diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index fc1f00438a95a..60f01d1959a9f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -164,7 +164,7 @@ # ServiceLabel: %Cognitive - Health Insights # PRLabel: %Cognitive - Health Insights -/sdk/healthinsights/ @tomsft +/sdk/healthinsights/ @tomsft @koen-mertens # AzureSdkOwners: @mccoyp # ServiceLabel: %KeyVault @@ -221,7 +221,7 @@ # ServiceLabel: %Cosmos # PRLabel: %Cosmos -/sdk/cosmos/ @kushagraThapar @simorenoh @xinlian12 @annatisch @bambriz @pilchie +/sdk/cosmos/ @annatisch @Azure/azure-cosmos-python-sdk # ServiceLabel: %Cosmos %Service Attention #// @pjohari-ms @simorenoh @AbhinavTrips @bambriz @pilchie @@ -265,27 +265,7 @@ # ServiceOwners: @azureml-github @Azure/azure-ml-sdk # PRLabel: %Machine Learning -/sdk/ml/ @paulshealy1 @singankit @diondrapeck @luigiw @kdestin @MilesHolland @needuv @achauhan-scc @kingernupur @ninghu @YusakuNo1 - -# PRLabel: %ML-Data -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_data/ @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_datastore/ @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_feature_store/ @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_feature_set/ @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_feature_store_entity/ @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/assets/data.py @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_assets/_artifacts/data.py @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_assets/_artifacts/feature_set.py @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_data/ @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_feature_store/ @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_feature_store_entity/ @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_feature_set/ @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_data_operations.py @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_datastore_operations.py @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_feature_store_operations.py @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_feature_store_entity_operations.py @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_feature_set_operations.py @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur -/sdk/ml/data-experiences.tests.yml @sogansky @code-vicar @pritamDas9191 @achauhan-scc @kingernupur +/sdk/ml/ @paulshealy1 @achauhan-scc @kingernupur # PRLabel: %ML-Local Endpoints /sdk/ml/azure-ai-ml/azure/ai/ml/_local_endpoints/ @NonStatic2014 @arunsu @JustinFirsching @@ -315,41 +295,11 @@ /sdk/ml/azure-ai-ml/azure/ai/ml/_internal/ @wangchao1230 /sdk/ml/pipeline.tests.yml @wangchao1230 @eniac871 -# PRLabel: %ML-RegistryManagement -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/registry/ @hugoaponte @Man-MSFT -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_registry_operations.py @hugoaponte @Man-MSFT -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_registry/ @hugoaponte @Man-MSFT - -# PRLabel: %ML-Assets -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/component/ @hugoaponte @Man-MSFT -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_component/ @hugoaponte @Man-MSFT -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_code_operations.py @hugoaponte @Man-MSFT -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_component_operations.py @hugoaponte @Man-MSFT -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_environment_operations.py @hugoaponte @Man-MSFT -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_model_operations.py @hugoaponte @Man-MSFT -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_assets/ @hugoaponte @Man-MSFT -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_deployment/ @hugoaponte @Man-MSFT -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_endpoint/ @hugoaponte @Man-MSFT -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/assets/ @hugoaponte @Man-MSFT - -# PRLabel: %ML-Inference -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_batch_deployment_operations.py @hugoaponte @Man-MSFT @nancy-mejia @TajiHarrisMicrosoft -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_batch_endpoint_operations.py @hugoaponte @Man-MSFT @nancy-mejia @TajiHarrisMicrosoft -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_online_deployment_operations.py @hugoaponte @Man-MSFT @nancy-mejia @TajiHarrisMicrosoft -/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_online_endpoint_operations.py @hugoaponte @Man-MSFT @nancy-mejia @TajiHarrisMicrosoft -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_deployment/ @hugoaponte @Man-MSFT @nancy-mejia @TajiHarrisMicrosoft -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_endpoint/ @hugoaponte @Man-MSFT @nancy-mejia @TajiHarrisMicrosoft -/sdk/ml/production-experiences.tests.yml @hugoaponte @Man-MSFT @nancy-mejia @TajiHarrisMicrosoft - # PRLabel: %ML-Workspace /sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/ @seanyao1 @debuggerXi /sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/ @seanyao1 @debuggerXi /sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_operations.py @seanyao1 @debuggerXi -# PRLabel: %ML-WorkspaceConnections -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/workspace/connections/ @paulshealy1 @singankit @diondrapeck @luigiw @kdestin @MilesHolland @needuv @achauhan-scc @kingernupur @ninghu @YusakuNo1 -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/connections/ @paulshealy1 @singankit @diondrapeck @luigiw @kdestin @MilesHolland @needuv @achauhan-scc @kingernupur @ninghu @YusakuNo1 - # PRLabel: %ML-ImportJob /sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job/import_job.py @xiongrenyi /sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/import_job.py @xiongrenyi @@ -572,7 +522,7 @@ #// @sgellock # ServiceLabel: %Cloud Shell %Service Attention -#// @maertendMSFT +#// @mbifeld # ServiceLabel: %Cognitive - Custom Vision %Service Attention #// @areddish @tburns10 @@ -812,7 +762,7 @@ #// @sffamily @chenkennt # ServiceLabel: %Service Attention %Storsimple -#// @anoobbacker @ganzee @manuaery @patelkunal +#// @anoobbacker @ganzee @manuaery # ServiceLabel: %Service Attention %Stream Analytics #// @atpham256 @@ -881,16 +831,15 @@ ########### # Eng Sys ########### -# TEMPORARY COMMENTING FOR PROOF-OF-CONCEPT. -#/eng/ @scbedd @weshaggard @benbp -#/eng/common/ @Azure/azure-sdk-eng -#/.github/workflows/ @Azure/azure-sdk-eng +/eng/ @scbedd @weshaggard @benbp +/eng/common/ @Azure/azure-sdk-eng +/.github/workflows/ @Azure/azure-sdk-eng -#/tools/ @scbedd @mccoyp +/tools/ @scbedd @mccoyp # Add owners for notifications for specific pipelines -#/eng/pipelines/templates/jobs/tests-nightly-python.yml @lmazuel @mccoyp -#/eng/pipelines/aggregate-reports.yml @lmazuel @mccoyp @YalinLi0312 -#/eng/common/pipelines/codeowners-linter.yml @lmazuel @mccoyp +/eng/pipelines/templates/jobs/tests-nightly-python.yml @lmazuel @mccoyp +/eng/pipelines/aggregate-reports.yml @lmazuel @mccoyp @YalinLi0312 +/eng/common/pipelines/codeowners-linter.yml @lmazuel @mccoyp /pylintrc @l0lawrence diff --git a/.github/workflows/event.yml b/.github/workflows/event.yml index 1efb7a7e9b129..6a973b4277fbd 100644 --- a/.github/workflows/event.yml +++ b/.github/workflows/event.yml @@ -18,7 +18,7 @@ jobs: pull-requests: write # to read pull requests and write comments (azure/azure-sdk-actions) checks: read # to read check status (azure/azure-sdk-actions) name: Handle ${{ github.event_name }} ${{ github.event.action }} event - runs-on: ubuntu-latest + runs-on: ubuntu-latest # This image is intentionally set to "latest", and not to a specific version steps: - uses: azure/azure-sdk-actions@main with: diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 812b93d73d4e3..e65bad8a37b3f 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -1818,7 +1818,12 @@ "Nify", "loinc", "wday", - "SNOMED" + "SNOMED", + "lobulated", + "pericholecystic", + "craniocaudally", + "angiomyolipomas", + "Omnipaque" ] }, { diff --git a/doc/analyze_check_versions.md b/doc/analyze_check_versions.md new file mode 100644 index 0000000000000..6e3bcca57771d --- /dev/null +++ b/doc/analyze_check_versions.md @@ -0,0 +1,12 @@ +# Analyze check versions + +This table is to clarify the currently pinned version of tools we run in CI and when versions for the tools will be bumped to keep up with the latest improvements and bug fixes. + + +| Tool | Current Version | Next Version | Next Version Merge Date | +|------|-----------------|--------------|-------------------------| +Pylint | 3.1.0 | 3.2.5 | 2024-10-14 | +MyPy | 1.9.0 | 1.10.1 | 2024-10-14 | +Pyright | 1.1.359 | 1.1.371 | 2024-10-14 | +Sphinx | 7.3.7 | N/A | N/A | +Black | 24.4.0 | N/A | N/A | diff --git a/doc/dev/test_proxy_troubleshooting.md b/doc/dev/test_proxy_troubleshooting.md index ab39f10357e91..70b835331f5a0 100644 --- a/doc/dev/test_proxy_troubleshooting.md +++ b/doc/dev/test_proxy_troubleshooting.md @@ -260,13 +260,19 @@ While the test proxy is being invoked during the start of a test run, you may se PermissionError: [Errno 13] Permission denied: '.../azure-sdk-for-python/.proxy/Azure.Sdk.Tools.TestProxy' ``` -This means that the test proxy tool was successfully installed at the location in the error message, but we don't have +This can mean that the test proxy tool was successfully installed at the location in the error message, but we don't have sufficient permissions to run it with the tool startup script. We can set the correct permissions on the file by using `chmod`. Using the tool path that was provided in the `PermissionError` message, run the following command: ``` chmod +x .../azure-sdk-for-python/.proxy/Azure.Sdk.Tools.TestProxy ``` +Alternatively, you can delete the installed tool and re-run your tests to automatically reinstall it correctly. + +- Open Task Manager, search for a process named "Azure.Sdk.Tools.TestProxy", and end the task if one is running. +- Delete the `.proxy` folder at the root of your local `azure-sdk-for-python` clone. +- Re-run your tests; the test proxy will be reinstalled and should correctly set file permissions. + [custom_default_matcher]: https://github.com/Azure/azure-sdk-for-python/blob/497f5f3435162c4f2086d1429fc1bba4f31a4354/tools/azure-sdk-tools/devtools_testutils/sanitizers.py#L85 [detailed_docs]: https://github.com/Azure/azure-sdk-tools/tree/main/tools/test-proxy/Azure.Sdk.Tools.TestProxy/README.md diff --git a/doc/dev/tests-advanced.md b/doc/dev/tests-advanced.md index eb74828a30714..b5e9dbe98e8f2 100644 --- a/doc/dev/tests-advanced.md +++ b/doc/dev/tests-advanced.md @@ -1,25 +1,24 @@ -# Setup Python Development Environment - Advanced -In this document we will provide additional information about the test environments: +# Python SDK advanced testing guide +This guide covers advanced testing scenarios for Azure SDK for Python libraries. -- [Setup Python Development Environment - Advanced](#setup-python-development-environment---advanced) - - [Test Mixin Classes](#test-mixin-classes) - - [Preparers](#preparers) - - [Examples with Preparers](#examples-with-preparers) - - [Example 2: Basic Preparer Usage with Storage](#example-2-basic-preparer-usage-with-storage) - - [Example 3: Cached Preparer Usage](#example-3-cached-preparer-usage) - - [mgmt\_settings\_real file](#mgmt_settings_real-file) +## Table of contents -## Test Mixin Classes -Many of our test suites use a mixin class to reduce re-writing code in multiple test files. For example, in the Tables test suite there is a `_shared` directory containing two of these mixin classes, a [sync one](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/tests/_shared/testcase.py) and an [async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/tests/_shared/asynctestcase.py). These classes will often have ways to create connection strings from an account name and key, formulate the account url, configure logging, or validate service responses. In order for these mixin classes to be used by both the functional and unit tests they should inherit from `object`. For example: +- [Mixin classes](#test-mixin-classes) +- [Pre-test setup](#pre-test-setup) + - [xunit-style setup](#xunit-style-setup) + - [Fixture setup](#fixture-setup) -```python +## Mixin classes +Many of our test suites use a base/mixin class to consolidate shared test logic. Mixin classes can define instance attributes to handle environment variables, make complex assertions, and more. By inheriting from these mixins, test classes can then share this logic throughout multiple files. + +For example, in the Tables test suite there is a `_shared` directory containing two of these mixin classes: a [sync version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/tests/_shared/testcase.py) and an [async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/tests/_shared/asynctestcase.py). -class TablesTestMixin(object): - def connection_string(self, account, key): - return "DefaultEndpointsProtocol=https;AccountName=" + account + ";AccountKey=" + str(key) + ";EndpointSuffix=core.windows.net" +```python +class TableTestCase(object): def account_url(self, account, endpoint_type): """Return an url of storage account. + :param str storage_account: Storage account name :param str storage_type: The Storage type part of the URL. Should be "table", or "cosmos", etc. """ @@ -27,44 +26,49 @@ class TablesTestMixin(object): if endpoint_type == "table": return account.primary_endpoints.table.rstrip("/") if endpoint_type == "cosmos": - return "https://{}.table.cosmos.azure.com".format(account.name) - else: - raise ValueError("Unknown storage type {}".format(storage_type)) - except AttributeError: # Didn't find "primary_endpoints" + cosmos_suffix = os.getenv("TABLES_COSMOS_ENDPOINT_SUFFIX", DEFAULT_COSMOS_ENDPOINT_SUFFIX) + return f"https://{account.name}.table.{cosmos_suffix}" + except AttributeError: # Didn't find "account.primary_endpoints" if endpoint_type == "table": - return 'https://{}.{}.core.windows.net'.format(account, endpoint_type) + storage_suffix = os.getenv("TABLES_STORAGE_ENDPOINT_SUFFIX", DEFAULT_STORAGE_ENDPOINT_SUFFIX) + return f"https://{account}.table.{storage_suffix}" if endpoint_type == "cosmos": - return "https://{}.table.cosmos.azure.com".format(account) - - def enable_logging(self): - handler = logging.StreamHandler() - handler.setFormatter(logging.Formatter(LOGGING_FORMAT)) - self.logger.handlers = [handler] - self.logger.setLevel(logging.INFO) - self.logger.propagate = True - self.logger.disabled = False + cosmos_suffix = os.getenv("TABLES_COSMOS_ENDPOINT_SUFFIX", DEFAULT_COSMOS_ENDPOINT_SUFFIX) + return f"https://{account}.table.{cosmos_suffix}" + + ... + + def _assert_delete_retention_policy_equal(self, policy1, policy2): + """Assert that two deletion retention policies are equal.""" + if policy1 is None or policy2 is None: + assert policy1 == policy2 + return + + assert policy1.enabled == policy2.enabled + assert policy1.days == policy2.days + + ... ``` In action this class can be used in functional tests: ```python -class TestTablesFunctional(AzureTestCase, TablesTestMixin): - ... - def test_with_mixin(self, account, key): - conn_str = self.connection_string(account, key) - client = TableClient.from_connection_string(conn_str) - client.create_table('first') - client.create_table('second') - tables = 0 - for table in client.list_tables(): - tables += 1 - - assert tables == 2 +class TestTable(AzureRecordedTestCase, TableTestCase): + @tables_decorator + @recorded_by_proxy + def test_create_properties(self, tables_storage_account_name, tables_primary_storage_account_key): + # # Arrange + account_url = self.account_url(tables_storage_account_name, "table") + ts = TableServiceClient(credential=tables_primary_storage_account_key, endpoint=account_url) + table_name = self._get_table_reference() + # Act + created = ts.create_table(table_name) + ... ``` Or can be used in a unit test: ```python -class TestTablesUnit(TablesTestMixin): +class TestTablesUnit(TableTestCase): ... def test_valid_url(self): account = "fake_tables_account" @@ -74,114 +78,77 @@ class TestTablesUnit(TablesTestMixin): client = TableClient(account_url=url, credential=credential) assert client is not None - assert client.account_url == "https://{}.tables.core.windows.net/".format(account) + assert client.account_url == f"https://{account}.tables.core.windows.net/" ``` -## Preparers - -The Azure SDK team has created some in house tools to help with easier testing. These additional tools are located in the `devtools_testutils` package that was installed with your `dev_requirements.txt`. In this package are the preparers that will be commonly used throughout the repository to test various resources. A preparer is a way to programmatically create fresh resources to run our tests against and then deleting them after running a test suite. These help guarantee standardized behavior by starting each test group from a fresh resource and account. +## Pre-test setup +Tests will often use shared resources that make sense to set up before tests execute. There are two recommended +approaches for this kind of setup, with each having benefits and drawbacks. -If this situation is a requirement for your tests, you can opt to create a new preparer for your service from the management plane library for a service. There are already a few preparers built in the [devtools_testutils](https://github.com/Azure/azure-sdk-for-python/tree/main/tools/azure-sdk-tools/devtools_testutils). Most prepares will start with the [`ResourceGroupPreparer`](https://github.com/Azure/azure-sdk-for-python/blob/main/tools/azure-sdk-tools/devtools_testutils/resource_testcase.py#L29-L99) to first create a resource group for your service. - -To build your own preparer you will need to use the management plane library to create a service and pass the credentials you need into your tests. The two important methods for a preparer are the `create_resource` and `remove_resource` methods. In the `create_resource` method you will use the management client to create the resource and return a dictionary of key-value pairs. The keys will be matched with the test method parameters and passed in as positional arguments to the test. The `remove_resource` method will clean up and remove the resource to prevent a backlog of unused resources in your subscription. For examples of each of these methods, check out these examples: - -| Preparer | `create_resource` | `remove_resource` | -|-|-|-| -| Resource Group | [link](https://github.com/Azure/azure-sdk-for-python/blob/main/tools/azure-sdk-tools/devtools_testutils/resource_testcase.py#L57-L85) | [link](https://github.com/Azure/azure-sdk-for-python/blob/main/tools/azure-sdk-tools/devtools_testutils/resource_testcase.py#L87-L99) | -| Storage Account | [link](https://github.com/Azure/azure-sdk-for-python/blob/main/tools/azure-sdk-tools/devtools_testutils/storage_testcase.py#L53-L102) | [link](https://github.com/Azure/azure-sdk-for-python/blob/main/tools/azure-sdk-tools/devtools_testutils/storage_testcase.py#L104-L107) | - -## Examples with Preparers - -### Example 2: Basic Preparer Usage with Storage +### xunit-style setup +Pytest has documentation describing this setup style: https://docs.pytest.org/en/latest/how-to/xunit_setup.html. For +example: ```python -import os -import pytest - -from azure.data.tables import TableServiceClient -from devtools_testutils import ( - AzureTestCase, - ResourceGroupPreparer, - StorageAccountPreparer -) +from devtools_testutils.azure_recorded_testcase import get_credential + +class TestService(AzureRecordedTestCase): + def setup_method(self, method): + """This method is called before each test in the class executes.""" + credential = self.get_credential(ServiceClient) # utility from parent class + self.client = ServiceClient("...", credential) + + @classmethod + def setup_class(cls): + """This method is called only once, before any tests execute.""" + credential = get_credential() # only module-level and classmethod utilities are available + cls.client = ServiceClient("...", credential) +``` -class ExampleStorageTestCase(AzureTestCase): +The primary benefit of using `setup_method` is retaining access to the utilities provided your test class. You could +use `self.get_credential`, for example, to pick up our core utility for selecting a client credential based on your +environment. A drawback is that `setup_method` runs before each test method in the class, so your setup needs to be +idempotent to avoid issues caused by repeated invocations. - @ResourceGroupPreparer() - @StorageAccountPreparer() - def test_create_table(self, resource_group, location, storage_account, storage_account_key): - account_url = self.account_url(storage_account, "table") - client = self.create_client_from_credential(TableServiceClient, storage_account_key, account_url=account_url) +Alternatively, the class-level `setup_class` method runs once before all tests, but doesn't give you access to all +instance attributes on the class. You can still set attributes on the test class to reference from tests, and +module-level utilities can be used in place of instance attributes, as shown in the example above. - valid_table_name = "validtablename" - table = client.create_table(valid_table_name) +### Fixture setup +Pytest has documentation explaining how to implement and use fixtures: +https://docs.pytest.org/en/latest/how-to/fixtures.html. For example, in a library's `conftest.py`: - assert valid_table_name == table.table_name +```python +from devtools_testutils.azure_recorded_testcase import get_credential + +@pytest.fixture(scope="session") +def setup_teardown_fixture(): + # Note that we can't reference AzureRecordedTestCase.get_credential but can use the module-level function + client = ServiceClient("...", get_credential()) + client.set_up_resource() + yield # <-- Tests run here, and execution resumes after they finish + client.tear_down_resources() ``` -This test uses preparers to create resources, then creates a table, and finally verifies the name is correct. - -Notes: -1. This test is aiming to create a new Table, which requires a storage account, which in hand requires a resource group. The first decorator (`@ResourceGroupPreparer()`) creates a new resource group, and passes the parameters of this resource group into the `@StorageAccountPreparer()` which creates the storage account. The parameters from the storage account creation is passed into the signature of `test_create_table` . -2. The `create_client_from_credential` is used again but this time with `storage_account_key` instead of getting a credential from the `self.get_credential` method showed in the previous section. The storage account preparer returns the key for the account which is a valid credential. - +We can then request the fixture from a test class: -### Example 3: Cached Preparer Usage ```python -import os -import pytest - -from azure.core.exceptions import ResourceExistsError -from azure.data.tables import TableServiceClient -from devtools_testutils import ( - AzureTestCase, - CachedResourceGroupPreparer, - CachedStorageAccountPreparer -) - -class ExampleStorageTestCase(AzureTestCase): - - @CachedResourceGroupPreparer(name_prefix="storagetest") - @CachedStorageAccountPreparer(name_prefix="storagetest") - def test_create_table(self, resource_group, location, storage_account, storage_account_key): - account_url = self.account_url(storage_account, "table") - client = self.create_client_from_credential(TableServiceClient, storage_account_key, account_url=account_url) - - valid_table_name = "validtablename" - table = client.create_table(valid_table_name) - - assert valid_table_name == table.table_name - - @CachedResourceGroupPreparer(name_prefix="storagetest") - @CachedStorageAccountPreparer(name_prefix="storagetest") - def test_create_table_if_exists (self, resource_group, location, storage_account, storage_account_key): - account_url = self.account_url(storage_account, "table") - client = self.create_client_from_credential(TableServiceClient, storage_account_key, account_url=account_url) - - valid_table_name = "validtablename" - with pytest.raises(ResourceExistsError): - table = client.create_table(valid_table_name) +@pytest.mark.usefixtures("setup_teardown_fixture") +class TestService(AzureRecordedTestCase): + ... ``` -The first test is the same as above, the second test tries to create a table that already exists and asserts that the correct type of error is raised in response. These tests use cached preparers unlike the previous example. - -Notes: -1. The cached preparers here will first look to see if an existing resource group or storage account exists with the given parameters, in this case the `name_prefix`. For more information on what parameters differentiate a new resource group or storage account look for the `self.set_cache()` method in the preparer source code [here](https://github.com/Azure/azure-sdk-for-python/blob/main/tools/azure-sdk-tools/devtools_testutils/storage_testcase.py#L49). The advantage to using a cached preparer is the time saver to re-using the same resource instead of creating a new resource for each test. However, this can increase the possibility that you have to be more exact about cleaning up the entities created in between test runs. +By requesting a fixture from the test class, the fixture will execute before any tests in the class do. Fixtures are the +preferred solution from pytest's perspective and offer a great deal of modular functionality. -## mgmt_settings_real file +As shown in the example above, the +[`yield`](https://docs.pytest.org/latest/how-to/fixtures.html#yield-fixtures-recommended) command will defer to test +execution -- after tests finish running, the fixture code after `yield` will execute. This enables the use of a fixture +for both setup and teardown. -A `mgmt_settings_real.py` can be used in place of a `.env` file by copying `sdk/tools/azure-sdk-tools/devtools_testutils/mgmt_settings_fake.py` to `sdk/tools/azure-sdk-tools/devtools_testutils/mgmt_settings_real.py` and providing real credentials to it. The following changes need to be made to the `mgmt_settings_real.py` file: +However, fixtures in this context have similar drawbacks to the `setup_class` method described in +[xunit-style setup](#xunit-style-setup). Since their scope is outside of the test class, test class instance utilities +can't be accessed and class state can't be modified. -1. Change the value of the `SUBSCRIPTION_ID` variable to your organizations subscription ID, which can be found in the "Overview" section of the "Subscriptions" blade in the [Azure portal](https://portal.azure.com/). -2. Define `TENANT_ID`, `CLIENT_ID`, and `CLIENT_SECRET`, which are available after creating a Service Principal or can be retrieved from the Azure Portal after creating a Service Principal. Check out the [Azure docs](https://docs.microsoft.com/cli/azure/ad/sp?view=azure-cli-latest#az_ad_sp_create_for_rbac) to create a Service Principal with a simple one line command to create one. The recommended practice is to include your alias or name in the Service Principal name. -3. Change the [`get_azure_core_credentials(**kwargs):`](https://github.com/Azure/azure-sdk-for-python/blob/main/tools/azure-sdk-tools/devtools_testutils/mgmt_settings_fake.py#L39-L53) function in the `mgmt_settings_real.py` file to construct and return a `ClientSecretCredential` object. Pass in the `CLIENT_ID`, `CLIENT_SECRET`, and `TENANT_ID` values to the `ClientSecretCredential` object. This method should look like this: -```python -def get_azure_core_credentials(**kwargs): - from azure.identity import ClientSecretCredential - import os - return ClientSecretCredential( - client_id = CLIENT_ID, - client_secret = CLIENT_SECRET, - tenant_id = TENANT_ID - ) -``` \ No newline at end of file +By convention, fixtures should be defined in a library's `tests/conftest.py` file. This will provide access to the +fixture across test files, and the fixture can be requested without having to manually import it. diff --git a/doc/dev/tests.md b/doc/dev/tests.md index f0d8ebd34e6af..a67339b5d92f3 100644 --- a/doc/dev/tests.md +++ b/doc/dev/tests.md @@ -340,6 +340,9 @@ AzureRecordedTestCase, EnvironmentVariableLoader, recorded_by_proxy`. If you need logging functionality for your testing, pytest also offers [logging][pytest_logging] capabilities either inline through the `caplog` fixture or with command line flags. +If your tests use shared resources or configuration that needs to be set up at test-running time, you can refer to the +[Pre-test setup][setup] section of our advanced testing guide for recommended practices. + ### Configure live or playback testing mode "Live" tests refer to tests that make requests to actual Azure resources. "Playback" tests require a recording for each @@ -516,10 +519,13 @@ Some sanitizers IDs that are often opted out of are: ## Functional vs. unit tests -The tests written above are functional tests: they generate HTTP traffic and send data to the service. For tests that -don't need to make HTTP requests -- i.e. unit tests -- the best practice is to have a separate test class from the one -containing functional tests. For example, the `azure-data-tables` package has client-side validation for the table name -and properties of the entity; below is an example of how these could be tested: +The tests written above are functional tests: they generate HTTP traffic and send data to the service. Client operations +that interact with the service should be tested by functional tests wherever possible. + +Tests that don't make HTTP requests -- e.g. tests for model serialization or mocked service interactions for complex +scenarios -- can be referred to as "unit tests". For unit tests, the best practice is to have a separate test class +from the one containing functional tests. For example, the `azure-data-tables` package has client-side validation for +the table name and properties of the entity; below is an example of how these could be tested: ```python import pytest @@ -600,6 +606,7 @@ For information about more advanced testing scenarios, refer to the [advanced te [pytest_logging]: https://docs.pytest.org/en/stable/logging.html [python-dotenv_readme]: https://github.com/theskumar/python-dotenv [recording_move]: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/recording_migration_guide.md +[setup]: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/tests-advanced.md#pre-test-setup [test_proxy_sanitizers]: https://github.com/Azure/azure-sdk-tools/blob/57382d5dc00b10a2f9cfd597293eeee0c2dbd8fd/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SanitizerDictionary.cs#L65 [test_proxy_startup]: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/test_proxy_migration_guide.md#start-the-proxy-server [test_resources]: https://github.com/Azure/azure-sdk-for-python/tree/main/eng/common/TestResources#readme diff --git a/doc/repo_health_status.md b/doc/repo_health_status.md new file mode 100644 index 0000000000000..c4921da59c7f8 --- /dev/null +++ b/doc/repo_health_status.md @@ -0,0 +1,129 @@ +# Python SDK Health Status Report + +The Python health status report is used to get a quick glance of our SDK health and whether a library can pass CI checks to release the package. + +[aka.ms/azsdk/python/health](https://www.aka.ms/azsdk/python/health) + +## Need help? + +If this document does not answer your question, please post on the [Language - Python](https://teams.microsoft.com/l/channel/19%3Ab97d98e6d22c41e0970a1150b484d935%40thread.skype/Language%20-%20Python?groupId=3e17dcb0-4257-4a30-b843-77f47f1d4121&tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47) Teams channel. + +## Overview + +The health report collects statuses from the most recent scheduled pipelines for your library. This includes your release pipeline (`python - {service-directory}`), your live tests pipeline (`python - {service-directory} - tests`), and your live tests-weekly pipeline (`python - {service-directory} - tests-weekly`). If a pipeline result is available, you can click on the status in the report to view the build result. + +The following are required, release-blocking checks: `MyPy`, `Pylint`, `Sphinx`, and `Tests - CI`. If any of these checks are failing, your library will be blocked from releasing. If any of these checks are disabled, your library may be blocked from release in the future. If any of these are in a warning state, your library is not blocked from release today, but may be blocked in the near future. See below for more information on each check. + +> Note: A check can be re-enabled by removing the `check = false` from the library's pyproject.toml file. See [eng_sys_checks.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/eng_sys_checks.md#the-pyprojecttoml) for more information on how we use pyproject.toml in this repo. + +## Explained + +The health report is broken down into the following sections: + +- [Status](#status) +- [MyPy](#mypy-required-check) +- [Pylint](#pylint-required-check) +- [Sphinx](#sphinx-required-check) +- [Tests - CI](#tests---ci-required-check) +- [Tests - Live](#tests---live) +- [Pyright](#pyright) +- [Type check samples](#type-check-samples) +- [SLA - Bugs](#sla---bugs) +- [SLA - Questions](#sla---questions) +- [Total customer-reported issues](#total-customer-reported-issues) + +### Status: + +This is the overall status of your library and indicates whether you can release your library today. + +- $${\color{red}BLOCKED}$$ - your library is currently blocked from release. It is failing required/mandatory checks (marked in red) or has its CI disabled due to non-compliance with required checks. + + If your CI has been disabled, please take action to re-enable and fix all checks highlighted in yellow. Once all checks are fixed, you can remove the `ci_enabled=false` from your library's pyrpoject.toml file. + +- $${\color{yellow}NEEDS \space ACTION}$$ - your library is not blocked from release today, but if action(s) are not taken, it may be blocked in the near future. Please take action to fix/re-enable any checks highlighted in yellow. + +- $${\color{green}GOOD}$$ - your library is passing and in compliance with all required checks and can release without issues. + +### MyPy (required check): + +[MyPy](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/eng_sys_checks.md#mypy) is a static type checker, and is mandatory to run on the source code of all libraries. To learn more about static type checking in our repo, see our [Static Type Checking Guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/static_type_checking.md). Possible statuses include: + +- $${\color{red}FAILED}$$ - The library is failing the MyPy check. Check the build result and address the errors present. This will block the release of your library and should be fixed immediately. +- $${\color{yellow}DISABLED}$$ - MyPy is not enabled for your library in the pyproject.toml file. This is a required check and must be enabled. If not enabled, your library will be blocked from release in the near future. +- $${\color{yellow}WARNING}$$ - The library passes the currently pinned version of MyPy in the repo, but is failing the next-mypy check (the next version of MyPy the repo will be bumped to in the near future). Please fix these errors before the merge date of the next version of MyPy or the errors will begin to fail the build (See [analyze_check_versions.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/analyze_check_versions.md)) to understand target dates for version bumps. +- $${\color{green}GOOD}$$ - The library passes both current MyPy and next-MyPy. +- $${\color{black}UNKNOWN}$$ - A result was not available for the most recent scheduled build. This could be due to an upstream pipeline failure preventing this particular check from running or a missing pipeline. Please ensure your pipeline builds are free of errors so that a Status for your library can be determined. + +### Pylint (required check): + +[Pylint](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/eng_sys_checks.md#pylint) is a linter, and is mandatory to run on all libraries. To learn more about linting in our repo, see our [Pylint Guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/pylint_checking.md). Possible statuses include: + +- $${\color{red}FAILED}$$ - The library is failing the Pylint check. Check the build result and address the errors present. This will block the release of your library and should be fixed immediately. +- $${\color{yellow}DISABLED}$$ - Pylint is not enabled for your library in the pyproject.toml file. This is a required check and must be enabled. If not enabled, your library will be blocked from release in the near future. +- $${\color{yellow}WARNING}$$ - The library passes the currently pinned version of Pylint in the repo, but is failing the next-pylint check (the next version of Pylint the repo will be bumped to in the near future). Please fix these errors before the merge date of the next version of Pylint or the errors will begin to fail the build (See [analyze_check_versions.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/analyze_check_versions.md)) to understand target dates for version bumps. +- $${\color{green}GOOD}$$ - The library passes both current Pylint and next-Pylint. +- $${\color{black}UNKNOWN}$$ - A result was not available for the most recent scheduled build. This could be due to an upstream pipeline failure preventing this particular check from running or a missing pipeline. Please ensure your pipeline builds are free of errors so that a Status for your library can be determined. + +### Sphinx (required check): + +[Sphinx](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/eng_sys_checks.md#sphinx-and-docstring-checker) is a tool which builds/validates our documentation, and is mandatory to run on all libraries. To learn more about Sphinx/docstrings in our repo, see [Docstrings](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/docstring.md). Possible statuses include: + +- $${\color{red}FAILED}$$ - The library is failing the Sphinx check. Check the build result and address the errors present. This will block the release of your library and should be fixed immediately. +- $${\color{yellow}DISABLED}$$ - Sphinx is not enabled for your library in the pyproject.toml file. This is a required check and must be enabled. If not enabled, your library will be blocked from release in the near future. +- $${\color{green}GOOD}$$ - The library passes Sphinx. +- $${\color{black}UNKNOWN}$$ - A result was not available for the most recent scheduled build. This could be due to an upstream pipeline failure preventing this particular check from running or a missing pipeline. Please ensure your pipeline builds are free of errors so that a Status for your library can be determined. + +### Tests - CI (required check): + +[Tests - CI](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/eng_sys_checks.md#pr-validation-tox-test-environments) checks the status of the most recent (python - {service-directory})scheduled build of your library's recorded tests. This is the same CI that will run when triggering a release build. To learn more about tests in our repo, see our [Testing Guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/tests.md). Possible statuses include: + +- $${\color{red}FAILED}$$ - The library is failing CI recorded tests. Check the build result and address the errors present. This will block the release of your library and should be fixed immediately. +- $${\color{yellow}DISABLED}$$ - The library has its CI disabled due to non-compliance with required checks. Please take action to re-enable and fix all checks highlighted in yellow. Once all checks are fixed, you can remove the `ci_enabled=false` from your library's pyproject.toml file. +- $${\color{green}GOOD}$$ - The library passes CI recorded tests. +- $${\color{black}UNKNOWN}$$ - A result was not available for the most recent scheduled build. This could be due to an upstream pipeline failure preventing this particular check from running or a missing pipeline. Please ensure your pipeline builds are free of errors so that a Status for your library can be determined. + +### Tests - Live: + +[Tests - Live](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/eng_sys_checks.md#nightly-live-checks) checks the status of the most recent (python - {service-directory} - tests)scheduled build of your library's live tests. To learn more about setting up live tests in our repo, see our [Testing Guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/tests.md). Possible statuses include: + +- $${\color{red}FAILED}$$ - The library is failing live tests. Errors should be investigated and fixed promptly to ensure there are no issues with releasing the current state of your library. +- $${\color{yellow}DISABLED}$$ - The library has its CI disabled due to non-compliance with required checks. Please take action to re-enable and fix all checks highlighted in yellow. Once all checks are fixed, you can remove the `ci_enabled=false` from your library's pyproject.toml file. +- $${\color{green}GOOD}$$ - The library passes live tests. +- $${\color{black}UNKNOWN}$$ - A result was not available for the most recent scheduled build. This could be due to an upstream pipeline failure preventing this particular check from running or a missing pipeline. Please ensure your pipeline builds are free of errors so that a Status for your library can be determined. + +### Pyright: + +[Pyright](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/eng_sys_checks.md#pyright) is a static type checker, and is recommended to run on the source code of all libraries. To learn more about static type checking in our repo, see our [Static Type Checking Guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/static_type_checking.md). Possible statuses include: + +- $${\color{red}FAILED}$$ - Pyright is enabled for the library and the library is failing the check. This will block the release of your library and should be fixed immediately. +- $${\color{yellow}DISABLED}$$ - Pyright is not enabled for your library in the pyproject.toml file. +- $${\color{yellow}WARNING}$$ - Pyright is enabled for the library and the library passes the currently pinned version of Pyright in the repo, but is failing the next-pyright check (the next version of Pyright the repo will be bumped to in the near future). Please fix these errors before the merge date of the next version of Pyright or the errors will begin to fail the build (See [analyze_check_versions.md](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/analyze_check_versions.md)) to understand target dates for version bumps. +- $${\color{green}GOOD}$$ - The library passes both current Pyright and next-pyright. +- $${\color{black}UNKNOWN}$$ - A result was not available for the most recent scheduled build. This could be due to an upstream pipeline failure preventing this particular check from running or a missing pipeline. Please ensure your pipeline builds are free of errors so that a Status for your library can be determined. + +### Type check samples: + +This `type_check_samples` option in the pyproject.toml is a recommended check that indicates whether type checkers should run on the library's samples/ directory. The actual status of the check is reported with the MyPy and Pyright (if enabled) status. Possible values include: + +- $${\color{black}ENABLED}$$ - The library opts-in to running type checking on the samples directory. +- $${\color{black}DISABLED}$$ - The library does not run type checking on the samples directory. + +### SLA - Bugs + +`SLA - Bugs` reports a count of the total number of customer-reported bugs that have been open for the library for greater than 90 days. It uses this filter: + +> is:open is:issue label:customer-reported label:Client -label:issue-addressed -label:question -label:needs-author-feedback -label:feature-request label:"[library-label]" created:"[<90days]" + +Any number greater than zero indicates that the SLA has been violated. Please investigate and address these bugs immediately. + +### SLA - Questions + +`SLA - Questions` reports a count of the total number of customer-reported questions that have been open for the library for greater than 30 days. It uses this filter: + +> is:open is:issue label:customer-reported label:Client -label:issue-addressed -label:bug -label:needs-author-feedback -label:feature-request label:"[library-label]" created:"[<30days]" + +Any number greater than zero indicates that the SLA has been violated. Please investigate and address these questions immediately. + +### Total customer-reported issues + +This the total number of `customer-reported` labeled issues that are currently open for the library. This includes bugs, questions, and other types of issues. Please investigate and address these issues promptly. diff --git a/eng/common/TestResources/SubConfig-Helpers.ps1 b/eng/common/TestResources/SubConfig-Helpers.ps1 index b2ee24e6d66c5..8df6440fe7eca 100644 --- a/eng/common/TestResources/SubConfig-Helpers.ps1 +++ b/eng/common/TestResources/SubConfig-Helpers.ps1 @@ -82,7 +82,8 @@ function ShouldMarkValueAsSecret([string]$serviceName, [string]$key, [string]$va "TenantId", "TestApplicationId", "TestApplicationOid", - "ProvisionerApplicationId" + "ProvisionerApplicationId", + "ProvisionerApplicationOid" ) $serviceDirectoryPrefix = BuildServiceDirectoryPrefix $serviceName @@ -129,7 +130,7 @@ function SetSubscriptionConfiguration([object]$subscriptionConfiguration) return $subscriptionConfiguration } -function UpdateSubscriptionConfiguration([object]$subscriptionConfigurationBase, [object]$subscriptionConfiguration) +function UpdateSubscriptionConfiguration([object]$subscriptionConfigurationBase, [object]$subscriptionConfiguration, [array]$allowedValues) { foreach ($pair in $subscriptionConfiguration.GetEnumerator()) { if ($pair.Value -is [Hashtable]) { @@ -140,13 +141,13 @@ function UpdateSubscriptionConfiguration([object]$subscriptionConfigurationBase, # Mark values as secret so we don't print json blobs containing secrets in the logs. # Prepend underscore to the variable name, so we can still access the variable names via environment # variables if they get set subsequently. - if (ShouldMarkValueAsSecret "AZURE_" $nestedPair.Name $nestedPair.Value) { + if (ShouldMarkValueAsSecret "AZURE_" $nestedPair.Name $nestedPair.Value $allowedValues) { Write-Host "##vso[task.setvariable variable=_$($nestedPair.Name);issecret=true;]$($nestedPair.Value)" } $subscriptionConfigurationBase[$pair.Name][$nestedPair.Name] = $nestedPair.Value } } else { - if (ShouldMarkValueAsSecret "AZURE_" $pair.Name $pair.Value) { + if (ShouldMarkValueAsSecret "AZURE_" $pair.Name $pair.Value $allowedValues) { Write-Host "##vso[task.setvariable variable=_$($pair.Name);issecret=true;]$($pair.Value)" } $subscriptionConfigurationBase[$pair.Name] = $pair.Value @@ -155,3 +156,66 @@ function UpdateSubscriptionConfiguration([object]$subscriptionConfigurationBase, return $subscriptionConfigurationBase } + +# Helper function for processing sub config files from a pipeline file list yaml parameter +function UpdateSubscriptionConfigurationWithFiles([object]$baseSubConfig, [string]$fileListJson) { + if (!$fileListJson) { + return $baseSubConfig + } + + $finalConfig = $baseSubConfig + + $subConfigFiles = $fileListJson | ConvertFrom-Json -AsHashtable + foreach ($file in $subConfigFiles) { + # In some cases, $file could be an empty string. Get-Content will fail + # if $file is an empty string, so skip those cases. + if (!$file) { + continue + } + + Write-Host "Merging sub config from file: $file" + $subConfig = Get-Content $file | ConvertFrom-Json -AsHashtable + $allowedValues = @() + # Since the keys are all coming from a file in github, we know every key should not be marked + # as a secret. Set up these exclusions here to make pipeline log debugging easier. + foreach ($pair in $subConfig.GetEnumerator()) { + if ($pair.Value -is [Hashtable]) { + foreach($nestedPair in $pair.Value.GetEnumerator()) { + $allowedValues += $nestedPair.Name + } + } else { + $allowedValues += $pair.Name + } + } + $finalConfig = UpdateSubscriptionConfiguration $finalConfig $subConfig $allowedValues + } + + return $finalConfig +} + +# Helper function for processing stringified json sub configs from pipeline parameter data +function BuildAndSetSubscriptionConfig([string]$baseSubConfigJson, [string]$additionalSubConfigsJson, [string]$subConfigFilesJson) { + $finalConfig = @{} + if ($baseSubConfigJson) { + $baseSubConfig = $baseSubConfigJson | ConvertFrom-Json -AsHashtable + + Write-Host "Setting base sub config" + $finalConfig = SetSubscriptionConfiguration $baseSubConfig + } + + if ($additionalSubConfigsJson) { + $subConfigs = $additionalSubConfigsJson | ConvertFrom-Json -AsHashtable + + foreach ($subConfig in $subConfigs) { + Write-Host "Merging sub config from list" + $finalConfig = UpdateSubscriptionConfiguration $finalConfig $subConfig + } + } + + Write-Host "Merging sub config from files" + $finalConfig = UpdateSubscriptionConfigurationWithFiles $finalConfig $subConfigFilesJson + + Write-Host ($finalConfig | ConvertTo-Json) + $serialized = $finalConfig | ConvertTo-Json -Compress + Write-Host "##vso[task.setvariable variable=SubscriptionConfiguration;]$serialized" +} diff --git a/eng/common/TestResources/build-test-resource-config.yml b/eng/common/TestResources/build-test-resource-config.yml index e3dd306449552..25de7ef33e3a5 100644 --- a/eng/common/TestResources/build-test-resource-config.yml +++ b/eng/common/TestResources/build-test-resource-config.yml @@ -37,50 +37,17 @@ steps: - pwsh: | . ./eng/common/TestResources/SubConfig-Helpers.ps1 - $finalConfig = @{} - $baseSubConfigRaw = @' + $baseSubConfigJson = @' ${{ parameters.SubscriptionConfiguration }} '@.Trim() - if ($baseSubConfigRaw) { - $baseSubConfig = $baseSubConfigRaw | ConvertFrom-Json -AsHashtable - Write-Host "Setting base sub config" - $finalConfig = SetSubscriptionConfiguration $baseSubConfig - } - - $subConfigJsonsRaw = @' + $additionalSubConfigsJson = @' ${{ convertToJson(parameters.SubscriptionConfigurations) }} '@.Trim() -replace '"{', '{' -replace '}"', '}' - if ($subConfigJsonsRaw) { - $subConfigs = $subConfigJsonsRaw | ConvertFrom-Json -AsHashtable - - foreach ($subConfig in $subConfigs) { - Write-Host "Merging sub config from list" - $finalConfig = UpdateSubscriptionConfiguration $finalConfig $subConfig - } - } - - $subConfigFilesRaw = @' + $subConfigFilesJson = @' ${{ convertToJson(parameters.SubscriptionConfigurationFilePaths) }} '@.Trim() - if ($subConfigFilesRaw) { - $subConfigFiles = $subConfigFilesRaw | ConvertFrom-Json -AsHashtable - foreach ($file in $subConfigFiles) { - # In some cases, $file could be an empty string. Get-Content will fail - # if $file is an empty string, so skip those cases. - if (!$file) { - continue - } - - Write-Host "Merging sub config from file: $file" - $subConfig = Get-Content $file | ConvertFrom-Json -AsHashtable - $finalConfig = UpdateSubscriptionConfiguration $finalConfig $subConfig - } - } - - Write-Host ($finalConfig | ConvertTo-Json) - $serialized = $finalConfig | ConvertTo-Json -Compress - Write-Host "##vso[task.setvariable variable=SubscriptionConfiguration;]$serialized" + BuildAndSetSubscriptionConfig $baseSubConfigJson $additionalSubConfigsJson $subConfigFilesJson displayName: Merge subscription configurations diff --git a/eng/common/pipelines/templates/steps/detect-api-changes.yml b/eng/common/pipelines/templates/steps/detect-api-changes.yml index f39a88eaa3a5d..8d605d8694b16 100644 --- a/eng/common/pipelines/templates/steps/detect-api-changes.yml +++ b/eng/common/pipelines/templates/steps/detect-api-changes.yml @@ -1,6 +1,5 @@ parameters: ArtifactPath: $(Build.ArtifactStagingDirectory) - Artifacts: [] ArtifactName: 'packages' steps: @@ -14,7 +13,6 @@ steps: inputs: filePath: $(Build.SourcesDirectory)/eng/common/scripts/Detect-Api-Changes.ps1 arguments: > - -ArtifactList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json | Select-Object Name) -ArtifactPath ${{parameters.ArtifactPath}} -CommitSha '$(Build.SourceVersion)' -BuildId $(Build.BuildId) diff --git a/eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml b/eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml index b455fec2100c9..1524ae8e1b8b8 100644 --- a/eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml +++ b/eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml @@ -21,7 +21,7 @@ steps: } if ((!"$(System.PullRequest.SourceBranch)".StartsWith("sync-.github/workflows")) -and "$(System.PullRequest.TargetBranch)" -match "^(refs/heads/)?$(DefaultBranch)$") { - $filesInCommonDir = & "eng/common/scripts/get-changedfiles.ps1" -DiffPath '.github/workflows/*' -DiffFilterType "" + $filesInCommonDir = & "eng/common/scripts/get-changedfiles.ps1" -DiffPath '.github/workflows/*event*' -DiffFilterType "" if (($LASTEXITCODE -eq 0) -and ($filesInCommonDir.Count -gt 0)) { Write-Host "##vso[task.LogIssue type=error;]Changes to files under '.github/workflows' directory should not be made in this Repo`n${filesInCommonDir}" diff --git a/eng/common/pipelines/templates/steps/publish-blobs.yml b/eng/common/pipelines/templates/steps/publish-blobs.yml index 2ba10037e18f2..a78d629e586b6 100644 --- a/eng/common/pipelines/templates/steps/publish-blobs.yml +++ b/eng/common/pipelines/templates/steps/publish-blobs.yml @@ -1,20 +1,14 @@ parameters: FolderForUpload: '' TargetLanguage: '' - BlobName: '' - ScriptPath: '' + BlobName: '' # To be removed once all usages are removed in the languages + BlobAccountName: 'https://azuresdkdocs.blob.core.windows.net' + ScriptPath: 'eng/common/scripts/copy-docs-to-blobstorage.ps1' ArtifactLocation: '' RepoId: $(Build.Repository.Name) steps: - template: /eng/common/pipelines/templates/steps/set-default-branch.yml -- pwsh: | - if (!(Test-Path '$(Build.BinariesDirectory)/azcopy/azcopy_windows_amd64_*/azcopy.exe')) { - Invoke-WebRequest -MaximumRetryCount 10 -Uri "https://aka.ms/downloadazcopy-v10-windows" -OutFile "azcopy.zip" | Wait-Process; - Expand-Archive -Path "azcopy.zip" -DestinationPath "$(Build.BinariesDirectory)/azcopy/" -Force - } - workingDirectory: $(Build.BinariesDirectory) - displayName: Download and Extract azcopy Zip - task: AzurePowerShell@5 displayName: 'Copy Docs to Blob Storage' @@ -24,9 +18,8 @@ steps: ScriptType: 'FilePath' ScriptPath: ${{ parameters.ScriptPath }} ScriptArguments: > - -AzCopy $(Resolve-Path "$(Build.BinariesDirectory)/azcopy/azcopy_windows_amd64_*/azcopy.exe")[0] -DocLocation "${{ parameters.FolderForUpload }}" - -BlobName "${{ parameters.BlobName }}" + -BlobAccountName "${{ parameters.BlobAccountName }}" -PublicArtifactLocation "${{ parameters.ArtifactLocation }}" -RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)$(DefaultBranch)" azurePowerShellVersion: latestVersion diff --git a/eng/common/pipelines/templates/steps/verify-changelogs.yml b/eng/common/pipelines/templates/steps/verify-changelogs.yml new file mode 100644 index 0000000000000..3f36954f4cd86 --- /dev/null +++ b/eng/common/pipelines/templates/steps/verify-changelogs.yml @@ -0,0 +1,16 @@ +parameters: +- name: PackagePropertiesFolder + type: string +- name: Condition + type: string + default: succeeded() + +steps: + - task: Powershell@2 + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/scripts/Verify-ChangeLogs.ps1 + arguments: > + -PackagePropertiesFolder '${{ parameters.PackagePropertiesFolder }}' + pwsh: true + displayName: Verify ChangeLogEntries + condition: ${{ parameters.Condition }} diff --git a/eng/common/pipelines/templates/steps/verify-readmes.yml b/eng/common/pipelines/templates/steps/verify-readmes.yml new file mode 100644 index 0000000000000..13ff963b43775 --- /dev/null +++ b/eng/common/pipelines/templates/steps/verify-readmes.yml @@ -0,0 +1,43 @@ +parameters: +- name: PackagePropertiesFolder + type: string +- name: RepoRoot + type: string + default: $(Build.SourcesDirectory) +- name: SettingsPath + type: string + default: '$(Build.SourcesDirectory)/eng/.docsettings.yml' +- name: DocWardenVersion + type: string + default: '' +- name: Condition + type: string + default: succeeded() + +steps: +- pwsh: | + $packageProperties = Get-ChildItem -Recurse "${{ parameters.PackagePropertiesFolder }}" *.json + + $paths = @() + + foreach($propertiesFile in $packageProperties) { + $PackageProp = Get-Content -Path $propertiesFile | ConvertFrom-Json + + $paths += (Join-Path "$(Build.SourcesDirectory)" $PackageProp.DirectoryPath) + } + + $scanPaths = $paths -join "," + Write-Host "##vso[task.setvariable variable=ScanPathArgument;]$scanPaths" + displayName: Populate Scan Paths + +- task: PowerShell@2 + displayName: "Verify Readmes" + condition: ${{ parameters.Condition }} + inputs: + filePath: "eng/common/scripts/Verify-Readme.ps1" + arguments: > + -DocWardenVersion '${{ parameters.DocWardenVersion }}' + -ScanPaths '$(ScanPathArgument)' + -RepoRoot ${{ parameters.RepoRoot }} + -SettingsPath ${{ parameters.SettingsPath }} + pwsh: true diff --git a/eng/common/scripts/Delete-RemoteBranches.ps1 b/eng/common/scripts/Delete-RemoteBranches.ps1 index 82cafe43cca67..55b20f63126ab 100644 --- a/eng/common/scripts/Delete-RemoteBranches.ps1 +++ b/eng/common/scripts/Delete-RemoteBranches.ps1 @@ -15,7 +15,6 @@ param( $AuthToken ) Set-StrictMode -version 3 - . (Join-Path $PSScriptRoot common.ps1) function Get-AllBranchesAndPullRequestInfo($owner, $repo) { @@ -66,67 +65,124 @@ if ($AuthToken) { } $owner, $repo = $RepoId -split "/" -$branches = Get-AllBranchesAndPullRequestInfo $owner $repo -foreach ($branch in $branches) -{ - $branchName = $branch.Name - if ($branchName -notmatch $BranchRegex) { - continue +# These will always be output at the end of the script. Their only purpose is for information gathering +# Total number returned from query +$totalBranchesFromQuery = 0 +# reasons why a branch was skipped +$skippedBranchNotMatchRegex = 0 +$skippedForCommitDate = 0 +$skippedForOpenPRs = 0 +$skippedForPRNotInBranch = 0 +$skippedForPRNotInRepo = 0 +# gh call counters +$ghPRViewCalls = 0 +$ghBranchDeleteCalls = 0 + +try { + # Output the core rate limit at the start of processing. There's no real need + # to output this at the end because the GH call counts are being output + $coreRateLimit = Get-RateLimit core + Write-RateLimit $coreRateLimit + # Output the GraphQL rate limit before and after the call + $graphqlRateLimit = Get-RateLimit graphql + Write-RateLimit $graphqlRateLimit "Before GraphQL Call" + $branches = Get-AllBranchesAndPullRequestInfo $owner $repo + $graphqlRateLimit = Get-RateLimit graphql + Write-RateLimit $graphqlRateLimit "After GraphQL Call" + + if ($branches) { + $totalBranchesFromQuery = $branches.Count } - $openPullRequests = @($branch.pullRequests | Where-Object { !$_.Closed }) - # If we have a central PR that created this branch still open don't delete the branch - if ($CentralRepoId) + foreach ($branch in $branches) { - $pullRequestNumber = $matches["PrNumber"] - # If central PR number is not found, then skip - if (!$pullRequestNumber) { - LogError "No PR number found in the branch name. Please check the branch name '$branchName'. Skipping..." + $branchName = $branch.Name + if ($branchName -notmatch $BranchRegex) { + $skippedBranchNotMatchRegex++ continue } + $openPullRequests = @($branch.pullRequests | Where-Object { !$_.Closed }) - $centralPR = gh pr view --json 'url,closed' --repo $CentralRepoId $pullRequestNumber | ConvertFrom-Json - if ($LASTEXITCODE) { - LogError "PR '$pullRequestNumber' not found in repo '$CentralRepoId'. Skipping..." - continue; - } else { - LogDebug "Found central PR $($centralPR.url) and Closed=$($centralPR.closed)" - if (!$centralPR.Closed) { - # Skipping if there is an open central PR open for the branch. - LogDebug "Central PR is still open so skipping the deletion of branch '$branchName'. Skipping..." - continue; + # If we have a central PR that created this branch still open don't delete the branch + if ($CentralRepoId) + { + $pullRequestNumber = $matches["PrNumber"] + # If central PR number is not found, then skip + if (!$pullRequestNumber) { + LogError "No PR number found in the branch name. Please check the branch name '$branchName'. Skipping..." + $skippedForPRNotInBranch++ + continue + } + + $ghPRViewCalls++ + $centralPR = gh pr view --json 'url,closed' --repo $CentralRepoId $pullRequestNumber | ConvertFrom-Json + if ($LASTEXITCODE) { + LogError "PR '$pullRequestNumber' not found in repo '$CentralRepoId'. Skipping..." + $skippedForPRNotInRepo++ + continue + } else { + LogDebug "Found central PR $($centralPR.url) and Closed=$($centralPR.closed)" + if (!$centralPR.Closed) { + $skippedForOpenPRs++ + # Skipping if there is an open central PR open for the branch. + LogDebug "Central PR is still open so skipping the deletion of branch '$branchName'. Skipping..." + continue + } } } - } - else { - # Not CentralRepoId - not associated with a central repo PR - if ($openPullRequests.Count -gt 0 -and !$DeleteBranchesEvenIfThereIsOpenPR) { - LogDebug "Found open PRs associate with branch '$branchName'. Skipping..." - continue + else { + # Not CentralRepoId - not associated with a central repo PR + if ($openPullRequests.Count -gt 0 -and !$DeleteBranchesEvenIfThereIsOpenPR) { + $skippedForOpenPRs++ + LogDebug "Found open PRs associate with branch '$branchName'. Skipping..." + continue + } } - } - # If there is date filter, then check if branch last commit is older than the date. - if ($LastCommitOlderThan) - { - $commitDate = $branch.committedDate - if ($commitDate -gt $LastCommitOlderThan) { - LogDebug "The branch $branch last commit date '$commitDate' is newer than the date '$LastCommitOlderThan'. Skipping..." - continue + # If there is date filter, then check if branch last commit is older than the date. + if ($LastCommitOlderThan) + { + $commitDate = $branch.committedDate + if ($commitDate -gt $LastCommitOlderThan) { + $skippedForCommitDate++ + LogDebug "The branch $branch last commit date '$commitDate' is newer than the date '$LastCommitOlderThan'. Skipping..." + continue + } } - } - foreach ($openPullRequest in $openPullRequests) { - Write-Host "Note: Open pull Request '$($openPullRequest.url)' will be closed after branch deletion, given the central PR is closed." - } + foreach ($openPullRequest in $openPullRequests) { + LogDebug "Note: Open pull Request '$($openPullRequest.url)' will be closed after branch deletion, given the central PR is closed." + } - $commitUrl = $branch.commitUrl - if ($PSCmdlet.ShouldProcess("'$branchName' in '$RepoId'", "Deleting branch on cleanup script")) { - gh api "repos/${RepoId}/git/refs/heads/${branchName}" -X DELETE - if ($LASTEXITCODE) { - LogError "Deletion of branch '$branchName` failed" + $commitUrl = $branch.commitUrl + if ($PSCmdlet.ShouldProcess("'$branchName' in '$RepoId'", "Deleting branch on cleanup script")) { + $ghBranchDeleteCalls++ + gh api "repos/${RepoId}/git/refs/heads/${branchName}" -X DELETE + if ($LASTEXITCODE) { + LogError "Deletion of branch '$branchName` failed, see command output above" + exit $LASTEXITCODE + } + LogDebug "The branch '$branchName' at commit '$commitUrl' in '$RepoId' has been deleted." } - Write-Host "The branch '$branchName' at commit '$commitUrl' in '$RepoId' has been deleted." + } +} +finally { + + + Write-Host "Number of branches returned from graphql query: $totalBranchesFromQuery" + # The $BranchRegex seems to be always set + if ($BranchRegex) { + Write-Host "Number of branches that didn't match the BranchRegex: $skippedBranchNotMatchRegex" + } + Write-Host "Number of branches skipped for newer last commit date: $skippedForCommitDate" + Write-Host "Number of branches skipped for open PRs: $skippedForOpenPRs" + Write-Host "Number of gh api calls to delete branches: $ghBranchDeleteCalls" + # The following are only applicable when $CentralRepoId is passed in + if ($CentralRepoId) { + Write-Host "The following are applicable because CentralRepoId was passed in:" + Write-Host " Number of gh pr view calls: $ghPRViewCalls" + Write-Host " Number of branches skipped due to PR not in the repository: $skippedForPRNotInRepo " + Write-Host " Number of branches skipped due to PR not in the branch name: $skippedForPRNotInBranch" } } diff --git a/eng/common/scripts/Detect-Api-Changes.ps1 b/eng/common/scripts/Detect-Api-Changes.ps1 index 5223465023327..72163ce66fda3 100644 --- a/eng/common/scripts/Detect-Api-Changes.ps1 +++ b/eng/common/scripts/Detect-Api-Changes.ps1 @@ -10,8 +10,6 @@ Param ( [string] $BuildId, [Parameter(Mandatory=$True)] [string] $CommitSha, - [Parameter(Mandatory=$True)] - [array] $ArtifactList, [string] $APIViewUri, [string] $RepoFullName = "", [string] $ArtifactName = "packages", @@ -21,6 +19,8 @@ Param ( . (Join-Path $PSScriptRoot common.ps1) +$configFileDir = Join-Path -Path $ArtifactPath "PackageInfo" + # Submit API review request and return status whether current revision is approved or pending or failed to create review function Submit-Request($filePath, $packageName) { @@ -64,7 +64,6 @@ function Submit-Request($filePath, $packageName) function Should-Process-Package($pkgPath, $packageName) { $pkg = Split-Path -Leaf $pkgPath - $configFileDir = Join-Path -Path $ArtifactPath "PackageInfo" $pkgPropPath = Join-Path -Path $configFileDir "$packageName.json" if (!(Test-Path $pkgPropPath)) { @@ -103,32 +102,39 @@ if (!($FindArtifactForApiReviewFn -and (Test-Path "Function:$FindArtifactForApiR } $responses = @{} -foreach ($artifact in $ArtifactList) + +$packageProperties = Get-ChildItem -Recurse -Force "$configFileDir" ` + | Where-Object { $_.Extension -eq '.json' } + +foreach ($packagePropFile in $packageProperties) { - Write-Host "Processing $($artifact.name)" - $packages = &$FindArtifactForApiReviewFn $ArtifactPath $artifact.name + $packageMetadata = Get-Content $packagePropFile | ConvertFrom-Json + Write-Host "Processing $($packageMetadata.ArtifactName)" + + $packages = &$FindArtifactForApiReviewFn $ArtifactPath $packageMetadata.ArtifactName + if ($packages) { $pkgPath = $packages.Values[0] - $isRequired = Should-Process-Package -pkgPath $pkgPath -packageName $artifact.name - Write-Host "Is API change detect required for $($artifact.name):$($isRequired)" + $isRequired = Should-Process-Package -pkgPath $pkgPath -packageName $($packageMetadata.ArtifactName) + Write-Host "Is API change detect required for $($packages.ArtifactName):$($isRequired)" if ($isRequired -eq $True) { $filePath = $pkgPath.Replace($ArtifactPath , "").Replace("\", "/") - $respCode = Submit-Request -filePath $filePath -packageName $artifact.name + $respCode = Submit-Request -filePath $filePath -packageName $($packageMetadata.ArtifactName) if ($respCode -ne '200') { - $responses[$artifact.name] = $respCode + $responses[$($packageMetadata.ArtifactName)] = $respCode } } else { - Write-Host "Pull request does not have any change for $($artifact.name). Skipping API change detect." + Write-Host "Pull request does not have any change for $($packageMetadata.ArtifactName)). Skipping API change detect." } } else { - Write-Host "No package is found in artifact path to find API changes for $($artifact.name)" + Write-Host "No package is found in artifact path to find API changes for $($packageMetadata.ArtifactName)" } } diff --git a/eng/common/scripts/Generate-PR-Diff.ps1 b/eng/common/scripts/Generate-PR-Diff.ps1 index d84f9e15ca7c9..7a31456b36ca8 100644 --- a/eng/common/scripts/Generate-PR-Diff.ps1 +++ b/eng/common/scripts/Generate-PR-Diff.ps1 @@ -19,14 +19,14 @@ Param ( [string] $TargetPath ) -. (Join-Path $PSScriptRoot "Helpers" git-helpers.ps1) +. (Join-Path $PSScriptRoot "Helpers" "git-helpers.ps1") function Get-ChangedServices { Param ( [Parameter(Mandatory=$True)] [string[]] $ChangedFiles ) - + $changedServices = $ChangedFiles | Foreach-Object { if ($_ -match "sdk/([^/]+)") { $matches[1] } } | Sort-Object -Unique return $changedServices diff --git a/eng/common/scripts/Helpers/git-helpers.ps1 b/eng/common/scripts/Helpers/git-helpers.ps1 index 63f34eca5183c..27a3d8ae3af3f 100644 --- a/eng/common/scripts/Helpers/git-helpers.ps1 +++ b/eng/common/scripts/Helpers/git-helpers.ps1 @@ -15,7 +15,7 @@ function Get-ChangedFiles { return "" } - # Add config to disable the quote and encoding on file name. + # Add config to disable the quote and encoding on file name. # Ref: https://github.com/msysgit/msysgit/wiki/Git-for-Windows-Unicode-Support#disable-quoted-file-names # Ref: https://github.com/msysgit/msysgit/wiki/Git-for-Windows-Unicode-Support#disable-commit-message-transcoding # Git PR diff: https://docs.github.com/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-comparing-branches-in-pull-requests#three-dot-and-two-dot-git-diff-comparisons @@ -91,7 +91,7 @@ class ConflictedFile { $lines = $IncomingContent -split "`r?`n" $l = @() $r = @() - + foreach($line in $lines) { if ($line -match "^<<<<<<<\s*(.+)") { $this.IsConflicted = $true @@ -110,3 +110,141 @@ class ConflictedFile { } } } + +# The rate limit comes back in the following format: +# The top level "rate" object is deprecated and the resources->core object should be used +# in its place. +# { +# "resources": { +# "core": { +# "limit": 5000, +# "used": 1087, +# "remaining": 3913, +# "reset": 1722876411 +# }, +# "search": { +# "limit": 30, +# "used": 0, +# "remaining": 30, +# "reset": 1722875519 +# }, +# "graphql": { +# "limit": 5000, +# "used": 0, +# "remaining": 5000, +# "reset": 1722879059 +# }, +# "integration_manifest": { +# "limit": 5000, +# "used": 0, +# "remaining": 5000, +# "reset": 1722879059 +# }, +# "source_import": { +# "limit": 100, +# "used": 0, +# "remaining": 100, +# "reset": 1722875519 +# }, +# "code_scanning_upload": { +# "limit": 1000, +# "used": 0, +# "remaining": 1000, +# "reset": 1722879059 +# }, +# "actions_runner_registration": { +# "limit": 10000, +# "used": 0, +# "remaining": 10000, +# "reset": 1722879059 +# }, +# "scim": { +# "limit": 15000, +# "used": 0, +# "remaining": 15000, +# "reset": 1722879059 +# }, +# "dependency_snapshots": { +# "limit": 100, +# "used": 0, +# "remaining": 100, +# "reset": 1722875519 +# }, +# "audit_log": { +# "limit": 1750, +# "used": 0, +# "remaining": 1750, +# "reset": 1722879059 +# }, +# "audit_log_streaming": { +# "limit": 15, +# "used": 0, +# "remaining": 15, +# "reset": 1722879059 +# }, +# "code_search": { +# "limit": 10, +# "used": 0, +# "remaining": 10, +# "reset": 1722875519 +# } +# }, +# "rate": { +# "limit": 5000, +# "used": 1087, +# "remaining": 3913, +# "reset": 1722876411 +# } +# } + +# These are the rate limit types we care about. If others needed in the future they +# can be defined here. The reason these need to be defined is because Get-RateLimit +# call needs to select the particular property to return the right limit. This ensures +# that rate limit type being passed to the function will exist. +enum RateLimitTypes { + core + search + graphql +} + +# Fetch the rate limit for the given RateLimitType +function Get-RateLimit([RateLimitTypes]$RateLimitType) { + $returnValue = gh api rate_limit + if ($LASTEXITCODE) { + LogError "Get-RateLimit::unable to get rate limit" + exit $LASTEXITCODE + } + # All rate limits have the following fields: limit, used, remaning, reset. + # Returning -AsHashtable allows easier access, eg. $rate_limit.remaining + $rate_limit = $returnValue | ConvertFrom-Json -AsHashtable | Select-Object -ExpandProperty resources | Select-Object -ExpandProperty $RateLimitType + # Add the limit type for convenance + $rate_limit["type"] = $RateLimitType + return $rate_limit +} + +# Get the number of minutes until RateLimit reset rounded up to the nearest minute +# for the passed in RateLimit. This is more applicable to the core and graphql rate +# limits than search because the search rate limit resets every minute +function Get-MinutesUntilRateLimitReset($RateLimit) { + $TimeSpan = [System.DateTimeOffset]::FromUnixTimeSeconds($rate.reset).UtcDateTime.Subtract([System.DateTime]::UtcNow) + $MinutesRoundedUp = [Math]::Ceiling($TimeSpan.TotalMinutes) + return $MinutesRoundedUp +} + +# Output the rate limit +function Write-RateLimit { + param ( + $RateLimit, + [string]$PreMsg = $null + ) + + if ($PreMsg) { + Write-Host $PreMsg + } + Write-Host "Limit Type=$($RateLimit.type)" + Write-Host " limit=$($RateLimit.limit)" + Write-Host " used=$($RateLimit.used)" + Write-Host " remaining=$($RateLimit.remaining)" + Write-Host " reset=$($RateLimit.reset)" + Write-Host "" +} \ No newline at end of file diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index 0e703a9d43743..2250b4f80ba68 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -15,6 +15,7 @@ class PackageProps [boolean]$IsNewSdk [string]$ArtifactName [string]$ReleaseStatus + [string[]]$DependentPackages PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory) { @@ -55,7 +56,7 @@ class PackageProps if ($changeLogEntry -and $changeLogEntry.ReleaseStatus) { $this.ReleaseStatus = $changeLogEntry.ReleaseStatus.Trim().Trim("()") - } + } } else { @@ -101,7 +102,7 @@ function Get-PkgProperties return $pkgProps[0] } - LogError "Failed to retrive Properties for [$PackageName]" + LogError "Failed to retrieve Properties for [$PackageName]" return $null } @@ -112,20 +113,35 @@ function Get-PrPkgProperties([string]$InputDiffJson) { $diff = Get-Content $InputDiffJson | ConvertFrom-Json $targetedFiles = $diff.ChangedFiles - foreach($pkg in $allPackageProperties) + $dependentPackagesForInclusion = @() + $lookup = @{} + + foreach ($pkg in $allPackageProperties) { $pkgDirectory = Resolve-Path "$($pkg.DirectoryPath)" + $lookupKey = ($pkg.DirectoryPath).Replace($RepoRoot, "").SubString(1) + $lookup[$lookupKey] = $pkg - foreach($file in $targetedFiles) + foreach ($file in $targetedFiles) { $filePath = Resolve-Path (Join-Path $RepoRoot $file) $shouldInclude = $filePath -like "$pkgDirectory*" if ($shouldInclude) { $packagesWithChanges += $pkg + + if ($pkg.DependentPackages) { + $dependentPackagesForInclusion += $pkg.DependentPackages + } } } } + foreach ($addition in $dependentPackagesForInclusion) { + if ($lookup[$addition]) { + $packagesWithChanges += $lookup[$addition] + } + } + return $packagesWithChanges } diff --git a/eng/common/scripts/Verify-ChangeLogs.ps1 b/eng/common/scripts/Verify-ChangeLogs.ps1 new file mode 100644 index 0000000000000..fbf117d5b9a51 --- /dev/null +++ b/eng/common/scripts/Verify-ChangeLogs.ps1 @@ -0,0 +1,31 @@ +# Wrapper Script for ChangeLog Verification in a PR +[CmdletBinding()] +param ( + [String]$PackagePropertiesFolder +) +Set-StrictMode -Version 3 + +. (Join-Path $PSScriptRoot common.ps1) + +# find which packages we need to confirm the changelog for +$packageProperties = Get-ChildItem -Recurse "$PackagePropertiesFolder" *.json + +# grab the json file, then confirm the changelog entry for it +$allPassing = $true +foreach($propertiesFile in $packageProperties) { + $PackageProp = Get-Content -Path $propertiesFile | ConvertFrom-Json + + $validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.ChangeLogPath -VersionString $PackageProp.Version -ForRelease $false + + if (-not $validChangeLog) { + $allPassing = $false + } +} + + +if (!$allPassing) +{ + exit 1 +} + +exit 0 diff --git a/eng/common/scripts/copy-docs-to-blobstorage.ps1 b/eng/common/scripts/copy-docs-to-blobstorage.ps1 index ff55c7389c109..c4f88ce756f2e 100644 --- a/eng/common/scripts/copy-docs-to-blobstorage.ps1 +++ b/eng/common/scripts/copy-docs-to-blobstorage.ps1 @@ -2,9 +2,8 @@ # powershell core is a requirement for successful execution. [CmdletBinding()] param ( - $AzCopy, $DocLocation, - $BlobName, + $BlobAccountName = "https://azuresdkdocs.blob.core.windows.net", $ExitOnError=1, $UploadLatest=1, $PublicArtifactLocation = "", @@ -117,7 +116,7 @@ function Get-Existing-Versions Param ( [Parameter(Mandatory=$true)] [String]$PkgName ) - $versionUri = "$($BlobName)/`$web/$($Language)/$($PkgName)/versioning/versions" + $versionUri = "${BlobAccountName}/`$web/$($Language)/$($PkgName)/versioning/versions" LogDebug "Heading to $versionUri to retrieve known versions" try { @@ -175,9 +174,9 @@ function Update-Existing-Versions $sortedVersionObj.LatestGAPackage | Out-File -File "$($DocLocation)/latest-ga" -Force -NoNewLine $sortedVersionObj.LatestPreviewPackage | Out-File -File "$($DocLocation)/latest-preview" -Force -NoNewLine - & $($AzCopy) cp "$($DocLocation)/versions" "$($DocDest)/$($PkgName)/versioning/versions" --cache-control "max-age=300, must-revalidate" - & $($AzCopy) cp "$($DocLocation)/latest-preview" "$($DocDest)/$($PkgName)/versioning/latest-preview" --cache-control "max-age=300, must-revalidate" - & $($AzCopy) cp "$($DocLocation)/latest-ga" "$($DocDest)/$($PkgName)/versioning/latest-ga" --cache-control "max-age=300, must-revalidate" + azcopy cp "$($DocLocation)/versions" "$($DocDest)/$($PkgName)/versioning/versions" --cache-control "max-age=300, must-revalidate" + azcopy cp "$($DocLocation)/latest-preview" "$($DocDest)/$($PkgName)/versioning/latest-preview" --cache-control "max-age=300, must-revalidate" + azcopy cp "$($DocLocation)/latest-ga" "$($DocDest)/$($PkgName)/versioning/latest-ga" --cache-control "max-age=300, must-revalidate" return $sortedVersionObj } @@ -189,8 +188,7 @@ function Upload-Blobs [Parameter(Mandatory=$true)] [String]$DocVersion, [Parameter(Mandatory=$false)] [String]$ReleaseTag ) - #eg : $BlobName = "https://azuresdkdocs.blob.core.windows.net" - $DocDest = "$($BlobName)/`$web/$($Language)" + $DocDest = "${BlobAccountName}/`$web/$($Language)" LogDebug "DocDest $($DocDest)" LogDebug "PkgName $($PkgName)" @@ -215,7 +213,7 @@ function Upload-Blobs } LogDebug "Uploading $($PkgName)/$($DocVersion) to $($DocDest)..." - & $($AzCopy) cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/$($DocVersion)" --recursive=true --cache-control "max-age=300, must-revalidate" + azcopy cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/$($DocVersion)" --recursive=true --cache-control "max-age=300, must-revalidate" LogDebug "Handling versioning files under $($DocDest)/$($PkgName)/versioning/" $versionsObj = (Update-Existing-Versions -PkgName $PkgName -PkgVersion $DocVersion -DocDest $DocDest) @@ -228,7 +226,7 @@ function Upload-Blobs if ($UploadLatest -and ($latestVersion -eq $DocVersion)) { LogDebug "Uploading $($PkgName) to latest folder in $($DocDest)..." - & $($AzCopy) cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/latest" --recursive=true --cache-control "max-age=300, must-revalidate" + azcopy cp "$($DocDir)/**" "$($DocDest)/$($PkgName)/latest" --recursive=true --cache-control "max-age=300, must-revalidate" } } @@ -248,4 +246,4 @@ if ($LASTEXITCODE) { Write-Host "Copying failed with error code [$LASTEXITCODE]. Dumping the logs to help diagnose." Get-ChildItem $env:UserProfile\.azcopy -Filter *.log | ForEach-Object { "LOG: " + $_; Get-Content $_; } -} \ No newline at end of file +} diff --git a/eng/common/testproxy/scripts/tag-merge/merge-proxy-tags.ps1 b/eng/common/testproxy/scripts/tag-merge/merge-proxy-tags.ps1 index b0187f69b6dff..e2e38568de60d 100644 --- a/eng/common/testproxy/scripts/tag-merge/merge-proxy-tags.ps1 +++ b/eng/common/testproxy/scripts/tag-merge/merge-proxy-tags.ps1 @@ -111,10 +111,10 @@ function Locate-Assets-Slice($ProxyExe, $AssetsJson, $MountDirectory) { function Get-Tag-SHA($TagName, $WorkingDirectory) { $results = Git-Command "ls-remote origin $TagName" $WorkingDirectory - + if ($results -and $lastexitcode -eq 0) { $arr = $results -split '\s+' - + return $arr[0] } @@ -124,7 +124,7 @@ function Get-Tag-SHA($TagName, $WorkingDirectory) { function Start-Message($AssetsJson, $TargetTags, $AssetsRepoLocation, $MountDirectory) { $alreadyCombinedTags = Load-Incomplete-Progress $MountDirectory - + $TargetTags = $TargetTags | Where-Object { $_ -notin $alreadyCombinedTags } if ($alreadyCombinedTags) { @@ -172,7 +172,7 @@ function Finish-Message($AssetsJson, $TargetTags, $AssetsRepoLocation, $MountDir $suffix = if ($len -gt 1) { "s" } else { "" } - Write-Host "`nSuccessfully combined $len tag$suffix. Invoke `"test-proxy push " -NoNewLine + Write-Host "`nSuccessfully combined $len tag$suffix. Invoke `"test-proxy push -a " -NoNewLine Write-Host $AssetsJson -ForegroundColor Green -NoNewLine Write-Host "`" to push the results as a new tag." } @@ -256,7 +256,7 @@ function Combine-Tags($RemainingTags, $AssetsRepoLocation, $MountDirectory, $Rel $pushedTags = Load-Incomplete-Progress $MountDirectory $testFile = Get-ChildItem -Recurse -Path $AssetsRepoLocation | Where-Object { !$_.PSIsContainer } | Select-Object -First 1 - Add-Content -Path $testFile -Value "`n" + Add-Content -LiteralPath $testFile -Value "`n" # if we have successfully gotten to the end without any non-zero exit codes...delete the mergeprogress file, we're g2g Cleanup-Incomplete-Progress $MountDirectory diff --git a/eng/common/testproxy/target_version.txt b/eng/common/testproxy/target_version.txt index 1466900c73eea..26b6c79cf6f38 100644 --- a/eng/common/testproxy/target_version.txt +++ b/eng/common/testproxy/target_version.txt @@ -1 +1 @@ -1.0.0-dev.20240619.2 +1.0.0-dev.20240806.1 diff --git a/eng/emitter-package-lock.json b/eng/emitter-package-lock.json index 1d47a4cff9709..dbab57f0acabb 100644 --- a/eng/emitter-package-lock.json +++ b/eng/emitter-package-lock.json @@ -5,20 +5,20 @@ "packages": { "": { "dependencies": { - "@azure-tools/typespec-python": "0.27.0" + "@azure-tools/typespec-python": "0.29.0" }, "devDependencies": { - "@azure-tools/typespec-autorest": "~0.44.0", - "@azure-tools/typespec-azure-core": "~0.44.0", - "@azure-tools/typespec-azure-resource-manager": "~0.44.0", - "@azure-tools/typespec-azure-rulesets": "~0.44.0", - "@azure-tools/typespec-client-generator-core": "~0.44.1", - "@typespec/compiler": "~0.58.0", - "@typespec/http": "~0.58.0", - "@typespec/openapi": "~0.58.0", - "@typespec/rest": "~0.58.0", - "@typespec/versioning": "~0.58.0", - "@typespec/xml": "~0.58.0" + "@azure-tools/typespec-autorest": "~0.45.0", + "@azure-tools/typespec-azure-core": "~0.45.0", + "@azure-tools/typespec-azure-resource-manager": "~0.45.0", + "@azure-tools/typespec-azure-rulesets": "~0.45.0", + "@azure-tools/typespec-client-generator-core": "~0.45.1", + "@typespec/compiler": "~0.59.1", + "@typespec/http": "~0.59.0", + "@typespec/openapi": "~0.59.0", + "@typespec/rest": "~0.59.0", + "@typespec/versioning": "~0.59.0", + "@typespec/xml": "~0.59.0" } }, "node_modules/@apidevtools/swagger-methods": { @@ -26,54 +26,41 @@ "resolved": "https://registry.npmjs.org/@apidevtools/swagger-methods/-/swagger-methods-3.0.2.tgz", "integrity": "sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==" }, - "node_modules/@autorest/system-requirements": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@autorest/system-requirements/-/system-requirements-1.0.2.tgz", - "integrity": "sha512-T21naRb6JDdjjn2s/zwr9iCIv/9jviL/PRtiWAhi+3UA2WKH2wrId2VqJa4uVD7iEV8BLkuGgFmMkaMBG26hFw==", - "dependencies": { - "@azure/logger": "^1.0.2", - "command-exists": "~1.2.9", - "semver": "^7.3.5" - }, - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/@azure-tools/typespec-autorest": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.44.0.tgz", - "integrity": "sha512-GlIQayA6HfKndq1T2qHBXtL6n8gTiShUEhi30zncoBaIUnwumkXSnx18uCQl0EzFmvAqLYt3kbHqQNzZIdGaeQ==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.45.0.tgz", + "integrity": "sha512-6ycZ0bEfXC0U26FHHEt9smAhxh78SACIDY+u7zLAopRzmxjTuthDdGgYSShuRDu3J+vEBi1fOKpz4cYQkgRkBQ==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "~0.44.0", - "@azure-tools/typespec-azure-resource-manager": "~0.44.0", - "@azure-tools/typespec-client-generator-core": "~0.44.0", - "@typespec/compiler": "~0.58.0", - "@typespec/http": "~0.58.0", - "@typespec/openapi": "~0.58.0", - "@typespec/rest": "~0.58.0", - "@typespec/versioning": "~0.58.0" + "@azure-tools/typespec-azure-core": "~0.45.0", + "@azure-tools/typespec-azure-resource-manager": "~0.45.0", + "@azure-tools/typespec-client-generator-core": "~0.45.0", + "@typespec/compiler": "~0.59.0", + "@typespec/http": "~0.59.0", + "@typespec/openapi": "~0.59.0", + "@typespec/rest": "~0.59.0", + "@typespec/versioning": "~0.59.0" } }, "node_modules/@azure-tools/typespec-azure-core": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.44.0.tgz", - "integrity": "sha512-d11QK2v5fOZH8YUqf42FsqHEirKCHzeKFq4Uo/51BXCXmJJahsTaFMAG2M0GoJe8tmTHeMijStnVMfzcGNqCAA==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.45.0.tgz", + "integrity": "sha512-GycGMCmaIVSN+TftPtlPJLyeOrglbLmH08ZiZaVMjSih/TQEJM21RGR6d8QdjlkQWN61ntNDRD+RP2uv9tHmqw==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.58.0", - "@typespec/http": "~0.58.0", - "@typespec/rest": "~0.58.0" + "@typespec/compiler": "~0.59.0", + "@typespec/http": "~0.59.0", + "@typespec/rest": "~0.59.0" } }, "node_modules/@azure-tools/typespec-azure-resource-manager": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.44.0.tgz", - "integrity": "sha512-m4dG41at6En1swbxlvCDl1v4Mvrfp17acDnRxEcd4SdKP2R9eVS2mBy1tSuFtMcJlOnoBZ5CxQgk+Osg/Q9nmA==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.45.0.tgz", + "integrity": "sha512-PdhB03P8PoOlUoUWd+CF5WipGzu2Q3ZjT0EAzgQe878DmXvxMq+zYaPJQtvkq9R6jCxFauDSr5gG7Yd4NINAuA==", "dependencies": { "change-case": "~5.4.4", "pluralize": "^8.0.0" @@ -82,32 +69,32 @@ "node": ">=18.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "~0.44.0", - "@typespec/compiler": "~0.58.0", - "@typespec/http": "~0.58.0", - "@typespec/openapi": "~0.58.0", - "@typespec/rest": "~0.58.0", - "@typespec/versioning": "~0.58.0" + "@azure-tools/typespec-azure-core": "~0.45.0", + "@typespec/compiler": "~0.59.0", + "@typespec/http": "~0.59.0", + "@typespec/openapi": "~0.59.0", + "@typespec/rest": "~0.59.0", + "@typespec/versioning": "~0.59.0" } }, "node_modules/@azure-tools/typespec-azure-rulesets": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-rulesets/-/typespec-azure-rulesets-0.44.0.tgz", - "integrity": "sha512-ZFiT+rtLIq3uP4uSr85i7w+3r02BEqERePaCtTyjexo2IBz0lwQ5Nn/5ujfuDDSy+3daoC2bQy8hw/BGWg9/Ng==", + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-rulesets/-/typespec-azure-rulesets-0.45.0.tgz", + "integrity": "sha512-OpMYYc0ElxnswABud22GSqE24ZoJCRGh9fwSA8SoqsJr0uXRX7D6D5pA1FHFT3b5uBVHy0l+FFHvjz9wxfsbUw==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "~0.44.0", - "@azure-tools/typespec-azure-resource-manager": "~0.44.0", - "@azure-tools/typespec-client-generator-core": "~0.44.0", - "@typespec/compiler": "~0.58.0" + "@azure-tools/typespec-azure-core": "~0.45.0", + "@azure-tools/typespec-azure-resource-manager": "~0.45.0", + "@azure-tools/typespec-client-generator-core": "~0.45.0", + "@typespec/compiler": "~0.59.0" } }, "node_modules/@azure-tools/typespec-client-generator-core": { - "version": "0.44.1", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.44.1.tgz", - "integrity": "sha512-hpDYS4J329kPnXMAndburITh81jgOloxLrv6QXJadurnFhxFHb8AycGO8VWgFYTf04cWd7yDx7HutzGSN9C7TQ==", + "version": "0.45.4", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.45.4.tgz", + "integrity": "sha512-QJygwMqhEtBi2tPYs/HAfs0QTowXAwp6QpP/Vd2pHnJAncTV1BN17n/9LLAlMu2CnLimqvTuIN+FfliM28AX9w==", "dependencies": { "change-case": "~5.4.4", "pluralize": "^8.0.0" @@ -116,50 +103,39 @@ "node": ">=18.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "~0.44.0", - "@typespec/compiler": "~0.58.0", - "@typespec/http": "~0.58.0", - "@typespec/rest": "~0.58.0", - "@typespec/versioning": "~0.58.0" + "@azure-tools/typespec-azure-core": "~0.45.0", + "@typespec/compiler": "~0.59.0", + "@typespec/http": "~0.59.0", + "@typespec/openapi": "~0.59.0", + "@typespec/rest": "~0.59.0", + "@typespec/versioning": "~0.59.0" } }, "node_modules/@azure-tools/typespec-python": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-python/-/typespec-python-0.27.0.tgz", - "integrity": "sha512-ITFbQ+u6ZpU+/NrmOCrXD2+M+Ueq4PjHOBxOohG4xqMvv8PWiHAIQ0U1fefQbTZe4lODgdQGW21yEy51q35zgQ==", + "version": "0.29.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-python/-/typespec-python-0.29.0.tgz", + "integrity": "sha512-7S8elNa67OfJT792MHkq5+mTEoQVWnJlqQa41YYU9Ly6KIIRV+Kp1bHmOn9FS3oQtg4WtNCNlZP1/N32KrZWzw==", "hasInstallScript": true, "dependencies": { - "@autorest/system-requirements": "~1.0.2", - "@typespec/openapi3": "~0.58.0", - "fs-extra": "~11.2.0", + "@typespec/openapi3": "~0.59.0", "js-yaml": "~4.1.0", - "semver": "~7.6.2" + "semver": "~7.6.2", + "tsx": "4.17.0" }, "engines": { "node": ">=14.0.0" }, "peerDependencies": { - "@azure-tools/typespec-autorest": ">=0.44.0 <1.0.0", - "@azure-tools/typespec-azure-core": ">=0.44.0 <1.0.0", - "@azure-tools/typespec-azure-resource-manager": ">=0.44.0 <1.0.0", - "@azure-tools/typespec-azure-rulesets": ">=0.44.0 <3.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.44.1 <1.0.0", - "@typespec/compiler": ">=0.58.0 <1.0.0", - "@typespec/http": ">=0.58.0 <1.0.0", - "@typespec/openapi": ">=0.58.0 <1.0.0", - "@typespec/rest": ">=0.58.0 <1.0.0", - "@typespec/versioning": ">=0.58.0 <1.0.0" - } - }, - "node_modules/@azure/logger": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.1.3.tgz", - "integrity": "sha512-J8/cIKNQB1Fc9fuYqBVnrppiUtW+5WWJPCj/tAokC5LdSTwkWWttN+jsRgw9BLYD7JDBx7PceiqOBxJJ1tQz3Q==", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18.0.0" + "@azure-tools/typespec-autorest": ">=0.45.0 <1.0.0", + "@azure-tools/typespec-azure-core": ">=0.45.0 <1.0.0", + "@azure-tools/typespec-azure-resource-manager": ">=0.45.0 <1.0.0", + "@azure-tools/typespec-azure-rulesets": ">=0.45.0 <3.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.45.1 <1.0.0", + "@typespec/compiler": ">=0.59.1 <1.0.0", + "@typespec/http": ">=0.59.0 <1.0.0", + "@typespec/openapi": ">=0.59.0 <1.0.0", + "@typespec/rest": ">=0.59.0 <1.0.0", + "@typespec/versioning": ">=0.59.0 <1.0.0" } }, "node_modules/@babel/code-frame": { @@ -197,9 +173,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.8.tgz", - "integrity": "sha512-5F7SDGs1T72ZczbRwbGO9lQi0NLjQxzl6i4lJxLxfW9U5UluCSyEJeniWvnhl3/euNiqQVbo8zruhsDfid0esA==", + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.0.tgz", + "integrity": "sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -207,6 +183,366 @@ "node": ">=6.9.0" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", + "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", + "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", + "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", + "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", + "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", + "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", + "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", + "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", + "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", + "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", + "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", + "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", + "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", + "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", + "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", + "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", + "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", + "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", + "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", + "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", + "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", + "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", + "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", + "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@humanwhocodes/momoa": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@humanwhocodes/momoa/-/momoa-2.0.4.tgz", @@ -393,19 +729,19 @@ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" }, "node_modules/@typespec/compiler": { - "version": "0.58.1", - "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-0.58.1.tgz", - "integrity": "sha512-bVxxM35r40OtuL4+/9W/g1EevlnWnW6i151nsZAFOJj1xWHoE2G9zkx5/Feic8OlzArjhGGLJOLH3Ez1Wrw35A==", + "version": "0.59.1", + "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-0.59.1.tgz", + "integrity": "sha512-O2ljgr6YoFaIH6a8lWc90/czdv4B2X6N9wz4WsnQnVvgO0Tj0s+3xkvp4Tv59RKMhT0f3fK6dL8oEGO32FYk1A==", "dependencies": { "@babel/code-frame": "~7.24.7", - "ajv": "~8.16.0", + "ajv": "~8.17.1", "change-case": "~5.4.4", "globby": "~14.0.2", "mustache": "~4.2.0", "picocolors": "~1.0.1", - "prettier": "~3.3.2", + "prettier": "~3.3.3", "prompts": "~2.4.2", - "semver": "^7.6.2", + "semver": "^7.6.3", "temporal-polyfill": "^0.2.5", "vscode-languageserver": "~9.0.1", "vscode-languageserver-textdocument": "~1.0.11", @@ -421,32 +757,32 @@ } }, "node_modules/@typespec/http": { - "version": "0.58.0", - "resolved": "https://registry.npmjs.org/@typespec/http/-/http-0.58.0.tgz", - "integrity": "sha512-jQpkugg9AZVrNDMkDIgZRpIoRkkU2b0LtKWqMGg33MItYj9/DYSgDtY7xb7oCBppRtFFZ/h138HyhYl3zQxZRg==", + "version": "0.59.1", + "resolved": "https://registry.npmjs.org/@typespec/http/-/http-0.59.1.tgz", + "integrity": "sha512-Ai8oCAO+Bw1HMSZ9gOI5Od4fNn/ul4HrVtTB01xFuLK6FQj854pxhzao8ylPnr7gIRQ327FV12/QfXR87yCiYQ==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.58.0" + "@typespec/compiler": "~0.59.0" } }, "node_modules/@typespec/openapi": { - "version": "0.58.0", - "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-0.58.0.tgz", - "integrity": "sha512-gu6nXfmpfZrfq8Etpgl1dpMfsXii7EzQyhZgsPhIy7ZwV5bDmFk1/oyhTqIpWrnr4pD3r151T2BQjzJefjf15A==", + "version": "0.59.0", + "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-0.59.0.tgz", + "integrity": "sha512-do1Dm5w0MuK3994gYTBg6qMfgeIxmmsDqnz3zimYKMPpbnUBi4F6/o4iCfn0Fn9kaNl+H6UlOzZpsZW9xHui1Q==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.58.0", - "@typespec/http": "~0.58.0" + "@typespec/compiler": "~0.59.0", + "@typespec/http": "~0.59.0" } }, "node_modules/@typespec/openapi3": { - "version": "0.58.0", - "resolved": "https://registry.npmjs.org/@typespec/openapi3/-/openapi3-0.58.0.tgz", - "integrity": "sha512-G9t9CWT9cN6ip39dLZaE6JdEDxGsFyOUxA2s6a087rweoTH85XzsFiQL7uiUD8vHhXyEo6tF6sy3LMZVN0BsoQ==", + "version": "0.59.1", + "resolved": "https://registry.npmjs.org/@typespec/openapi3/-/openapi3-0.59.1.tgz", + "integrity": "sha512-89VbUbkWKxeFgE0w0hpVyk1UZ6ZHRxOhcAHvF5MgxQxEhs2ALXKAqapWjFQsYrLBhAUoWzdPFrJJUMbwF9kX0Q==", "dependencies": { "@readme/openapi-parser": "~2.6.0", "yaml": "~2.4.5" @@ -458,56 +794,56 @@ "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.58.0", - "@typespec/http": "~0.58.0", - "@typespec/openapi": "~0.58.0", - "@typespec/versioning": "~0.58.0" + "@typespec/compiler": "~0.59.0", + "@typespec/http": "~0.59.1", + "@typespec/openapi": "~0.59.0", + "@typespec/versioning": "~0.59.0" } }, "node_modules/@typespec/rest": { - "version": "0.58.0", - "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.58.0.tgz", - "integrity": "sha512-QBxkED0/KQKG22pwzis0n7BY+uLMSZZPSoVe/ESBFika9n5/yyeQ0l58xbFFwwfxAxe4xwuZ5PNwTdEXZbzr5g==", + "version": "0.59.1", + "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.59.1.tgz", + "integrity": "sha512-uKU431jBYL2tVQWG5THA75+OtXDa1e8cMAafYK/JJRRiVRd8D/Epd8fp07dzlB8tFGrhCaGlekRMqFPFrHh2/A==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.58.0", - "@typespec/http": "~0.58.0" + "@typespec/compiler": "~0.59.0", + "@typespec/http": "~0.59.1" } }, "node_modules/@typespec/versioning": { - "version": "0.58.0", - "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.58.0.tgz", - "integrity": "sha512-brnQQ3wKWh4AbgqmnVLj+8zyOaDk9VPWg4QBecdQxzz7PrSrlAzIzRfeIyr67+hwi/0SvkTAB6GNH7YYTypKGA==", + "version": "0.59.0", + "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.59.0.tgz", + "integrity": "sha512-aihO/ux0lLmsuYAdGVkiBflSudcZokYG42SELk1FtMFo609G3Pd7ep7hau6unBnMIceQZejB0ow5UGRupK4X5A==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.58.0" + "@typespec/compiler": "~0.59.0" } }, "node_modules/@typespec/xml": { - "version": "0.58.0", - "resolved": "https://registry.npmjs.org/@typespec/xml/-/xml-0.58.0.tgz", - "integrity": "sha512-2OG2JXypMZR90nVoIVwxc+6Sc4lsggLPuh1yhw1BKiv2NBAuSdfcK4MuiIooqR206QJw9xM8qtNxlUeDb00DDw==", + "version": "0.59.0", + "resolved": "https://registry.npmjs.org/@typespec/xml/-/xml-0.59.0.tgz", + "integrity": "sha512-UoSsEmm7SXEtL9OXsqotu1TjruJSobqZMhUKAAlC9EP2WfQIHLRfBu7xaZB0sgwq7CM6zy/Hq1RZfQyL1KqEvg==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.58.0" + "@typespec/compiler": "~0.59.0" } }, "node_modules/ajv": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.16.0.tgz", - "integrity": "sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dependencies": { "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.4.1" + "require-from-string": "^2.0.2" }, "funding": { "type": "github", @@ -619,16 +955,49 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" }, - "node_modules/command-exists": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", - "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==" - }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, + "node_modules/esbuild": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", + "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.23.1", + "@esbuild/android-arm": "0.23.1", + "@esbuild/android-arm64": "0.23.1", + "@esbuild/android-x64": "0.23.1", + "@esbuild/darwin-arm64": "0.23.1", + "@esbuild/darwin-x64": "0.23.1", + "@esbuild/freebsd-arm64": "0.23.1", + "@esbuild/freebsd-x64": "0.23.1", + "@esbuild/linux-arm": "0.23.1", + "@esbuild/linux-arm64": "0.23.1", + "@esbuild/linux-ia32": "0.23.1", + "@esbuild/linux-loong64": "0.23.1", + "@esbuild/linux-mips64el": "0.23.1", + "@esbuild/linux-ppc64": "0.23.1", + "@esbuild/linux-riscv64": "0.23.1", + "@esbuild/linux-s390x": "0.23.1", + "@esbuild/linux-x64": "0.23.1", + "@esbuild/netbsd-x64": "0.23.1", + "@esbuild/openbsd-arm64": "0.23.1", + "@esbuild/openbsd-x64": "0.23.1", + "@esbuild/sunos-x64": "0.23.1", + "@esbuild/win32-arm64": "0.23.1", + "@esbuild/win32-ia32": "0.23.1", + "@esbuild/win32-x64": "0.23.1" + } + }, "node_modules/escalade": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", @@ -665,6 +1034,11 @@ "node": ">=8.6.0" } }, + "node_modules/fast-uri": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", + "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==" + }, "node_modules/fastq": { "version": "1.17.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", @@ -684,17 +1058,17 @@ "node": ">=8" } }, - "node_modules/fs-extra": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", - "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=14.14" + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, "node_modules/get-caller-file": { @@ -705,6 +1079,17 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-tsconfig": { + "version": "4.7.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.6.tgz", + "integrity": "sha512-ZAqrLlu18NbDdRaHq+AKXzAmqIUPswPWKUchfytdAjiRFnCe5ojG2bstg6mRiZabkKfCoL/e98pbBELIV/YCeA==", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -735,11 +1120,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" - }, "node_modules/grapheme-splitter": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", @@ -754,9 +1134,9 @@ } }, "node_modules/ignore": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", - "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "engines": { "node": ">= 4" } @@ -829,17 +1209,6 @@ "node": ">= 4" } }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, "node_modules/jsonpointer": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz", @@ -959,14 +1328,6 @@ "node": ">= 6" } }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "engines": { - "node": ">=6" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -1007,6 +1368,14 @@ "node": ">=0.10.0" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -1124,10 +1493,23 @@ "node": ">=8.0" } }, - "node_modules/tslib": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" + "node_modules/tsx": { + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.17.0.tgz", + "integrity": "sha512-eN4mnDA5UMKDt4YZixo9tBioibaMBpoxBkD+rIPAjVmYERSG0/dWEY1CEFuV89CgASlKL499q8AhmkMnnjtOJg==", + "dependencies": { + "esbuild": "~0.23.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } }, "node_modules/unicorn-magic": { "version": "0.1.0", @@ -1140,22 +1522,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/vscode-jsonrpc": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", @@ -1185,9 +1551,9 @@ } }, "node_modules/vscode-languageserver-textdocument": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.11.tgz", - "integrity": "sha512-X+8T3GoiwTVlJbicx/sIAF+yuJAqz8VvwJyoMVhwEMoEKE/fkDmrqUgDMyBECcM2A2frVZIUj5HI/ErRXCfOeA==" + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz", + "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==" }, "node_modules/vscode-languageserver-types": { "version": "3.17.5", diff --git a/eng/emitter-package.json b/eng/emitter-package.json index 45e4c562215eb..fc93c8768f934 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,19 +1,19 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-python": "0.27.0" + "@azure-tools/typespec-python": "0.29.0" }, "devDependencies": { - "@azure-tools/typespec-autorest": "~0.44.0", - "@azure-tools/typespec-azure-core": "~0.44.0", - "@azure-tools/typespec-azure-rulesets": "~0.44.0", - "@azure-tools/typespec-azure-resource-manager": "~0.44.0", - "@azure-tools/typespec-client-generator-core": "~0.44.1", - "@typespec/compiler": "~0.58.0", - "@typespec/http": "~0.58.0", - "@typespec/openapi": "~0.58.0", - "@typespec/rest": "~0.58.0", - "@typespec/versioning": "~0.58.0", - "@typespec/xml": "~0.58.0" + "@azure-tools/typespec-autorest": "~0.45.0", + "@azure-tools/typespec-azure-core": "~0.45.0", + "@azure-tools/typespec-azure-rulesets": "~0.45.0", + "@azure-tools/typespec-azure-resource-manager": "~0.45.0", + "@azure-tools/typespec-client-generator-core": "~0.45.1", + "@typespec/compiler": "~0.59.1", + "@typespec/http": "~0.59.0", + "@typespec/openapi": "~0.59.0", + "@typespec/rest": "~0.59.0", + "@typespec/versioning": "~0.59.0", + "@typespec/xml": "~0.59.0" } } diff --git a/eng/pipelines/templates/jobs/build-conda-dependencies.yml b/eng/pipelines/templates/jobs/build-conda-dependencies.yml index c37e3bcb4aab1..082eac810c2df 100644 --- a/eng/pipelines/templates/jobs/build-conda-dependencies.yml +++ b/eng/pipelines/templates/jobs/build-conda-dependencies.yml @@ -121,9 +121,9 @@ jobs: - script: sudo ls /Applications/ displayName: 'List All apps' - - - script: sudo xcode-select --switch /Applications/Xcode_11.7.0.app - displayName: 'Select Xcode 11.7.0' + + - script: sudo xcode-select --switch /Applications/Xcode_13.3.1.app + displayName: 'Select Xcode_13.3.1.app' - bash: | echo "##vso[task.setvariable variable=CFLAGS;]-mmacosx-version-min=$(MacOSXDeploymentTarget) -I$(OpenSSLDir)/include" diff --git a/eng/pipelines/templates/stages/archetype-python-release.yml b/eng/pipelines/templates/stages/archetype-python-release.yml index 3009acce29cd2..3d85514af92a6 100644 --- a/eng/pipelines/templates/stages/archetype-python-release.yml +++ b/eng/pipelines/templates/stages/archetype-python-release.yml @@ -52,12 +52,11 @@ stages: ServiceDirectory: "template" TestPipeline: ${{ parameters.TestPipeline }} - - ${{if ne(artifact.skipVerifyChangeLog, 'true')}}: - - template: /eng/common/pipelines/templates/steps/verify-changelog.yml - parameters: - PackageName: ${{artifact.name}} - ServiceName: ${{parameters.ServiceDirectory}} - ForRelease: true + - template: /eng/common/pipelines/templates/steps/verify-changelog.yml + parameters: + PackageName: ${{artifact.name}} + ServiceName: ${{parameters.ServiceDirectory}} + ForRelease: true - template: /eng/common/pipelines/templates/steps/verify-restapi-spec-location.yml parameters: @@ -177,7 +176,7 @@ stages: ArtifactName: ${{parameters.ArtifactName}} PackageName: ${{artifact.name}} - - ${{if ne(artifact.skipPublishDocs, 'true')}}: + - ${{if ne(artifact.skipPublishDocGithubIo, 'true')}}: - deployment: PublishGitHubIODocs displayName: Publish Docs to GitHubIO Blob Storage condition: and(succeeded(), ne(variables['Skip.PublishDocs'], 'true')) @@ -203,11 +202,8 @@ stages: - template: /eng/common/pipelines/templates/steps/publish-blobs.yml parameters: FolderForUpload: '$(Pipeline.Workspace)/${{parameters.DocArtifact}}/${{artifact.name}}' - BlobName: '$(azure-sdk-docs-prod-blob-name)' TargetLanguage: 'python' ArtifactLocation: '$(Pipeline.Workspace)/${{parameters.ArtifactName}}/${{artifact.name}}' - # we override the regular script path because we have cloned the build tools repo as a separate artifact. - ScriptPath: 'eng/common/scripts/copy-docs-to-blobstorage.ps1' - ${{if ne(artifact.skipPublishDocMs, 'true')}}: - deployment: PublishDocs @@ -244,37 +240,44 @@ stages: - metadata/ PackageSourceOverride: ${{parameters.PackageSourceOverride}} DocValidationImageId: ${{parameters.DocValidationImageId}} - - ${{if ne(artifact.skipPublishDocGithubIo, 'true')}}: - - deployment: UpdatePackageVersion - displayName: "Update Package Version" - condition: and(succeeded(), ne(variables['Skip.UpdatePackageVersion'], 'true')) - environment: github - dependsOn: PublishPackage - pool: - image: azsdk-pool-mms-ubuntu-2004-1espt - name: azsdk-pool-mms-ubuntu-2004-general - os: linux + - deployment: UpdatePackageVersion + displayName: "Update Package Version" + condition: and(succeeded(), ne(variables['Skip.UpdatePackageVersion'], 'true')) + environment: github + dependsOn: PublishPackage + + pool: + image: azsdk-pool-mms-ubuntu-2004-1espt + name: azsdk-pool-mms-ubuntu-2004-general + os: linux + + strategy: + runOnce: + deploy: + steps: + - checkout: self + - task: UsePythonVersion@0 + - script: | + python -m pip install "./tools/azure-sdk-tools[build]" + displayName: Install versioning tool dependencies + + - pwsh: | + sdk_increment_version --package-name ${{ artifact.name }} --service ${{ parameters.ServiceDirectory }} + if (Test-Path component-detection-pip-report.json) { + Write-Host "Deleting component-detection-pip-report.json" + rm component-detection-pip-report.json + } + displayName: Increment package version + + - template: /eng/common/pipelines/templates/steps/create-pull-request.yml + parameters: + RepoName: azure-sdk-for-python + PRBranchName: increment-package-version-${{ parameters.ServiceDirectory }}-$(Build.BuildId) + CommitMsg: "Increment package version after release of ${{ artifact.name }}" + PRTitle: "Increment version for ${{ parameters.ServiceDirectory }} releases" + CloseAfterOpenForTesting: '${{ parameters.TestPipeline }}' - strategy: - runOnce: - deploy: - steps: - - checkout: self - - task: UsePythonVersion@0 - - script: | - python -m pip install "./tools/azure-sdk-tools[build]" - displayName: Install versioning tool dependencies - - pwsh: | - sdk_increment_version --package-name ${{ artifact.name }} --service ${{ parameters.ServiceDirectory }} - displayName: Increment package version - - template: /eng/common/pipelines/templates/steps/create-pull-request.yml - parameters: - RepoName: azure-sdk-for-python - PRBranchName: increment-package-version-${{ parameters.ServiceDirectory }}-$(Build.BuildId) - CommitMsg: "Increment package version after release of ${{ artifact.name }}" - PRTitle: "Increment version for ${{ parameters.ServiceDirectory }} releases" - CloseAfterOpenForTesting: '${{ parameters.TestPipeline }}' - ${{if and(eq(variables['Build.Reason'], 'Manual'), eq(variables['System.TeamProject'], 'internal'))}}: - template: /eng/pipelines/templates/jobs/smoke.tests.yml parameters: @@ -327,7 +330,7 @@ stages: - job: PublishDocsToNightlyBranch dependsOn: PublishPackages - condition: or(eq(variables['SetDevVersion'], 'true'), and(eq(variables['Build.Reason'],'Schedule'), eq(variables['System.TeamProject'], 'internal'))) + condition: and(succeeded(), or(eq(variables['SetDevVersion'], 'true'), and(eq(variables['Build.Reason'],'Schedule'), eq(variables['System.TeamProject'], 'internal')))) pool: image: azsdk-pool-mms-ubuntu-2004-1espt name: azsdk-pool-mms-ubuntu-2004-general diff --git a/eng/pipelines/templates/stages/partner-release.yml b/eng/pipelines/templates/stages/partner-release.yml index 0ca5c5291a9b9..f36a6b0e54719 100644 --- a/eng/pipelines/templates/stages/partner-release.yml +++ b/eng/pipelines/templates/stages/partner-release.yml @@ -64,8 +64,8 @@ extends: Intent: 'PackageDistribution' ContentType: 'PyPI' FolderLocation: $(Artifacts) - Owners: $(Build.RequestedForEmail) - Approvers: $(Build.RequestedForEmail) + Owners: ${{ coalesce(variables['Build.RequestedForEmail'], 'azuresdk@microsoft.com') }} + Approvers: ${{ coalesce(variables['Build.RequestedForEmail'], 'azuresdk@microsoft.com') }} ServiceEndpointUrl: 'https://api.esrp.microsoft.com' MainPublisher: 'ESRPRELPACMANTEST' DomainTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47' diff --git a/eng/pipelines/templates/jobs/trigger-ml-sample-pipeline.yml b/eng/pipelines/trigger-ml-sample-pipeline.yml similarity index 71% rename from eng/pipelines/templates/jobs/trigger-ml-sample-pipeline.yml rename to eng/pipelines/trigger-ml-sample-pipeline.yml index 9b2e190d60946..b5546a69a4fb2 100644 --- a/eng/pipelines/templates/jobs/trigger-ml-sample-pipeline.yml +++ b/eng/pipelines/trigger-ml-sample-pipeline.yml @@ -4,7 +4,7 @@ parameters: default: 'ml' - name: Artifacts type: object - default: + default: - name: azure-ai-ml safeName: azureaiml skipVerifyChangeLog: true @@ -17,7 +17,9 @@ jobs: displayName: "Build, Upload, and PR Azure ML Changeset" timeoutInMinutes: 90 variables: - - template: ../variables/globals.yml + - name: StorageAccountName + value: 'docsupport' + - template: /eng/pipelines/templates/variables/globals.yml pool: name: azsdk-pool-mms-ubuntu-2004-general @@ -39,9 +41,9 @@ jobs: versionSpec: $(PythonVersion) - script: | - python -m pip install setuptools==58.3.0 - python -m pip install -r eng/ci_tools.txt - python -m pip install -r eng/ml_sample_tools.txt + python -m pip install tools/azure-sdk-tools[build] + python -m pip install azure-identity + python -m pip install azure-storage-blob displayName: 'Prep Environment' - pwsh: | @@ -61,20 +63,24 @@ jobs: Get-ChildItem "$(mlrepo)" -R displayName: Output Staging Directory - - task: PythonScript@0 - displayName: 'Generate Samples Repo Changes' - env: - BLOB_CONNECTION_STRING: $(azure-sdk-docsupport-cs) + - pwsh: | + cat "$(mlrepo)/sdk/python/setup.sh" + displayName: Display setup.sh pre-update + + - task: AzurePowerShell@5 + displayName: Generate Samples Repo Changes inputs: - scriptPath: 'scripts/devops_tasks/generate_ml_sample_update.py' - arguments: >- - --ml-repo="$(mlrepo)" - --ml-wheel-folder="$(Build.ArtifactStagingDirectory)/azure-ai-ml" - --build-id="$(Build.BuildId)" + azureSubscription: 'Azure SDK Artifacts' + azurePowerShellVersion: LatestVersion + pwsh: true + ScriptType: InlineScript + Inline: | + python scripts/devops_tasks/generate_ml_sample_update.py --ml-repo "$(mlrepo)" --ml-wheel-folder "$(Build.ArtifactStagingDirectory)/azure-ai-ml" --build-id "$(Build.BuildId)" --storage-account-name "$(StorageAccountName)"; + exit $LASTEXITCODE; - pwsh: | cat "$(mlrepo)/sdk/python/setup.sh" - displayName: Display Updated setup.sh + displayName: Display setup.sh post-update - template: /eng/common/pipelines/templates/steps/create-pull-request.yml parameters: diff --git a/scripts/auto_release/main.py b/scripts/auto_release/main.py index f41360f00389b..52b4aafc80423 100644 --- a/scripts/auto_release/main.py +++ b/scripts/auto_release/main.py @@ -29,7 +29,7 @@ def wrapper(*args, **kwargs): def log(cmd: str): - _LOG.info('==' + cmd + ' ==\n') + _LOG.info("==" + cmd + " ==\n") def print_exec(cmd: str): @@ -39,7 +39,7 @@ def print_exec(cmd: str): def print_exec_output(cmd: str) -> List[str]: log(cmd) - return subprocess.getoutput(cmd).split('\n') + return subprocess.getoutput(cmd).split("\n") def print_check(cmd): @@ -50,31 +50,31 @@ def print_check(cmd): def preview_version_plus(preview_label: str, last_version: str) -> str: num = last_version.split(preview_label) num[1] = str(int(num[1]) + 1) - return f'{num[0]}{preview_label}{num[1]}' + return f"{num[0]}{preview_label}{num[1]}" def stable_version_plus(changelog: str, last_version: str): flag = [False, False, False] # breaking, feature, bugfix - flag[0] = '### Breaking Changes' in changelog - flag[1] = '### Features Added' in changelog - flag[2] = '### Bugs Fixed' in changelog + flag[0] = "### Breaking Changes" in changelog + flag[1] = "### Features Added" in changelog + flag[2] = "### Bugs Fixed" in changelog - num = last_version.split('.') + num = last_version.split(".") if flag[0]: - return f'{int(num[0]) + 1}.0.0' + return f"{int(num[0]) + 1}.0.0" elif flag[1]: - return f'{num[0]}.{int(num[1]) + 1}.0' + return f"{num[0]}.{int(num[1]) + 1}.0" elif flag[2]: - return f'{num[0]}.{num[1]}.{int(num[2]) + 1}' + return f"{num[0]}.{num[1]}.{int(num[2]) + 1}" else: - return '0.0.0' + return "0.0.0" # find all the files of one folder, including files in subdirectory def all_files(path: str, files: List[str]): all_folder = os.listdir(path) for item in all_folder: - folder = str(Path(f'{path}/{item}')) + folder = str(Path(f"{path}/{item}")) if os.path.isdir(folder): all_files(folder, files) else: @@ -82,21 +82,22 @@ def all_files(path: str, files: List[str]): def modify_file(file_path: str, func: Any): - with open(file_path, 'r') as file_in: + with open(file_path, "r") as file_in: content = file_in.readlines() func(content) - with open(file_path, 'w') as file_out: + with open(file_path, "w") as file_out: file_out.writelines(content) def current_time() -> str: date = time.localtime(time.time()) - return '{}-{:02d}-{:02d}'.format(date.tm_year, date.tm_mon, date.tm_mday) + return "{}-{:02d}-{:02d}".format(date.tm_year, date.tm_mon, date.tm_mday) def current_time_month() -> str: date = time.localtime(time.time()) - return '{}-{:02d}'.format(date.tm_year, date.tm_mon) + return "{}-{:02d}".format(date.tm_year, date.tm_mon) + class CodegenTestPR: """ @@ -104,27 +105,27 @@ class CodegenTestPR: """ def __init__(self): - self.issue_link = os.getenv('ISSUE_LINK', '') - self.pipeline_link = os.getenv('PIPELINE_LINK', '') - self.bot_token = os.getenv('BOT_TOKEN') - self.spec_readme = os.getenv('SPEC_README', '') - self.spec_repo = os.getenv('SPEC_REPO', '') - self.target_date = os.getenv('TARGET_DATE', '') - self.test_folder = os.getenv('TEST_FOLDER', '') - self.issue_owner = os.getenv('ISSUE_OWNER', '') - - self.package_name = '' # 'dns' of 'sdk/compute/azure-mgmt-dns' - self.whole_package_name = '' # 'azure-mgmt-dns' - self.new_branch = '' - self.sdk_folder = '' # 'compute' of 'sdk/compute/azure-mgmt-dns' - self.autorest_result = '' - self.next_version = '' - self.test_result = '' + self.issue_link = os.getenv("ISSUE_LINK", "") + self.pipeline_link = os.getenv("PIPELINE_LINK", "") + self.bot_token = os.getenv("BOT_TOKEN") + self.spec_readme = os.getenv("SPEC_README", "") + self.spec_repo = os.getenv("SPEC_REPO", "") + self.target_date = os.getenv("TARGET_DATE", "") + self.test_folder = os.getenv("TEST_FOLDER", "") + self.issue_owner = os.getenv("ISSUE_OWNER", "") + + self.package_name = "" # 'dns' of 'sdk/compute/azure-mgmt-dns' + self.whole_package_name = "" # 'azure-mgmt-dns' + self.new_branch = "" + self.sdk_folder = "" # 'compute' of 'sdk/compute/azure-mgmt-dns' + self.autorest_result = "" + self.next_version = "" + self.test_result = "" self.pr_number = 0 self.tag_is_stable = False self.has_test = False self.check_package_size_result = [] # List[str] - self.version_suggestion = '' # if can't calculate next version, give a suggestion + self.version_suggestion = "" # if can't calculate next version, give a suggestion @property def target_release_date(self) -> str: @@ -132,13 +133,13 @@ def target_release_date(self) -> str: if self.target_date: return (datetime.fromisoformat(self.target_date) + timedelta(days=-4)).strftime("%Y-%m-%d") except: - log(f'Invalid target date: {self.target_date}') + log(f"Invalid target date: {self.target_date}") return current_time() @return_origin_path def get_latest_commit_in_swagger_repo(self) -> str: os.chdir(Path(self.spec_repo)) - head_sha = print_exec_output('git rev-parse HEAD')[0] + head_sha = print_exec_output("git rev-parse HEAD")[0] return head_sha def readme_local_folder(self) -> str: @@ -146,16 +147,16 @@ def readme_local_folder(self) -> str: def get_sdk_folder_with_autorest_result(self): generate_result = self.get_autorest_result() - self.sdk_folder = generate_result["packages"][0]["path"][0].split('/')[-1] + self.sdk_folder = generate_result["packages"][0]["path"][0].split("/")[-1] @staticmethod def checkout_branch(env_key: str, repo: str): env_var = os.getenv(env_key, "") usr = env_var.split(":")[0] or "Azure" branch = env_var.split(":")[-1] or "main" - print_exec(f'git remote add {usr} https://github.com/{usr}/{repo}.git') - print_check(f'git fetch {usr} {branch}') - print_check(f'git checkout {usr}/{branch}') + print_exec(f"git remote add {usr} https://github.com/{usr}/{repo}.git") + print_check(f"git fetch {usr} {branch}") + print_check(f"git checkout {usr}/{branch}") @return_origin_path def checkout_azure_default_branch(self): @@ -166,7 +167,7 @@ def checkout_azure_default_branch(self): if self.spec_repo: os.chdir(Path(self.spec_repo)) self.checkout_branch("DEBUG_REST_BRANCH", "azure-rest-api-specs") - + @property def from_swagger(self) -> bool: return "readme.md" in self.spec_readme @@ -177,35 +178,35 @@ def generate_code(self): # prepare input data file_name = "relatedReadmeMdFiles" if self.from_swagger else "relatedTypeSpecProjectFolder" input_data = { - 'headSha': self.get_latest_commit_in_swagger_repo(), - 'repoHttpsUrl': "https://github.com/Azure/azure-rest-api-specs", - 'specFolder': self.spec_repo, + "headSha": self.get_latest_commit_in_swagger_repo(), + "repoHttpsUrl": "https://github.com/Azure/azure-rest-api-specs", + "specFolder": self.spec_repo, file_name: [self.readme_local_folder()], } log(str(input_data)) # if Python tag exists - if os.getenv('PYTHON_TAG'): - input_data['python_tag'] = os.getenv('PYTHON_TAG') + if os.getenv("PYTHON_TAG"): + input_data["python_tag"] = os.getenv("PYTHON_TAG") - self.autorest_result = str(Path(os.getenv('TEMP_FOLDER')) / 'temp.json') - with open(self.autorest_result, 'w') as file: + self.autorest_result = str(Path(os.getenv("TEMP_FOLDER")) / "temp.json") + with open(self.autorest_result, "w") as file: json.dump(input_data, file) # generate code(be careful about the order) - print_exec('python scripts/dev_setup.py -p azure-core') - print_check(f'python -m packaging_tools.sdk_generator {self.autorest_result} {self.autorest_result}') + print_exec("python scripts/dev_setup.py -p azure-core") + print_check(f"python -m packaging_tools.sdk_generator {self.autorest_result} {self.autorest_result}") generate_result = self.get_autorest_result() - self.tag_is_stable = list(generate_result.values())[0]['tagIsStable'] + self.tag_is_stable = list(generate_result.values())[0]["tagIsStable"] log(f"tag_is_stable is {self.tag_is_stable}") - - print_check(f'python -m packaging_tools.sdk_package {self.autorest_result} {self.autorest_result}') + + print_check(f"python -m packaging_tools.sdk_package {self.autorest_result} {self.autorest_result}") def get_package_name_with_autorest_result(self): generate_result = self.get_autorest_result() self.whole_package_name = generate_result["packages"][0]["packageName"] - self.package_name = self.whole_package_name.split('-', 2)[-1] + self.package_name = self.whole_package_name.split("-", 2)[-1] def prepare_branch_with_readme(self): self.generate_code() @@ -214,25 +215,25 @@ def prepare_branch_with_readme(self): self.create_new_branch() def create_new_branch(self): - self.new_branch = f't2-{self.package_name}-{current_time()}-{str(time.time())[-5:]}' - print_check(f'git checkout -b {self.new_branch}') + self.new_branch = f"t2-{self.package_name}-{current_time()}-{str(time.time())[-5:]}" + print_check(f"git checkout -b {self.new_branch}") def check_sdk_readme(self): - sdk_readme = str(Path(f'sdk/{self.sdk_folder}/{self.whole_package_name}/README.md')) + sdk_readme = str(Path(f"sdk/{self.sdk_folder}/{self.whole_package_name}/README.md")) def edit_sdk_readme(content: List[str]): for i in range(0, len(content)): - if content[i].find('MyService') > 0: - content[i] = content[i].replace('MyService', self.package_name.capitalize()) + if content[i].find("MyService") > 0: + content[i] = content[i].replace("MyService", self.package_name.capitalize()) modify_file(sdk_readme, edit_sdk_readme) @property - def readme_md_path(self)-> Path: + def readme_md_path(self) -> Path: return Path(self.spec_repo) / "specification" / self.spec_readme.split("specification/")[-1] @property - def readme_python_md_path(self)-> Path: + def readme_python_md_path(self) -> Path: return Path(str(self.readme_md_path).replace("readme.md", "readme.python.md")) # Use the template to update readme and setup by packaging_tools @@ -245,15 +246,16 @@ def check_file_with_packaging_tool(self): if item.endswith("Client"): title = item break - + if not title: log(f"Can not find the title in {self.whole_package_name}") - - os.chdir(Path(f'sdk/{self.sdk_folder}')) + + os.chdir(Path(f"sdk/{self.sdk_folder}")) # add `title` and update `is_stable` in sdk_packaging.toml toml = Path(self.whole_package_name) / "sdk_packaging.toml" stable_config = "is_stable = " + ("true" if self.tag_is_stable else "false") + "\n" if toml.exists(): + def edit_toml(content: List[str]): has_title = False has_isstable = False @@ -264,28 +266,29 @@ def edit_toml(content: List[str]): has_isstable = True content[idx] = stable_config if not has_title: - content.append(f"title = \"{title}\"\n") + content.append(f'title = "{title}"\n') if not has_isstable: content.append(stable_config) + modify_file(str(toml), edit_toml) else: log(f"{os.getcwd()}/{toml} does not exist") - print_check(f'python -m packaging_tools --build-conf {self.whole_package_name}') - log('packaging_tools --build-conf successfully ') + print_check(f"python -m packaging_tools --build-conf {self.whole_package_name}") + log("packaging_tools --build-conf successfully ") def check_pprint_name(self): pprint_name = self.package_name.capitalize() def edit_file_for_pprint_name(content: List[str]): for i in range(0, len(content)): - content[i] = content[i].replace('MyService', pprint_name) + content[i] = content[i].replace("MyService", pprint_name) for file in os.listdir(self.sdk_code_path()): file_path = str(Path(self.sdk_code_path()) / file) if os.path.isfile(file_path): modify_file(file_path, edit_file_for_pprint_name) - log(f' replace \"MyService\" with \"{pprint_name}\" successfully ') + log(f' replace "MyService" with "{pprint_name}" successfully ') def get_all_files_under_package_folder(self) -> List[str]: files = [] @@ -295,29 +298,29 @@ def get_all_files_under_package_folder(self) -> List[str]: def calculate_next_version_proc(self, last_version: str): preview_tag = not self.tag_is_stable changelog = self.get_changelog() - if changelog == '': - self.version_suggestion = '(it should be stable)' if self.tag_is_stable else '(it should be perview)' + if changelog == "": + self.version_suggestion = "(it should be stable)" if self.tag_is_stable else "(it should be perview)" return "0.0.0" - preview_version = 'rc' in last_version or 'b' in last_version + preview_version = "rc" in last_version or "b" in last_version # | preview tag | stable tag # preview version(1.0.0rc1/1.0.0b1) | 1.0.0rc2(track1)/1.0.0b2(track2) | 1.0.0 # stable version (1.0.0) (breaking change) | 2.0.0rc1(track1)/2.0.0b1(track2) | 2.0.0 # stable version (1.0.0) (feature) | 1.1.0rc1(track1)/1.1.0b1(track2) | 1.1.0 # stable version (1.0.0) (bugfix) | 1.0.1rc1(track1)/1.0.1b1(track2) | 1.0.1 - preview_label = 'b' + preview_label = "b" if preview_version and preview_tag: next_version = preview_version_plus(preview_label, last_version) elif preview_version and not preview_tag: next_version = last_version.split(preview_label)[0] elif not preview_version and preview_tag: - next_version = stable_version_plus(changelog, last_version) + preview_label + '1' + next_version = stable_version_plus(changelog, last_version) + preview_label + "1" else: next_version = stable_version_plus(changelog, last_version) return next_version def get_autorest_result(self) -> Dict[Any, Any]: - with open(self.autorest_result, 'r') as file_in: + with open(self.autorest_result, "r") as file_in: content = json.load(file_in) return content @@ -331,26 +334,26 @@ def get_last_release_version(self) -> str: try: return str(Version(last_version)) except: - return '' + return "" def calculate_next_version(self): last_version = self.get_last_release_version() if last_version: self.next_version = self.calculate_next_version_proc(last_version) else: - self.next_version = '1.0.0b1' + self.next_version = "1.0.0b1" def edit_all_version_file(self): files = self.get_all_files_under_package_folder() def edit_version_file(content: List[str]): for i in range(0, len(content)): - if content[i].find('VERSION') > -1: + if content[i].find("VERSION") > -1: content[i] = f'VERSION = "{self.next_version}"\n' break for file in files: - if Path(file).name == '_version.py': + if Path(file).name == "_version.py": modify_file(file, edit_version_file) def check_version(self): @@ -360,19 +363,21 @@ def check_version(self): def check_changelog_file(self): def edit_changelog_proc(content: List[str]): next_version = self.next_version - content[1:1] = ['\n', f'## {next_version}{self.version_suggestion} ({self.target_release_date})\n\n', self.get_changelog(), '\n'] + content[1:1] = [ + "\n", + f"## {next_version}{self.version_suggestion} ({self.target_release_date})\n\n", + self.get_changelog(), + "\n", + ] if next_version == "1.0.0b1": for _ in range(4): content.pop() - modify_file(str(Path(self.sdk_code_path()) / 'CHANGELOG.md'), edit_changelog_proc) + modify_file(str(Path(self.sdk_code_path()) / "CHANGELOG.md"), edit_changelog_proc) def check_dev_requirement(self): - file = Path(f'sdk/{self.sdk_folder}/{self.whole_package_name}/dev_requirements.txt') - content = [ - "-e ../../../tools/azure-sdk-tools\n", - "../../identity/azure-identity\n" - ] + file = Path(f"sdk/{self.sdk_folder}/{self.whole_package_name}/dev_requirements.txt") + content = ["-e ../../../tools/azure-sdk-tools\n", "../../identity/azure-identity\n"] if not file.exists(): with open(file, "w") as file_out: file_out.writelines(content) @@ -382,27 +387,55 @@ def check_package_size(self): packages = self.get_private_package() for package in packages: if os.path.getsize(package) > 2 * 1024 * 1024: - self.check_package_size_result.append(f'ERROR: Package size is over 2MBytes: {Path(package).name}!!!') + self.check_package_size_result.append( + f"ERROR: Package size is over 2MBytes: {Path(package).name}!!!" + ) def check_model_flatten(self): if self.from_swagger: last_version = self.get_last_release_version() if last_version == "" or last_version.startswith("1.0.0b"): - with open(self.readme_md_path, 'r') as file_in: + with open(self.readme_md_path, "r") as file_in: readme_md_content = file_in.read() - with open(self.readme_python_md_path, 'r') as file_in: + with open(self.readme_python_md_path, "r") as file_in: readme_python_md_content = file_in.read() - - if "flatten-models: false" not in readme_md_content and "flatten-models: false" not in readme_python_md_content and self.issue_link: + + if ( + "flatten-models: false" not in readme_md_content + and "flatten-models: false" not in readme_python_md_content + and self.issue_link + ): api = Github(self.bot_token).get_repo("Azure/sdk-release-request") - issue_number = int(self.issue_link.split('/')[-1]) + issue_number = int(self.issue_link.split("/")[-1]) issue = api.get_issue(issue_number) assignee = issue.assignee.login if issue.assignee else "" message = "please set `flatten-models: false` in readme.md or readme.python.md" - issue.create_comment(f'@{assignee}, {message}') + issue.create_comment(f"@{assignee}, {message}") raise Exception(message) + @return_origin_path + def check_pyproject_toml(self): + os.chdir(Path("sdk") / self.sdk_folder / self.whole_package_name) + # add `breaking = false` in pyproject.toml + toml = Path("pyproject.toml") + if not toml.exists(): + with open(toml, "w") as file: + file.write("[tool.azure-sdk-build]\nbreaking = false\n") + _LOG.info("create pyproject.toml") + + def edit_toml(content: List[str]): + has_breaking = False + for line in content: + if "breaking = false" in line: + has_breaking = True + break + if not has_breaking: + _LOG.info("add breaking = false to pyproject.toml") + content.append("breaking = false\n") + + modify_file(str(toml), edit_toml) + def check_file(self): self.check_file_with_packaging_tool() self.check_pprint_name() @@ -412,27 +445,28 @@ def check_file(self): self.check_dev_requirement() self.check_package_size() self.check_model_flatten() + self.check_pyproject_toml() def sdk_code_path(self) -> str: - return str(Path(f'sdk/{self.sdk_folder}/{self.whole_package_name}')) + return str(Path(f"sdk/{self.sdk_folder}/{self.whole_package_name}")) @property - def is_single_path(self) -> bool: - path = str(Path(f'sdk/{self.sdk_folder}')) - num = sum([os.path.isdir(str(Path(f'{path}/{listx}'))) for listx in os.listdir(path)]) - return num == 1 + def has_multi_packages(self) -> bool: + sdk_path = Path("sdk") / self.sdk_folder + packages = [l for l in sdk_path.iterdir() if l.is_dir() and l.name.startswith("azure")] + return len(packages) > 1 @return_origin_path def install_package_locally(self): os.chdir(self.sdk_code_path()) - print_check('pip install -e .') - print_exec('pip install -r dev_requirements.txt') + print_check("pip install -e .") + print_exec("pip install -r dev_requirements.txt") def prepare_test_env(self): self.install_package_locally() - + @staticmethod - def is_live_test()-> bool: + def is_live_test() -> bool: return str(os.getenv("AZURE_TEST_RUN_LIVE")).lower() == "true" @return_origin_path @@ -440,28 +474,28 @@ def run_test_proc(self): # run test os.chdir(self.sdk_code_path()) test_mode = "Live test" if self.is_live_test() else "Recording test" - succeeded_result = f'{test_mode} success' - failed_result = f'{test_mode} fail, detailed info is in pipeline log(search keyword FAILED)!!!' + succeeded_result = f"{test_mode} success" + failed_result = f"{test_mode} fail, detailed info is in pipeline log(search keyword FAILED)!!!" try: - print_check(f'pytest --collect-only') + print_check(f"pytest --collect-only") except: try: - assert "error" not in print_exec_output(f'pytest --collect-only')[-1] - log(f'{test_mode} run done, do not find any test !!!') + assert "error" not in print_exec_output(f"pytest --collect-only")[-1] + log(f"{test_mode} run done, do not find any test !!!") self.test_result = succeeded_result except: - log('some test collected failed, please fix it locally') + log("some test collected failed, please fix it locally") self.test_result = failed_result return try: - print_check(f'pytest -s') + print_check(f"pytest -s") except: - log('some test failed, please fix it locally') + log("some test failed, please fix it locally") self.test_result = failed_result else: - log(f'{test_mode} run done, do not find failure !!!') + log(f"{test_mode} run done, do not find failure !!!") self.test_result = succeeded_result - + self.has_test = True @staticmethod @@ -480,30 +514,30 @@ def run_test(self): self.prepare_test_env() self.run_test_proc() self.clean_test_env() - self.upload_recording_files() + # self.upload_recording_files() def create_pr_proc(self): - api = GhApi(owner='Azure', repo='azure-sdk-for-python', token=self.bot_token) + api = GhApi(owner="Azure", repo="azure-sdk-for-python", token=self.bot_token) pr_title = "[AutoRelease] {}(can only be merged by SDK owner)".format(self.new_branch) - pr_head = "{}:{}".format(os.getenv('USR_NAME'), self.new_branch) - pr_base = 'main' + pr_head = "{}:{}".format(os.getenv("USR_NAME"), self.new_branch) + pr_base = "main" pr_body = "" if not self.check_package_size_result else "{}\n".format("\n".join(self.check_package_size_result)) pr_body = pr_body + "{} \n{} \n{}".format(self.issue_link, self.test_result, self.pipeline_link) - if not self.is_single_path: - pr_body += f'\nBuildTargetingString\n {self.whole_package_name}\nSkip.CreateApiReview\ntrue' + if self.has_multi_packages: + pr_body += f"\nBuildTargetingString\n {self.whole_package_name}\nSkip.CreateApiReview" res_create = api.pulls.create(pr_title, pr_head, pr_base, pr_body) # Add issue link on PR - api = GhApi(owner='Azure', repo='azure-sdk-for-python', token=self.bot_token) - api.issues.create_comment(issue_number=res_create.number, body='issue link:{}'.format(self.issue_link)) + api = GhApi(owner="Azure", repo="azure-sdk-for-python", token=self.bot_token) + api.issues.create_comment(issue_number=res_create.number, body="issue link:{}".format(self.issue_link)) self.pr_number = res_create.number def zero_version_policy(self): - if re.match(re.compile('0\.0\.0'), self.next_version): - api_request = GhApi(owner='Azure', repo='sdk-release-request', token=self.bot_token) + if re.match(re.compile("0\.0\.0"), self.next_version): + api_request = GhApi(owner="Azure", repo="sdk-release-request", token=self.bot_token) if self.issue_link: - issue_number = int(self.issue_link.split('/')[-1]) - api_request.issues.add_labels(issue_number=issue_number, labels=['base-branch-attention']) + issue_number = int(self.issue_link.split("/")[-1]) + api_request.issues.add_labels(issue_number=issue_number, labels=["base-branch-attention"]) @property def after_multiapi_combiner(self) -> bool: @@ -516,32 +550,36 @@ def get_private_package(self) -> List[str]: @property def get_whl_package(self) -> str: - return [package for package in self.get_private_package() if package.endswith('.whl')][0] + return [package for package in self.get_private_package() if package.endswith(".whl")][0] def ask_check_policy(self): changelog = self.get_changelog() - if changelog == '': - changelog = 'no new content found by changelog tools!' + if changelog == "": + changelog = "no new content found by changelog tools!" if self.issue_link: # comment to ask for check from users - issue_number = int(self.issue_link.split('/')[-1]) - api = GhApi(owner='Azure', repo='sdk-release-request', token=self.bot_token) + issue_number = int(self.issue_link.split("/")[-1]) + api = GhApi(owner="Azure", repo="sdk-release-request", token=self.bot_token) author = self.issue_owner or api.issues.get(issue_number=issue_number).user.login - body = f'Hi @{author}, please check whether CHANGELOG for this release meet requirements:\n' \ - f'```\n' \ - f'CHANGELOG:\n' \ - f'{changelog}\n' \ - f'```\n' \ - '* (If you want private package for test or development, ' \ - f'please build it locally based on https://github.com/Azure/azure-sdk-for-python/pull/{self.pr_number} with [guidance](https://github.com/Azure/azure-sdk-for-python/wiki/Common-issues-about-Python-SDK#build-private-package-with-pr))\n\n' + body = ( + f"Hi @{author}, please check whether CHANGELOG for this release meet requirements:\n" + f"```\n" + f"CHANGELOG:\n" + f"{changelog}\n" + f"```\n" + "* (If you want private package for test or development, " + f"please build it locally based on https://github.com/Azure/azure-sdk-for-python/pull/{self.pr_number} with [guidance](https://github.com/Azure/azure-sdk-for-python/wiki/Common-issues-about-Python-SDK#build-private-package-with-pr))\n\n" + ) api.issues.create_comment(issue_number=issue_number, body=body) # comment for hint - body = 'Tips: If you have special needs for release date or other things, please let us know. ' \ - 'Otherwise we will follow ' \ - '[Management-SDK-Release-Cycle](https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/761/Management-SDK-Release-Cycle) ' \ - 'to release it before target date' + body = ( + "Tips: If you have special needs for release date or other things, please let us know. " + "Otherwise we will follow " + "[Management-SDK-Release-Cycle](https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/761/Management-SDK-Release-Cycle) " + "to release it before target date" + ) api.issues.create_comment(issue_number=issue_number, body=body) def issue_comment(self): @@ -550,9 +588,9 @@ def issue_comment(self): @staticmethod def commit_code(): - print_exec('git add sdk/') - print_exec('git commit -m \"code and test\"') - print_check('git push origin HEAD -f') + print_exec("git add sdk/") + print_exec('git commit -m "code and test"') + print_check("git push origin HEAD -f") def create_pr(self): # commit all code @@ -571,19 +609,19 @@ def run(self): self.run_test() self.create_pr() elif self.test_folder: - self.sdk_folder = self.test_folder.split('/')[0] - self.package_name = self.test_folder.split('/')[-1].split('-')[-1] + self.sdk_folder = self.test_folder.split("/")[0] + self.package_name = self.test_folder.split("/")[-1].split("-")[-1] env_var = os.getenv("DEBUG_SDK_BRANCH", "") branch = env_var.split(":")[-1] - print_check(f'git checkout {branch}') + print_check(f"git checkout {branch}") self.run_test() # commit all code self.commit_code() -if __name__ == '__main__': +if __name__ == "__main__": main_logger = logging.getLogger() logging.basicConfig() main_logger.setLevel(logging.INFO) diff --git a/scripts/auto_release/requirement.txt b/scripts/auto_release/requirement.txt index 34727da84979d..1fd11ed3158bb 100644 --- a/scripts/auto_release/requirement.txt +++ b/scripts/auto_release/requirement.txt @@ -4,4 +4,5 @@ ghapi==0.1.19 PyGithub==1.55 packaging==23.1 pytest==6.2.5 -fastcore==1.3.25 \ No newline at end of file +fastcore==1.3.25 +tox==4.5.0 \ No newline at end of file diff --git a/scripts/automation_init.sh b/scripts/automation_init.sh index 6e5641fb44943..71887c6dbe235 100644 --- a/scripts/automation_init.sh +++ b/scripts/automation_init.sh @@ -14,6 +14,7 @@ PATH="$VIRTUAL_ENV/bin:$PATH" export PATH python -m pip install -U pip python scripts/dev_setup.py -p azure-core +pip install tox==4.15.0 # install tsp-client globally (local install may interfere with tooling) echo Install tsp-client diff --git a/scripts/breaking_changes_checker/breaking_changes_allowlist.py b/scripts/breaking_changes_checker/breaking_changes_allowlist.py index da4f699152af8..d3667fb5d606e 100644 --- a/scripts/breaking_changes_checker/breaking_changes_allowlist.py +++ b/scripts/breaking_changes_checker/breaking_changes_allowlist.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------------------------- -RUN_BREAKING_CHANGES_PACKAGES = [] +RUN_BREAKING_CHANGES_PACKAGES = ["azure-mgmt-*"] # See Readme for ignore format @@ -20,6 +20,8 @@ ("ChangedParameterKind", "*", "*", "*", "filter"), ("ChangedParameterKind", "*", "*", "*", "skip"), ("RemovedOrRenamedPositionalParam", "*", "*", "*", "maxpagesize"), + # msrest model bases on vendored _serialization.model instead of msrest.Model which no longer has "validate" + ("RemovedOrRenamedClassMethod", "*", "*", "validate"), # Changes due to not using msrest anymore ("RemovedOrRenamedClassMethod", "*", "*", "as_dict"), ("RemovedOrRenamedClassMethod", "*", "*", "deserialize"), diff --git a/scripts/breaking_changes_checker/breaking_changes_tracker.py b/scripts/breaking_changes_checker/breaking_changes_tracker.py index 3dc7cc0a016c4..83096bfa8978b 100644 --- a/scripts/breaking_changes_checker/breaking_changes_tracker.py +++ b/scripts/breaking_changes_checker/breaking_changes_tracker.py @@ -42,63 +42,63 @@ class BreakingChangeType(str, Enum): class BreakingChangesTracker: REMOVED_OR_RENAMED_CLIENT_MSG = \ - "The client '{}.{}' was deleted or renamed in the current version" + "The client '{}' was deleted or renamed in the current version" REMOVED_OR_RENAMED_CLIENT_METHOD_MSG = \ - "The '{}.{}' client method '{}' was deleted or renamed in the current version" + "The '{}' client method '{}' was deleted or renamed in the current version" REMOVED_OR_RENAMED_CLASS_MSG = \ - "The model or publicly exposed class '{}.{}' was deleted or renamed in the current version" + "The model or publicly exposed class '{}' was deleted or renamed in the current version" REMOVED_OR_RENAMED_CLASS_METHOD_MSG = \ - "The '{}.{}' method '{}' was deleted or renamed in the current version" + "The '{}' method '{}' was deleted or renamed in the current version" REMOVED_OR_RENAMED_MODULE_LEVEL_FUNCTION_MSG = \ - "The publicly exposed function '{}.{}' was deleted or renamed in the current version" + "The publicly exposed function '{}' was deleted or renamed in the current version" REMOVED_OR_RENAMED_POSITIONAL_PARAM_OF_METHOD_MSG = \ - "The '{}.{}' method '{}' had its parameter '{}' of kind '{}' deleted or renamed in the current version" + "The '{}' method '{}' had its parameter '{}' of kind '{}' deleted or renamed in the current version" REMOVED_OR_RENAMED_POSITIONAL_PARAM_OF_FUNCTION_MSG = \ - "The function '{}.{}' had its parameter '{}' of kind '{}' deleted or renamed in the current version" + "The function '{}' had its parameter '{}' of kind '{}' deleted or renamed in the current version" ADDED_POSITIONAL_PARAM_TO_METHOD_MSG = \ - "The '{}.{}' method '{}' had a '{}' parameter '{}' inserted in the current version" + "The '{}' method '{}' had a '{}' parameter '{}' inserted in the current version" ADDED_POSITIONAL_PARAM_TO_FUNCTION_MSG = \ - "The function '{}.{}' had a '{}' parameter '{}' inserted in the current version" + "The function '{}' had a '{}' parameter '{}' inserted in the current version" REMOVED_OR_RENAMED_INSTANCE_ATTRIBUTE_FROM_CLIENT_MSG = \ - "The client '{}.{}' had its instance variable '{}' deleted or renamed in the current version" + "The client '{}' had its instance variable '{}' deleted or renamed in the current version" REMOVED_OR_RENAMED_INSTANCE_ATTRIBUTE_FROM_MODEL_MSG = \ - "The model or publicly exposed class '{}.{}' had its instance variable '{}' deleted or renamed " \ + "The model or publicly exposed class '{}' had its instance variable '{}' deleted or renamed " \ "in the current version" REMOVED_OR_RENAMED_ENUM_VALUE_MSG = \ - "The '{}.{}' enum had its value '{}' deleted or renamed in the current version" + "The '{}' enum had its value '{}' deleted or renamed in the current version" CHANGED_PARAMETER_DEFAULT_VALUE_MSG = \ - "The class '{}.{}' method '{}' had its parameter '{}' default value changed from '{}' to '{}'" + "The class '{}' method '{}' had its parameter '{}' default value changed from '{}' to '{}'" CHANGED_PARAMETER_DEFAULT_VALUE_OF_FUNCTION_MSG = \ - "The publicly exposed function '{}.{}' had its parameter '{}' default value changed from '{}' to '{}'" + "The publicly exposed function '{}' had its parameter '{}' default value changed from '{}' to '{}'" REMOVED_PARAMETER_DEFAULT_VALUE_MSG = \ - "The class '{}.{}' method '{}' had default value '{}' removed from its parameter '{}' in " \ + "The class '{}' method '{}' had default value '{}' removed from its parameter '{}' in " \ "the current version" REMOVED_PARAMETER_DEFAULT_VALUE_OF_FUNCTION_MSG = \ - "The publicly exposed function '{}.{}' had default value '{}' removed from its parameter '{}' in " \ + "The publicly exposed function '{}' had default value '{}' removed from its parameter '{}' in " \ "the current version" CHANGED_PARAMETER_ORDERING_MSG = \ - "The class '{}.{}' method '{}' had its parameters re-ordered from '{}' to '{}' in the current version" + "The class '{}' method '{}' had its parameters re-ordered from '{}' to '{}' in the current version" CHANGED_PARAMETER_ORDERING_OF_FUNCTION_MSG = \ - "The publicly exposed function '{}.{}' had its parameters re-ordered from '{}' to '{}' in " \ + "The publicly exposed function '{}' had its parameters re-ordered from '{}' to '{}' in " \ "the current version" CHANGED_PARAMETER_KIND_MSG = \ - "The class '{}.{}' method '{}' had its parameter '{}' changed from '{}' to '{}' in the current version" + "The class '{}' method '{}' had its parameter '{}' changed from '{}' to '{}' in the current version" CHANGED_PARAMETER_KIND_OF_FUNCTION_MSG = \ - "The function '{}.{}' had its parameter '{}' changed from '{}' to '{}' in the current version" + "The function '{}' had its parameter '{}' changed from '{}' to '{}' in the current version" CHANGED_CLASS_FUNCTION_KIND_MSG = \ - "The class '{}.{}' method '{}' changed from '{}' to '{}' in the current version." + "The class '{}' method '{}' changed from '{}' to '{}' in the current version." CHANGED_FUNCTION_KIND_MSG = \ - "The function '{}.{}' changed from '{}' to '{}' in the current version." + "The function '{}' changed from '{}' to '{}' in the current version." REMOVED_OR_RENAMED_MODULE_MSG = \ "The '{}' module was deleted or renamed in the current version" REMOVED_CLASS_FUNCTION_KWARGS_MSG = \ - "The class '{}.{}' method '{}' changed from accepting keyword arguments to not accepting them in " \ + "The class '{}' method '{}' changed from accepting keyword arguments to not accepting them in " \ "the current version" REMOVED_FUNCTION_KWARGS_MSG = \ - "The function '{}.{}' changed from accepting keyword arguments to not accepting them in " \ + "The function '{}' changed from accepting keyword arguments to not accepting them in " \ "the current version" REMOVED_OR_RENAMED_OPERATION_GROUP_MSG = \ - "The '{}.{}' client had operation group '{}' deleted or renamed in the current version" + "The '{}' client had operation group '{}' deleted or renamed in the current version" def __init__(self, stable: Dict, current: Dict, diff: Dict, package_name: str, **kwargs: Any) -> None: self.stable = stable @@ -625,9 +625,10 @@ def report_changes(self) -> None: formatted = "\n" for idx, bc in enumerate(self.breaking_changes): - msg, *args = bc + # Extract the message and the change type, skip the module name + msg, bc_type, _, *args = bc # For simple breaking changes reporting, prepend the change code to the message - msg = "({}): " + msg + "\n" + msg = f"({bc_type}): " + msg + "\n" formatted += msg.format(*args) formatted += f"\nFound {len(self.breaking_changes)} breaking changes.\n" diff --git a/scripts/breaking_changes_checker/changelog_tracker.py b/scripts/breaking_changes_checker/changelog_tracker.py index 116cad6977549..8fde476026ab3 100644 --- a/scripts/breaking_changes_checker/changelog_tracker.py +++ b/scripts/breaking_changes_checker/changelog_tracker.py @@ -22,21 +22,21 @@ class ChangeType(str, Enum): class ChangelogTracker(BreakingChangesTracker): ADDED_CLIENT_MSG = \ - "The client '{}.{}' was added in the current version" + "The client '{}' was added in the current version" ADDED_CLIENT_METHOD_MSG = \ - "The '{}.{}' client method '{}' was added in the current version" + "The '{}' client method '{}' was added in the current version" ADDED_CLASS_MSG = \ - "The model or publicly exposed class '{}.{}' was added in the current version" + "The model or publicly exposed class '{}' was added in the current version" ADDED_CLASS_METHOD_MSG = \ - "The '{}.{}' method '{}' was added in the current version" + "The '{}' method '{}' was added in the current version" ADDED_CLASS_METHOD_PARAMETER_MSG = \ - "The model or publicly exposed class '{}.{}' had property '{}' added in the {} method in the current version" + "The model or publicly exposed class '{}' had property '{}' added in the {} method in the current version" ADDED_FUNCTION_PARAMETER_MSG = \ - "The function '{}.{}' had parameter '{}' added in the current version" + "The function '{}' had parameter '{}' added in the current version" ADDED_CLASS_PROPERTY_MSG = \ - "The model or publicly exposed class '{}.{}' had property '{}' added in the current version" + "The model or publicly exposed class '{}' had property '{}' added in the current version" ADDED_OPERATION_GROUP_MSG = \ - "The '{}.{}' client had operation group '{}' added in the current version" + "The '{}' client had operation group '{}' added in the current version" def __init__(self, stable: Dict, current: Dict, diff: Dict, package_name: str, **kwargs: Any) -> None: @@ -159,7 +159,8 @@ def _build_md(content: list, title: str, buffer: list): buffer.append(title) buffer.append("") for _, bc in enumerate(content): - msg, _, *args = bc + # Extract the message, skip the change type and the module name + msg, _, _,*args = bc buffer.append(" - " + msg.format(*args)) buffer.append("") return buffer @@ -170,4 +171,6 @@ def _build_md(content: list, title: str, buffer: list): if self.breaking_changes: _build_md(self.breaking_changes, "### Breaking Changes", buffer) content = "\n".join(buffer).strip() + + content = "===== changelog start =====\n" + content + "\n===== changelog end =====\n" return content diff --git a/scripts/breaking_changes_checker/detect_breaking_changes.py b/scripts/breaking_changes_checker/detect_breaking_changes.py index 917b55cb488c7..3d4f396631114 100644 --- a/scripts/breaking_changes_checker/detect_breaking_changes.py +++ b/scripts/breaking_changes_checker/detect_breaking_changes.py @@ -321,9 +321,8 @@ def test_compare_reports(pkg_dir: str, changelog: bool, source_report: str = "st remove_json_files(pkg_dir) - print("===== changelog start =====") print(checker.report_changes()) - print("===== changelog end =====") + if not changelog and checker.breaking_changes: exit(1) diff --git a/scripts/devops_tasks/generate_ml_sample_update.py b/scripts/devops_tasks/generate_ml_sample_update.py index f6d0b30daba27..4bdc20a2cec00 100644 --- a/scripts/devops_tasks/generate_ml_sample_update.py +++ b/scripts/devops_tasks/generate_ml_sample_update.py @@ -5,6 +5,7 @@ import re from azure.storage.blob import BlobServiceClient +from azure.identity import AzurePowerShellCredential, ChainedTokenCredential, AzureCliCredential UPLOAD_PATTERN = "{build_id}/{filename}" DEFAULT_CONTAINER = os.getenv("BLOB_CONTAINER", "ml-sample-submissions") @@ -59,6 +60,13 @@ def replace_test_install_command(content, targeted_urls): help=("The folder from where the the azure ml wheel will reside."), ) + parser.add_argument( + "--storage-account-name", + dest="storage_account_name", + help=("The name of the storage account"), + ) + + args = parser.parse_args() print("Input repo {}".format(args.ml_root)) @@ -66,7 +74,9 @@ def replace_test_install_command(content, targeted_urls): target_glob = os.path.join(os.path.abspath(args.wheel_folder), "*.whl") sdk_setup_sh = os.path.join(os.path.abspath(args.ml_root), "sdk", "python", "setup.sh") - blob_service_client = BlobServiceClient.from_connection_string(CONNECTION_STRING) + credential_chain = ChainedTokenCredential(AzureCliCredential(), AzurePowerShellCredential()) + + blob_service_client = BlobServiceClient(account_url=f"https://{args.storage_account_name}.blob.core.windows.net", credential=credential_chain) container_client = blob_service_client.get_container_client(DEFAULT_CONTAINER) to_be_installed = [] diff --git a/scripts/old_packages/README.md b/scripts/old_packages/README.md new file mode 100644 index 0000000000000..91fd852da6e56 --- /dev/null +++ b/scripts/old_packages/README.md @@ -0,0 +1,39 @@ +# Output old packages script + +This script can be run to output old packages in the repo and their download stats to csv. + +It defaults to reporting packages that have not seen a release in the last 2 years. + +To omit an older package from the script output that we don't want to deprecate, add the `verify_status_by` key to the package's `pyproject.toml`. The value should be a date in the format `YYYY-MM-DD` and indicate the future date by which the package should be re-evaluated for deprecation. If a package should be kept and not re-evaluated, then set the date to 3000-01-01. + +```toml +[tool.azure-sdk-build] +verify_status_by = 2025-07-09 +``` + +## Requirements + +- requests +- PePy API key ([PePy API](https://www.pepy.tech/pepy-api)) + +Set the `PEPY_API_KEY` environment variable to your PePy API key. + +## Usage + +1. Defaults to packages that have not released in the past 2 years. Omits already Inactive released packages. + +```bash +python output_old_packages.py +``` + +2. Specify the number of years since last release (e.g. 1 year). + +```bash +python output_old_packages.py -y 1 +``` + +3. Run unfiltered (don't omit already Inactive packages or packages which have a `verify_status_by` in the future.) + +```bash +python output_old_packages.py -f +``` diff --git a/scripts/old_packages/output_old_packages.py b/scripts/old_packages/output_old_packages.py new file mode 100644 index 0000000000000..6282ff455d721 --- /dev/null +++ b/scripts/old_packages/output_old_packages.py @@ -0,0 +1,172 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os +import typing +import csv +import argparse +import pathlib +import glob +import datetime + +import requests + +from ci_tools.parsing import get_config_setting +from pypi_tools.pypi import PyPIClient + +INACTIVE_CLASSIFIER = "Development Status :: 7 - Inactive" + + +def get_newer(current: datetime.date, contender: datetime.date) -> datetime.date: + if current > contender: + return current + return contender + + +def write_csv(packages: typing.Mapping[str, str]) -> None: + if not packages: + print("No packages found.") + return + + with open("./old_packages.csv", mode="w", newline="", encoding="utf-8") as file: + writer = csv.writer(file) + + column_names = [ + "Package", + "Last released version", + "Last released date", + "Status", + "Downloads (last 90 days)" + ] + writer.writerow(column_names) + + for package, info in packages.items(): + writer.writerow([package, info["version"], info["date"], info["status"], info["downloads_90d"]]) + + +def get_latest_release( + project: typing.Mapping[str, typing.Any] +) -> typing.Mapping[str, str]: + current = datetime.datetime(1970, 1, 1).date() + + for version, release in project["releases"].items(): + if not release: + # somehow we release without whl/sdist? + continue + + release_date = datetime.datetime.strptime( + release[0]["upload_time"], "%Y-%m-%dT%H:%M:%S" + ).date() + if get_newer(current, release_date) == release_date: + latest = { + "version": version, + "date": release_date, + "status": project["info"]["classifiers"][0], + } + current = release_date + return latest + + +def apply_filters(pkg_path: str, release: typing.Mapping[str, str]) -> bool: + """Filter out packages that are marked as Inactive or have a verify_status_by date in the future. + If the package has no verify_status_by date, it is considered active. + """ + if release["status"] == INACTIVE_CLASSIFIER: + return False + + verify_status_by = get_config_setting(pkg_path, "verify_status_by", default=None) + if verify_status_by is None: + return True + + today = datetime.datetime.today().date() + if get_newer(today, verify_status_by) == verify_status_by: + return False + + return True + + +class PepyClient: + """Client to interact with the Pepy API to fetch package download data.""" + + def __init__(self, api_key: str): + """Initialize the client with your API key - https://www.pepy.tech/pepy-api (register first)""" + self.api_key = api_key + + def get_downloads_90d(self, package: str) -> int: + """Get the total downloads in the last 90 days for a given package.""" + url = f"https://api.pepy.tech/api/v2/projects/{package}" + headers = {"x-api-key": self.api_key} + try: + response = requests.get(url, headers=headers) + response.raise_for_status() + downloads_90d = response.json().get("downloads", {}) + except requests.RequestException as e: + print(f"Request failed: {e}") + return -1 + + total_downloads_90d = sum( + downloads + for versions in downloads_90d.values() + for downloads in versions.values() + ) + + return total_downloads_90d + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Output old packages in the repo.") + + parser.add_argument( + "-y", + "--years", + dest="years", + help="How many years since last release. Defaults to 2.", + type=int, + default=2, + ) + + parser.add_argument( + "-f", + "--disable-filter", + dest="filter", + help="Disable the filter which removes Inactive packages and ones with verify_status_by dates in the future.", + action="store_false", + ) + + args = parser.parse_args() + sdk_path = pathlib.Path(__file__).parent.parent.parent / "sdk" + service_directories = glob.glob(f"{sdk_path}/*/", recursive=True) + pypi_client = PyPIClient() + pepy_client = PepyClient(os.environ["PEPY_API_KEY"]) + old_packages = {} + + years = args.years + timepoint = datetime.datetime.today().date() - datetime.timedelta(days=365 * years) + + for service in service_directories: + package_paths = glob.glob(f"{service}*/", recursive=True) + for package_path in package_paths: + package_name = pathlib.Path(package_path).name + if not package_name.startswith("azure"): + continue + + pypi_project = pypi_client.project(package_name) + if pypi_project.get("releases") is None: + # not yet released + continue + + latest_release = get_latest_release(pypi_project) + + if ( + get_newer(latest_release["date"], timepoint) == timepoint + ): + add_package = not args.filter or apply_filters(package_path, latest_release) + if add_package: + old_packages[package_name] = latest_release + old_packages[package_name]["downloads_90d"] = ( + pepy_client.get_downloads_90d(package_name) + ) + + write_csv(old_packages) diff --git a/scripts/repo_health_status_report/README.md b/scripts/repo_health_status_report/README.md new file mode 100644 index 0000000000000..fcbbdc7bcd480 --- /dev/null +++ b/scripts/repo_health_status_report/README.md @@ -0,0 +1,14 @@ +# Python SDK Health Status Report + +This script generates a health status report for the Python SDK. The report can be found at [aka.ms/azsdk/python/health](https://www.aka.ms/azsdk/python/health). + +# How to run the script + +1. pip install -r dev_requirements.txt +2. az login +3. Set the `GH_TOKEN` environment variable to your [GitHub PAT](https://github.com/settings/tokens) (with repo permissions). +4. Run the script: `python output_health_report.py` + +## Command line options + +By default, the script will generate a csv report. To generate a report in markdown or html, pass `-f markdown` or `-f html`, respectively. To omit SDK team owned libraries from the report, pass `-s`. diff --git a/scripts/repo_health_status_report/dev_requirements.txt b/scripts/repo_health_status_report/dev_requirements.txt new file mode 100644 index 0000000000000..6b9348ed6bdfe --- /dev/null +++ b/scripts/repo_health_status_report/dev_requirements.txt @@ -0,0 +1,6 @@ +httpx==0.25.2 +markdown==3.6 +PyGitHub>=1.59.0 +setuptools==67.6.0 +-e ../../sdk/identity/azure-identity +-e ../../tools/azure-sdk-tools diff --git a/scripts/repo_health_status_report/output_health_report.py b/scripts/repo_health_status_report/output_health_report.py new file mode 100644 index 0000000000000..2d4259894dcad --- /dev/null +++ b/scripts/repo_health_status_report/output_health_report.py @@ -0,0 +1,882 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from __future__ import annotations + +import os +import csv +import typing +import json +import glob +import pathlib +import argparse +import datetime + +import httpx +import markdown +from github import Github, Auth +from azure.identity import DefaultAzureCredential + +from ci_tools.variables import in_ci +from ci_tools.parsing import ParsedSetup +from ci_tools.environment_exclusions import ( + is_check_enabled, + IGNORE_FILTER, + IGNORE_PACKAGES, + FILTER_EXCLUSIONS, +) + +IGNORE_PACKAGES.append("azure-openai") + +# Github +GIT_TOKEN = os.environ["GH_TOKEN"] +auth = Auth.Token(GIT_TOKEN) +github = Github(auth=auth) +# repo = github.get_repo("Azure/azure-sdk-for-python") + +# Azure DevOps +DEVOPS_RESOURCE_UUID = "499b84ac-1321-427f-aa17-267ca6975798" +token = DefaultAzureCredential().get_token(f"{DEVOPS_RESOURCE_UUID}/.default").token +AUTH_HEADERS = {"Authorization": f"Bearer {token}"} +DEVOPS_TASK_STATUS = typing.Literal[ + "abandoned", + "canceled", + "failed", + "skipped", + "succeeded", + "succeededWithIssues", + "UNKNOWN", +] +DEVOPS_BUILD_STATUS = typing.Literal["succeeded", "failed", "canceled", "none", "partiallySucceeded", "UNKNOWN"] +LIST_BUILDS = "https://dev.azure.com/azure-sdk/internal/_apis/pipelines?api-version=7.0" + +# Statuses for table +LIBRARY_STATUS = typing.Literal["NEEDS_ACTION", "BLOCKED", "GOOD"] +CHECK_STATUS = typing.Literal["PASS", "FAIL", "WARNING", "DISABLED", "UNKNOWN"] + +NEXT_CHECKS = ("mypy", "pyright", "pylint") +RELEASE_BLOCKERS = ( + "mypy", + "pylint", + "pyright", + "sphinx", + "ci", +) # will block release if failing +MANDATORY_CHECKS = ( + "mypy", + "pylint", + "sphinx", + "ci", +) # must be enabled to be considered GOOD + +INACTIVE_CLASSIFIER = "Development Status :: 7 - Inactive" + +# Script types +ServiceDirectory = str +LibraryName = str +CheckTypes = typing.Literal["mypy", "pyright", "pylint", "sphinx", "ci", "tests"] + + +class Status(typing.TypedDict, total=False): + status: CHECK_STATUS + link: str | None + + +class CheckStatus(typing.TypedDict, total=False): + status: DEVOPS_TASK_STATUS + log: str | None + + +class TestsWeeklyPipelineResult(typing.TypedDict, total=False): + id: int + link: str + result: DEVOPS_BUILD_STATUS + next_mypy: CheckStatus + next_pyright: CheckStatus + next_pylint: CheckStatus + tests_weekly: CheckStatus + + +class TestsPipelineResult(typing.TypedDict, total=False): + id: int + link: str + result: DEVOPS_BUILD_STATUS + tests: CheckStatus + + +class CIPipelineResult(typing.TypedDict, total=False): + id: int + link: str + result: DEVOPS_BUILD_STATUS + mypy: CheckStatus + pyright: CheckStatus + pylint: CheckStatus + sphinx: CheckStatus + ci: CheckStatus + + +class PipelineResults(typing.TypedDict, total=False): + ci: CIPipelineResult + tests: TestsPipelineResult + tests_weekly: TestsWeeklyPipelineResult + + +class SLAStatus(typing.TypedDict, total=False): + question: IssueDetails + """open > 30 days""" + bug: IssueDetails + """open > 90 days""" + + +class IssueDetails(typing.TypedDict, total=False): + num: int + link: str + + +class LibraryStatus(typing.TypedDict, total=False): + status: LIBRARY_STATUS + path: pathlib.Path + label: str | None + sla: SLAStatus | None + customer_issues: IssueDetails | None + mypy: Status + pyright: Status + type_check_samples: typing.Literal["ENABLED", "DISABLED"] + pylint: Status + sphinx: Status + sdk_owned: bool + tests: Status + ci: Status + + +PipelineResultsUnion = typing.Union[CIPipelineResult, TestsPipelineResult, TestsWeeklyPipelineResult] + +SDK_TEAM_OWNED = [ + "azure-ai-documentintelligence", + "azure-ai-formrecognizer", + "azure-appconfiguration", + "azure-containerregistry", + "azure-core", + "azure-mgmt-core", + "azure-core-experimental", + "azure-core-tracing-opencensus", + "azure-core-tracing-opentelemetry", + "azure-data-tables", + "azure-eventgrid", + "azure-eventhub", + "azure-eventhub-checkpointstoreblob", + "azure-eventhub-checkpointstoreblob-aio", + "azure-eventhub-checkpointstoretable", + "azure-identity", + "azure-identity-broker", + "azure-keyvault-administration", + "azure-keyvault-certificates", + "azure-keyvault-keys", + "azure-keyvault-secrets", + "azure-monitor-ingestion", + "azure-monitor-query", + "azure-schemaregistry", + "azure-schemaregistry-avroencoder", + "azure-search-documents", + "azure-servicebus", + "corehttp", +] + + +def get_build_url(pipeline_id: int) -> str: + return f"https://dev.azure.com/azure-sdk/internal/_apis/build/builds?definitions={str(pipeline_id)}&$top=1&queryOrder=finishTimeDescending&reasonFilter=schedule&api-version=7.0" + + +def get_build_timeline_url(build_id: str) -> str: + return f"https://dev.azure.com/azure-sdk/internal/_apis/build/builds/{build_id}/Timeline?api-version=7.0" + + +def get_github_issue_link(label: str, kind: typing.Literal["bug", "question"], created: str) -> str: + label = label.replace(" ", "+") + if kind == "question": + minus = "bug" + else: + minus = "question" + return f"https://github.com/Azure/azure-sdk-for-python/issues?q=is%3Aopen+is%3Aissue+label%3Acustomer-reported+label%3AClient+-label%3Aissue-addressed+-label%3A{minus}+-label%3Aneeds-author-feedback+-label%3Afeature-request+label%3A%22{label}%22+created%3A%22%3C{created}%22" + + +def get_github_total_issue_link(label: str) -> str: + label = label.replace(" ", "+") + return f"https://github.com/Azure/azure-sdk-for-python/issues?q=is%3Aopen+is%3Aissue+label%3Acustomer-reported+label%3AClient+label%3A%22{label}%22" + + +def is_package_inactive(package_path: str) -> bool: + return INACTIVE_CLASSIFIER in ParsedSetup.from_path(package_path).classifiers + + +def skip_package(package_name: str) -> bool: + return ( + (not package_name.startswith("azure") and package_name != "corehttp") + or package_name in IGNORE_PACKAGES + or package_name not in FILTER_EXCLUSIONS + and any(identifier in package_name for identifier in IGNORE_FILTER) + ) + + +def get_dataplane( + include_sdk_owned: bool = True, +) -> dict[ServiceDirectory, dict[LibraryName, LibraryStatus]]: + dataplane: dict[ServiceDirectory, dict[LibraryName, LibraryStatus]] = {} + sdk_path = pathlib.Path(__file__).parent.parent.parent / "sdk" + service_directories = glob.glob(f"{sdk_path}/*/", recursive=True) + + for service in service_directories: + package_paths = glob.glob(f"{service}*/", recursive=True) + for pkg_path in package_paths: + package_path = pathlib.Path(pkg_path) + package_name = package_path.name + if ( + skip_package(package_name) + or is_package_inactive(str(package_path)) + or (package_name in SDK_TEAM_OWNED and not include_sdk_owned) + ): + continue + service_directory = pathlib.Path(service).name + dataplane.setdefault(service_directory, {}) + dataplane[service_directory][package_name] = LibraryStatus(path=package_path) + + sorted_libs = {key: dataplane[key] for key in sorted(dataplane)} + return sorted_libs + + +def get_pipelines( + dataplane: dict[ServiceDirectory, dict[LibraryName, LibraryStatus]] +) -> dict[ServiceDirectory, PipelineResults]: + + response = httpx.get(LIST_BUILDS, headers=AUTH_HEADERS) + if response.status_code != 200: + raise Exception(f"Failed to get pipelines - {response.status_code}") + pipelines_json = json.loads(response.text) + python_pipelines = [ + pipeline + for pipeline in pipelines_json["value"] + if "python - " in pipeline["name"] + and "autorest" not in pipeline["name"] + and "update_pr" not in pipeline["name"] + and "azure-sdk-for-python" not in pipeline["name"] + ] + pipelines: dict[ServiceDirectory, PipelineResults] = {} + for p in python_pipelines: + pipeline_name = p["name"] + for service_directory, _ in dataplane.items(): + pipelines.setdefault(service_directory, {}) + if service_directory == pipeline_name.split("python - ")[1]: + pipelines[service_directory].update(PipelineResults(ci=CIPipelineResult(id=p["id"], link=""))) + record_all_pipeline("ci", pipelines[service_directory], "UNKNOWN") + if f"{service_directory} - tests" == pipeline_name.split("python - ")[1]: + pipelines[service_directory].update(PipelineResults(tests=TestsPipelineResult(id=p["id"], link=""))) + record_all_pipeline("tests", pipelines[service_directory], "UNKNOWN") + if f"{service_directory} - tests-weekly" == pipeline_name.split("python - ")[1]: + pipelines[service_directory].update( + PipelineResults(tests_weekly=TestsWeeklyPipelineResult(id=p["id"], link="")) + ) + record_all_pipeline("tests_weekly", pipelines[service_directory], "UNKNOWN") + return pipelines + + +def record_check_result(task: dict[str, str], type: str, pipeline: PipelineResultsUnion): + pipeline.update({type: CheckStatus(status=task["result"])}) + pipeline[type]["log"] = task["log"]["url"] + + +def record_test_result( + task: dict, + type: typing.Literal["ci", "tests", "tests_weekly"], + pipeline: CIPipelineResult | TestsPipelineResult | TestsWeeklyPipelineResult, +) -> None: + unsuccessful = ["failed", "canceled", "abandoned", "skipped", "succeededWithIssues"] + if task["result"] == "succeeded": + if pipeline.get(type, {}).get("status") not in unsuccessful: + pipeline.update({type: CheckStatus(status="succeeded")}) + elif task["result"] == "failed": + pipeline.update({type: CheckStatus(status="failed")}) + pipeline[type]["log"] = task["log"]["url"] + elif pipeline.get(type, {}).get("status") != "failed": + pipeline.update({type: CheckStatus(status=task["result"])}) + pipeline[type]["log"] = task["log"]["url"] + + +def record_all_pipeline( + task: typing.Literal["ci", "tests", "tests_weekly"], + pipeline: PipelineResults, + status: typing.Literal["succeeded", "UNKNOWN"], +) -> None: + if task == "ci": + pipeline.setdefault("ci", {}) + pipeline["ci"].update( + CIPipelineResult( + { + "result": status, + "mypy": CheckStatus(status=status), + "pyright": CheckStatus(status=status), + "pylint": CheckStatus(status=status), + "sphinx": CheckStatus(status=status), + "ci": CheckStatus(status=status), + } + ) + ) + elif task == "tests": + pipeline.setdefault("tests", {}) + pipeline["tests"].update( + TestsPipelineResult( + { + "result": status, + "tests": CheckStatus(status=status), + } + ) + ) + elif task == "tests_weekly": + pipeline.setdefault("tests_weekly", {}) + pipeline["tests_weekly"].update( + TestsWeeklyPipelineResult( + { + "result": status, + "next_mypy": CheckStatus(status=status), + "next_pyright": CheckStatus(status=status), + "next_pylint": CheckStatus(status=status), + "tests_weekly": CheckStatus(status=status), + } + ) + ) + + +def record_all_library(details: LibraryStatus, status: CHECK_STATUS) -> None: + details["mypy"] = Status(status=status, link=None) + details["pyright"] = Status(status=status, link=None) + details["type_check_samples"] = ( + "ENABLED" + if is_check_enabled(str(details["path"]), "type_check_samples") and details["status"] != "BLOCKED" + else "DISABLED" + ) + details["sdk_owned"] = details["path"].name in SDK_TEAM_OWNED + details["pylint"] = Status(status=status, link=None) + details["sphinx"] = Status(status=status, link=None) + details["ci"] = Status(status=status, link=None) + details["tests"] = Status(status=status, link=None) + + +def get_ci_result(service: str, pipeline_id: int | None, pipelines: dict[ServiceDirectory, PipelineResults]) -> None: + if not pipeline_id: + print(f"No CI result for {service}") + record_all_pipeline("ci", pipelines[service], "UNKNOWN") + return + + build_response = httpx.get(get_build_url(pipeline_id), headers=AUTH_HEADERS) + build_result = json.loads(build_response.text) + if build_response.status_code != 200 or not build_result["value"]: + print(f"No CI result for {service}") + record_all_pipeline("ci", pipelines[service], "UNKNOWN") + return + + result = build_result["value"][0] + pipelines[service]["ci"]["link"] = result["_links"]["web"]["href"] + if result["result"] == "succeeded": + # set all checks to pass + record_all_pipeline("ci", pipelines[service], "succeeded") + return + + # get timeline + pipelines[service]["ci"].update({"result": result["result"]}) + build_id = result["id"] + timeline_response = httpx.get(get_build_timeline_url(build_id), headers=AUTH_HEADERS) + timeline_result = json.loads(timeline_response.text) + + for task in timeline_result["records"]: + if "Run Tests" in task["name"]: + record_test_result(task, "ci", pipelines[service]["ci"]) + elif "Generate Docs" in task["name"]: + record_check_result(task, "sphinx", pipelines[service]["ci"]) + elif "Run MyPy" in task["name"]: + record_check_result(task, "mypy", pipelines[service]["ci"]) + elif "Run Pyright" in task["name"]: + record_check_result(task, "pyright", pipelines[service]["ci"]) + elif "Run Pylint" in task["name"]: + record_check_result(task, "pylint", pipelines[service]["ci"]) + + +def get_tests_result(service: str, pipeline_id: int | None, pipelines: dict[ServiceDirectory, PipelineResults]) -> None: + if not pipeline_id: + print(f"No live tests result for {service}") + record_all_pipeline("tests", pipelines[service], "UNKNOWN") + return + + build_response = httpx.get(get_build_url(pipeline_id), headers=AUTH_HEADERS) + build_result = json.loads(build_response.text) + if build_response.status_code != 200 or not build_result["value"]: + print(f"No live tests result for {service}") + record_all_pipeline("tests", pipelines[service], "UNKNOWN") + return + + result = build_result["value"][0] + pipelines[service]["tests"]["link"] = result["_links"]["web"]["href"] + if result["result"] == "succeeded": + # set all checks to pass + record_all_pipeline("tests", pipelines[service], "succeeded") + return + + # get timeline + pipelines[service]["tests"].update({"result": result["result"]}) + build_id = result["id"] + timeline_response = httpx.get(get_build_timeline_url(build_id), headers=AUTH_HEADERS) + timeline_result = json.loads(timeline_response.text) + + for task in timeline_result["records"]: + if "Run Tests" in task["name"]: + record_test_result(task, "tests", pipelines[service]["tests"]) + + +def get_tests_weekly_result(service: str, pipeline_id: int | None, pipelines: dict[ServiceDirectory, PipelineResults]) -> None: + if not pipeline_id: + print(f"No tests_weekly result for {service}") + record_all_pipeline("tests_weekly", pipelines[service], "UNKNOWN") + return + + build_response = httpx.get(get_build_url(pipeline_id), headers=AUTH_HEADERS) + build_result = json.loads(build_response.text) + if build_response.status_code != 200 or not build_result["value"]: + print(f"No tests_weekly result for {service}") + record_all_pipeline("tests_weekly", pipelines[service], "UNKNOWN") + return + + result = build_result["value"][0] + pipelines[service]["tests_weekly"]["link"] = result["_links"]["web"]["href"] + + # get timeline + pipelines[service]["tests_weekly"].update({"result": result["result"]}) + build_id = result["id"] + timeline_response = httpx.get(get_build_timeline_url(build_id), headers=AUTH_HEADERS) + timeline_result = json.loads(timeline_response.text) + + for task in timeline_result["records"]: + if "Run Tests" in task["name"]: + record_test_result(task, "tests_weekly", pipelines[service]["tests_weekly"]) + elif "Run Pylint Next" in task["name"]: + record_check_result(task, "next_pylint", pipelines[service]["tests_weekly"]) + elif "Run Pyright Next" in task["name"]: + record_check_result(task, "next_pyright", pipelines[service]["tests_weekly"]) + elif "Run MyPy Next" in task["name"]: + record_check_result(task, "next_mypy", pipelines[service]["tests_weekly"]) + + +def report_overall_status(library_details: LibraryStatus) -> None: + """Status is based on if anything is blocking release + or could block release in the near future. + """ + overall_status = "GOOD" + for check, status in library_details.items(): + if check not in RELEASE_BLOCKERS: + continue + if status["status"] == "FAIL": + overall_status = "BLOCKED" + break + if status["status"] in ["DISABLED", "WARNING", "UNKNOWN"] and check in MANDATORY_CHECKS: + overall_status = "NEEDS_ACTION" + if check == "pyright" and status["status"] in ["WARNING", "UNKNOWN"]: + # special case for pyright which is not mandatory, but action is needed + # if library has enabled it and its status is warning or unknown + overall_status = "NEEDS_ACTION" + library_details["status"] = overall_status + + +def report_test_result( + test_type: typing.Literal["ci", "tests"], + pipeline: PipelineResults, + library_details: LibraryStatus, +) -> None: + test_status = pipeline[test_type][test_type]["status"] + if test_status in ["succeeded", "partiallySucceeded"]: + library_details[test_type] = Status(status="PASS", link=pipeline[test_type]["link"]) + elif test_status == "failed": + library_details[test_type] = Status(status="FAIL", link=pipeline[test_type]["link"]) + else: + library_details[test_type] = Status(status="UNKNOWN", link=pipeline[test_type].get("link")) + + +def report_check_result( + check: CheckTypes, + pipeline: PipelineResults, + library_details: LibraryStatus, +) -> None: + enabled = is_check_enabled(str(library_details["path"]), check) + if not enabled: + library_details[check] = Status(status="DISABLED", link=None) + return + + if check in NEXT_CHECKS: + ci_check = pipeline["ci"][check]["status"] + next_check = pipeline["tests_weekly"][f"next_{check}"]["status"] + if ci_check == "succeeded" and next_check == "succeeded": + library_details[check] = Status(status="PASS", link=pipeline["ci"]["link"]) + elif ci_check == "succeeded" and next_check in [ + "succeededWithIssues", + "UNKNOWN", + ]: + library_details[check] = Status(status="WARNING", link=pipeline["tests_weekly"].get("link")) + + elif ci_check == "failed": + library_details[check] = Status(status="FAIL", link=pipeline["ci"]["link"]) + else: + library_details[check] = Status(status="UNKNOWN", link=pipeline["ci"].get("link")) + else: + ci_check = pipeline["ci"][check]["status"] + if ci_check == "succeeded": + library_details[check] = Status(status="PASS", link=pipeline["ci"]["link"]) + elif ci_check == "failed": + library_details[check] = Status(status="FAIL", link=pipeline["ci"]["link"]) + else: + library_details[check] = Status(status="UNKNOWN", link=pipeline["ci"].get("link")) + + +def report_status( + dataplane: dict[ServiceDirectory, dict[LibraryName, LibraryStatus]], + pipelines: dict[ServiceDirectory, PipelineResults], +) -> None: + for service_directory, libraries in dataplane.items(): + for _, details in libraries.items(): + if not is_check_enabled(str(details["path"]), "ci_enabled"): + details["status"] = "BLOCKED" + record_all_library(details, "DISABLED") + continue + report_check_result("mypy", pipelines[service_directory], details) + report_check_result("pylint", pipelines[service_directory], details) + report_check_result("pyright", pipelines[service_directory], details) + report_check_result("sphinx", pipelines[service_directory], details) + details["type_check_samples"] = ( + "ENABLED" if is_check_enabled(str(details["path"]), "type_check_samples") else "DISABLED" + ) + details["sdk_owned"] = details["path"].name in SDK_TEAM_OWNED + report_test_result("tests", pipelines[service_directory], details) + report_test_result("ci", pipelines[service_directory], details) + report_overall_status(details) + + +def map_codeowners_to_label( + dataplane: dict[ServiceDirectory, dict[LibraryName, LibraryStatus]] +) -> dict[str, ServiceDirectory]: + codeowners_url = "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/main/.github/CODEOWNERS" + codeowners_response = httpx.get(codeowners_url) + if codeowners_response.status_code != 200: + raise Exception("Failed to get CODEOWNERS file") + codeowners = codeowners_response.text.splitlines() + + tracked_labels = {} + label = "" + for line in codeowners: + if line.startswith("# PRLabel:"): + label = line.split("# PRLabel: %")[1].strip() + if label and line.startswith("/sdk/"): + parts = line.split("@")[0].split("/")[2:-1] + if len(parts) > 3: + # we don't distinguish past package level for SLA + continue + service_directory = parts[0] + tracked_labels[label] = service_directory + try: + library = parts[1] + except IndexError: + library = None + + if library: + try: + service = dataplane[service_directory] + except KeyError: + continue + try: + service[library]["label"] = label + except KeyError: + continue + continue + try: + service = dataplane[service_directory] + for _, details in service.items(): + if details.get("label") is None: + details["label"] = label + except KeyError: + continue + return tracked_labels + + +def record_total_customer_reported_issues( + libraries: dict[ServiceDirectory, dict[LibraryName, LibraryStatus]], + tracked_labels: dict[str, ServiceDirectory], + issues: list[object], +) -> None: + for issue in issues: + for lbl in issue.labels: + if lbl.name in tracked_labels: + service_directory = tracked_labels[lbl.name] + applicable = libraries.get(service_directory, None) + if not applicable: + continue + for _, details in applicable.items(): + if lbl.name == details["label"]: + details.setdefault("customer_issues", {}) + details["customer_issues"].setdefault("num", 0) + details["customer_issues"]["num"] += 1 + details["customer_issues"]["link"] = get_github_total_issue_link(lbl.name) + + +def record_sla_status( + libraries: dict[ServiceDirectory, dict[LibraryName, LibraryStatus]], + issue: object, + tracked_labels: dict[str, ServiceDirectory], + kind: typing.Literal["question", "bug"], + time_period: datetime.datetime, +) -> None: + for lbl in issue.labels: + if lbl.name in tracked_labels: + service_directory = tracked_labels[lbl.name] + applicable = libraries.get(service_directory, None) + if not applicable: + return + for _, details in applicable.items(): + if lbl.name == details["label"]: + details.setdefault("sla", {}) + details["sla"].setdefault( + kind, + {"num": 0, "link": get_github_issue_link(lbl.name, kind, str(time_period.date()))}, + ) + details["sla"][kind]["num"] += 1 + + +def report_sla_and_total_issues( + libraries: dict[ServiceDirectory, dict[LibraryName, LibraryStatus]], +) -> None: + + tracked_labels = map_codeowners_to_label(libraries) + today = datetime.datetime.now(datetime.UTC) + repo = github.get_repo("Azure/azure-sdk-for-python") + filter_labels = ["issue-addressed", "needs-author-feedback", "feature-request"] + issues = list(repo.get_issues(state="open", labels=["customer-reported", "Client"])) + record_total_customer_reported_issues(libraries, tracked_labels, issues) + filtered = [issue for issue in issues if not any(label for label in issue.labels if label.name in filter_labels)] + + thirty_days_ago = today - datetime.timedelta(days=30) + ninety_days_ago = today - datetime.timedelta(days=90) + for issue in filtered: + if "question" in (label.name for label in issue.labels) and issue.created_at < thirty_days_ago: + record_sla_status(libraries, issue, tracked_labels, "question", thirty_days_ago) + if "bug" in (label.name for label in issue.labels) and issue.created_at < ninety_days_ago: + record_sla_status(libraries, issue, tracked_labels, "bug", ninety_days_ago) + + +def write_to_csv(libraries: dict[ServiceDirectory, dict[LibraryName, LibraryStatus]]) -> None: + with open("./health_report.csv", mode="w", newline="", encoding="utf-8") as file: + writer = csv.writer(file) + + column_names = [ + "Library", + "Status", + "Mypy", + "Pyright", + "Type Checked Samples", + "Pylint", + "Sphinx", + "Tests - CI", + "Tests - Live", + "SLA - Questions", + "SLA - Bugs", + "Total customer-reported issues", + "Mypy_link", + "Pyright_link", + "Pylint_link", + "Sphinx_link", + "Tests - CI_link", + "Tests - Live_link", + "SLA - Questions_link", + "SLA - Bugs_link", + "Total customer-reported issues_link", + "Last Refresh", + "SDK Owned", + ] + writer.writerow(column_names) + + rows = [] + for _, libs in libraries.items(): + for library, details in libs.items(): + rows.append( + [ + library, + details["status"], + details["mypy"]["status"], + details["pyright"]["status"], + details["type_check_samples"], + details["pylint"]["status"], + details["sphinx"]["status"], + details["ci"]["status"], + details["tests"]["status"], + details.get("sla", {}).get("question", {}).get("num", 0), + details.get("sla", {}).get("bug", {}).get("num", 0), + details.get("customer_issues", {}).get("num", 0), + details["mypy"].get("link", ""), + details["pyright"].get("link", ""), + details["pylint"].get("link", ""), + details["sphinx"].get("link", ""), + details["ci"].get("link", ""), + details["tests"].get("link", ""), + details.get("sla", {}).get("question", {}).get("link", ""), + details.get("sla", {}).get("bug", {}).get("link", ""), + details.get("customer_issues", {}).get("link", ""), + datetime.datetime.today().strftime("%m-%d-%Y %H:%M:%S"), + details["sdk_owned"], + ] + ) + sorted_rows = sorted(rows) + writer.writerows(sorted_rows) + + +def write_to_markdown(libraries: dict[ServiceDirectory, dict[LibraryName, LibraryStatus]]) -> None: + + rows = [] + column_names = [ + "Library", + "Status", + "Mypy", + "Pyright", + "Type Checked Samples", + "Pylint", + "Sphinx", + "Tests - CI", + "Tests - Live", + "SLA - Questions / Bugs", + "Total customer-reported issues", + ] + for _, libs in libraries.items(): + for library, details in libs.items(): + if details["status"] == "BLOCKED": + status_colored = f'{details["status"]}' + elif details["status"] == "NEEDS_ACTION": + status_colored = f'{details["status"]}' + elif details["status"] == "GOOD": + status_colored = f'{details["status"]}' + + sla = details.get("sla") + if sla: + question_link = ( + f"([link]({sla.get("question", {}).get("link", None)}))" + if sla.get("question", {}).get("link", None) is not None + else "" + ) + bug_link = ( + f"([link]({sla.get("bug", {}).get("link", None)}))" + if sla.get("bug", {}).get("link", None) is not None + else "" + ) + sla_str = f"{sla.get('question', {}).get('num', 0)} {question_link} / {sla.get('bug', {}).get('num', 0)} {bug_link}" + else: + sla_str = "0 / 0" + + row = [ + library, + status_colored, + details["mypy"]["status"] + + (f" ([link]({details["mypy"]["link"]}))" if details["mypy"]["link"] is not None else ""), + details["pyright"]["status"] + + (f" ([link]({details["pyright"]["link"]}))" if details["pyright"]["link"] is not None else ""), + details["type_check_samples"], + details["pylint"]["status"] + + (f" ([link]({details["pylint"]["link"]}))" if details["pylint"]["link"] is not None else ""), + details["sphinx"]["status"] + + (f" ([link]({details["sphinx"]["link"]}))" if details["sphinx"]["link"] is not None else ""), + details["ci"]["status"] + + (f" ([link]({details["ci"]["link"]}))" if details["ci"]["link"] is not None else ""), + details["tests"]["status"] + + (f" ([link]({details["tests"]["link"]}))" if details["tests"]["link"] is not None else ""), + sla_str, + str(details.get("customer_issues", {}).get("num", 0)) + + ( + f" ([link]({details.get("customer_issues", {}).get("link", "")}))" + if details.get("customer_issues", {}).get("link", None) is not None + else "" + ), + ] + rows.append(row) + + with open("./health_report.md", mode="w", newline="", encoding="utf-8") as file: + + file.write("|" + "|".join(column_names) + "|\n") + file.write("|" + "---|" * len(column_names) + "\n") + + for row in sorted(rows): + row_str = [str(item).strip() for item in row] + file.write("|" + "|".join(row_str) + "|\n") + + +def write_to_html(libraries: dict[ServiceDirectory, dict[LibraryName, LibraryStatus]]) -> None: + write_to_markdown(libraries) + with open("./health_report.md", "r") as f: + markd = f.read() + + html = markdown.markdown(markd, extensions=["tables"]) + + css_styles = """ + + """ + + html_with_css = css_styles + html + + with open("./health_report.html", "w", encoding="utf-8") as file: + file.write(html_with_css) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Report the health status for the Python SDK repo.") + + parser.add_argument( + "-s", + "--include-sdk-owned", + dest="include_sdk_owned", + help="Include SDK team owned libraries in the report. Defaults to True.", + action="store_false", + ) + + parser.add_argument( + "-f", + "--format", + dest="format", + help="Which format to output the result. Possible values: csv, md, html. Defaults to csv.", + type=str, + default="csv", + ) + + args = parser.parse_args() + + libraries = get_dataplane(include_sdk_owned=args.include_sdk_owned) + pipelines = get_pipelines(libraries) + for service, pipeline_ids in pipelines.items(): + get_ci_result(service, pipeline_ids.get("ci", {}).get("id"), pipelines) + get_tests_result(service, pipeline_ids.get("tests", {}).get("id"), pipelines) + get_tests_weekly_result(service, pipeline_ids.get("tests_weekly", {}).get("id"), pipelines) + + report_status(libraries, pipelines) + report_sla_and_total_issues(libraries) + if args.format == "csv": + write_to_csv(libraries) + elif args.format == "md": + write_to_markdown(libraries) + elif args.format == "html": + write_to_html(libraries) + + # if in_ci(): + # repo = github.get_repo("Azure/azure-sdk-for-python") + # repo.create_file( + # path="scripts/library_health_status/health_report.csv", + # message="Update health report", + # content=open("health_report.csv", "rb").read(), + # branch="health-status-script", + # ) diff --git a/sdk/advisor/azure-mgmt-advisor/pyproject.toml b/sdk/advisor/azure-mgmt-advisor/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/advisor/azure-mgmt-advisor/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/agrifood/azure-agrifood-farming/pyproject.toml b/sdk/agrifood/azure-agrifood-farming/pyproject.toml index a3a58bd090306..b8570555c5c38 100644 --- a/sdk/agrifood/azure-agrifood-farming/pyproject.toml +++ b/sdk/agrifood/azure-agrifood-farming/pyproject.toml @@ -2,5 +2,4 @@ pylint = false pyright = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/agrifood/azure-mgmt-agrifood/pyproject.toml b/sdk/agrifood/azure-mgmt-agrifood/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/agrifood/azure-mgmt-agrifood/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/ai/tests.yml.old b/sdk/ai/tests.yml similarity index 68% rename from sdk/ai/tests.yml.old rename to sdk/ai/tests.yml index b51eb6aaf15d4..960b65f988536 100644 --- a/sdk/ai/tests.yml.old +++ b/sdk/ai/tests.yml @@ -1,4 +1,3 @@ -# This was the tests.yml file that was used when azure-ai-generative and azure-ai-resources packages were built. trigger: none # NOTE: Service live tests are NOT enabled. This file only enables the analyze stage currently. diff --git a/sdk/aks/azure-mgmt-devspaces/pyproject.toml b/sdk/aks/azure-mgmt-devspaces/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/aks/azure-mgmt-devspaces/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/alertsmanagement/azure-mgmt-alertsmanagement/pyproject.toml b/sdk/alertsmanagement/azure-mgmt-alertsmanagement/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/alertsmanagement/azure-mgmt-alertsmanagement/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/apicenter/azure-mgmt-apicenter/pyproject.toml b/sdk/apicenter/azure-mgmt-apicenter/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/apicenter/azure-mgmt-apicenter/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/pyproject.toml b/sdk/apimanagement/azure-mgmt-apimanagement/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/app/azure-mgmt-app/pyproject.toml b/sdk/app/azure-mgmt-app/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/app/azure-mgmt-app/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/pyproject.toml b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/assets.json b/sdk/appconfiguration/azure-appconfiguration-provider/assets.json index d4dbcc6941e04..af8670ce019ae 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/assets.json +++ b/sdk/appconfiguration/azure-appconfiguration-provider/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/appconfiguration/azure-appconfiguration-provider", - "Tag": "python/appconfiguration/azure-appconfiguration-provider_d412917208" + "Tag": "python/appconfiguration/azure-appconfiguration-provider_c09fc0dba6" } diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationprovider.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationprovider.py index 40beba690fdbd..557c69933d8a2 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationprovider.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationprovider.py @@ -29,19 +29,15 @@ TypeVar, ) from azure.appconfiguration import ( # type:ignore # pylint:disable=no-name-in-module - AzureAppConfigurationClient, FeatureFlagConfigurationSetting, SecretReferenceConfigurationSetting, - ConfigurationSetting, ) -from azure.core import MatchConditions -from azure.core.exceptions import HttpResponseError, ServiceRequestError, ServiceResponseError +from azure.core.exceptions import AzureError, HttpResponseError from azure.keyvault.secrets import SecretClient, KeyVaultSecretIdentifier from ._models import AzureAppConfigurationKeyVaultOptions, SettingSelector from ._constants import ( FEATURE_MANAGEMENT_KEY, FEATURE_FLAG_KEY, - FEATURE_FLAG_PREFIX, REQUEST_TRACING_DISABLED_ENVIRONMENT_VARIABLE, ServiceFabricEnvironmentVariable, AzureFunctionEnvironmentVariable, @@ -49,14 +45,13 @@ ContainerAppEnvironmentVariable, KubernetesEnvironmentVariable, EMPTY_LABEL, - PERCENTAGE_FILTER_NAMES, - TIME_WINDOW_FILTER_NAMES, - TARGETING_FILTER_NAMES, CUSTOM_FILTER_KEY, PERCENTAGE_FILTER_KEY, TIME_WINDOW_FILTER_KEY, TARGETING_FILTER_KEY, ) +from ._client_manager import ConfigurationClientWrapper, ConfigurationClientManager +from ._discovery import find_auto_failover_endpoints from ._user_agent import USER_AGENT if TYPE_CHECKING: @@ -124,6 +119,9 @@ def load( # pylint: disable=docstring-keyword-should-match-keyword-only :keyword feature_flag_refresh_enabled: Optional flag to enable or disable the refresh of feature flags. Default is False. :paramtype feature_flag_refresh_enabled: bool + :keyword replica_discovery_enabled: Optional flag to enable or disable the discovery of replica endpoints. Default + is True. + :paramtype replica_discovery_enabled: bool """ @@ -179,13 +177,13 @@ def load( # pylint: disable=docstring-keyword-should-match-keyword-only :keyword feature_flag_refresh_enabled: Optional flag to enable or disable the refresh of feature flags. Default is False. :paramtype feature_flag_refresh_enabled: bool + :keyword replica_discovery_enabled: Optional flag to enable or disable the discovery of replica endpoints. Default + is True. + :paramtype replica_discovery_enabled: bool """ def load(*args, **kwargs) -> "AzureAppConfigurationProvider": - # pylint:disable=protected-access - - # Start by parsing kwargs endpoint: Optional[str] = kwargs.pop("endpoint", None) credential: Optional["TokenCredential"] = kwargs.pop("credential", None) connection_string: Optional[str] = kwargs.pop("connection_string", None) @@ -222,38 +220,28 @@ def load(*args, **kwargs) -> "AzureAppConfigurationProvider": if kwargs.get("keyvault_credential") is not None and kwargs.get("secret_resolver") is not None: raise ValueError("A keyvault credential and secret resolver can't both be configured.") - headers = _get_headers("Startup", **kwargs) - provider = _buildprovider( - connection_string, endpoint, credential, uses_key_vault="UsesKeyVault" in headers, **kwargs + uses_key_vault = ( + "keyvault_credential" in kwargs + or "keyvault_client_configs" in kwargs + or "secret_resolver" in kwargs + or kwargs.get("uses_key_vault", False) + ) + + provider = _buildprovider(connection_string, endpoint, credential, uses_key_vault=uses_key_vault, **kwargs) + headers = _get_headers( + kwargs.pop("headers", {}), + "Startup", + provider._replica_client_manager.get_client_count() - 1, # pylint:disable=protected-access + kwargs.pop("uses_feature_flags", False), + kwargs.pop("feature_filters_used", {}), + uses_key_vault, ) try: - provider._load_all(headers=headers) + provider._load_all(headers=headers) # pylint:disable=protected-access except Exception as e: _delay_failure(start_time) raise e - - # Refresh-All sentinels are not updated on load_all, as they are not necessarily included in the provider. - for (key, label), etag in provider._refresh_on.items(): - if not etag: - try: - sentinel = provider._client.get_configuration_setting(key, label, headers=headers) # type:ignore - provider._refresh_on[(key, label)] = sentinel.etag # type:ignore - except HttpResponseError as e: - if e.status_code == 404: - # If the sentinel is not found a refresh should be triggered when it is created. - logging.debug( - "WatchKey key: %s label %s was configured but not found. Refresh will be triggered if created.", - key, - label, - ) - provider._refresh_on[(key, label)] = None # type: ignore - else: - _delay_failure(start_time) - raise e - except Exception as e: - _delay_failure(start_time) - raise e return provider @@ -266,15 +254,13 @@ def _delay_failure(start_time: datetime.datetime) -> None: time.sleep((min_time - (current_time - start_time)).total_seconds()) -def _get_headers(request_type, **kwargs) -> str: - headers = kwargs.pop("headers", {}) +def _get_headers(headers, request_type, replica_count, uses_feature_flags, feature_filters_used, uses_key_vault) -> str: if os.environ.get(REQUEST_TRACING_DISABLED_ENVIRONMENT_VARIABLE, default="").lower() == "true": return headers correlation_context = "RequestType=" + request_type - if "feature_filters_used" in kwargs: + if len(feature_filters_used) > 0: filters_used = "" - feature_filters_used = kwargs.pop("feature_filters_used", {}) if CUSTOM_FILTER_KEY in feature_filters_used: filters_used = CUSTOM_FILTER_KEY if PERCENTAGE_FILTER_KEY in feature_filters_used: @@ -285,14 +271,9 @@ def _get_headers(request_type, **kwargs) -> str: filters_used += ("+" if filters_used else "") + TARGETING_FILTER_KEY correlation_context += ",Filters=" + filters_used - correlation_context += _uses_feature_flags(**kwargs) + correlation_context += _uses_feature_flags(uses_feature_flags) - if ( - "keyvault_credential" in kwargs - or "keyvault_client_configs" in kwargs - or "secret_resolver" in kwargs - or kwargs.pop("uses_key_vault", False) - ): + if uses_key_vault: correlation_context += ",UsesKeyVault" host_type = "" if AzureFunctionEnvironmentVariable in os.environ: @@ -308,12 +289,15 @@ def _get_headers(request_type, **kwargs) -> str: if host_type: correlation_context += ",Host=" + host_type + if replica_count > 0: + correlation_context += ",ReplicaCount=" + str(replica_count) + headers["Correlation-Context"] = correlation_context return headers -def _uses_feature_flags(**kwargs): - if not kwargs.pop("uses_feature_flags", False): +def _uses_feature_flags(uses_feature_flags): + if not uses_feature_flags: return "" package_name = "featuremanagement" try: @@ -329,35 +313,51 @@ def _buildprovider( connection_string: Optional[str], endpoint: Optional[str], credential: Optional["TokenCredential"], **kwargs ) -> "AzureAppConfigurationProvider": # pylint:disable=protected-access - provider = AzureAppConfigurationProvider(**kwargs) + if connection_string: + endpoint = connection_string.split(";")[0].split("=")[1] + provider = AzureAppConfigurationProvider(endpoint, **kwargs) retry_total = kwargs.pop("retry_total", 2) retry_backoff_max = kwargs.pop("retry_backoff_max", 60) + replica_discovery_enabled = kwargs.pop("replica_discovery_enabled", True) if "user_agent" in kwargs: user_agent = kwargs.pop("user_agent") + " " + USER_AGENT else: user_agent = USER_AGENT - if connection_string: - provider._client = AzureAppConfigurationClient.from_connection_string( - connection_string, - user_agent=user_agent, - retry_total=retry_total, - retry_backoff_max=retry_backoff_max, - **kwargs + clients = [] + if connection_string and endpoint: + clients.append( + ConfigurationClientWrapper.from_connection_string( + endpoint, connection_string, user_agent, retry_total, retry_backoff_max, **kwargs + ) ) + failover_endpoints = find_auto_failover_endpoints(endpoint, replica_discovery_enabled) + for failover_endpoint in failover_endpoints: + failover_connection_string = connection_string.replace(endpoint, failover_endpoint) + clients.append( + ConfigurationClientWrapper.from_connection_string( + failover_endpoint, failover_connection_string, user_agent, retry_total, retry_backoff_max, **kwargs + ) + ) + provider._replica_client_manager.set_clients(clients) return provider - if endpoint is not None and credential is not None: - provider._client = AzureAppConfigurationClient( - endpoint, - credential, - user_agent=user_agent, - retry_total=retry_total, - retry_backoff_max=retry_backoff_max, - **kwargs + if endpoint and credential: + clients.append( + ConfigurationClientWrapper.from_credential( + endpoint, credential, user_agent, retry_total, retry_backoff_max, **kwargs + ) ) + failover_endpoints = find_auto_failover_endpoints(endpoint, replica_discovery_enabled) + for failover_endpoint in failover_endpoints: + clients.append( + ConfigurationClientWrapper.from_credential( + endpoint, credential, user_agent, retry_total, retry_backoff_max, **kwargs + ) + ) + provider._replica_client_manager.set_clients(clients) return provider - raise ValueError("Please pass either endpoint and credential, or a connection string.") + raise ValueError("Please pass either endpoint and credential, or a connection string with a value.") def _resolve_keyvault_reference( @@ -445,7 +445,7 @@ def __init__(self, **kwargs): self._next_refresh_time: float = time.time() + self._interval self._attempts: int = 1 self._min_backoff: int = ( - kwargs.pop("min_backoff", 30) if kwargs.get("min_backoff", 30) <= self._interval else self._interval + kwargs.get("min_backoff", 30) if kwargs.get("min_backoff", 30) <= self._interval else self._interval ) self._max_backoff: int = 600 if 600 <= self._interval else self._interval @@ -487,9 +487,17 @@ class AzureAppConfigurationProvider(Mapping[str, Union[str, JSON]]): # pylint: keys. Enables resolution of Key Vault references in configuration settings. """ - def __init__(self, **kwargs) -> None: - self._dict: Dict[str, str] = {} - self._client: Optional[AzureAppConfigurationClient] = None + def __init__(self, endpoint, **kwargs) -> None: + self._origin_endpoint = endpoint + + interval: int = kwargs.get("refresh_interval", 30) + if interval < 1: + raise ValueError("Refresh interval must be greater than or equal to 1 second.") + + min_backoff: int = kwargs.get("min_backoff", 30) if kwargs.get("min_backoff", 30) <= interval else interval + max_backoff: int = 600 if 600 <= interval else interval + self._replica_client_manager = ConfigurationClientManager(min_backoff, max_backoff) + self._dict: Dict[str, Any] = {} self._secret_clients: Dict[str, SecretClient] = {} self._selects: List[SettingSelector] = kwargs.pop( "selects", [SettingSelector(key_filter="*", label_filter=EMPTY_LABEL)] @@ -532,174 +540,123 @@ def refresh(self, **kwargs) -> None: return success = False need_refresh = False + error_message = """ + Failed to refresh configuration settings. No Azure App Configuration stores successfully + refreshed. + """ + exception: Exception = RuntimeError(error_message) try: - if self._refresh_on: - need_refresh = self._refresh_configuration_settings(**kwargs) - if self._feature_flag_refresh_enabled: - need_refresh = self._refresh_feature_flags(**kwargs) or need_refresh - # Even if we don't need to refresh, we should reset the timer - self._refresh_timer.reset() - success = True - except (ServiceRequestError, ServiceResponseError, HttpResponseError) as e: - # If we get an error we should retry sooner than the next refresh interval - if self._on_refresh_error: - self._on_refresh_error(e) - return - raise - finally: - self._refresh_lock.release() + active_clients = self._replica_client_manager.get_active_clients() + + for client in active_clients: + try: + if self._refresh_on: + headers = _get_headers( + kwargs.pop("headers", {}), + "Watch", + self._replica_client_manager.get_client_count() - 1, + self._feature_flag_enabled, + self._feature_filter_usage, + self._uses_key_vault, + ) + need_refresh, self._refresh_on, configuration_settings = client.refresh_configuration_settings( + self._selects, self._refresh_on, headers, **kwargs + ) + configuration_settings_processed = {} + for config in configuration_settings: + key = self._process_key_name(config) + value = self._process_key_value(config) + configuration_settings_processed[key] = value + if self._feature_flag_enabled: + configuration_settings_processed[FEATURE_MANAGEMENT_KEY] = self._dict[ + FEATURE_MANAGEMENT_KEY + ] + if need_refresh: + self._dict = configuration_settings_processed + if self._feature_flag_refresh_enabled: + headers = _get_headers( + kwargs.pop("headers", {}), + "Watch", + self._replica_client_manager.get_client_count() - 1, + self._feature_flag_enabled, + self._feature_filter_usage, + self._uses_key_vault, + ) + need_ff_refresh, self._refresh_on_feature_flags, feature_flags = client.refresh_feature_flags( + self._refresh_on_feature_flags, self._feature_flag_selectors, headers, **kwargs + ) + + if need_refresh or need_ff_refresh: + self._dict[FEATURE_MANAGEMENT_KEY] = {} + self._dict[FEATURE_MANAGEMENT_KEY][FEATURE_FLAG_KEY] = feature_flags + # Even if we don't need to refresh, we should reset the timer + self._refresh_timer.reset() + success = True + break + except AzureError as e: + exception = e + self._replica_client_manager.backoff(client) + if not success: self._refresh_timer.backoff() - elif need_refresh and self._on_refresh_success: + if self._on_refresh_error: + self._on_refresh_error(exception) + return + raise exception + if self._on_refresh_success: self._on_refresh_success() + finally: + self._refresh_lock.release() - def _refresh_configuration_settings(self, **kwargs) -> bool: - need_refresh = False - updated_sentinel_keys = dict(self._refresh_on) - headers = _get_headers( - "Watch", - uses_key_vault=self._uses_key_vault, - feature_filters_used=self._feature_filter_usage, - uses_feature_flags=self._feature_flag_enabled, - **kwargs - ) - for (key, label), etag in updated_sentinel_keys.items(): - changed, updated_sentinel = self._check_configuration_setting( - key=key, label=label, etag=etag, headers=headers, **kwargs - ) - if changed: - need_refresh = True - if updated_sentinel is not None: - updated_sentinel_keys[(key, label)] = updated_sentinel.etag - # Need to only update once, no matter how many sentinels are updated - if need_refresh: - configuration_settings, sentinel_keys = self._load_configuration_settings(**kwargs) - if self._feature_flag_enabled: - configuration_settings[FEATURE_MANAGEMENT_KEY] = self._dict[FEATURE_MANAGEMENT_KEY] - with self._update_lock: - self._refresh_on = sentinel_keys - self._dict = configuration_settings - return need_refresh - - def _refresh_feature_flags(self, **kwargs) -> bool: - feature_flag_sentinel_keys = dict(self._refresh_on_feature_flags) - headers = _get_headers( - "Watch", - uses_key_vault=self._uses_key_vault, - feature_filters_used=self._feature_filter_usage, - uses_feature_flags=self._feature_flag_enabled, - **kwargs - ) - for (key, label), etag in feature_flag_sentinel_keys.items(): - changed = self._check_configuration_setting(key=key, label=label, etag=etag, headers=headers, **kwargs) - if changed: - feature_flags, feature_flag_sentinel_keys = self._load_feature_flags(**kwargs) - with self._update_lock: - updated_configurations: Dict[str, Any] = {} - updated_configurations[FEATURE_MANAGEMENT_KEY] = {} - updated_configurations[FEATURE_MANAGEMENT_KEY][FEATURE_FLAG_KEY] = feature_flags - self._dict.update(updated_configurations) - self._refresh_on_feature_flags = feature_flag_sentinel_keys - return True - return False + def _load_all(self, **kwargs): + active_clients = self._replica_client_manager.get_active_clients() - def _check_configuration_setting( - self, key, label, etag, headers, **kwargs - ) -> Tuple[bool, Union[ConfigurationSetting, None]]: - """ - Checks if the configuration setting have been updated since the last refresh. - - :param str key: key to check for chances - :param str label: label to check for changes - :param str etag: etag to check for changes - :param Mapping[str, str] headers: headers to use for the request - :return: A tuple with the first item being true/false if a change is detected. The second item is the updated - value if a change was detected. - :rtype: Tuple[bool, Union[ConfigurationSetting, None]] - """ - try: - updated_sentinel = self._client.get_configuration_setting( # type: ignore - key=key, label=label, etag=etag, match_condition=MatchConditions.IfModified, headers=headers, **kwargs - ) - if updated_sentinel is not None: - logging.debug( - "Refresh all triggered by key: %s label %s.", - key, - label, + for client in active_clients: + try: + configuration_settings, sentinel_keys = client.load_configuration_settings( + self._selects, self._refresh_on, **kwargs ) - return True, updated_sentinel - except HttpResponseError as e: - if e.status_code == 404: - if etag is not None: - # If the sentinel is not found, it means the key/label was deleted, so we should refresh - logging.debug("Refresh all triggered by key: %s label %s.", key, label) - return True, None - else: - raise e - return False, None - - def _load_all(self, **kwargs): - configuration_settings, sentinel_keys = self._load_configuration_settings(**kwargs) - if self._feature_flag_enabled: - feature_flags, feature_flag_sentinel_keys = self._load_feature_flags(**kwargs) - configuration_settings[FEATURE_MANAGEMENT_KEY] = {} - configuration_settings[FEATURE_MANAGEMENT_KEY][FEATURE_FLAG_KEY] = feature_flags - self._refresh_on_feature_flags = feature_flag_sentinel_keys - with self._update_lock: - self._refresh_on = sentinel_keys - self._dict = configuration_settings - - def _load_configuration_settings(self, **kwargs): - configuration_settings = {} - sentinel_keys = kwargs.pop("sentinel_keys", self._refresh_on) - for select in self._selects: - configurations = self._client.list_configuration_settings( - key_filter=select.key_filter, label_filter=select.label_filter, **kwargs - ) - for config in configurations: - if isinstance(config, FeatureFlagConfigurationSetting): - # Feature flags are ignored when loaded by Selects, as they are selected from - # `feature_flag_selectors` - pass - else: + configuration_settings_processed = {} + for config in configuration_settings: key = self._process_key_name(config) value = self._process_key_value(config) - configuration_settings[key] = value - # Every time we run load_all, we should update the etag of our refresh sentinels - # so they stay up-to-date. - # Sentinel keys will have unprocessed key names, so we need to use the original key. - if (config.key, config.label) in self._refresh_on: - sentinel_keys[(config.key, config.label)] = config.etag - return configuration_settings, sentinel_keys - - def _load_feature_flags(self, **kwargs): - feature_flag_sentinel_keys = {} - loaded_feature_flags = [] - # Needs to be removed unknown keyword argument for list_configuration_settings - kwargs.pop("sentinel_keys", None) - filters_used = {} - for select in self._feature_flag_selectors: - feature_flags = self._client.list_configuration_settings( - key_filter=FEATURE_FLAG_PREFIX + select.key_filter, label_filter=select.label_filter, **kwargs - ) - for feature_flag in feature_flags: - loaded_feature_flags.append(json.loads(feature_flag.value)) - - if self._feature_flag_refresh_enabled: - feature_flag_sentinel_keys[(feature_flag.key, feature_flag.label)] = feature_flag.etag - if feature_flag.filters: - for filter in feature_flag.filters: - if filter.get("name") in PERCENTAGE_FILTER_NAMES: - filters_used[PERCENTAGE_FILTER_KEY] = True - elif filter.get("name") in TIME_WINDOW_FILTER_NAMES: - filters_used[TIME_WINDOW_FILTER_KEY] = True - elif filter.get("name") in TARGETING_FILTER_NAMES: - filters_used[TARGETING_FILTER_KEY] = True - else: - filters_used[CUSTOM_FILTER_KEY] = True - self._feature_filter_usage = filters_used - - return loaded_feature_flags, feature_flag_sentinel_keys + configuration_settings_processed[key] = value + if self._feature_flag_enabled: + feature_flags, feature_flag_sentinel_keys = client.load_feature_flags( + self._feature_flag_selectors, self._feature_flag_refresh_enabled, **kwargs + ) + configuration_settings_processed[FEATURE_MANAGEMENT_KEY] = {} + configuration_settings_processed[FEATURE_MANAGEMENT_KEY][FEATURE_FLAG_KEY] = feature_flags + self._refresh_on_feature_flags = feature_flag_sentinel_keys + for (key, label), etag in self._refresh_on.items(): + if not etag: + try: + headers = kwargs.get("headers", {}) + sentinel = client.get_configuration_setting(key, label, headers=headers) # type:ignore + self._refresh_on[(key, label)] = sentinel.etag # type:ignore + except HttpResponseError as e: + if e.status_code == 404: + # If the sentinel is not found a refresh should be triggered when it is created. + logging.debug( + """ + WatchKey key: %s label %s was configured but not found. Refresh will be triggered + if created. + """, + key, + label, + ) + self._refresh_on[(key, label)] = None # type: ignore + else: + raise e + with self._update_lock: + self._refresh_on = sentinel_keys + self._dict = configuration_settings_processed + return + except AzureError: + self._replica_client_manager.backoff(client) + raise RuntimeError( + "Failed to load configuration settings. No Azure App Configuration stores successfully loaded from." + ) def _process_key_name(self, config): trimmed_key = config.key @@ -802,9 +759,7 @@ def __eq__(self, other: Any) -> bool: return False if self._trim_prefixes != other._trim_prefixes: return False - if self._client != other._client: - return False - return True + return self._replica_client_manager == other._replica_client_manager def __ne__(self, other: Any) -> bool: return not self == other @@ -815,15 +770,15 @@ def close(self) -> None: """ for client in self._secret_clients.values(): client.close() - self._client.close() # type: ignore + self._replica_client_manager.close() def __enter__(self) -> "AzureAppConfigurationProvider": - self._client.__enter__() # type: ignore + self._replica_client_manager.__enter__() for client in self._secret_clients.values(): client.__enter__() return self def __exit__(self, *args) -> None: - self._client.__exit__(*args) # type: ignore + self._replica_client_manager.__exit__() for client in self._secret_clients.values(): client.__exit__() diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_client_manager.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_client_manager.py new file mode 100644 index 0000000000000..95641b43c9bae --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_client_manager.py @@ -0,0 +1,330 @@ +# ------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- +from logging import getLogger +import json +import time +import random +from dataclasses import dataclass +from typing import Tuple, Union, Dict, List, Any, Optional, Mapping +from typing_extensions import Self +from azure.core import MatchConditions +from azure.core.tracing.decorator import distributed_trace +from azure.core.exceptions import HttpResponseError +from azure.core.credentials import TokenCredential +from azure.appconfiguration import ( # type:ignore # pylint:disable=no-name-in-module + ConfigurationSetting, + AzureAppConfigurationClient, + FeatureFlagConfigurationSetting, +) +from ._models import SettingSelector +from ._constants import FEATURE_FLAG_PREFIX + + +@dataclass +class ConfigurationClientWrapper: + endpoint: str + _client: AzureAppConfigurationClient + backoff_end_time: float = 0 + failed_attempts: int = 0 + LOGGER = getLogger(__name__) + + @classmethod + def from_credential( + cls, + endpoint: str, + credential: TokenCredential, + user_agent: str, + retry_total: int, + retry_backoff_max: int, + **kwargs + ) -> Self: + """ + Creates a new instance of the ConfigurationClientWrapper class, using the provided credential to authenticate + requests. + + :param str endpoint: The endpoint of the App Configuration store + :param TokenCredential credential: The credential to use for authentication + :param str user_agent: The user agent string to use for the request + :param int retry_total: The total number of retries to allow for requests + :param int retry_backoff_max: The maximum backoff time for retries + :return: A new instance of the ConfigurationClientWrapper class + :rtype: ConfigurationClientWrapper + """ + return cls( + endpoint, + AzureAppConfigurationClient( + endpoint, + credential, + user_agent=user_agent, + retry_total=retry_total, + retry_backoff_max=retry_backoff_max, + **kwargs + ), + ) + + @classmethod + def from_connection_string( + cls, endpoint: str, connection_string: str, user_agent: str, retry_total: int, retry_backoff_max: int, **kwargs + ) -> Self: + """ + Creates a new instance of the ConfigurationClientWrapper class, using the provided connection string to + authenticate requests. + + :param str endpoint: The endpoint of the App Configuration store + :param str connection_string: The connection string to use for authentication + :param str user_agent: The user agent string to use for the request + :param int retry_total: The total number of retries to allow for requests + :param int retry_backoff_max: The maximum backoff time for retries + :return: A new instance of the ConfigurationClientWrapper class + :rtype: ConfigurationClientWrapper + """ + return cls( + endpoint, + AzureAppConfigurationClient.from_connection_string( + connection_string, + user_agent=user_agent, + retry_total=retry_total, + retry_backoff_max=retry_backoff_max, + **kwargs + ), + ) + + def _check_configuration_setting( + self, key: str, label: str, etag: Optional[str], headers: Dict[str, str], **kwargs + ) -> Tuple[bool, Union[ConfigurationSetting, None]]: + """ + Checks if the configuration setting have been updated since the last refresh. + + :param str key: key to check for chances + :param str label: label to check for changes + :param str etag: etag to check for changes + :param Mapping[str, str] headers: headers to use for the request + :return: A tuple with the first item being true/false if a change is detected. The second item is the updated + value if a change was detected. + :rtype: Tuple[bool, Union[ConfigurationSetting, None]] + """ + try: + updated_sentinel = self._client.get_configuration_setting( # type: ignore + key=key, label=label, etag=etag, match_condition=MatchConditions.IfModified, headers=headers, **kwargs + ) + if updated_sentinel is not None: + self.LOGGER.debug( + "Refresh all triggered by key: %s label %s.", + key, + label, + ) + return True, updated_sentinel + except HttpResponseError as e: + if e.status_code == 404: + if etag is not None: + # If the sentinel is not found, it means the key/label was deleted, so we should refresh + self.LOGGER.debug("Refresh all triggered by key: %s label %s.", key, label) + return True, None + else: + raise e + return False, None + + @distributed_trace + def load_configuration_settings( + self, selects: List[SettingSelector], refresh_on: Dict[Tuple[str, str], str], **kwargs + ) -> Tuple[List[ConfigurationSetting], Dict[Tuple[str, str], str]]: + configuration_settings = [] + sentinel_keys = kwargs.pop("sentinel_keys", refresh_on) + for select in selects: + configurations = self._client.list_configuration_settings( + key_filter=select.key_filter, label_filter=select.label_filter, **kwargs + ) + for config in configurations: + if isinstance(config, FeatureFlagConfigurationSetting): + # Feature flags are ignored when loaded by Selects, as they are selected from + # `feature_flag_selectors` + pass + configuration_settings.append(config) + # Every time we run load_all, we should update the etag of our refresh sentinels + # so they stay up-to-date. + # Sentinel keys will have unprocessed key names, so we need to use the original key. + if (config.key, config.label) in refresh_on: + sentinel_keys[(config.key, config.label)] = config.etag + return configuration_settings, sentinel_keys + + @distributed_trace + def load_feature_flags( + self, feature_flag_selectors: List[SettingSelector], feature_flag_refresh_enabled: bool, **kwargs + ) -> Tuple[List[FeatureFlagConfigurationSetting], Dict[Tuple[str, str], str]]: + feature_flag_sentinel_keys = {} + loaded_feature_flags = [] + # Needs to be removed unknown keyword argument for list_configuration_settings + kwargs.pop("sentinel_keys", None) + for select in feature_flag_selectors: + feature_flags = self._client.list_configuration_settings( + key_filter=FEATURE_FLAG_PREFIX + select.key_filter, label_filter=select.label_filter, **kwargs + ) + for feature_flag in feature_flags: + loaded_feature_flags.append(json.loads(feature_flag.value)) + + if feature_flag_refresh_enabled: + feature_flag_sentinel_keys[(feature_flag.key, feature_flag.label)] = feature_flag.etag + return loaded_feature_flags, feature_flag_sentinel_keys + + @distributed_trace + def refresh_configuration_settings( + self, selects: List[SettingSelector], refresh_on: Dict[Tuple[str, str], str], headers: Dict[str, str], **kwargs + ) -> Tuple[bool, Dict[Tuple[str, str], str], List[Any]]: + """ + Gets the refreshed configuration settings if they have changed. + + :param List[SettingSelector] selects: The selectors to use to load configuration settings + :param List[SettingSelector] refresh_on: The configuration settings to check for changes + :param Mapping[str, str] headers: The headers to use for the request + + :return: A tuple with the first item being true/false if a change is detected. The second item is the updated + value of the configuration sentinel keys. The third item is the updated configuration settings. + :rtype: Tuple[bool, Union[Dict[Tuple[str, str], str], None], Union[List[ConfigurationSetting], None]] + """ + need_refresh = False + updated_sentinel_keys = dict(refresh_on) + for (key, label), etag in updated_sentinel_keys.items(): + changed, updated_sentinel = self._check_configuration_setting( + key=key, label=label, etag=etag, headers=headers, **kwargs + ) + if changed: + need_refresh = True + if updated_sentinel is not None: + updated_sentinel_keys[(key, label)] = updated_sentinel.etag + # Need to only update once, no matter how many sentinels are updated + if need_refresh: + configuration_settings, sentinel_keys = self.load_configuration_settings(selects, refresh_on, **kwargs) + return True, sentinel_keys, configuration_settings + return False, refresh_on, [] + + @distributed_trace + def refresh_feature_flags( + self, + refresh_on: Mapping[Tuple[str, str], Optional[str]], + feature_flag_selectors: List[SettingSelector], + headers: Dict[str, str], + **kwargs + ) -> Tuple[bool, Optional[Dict[Tuple[str, str], str]], Optional[List[Any]]]: + """ + Gets the refreshed feature flags if they have changed. + + :param Mapping[Tuple[str, str], Optional[str]] refresh_on: The feature flags to check for changes + :param List[SettingSelector] feature_flag_selectors: The selectors to use to load feature flags + :param Mapping[str, str] headers: The headers to use for the request + + :return: A tuple with the first item being true/false if a change is detected. The second item is the updated + value of the feature flag sentinel keys. The third item is the updated feature flags. + :rtype: Tuple[bool, Union[Dict[Tuple[str, str], str], None], Union[List[Dict[str, str]], None]] + """ + feature_flag_sentinel_keys: Mapping[Tuple[str, str], Optional[str]] = dict(refresh_on) + for (key, label), etag in feature_flag_sentinel_keys.items(): + changed = self._check_configuration_setting(key=key, label=label, etag=etag, headers=headers, **kwargs) + if changed: + feature_flags, feature_flag_sentinel_keys = self.load_feature_flags( + feature_flag_selectors, True, **kwargs + ) + return True, feature_flag_sentinel_keys, feature_flags + return False, None, None + + @distributed_trace + def get_configuration_setting(self, key: str, label: str, **kwargs) -> ConfigurationSetting: + """ + Gets a configuration setting from the replica client. + + :param str key: The key of the configuration setting + :param str label: The label of the configuration setting + :return: The configuration setting + :rtype: ConfigurationSetting + """ + return self._client.get_configuration_setting(key=key, label=label, **kwargs) + + def is_active(self) -> bool: + """ + Checks if the client is active and can be used. + + :return: True if the client is active, False otherwise + :rtype: bool + """ + return self.backoff_end_time <= (time.time() * 1000) + + def close(self) -> None: + """ + Closes the connection to Azure App Configuration. + """ + self._client.close() + + def __enter__(self): + self._client.__enter__() + return self + + def __exit__(self, *args): + self._client.__exit__(*args) + + +class ConfigurationClientManager: + def __init__(self, min_backoff_sec: int, max_backoff_sec: int): + self._replica_clients: List[ConfigurationClientWrapper] = [] + self._min_backoff_sec = min_backoff_sec + self._max_backoff_sec = max_backoff_sec + + def set_clients(self, replica_clients: List[ConfigurationClientWrapper]): + self._replica_clients.clear() + self._replica_clients.extend(replica_clients) + + def get_active_clients(self): + active_clients = [] + for client in self._replica_clients: + if client.is_active(): + active_clients.append(client) + return active_clients + + def backoff(self, client: ConfigurationClientWrapper): + client.failed_attempts += 1 + backoff_time = self._calculate_backoff(client.failed_attempts) + client.backoff_end_time = (time.time() * 1000) + backoff_time + + def get_client_count(self): + return len(self._replica_clients) + + def _calculate_backoff(self, attempts: int) -> float: + max_attempts = 63 + ms_per_second = 1000 # 1 Second in milliseconds + + min_backoff_milliseconds = self._min_backoff_sec * ms_per_second + max_backoff_milliseconds = self._max_backoff_sec * ms_per_second + + if self._max_backoff_sec <= self._min_backoff_sec: + return min_backoff_milliseconds + + calculated_milliseconds = max(1, min_backoff_milliseconds) * (1 << min(attempts, max_attempts)) + + if calculated_milliseconds > max_backoff_milliseconds or calculated_milliseconds <= 0: + calculated_milliseconds = max_backoff_milliseconds + + return min_backoff_milliseconds + ( + random.uniform(0.0, 1.0) * (calculated_milliseconds - min_backoff_milliseconds) + ) + + def __eq__(self, other): + if len(self._replica_clients) != len(other._replica_clients): + return False + for i in range(len(self._replica_clients)): # pylint:disable=consider-using-enumerate + if self._replica_clients[i] != other._replica_clients[i]: + return False + return True + + def close(self): + for client in self._replica_clients: + client.close() + + def __enter__(self): + for client in self._replica_clients: + client.__enter__() + return self + + def __exit__(self, *args): + for client in self._replica_clients: + client.__exit__(*args) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_discovery.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_discovery.py new file mode 100644 index 0000000000000..79253ca7bd6f2 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_discovery.py @@ -0,0 +1,97 @@ +# ------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- + +import time +from urllib.parse import urlparse +import dns.resolver +from dns.resolver import NXDOMAIN, YXDOMAIN, LifetimeTimeout, NoNameservers # cspell:disable-line +from dns.rdatatype import SRV # cspell:disable-line + +request_retry_period = 5 # seconds +HTTPS_PREFIX = "https://" + + +class SRVRecord: + priority: int + weight: int + port: int + target: str + + def __init__(self, answer): + self.priority = answer.priority + self.weight = answer.weight + self.port = answer.port + self.target = str(answer.target).rstrip(".") + + +def find_auto_failover_endpoints(endpoint: str, replica_discovery_enabled: bool): + if not replica_discovery_enabled: + return [] + known_domain = _get_known_domain(endpoint) + if known_domain is None: + return [] + + origin = _find_origin(endpoint) + if origin is None or not _validate(known_domain, origin.target): + return [] + + srv_records = [origin] + _find_replicas(origin.target) + endpoints = [] + if endpoint.startswith(HTTPS_PREFIX): + endpoint = endpoint[len(HTTPS_PREFIX) :] + for srv_record in srv_records: + if _validate(known_domain, srv_record.target) and srv_record.target != endpoint: + endpoints.append(HTTPS_PREFIX + srv_record.target) + return endpoints + + +def _find_origin(endpoint): + uri = urlparse(endpoint).hostname + request = f"_origin._tcp.{uri}" + srv_records = _request_record(request) + if not srv_records: + return None + return SRVRecord(srv_records[0]) + + +def _find_replicas(origin): + replicas = [] + i = 0 + while True: + request = f"_alt{str(i)}._tcp.{origin}" + answers = _request_record(request) + if not answers: + break + for answer in answers: + replicas.append(SRVRecord(answer)) + i += 1 + return replicas + + +def _request_record(request): + start_time = time.time() + while time.time() - start_time < request_retry_period: + try: + return dns.resolver.resolve(request, SRV) + except (NXDOMAIN, YXDOMAIN): # cspell:disable-line + break + except (LifetimeTimeout, NoNameservers): + continue + return None + + +def _validate(known_domain, endpoint): + return endpoint.endswith(known_domain) + + +def _get_known_domain(known_host): + trusted_domain_labels = ["appconfig", "azconfig"] # cspell:disable-line + + for label in trusted_domain_labels: + index = known_host.lower().rfind(f".{label}.") + if index > 0: + return known_host[index:] + return None diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/aio/_azureappconfigurationproviderasync.py b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/aio/_azureappconfigurationproviderasync.py index 8ab97ae3e2a9c..d2a7aa3d51a40 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/aio/_azureappconfigurationproviderasync.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/aio/_azureappconfigurationproviderasync.py @@ -52,11 +52,11 @@ TARGETING_FILTER_KEY, ) from .._azureappconfigurationprovider import ( - _is_json_content_type, _get_headers, _RefreshTimer, _build_sentinel, _delay_failure, + _is_json_content_type, ) from .._user_agent import USER_AGENT @@ -220,7 +220,21 @@ async def load(*args, **kwargs) -> "AzureAppConfigurationProvider": if kwargs.get("keyvault_credential") is not None and kwargs.get("secret_resolver") is not None: raise ValueError("A keyvault credential and secret resolver can't both be configured.") - headers = _get_headers("Startup", **kwargs) + uses_key_vault = ( + "keyvault_credential" in kwargs + or "keyvault_client_configs" in kwargs + or "secret_resolver" in kwargs + or kwargs.get("uses_key_vault", False) + ) + + headers = _get_headers( + kwargs.pop("headers", {}), + "Startup", + 0, + kwargs.pop("uses_feature_flags", False), + kwargs.pop("feature_filters_used", {}), + uses_key_vault, + ) provider = _buildprovider( connection_string, endpoint, credential, uses_key_vault="UsesKeyVault" in headers, **kwargs ) @@ -417,11 +431,12 @@ async def _refresh_configuration_settings(self, **kwargs) -> bool: need_refresh = False updated_sentinel_keys = dict(self._refresh_on) headers = _get_headers( + kwargs.pop("headers", {}), "Watch", - uses_key_vault=self._uses_key_vault, - feature_filters_used=self._feature_filter_usage, - uses_feature_flags=self._feature_flag_enabled, - **kwargs + 0, + self._feature_flag_enabled, + self._feature_filter_usage, + self._uses_key_vault, ) for (key, label), etag in updated_sentinel_keys.items(): changed, updated_sentinel = await self._check_configuration_setting( @@ -444,11 +459,12 @@ async def _refresh_configuration_settings(self, **kwargs) -> bool: async def _refresh_feature_flags(self, **kwargs) -> bool: feature_flag_sentinel_keys = dict(self._refresh_on_feature_flags) headers = _get_headers( + kwargs.pop("headers", {}), "Watch", - uses_key_vault=self._uses_key_vault, - feature_filters_used=self._feature_filter_usage, - uses_feature_flags=self._feature_flag_enabled, - **kwargs + 0, + self._feature_flag_enabled, + self._feature_filter_usage, + self._uses_key_vault, ) for (key, label), etag in feature_flag_sentinel_keys.items(): changed = await self._check_configuration_setting( diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/dev_requirements.txt b/sdk/appconfiguration/azure-appconfiguration-provider/dev_requirements.txt index 4bd6de19acc80..0d90dc7dbabde 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/dev_requirements.txt +++ b/sdk/appconfiguration/azure-appconfiguration-provider/dev_requirements.txt @@ -4,3 +4,4 @@ -e ../../keyvault/azure-keyvault-secrets aiohttp>=3.0 -e ../../../tools/azure-sdk-tools +dnspython \ No newline at end of file diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/setup.py b/sdk/appconfiguration/azure-appconfiguration-provider/setup.py index debe3ec82b1d8..2748b0ae3ac43 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/setup.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/setup.py @@ -75,5 +75,6 @@ "azure-core>=1.28.0", "azure-appconfiguration>=1.6.0", "azure-keyvault-secrets>=4.3.0", + "dnspython>=2.6.1", ], ) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/conftest.py b/sdk/appconfiguration/azure-appconfiguration-provider/tests/conftest.py index 0117415f3ecf2..5692e937a5a7e 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/conftest.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/conftest.py @@ -6,6 +6,7 @@ set_custom_default_matcher, remove_batch_sanitizers, add_remove_header_sanitizer, + add_uri_string_sanitizer, ) import pytest @@ -15,17 +16,21 @@ @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): add_general_regex_sanitizer( - value="https://fake-endpoint.azconfig.io", - regex=os.environ.get("APPCONFIGURATION_ENDPOINT_STRING", "https://fake-endpoint.azconfig.io"), + value="https://Sanitized.azconfig.io", + regex=os.environ.get("APPCONFIGURATION_ENDPOINT_STRING", "https://Sanitized.azconfig.io"), ) add_general_regex_sanitizer( - value="fake-connection-string", - regex=os.environ.get("APPCONFIGURATION_CONNECTION_STRING", "fake-connection-string"), + value="Sanitized", + regex=os.environ.get("APPCONFIGURATION_CONNECTION_STRING", "Sanitized"), ) + add_uri_string_sanitizer() add_general_string_sanitizer( - value="https://fake-key-vault.vault.azure.net/", - target=os.environ.get("APPCONFIGURATION_KEY_VAULT_REFERENCE", "https://fake-key-vault.vault.azure.net/"), + value="https://Sanitized.vault.azure.net/secrets/fake-secret/", + target=os.environ.get( + "APPCONFIGURATION_KEY_VAULT_REFERENCE", "https://Sanitized.vault.azure.net/secrets/fake-secret/" + ), ) + add_remove_header_sanitizer(headers="Correlation-Context") add_general_regex_sanitizer(value="api-version=1970-01-01", regex="api-version=.+") set_custom_default_matcher(ignored_headers="x-ms-content-sha256, Accept", excluded_headers="Content-Length") diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/preparers.py b/sdk/appconfiguration/azure-appconfiguration-provider/tests/preparers.py index 6be4c6c4a2c74..d7512a12f5ce2 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/preparers.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/preparers.py @@ -10,10 +10,10 @@ AppConfigProviderPreparer = functools.partial( EnvironmentVariableLoader, "appconfiguration", - keyvault_secret_url="https://fake-keyvault.vault.azure.net/secrets/fake-secret/", - appconfiguration_keyvault_secret_url="https://fake-keyvault.vault.azure.net/secrets/fake-secret/", - appconfiguration_connection_string="Endpoint=https://fake-endpoint.azconfig.io;Id=0-l4-s0:h5htBaY5Z1LwFz50bIQv;Secret=lamefakesecretlamefakesecretlamefakesecrett=", - appconfiguration_endpoint_string="https://fake-endpoint.azconfig.io", + keyvault_secret_url="https://Sanitized.vault.azure.net/secrets/fake-secret/", + appconfiguration_keyvault_secret_url="https://Sanitized.vault.azure.net/secrets/fake-secret/", + appconfiguration_connection_string="Endpoint=https://Sanitized.azconfig.io;Id=0-l4-s0:h5htBaY5Z1LwFz50bIQv;Secret=lamefakesecretlamefakesecretlamefakesecrett=", + appconfiguration_endpoint_string="https://Sanitized.azconfig.io", ) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_async_provider_refresh.py b/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_async_provider_refresh.py index 8fa28c303afc6..56c121f8ce596 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_async_provider_refresh.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_async_provider_refresh.py @@ -39,12 +39,15 @@ async def test_refresh(self, appconfiguration_endpoint_string, appconfiguration_ assert client["my_json"]["key"] == "value" assert FEATURE_MANAGEMENT_KEY in client assert has_feature_flag(client, "Alpha") - setting = await client._client.get_configuration_setting(key="refresh_message") + + appconfig_client = client._client + + setting = await appconfig_client.get_configuration_setting(key="refresh_message") setting.value = "updated value" - feature_flag = await client._client.get_configuration_setting(key=".appconfig.featureflag/Alpha") + feature_flag = await appconfig_client.get_configuration_setting(key=".appconfig.featureflag/Alpha") feature_flag.enabled = True - await client._client.set_configuration_setting(setting) - await client._client.set_configuration_setting(feature_flag) + await appconfig_client.set_configuration_setting(setting) + await appconfig_client.set_configuration_setting(feature_flag) # Waiting for the refresh interval to pass time.sleep(2) @@ -56,8 +59,8 @@ async def test_refresh(self, appconfiguration_endpoint_string, appconfiguration_ setting.value = "original value" feature_flag.enabled = False - await client._client.set_configuration_setting(setting) - await client._client.set_configuration_setting(feature_flag) + await appconfig_client.set_configuration_setting(setting) + await appconfig_client.set_configuration_setting(feature_flag) # Waiting for the refresh interval to pass time.sleep(2) @@ -69,8 +72,8 @@ async def test_refresh(self, appconfiguration_endpoint_string, appconfiguration_ setting.value = "updated value 2" feature_flag.enabled = True - await client._client.set_configuration_setting(setting) - await client._client.set_configuration_setting(feature_flag) + await appconfig_client.set_configuration_setting(setting) + await appconfig_client.set_configuration_setting(feature_flag) # Not waiting for the refresh interval to pass await client.refresh() @@ -79,7 +82,7 @@ async def test_refresh(self, appconfiguration_endpoint_string, appconfiguration_ assert mock_callback.call_count == 2 setting.value = "original value" - await client._client.set_configuration_setting(setting) + await appconfig_client.set_configuration_setting(setting) await client.refresh() assert client["refresh_message"] == "original value" @@ -103,12 +106,15 @@ async def test_empty_refresh(self, appconfiguration_endpoint_string, appconfigur assert client["my_json"]["key"] == "value" assert FEATURE_MANAGEMENT_KEY in client assert has_feature_flag(client, "Alpha") - setting = await client._client.get_configuration_setting(key="refresh_message") + + appconfig_client = client._client + + setting = await appconfig_client.get_configuration_setting(key="refresh_message") setting.value = "updated value" - await client._client.set_configuration_setting(setting) - static_setting = await client._client.get_configuration_setting(key="non_refreshed_message") + await appconfig_client.set_configuration_setting(setting) + static_setting = await appconfig_client.get_configuration_setting(key="non_refreshed_message") static_setting.value = "updated static" - await client._client.set_configuration_setting(static_setting) + await appconfig_client.set_configuration_setting(static_setting) # Waiting for the refresh interval to pass time.sleep(2) @@ -119,9 +125,9 @@ async def test_empty_refresh(self, appconfiguration_endpoint_string, appconfigur assert mock_callback.call_count == 0 setting.value = "original value" - await client._client.set_configuration_setting(setting) + await appconfig_client.set_configuration_setting(setting) static_setting.value = "Static" - await client._client.set_configuration_setting(static_setting) + await appconfig_client.set_configuration_setting(static_setting) except ImportError: pass diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_provider_refresh.py b/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_provider_refresh.py index be506901c4563..a72aecf142431 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_provider_refresh.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/test_provider_refresh.py @@ -34,12 +34,14 @@ def test_refresh(self, appconfiguration_endpoint_string, appconfiguration_keyvau assert FEATURE_MANAGEMENT_KEY in client assert has_feature_flag(client, "Alpha") - setting = client._client.get_configuration_setting(key="refresh_message") + appconfig_client = self.create_aad_sdk_client(appconfiguration_endpoint_string) + + setting = appconfig_client.get_configuration_setting(key="refresh_message") setting.value = "updated value" - feature_flag = client._client.get_configuration_setting(key=".appconfig.featureflag/Alpha") + feature_flag = appconfig_client.get_configuration_setting(key=".appconfig.featureflag/Alpha") feature_flag.enabled = True - client._client.set_configuration_setting(setting) - client._client.set_configuration_setting(feature_flag) + appconfig_client.set_configuration_setting(setting) + appconfig_client.set_configuration_setting(feature_flag) # Waiting for the refresh interval to pass time.sleep(2) @@ -51,8 +53,8 @@ def test_refresh(self, appconfiguration_endpoint_string, appconfiguration_keyvau setting.value = "original value" feature_flag.enabled = False - client._client.set_configuration_setting(setting) - client._client.set_configuration_setting(feature_flag) + appconfig_client.set_configuration_setting(setting) + appconfig_client.set_configuration_setting(feature_flag) # Waiting for the refresh interval to pass time.sleep(2) @@ -64,8 +66,8 @@ def test_refresh(self, appconfiguration_endpoint_string, appconfiguration_keyvau setting.value = "updated value 2" feature_flag.enabled = True - client._client.set_configuration_setting(setting) - client._client.set_configuration_setting(feature_flag) + appconfig_client.set_configuration_setting(setting) + appconfig_client.set_configuration_setting(feature_flag) # Not waiting for the refresh interval to pass client.refresh() @@ -74,7 +76,7 @@ def test_refresh(self, appconfiguration_endpoint_string, appconfiguration_keyvau assert mock_callback.call_count == 2 setting.value = "original value" - client._client.set_configuration_setting(setting) + appconfig_client.set_configuration_setting(setting) client.refresh() assert client["refresh_message"] == "original value" @@ -97,12 +99,14 @@ def test_empty_refresh(self, appconfiguration_endpoint_string, appconfiguration_ assert FEATURE_MANAGEMENT_KEY in client assert has_feature_flag(client, "Alpha") - setting = client._client.get_configuration_setting(key="refresh_message") + appconfig_client = self.create_aad_sdk_client(appconfiguration_endpoint_string) + + setting = appconfig_client.get_configuration_setting(key="refresh_message") setting.value = "updated value" - client._client.set_configuration_setting(setting) - static_setting = client._client.get_configuration_setting(key="non_refreshed_message") + appconfig_client.set_configuration_setting(setting) + static_setting = appconfig_client.get_configuration_setting(key="non_refreshed_message") static_setting.value = "updated static" - client._client.set_configuration_setting(static_setting) + appconfig_client.set_configuration_setting(static_setting) # Waiting for the refresh interval to pass time.sleep(2) @@ -113,6 +117,6 @@ def test_empty_refresh(self, appconfiguration_endpoint_string, appconfiguration_ assert mock_callback.call_count == 0 setting.value = "original value" - client._client.set_configuration_setting(setting) + appconfig_client.set_configuration_setting(setting) static_setting.value = "Static" - client._client.set_configuration_setting(static_setting) + appconfig_client.set_configuration_setting(static_setting) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/tests/testcase.py b/sdk/appconfiguration/azure-appconfiguration-provider/tests/testcase.py index a0b92d2faf34b..563c4070dce5f 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/tests/testcase.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/tests/testcase.py @@ -134,6 +134,16 @@ def create_client( feature_flag_refresh_enabled=feature_flag_refresh_enabled, ) + @staticmethod + def create_sdk_client(appconfiguration_connection_string): + return AzureAppConfigurationClient.from_connection_string( + appconfiguration_connection_string, user_agent="SDK/Integration" + ) + + def create_aad_sdk_client(self, appconfiguration_endpoint_string): + cred = self.get_credential(AzureAppConfigurationClient) + return AzureAppConfigurationClient(appconfiguration_endpoint_string, cred, user_agent="SDK/Integration") + def setup_configs(client, keyvault_secret_url): for config in get_configs(keyvault_secret_url): diff --git a/sdk/appconfiguration/azure-appconfiguration/CHANGELOG.md b/sdk/appconfiguration/azure-appconfiguration/CHANGELOG.md index 4ba6237de821b..9ce2987c0f485 100644 --- a/sdk/appconfiguration/azure-appconfiguration/CHANGELOG.md +++ b/sdk/appconfiguration/azure-appconfiguration/CHANGELOG.md @@ -1,15 +1,31 @@ # Release History -## 1.6.1 (Unreleased) +## 1.7.1 (Unreleased) ### Features Added ### Breaking Changes +### Bugs Fixed + +### Other Changes + +## 1.7.0 (2024-08-15) + +### Features Added +- Added operation `list_labels()` for listing configuration setting labels. +- Supported filtering by configuration setting tags in `list_configuration_settings()` and `list_revisions()`. +- Added a new property tags to ConfigurationSettingsFilter to support filtering settings with tags filter for snapshot. + ### Bugs Fixed - Fixed a bug where the `feature_id` of `FeatureFlagConfigurationSetting` will be different from `id` customer field, and may overwrite the original customer-defined value if different from the `FeatureFlagConfigurationSetting` key suffix. ### Other Changes +- Updated the default `api_version` to "2023-11-01". +- Published enum `LabelFields` and model `ConfigurationSettingLabel`. +- Published enum `SnapshotFields`, and accepted the type for `fields` parameter in `get_snapshot()` and `list_snapshots()`. +- Published enum `ConfigurationSettingFields`, and accepted the type for `fields` parameter in `list_configuration_settings()` and `list_revisions()`. +- Published enum `SnapshotComposition`, and accepted the type for `ConfigurationSnapshot` property `composition_type` and `begion_create_snapshot()` kwarg `composition_type`. ## 1.6.0 (2024-04-09) diff --git a/sdk/appconfiguration/azure-appconfiguration/README.md b/sdk/appconfiguration/azure-appconfiguration/README.md index 82d26f9b41161..be7e16a6e5dc5 100644 --- a/sdk/appconfiguration/azure-appconfiguration/README.md +++ b/sdk/appconfiguration/azure-appconfiguration/README.md @@ -179,7 +179,7 @@ There are two ways to store a Configuration Setting: - add_configuration_setting creates a setting only if the setting does not already exist in the store. - + ```python config_setting = ConfigurationSetting( @@ -192,7 +192,7 @@ added_config_setting = client.add_configuration_setting(config_setting) - set_configuration_setting creates a setting if it doesn't exist or overrides an existing setting. - + ```python added_config_setting.value = "new value" @@ -202,11 +202,33 @@ updated_config_setting = client.set_configuration_setting(added_config_setting) +### Set and clear read-only for a configuration setting. + +- Set a configuration setting to be read-only. + + + +```python +read_only_config_setting = client.set_read_only(updated_config_setting) +``` + + + +- Clear read-only for a configuration setting. + + + +```python +read_write_config_setting = client.set_read_only(updated_config_setting, False) +``` + + + ### Get a Configuration Setting Get a previously stored Configuration Setting. - + ```python fetched_config_setting = client.get_configuration_setting(key="MyKey", label="MyLabel") @@ -218,34 +240,70 @@ fetched_config_setting = client.get_configuration_setting(key="MyKey", label="My Delete an existing Configuration Setting. - + ```python -client.delete_configuration_setting( - key="MyKey", - label="MyLabel", -) +client.delete_configuration_setting(key="MyKey", label="MyLabel") ``` ### List Configuration Settings -List all configuration settings filtered with label_filter and/or key_filter. +List all configuration settings filtered with label_filter and/or key_filter and/or tags_filter. + + + +```python +config_settings = client.list_configuration_settings(key_filter="MyKey*", tags_filter=["my tag1=my tag1 value"]) +for config_setting in config_settings: + print(config_setting) +``` + + + +### List revisions + +List revision history of configuration settings filtered with label_filter and/or key_filter and/or tags_filter. + + + +```python +items = client.list_revisions(key_filter="MyKey", tags_filter=["my tag=my tag value"]) +for item in items: + print(item) +``` + + + +### List labels + +List labels of all configuration settings. - + ```python -config_settings = client.list_configuration_settings(label_filter="MyLabel") -for item in config_settings: - print_configuration_setting(item) +print("List all labels in resource") +config_settings = client.list_labels() +for config_setting in config_settings: + print(config_setting) + +print("List labels by exact match") +config_settings = client.list_labels(name="my label1") +for config_setting in config_settings: + print(config_setting) + +print("List labels by wildcard") +config_settings = client.list_labels(name="my label*") +for config_setting in config_settings: + print(config_setting) ``` ### Create a Snapshot - + ```python from azure.appconfiguration import ConfigurationSettingsFilter @@ -253,14 +311,13 @@ from azure.appconfiguration import ConfigurationSettingsFilter filters = [ConfigurationSettingsFilter(key="my_key1", label="my_label1")] response = client.begin_create_snapshot(name=snapshot_name, filters=filters) created_snapshot = response.result() -print_snapshot(created_snapshot) ``` ### Get a Snapshot - + ```python received_snapshot = client.get_snapshot(name=snapshot_name) @@ -270,44 +327,42 @@ received_snapshot = client.get_snapshot(name=snapshot_name) ### Archive a Snapshot - + ```python archived_snapshot = client.archive_snapshot(name=snapshot_name) -print_snapshot(archived_snapshot) ``` ### Recover a Snapshot - + ```python recovered_snapshot = client.recover_snapshot(name=snapshot_name) -print_snapshot(recovered_snapshot) ``` ### List Snapshots - + ```python for snapshot in client.list_snapshots(): - print_snapshot(snapshot) + print(snapshot) ``` ### List Configuration Settings of a Snapshot - + ```python for config_setting in client.list_configuration_settings(snapshot_name=snapshot_name): - print_configuration_setting(config_setting) + print(config_setting) ``` @@ -315,7 +370,7 @@ for config_setting in client.list_configuration_settings(snapshot_name=snapshot_ ### Async APIs Async client is supported. -To use the async client library, import the AzureAppConfigurationClient from package azure.appconfiguration.aio instead of azure.appconfiguration +To use the async client library, import the AzureAppConfigurationClient from package azure.appconfiguration.aio instead of azure.appconfiguration. @@ -325,16 +380,16 @@ from azure.appconfiguration.aio import AzureAppConfigurationClient CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] -# Create app config client +# Create an app config client client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) ``` -This async AzureAppConfigurationClient has the same method signatures as the sync ones except that they're async. -For instance, to retrieve a Configuration Setting asynchronously, async_client can be used: +This async AzureAppConfigurationClient has the same method signatures as the sync ones except that they're async.\ +For instance, retrieve a Configuration Setting asynchronously: - + ```python fetched_config_setting = await client.get_configuration_setting(key="MyKey", label="MyLabel") @@ -342,71 +397,14 @@ fetched_config_setting = await client.get_configuration_setting(key="MyKey", lab -To use list_configuration_settings, call it synchronously and iterate over the returned async iterator asynchronously - - - -```python -config_settings = client.list_configuration_settings(label_filter="MyLabel") -async for item in config_settings: - print_configuration_setting(item) -``` - - - - - -```python -from azure.appconfiguration import ConfigurationSettingsFilter - -filters = [ConfigurationSettingsFilter(key="my_key1", label="my_label1")] -response = await client.begin_create_snapshot(name=snapshot_name, filters=filters) -created_snapshot = await response.result() -print_snapshot(created_snapshot) -``` - - - - - -```python -received_snapshot = await client.get_snapshot(name=snapshot_name) -``` - - - - - -```python -archived_snapshot = await client.archive_snapshot(name=snapshot_name) -print_snapshot(archived_snapshot) -``` - - - - - -```python -recovered_snapshot = await client.recover_snapshot(name=snapshot_name) -print_snapshot(recovered_snapshot) -``` - - - - - -```python -async for snapshot in client.list_snapshots(): - print_snapshot(snapshot) -``` - - +To list configuration settings, call `list_configuration_settings` operation synchronously and iterate over the returned async iterator asynchronously: - + ```python -async for config_setting in client.list_configuration_settings(snapshot_name=snapshot_name): - print_configuration_setting(config_setting) +config_settings = client.list_configuration_settings(key_filter="MyKey*", tags_filter=["my tag1=my tag1 value"]) +async for config_setting in config_settings: + print(config_setting) ``` @@ -421,11 +419,13 @@ See the [troubleshooting guide][troubleshooting_guide] for details on how to dia Several App Configuration client library samples are available to you in this GitHub repository. These include: - [Hello world](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample.py) / [Async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample_async.py) -- [Hello world with labels](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_advanced_sample.py) / [Async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_advanced_sample_async.py) +- [List configuration settings](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/list_configuration_settings_sample.py) / [Async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/list_configuration_settings_sample_async.py) - [Make a configuration setting readonly](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample.py) / [Async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample_async.py) - [Read revision history](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample.py) / [Async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample_async.py) - [Get a setting if changed](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample.py) / [Async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample_async.py) -- [Create, retrieve and update status of a configuration settings snapshot](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_samples.py) / [Async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_samples_async.py) +- [Create, retrieve and update status of a configuration settings snapshot](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_sample.py) / [Async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_sample_async.py) +- [Send custom HTTP requests](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample.py) / [Async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample_async.py) +- [Update AzureAppConfigurationClient sync_token](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_sample.py) / [Async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_sample_async.py) For more details see the [samples README](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/README.md). diff --git a/sdk/appconfiguration/azure-appconfiguration/assets.json b/sdk/appconfiguration/azure-appconfiguration/assets.json index 64b5afd695f67..bb641d8c9303c 100644 --- a/sdk/appconfiguration/azure-appconfiguration/assets.json +++ b/sdk/appconfiguration/azure-appconfiguration/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/appconfiguration/azure-appconfiguration", - "Tag": "python/appconfiguration/azure-appconfiguration_27c8f82a12" + "Tag": "python/appconfiguration/azure-appconfiguration_6552b5023e" } diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/__init__.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/__init__.py index 92787282fbc79..4dd855d6d7116 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/__init__.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/__init__.py @@ -15,10 +15,17 @@ ConfigurationSetting, FeatureFlagConfigurationSetting, SecretReferenceConfigurationSetting, - ConfigurationSnapshot, ConfigurationSettingsFilter, + ConfigurationSnapshot, + ConfigurationSettingLabel, +) +from ._generated.models import ( + SnapshotStatus, + LabelFields, + SnapshotFields, + ConfigurationSettingFields, + SnapshotComposition, ) -from ._generated.models import SnapshotStatus from ._version import VERSION from ._azure_appconfiguration_error import ResourceReadOnlyError @@ -31,7 +38,12 @@ "SecretReferenceConfigurationSetting", "ConfigurationSnapshot", "SnapshotStatus", + "SnapshotFields", + "SnapshotComposition", + "LabelFields", + "ConfigurationSettingFields", "ConfigurationSettingsFilter", + "ConfigurationSettingLabel", "FILTER_PERCENTAGE", "FILTER_TARGETING", "FILTER_TIME_WINDOW", diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_client.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_client.py index fb68fb516357e..b029eeb7d1a66 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_client.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_client.py @@ -3,11 +3,9 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # ------------------------------------------------------------------------- -import binascii import functools from datetime import datetime -from typing import Any, Dict, List, Optional, Union, cast, overload -from typing_extensions import Literal +from typing import Any, Dict, List, Optional, Union, overload, cast from azure.core import MatchConditions from azure.core.paging import ItemPaged from azure.core.credentials import TokenCredential, AzureKeyCredential @@ -24,12 +22,20 @@ from ._azure_appconfiguration_error import ResourceReadOnlyError from ._azure_appconfiguration_requests import AppConfigRequestsCredentialsPolicy from ._generated import AzureAppConfiguration -from ._generated.models import SnapshotUpdateParameters, SnapshotStatus +from ._generated.models import ( + SnapshotUpdateParameters, + SnapshotStatus, + SnapshotFields, + SnapshotComposition, + LabelFields, + ConfigurationSettingFields, +) from ._models import ( ConfigurationSetting, + ConfigurationSettingPropertiesPaged, ConfigurationSettingsFilter, ConfigurationSnapshot, - ConfigurationSettingPropertiesPaged, + ConfigurationSettingLabel, ) from ._utils import ( prep_if_match, @@ -47,7 +53,7 @@ class AzureAppConfigurationClient: :param str base_url: Base url of the service. :param credential: An object which can provide secrets for the app configuration service :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this default + :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str @@ -139,22 +145,28 @@ def list_configuration_settings( *, key_filter: Optional[str] = None, label_filter: Optional[str] = None, + tags_filter: Optional[List[str]] = None, accept_datetime: Optional[Union[datetime, str]] = None, - fields: Optional[List[str]] = None, + fields: Optional[List[Union[str, ConfigurationSettingFields]]] = None, **kwargs: Any, ) -> ItemPaged[ConfigurationSetting]: """List the configuration settings stored in the configuration service, optionally filtered by - key, label and accept_datetime. + key, label, tags and accept_datetime. For more information about supported filters, see + https://learn.microsoft.com/azure/azure-app-configuration/rest-api-key-value?pivots=v23-11#supported-filters. - :keyword key_filter: filter results based on their keys. '*' can be - used as wildcard in the beginning or end of the filter + :keyword key_filter: Filter results based on their keys. '*' can be used as wildcard in the beginning or end + of the filter. :paramtype key_filter: str or None - :keyword label_filter: filter results based on their label. '*' can be - used as wildcard in the beginning or end of the filter + :keyword label_filter: Filter results based on their label. '*' can be used as wildcard in the beginning or end + of the filter. :paramtype label_filter: str or None - :keyword accept_datetime: retrieve ConfigurationSetting existed at this datetime + :keyword tags_filter: Filter results based on their tags. + :paramtype tags_filter: list[str] or None + :keyword accept_datetime: Retrieve ConfigurationSetting that existed at this datetime :paramtype accept_datetime: ~datetime.datetime or str or None - :keyword list[str] fields: specify which fields to include in the results. Leave None to include all fields + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.ConfigurationSettingFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.ConfigurationSettingFields] or None :return: An iterator of :class:`~azure.appconfiguration.ConfigurationSetting` :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.ConfigurationSetting] :raises: :class:`~azure.core.exceptions.HttpResponseError`, \ @@ -181,14 +193,19 @@ def list_configuration_settings( @overload def list_configuration_settings( - self, *, snapshot_name: str, fields: Optional[List[str]] = None, **kwargs: Any + self, + *, + snapshot_name: str, + fields: Optional[List[Union[str, ConfigurationSettingFields]]] = None, + **kwargs: Any, ) -> ItemPaged[ConfigurationSetting]: """List the configuration settings stored under a snapshot in the configuration service, optionally filtered by fields to present in return. :keyword str snapshot_name: The snapshot name. - :keyword fields: Specify which fields to include in the results. Leave None to include all fields. - :type fields: list[str] or None + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.ConfigurationSettingFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.ConfigurationSettingFields] or None :return: An iterator of :class:`~azure.appconfiguration.ConfigurationSetting` :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.ConfigurationSetting] :raises: :class:`~azure.core.exceptions.HttpResponseError` @@ -204,29 +221,27 @@ def list_configuration_settings(self, *args, **kwargs) -> ItemPaged[Configuratio select = ["locked" if x == "read_only" else x for x in select] snapshot_name = kwargs.pop("snapshot_name", None) - try: - if snapshot_name is not None: - return self._impl.get_key_values( # type: ignore - snapshot=snapshot_name, - accept_datetime=accept_datetime, - select=select, - cls=lambda objs: [ConfigurationSetting._from_generated(x) for x in objs], - **kwargs, - ) - key_filter, kwargs = get_key_filter(*args, **kwargs) - label_filter, kwargs = get_label_filter(*args, **kwargs) - command = functools.partial(self._impl.get_key_values_in_one_page, **kwargs) # type: ignore[attr-defined] - return ItemPaged( - command, - key=key_filter, - label=label_filter, + if snapshot_name is not None: + return self._impl.get_key_values( # type: ignore[return-value] + snapshot=snapshot_name, accept_datetime=accept_datetime, select=select, - page_iterator_class=ConfigurationSettingPropertiesPaged, + cls=lambda objs: [ConfigurationSetting._from_generated(x) for x in objs], + **kwargs, ) - - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc + tags = kwargs.pop("tags_filter", None) + key_filter, kwargs = get_key_filter(*args, **kwargs) + label_filter, kwargs = get_label_filter(*args, **kwargs) + command = functools.partial(self._impl.get_key_values_in_one_page, **kwargs) # type: ignore[attr-defined] + return ItemPaged( + command, + key=key_filter, + label=label_filter, + accept_datetime=accept_datetime, + select=select, + tags=tags, + page_iterator_class=ConfigurationSettingPropertiesPaged, + ) @distributed_trace def get_configuration_setting( @@ -241,15 +256,15 @@ def get_configuration_setting( ) -> Union[None, ConfigurationSetting]: """Get the matched ConfigurationSetting from Azure App Configuration service - :param key: key of the ConfigurationSetting + :param key: Key of the ConfigurationSetting :type key: str - :param label: label used to identify the ConfigurationSetting. Default is `None`. + :param label: Label used to identify the ConfigurationSetting. Default is `None`. :type label: str or None - :param etag: check if the ConfigurationSetting is changed. Set None to skip checking etag + :param etag: Check if the ConfigurationSetting is changed. Set None to skip checking etag :type etag: str or None :param match_condition: The match condition to use upon the etag :type match_condition: ~azure.core.MatchConditions - :keyword accept_datetime: retrieve ConfigurationSetting existed at this datetime + :keyword accept_datetime: Retrieve ConfigurationSetting that existed at this datetime :paramtype accept_datetime: ~datetime.datetime or str or None :return: The matched ConfigurationSetting object :rtype: ~azure.appconfiguration.ConfigurationSetting or None @@ -291,14 +306,12 @@ def get_configuration_setting( return ConfigurationSetting._from_generated(key_value) except ResourceNotModifiedError: return None - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc @distributed_trace def add_configuration_setting(self, configuration_setting: ConfigurationSetting, **kwargs) -> ConfigurationSetting: """Add a ConfigurationSetting instance into the Azure App Configuration service. - :param configuration_setting: the ConfigurationSetting object to be added + :param configuration_setting: The ConfigurationSetting object to be added :type configuration_setting: ~azure.appconfiguration.ConfigurationSetting :return: The ConfigurationSetting object returned from the App Configuration service :rtype: ~azure.appconfiguration.ConfigurationSetting @@ -321,18 +334,15 @@ def add_configuration_setting(self, configuration_setting: ConfigurationSetting, """ key_value = configuration_setting._to_generated() error_map = {412: ResourceExistsError} - try: - key_value_added = self._impl.put_key_value( - entity=key_value, - key=key_value.key, # type: ignore - label=key_value.label, - if_none_match="*", - error_map=error_map, - **kwargs, - ) - return ConfigurationSetting._from_generated(key_value_added) - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc + key_value_added = self._impl.put_key_value( + entity=key_value, + key=key_value.key, # type: ignore + label=key_value.label, + if_none_match="*", + error_map=error_map, + **kwargs, + ) + return ConfigurationSetting._from_generated(key_value_added) @distributed_trace def set_configuration_setting( @@ -347,13 +357,14 @@ def set_configuration_setting( If the configuration setting identified by key and label does not exist, this is a create. Otherwise this is an update. - :param configuration_setting: the ConfigurationSetting to be added (if not exists) \ + :param configuration_setting: The ConfigurationSetting to be added (if not exists) \ or updated (if exists) to the service :type configuration_setting: ~azure.appconfiguration.ConfigurationSetting :param match_condition: The match condition to use upon the etag :type match_condition: ~azure.core.MatchConditions - :keyword str etag: check if the ConfigurationSetting is changed. \ + :keyword etag: Check if the ConfigurationSetting is changed. \ Will use the value from param configuration_setting if not set. + :paramtype etag: str or None :return: The ConfigurationSetting returned from the service :rtype: ~azure.appconfiguration.ConfigurationSetting :raises: :class:`~azure.appconfiguration.ResourceReadOnlyError`, \ @@ -388,19 +399,16 @@ def set_configuration_setting( if match_condition == MatchConditions.IfMissing: error_map.update({412: ResourceExistsError}) - try: - key_value_set = self._impl.put_key_value( - entity=key_value, - key=key_value.key, # type: ignore - label=key_value.label, - if_match=prep_if_match(configuration_setting.etag, match_condition), - if_none_match=prep_if_none_match(etag or configuration_setting.etag, match_condition), - error_map=error_map, - **kwargs, - ) - return ConfigurationSetting._from_generated(key_value_set) - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc + key_value_set = self._impl.put_key_value( + entity=key_value, + key=key_value.key, # type: ignore + label=key_value.label, + if_match=prep_if_match(configuration_setting.etag, match_condition), + if_none_match=prep_if_none_match(etag or configuration_setting.etag, match_condition), + error_map=error_map, + **kwargs, + ) + return ConfigurationSetting._from_generated(key_value_set) @distributed_trace def delete_configuration_setting( # pylint:disable=delete-operation-wrong-return-type @@ -414,11 +422,12 @@ def delete_configuration_setting( # pylint:disable=delete-operation-wrong-retur ) -> Union[None, ConfigurationSetting]: """Delete a ConfigurationSetting if it exists - :param key: key used to identify the ConfigurationSetting + :param key: Key used to identify the ConfigurationSetting :type key: str - :param label: label used to identify the ConfigurationSetting. Default is `None`. - :type label: str - :keyword str etag: check if the ConfigurationSetting is changed. Set None to skip checking etag + :param label: Label used to identify the ConfigurationSetting. Default is `None`. + :type label: str or None + :keyword etag: Check if the ConfigurationSetting is changed. Set None to skip checking etag + :paramtype etag: str or None :keyword match_condition: The match condition to use upon the etag :paramtype match_condition: ~azure.core.MatchConditions :return: The deleted ConfigurationSetting returned from the service, or None if it doesn't exist. @@ -449,19 +458,16 @@ def delete_configuration_setting( # pylint:disable=delete-operation-wrong-retur if match_condition == MatchConditions.IfMissing: error_map.update({412: ResourceExistsError}) - try: - key_value_deleted = self._impl.delete_key_value( - key=key, - label=label, - if_match=prep_if_match(etag, match_condition), - error_map=error_map, - **kwargs, - ) - if key_value_deleted: - return ConfigurationSetting._from_generated(key_value_deleted) - return None - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc + key_value_deleted = self._impl.delete_key_value( + key=key, + label=label, + if_match=prep_if_match(etag, match_condition), + error_map=error_map, + **kwargs, + ) + if key_value_deleted: + return ConfigurationSetting._from_generated(key_value_deleted) + return None @distributed_trace def list_revisions( @@ -469,22 +475,29 @@ def list_revisions( key_filter: Optional[str] = None, label_filter: Optional[str] = None, *, + tags_filter: Optional[List[str]] = None, accept_datetime: Optional[Union[datetime, str]] = None, - fields: Optional[List[str]] = None, + fields: Optional[List[Union[str, ConfigurationSettingFields]]] = None, **kwargs, ) -> ItemPaged[ConfigurationSetting]: """ - Find the ConfigurationSetting revision history, optionally filtered by key, label and accept_datetime. + Find the ConfigurationSetting revision history, optionally filtered by key, label, tags and accept_datetime. + For more information about supported filters, see + https://learn.microsoft.com/azure/azure-app-configuration/rest-api-revisions?pivots=v23-11#supported-filters. - :param key_filter: filter results based on their keys. '*' can be - used as wildcard in the beginning or end of the filter + :param key_filter: Filter results based on their keys. '*' can be used as wildcard in the beginning or end + of the filter. :type key_filter: str or None - :param label_filter: filter results based on their label. '*' can be - used as wildcard in the beginning or end of the filter + :param label_filter: Filter results based on their label. '*' can be used as wildcard in the beginning or end + of the filter. :type label_filter: str or None - :keyword accept_datetime: retrieve ConfigurationSetting existed at this datetime + :keyword tags_filter: Filter results based on their tags. + :paramtype tags_filter: list[str] or None + :keyword accept_datetime: Retrieve ConfigurationSetting that existed at this datetime :paramtype accept_datetime: ~datetime.datetime or str or None - :keyword list[str] fields: specify which fields to include in the results. Leave None to include all fields + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.ConfigurationSettingFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.ConfigurationSettingFields] or None :return: An iterator of :class:`~azure.appconfiguration.ConfigurationSetting` :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.ConfigurationSetting] :raises: :class:`~azure.core.exceptions.HttpResponseError`, \ @@ -513,17 +526,15 @@ def list_revisions( if fields: fields = ["locked" if x == "read_only" else x for x in fields] - try: - return self._impl.get_revisions( # type: ignore - label=label_filter, - key=key_filter, - accept_datetime=accept_datetime, - select=fields, - cls=lambda objs: [ConfigurationSetting._from_generated(x) for x in objs], - **kwargs, - ) - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc + return self._impl.get_revisions( # type: ignore[return-value] + label=label_filter, + key=key_filter, + accept_datetime=accept_datetime, + select=fields, + tags=tags_filter, + cls=lambda objs: [ConfigurationSetting._from_generated(x) for x in objs], + **kwargs, + ) @distributed_trace def set_read_only( @@ -536,9 +547,9 @@ def set_read_only( ) -> ConfigurationSetting: """Set a configuration setting read only - :param configuration_setting: the ConfigurationSetting to be set read only + :param configuration_setting: The ConfigurationSetting to be set read only :type configuration_setting: ~azure.appconfiguration.ConfigurationSetting - :param read_only: set the read only setting if true, else clear the read only setting + :param read_only: Set the read only setting if true, else clear the read only setting :type read_only: bool :keyword match_condition: The match condition to use upon the etag :paramtype match_condition: ~azure.core.MatchConditions @@ -569,28 +580,65 @@ def set_read_only( if match_condition == MatchConditions.IfMissing: error_map.update({412: ResourceExistsError}) - try: - if read_only: - key_value = self._impl.put_lock( - key=configuration_setting.key, - label=configuration_setting.label, - if_match=prep_if_match(configuration_setting.etag, match_condition), - if_none_match=prep_if_none_match(configuration_setting.etag, match_condition), - error_map=error_map, - **kwargs, - ) - else: - key_value = self._impl.delete_lock( - key=configuration_setting.key, - label=configuration_setting.label, - if_match=prep_if_match(configuration_setting.etag, match_condition), - if_none_match=prep_if_none_match(configuration_setting.etag, match_condition), - error_map=error_map, - **kwargs, - ) - return ConfigurationSetting._from_generated(key_value) - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc + if read_only: + key_value = self._impl.put_lock( + key=configuration_setting.key, + label=configuration_setting.label, + if_match=prep_if_match(configuration_setting.etag, match_condition), + if_none_match=prep_if_none_match(configuration_setting.etag, match_condition), + error_map=error_map, + **kwargs, + ) + else: + key_value = self._impl.delete_lock( + key=configuration_setting.key, + label=configuration_setting.label, + if_match=prep_if_match(configuration_setting.etag, match_condition), + if_none_match=prep_if_none_match(configuration_setting.etag, match_condition), + error_map=error_map, + **kwargs, + ) + return ConfigurationSetting._from_generated(key_value) + + @distributed_trace + def list_labels( + self, + *, + name: Optional[str] = None, + after: Optional[str] = None, + accept_datetime: Optional[Union[datetime, str]] = None, + fields: Optional[List[Union[str, LabelFields]]] = None, + **kwargs, + ) -> ItemPaged[ConfigurationSettingLabel]: + """Gets a list of labels. + + :keyword name: A filter for the name of the returned labels. '*' can be used as wildcard + in the beginning or end of the filter. For more information about supported filters, see + https://learn.microsoft.com/azure/azure-app-configuration/rest-api-labels?pivots=v23-11#supported-filters. + :paramtype name: str or None + :keyword after: Instructs the server to return elements that appear after the element referred to + by the specified token. + :paramtype after: str or None + :keyword accept_datetime: Requests the server to respond with the state of the resource at the + specified time. + :paramtype accept_datetime: ~datetime.datetime or str or None + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.LabelFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.LabelFields] or None + :return: An iterator of labels. + :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.ConfigurationSettingLabel] + :raises: :class:`~azure.core.exceptions.HttpResponseError` + """ + if isinstance(accept_datetime, datetime): + accept_datetime = str(accept_datetime) + return self._impl.get_labels( # type: ignore[return-value] + name=name, + after=after, + accept_datetime=accept_datetime, + select=fields, + cls=lambda objs: [ConfigurationSettingLabel(name=x.name) for x in objs], + **kwargs, + ) @distributed_trace def begin_create_snapshot( @@ -598,7 +646,7 @@ def begin_create_snapshot( name: str, filters: List[ConfigurationSettingsFilter], *, - composition_type: Optional[Literal["key", "key_label"]] = None, + composition_type: Optional[Union[str, SnapshotComposition]] = None, retention_period: Optional[int] = None, tags: Optional[Dict[str, str]] = None, **kwargs, @@ -614,14 +662,14 @@ def begin_create_snapshot( snapshot are composed. Known values are: "key" and "key_label". The "key" composition type ensures there are no two key-values containing the same key. The 'key_label' composition type ensures there are no two key-values containing the same key and label. - :type composition_type: str or None + :paramtype composition_type: str or ~azure.appconfiguration.SnapshotComposition or None :keyword retention_period: The amount of time, in seconds, that a configuration snapshot will remain in the archived state before expiring. This property is only writable during the creation of a configuration snapshot. If not specified, will set to 2592000(30 days). If specified, should be in range 3600(1 hour) to 7776000(90 days). - :type retention_period: int or None + :paramtype retention_period: int or None :keyword tags: The tags of the configuration snapshot. - :type tags: dict[str, str] or None + :paramtype tags: dict[str, str] or None :return: A poller for create configuration snapshot operation. Call `result()` on this object to wait for the operation to complete and get the created snapshot. :rtype: ~azure.core.polling.LROPoller[~azure.appconfiguration.ConfigurationSnapshot] @@ -630,15 +678,12 @@ def begin_create_snapshot( snapshot = ConfigurationSnapshot( filters=filters, composition_type=composition_type, retention_period=retention_period, tags=tags ) - try: - return cast( - LROPoller[ConfigurationSnapshot], - self._impl.begin_create_snapshot( - name=name, entity=snapshot._to_generated(), cls=ConfigurationSnapshot._from_deserialized, **kwargs - ), - ) - except binascii.Error: - raise binascii.Error("Connection string secret has incorrect padding") # pylint: disable=raise-missing-from + return cast( + LROPoller[ConfigurationSnapshot], + self._impl.begin_create_snapshot( + name=name, entity=snapshot._to_generated(), cls=ConfigurationSnapshot._from_deserialized, **kwargs + ), + ) @distributed_trace def archive_snapshot( @@ -655,9 +700,9 @@ def archive_snapshot( :param name: The name of the configuration setting snapshot to archive. :type name: str :keyword match_condition: The match condition to use upon the etag. - :type match_condition: ~azure.core.MatchConditions + :paramtype match_condition: ~azure.core.MatchConditions :keyword etag: Check if the ConfigurationSnapshot is changed. Set None to skip checking etag. - :type etag: str or None + :paramtype etag: str or None :return: The ConfigurationSnapshot returned from the service. :rtype: ~azure.appconfiguration.ConfigurationSnapshot :raises: :class:`~azure.core.exceptions.HttpResponseError` @@ -671,18 +716,15 @@ def archive_snapshot( error_map.update({412: ResourceNotFoundError}) if match_condition == MatchConditions.IfMissing: error_map.update({412: ResourceExistsError}) - try: - generated_snapshot = self._impl.update_snapshot( - name=name, - entity=SnapshotUpdateParameters(status=SnapshotStatus.ARCHIVED), - if_match=prep_if_match(etag, match_condition), - if_none_match=prep_if_none_match(etag, match_condition), - error_map=error_map, - **kwargs, - ) - return ConfigurationSnapshot._from_generated(generated_snapshot) - except binascii.Error: - raise binascii.Error("Connection string secret has incorrect padding") # pylint: disable=raise-missing-from + generated_snapshot = self._impl.update_snapshot( + name=name, + entity=SnapshotUpdateParameters(status=SnapshotStatus.ARCHIVED), + if_match=prep_if_match(etag, match_condition), + if_none_match=prep_if_none_match(etag, match_condition), + error_map=error_map, + **kwargs, + ) + return ConfigurationSnapshot._from_generated(generated_snapshot) @distributed_trace def recover_snapshot( @@ -698,9 +740,9 @@ def recover_snapshot( :param name: The name of the configuration setting snapshot to recover. :type name: str :keyword match_condition: The match condition to use upon the etag. - :type match_condition: ~azure.core.MatchConditions + :paramtype match_condition: ~azure.core.MatchConditions :keyword etag: Check if the ConfigurationSnapshot is changed. Set None to skip checking etag. - :type etag: str or None + :paramtype etag: str or None :return: The ConfigurationSnapshot returned from the service. :rtype: ~azure.appconfiguration.ConfigurationSnapshot :raises: :class:`~azure.core.exceptions.HttpResponseError` @@ -714,45 +756,42 @@ def recover_snapshot( error_map.update({412: ResourceNotFoundError}) if match_condition == MatchConditions.IfMissing: error_map.update({412: ResourceExistsError}) - try: - generated_snapshot = self._impl.update_snapshot( - name=name, - entity=SnapshotUpdateParameters(status=SnapshotStatus.READY), - if_match=prep_if_match(etag, match_condition), - if_none_match=prep_if_none_match(etag, match_condition), - error_map=error_map, - **kwargs, - ) - return ConfigurationSnapshot._from_generated(generated_snapshot) - except binascii.Error: - raise binascii.Error("Connection string secret has incorrect padding") # pylint: disable=raise-missing-from + generated_snapshot = self._impl.update_snapshot( + name=name, + entity=SnapshotUpdateParameters(status=SnapshotStatus.READY), + if_match=prep_if_match(etag, match_condition), + if_none_match=prep_if_none_match(etag, match_condition), + error_map=error_map, + **kwargs, + ) + return ConfigurationSnapshot._from_generated(generated_snapshot) @distributed_trace - def get_snapshot(self, name: str, *, fields: Optional[List[str]] = None, **kwargs) -> ConfigurationSnapshot: + def get_snapshot( + self, name: str, *, fields: Optional[List[Union[str, SnapshotFields]]] = None, **kwargs + ) -> ConfigurationSnapshot: """Get a configuration setting snapshot. :param name: The name of the configuration setting snapshot to retrieve. :type name: str - :keyword fields: Specify which fields to include in the results. Leave None to include all fields. - :type fields: list[str] or None + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.SnapshotFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.SnapshotFields] or None :return: The ConfigurationSnapshot returned from the service. :rtype: ~azure.appconfiguration.ConfigurationSnapshot :raises: :class:`~azure.core.exceptions.HttpResponseError` """ - try: - generated_snapshot = self._impl.get_snapshot( - name=name, if_match=None, if_none_match=None, select=fields, **kwargs - ) - return ConfigurationSnapshot._from_generated(generated_snapshot) - except binascii.Error: - raise binascii.Error("Connection string secret has incorrect padding") # pylint: disable=raise-missing-from + generated_snapshot = self._impl.get_snapshot( + name=name, if_match=None, if_none_match=None, select=fields, **kwargs + ) + return ConfigurationSnapshot._from_generated(generated_snapshot) @distributed_trace def list_snapshots( self, *, name: Optional[str] = None, - fields: Optional[List[str]] = None, + fields: Optional[List[Union[str, SnapshotFields]]] = None, status: Optional[List[Union[str, SnapshotStatus]]] = None, **kwargs, ) -> ItemPaged[ConfigurationSnapshot]: @@ -760,25 +799,24 @@ def list_snapshots( snapshot name, snapshot status and fields to present in return. :keyword name: Filter results based on snapshot name. - :type name: str or None - :keyword fields: Specify which fields to include in the results. Leave None to include all fields. - :type fields: list[str] or None - :keyword status: Filter results based on snapshot keys. - :type status: list[str] or list[~azure.appconfiguration.SnapshotStatus] or None + :paramtype name: str or None + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.SnapshotFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.SnapshotFields] or None + :keyword status: Filter results based on snapshot keys. Available status see + :class:`~azure.appconfiguration.SnapshotStatus`. + :paramtype status: list[str] or list[~azure.appconfiguration.SnapshotStatus] or None :return: An iterator of :class:`~azure.appconfiguration.ConfigurationSnapshot` :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.ConfigurationSnapshot] :raises: :class:`~azure.core.exceptions.HttpResponseError` """ - try: - return self._impl.get_snapshots( # type: ignore - name=name, - select=fields, - status=status, - cls=lambda objs: [ConfigurationSnapshot._from_generated(x) for x in objs], - **kwargs, - ) - except binascii.Error: - raise binascii.Error("Connection string secret has incorrect padding") # pylint: disable=raise-missing-from + return self._impl.get_snapshots( # type: ignore[return-value] + name=name, + select=fields, + status=status, + cls=lambda objs: [ConfigurationSnapshot._from_generated(x) for x in objs], + **kwargs, + ) def update_sync_token(self, token: str) -> None: """Add a sync token to the internal list of tokens. diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_azure_app_configuration.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_azure_app_configuration.py index b1c40c5c448a5..e1381a3726f7a 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_azure_app_configuration.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_azure_app_configuration.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Optional +from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -30,7 +31,7 @@ class AzureAppConfiguration(AzureAppConfigurationOperationsMixin): # pylint: di :param sync_token: Used to guarantee real-time consistency between requests. Default value is None. :type sync_token: str - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -68,7 +69,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -92,12 +93,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, **kwargs) # type: ignore + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "AzureAppConfiguration": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_configuration.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_configuration.py index 32340beafc1db..7d10ceaec1241 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_configuration.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_configuration.py @@ -27,7 +27,7 @@ class AzureAppConfigurationConfiguration: # pylint: disable=too-many-instance-a :param sync_token: Used to guarantee real-time consistency between requests. Default value is None. :type sync_token: str - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -35,7 +35,7 @@ class AzureAppConfigurationConfiguration: # pylint: disable=too-many-instance-a def __init__( self, credential: AzureKeyCredential, endpoint: str, sync_token: Optional[str] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2023-10-01") + api_version: str = kwargs.pop("api_version", "2023-11-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_patch.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_patch.py index 1613cd1fcf4f5..0ac530adf35de 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_patch.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_patch.py @@ -2,6 +2,8 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize @@ -23,7 +25,7 @@ class AzureAppConfiguration(AzureAppConfigurationGenerated): :param sync_token: Used to guarantee real-time consistency between requests. Default value is None. :type sync_token: str - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -53,7 +55,7 @@ class AzureAppConfigurationConfiguration(AzureAppConfigurationConfigurationGener :param sync_token: Used to guarantee real-time consistency between requests. Default value is None. :type sync_token: str - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_serialization.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_serialization.py index 1247eb71a98fd..8139854b97bb8 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_serialization.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_serialization.py @@ -64,7 +64,7 @@ import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -144,6 +144,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +172,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -545,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +556,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +644,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -730,7 +725,6 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) - # https://github.com/Azure/autorest.python/issues/2063 output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") @@ -746,7 +740,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -806,7 +800,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -995,7 +989,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1211,7 +1205,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1232,7 +1225,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1373,7 +1365,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1393,7 +1385,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1446,12 +1438,12 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore @@ -1517,14 +1509,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1580,7 +1572,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1702,7 +1694,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1759,7 +1751,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1863,7 +1855,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise DeserializationError(msg) from err @@ -1999,6 +1991,7 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_vendor.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_vendor.py index 23ebf69c5c1d5..a7cb430b9c7de 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_vendor.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import AzureAppConfigurationConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from ._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class AzureAppConfigurationMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_azure_app_configuration.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_azure_app_configuration.py index 1e16d7f8e4465..39ae86b6cec9b 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_azure_app_configuration.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_azure_app_configuration.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, Optional +from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -30,7 +31,7 @@ class AzureAppConfiguration(AzureAppConfigurationOperationsMixin): # pylint: di :param sync_token: Used to guarantee real-time consistency between requests. Default value is None. :type sync_token: str - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -68,7 +69,9 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -92,12 +95,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) - return self._client.send_request(request_copy, **kwargs) # type: ignore + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "AzureAppConfiguration": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_configuration.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_configuration.py index 4435b29cb6383..0de2ae01c4d93 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_configuration.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_configuration.py @@ -27,7 +27,7 @@ class AzureAppConfigurationConfiguration: # pylint: disable=too-many-instance-a :param sync_token: Used to guarantee real-time consistency between requests. Default value is None. :type sync_token: str - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -35,7 +35,7 @@ class AzureAppConfigurationConfiguration: # pylint: disable=too-many-instance-a def __init__( self, credential: AzureKeyCredential, endpoint: str, sync_token: Optional[str] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2023-10-01") + api_version: str = kwargs.pop("api_version", "2023-11-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_patch.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_patch.py index 46720940469c9..fc560bc2d2ef7 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_patch.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_patch.py @@ -2,6 +2,8 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize @@ -24,7 +26,7 @@ class AzureAppConfiguration(AzureAppConfigurationGenerated): :param sync_token: Used to guarantee real-time consistency between requests. Default value is None. :type sync_token: str - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -54,7 +56,7 @@ class AzureAppConfigurationConfiguration(AzureAppConfigurationConfigurationGener :param sync_token: Used to guarantee real-time consistency between requests. Default value is None. :type sync_token: str - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_vendor.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_vendor.py index 71cee5404f2b3..203a80e19af4a 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_vendor.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import AzureAppConfigurationConfiguration if TYPE_CHECKING: diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/operations/_azure_app_configuration_operations.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/operations/_azure_app_configuration_operations.py index 47c75e0ef958d..1f1afcee50363 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/operations/_azure_app_configuration_operations.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/operations/_azure_app_configuration_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +import sys +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,19 +32,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.polling.async_base_polling import AsyncLROBasePolling -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from ... import models as _models -from ..._vendor import _convert_request from ...operations._azure_app_configuration_operations import ( build_check_key_value_request, build_check_key_values_request, @@ -55,11 +70,16 @@ ) from .._vendor import AzureAppConfigurationMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AzureAppConfigurationOperationsMixin(AzureAppConfigurationMixinABC): # pylint: disable=too-many-public-methods + @distributed_trace def get_keys( self, @@ -80,7 +100,6 @@ def get_keys( :param accept_datetime: Requests the server to respond with the state of the resource at the specified time. Default value is None. :type accept_datetime: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Key or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.appconfiguration.models.Key] :raises ~azure.core.exceptions.HttpResponseError: @@ -91,7 +110,7 @@ def get_keys( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +130,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -132,7 +150,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -187,12 +204,11 @@ async def check_keys( # pylint: disable=inconsistent-return-statements :param accept_datetime: Requests the server to respond with the state of the resource at the specified time. Default value is None. :type accept_datetime: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,7 +231,6 @@ async def check_keys( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -245,19 +260,22 @@ def get_key_values( label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, snapshot: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, + tags: Optional[List[str]] = None, **kwargs: Any ) -> AsyncIterable["_models.KeyValue"]: """Gets a list of key-values. Gets a list of key-values. - :param key: A filter used to match keys. Default value is None. + :param key: A filter used to match keys. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. :type key: str - :param label: A filter used to match labels. Default value is None. + :param label: A filter used to match labels. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. :type label: str :param after: Instructs the server to return elements that appear after the element referred to by the specified token. Default value is None. @@ -267,7 +285,7 @@ def get_key_values( :type accept_datetime: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] :param snapshot: A filter used get key-values for a snapshot. The value should be the name of the snapshot. Not valid when used with 'key' and 'label' filters. Default value is None. :type snapshot: str @@ -277,7 +295,9 @@ def get_key_values( :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param tags: A filter used to query by tags. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. + :type tags: list[str] :return: An iterator like instance of either KeyValue or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.appconfiguration.models.KeyValue] :raises ~azure.core.exceptions.HttpResponseError: @@ -288,7 +308,7 @@ def get_key_values( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.KeyValueListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -308,12 +328,12 @@ def prepare_request(next_link=None): snapshot=snapshot, if_match=if_match, if_none_match=if_none_match, + tags=tags, sync_token=self._config.sync_token, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -334,7 +354,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -376,19 +395,22 @@ async def check_key_values( # pylint: disable=inconsistent-return-statements label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, snapshot: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, + tags: Optional[List[str]] = None, **kwargs: Any ) -> None: """Requests the headers and status of the given resource. Requests the headers and status of the given resource. - :param key: A filter used to match keys. Default value is None. + :param key: A filter used to match keys. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. :type key: str - :param label: A filter used to match labels. Default value is None. + :param label: A filter used to match labels. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. :type label: str :param after: Instructs the server to return elements that appear after the element referred to by the specified token. Default value is None. @@ -398,7 +420,7 @@ async def check_key_values( # pylint: disable=inconsistent-return-statements :type accept_datetime: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] :param snapshot: A filter used get key-values for a snapshot. Not valid when used with 'key' and 'label' filters. Default value is None. :type snapshot: str @@ -408,12 +430,14 @@ async def check_key_values( # pylint: disable=inconsistent-return-statements :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param tags: A filter used to query by tags. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. + :type tags: list[str] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -436,12 +460,12 @@ async def check_key_values( # pylint: disable=inconsistent-return-statements snapshot=snapshot, if_match=if_match, if_none_match=if_none_match, + tags=tags, sync_token=self._config.sync_token, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -473,7 +497,7 @@ async def get_key_value( accept_datetime: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, **kwargs: Any ) -> _models.KeyValue: """Gets a single key-value. @@ -495,13 +519,12 @@ async def get_key_value( :type if_none_match: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] - :keyword callable cls: A custom type or function that will be passed the direct response + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] :return: KeyValue or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -527,7 +550,6 @@ async def get_key_value( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -549,7 +571,7 @@ async def get_key_value( response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("KeyValue", pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -587,7 +609,6 @@ async def put_key_value( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: KeyValue or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue :raises ~azure.core.exceptions.HttpResponseError: @@ -600,7 +621,7 @@ async def put_key_value( label: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, - entity: Optional[IO] = None, + entity: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -620,14 +641,13 @@ async def put_key_value( not match the value provided. Default value is None. :type if_none_match: str :param entity: The key-value to create. Default value is None. - :type entity: IO + :type entity: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Known values are: 'application/*+json', 'application/json', 'application/json-patch+json', 'application/vnd.microsoft.appconfig.kv+json', 'application/vnd.microsoft.appconfig.kvset+json', 'text/json'. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: KeyValue or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue :raises ~azure.core.exceptions.HttpResponseError: @@ -640,7 +660,7 @@ async def put_key_value( label: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, - entity: Optional[Union[_models.KeyValue, IO]] = None, + entity: Optional[Union[_models.KeyValue, IO[bytes]]] = None, **kwargs: Any ) -> _models.KeyValue: """Creates a key-value. @@ -657,20 +677,14 @@ async def put_key_value( :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :param entity: The key-value to create. Is either a KeyValue type or a IO type. Default value - is None. - :type entity: ~azure.appconfiguration.models.KeyValue or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/*+json', - 'application/json', 'application/json-patch+json', - 'application/vnd.microsoft.appconfig.kv+json', - 'application/vnd.microsoft.appconfig.kvset+json', 'text/json'. Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param entity: The key-value to create. Is either a KeyValue type or a IO[bytes] type. Default + value is None. + :type entity: ~azure.appconfiguration.models.KeyValue or IO[bytes] :return: KeyValue or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -709,7 +723,6 @@ async def put_key_value( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -731,7 +744,7 @@ async def put_key_value( response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("KeyValue", pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -753,12 +766,11 @@ async def delete_key_value( :param if_match: Used to perform an operation only if the targeted resource's etag matches the value provided. Default value is None. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: KeyValue or None or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -781,7 +793,6 @@ async def delete_key_value( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -805,7 +816,7 @@ async def delete_key_value( response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("KeyValue", pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response.http_response) if response.status_code == 204: response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) @@ -823,7 +834,7 @@ async def check_key_value( # pylint: disable=inconsistent-return-statements accept_datetime: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, **kwargs: Any ) -> None: """Requests the headers and status of the given resource. @@ -845,13 +856,12 @@ async def check_key_value( # pylint: disable=inconsistent-return-statements :type if_none_match: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] - :keyword callable cls: A custom type or function that will be passed the direct response + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -877,7 +887,6 @@ async def check_key_value( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -925,7 +934,6 @@ def get_snapshots( :param status: Used to filter returned snapshots by their status property. Default value is None. :type status: list[str or ~azure.appconfiguration.models.SnapshotStatus] - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.appconfiguration.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: @@ -936,7 +944,7 @@ def get_snapshots( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SnapshotListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -957,7 +965,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -978,7 +985,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -1024,12 +1030,11 @@ async def check_snapshots( # pylint: disable=inconsistent-return-statements :param after: Instructs the server to return elements that appear after the element referred to by the specified token. Default value is None. :type after: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1050,7 +1055,6 @@ async def check_snapshots( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1097,12 +1101,11 @@ async def get_snapshot( :param select: Used to select what fields are present in the returned resource(s). Default value is None. :type select: list[str or ~azure.appconfiguration.models.SnapshotFields] - :keyword callable cls: A custom type or function that will be passed the direct response :return: Snapshot or the result of cls(response) :rtype: ~azure.appconfiguration.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1126,7 +1129,6 @@ async def get_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1149,7 +1151,7 @@ async def get_snapshot( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) response_headers["Link"] = self._deserialize("str", response.headers.get("Link")) - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1157,9 +1159,9 @@ async def get_snapshot( return deserialized # type: ignore async def _create_snapshot_initial( - self, name: str, entity: Union[_models.Snapshot, IO], **kwargs: Any - ) -> _models.Snapshot: - error_map = { + self, name: str, entity: Union[_models.Snapshot, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1172,7 +1174,7 @@ async def _create_snapshot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1192,13 +1194,13 @@ async def _create_snapshot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1206,6 +1208,10 @@ async def _create_snapshot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1216,7 +1222,7 @@ async def _create_snapshot_initial( response_headers["Link"] = self._deserialize("str", response.headers.get("Link")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1238,14 +1244,6 @@ async def begin_create_snapshot( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.appconfiguration.models.Snapshot] @@ -1254,7 +1252,7 @@ async def begin_create_snapshot( @overload async def begin_create_snapshot( - self, name: str, entity: IO, *, content_type: str = "application/json", **kwargs: Any + self, name: str, entity: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Snapshot]: """Creates a key-value snapshot. @@ -1263,19 +1261,11 @@ async def begin_create_snapshot( :param name: The name of the key-value snapshot to create. Required. :type name: str :param entity: The key-value snapshot to create. Required. - :type entity: IO + :type entity: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Known values are: 'application/json', 'application/vnd.microsoft.appconfig.snapshot+json'. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.appconfiguration.models.Snapshot] @@ -1284,7 +1274,7 @@ async def begin_create_snapshot( @distributed_trace_async async def begin_create_snapshot( - self, name: str, entity: Union[_models.Snapshot, IO], **kwargs: Any + self, name: str, entity: Union[_models.Snapshot, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Snapshot]: """Creates a key-value snapshot. @@ -1292,20 +1282,9 @@ async def begin_create_snapshot( :param name: The name of the key-value snapshot to create. Required. :type name: str - :param entity: The key-value snapshot to create. Is either a Snapshot type or a IO type. + :param entity: The key-value snapshot to create. Is either a Snapshot type or a IO[bytes] type. Required. - :type entity: ~azure.appconfiguration.models.Snapshot or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json', - 'application/vnd.microsoft.appconfig.snapshot+json'. Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False - for this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :type entity: ~azure.appconfiguration.models.Snapshot or IO[bytes] :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.appconfiguration.models.Snapshot] @@ -1331,6 +1310,7 @@ async def begin_create_snapshot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -1343,7 +1323,7 @@ def get_long_running_output(pipeline_response): "str", response.headers.get("Operation-Location") ) - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -1400,7 +1380,6 @@ async def update_snapshot( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Snapshot or the result of cls(response) :rtype: ~azure.appconfiguration.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: @@ -1410,7 +1389,7 @@ async def update_snapshot( async def update_snapshot( self, name: str, - entity: IO, + entity: IO[bytes], if_match: Optional[str] = None, if_none_match: Optional[str] = None, *, @@ -1424,7 +1403,7 @@ async def update_snapshot( :param name: The name of the key-value snapshot to update. Required. :type name: str :param entity: The parameters used to update the snapshot. Required. - :type entity: IO + :type entity: IO[bytes] :param if_match: Used to perform an operation only if the targeted resource's etag matches the value provided. Default value is None. :type if_match: str @@ -1435,7 +1414,6 @@ async def update_snapshot( Known values are: 'application/json', 'application/merge-patch+json'. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Snapshot or the result of cls(response) :rtype: ~azure.appconfiguration.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: @@ -1445,7 +1423,7 @@ async def update_snapshot( async def update_snapshot( self, name: str, - entity: Union[_models.SnapshotUpdateParameters, IO], + entity: Union[_models.SnapshotUpdateParameters, IO[bytes]], if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any @@ -1457,23 +1435,19 @@ async def update_snapshot( :param name: The name of the key-value snapshot to update. Required. :type name: str :param entity: The parameters used to update the snapshot. Is either a SnapshotUpdateParameters - type or a IO type. Required. - :type entity: ~azure.appconfiguration.models.SnapshotUpdateParameters or IO + type or a IO[bytes] type. Required. + :type entity: ~azure.appconfiguration.models.SnapshotUpdateParameters or IO[bytes] :param if_match: Used to perform an operation only if the targeted resource's etag matches the value provided. Default value is None. :type if_match: str :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json', - 'application/merge-patch+json'. Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Snapshot or the result of cls(response) :rtype: ~azure.appconfiguration.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1508,7 +1482,6 @@ async def update_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1531,7 +1504,7 @@ async def update_snapshot( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) response_headers["Link"] = self._deserialize("str", response.headers.get("Link")) - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1554,12 +1527,11 @@ async def check_snapshot( # pylint: disable=inconsistent-return-statements :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1582,7 +1554,6 @@ async def check_snapshot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1631,7 +1602,6 @@ def get_labels( :param select: Used to select what fields are present in the returned resource(s). Default value is None. :type select: list[str or ~azure.appconfiguration.models.LabelFields] - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Label or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.appconfiguration.models.Label] :raises ~azure.core.exceptions.HttpResponseError: @@ -1642,7 +1612,7 @@ def get_labels( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LabelListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1663,7 +1633,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -1684,7 +1653,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -1743,12 +1711,11 @@ async def check_labels( # pylint: disable=inconsistent-return-statements :param select: Used to select what fields are present in the returned resource(s). Default value is None. :type select: list[str or ~azure.appconfiguration.models.LabelFields] - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1772,7 +1739,6 @@ async def check_labels( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1818,12 +1784,11 @@ async def put_lock( :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: KeyValue or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1847,7 +1812,6 @@ async def put_lock( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1869,7 +1833,7 @@ async def put_lock( response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("KeyValue", pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1899,12 +1863,11 @@ async def delete_lock( :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: KeyValue or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1928,7 +1891,6 @@ async def delete_lock( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1950,7 +1912,7 @@ async def delete_lock( response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("KeyValue", pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1964,16 +1926,19 @@ def get_revisions( label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, **kwargs: Any ) -> AsyncIterable["_models.KeyValue"]: """Gets a list of key-value revisions. Gets a list of key-value revisions. - :param key: A filter used to match keys. Default value is None. + :param key: A filter used to match keys. Syntax reference: + https://aka.ms/azconfig/docs/restapirevisions. Default value is None. :type key: str - :param label: A filter used to match labels. Default value is None. + :param label: A filter used to match labels. Syntax reference: + https://aka.ms/azconfig/docs/restapirevisions. Default value is None. :type label: str :param after: Instructs the server to return elements that appear after the element referred to by the specified token. Default value is None. @@ -1983,8 +1948,10 @@ def get_revisions( :type accept_datetime: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] - :keyword callable cls: A custom type or function that will be passed the direct response + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] + :param tags: A filter used to query by tags. Syntax reference: + https://aka.ms/azconfig/docs/restapirevisions. Default value is None. + :type tags: list[str] :return: An iterator like instance of either KeyValue or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.appconfiguration.models.KeyValue] :raises ~azure.core.exceptions.HttpResponseError: @@ -1995,7 +1962,7 @@ def get_revisions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.KeyValueListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2012,12 +1979,12 @@ def prepare_request(next_link=None): after=after, accept_datetime=accept_datetime, select=select, + tags=tags, sync_token=self._config.sync_token, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -2038,7 +2005,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -2080,16 +2046,19 @@ async def check_revisions( # pylint: disable=inconsistent-return-statements label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, **kwargs: Any ) -> None: """Requests the headers and status of the given resource. Requests the headers and status of the given resource. - :param key: A filter used to match keys. Default value is None. + :param key: A filter used to match keys. Syntax reference: + https://aka.ms/azconfig/docs/restapirevisions. Default value is None. :type key: str - :param label: A filter used to match labels. Default value is None. + :param label: A filter used to match labels. Syntax reference: + https://aka.ms/azconfig/docs/restapirevisions. Default value is None. :type label: str :param after: Instructs the server to return elements that appear after the element referred to by the specified token. Default value is None. @@ -2099,13 +2068,15 @@ async def check_revisions( # pylint: disable=inconsistent-return-statements :type accept_datetime: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] - :keyword callable cls: A custom type or function that will be passed the direct response + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] + :param tags: A filter used to query by tags. Syntax reference: + https://aka.ms/azconfig/docs/restapirevisions. Default value is None. + :type tags: list[str] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2125,12 +2096,12 @@ async def check_revisions( # pylint: disable=inconsistent-return-statements after=after, accept_datetime=accept_datetime, select=select, + tags=tags, sync_token=self._config.sync_token, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -2162,12 +2133,11 @@ async def get_operation_details(self, snapshot: str, **kwargs: Any) -> _models.O :param snapshot: Snapshot identifier for the long running operation. Required. :type snapshot: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationDetails or the result of cls(response) :rtype: ~azure.appconfiguration.models.OperationDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2187,7 +2157,6 @@ async def get_operation_details(self, snapshot: str, **kwargs: Any) -> _models.O headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -2205,7 +2174,7 @@ async def get_operation_details(self, snapshot: str, **kwargs: Any) -> _models.O error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("OperationDetails", pipeline_response) + deserialized = self._deserialize("OperationDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/operations/_patch.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/operations/_patch.py index 0c6a251513084..54701280e208c 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/operations/_patch.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/operations/_patch.py @@ -2,6 +2,8 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize @@ -25,7 +27,6 @@ build_get_key_values_request, ) from ... import models as _models -from ..._vendor import _convert_request class AzureAppConfigurationOperationsMixin(AzureAppConfigOpGenerated): @@ -36,9 +37,10 @@ async def get_key_values_in_one_page( label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, + tags: Optional[List[str]] = None, continuation_token: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.KeyValue"]: @@ -58,13 +60,15 @@ async def get_key_values_in_one_page( :type accept_datetime: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] :param if_match: Used to perform an operation only if the targeted resource's etag matches the value provided. Default value is None. :type if_match: str :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str + :param tags: A filter used to query by tags. Default value is None. + :type tags: list[str] :param str continuation_token: An opaque continuation token. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either KeyValue or the result of cls(response) @@ -96,21 +100,21 @@ def prepare_request(next_link=None): select=select, if_match=if_match, if_none_match=if_none_match, + tags=tags, sync_token=self._config.sync_token, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } _request.url = self._client.format_url(_request.url, **path_format_arguments) - else: # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) _next_request_params = case_insensitive_dict( { @@ -122,7 +126,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -144,13 +147,11 @@ def prepare_request(next_link=None): map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - response_headers = response.headers deserialized = self._deserialize("KeyValueListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) - return deserialized diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py index 4a07057d07bcc..c5b1e0ff92fda 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py @@ -21,9 +21,9 @@ from ._models_py3 import SnapshotListResult from ._models_py3 import SnapshotUpdateParameters -from ._azure_app_configuration_enums import CompositionType -from ._azure_app_configuration_enums import KeyValueFields +from ._azure_app_configuration_enums import ConfigurationSettingFields from ._azure_app_configuration_enums import LabelFields +from ._azure_app_configuration_enums import SnapshotComposition from ._azure_app_configuration_enums import SnapshotFields from ._azure_app_configuration_enums import SnapshotStatus from ._azure_app_configuration_enums import State @@ -46,9 +46,9 @@ "Snapshot", "SnapshotListResult", "SnapshotUpdateParameters", - "CompositionType", - "KeyValueFields", + "ConfigurationSettingFields", "LabelFields", + "SnapshotComposition", "SnapshotFields", "SnapshotStatus", "State", diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_azure_app_configuration_enums.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_azure_app_configuration_enums.py index a8b03a3837e11..8a1f283b8bf5b 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_azure_app_configuration_enums.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_azure_app_configuration_enums.py @@ -10,18 +10,8 @@ from azure.core import CaseInsensitiveEnumMeta -class CompositionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The composition type describes how the key-values within the snapshot are composed. The 'key' - composition type ensures there are no two key-values containing the same key. The 'key_label' - composition type ensures there are no two key-values containing the same key and label. - """ - - KEY = "key" - KEY_LABEL = "key_label" - - -class KeyValueFields(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """KeyValueFields.""" +class ConfigurationSettingFields(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ConfigurationSettingFields.""" KEY = "key" LABEL = "label" @@ -39,6 +29,16 @@ class LabelFields(str, Enum, metaclass=CaseInsensitiveEnumMeta): NAME = "name" +class SnapshotComposition(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The composition type describes how the key-values within the snapshot are composed. The 'key' + composition type ensures there are no two key-values containing the same key. The 'key_label' + composition type ensures there are no two key-values containing the same key and label. + """ + + KEY = "key" + KEY_LABEL = "key_label" + + class SnapshotFields(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SnapshotFields.""" diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models_py3.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models_py3.py index 81a9d6b5f727b..95f255795c4b4 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models_py3.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models_py3.py @@ -73,7 +73,7 @@ def __init__( class ErrorDetail(_serialization.Model): """The details of an error. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar code: One of a server-defined set of error codes. Required. :vartype code: str @@ -281,35 +281,45 @@ def __init__( class KeyValueFilter(_serialization.Model): - """Enables filtering of key-values. + """Enables filtering of key-values. Syntax reference: + https://aka.ms/azconfig/docs/restapisnapshots. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar key: Filters key-values by their key field. Required. :vartype key: str :ivar label: Filters key-values by their label field. :vartype label: str + :ivar tags: Filters key-values by their tags field. + :vartype tags: list[str] """ _validation = { "key": {"required": True}, + "tags": {"unique": True}, } _attribute_map = { "key": {"key": "key", "type": "str"}, "label": {"key": "label", "type": "str"}, + "tags": {"key": "tags", "type": "[str]"}, } - def __init__(self, *, key: str, label: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, key: str, label: Optional[str] = None, tags: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword key: Filters key-values by their key field. Required. :paramtype key: str :keyword label: Filters key-values by their label field. :paramtype label: str + :keyword tags: Filters key-values by their tags field. + :paramtype tags: list[str] """ super().__init__(**kwargs) self.key = key self.label = label + self.tags = tags class KeyValueListResult(_serialization.Model): @@ -405,14 +415,14 @@ def __init__( class OperationDetails(_serialization.Model): """Details of a long running operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: The unique id of the operation. Required. :vartype id: str :ivar status: The current status of the operation. Required. Known values are: "NotStarted", "Running", "Succeeded", "Failed", and "Canceled". :vartype status: str or ~azure.appconfiguration.models.State - :ivar error: An error, available when the status is ``Failed``\ , describing why the operation + :ivar error: An error, available when the status is ``Failed``\\ , describing why the operation failed. :vartype error: ~azure.appconfiguration.models.ErrorDetail """ @@ -442,7 +452,7 @@ def __init__( :keyword status: The current status of the operation. Required. Known values are: "NotStarted", "Running", "Succeeded", "Failed", and "Canceled". :paramtype status: str or ~azure.appconfiguration.models.State - :keyword error: An error, available when the status is ``Failed``\ , describing why the + :keyword error: An error, available when the status is ``Failed``\\ , describing why the operation failed. :paramtype error: ~azure.appconfiguration.models.ErrorDetail """ @@ -457,7 +467,7 @@ class Snapshot(_serialization.Model): # pylint: disable=too-many-instance-attri Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The name of the snapshot. :vartype name: str @@ -471,7 +481,7 @@ class Snapshot(_serialization.Model): # pylint: disable=too-many-instance-attri are composed. The 'key' composition type ensures there are no two key-values containing the same key. The 'key_label' composition type ensures there are no two key-values containing the same key and label. Known values are: "key" and "key_label". - :vartype composition_type: str or ~azure.appconfiguration.models.CompositionType + :vartype composition_type: str or ~azure.appconfiguration.models.SnapshotComposition :ivar created: The time that the snapshot was created. :vartype created: ~datetime.datetime :ivar expires: The time that the snapshot will expire. @@ -520,7 +530,7 @@ def __init__( self, *, filters: List["_models.KeyValueFilter"], - composition_type: Optional[Union[str, "_models.CompositionType"]] = None, + composition_type: Optional[Union[str, "_models.SnapshotComposition"]] = None, retention_period: Optional[int] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any @@ -533,7 +543,7 @@ def __init__( snapshot are composed. The 'key' composition type ensures there are no two key-values containing the same key. The 'key_label' composition type ensures there are no two key-values containing the same key and label. Known values are: "key" and "key_label". - :paramtype composition_type: str or ~azure.appconfiguration.models.CompositionType + :paramtype composition_type: str or ~azure.appconfiguration.models.SnapshotComposition :keyword retention_period: The amount of time, in seconds, that a snapshot will remain in the archived state before expiring. This property is only writable during the creation of a snapshot. If not specified, the default lifetime of key-value revisions will be used. diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_patch.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_patch.py index f7dd32510333d..5755fd181b3f1 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_patch.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_patch.py @@ -2,6 +2,8 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/operations/_azure_app_configuration_operations.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/operations/_azure_app_configuration_operations.py index d6363cb712ed6..9bb8f16964580 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/operations/_azure_app_configuration_operations.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/operations/_azure_app_configuration_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,21 +17,26 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.polling.base_polling import LROBasePolling -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureAppConfigurationMixinABC, _convert_request +from .._vendor import AzureAppConfigurationMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +55,7 @@ def build_get_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.keyset+json, application/problem+json") # Construct URL @@ -83,7 +89,7 @@ def build_check_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) # Construct URL _url = kwargs.pop("template_url", "/keys") @@ -109,17 +115,18 @@ def build_get_key_values_request( label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, snapshot: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, + tags: Optional[List[str]] = None, sync_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.kvset+json, application/problem+json") # Construct URL @@ -137,6 +144,8 @@ def build_get_key_values_request( _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") if snapshot is not None: _params["snapshot"] = _SERIALIZER.query("snapshot", snapshot, "str") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] # Construct headers if sync_token is not None: @@ -158,17 +167,18 @@ def build_check_key_values_request( label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, snapshot: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, + tags: Optional[List[str]] = None, sync_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) # Construct URL _url = kwargs.pop("template_url", "/kv") @@ -184,6 +194,8 @@ def build_check_key_values_request( _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") if snapshot is not None: _params["snapshot"] = _SERIALIZER.query("snapshot", snapshot, "str") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] # Construct headers if sync_token is not None: @@ -205,14 +217,14 @@ def build_get_key_value_request( accept_datetime: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, sync_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.kv+json, application/problem+json") # Construct URL @@ -256,7 +268,7 @@ def build_put_key_value_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.kv+json, application/problem+json") @@ -298,7 +310,7 @@ def build_delete_key_value_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.kv+json, application/problem+json") # Construct URL @@ -331,14 +343,14 @@ def build_check_key_value_request( accept_datetime: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, sync_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) # Construct URL _url = kwargs.pop("template_url", "/kv/{key}") path_format_arguments = { @@ -379,7 +391,7 @@ def build_get_snapshots_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.snapshotset+json, application/problem+json") # Construct URL @@ -410,7 +422,7 @@ def build_check_snapshots_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) # Construct URL _url = kwargs.pop("template_url", "/snapshots") @@ -438,7 +450,7 @@ def build_get_snapshot_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.snapshot+json, application/problem+json") # Construct URL @@ -470,7 +482,7 @@ def build_create_snapshot_request(name: str, *, sync_token: Optional[str] = None _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.snapshot+json, application/problem+json") @@ -506,7 +518,7 @@ def build_update_snapshot_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.snapshot+json, application/problem+json") @@ -546,7 +558,7 @@ def build_check_snapshot_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) # Construct URL _url = kwargs.pop("template_url", "/snapshots/{name}") path_format_arguments = { @@ -581,7 +593,7 @@ def build_get_labels_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.labelset+json, application/problem+json") # Construct URL @@ -618,7 +630,7 @@ def build_check_labels_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) # Construct URL _url = kwargs.pop("template_url", "/labels") @@ -652,7 +664,7 @@ def build_put_lock_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.kv+json, application/problem+json") # Construct URL @@ -692,7 +704,7 @@ def build_delete_lock_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.kv+json, application/problem+json") # Construct URL @@ -726,14 +738,15 @@ def build_get_revisions_request( label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, sync_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/vnd.microsoft.appconfig.kvset+json, application/problem+json") # Construct URL @@ -749,6 +762,8 @@ def build_get_revisions_request( _params["After"] = _SERIALIZER.query("after", after, "str") if select is not None: _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] # Construct headers if sync_token is not None: @@ -766,14 +781,15 @@ def build_check_revisions_request( label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, sync_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) # Construct URL _url = kwargs.pop("template_url", "/revisions") @@ -787,6 +803,8 @@ def build_check_revisions_request( _params["After"] = _SERIALIZER.query("after", after, "str") if select is not None: _params["$Select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if tags is not None: + _params["tags"] = [_SERIALIZER.query("tags", q, "str") if q is not None else "" for q in tags] # Construct headers if sync_token is not None: @@ -801,7 +819,7 @@ def build_get_operation_details_request(*, snapshot: str, **kwargs: Any) -> Http _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -818,6 +836,7 @@ def build_get_operation_details_request(*, snapshot: str, **kwargs: Any) -> Http class AzureAppConfigurationOperationsMixin(AzureAppConfigurationMixinABC): # pylint: disable=too-many-public-methods + @distributed_trace def get_keys( self, @@ -838,7 +857,6 @@ def get_keys( :param accept_datetime: Requests the server to respond with the state of the resource at the specified time. Default value is None. :type accept_datetime: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Key or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.models.Key] :raises ~azure.core.exceptions.HttpResponseError: @@ -849,7 +867,7 @@ def get_keys( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -869,7 +887,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -890,7 +907,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -945,12 +961,11 @@ def check_keys( # pylint: disable=inconsistent-return-statements :param accept_datetime: Requests the server to respond with the state of the resource at the specified time. Default value is None. :type accept_datetime: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -973,7 +988,6 @@ def check_keys( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1003,19 +1017,22 @@ def get_key_values( label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, snapshot: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, + tags: Optional[List[str]] = None, **kwargs: Any ) -> Iterable["_models.KeyValue"]: """Gets a list of key-values. Gets a list of key-values. - :param key: A filter used to match keys. Default value is None. + :param key: A filter used to match keys. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. :type key: str - :param label: A filter used to match labels. Default value is None. + :param label: A filter used to match labels. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. :type label: str :param after: Instructs the server to return elements that appear after the element referred to by the specified token. Default value is None. @@ -1025,7 +1042,7 @@ def get_key_values( :type accept_datetime: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] :param snapshot: A filter used get key-values for a snapshot. The value should be the name of the snapshot. Not valid when used with 'key' and 'label' filters. Default value is None. :type snapshot: str @@ -1035,7 +1052,9 @@ def get_key_values( :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param tags: A filter used to query by tags. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. + :type tags: list[str] :return: An iterator like instance of either KeyValue or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.models.KeyValue] :raises ~azure.core.exceptions.HttpResponseError: @@ -1046,7 +1065,7 @@ def get_key_values( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.KeyValueListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1066,12 +1085,12 @@ def prepare_request(next_link=None): snapshot=snapshot, if_match=if_match, if_none_match=if_none_match, + tags=tags, sync_token=self._config.sync_token, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -1092,7 +1111,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -1134,19 +1152,22 @@ def check_key_values( # pylint: disable=inconsistent-return-statements label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, snapshot: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, + tags: Optional[List[str]] = None, **kwargs: Any ) -> None: """Requests the headers and status of the given resource. Requests the headers and status of the given resource. - :param key: A filter used to match keys. Default value is None. + :param key: A filter used to match keys. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. :type key: str - :param label: A filter used to match labels. Default value is None. + :param label: A filter used to match labels. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. :type label: str :param after: Instructs the server to return elements that appear after the element referred to by the specified token. Default value is None. @@ -1156,7 +1177,7 @@ def check_key_values( # pylint: disable=inconsistent-return-statements :type accept_datetime: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] :param snapshot: A filter used get key-values for a snapshot. Not valid when used with 'key' and 'label' filters. Default value is None. :type snapshot: str @@ -1166,12 +1187,14 @@ def check_key_values( # pylint: disable=inconsistent-return-statements :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param tags: A filter used to query by tags. Syntax reference: + https://aka.ms/azconfig/docs/keyvaluefiltering. Default value is None. + :type tags: list[str] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1194,12 +1217,12 @@ def check_key_values( # pylint: disable=inconsistent-return-statements snapshot=snapshot, if_match=if_match, if_none_match=if_none_match, + tags=tags, sync_token=self._config.sync_token, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1231,7 +1254,7 @@ def get_key_value( accept_datetime: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, **kwargs: Any ) -> _models.KeyValue: """Gets a single key-value. @@ -1253,13 +1276,12 @@ def get_key_value( :type if_none_match: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] - :keyword callable cls: A custom type or function that will be passed the direct response + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] :return: KeyValue or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1285,7 +1307,6 @@ def get_key_value( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1307,7 +1328,7 @@ def get_key_value( response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("KeyValue", pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1345,7 +1366,6 @@ def put_key_value( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: KeyValue or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue :raises ~azure.core.exceptions.HttpResponseError: @@ -1358,7 +1378,7 @@ def put_key_value( label: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, - entity: Optional[IO] = None, + entity: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1378,14 +1398,13 @@ def put_key_value( not match the value provided. Default value is None. :type if_none_match: str :param entity: The key-value to create. Default value is None. - :type entity: IO + :type entity: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Known values are: 'application/*+json', 'application/json', 'application/json-patch+json', 'application/vnd.microsoft.appconfig.kv+json', 'application/vnd.microsoft.appconfig.kvset+json', 'text/json'. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: KeyValue or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue :raises ~azure.core.exceptions.HttpResponseError: @@ -1398,7 +1417,7 @@ def put_key_value( label: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, - entity: Optional[Union[_models.KeyValue, IO]] = None, + entity: Optional[Union[_models.KeyValue, IO[bytes]]] = None, **kwargs: Any ) -> _models.KeyValue: """Creates a key-value. @@ -1415,20 +1434,14 @@ def put_key_value( :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :param entity: The key-value to create. Is either a KeyValue type or a IO type. Default value - is None. - :type entity: ~azure.appconfiguration.models.KeyValue or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/*+json', - 'application/json', 'application/json-patch+json', - 'application/vnd.microsoft.appconfig.kv+json', - 'application/vnd.microsoft.appconfig.kvset+json', 'text/json'. Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param entity: The key-value to create. Is either a KeyValue type or a IO[bytes] type. Default + value is None. + :type entity: ~azure.appconfiguration.models.KeyValue or IO[bytes] :return: KeyValue or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1467,7 +1480,6 @@ def put_key_value( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1489,7 +1501,7 @@ def put_key_value( response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("KeyValue", pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1511,12 +1523,11 @@ def delete_key_value( :param if_match: Used to perform an operation only if the targeted resource's etag matches the value provided. Default value is None. :type if_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: KeyValue or None or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1539,7 +1550,6 @@ def delete_key_value( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1563,7 +1573,7 @@ def delete_key_value( response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("KeyValue", pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response.http_response) if response.status_code == 204: response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) @@ -1581,7 +1591,7 @@ def check_key_value( # pylint: disable=inconsistent-return-statements accept_datetime: Optional[str] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, **kwargs: Any ) -> None: """Requests the headers and status of the given resource. @@ -1603,13 +1613,12 @@ def check_key_value( # pylint: disable=inconsistent-return-statements :type if_none_match: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] - :keyword callable cls: A custom type or function that will be passed the direct response + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1635,7 +1644,6 @@ def check_key_value( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1683,7 +1691,6 @@ def get_snapshots( :param status: Used to filter returned snapshots by their status property. Default value is None. :type status: list[str or ~azure.appconfiguration.models.SnapshotStatus] - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: @@ -1694,7 +1701,7 @@ def get_snapshots( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SnapshotListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1715,7 +1722,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -1736,7 +1742,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -1782,12 +1787,11 @@ def check_snapshots( # pylint: disable=inconsistent-return-statements :param after: Instructs the server to return elements that appear after the element referred to by the specified token. Default value is None. :type after: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1808,7 +1812,6 @@ def check_snapshots( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1855,12 +1858,11 @@ def get_snapshot( :param select: Used to select what fields are present in the returned resource(s). Default value is None. :type select: list[str or ~azure.appconfiguration.models.SnapshotFields] - :keyword callable cls: A custom type or function that will be passed the direct response :return: Snapshot or the result of cls(response) :rtype: ~azure.appconfiguration.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1884,7 +1886,6 @@ def get_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -1907,7 +1908,7 @@ def get_snapshot( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) response_headers["Link"] = self._deserialize("str", response.headers.get("Link")) - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1915,9 +1916,9 @@ def get_snapshot( return deserialized # type: ignore def _create_snapshot_initial( - self, name: str, entity: Union[_models.Snapshot, IO], **kwargs: Any - ) -> _models.Snapshot: - error_map = { + self, name: str, entity: Union[_models.Snapshot, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1930,7 +1931,7 @@ def _create_snapshot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1950,13 +1951,13 @@ def _create_snapshot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1964,6 +1965,10 @@ def _create_snapshot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) @@ -1974,7 +1979,7 @@ def _create_snapshot_initial( response_headers["Link"] = self._deserialize("str", response.headers.get("Link")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1996,14 +2001,6 @@ def begin_create_snapshot( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.appconfiguration.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: @@ -2011,7 +2008,7 @@ def begin_create_snapshot( @overload def begin_create_snapshot( - self, name: str, entity: IO, *, content_type: str = "application/json", **kwargs: Any + self, name: str, entity: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Snapshot]: """Creates a key-value snapshot. @@ -2020,19 +2017,11 @@ def begin_create_snapshot( :param name: The name of the key-value snapshot to create. Required. :type name: str :param entity: The key-value snapshot to create. Required. - :type entity: IO + :type entity: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Known values are: 'application/json', 'application/vnd.microsoft.appconfig.snapshot+json'. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.appconfiguration.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: @@ -2040,7 +2029,7 @@ def begin_create_snapshot( @distributed_trace def begin_create_snapshot( - self, name: str, entity: Union[_models.Snapshot, IO], **kwargs: Any + self, name: str, entity: Union[_models.Snapshot, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Snapshot]: """Creates a key-value snapshot. @@ -2048,20 +2037,9 @@ def begin_create_snapshot( :param name: The name of the key-value snapshot to create. Required. :type name: str - :param entity: The key-value snapshot to create. Is either a Snapshot type or a IO type. + :param entity: The key-value snapshot to create. Is either a Snapshot type or a IO[bytes] type. Required. - :type entity: ~azure.appconfiguration.models.Snapshot or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json', - 'application/vnd.microsoft.appconfig.snapshot+json'. Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :type entity: ~azure.appconfiguration.models.Snapshot or IO[bytes] :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.appconfiguration.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: @@ -2086,6 +2064,7 @@ def begin_create_snapshot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2098,7 +2077,7 @@ def get_long_running_output(pipeline_response): "str", response.headers.get("Operation-Location") ) - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -2154,7 +2133,6 @@ def update_snapshot( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Snapshot or the result of cls(response) :rtype: ~azure.appconfiguration.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: @@ -2164,7 +2142,7 @@ def update_snapshot( def update_snapshot( self, name: str, - entity: IO, + entity: IO[bytes], if_match: Optional[str] = None, if_none_match: Optional[str] = None, *, @@ -2178,7 +2156,7 @@ def update_snapshot( :param name: The name of the key-value snapshot to update. Required. :type name: str :param entity: The parameters used to update the snapshot. Required. - :type entity: IO + :type entity: IO[bytes] :param if_match: Used to perform an operation only if the targeted resource's etag matches the value provided. Default value is None. :type if_match: str @@ -2189,7 +2167,6 @@ def update_snapshot( Known values are: 'application/json', 'application/merge-patch+json'. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Snapshot or the result of cls(response) :rtype: ~azure.appconfiguration.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: @@ -2199,7 +2176,7 @@ def update_snapshot( def update_snapshot( self, name: str, - entity: Union[_models.SnapshotUpdateParameters, IO], + entity: Union[_models.SnapshotUpdateParameters, IO[bytes]], if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any @@ -2211,23 +2188,19 @@ def update_snapshot( :param name: The name of the key-value snapshot to update. Required. :type name: str :param entity: The parameters used to update the snapshot. Is either a SnapshotUpdateParameters - type or a IO type. Required. - :type entity: ~azure.appconfiguration.models.SnapshotUpdateParameters or IO + type or a IO[bytes] type. Required. + :type entity: ~azure.appconfiguration.models.SnapshotUpdateParameters or IO[bytes] :param if_match: Used to perform an operation only if the targeted resource's etag matches the value provided. Default value is None. :type if_match: str :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json', - 'application/merge-patch+json'. Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Snapshot or the result of cls(response) :rtype: ~azure.appconfiguration.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2262,7 +2235,6 @@ def update_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -2285,7 +2257,7 @@ def update_snapshot( response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) response_headers["Link"] = self._deserialize("str", response.headers.get("Link")) - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2308,12 +2280,11 @@ def check_snapshot( # pylint: disable=inconsistent-return-statements :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2336,7 +2307,6 @@ def check_snapshot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -2385,7 +2355,6 @@ def get_labels( :param select: Used to select what fields are present in the returned resource(s). Default value is None. :type select: list[str or ~azure.appconfiguration.models.LabelFields] - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Label or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.models.Label] :raises ~azure.core.exceptions.HttpResponseError: @@ -2396,7 +2365,7 @@ def get_labels( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LabelListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2417,7 +2386,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -2438,7 +2406,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -2497,12 +2464,11 @@ def check_labels( # pylint: disable=inconsistent-return-statements :param select: Used to select what fields are present in the returned resource(s). Default value is None. :type select: list[str or ~azure.appconfiguration.models.LabelFields] - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2526,7 +2492,6 @@ def check_labels( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -2572,12 +2537,11 @@ def put_lock( :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: KeyValue or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2601,7 +2565,6 @@ def put_lock( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -2623,7 +2586,7 @@ def put_lock( response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("KeyValue", pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2653,12 +2616,11 @@ def delete_lock( :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: KeyValue or the result of cls(response) :rtype: ~azure.appconfiguration.models.KeyValue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2682,7 +2644,6 @@ def delete_lock( headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -2704,7 +2665,7 @@ def delete_lock( response_headers["Sync-Token"] = self._deserialize("str", response.headers.get("Sync-Token")) response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("KeyValue", pipeline_response) + deserialized = self._deserialize("KeyValue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2718,16 +2679,19 @@ def get_revisions( label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, **kwargs: Any ) -> Iterable["_models.KeyValue"]: """Gets a list of key-value revisions. Gets a list of key-value revisions. - :param key: A filter used to match keys. Default value is None. + :param key: A filter used to match keys. Syntax reference: + https://aka.ms/azconfig/docs/restapirevisions. Default value is None. :type key: str - :param label: A filter used to match labels. Default value is None. + :param label: A filter used to match labels. Syntax reference: + https://aka.ms/azconfig/docs/restapirevisions. Default value is None. :type label: str :param after: Instructs the server to return elements that appear after the element referred to by the specified token. Default value is None. @@ -2737,8 +2701,10 @@ def get_revisions( :type accept_datetime: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] - :keyword callable cls: A custom type or function that will be passed the direct response + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] + :param tags: A filter used to query by tags. Syntax reference: + https://aka.ms/azconfig/docs/restapirevisions. Default value is None. + :type tags: list[str] :return: An iterator like instance of either KeyValue or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.models.KeyValue] :raises ~azure.core.exceptions.HttpResponseError: @@ -2749,7 +2715,7 @@ def get_revisions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.KeyValueListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2766,12 +2732,12 @@ def prepare_request(next_link=None): after=after, accept_datetime=accept_datetime, select=select, + tags=tags, sync_token=self._config.sync_token, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -2792,7 +2758,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -2834,16 +2799,19 @@ def check_revisions( # pylint: disable=inconsistent-return-statements label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, + tags: Optional[List[str]] = None, **kwargs: Any ) -> None: """Requests the headers and status of the given resource. Requests the headers and status of the given resource. - :param key: A filter used to match keys. Default value is None. + :param key: A filter used to match keys. Syntax reference: + https://aka.ms/azconfig/docs/restapirevisions. Default value is None. :type key: str - :param label: A filter used to match labels. Default value is None. + :param label: A filter used to match labels. Syntax reference: + https://aka.ms/azconfig/docs/restapirevisions. Default value is None. :type label: str :param after: Instructs the server to return elements that appear after the element referred to by the specified token. Default value is None. @@ -2853,13 +2821,15 @@ def check_revisions( # pylint: disable=inconsistent-return-statements :type accept_datetime: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] - :keyword callable cls: A custom type or function that will be passed the direct response + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] + :param tags: A filter used to query by tags. Syntax reference: + https://aka.ms/azconfig/docs/restapirevisions. Default value is None. + :type tags: list[str] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2879,12 +2849,12 @@ def check_revisions( # pylint: disable=inconsistent-return-statements after=after, accept_datetime=accept_datetime, select=select, + tags=tags, sync_token=self._config.sync_token, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -2916,12 +2886,11 @@ def get_operation_details(self, snapshot: str, **kwargs: Any) -> _models.Operati :param snapshot: Snapshot identifier for the long running operation. Required. :type snapshot: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationDetails or the result of cls(response) :rtype: ~azure.appconfiguration.models.OperationDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2941,7 +2910,6 @@ def get_operation_details(self, snapshot: str, **kwargs: Any) -> _models.Operati headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -2959,7 +2927,7 @@ def get_operation_details(self, snapshot: str, **kwargs: Any) -> _models.Operati error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("OperationDetails", pipeline_response) + deserialized = self._deserialize("OperationDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/operations/_patch.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/operations/_patch.py index 64039fa2983a2..1d0a27bce7a42 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/operations/_patch.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/operations/_patch.py @@ -2,6 +2,8 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize @@ -26,7 +28,6 @@ build_get_key_values_request, ) from .. import models as _models -from .._vendor import _convert_request class AzureAppConfigurationOperationsMixin(AzureAppConfigOpGenerated): @@ -37,9 +38,10 @@ def get_key_values_in_one_page( label: Optional[str] = None, after: Optional[str] = None, accept_datetime: Optional[str] = None, - select: Optional[List[Union[str, _models.KeyValueFields]]] = None, + select: Optional[List[Union[str, _models.ConfigurationSettingFields]]] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, + tags: Optional[List[str]] = None, continuation_token: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.KeyValue"]: @@ -59,7 +61,7 @@ def get_key_values_in_one_page( :type accept_datetime: str :param select: Used to select what fields are present in the returned resource(s). Default value is None. - :type select: list[str or ~azure.appconfiguration.models.KeyValueFields] + :type select: list[str or ~azure.appconfiguration.models.ConfigurationSettingFields] :param snapshot: A filter used get key-values for a snapshot. The value should be the name of the snapshot. Not valid when used with 'key' and 'label' filters. Default value is None. :type snapshot: str @@ -69,6 +71,8 @@ def get_key_values_in_one_page( :param if_none_match: Used to perform an operation only if the targeted resource's etag does not match the value provided. Default value is None. :type if_none_match: str + :param tags: A filter used to query by tags. Default value is None. + :type tags: list[str] :param str continuation_token: An opaque continuation token. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either KeyValue or the result of cls(response) @@ -100,21 +104,21 @@ def prepare_request(next_link=None): select=select, if_match=if_match, if_none_match=if_none_match, + tags=tags, sync_token=self._config.sync_token, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True ), } _request.url = self._client.format_url(_request.url, **path_format_arguments) - else: # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) _next_request_params = case_insensitive_dict( { @@ -126,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) path_format_arguments = { "endpoint": self._serialize.url( "self._config.endpoint", self._config.endpoint, "str", skip_quote=True @@ -148,13 +151,11 @@ def prepare_request(next_link=None): map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - response_headers = response.headers deserialized = self._deserialize("KeyValueListResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) - return deserialized diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_models.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_models.py index f615fe4da6313..b09ae021be914 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_models.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_models.py @@ -5,7 +5,6 @@ import json from datetime import datetime from typing import Any, Dict, List, Optional, Union, cast, Callable -from typing_extensions import Literal from azure.core.async_paging import AsyncList from azure.core.rest import HttpResponse @@ -17,6 +16,7 @@ KeyValueFilter, Snapshot as GeneratedConfigurationSnapshot, SnapshotStatus, + SnapshotComposition, ) @@ -394,16 +394,21 @@ class ConfigurationSettingsFilter: """Filters configuration settings by their key field. Required.""" label: Optional[str] """Filters configuration settings by their label field.""" + tags: Optional[List[str]] + """Filters key-values by their tags field.""" - def __init__(self, *, key: str, label: Optional[str] = None) -> None: + def __init__(self, *, key: str, label: Optional[str] = None, tags: Optional[List[str]] = None) -> None: """ :keyword key: Filters configuration settings by their key field. Required. :paramtype key: str :keyword label: Filters configuration settings by their label field. :paramtype label: str or None + :keyword tags: Filters key-values by their tags field. + :paramtype tags: list[str] or None """ self.key = key self.label = label + self.tags = tags class ConfigurationSnapshot: # pylint: disable=too-many-instance-attributes @@ -415,8 +420,8 @@ class ConfigurationSnapshot: # pylint: disable=too-many-instance-attributes """The current status of the snapshot. Known values are: "provisioning", "ready", "archived", and "failed".""" filters: List[ConfigurationSettingsFilter] - """A list of filters used to filter the key-values included in the configuration snapshot.""" - composition_type: Optional[str] + """A list of filters used to filter the key-values included in the configuration snapshot. Required.""" + composition_type: Optional[Union[str, SnapshotComposition]] """The composition type describes how the key-values within the configuration snapshot are composed. The 'key' composition type ensures there are no two key-values containing the same key. The 'key_label' composition type ensures there are no two key-values containing the @@ -442,7 +447,7 @@ def __init__( self, filters: List[ConfigurationSettingsFilter], *, - composition_type: Optional[Literal["key", "key_label"]] = None, + composition_type: Optional[Union[str, SnapshotComposition]] = None, retention_period: Optional[int] = None, tags: Optional[Dict[str, str]] = None, ) -> None: @@ -487,7 +492,7 @@ def _from_generated(cls, generated: GeneratedConfigurationSnapshot) -> "Configur ) snapshot = cls( filters=filters, - composition_type=cast(Optional[Literal["key", "key_label"]], generated.composition_type), + composition_type=cast(SnapshotComposition, generated.composition_type), retention_period=generated.retention_period, tags=generated.tags, ) @@ -518,7 +523,7 @@ def _from_deserialized( ) snapshot = cls( filters=filters, - composition_type=cast(Optional[Literal["key", "key_label"]], deserialized.composition_type), + composition_type=cast(SnapshotComposition, deserialized.composition_type), retention_period=deserialized.retention_period, tags=deserialized.tags, ) @@ -544,6 +549,20 @@ def _to_generated(self) -> GeneratedConfigurationSnapshot: ) +class ConfigurationSettingLabel: + """The label info of a configuration setting.""" + + name: Optional[str] + """The name of the ConfigurationSetting label.""" + + def __init__(self, *, name: Optional[str] = None) -> None: + """ + :keyword name: The configuration setting label name. + :paramtype composition_type: str or None + """ + self.name = name + + def _return_deserialized_and_headers(_, deserialized, response_headers): return deserialized, response_headers @@ -565,6 +584,7 @@ def __init__(self, command: Callable, **kwargs): self._label = kwargs.get("label") self._accept_datetime = kwargs.get("accept_datetime") self._select = kwargs.get("select") + self._tags = kwargs.get("tags") self._deserializer = lambda objs: [ ConfigurationSetting._from_generated(x) for x in objs # pylint:disable=protected-access ] @@ -575,6 +595,7 @@ def _get_next_cb(self, continuation_token, **kwargs): label=self._label, accept_datetime=self._accept_datetime, select=self._select, + tags=self._tags, continuation_token=continuation_token, cls=kwargs.pop("cls", None) or _return_deserialized_and_headers, ) @@ -602,6 +623,7 @@ def __init__(self, command: Callable, **kwargs): self._label = kwargs.get("label") self._accept_datetime = kwargs.get("accept_datetime") self._select = kwargs.get("select") + self._tags = kwargs.get("tags") self._deserializer = lambda objs: [ ConfigurationSetting._from_generated(x) for x in objs # pylint:disable=protected-access ] @@ -612,6 +634,7 @@ async def _get_next_cb(self, continuation_token, **kwargs): label=self._label, accept_datetime=self._accept_datetime, select=self._select, + tags=self._tags, continuation_token=continuation_token, cls=kwargs.pop("cls", None) or _return_deserialized_and_headers, ) diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py index 7be7a862d2939..ae9aa384b1d83 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. # ------------------------------------ -VERSION = "1.6.1" +VERSION = "1.7.1" diff --git a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/aio/_azure_appconfiguration_client_async.py b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/aio/_azure_appconfiguration_client_async.py index ac177aa365669..0763070fc2466 100644 --- a/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/aio/_azure_appconfiguration_client_async.py +++ b/sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/aio/_azure_appconfiguration_client_async.py @@ -3,11 +3,9 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # ------------------------------------------------------------------------- -import binascii import functools from datetime import datetime -from typing import Any, Dict, List, Optional, Union, cast, overload -from typing_extensions import Literal +from typing import Any, Dict, List, Optional, Union, overload, cast from azure.core import MatchConditions from azure.core.async_paging import AsyncItemPaged from azure.core.credentials import AzureKeyCredential @@ -27,12 +25,20 @@ from .._azure_appconfiguration_error import ResourceReadOnlyError from .._azure_appconfiguration_requests import AppConfigRequestsCredentialsPolicy from .._generated.aio import AzureAppConfiguration -from .._generated.models import SnapshotUpdateParameters, SnapshotStatus +from .._generated.models import ( + SnapshotUpdateParameters, + SnapshotStatus, + SnapshotFields, + SnapshotComposition, + LabelFields, + ConfigurationSettingFields, +) from .._models import ( ConfigurationSetting, + ConfigurationSettingPropertiesPagedAsync, ConfigurationSettingsFilter, ConfigurationSnapshot, - ConfigurationSettingPropertiesPagedAsync, + ConfigurationSettingLabel, ) from .._utils import ( prep_if_match, @@ -49,7 +55,7 @@ class AzureAppConfigurationClient: :param str base_url: Base url of the service. :param credential: An object which can provide secrets for the app configuration service :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this default + :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str @@ -145,22 +151,28 @@ def list_configuration_settings( *, key_filter: Optional[str] = None, label_filter: Optional[str] = None, + tags_filter: Optional[List[str]] = None, accept_datetime: Optional[Union[datetime, str]] = None, - fields: Optional[List[str]] = None, + fields: Optional[List[Union[str, ConfigurationSettingFields]]] = None, **kwargs: Any, ) -> AsyncItemPaged[ConfigurationSetting]: """List the configuration settings stored in the configuration service, optionally filtered by - key, label and accept_datetime. + key, label, tags and accept_datetime. For more information about supported filters, see + https://learn.microsoft.com/azure/azure-app-configuration/rest-api-key-value?pivots=v23-11#supported-filters. - :keyword key_filter: filter results based on their keys. '*' can be - used as wildcard in the beginning or end of the filter + :keyword key_filter: Filter results based on their keys. '*' can be used as wildcard in the beginning or end + of the filter. :paramtype key_filter: str or None - :keyword label_filter: filter results based on their label. '*' can be - used as wildcard in the beginning or end of the filter + :keyword label_filter: Filter results based on their label. '*' can be used as wildcard in the beginning or end + of the filter. :paramtype label_filter: str or None - :keyword accept_datetime: retrieve ConfigurationSetting existed at this datetime + :keyword tags_filter: Filter results based on their tags. + :paramtype tags_filter: list[str] or None + :keyword accept_datetime: Retrieve ConfigurationSetting that existed at this datetime :paramtype accept_datetime: ~datetime.datetime or str or None - :keyword list[str] fields: specify which fields to include in the results. Leave None to include all fields + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.ConfigurationSettingFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.ConfigurationSettingFields] or None :return: An async iterator of :class:`~azure.appconfiguration.ConfigurationSetting` :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.appconfiguration.ConfigurationSetting] :raises: :class:`~azure.core.exceptions.HttpResponseError`, \ @@ -187,14 +199,19 @@ def list_configuration_settings( @overload def list_configuration_settings( - self, *, snapshot_name: str, fields: Optional[List[str]] = None, **kwargs: Any + self, + *, + snapshot_name: str, + fields: Optional[List[Union[str, ConfigurationSettingFields]]] = None, + **kwargs: Any, ) -> AsyncItemPaged[ConfigurationSetting]: """List the configuration settings stored under a snapshot in the configuration service, optionally filtered by accept_datetime and fields to present in return. :keyword str snapshot_name: The snapshot name. - :keyword fields: Specify which fields to include in the results. Leave None to include all fields. - :type fields: list[str] or None + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.ConfigurationSettingFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.ConfigurationSettingFields] or None :return: An async iterator of :class:`~azure.appconfiguration.ConfigurationSetting` :rtype: ~azure.core.paging.AsyncItemPaged[~azure.appconfiguration.ConfigurationSetting] :raises: :class:`~azure.core.exceptions.HttpResponseError` @@ -211,28 +228,27 @@ def list_configuration_settings(self, *args, **kwargs) -> AsyncItemPaged[Configu select = ["locked" if x == "read_only" else x for x in select] snapshot_name = kwargs.pop("snapshot_name", None) - try: - if snapshot_name is not None: - return self._impl.get_key_values( # type: ignore - snapshot=snapshot_name, - accept_datetime=accept_datetime, - select=select, - cls=lambda objs: [ConfigurationSetting._from_generated(x) for x in objs], - **kwargs, - ) - key_filter, kwargs = get_key_filter(*args, **kwargs) - label_filter, kwargs = get_label_filter(*args, **kwargs) - command = functools.partial(self._impl.get_key_values_in_one_page, **kwargs) # type: ignore[attr-defined] - return AsyncItemPaged( - command, - key=key_filter, - label=label_filter, + if snapshot_name is not None: + return self._impl.get_key_values( # type: ignore[return-value] + snapshot=snapshot_name, accept_datetime=accept_datetime, select=select, - page_iterator_class=ConfigurationSettingPropertiesPagedAsync, + cls=lambda objs: [ConfigurationSetting._from_generated(x) for x in objs], + **kwargs, ) - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc + tags = kwargs.pop("tags_filter", None) + key_filter, kwargs = get_key_filter(*args, **kwargs) + label_filter, kwargs = get_label_filter(*args, **kwargs) + command = functools.partial(self._impl.get_key_values_in_one_page, **kwargs) # type: ignore[attr-defined] + return AsyncItemPaged( + command, + key=key_filter, + label=label_filter, + accept_datetime=accept_datetime, + select=select, + tags=tags, + page_iterator_class=ConfigurationSettingPropertiesPagedAsync, + ) @distributed_trace_async async def get_configuration_setting( @@ -247,15 +263,15 @@ async def get_configuration_setting( ) -> Union[None, ConfigurationSetting]: """Get the matched ConfigurationSetting from Azure App Configuration service - :param key: key of the ConfigurationSetting + :param key: Key of the ConfigurationSetting :type key: str - :param label: label used to identify the ConfigurationSetting. Default is `None`. + :param label: Label used to identify the ConfigurationSetting. Default is `None`. :type label: str or None - :param etag: check if the ConfigurationSetting is changed. Set None to skip checking etag + :param etag: Check if the ConfigurationSetting is changed. Set None to skip checking etag :type etag: str or None :param match_condition: The match condition to use upon the etag :type match_condition: ~azure.core.MatchConditions - :keyword accept_datetime: retrieve ConfigurationSetting existed at this datetime + :keyword accept_datetime: Retrieve ConfigurationSetting that existed at this datetime :paramtype accept_datetime: ~datetime.datetime or str or None :return: The matched ConfigurationSetting object :rtype: ~azure.appconfiguration.ConfigurationSetting or None @@ -298,8 +314,6 @@ async def get_configuration_setting( return ConfigurationSetting._from_generated(key_value) except ResourceNotModifiedError: return None - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc @distributed_trace_async async def add_configuration_setting( @@ -307,7 +321,7 @@ async def add_configuration_setting( ) -> ConfigurationSetting: """Add a ConfigurationSetting instance into the Azure App Configuration service. - :param configuration_setting: the ConfigurationSetting object to be added + :param configuration_setting: The ConfigurationSetting object to be added :type configuration_setting: ~azure.appconfiguration.ConfigurationSetting :return: The ConfigurationSetting object returned from the App Configuration service :rtype: ~azure.appconfiguration.ConfigurationSetting @@ -332,18 +346,15 @@ async def add_configuration_setting( key_value = configuration_setting._to_generated() error_map = {412: ResourceExistsError} - try: - key_value_added = await self._impl.put_key_value( - entity=key_value, - key=key_value.key, # type: ignore - label=key_value.label, - if_none_match="*", - error_map=error_map, - **kwargs, - ) - return ConfigurationSetting._from_generated(key_value_added) - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc + key_value_added = await self._impl.put_key_value( + entity=key_value, + key=key_value.key, # type: ignore + label=key_value.label, + if_none_match="*", + error_map=error_map, + **kwargs, + ) + return ConfigurationSetting._from_generated(key_value_added) @distributed_trace_async async def set_configuration_setting( @@ -358,13 +369,14 @@ async def set_configuration_setting( If the configuration setting identified by key and label does not exist, this is a create. Otherwise this is an update. - :param configuration_setting: the ConfigurationSetting to be added (if not exists) + :param configuration_setting: The ConfigurationSetting to be added (if not exists) or updated (if exists) to the service :type configuration_setting: ~azure.appconfiguration.ConfigurationSetting :param match_condition: The match condition to use upon the etag :type match_condition: ~azure.core.MatchConditions - :keyword str etag: check if the ConfigurationSetting is changed. \ + :keyword etag: Check if the ConfigurationSetting is changed. \ Will use the value from param configuration_setting if not set. + :paramtype etag: str or None :return: The ConfigurationSetting returned from the service :rtype: ~azure.appconfiguration.ConfigurationSetting :raises: :class:`~azure.appconfiguration.ResourceReadOnlyError`, \ @@ -400,19 +412,16 @@ async def set_configuration_setting( if match_condition == MatchConditions.IfMissing: error_map.update({412: ResourceExistsError}) - try: - key_value_set = await self._impl.put_key_value( - entity=key_value, - key=key_value.key, # type: ignore - label=key_value.label, - if_match=prep_if_match(configuration_setting.etag, match_condition), - if_none_match=prep_if_none_match(etag or configuration_setting.etag, match_condition), - error_map=error_map, - **kwargs, - ) - return ConfigurationSetting._from_generated(key_value_set) - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc + key_value_set = await self._impl.put_key_value( + entity=key_value, + key=key_value.key, # type: ignore + label=key_value.label, + if_match=prep_if_match(configuration_setting.etag, match_condition), + if_none_match=prep_if_none_match(etag or configuration_setting.etag, match_condition), + error_map=error_map, + **kwargs, + ) + return ConfigurationSetting._from_generated(key_value_set) @distributed_trace_async async def delete_configuration_setting( @@ -426,11 +435,12 @@ async def delete_configuration_setting( ) -> Union[None, ConfigurationSetting]: """Delete a ConfigurationSetting if it exists - :param key: key used to identify the ConfigurationSetting + :param key: Key used to identify the ConfigurationSetting :type key: str - :param label: label used to identify the ConfigurationSetting. Default is `None`. + :param label: Label used to identify the ConfigurationSetting. Default is `None`. :type label: str - :keyword str etag: check if the ConfigurationSetting is changed. Set None to skip checking etag + :keyword etag: Check if the ConfigurationSetting is changed. Set None to skip checking etag + :paramtype etag: str or None :keyword match_condition: The match condition to use upon the etag :paramtype match_condition: ~azure.core.MatchConditions :return: The deleted ConfigurationSetting returned from the service, or None if it doesn't exist. @@ -462,19 +472,16 @@ async def delete_configuration_setting( if match_condition == MatchConditions.IfMissing: error_map.update({412: ResourceExistsError}) - try: - key_value_deleted = await self._impl.delete_key_value( - key=key, - label=label, - if_match=prep_if_match(etag, match_condition), - error_map=error_map, - **kwargs, - ) - if key_value_deleted: - return ConfigurationSetting._from_generated(key_value_deleted) - return None - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc + key_value_deleted = await self._impl.delete_key_value( + key=key, + label=label, + if_match=prep_if_match(etag, match_condition), + error_map=error_map, + **kwargs, + ) + if key_value_deleted: + return ConfigurationSetting._from_generated(key_value_deleted) + return None @distributed_trace def list_revisions( @@ -482,22 +489,29 @@ def list_revisions( key_filter: Optional[str] = None, label_filter: Optional[str] = None, *, + tags_filter: Optional[List[str]] = None, accept_datetime: Optional[Union[datetime, str]] = None, - fields: Optional[List[str]] = None, + fields: Optional[List[Union[str, ConfigurationSettingFields]]] = None, **kwargs, ) -> AsyncItemPaged[ConfigurationSetting]: """ - Find the ConfigurationSetting revision history, optionally filtered by key, label and accept_datetime. + Find the ConfigurationSetting revision history, optionally filtered by key, label, tags and accept_datetime. + For more information about supported filters, see + https://learn.microsoft.com/azure/azure-app-configuration/rest-api-revisions?pivots=v23-11#supported-filters. - :param key_filter: filter results based on their keys. '*' can be - used as wildcard in the beginning or end of the filter + :param key_filter: Filter results based on their keys. '*' can be used as wildcard in the beginning or end + of the filter. :type key_filter: str or None - :param label_filter: filter results based on their label. '*' can be - used as wildcard in the beginning or end of the filter + :param label_filter: Filter results based on their label. '*' can be used as wildcard in the beginning or end + of the filter. :type label_filter: str or None - :keyword accept_datetime: retrieve ConfigurationSetting existed at this datetime + :keyword tags_filter: Filter results based on their tags. + :paramtype tags_filter: list[str] or None + :keyword accept_datetime: Retrieve ConfigurationSetting that existed at this datetime :paramtype accept_datetime: ~datetime.datetime or str or None - :keyword list[str] fields: specify which fields to include in the results. Leave None to include all fields. + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.ConfigurationSettingFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.ConfigurationSettingFields] or None :return: An async iterator of :class:`~azure.appconfiguration.ConfigurationSetting` :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.appconfiguration.ConfigurationSetting] :raises: :class:`~azure.core.exceptions.HttpResponseError`, \ @@ -527,17 +541,15 @@ def list_revisions( if fields: fields = ["locked" if x == "read_only" else x for x in fields] - try: - return self._impl.get_revisions( # type: ignore - label=label_filter, - key=key_filter, - accept_datetime=accept_datetime, - select=fields, - cls=lambda objs: [ConfigurationSetting._from_generated(x) for x in objs], - **kwargs, - ) - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc + return self._impl.get_revisions( # type: ignore[return-value] + label=label_filter, + key=key_filter, + accept_datetime=accept_datetime, + select=fields, + tags=tags_filter, + cls=lambda objs: [ConfigurationSetting._from_generated(x) for x in objs], + **kwargs, + ) @distributed_trace_async async def set_read_only( @@ -550,9 +562,9 @@ async def set_read_only( ) -> ConfigurationSetting: """Set a configuration setting read only - :param configuration_setting: the ConfigurationSetting to be set read only + :param configuration_setting: The ConfigurationSetting to be set read only :type configuration_setting: ~azure.appconfiguration.ConfigurationSetting - :param read_only: set the read only setting if true, else clear the read only setting + :param read_only: Set the read only setting if true, else clear the read only setting :type read_only: bool :keyword match_condition: The match condition to use upon the etag :paramtype match_condition: ~azure.core.MatchConditions @@ -583,28 +595,65 @@ async def set_read_only( if match_condition == MatchConditions.IfMissing: error_map.update({412: ResourceExistsError}) - try: - if read_only: - key_value = await self._impl.put_lock( - key=configuration_setting.key, - label=configuration_setting.label, - if_match=prep_if_match(configuration_setting.etag, match_condition), - if_none_match=prep_if_none_match(configuration_setting.etag, match_condition), - error_map=error_map, - **kwargs, - ) - else: - key_value = await self._impl.delete_lock( - key=configuration_setting.key, - label=configuration_setting.label, - if_match=prep_if_match(configuration_setting.etag, match_condition), - if_none_match=prep_if_none_match(configuration_setting.etag, match_condition), - error_map=error_map, - **kwargs, - ) - return ConfigurationSetting._from_generated(key_value) - except binascii.Error as exc: - raise binascii.Error("Connection string secret has incorrect padding") from exc + if read_only: + key_value = await self._impl.put_lock( + key=configuration_setting.key, + label=configuration_setting.label, + if_match=prep_if_match(configuration_setting.etag, match_condition), + if_none_match=prep_if_none_match(configuration_setting.etag, match_condition), + error_map=error_map, + **kwargs, + ) + else: + key_value = await self._impl.delete_lock( + key=configuration_setting.key, + label=configuration_setting.label, + if_match=prep_if_match(configuration_setting.etag, match_condition), + if_none_match=prep_if_none_match(configuration_setting.etag, match_condition), + error_map=error_map, + **kwargs, + ) + return ConfigurationSetting._from_generated(key_value) + + @distributed_trace + def list_labels( + self, + *, + name: Optional[str] = None, + after: Optional[str] = None, + accept_datetime: Optional[Union[datetime, str]] = None, + fields: Optional[List[Union[str, LabelFields]]] = None, + **kwargs, + ) -> AsyncItemPaged[ConfigurationSettingLabel]: + """Gets a list of labels. + + :keyword name: A filter for the name of the returned labels. '*' can be used as wildcard + in the beginning or end of the filter. For more information about supported filters, see + https://learn.microsoft.com/azure/azure-app-configuration/rest-api-labels?pivots=v23-11#supported-filters. + :paramtype name: str or None + :keyword after: Instructs the server to return elements that appear after the element referred to + by the specified token. + :paramtype after: str or None + :keyword accept_datetime: Requests the server to respond with the state of the resource at the + specified time. + :paramtype accept_datetime: ~datetime.datetime or str or None + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.LabelFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.LabelFields] or None + :return: An async iterator of labels. + :rtype: ~azure.core.paging.AsyncItemPaged[~azure.appconfiguration.ConfigurationSettingLabel] + :raises: :class:`~azure.core.exceptions.HttpResponseError` + """ + if isinstance(accept_datetime, datetime): + accept_datetime = str(accept_datetime) + return self._impl.get_labels( # type: ignore[return-value] + name=name, + after=after, + accept_datetime=accept_datetime, + select=fields, + cls=lambda objs: [ConfigurationSettingLabel(name=x.name) for x in objs], + **kwargs, + ) @distributed_trace_async async def begin_create_snapshot( @@ -612,7 +661,7 @@ async def begin_create_snapshot( name: str, filters: List[ConfigurationSettingsFilter], *, - composition_type: Optional[Literal["key", "key_label"]] = None, + composition_type: Optional[Union[str, SnapshotComposition]] = None, retention_period: Optional[int] = None, tags: Optional[Dict[str, str]] = None, **kwargs, @@ -628,14 +677,14 @@ async def begin_create_snapshot( snapshot are composed. Known values are: "key" and "key_label". The "key" composition type ensures there are no two key-values containing the same key. The 'key_label' composition type ensures there are no two key-values containing the same key and label. - :type composition_type: str or None + :paramtype composition_type: str or ~azure.appconfiguration.SnapshotComposition or None :keyword retention_period: The amount of time, in seconds, that a configuration snapshot will remain in the archived state before expiring. This property is only writable during the creation of a configuration snapshot. If not specified, will set to 2592000(30 days). If specified, should be in range 3600(1 hour) to 7776000(90 days). - :type retention_period: int or None + :paramtype retention_period: int or None :keyword tags: The tags of the configuration snapshot. - :type tags: dict[str, str] or None + :paramtype tags: dict[str, str] or None :return: A poller for create configuration snapshot operation. Call `result()` on this object to wait for the operation to complete and get the created snapshot. :rtype: ~azure.core.polling.LROPoller[~azure.appconfiguration.ConfigurationSnapshot] @@ -644,15 +693,12 @@ async def begin_create_snapshot( snapshot = ConfigurationSnapshot( filters=filters, composition_type=composition_type, retention_period=retention_period, tags=tags ) - try: - return cast( - AsyncLROPoller[ConfigurationSnapshot], - await self._impl.begin_create_snapshot( - name=name, entity=snapshot._to_generated(), cls=ConfigurationSnapshot._from_deserialized, **kwargs - ), - ) - except binascii.Error: - raise binascii.Error("Connection string secret has incorrect padding") # pylint: disable=raise-missing-from + return cast( + AsyncLROPoller[ConfigurationSnapshot], + await self._impl.begin_create_snapshot( + name=name, entity=snapshot._to_generated(), cls=ConfigurationSnapshot._from_deserialized, **kwargs + ), + ) @distributed_trace_async async def archive_snapshot( @@ -669,9 +715,9 @@ async def archive_snapshot( :param name: The name of the configuration setting snapshot to archive. :type name: str :keyword match_condition: The match condition to use upon the etag. - :type match_condition: ~azure.core.MatchConditions + :paramtype match_condition: ~azure.core.MatchConditions :keyword etag: Check if the ConfigurationSnapshot is changed. Set None to skip checking etag. - :type etag: str or None + :paramtype etag: str or None :return: The ConfigurationSnapshot returned from the service. :rtype: ~azure.appconfiguration.ConfigurationSnapshot :raises: :class:`~azure.core.exceptions.HttpResponseError` @@ -685,18 +731,15 @@ async def archive_snapshot( error_map.update({412: ResourceNotFoundError}) if match_condition == MatchConditions.IfMissing: error_map.update({412: ResourceExistsError}) - try: - generated_snapshot = await self._impl.update_snapshot( - name=name, - entity=SnapshotUpdateParameters(status=SnapshotStatus.ARCHIVED), - if_match=prep_if_match(etag, match_condition), - if_none_match=prep_if_none_match(etag, match_condition), - error_map=error_map, - **kwargs, - ) - return ConfigurationSnapshot._from_generated(generated_snapshot) - except binascii.Error: - raise binascii.Error("Connection string secret has incorrect padding") # pylint: disable=raise-missing-from + generated_snapshot = await self._impl.update_snapshot( + name=name, + entity=SnapshotUpdateParameters(status=SnapshotStatus.ARCHIVED), + if_match=prep_if_match(etag, match_condition), + if_none_match=prep_if_none_match(etag, match_condition), + error_map=error_map, + **kwargs, + ) + return ConfigurationSnapshot._from_generated(generated_snapshot) @distributed_trace_async async def recover_snapshot( @@ -712,9 +755,9 @@ async def recover_snapshot( :param name: The name of the configuration setting snapshot to recover. :type name: str :keyword match_condition: The match condition to use upon the etag. - :type match_condition: ~azure.core.MatchConditions + :paramtype match_condition: ~azure.core.MatchConditions :keyword etag: Check if the ConfigurationSnapshot is changed. Set None to skip checking etag. - :type etag: str or None + :paramtype etag: str or None :return: The ConfigurationSnapshot returned from the service. :rtype: ~azure.appconfiguration.ConfigurationSnapshot :raises: :class:`~azure.core.exceptions.HttpResponseError` @@ -728,45 +771,42 @@ async def recover_snapshot( error_map.update({412: ResourceNotFoundError}) if match_condition == MatchConditions.IfMissing: error_map.update({412: ResourceExistsError}) - try: - generated_snapshot = await self._impl.update_snapshot( - name=name, - entity=SnapshotUpdateParameters(status=SnapshotStatus.READY), - if_match=prep_if_match(etag, match_condition), - if_none_match=prep_if_none_match(etag, match_condition), - error_map=error_map, - **kwargs, - ) - return ConfigurationSnapshot._from_generated(generated_snapshot) - except binascii.Error: - raise binascii.Error("Connection string secret has incorrect padding") # pylint: disable=raise-missing-from + generated_snapshot = await self._impl.update_snapshot( + name=name, + entity=SnapshotUpdateParameters(status=SnapshotStatus.READY), + if_match=prep_if_match(etag, match_condition), + if_none_match=prep_if_none_match(etag, match_condition), + error_map=error_map, + **kwargs, + ) + return ConfigurationSnapshot._from_generated(generated_snapshot) @distributed_trace_async - async def get_snapshot(self, name: str, *, fields: Optional[List[str]] = None, **kwargs) -> ConfigurationSnapshot: + async def get_snapshot( + self, name: str, *, fields: Optional[List[Union[str, SnapshotFields]]] = None, **kwargs + ) -> ConfigurationSnapshot: """Get a configuration setting snapshot. :param name: The name of the configuration setting snapshot to retrieve. :type name: str - :keyword fields: Specify which fields to include in the results. Leave None to include all fields. - :type fields: list[str] or None + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.SnapshotFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.SnapshotFields] or None :return: The ConfigurationSnapshot returned from the service. :rtype: ~azure.appconfiguration.ConfigurationSnapshot :raises: :class:`~azure.core.exceptions.HttpResponseError` """ - try: - generated_snapshot = await self._impl.get_snapshot( - name=name, if_match=None, if_none_match=None, select=fields, **kwargs - ) - return ConfigurationSnapshot._from_generated(generated_snapshot) - except binascii.Error: - raise binascii.Error("Connection string secret has incorrect padding") # pylint: disable=raise-missing-from + generated_snapshot = await self._impl.get_snapshot( + name=name, if_match=None, if_none_match=None, select=fields, **kwargs + ) + return ConfigurationSnapshot._from_generated(generated_snapshot) @distributed_trace def list_snapshots( self, *, name: Optional[str] = None, - fields: Optional[List[str]] = None, + fields: Optional[List[Union[str, SnapshotFields]]] = None, status: Optional[List[Union[str, SnapshotStatus]]] = None, **kwargs, ) -> AsyncItemPaged[ConfigurationSnapshot]: @@ -774,25 +814,24 @@ def list_snapshots( snapshot name, snapshot status and fields to present in return. :keyword name: Filter results based on snapshot name. - :type name: str or None - :keyword fields: Specify which fields to include in the results. Leave None to include all fields. - :type fields: list[str] or None - :keyword status: Filter results based on snapshot keys. - :type status: list[str] or list[~azure.appconfiguration.SnapshotStatus] or None + :paramtype name: str or None + :keyword fields: Specify which fields to include in the results. If not specified, will include all fields. + Available fields see :class:`~azure.appconfiguration.SnapshotFields`. + :paramtype fields: list[str] or list[~azure.appconfiguration.SnapshotFields] or None + :keyword status: Filter results based on snapshot keys. Available status see + :class:`~azure.appconfiguration.SnapshotStatus`. + :paramtype status: list[str] or list[~azure.appconfiguration.SnapshotStatus] or None :return: An iterator of :class:`~azure.appconfiguration.ConfigurationSnapshot` :rtype: ~azure.core.paging.ItemPaged[~azure.appconfiguration.ConfigurationSnapshot] :raises: :class:`~azure.core.exceptions.HttpResponseError` """ - try: - return self._impl.get_snapshots( # type: ignore - name=name, - select=fields, - status=status, - cls=lambda objs: [ConfigurationSnapshot._from_generated(x) for x in objs], - **kwargs, - ) - except binascii.Error: - raise binascii.Error("Connection string secret has incorrect padding") # pylint: disable=raise-missing-from + return self._impl.get_snapshots( # type: ignore[return-value] + name=name, + select=fields, + status=status, + cls=lambda objs: [ConfigurationSnapshot._from_generated(x) for x in objs], + **kwargs, + ) async def update_sync_token(self, token: str) -> None: """Add a sync token to the internal list of tokens. diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/README.md b/sdk/appconfiguration/azure-appconfiguration/samples/README.md index 8afdad6833d86..20d6822474581 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/README.md +++ b/sdk/appconfiguration/azure-appconfiguration/samples/README.md @@ -32,13 +32,16 @@ pip install azure-appconfiguration | File | Description | |-------------|-------------| -| [hello_world_sample.py][hello_world_sample] / [hello_world_sample_async.py][hello_world_sample_async] | demos set/get/delete operations | -| [hello_world_advanced_sample.py][hello_world_advanced_sample] / [hello_world_advanced_sample_async.py][hello_world_advanced_sample_async] | demos add/set with label/list operations | -| [conditional_operation_sample.py][conditional_operation_sample] / [conditional_operation_sample_async.py][conditional_operation_sample_async] | demos conditional set/get/delete operations | -| [read_only_sample.py][read_only_sample] / [read_only_sample_async.py][read_only_sample_async] | demos set_read_only operations | -| [list_revision_sample.py][list_revision_sample] / [list_revision_sample_async.py][list_revision_sample_async] | demos list revision operations | -| [sync_token_samples.py][sync_token_samples] / [sync_token_sample_async.py][sync_token_sample_async] | demos the `update_sync_token` method | -| [snapshot_samples.py][snapshot_samples] / [snapshot_samples_async.py][snapshot_samples_async] | demos create/get/archive/recover/list operations on configuration setting snapshot | +| [hello_world_sample.py][hello_world_sample] / [hello_world_sample_async.py][hello_world_sample_async] | demos how to add/update/retrieve/delete configuration settings | +| [conditional_operation_sample.py][conditional_operation_sample] / [conditional_operation_sample_async.py][conditional_operation_sample_async] | demos how to conditional set/get/delete configuration settings | +| [read_only_sample.py][read_only_sample] / [read_only_sample_async.py][read_only_sample_async] | demos how to set and clear read-only for configuration settings | +| [list_configuration_settings_sample.py][list_configuration_settings_sample] / [list_configuration_settings_sample_async.py][list_configuration_settings_sample_async] | demos how to list configuration settings with optional filters | +| [list_labels_sample.py][list_labels_sample] / [list_labels_sample_async.py][list_labels_sample_async] | demos how to list labels | +| [list_revision_sample.py][list_revision_sample] / [list_revision_sample_async.py][list_revision_sample_async] | demos how to get configuration setting revision history | +| [sync_token_sample.py][sync_token_sample] / [sync_token_sample_async.py][sync_token_sample_async] | demos how to update sync_token for an AzureAppConfigurationClient | +| [snapshot_sample.py][snapshot_sample] / [snapshot_sample_async.py][snapshot_sample_async] | demos how to create/retrieve/archive/recover/list configuration settings snapshot and list configuration settings of a snapshot | +| [send_request_sample.py][send_request_sample] / [send_request_sample_async.py][send_request_sample_async] | demos how to make custom HTTP requests through a client pipeline | + [azure_sub]: https://azure.microsoft.com/free/ @@ -46,15 +49,19 @@ pip install azure-appconfiguration [configuration_store]: https://azure.microsoft.com/services/app-configuration/ [hello_world_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample.py [hello_world_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample_async.py -[hello_world_advanced_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_advanced_sample.py -[hello_world_advanced_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_advanced_sample_async.py [conditional_operation_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample.py [conditional_operation_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample_async.py [read_only_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample.py [read_only_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample_async.py +[list_configuration_settings_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/list_configuration_settings_sample.py +[list_configuration_settings_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/list_configuration_settings_sample_async.py +[list_labels_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/list_labels_sample.py +[list_labels_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/list_labels_sample_async.py [list_revision_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample.py [list_revision_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample_async.py -[sync_token_samples]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_samples.py -[sync_token_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_samples_async.py -[snapshot_samples]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_samples.py -[snapshot_samples_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_samples_async.py +[sync_token_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_sample.py +[sync_token_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_sample_async.py +[snapshot_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_sample.py +[snapshot_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_sample_async.py +[send_request_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample.py +[send_request_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample_async.py diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample.py b/sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample.py index 1d69cdcd16162..981acafbfce14 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample.py @@ -10,7 +10,7 @@ FILE: conditional_operation_sample.py DESCRIPTION: - This sample demos conditional set/get/delete operations for app configuration + This sample demos how to conditional set/get/delete configuration settings synchronously. USAGE: python conditional_operation_sample.py @@ -21,13 +21,12 @@ from azure.core import MatchConditions from azure.core.exceptions import ResourceModifiedError from azure.appconfiguration import AzureAppConfigurationClient, ConfigurationSetting -from util import print_configuration_setting def main(): CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] - # Create app config client + # Create an app config client client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) # Unconditional set @@ -40,13 +39,13 @@ def main(): first_get = client.get_configuration_setting(key="MyKey") if first_get is None: return print("Error, unconditional set failed.") - print_configuration_setting(first_get) + print(first_get) # Conditional get, expect to return None because it is not modified second_get = client.get_configuration_setting( key="MyKey", etag=first_get.etag, match_condition=MatchConditions.IfModified ) - print_configuration_setting(second_get) + print(second_get) # Conditional set first_get.value = "new value" diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample_async.py b/sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample_async.py index 8f8cd9be4916b..e8a0e977d4df5 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample_async.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample_async.py @@ -7,12 +7,12 @@ # -------------------------------------------------------------------------- """ -FILE: conditional_operation_async_sample.py +FILE: conditional_operation_sample_async.py DESCRIPTION: - This sample demos conditional set/get/delete operations for app configuration + This sample demos how to conditional set/get/delete configuration settings asynchronously. -USAGE: python conditional_operation_async_sample.py +USAGE: python conditional_operation_sample_async.py Set the environment variables with your own values before running the sample: 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. @@ -23,13 +23,12 @@ from azure.core.exceptions import ResourceModifiedError from azure.appconfiguration import ConfigurationSetting from azure.appconfiguration.aio import AzureAppConfigurationClient -from util import print_configuration_setting async def main(): CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] - # Create app config client + # Create an app config client client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) # Unconditional set @@ -42,13 +41,13 @@ async def main(): first_get = await client.get_configuration_setting(key="MyKey") if first_get is None: return print("Error, unconditional set failed.") - print_configuration_setting(first_get) + print(first_get) # Conditional get, expect to return None because it is not modified second_get = await client.get_configuration_setting( key="MyKey", etag=first_get.etag, match_condition=MatchConditions.IfModified ) - print_configuration_setting(second_get) + print(second_get) # Conditional set first_get.value = "new value" diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_advanced_sample.py b/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_advanced_sample.py deleted file mode 100644 index bc03c83554f02..0000000000000 --- a/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_advanced_sample.py +++ /dev/null @@ -1,76 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: hello_world_advanced_sample.py - -DESCRIPTION: - This sample demos more advanced scenarios including add/set with label/list operations for app configuration - -USAGE: python hello_world_advanced_sample.py - - Set the environment variables with your own values before running the sample: - 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. -""" -import os -from azure.appconfiguration import AzureAppConfigurationClient, ConfigurationSetting -from util import print_configuration_setting - - -def main(): - CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] - - # Create app config client - client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) - - print("Add new configuration setting") - # [START create_config_setting] - config_setting = ConfigurationSetting( - key="MyKey", label="MyLabel", value="my value", content_type="my content type", tags={"my tag": "my tag value"} - ) - added_config_setting = client.add_configuration_setting(config_setting) - # [END create_config_setting] - print("New configuration setting:") - print_configuration_setting(added_config_setting) - print("") - - print("Set configuration setting") - # [START set_config_setting] - added_config_setting.value = "new value" - added_config_setting.content_type = "new content type" - updated_config_setting = client.set_configuration_setting(added_config_setting) - # [END set_config_setting] - print_configuration_setting(updated_config_setting) - print("") - - print("Get configuration setting") - # [START get_config_setting] - fetched_config_setting = client.get_configuration_setting(key="MyKey", label="MyLabel") - # [END get_config_setting] - print("Fetched configuration setting:") - print_configuration_setting(fetched_config_setting) - print("") - - print("List configuration settings") - # [START list_config_setting] - config_settings = client.list_configuration_settings(label_filter="MyLabel") - for item in config_settings: - print_configuration_setting(item) - # [END list_config_setting] - - print("Delete configuration setting") - # [START delete_config_setting] - client.delete_configuration_setting( - key="MyKey", - label="MyLabel", - ) - # [END delete_config_setting] - - -if __name__ == "__main__": - main() diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_advanced_sample_async.py b/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_advanced_sample_async.py deleted file mode 100644 index 6c84900f056cc..0000000000000 --- a/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_advanced_sample_async.py +++ /dev/null @@ -1,72 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: hello_world_advanced_async_sample.py - -DESCRIPTION: - This sample demos more advanced scenarios including add/set with label/list operations for app configuration - -USAGE: python hello_world_advanced_async_sample.py - - Set the environment variables with your own values before running the sample: - 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. -""" -import asyncio -import os -from azure.appconfiguration import ConfigurationSetting -from azure.appconfiguration.aio import AzureAppConfigurationClient -from util import print_configuration_setting - - -async def main(): - CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] - - # Create app config client - client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) - - print("Add new configuration setting") - config_setting = ConfigurationSetting( - key="MyKey", label="MyLabel", value="my value", content_type="my content type", tags={"my tag": "my tag value"} - ) - added_config_setting = await client.add_configuration_setting(config_setting) - print("New configuration setting:") - print_configuration_setting(added_config_setting) - print("") - - print("Set configuration setting") - added_config_setting.value = "new value" - added_config_setting.content_type = "new content type" - updated_config_setting = await client.set_configuration_setting(added_config_setting) - print_configuration_setting(updated_config_setting) - print("") - - print("Get configuration setting") - # [START get_config_setting] - fetched_config_setting = await client.get_configuration_setting(key="MyKey", label="MyLabel") - # [END get_config_setting] - print("Fetched configuration setting:") - print_configuration_setting(fetched_config_setting) - print("") - - print("List configuration settings") - # [START list_config_setting] - config_settings = client.list_configuration_settings(label_filter="MyLabel") - async for item in config_settings: - print_configuration_setting(item) - # [END list_config_setting] - - print("Delete configuration setting") - await client.delete_configuration_setting( - key="MyKey", - label="MyLabel", - ) - - -if __name__ == "__main__": - asyncio.run(main()) diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample.py b/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample.py index b8e7ca721d84e..431a8bc63e15c 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample.py @@ -10,7 +10,7 @@ FILE: hello_world_sample.py DESCRIPTION: - This sample demos set/get/delete operations for app configuration + This sample demos how to add/update/retrieve/delete configuration settings synchronously. USAGE: python hello_world_sample.py @@ -18,7 +18,6 @@ 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. """ from azure.appconfiguration import ConfigurationSetting -from util import print_configuration_setting def main(): @@ -32,23 +31,38 @@ def main(): client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) # [END create_app_config_client] - print("Set new configuration setting") + print("Add new configuration setting") + # [START create_config_setting] config_setting = ConfigurationSetting( - key="MyKey", value="my value", content_type="my content type", tags={"my tag": "my tag value"} + key="MyKey", label="MyLabel", value="my value", content_type="my content type", tags={"my tag": "my tag value"} ) - returned_config_setting = client.set_configuration_setting(config_setting) + added_config_setting = client.add_configuration_setting(config_setting) + # [END create_config_setting] print("New configuration setting:") - print_configuration_setting(returned_config_setting) + print(added_config_setting) + print("") + + print("Set configuration setting") + # [START set_config_setting] + added_config_setting.value = "new value" + added_config_setting.content_type = "new content type" + updated_config_setting = client.set_configuration_setting(added_config_setting) + # [END set_config_setting] + print(updated_config_setting) print("") print("Get configuration setting") - fetched_config_setting = client.get_configuration_setting(key="MyKey") + # [START get_config_setting] + fetched_config_setting = client.get_configuration_setting(key="MyKey", label="MyLabel") + # [END get_config_setting] print("Fetched configuration setting:") - print_configuration_setting(fetched_config_setting) + print(fetched_config_setting) print("") print("Delete configuration setting") - client.delete_configuration_setting(key="MyKey") + # [START delete_config_setting] + client.delete_configuration_setting(key="MyKey", label="MyLabel") + # [END delete_config_setting] if __name__ == "__main__": diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample_async.py b/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample_async.py index 31a6330b1eba9..216373ee0f069 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample_async.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample_async.py @@ -7,19 +7,18 @@ # -------------------------------------------------------------------------- """ -FILE: hello_world_async_sample.py +FILE: hello_world_sample_async.py DESCRIPTION: - This sample demos set/get/delete operations for app configuration + This sample demos how to add/update/retrieve/delete configuration settings asynchronously. -USAGE: python hello_world_async_sample.py +USAGE: python hello_world_sample_async.py Set the environment variables with your own values before running the sample: 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. """ import asyncio from azure.appconfiguration import ConfigurationSetting -from util import print_configuration_setting async def main(): @@ -29,27 +28,36 @@ async def main(): CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] - # Create app config client + # Create an app config client client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) # [END create_app_config_client] - print("Set new configuration setting") + print("Add new configuration setting") config_setting = ConfigurationSetting( - key="MyKey", value="my value", content_type="my content type", tags={"my tag": "my tag value"} + key="MyKey", label="MyLabel", value="my value", content_type="my content type", tags={"my tag": "my tag value"} ) - returned_config_setting = await client.set_configuration_setting(config_setting) + added_config_setting = await client.add_configuration_setting(config_setting) print("New configuration setting:") - print_configuration_setting(returned_config_setting) + print(added_config_setting) + print("") + + print("Set configuration setting") + added_config_setting.value = "new value" + added_config_setting.content_type = "new content type" + updated_config_setting = await client.set_configuration_setting(added_config_setting) + print(updated_config_setting) print("") print("Get configuration setting") - fetched_config_setting = await client.get_configuration_setting(key="MyKey") + # [START get_config_setting] + fetched_config_setting = await client.get_configuration_setting(key="MyKey", label="MyLabel") + # [END get_config_setting] print("Fetched configuration setting:") - print_configuration_setting(fetched_config_setting) + print(fetched_config_setting) print("") print("Delete configuration setting") - await client.delete_configuration_setting(key="MyKey") + await client.delete_configuration_setting(key="MyKey", label="MyLabel") if __name__ == "__main__": diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/list_configuration_settings_sample.py b/sdk/appconfiguration/azure-appconfiguration/samples/list_configuration_settings_sample.py new file mode 100644 index 0000000000000..8cf04f3fe128c --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration/samples/list_configuration_settings_sample.py @@ -0,0 +1,51 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: list_configuration_settings_sample.py + +DESCRIPTION: + This sample demos how to list configuration settings with optional filters synchronously. + +USAGE: python list_configuration_settings_sample.py + + Set the environment variables with your own values before running the sample: + 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. +""" +import os +from azure.appconfiguration import AzureAppConfigurationClient, ConfigurationSetting + + +def main(): + CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] + + # Create an app config client + client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) + + config_setting1 = ConfigurationSetting( + key="MyKey1", value="my value1", content_type="my content type", tags={"my tag1": "my tag1 value"} + ) + config_setting2 = ConfigurationSetting( + key="MyKey2", value="my value2", content_type="my content type", tags={"my tag2": "my tag2 value"} + ) + client.set_configuration_setting(config_setting1) + client.set_configuration_setting(config_setting2) + + print("List configuration settings") + # [START list_configuration_settings] + config_settings = client.list_configuration_settings(key_filter="MyKey*", tags_filter=["my tag1=my tag1 value"]) + for config_setting in config_settings: + print(config_setting) + # [END list_configuration_settings] + + client.delete_configuration_setting(key="MyKey1") + client.delete_configuration_setting(key="MyKey2") + + +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/list_configuration_settings_sample_async.py b/sdk/appconfiguration/azure-appconfiguration/samples/list_configuration_settings_sample_async.py new file mode 100644 index 0000000000000..27e402ab5b1ff --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration/samples/list_configuration_settings_sample_async.py @@ -0,0 +1,53 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: list_configuration_settings_sample_async.py + +DESCRIPTION: + This sample demos how to list configuration settings with optional filters asynchronously. + +USAGE: python list_configuration_settings_sample_async.py + + Set the environment variables with your own values before running the sample: + 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. +""" +import os +import asyncio +from azure.appconfiguration import ConfigurationSetting +from azure.appconfiguration.aio import AzureAppConfigurationClient + + +async def main(): + CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] + + # Create an app config client + client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) + + config_setting1 = ConfigurationSetting( + key="MyKey1", value="my value1", content_type="my content type", tags={"my tag1": "my tag1 value"} + ) + config_setting2 = ConfigurationSetting( + key="MyKey2", value="my value2", content_type="my content type", tags={"my tag2": "my tag2 value"} + ) + await client.set_configuration_setting(config_setting1) + await client.set_configuration_setting(config_setting2) + + print("List configuration settings") + # [START list_configuration_settings] + config_settings = client.list_configuration_settings(key_filter="MyKey*", tags_filter=["my tag1=my tag1 value"]) + async for config_setting in config_settings: + print(config_setting) + # [END list_configuration_settings] + + await client.delete_configuration_setting(key="MyKey1") + await client.delete_configuration_setting(key="MyKey2") + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/list_labels_sample.py b/sdk/appconfiguration/azure-appconfiguration/samples/list_labels_sample.py new file mode 100644 index 0000000000000..dd6cdd6b91648 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration/samples/list_labels_sample.py @@ -0,0 +1,61 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: list_labels_sample.py + +DESCRIPTION: + This sample demos how to list labels synchronously. + +USAGE: python list_labels_sample.py + + Set the environment variables with your own values before running the sample: + 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. +""" +import os +from azure.appconfiguration import AzureAppConfigurationClient, ConfigurationSetting + + +def main(): + CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] + + # Create an app config client + client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) + + config_setting1 = ConfigurationSetting( + key="MyKey1", label="my label1", content_type="my content type", tags={"my tag1": "my tag1 value"} + ) + config_setting2 = ConfigurationSetting( + key="MyKey2", label="my label2", content_type="my content type", tags={"my tag2": "my tag2 value"} + ) + client.set_configuration_setting(config_setting1) + client.set_configuration_setting(config_setting2) + + # [START list_labels] + print("List all labels in resource") + config_settings = client.list_labels() + for config_setting in config_settings: + print(config_setting) + + print("List labels by exact match") + config_settings = client.list_labels(name="my label1") + for config_setting in config_settings: + print(config_setting) + + print("List labels by wildcard") + config_settings = client.list_labels(name="my label*") + for config_setting in config_settings: + print(config_setting) + # [END list_labels] + + client.delete_configuration_setting(key="MyKey1", label="my label1") + client.delete_configuration_setting(key="MyKey2", label="my label2") + + +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/list_labels_sample_async.py b/sdk/appconfiguration/azure-appconfiguration/samples/list_labels_sample_async.py new file mode 100644 index 0000000000000..d366484454518 --- /dev/null +++ b/sdk/appconfiguration/azure-appconfiguration/samples/list_labels_sample_async.py @@ -0,0 +1,61 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: list_labels_sample_async.py + +DESCRIPTION: + This sample demos how to list labels asynchronously. + +USAGE: python list_labels_sample_async.py + + Set the environment variables with your own values before running the sample: + 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. +""" +import os +import asyncio +from azure.appconfiguration import ConfigurationSetting +from azure.appconfiguration.aio import AzureAppConfigurationClient + + +async def main(): + CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] + + # Create an app config client + client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) + + config_setting1 = ConfigurationSetting( + key="MyKey1", label="my label1", content_type="my content type", tags={"my tag1": "my tag1 value"} + ) + config_setting2 = ConfigurationSetting( + key="MyKey2", label="my label2", content_type="my content type", tags={"my tag2": "my tag2 value"} + ) + await client.set_configuration_setting(config_setting1) + await client.set_configuration_setting(config_setting2) + + print("List all labels in resource") + config_settings = client.list_labels() + async for config_setting in config_settings: + print(config_setting) + + print("List labels by exact match") + config_settings = client.list_labels(name="my label1") + async for config_setting in config_settings: + print(config_setting) + + print("List labels by wildcard") + config_settings = client.list_labels(name="my label*") + async for config_setting in config_settings: + print(config_setting) + + await client.delete_configuration_setting(key="MyKey1", label="my label1") + await client.delete_configuration_setting(key="MyKey2", label="my label2") + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample.py b/sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample.py index 6471a2b20269e..defee06696a8d 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample.py @@ -10,7 +10,7 @@ FILE: list_revision_sample.py DESCRIPTION: - This sample demos list revision operations for app configuration + This sample demos how to get configuration setting revision history synchronously. USAGE: python list_revision_sample.py @@ -19,13 +19,12 @@ """ import os from azure.appconfiguration import AzureAppConfigurationClient, ConfigurationSetting -from util import print_configuration_setting def main(): CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] - # Create app config client + # Create an app config client client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) config_setting = ConfigurationSetting( @@ -37,14 +36,13 @@ def main(): returned_config_setting.content_type = "new content type" client.set_configuration_setting(config_setting) - items = client.list_revisions(key_filter="MyKey") + # [START list_revisions] + items = client.list_revisions(key_filter="MyKey", tags_filter=["my tag=my tag value"]) for item in items: - print_configuration_setting(item) - print("") + print(item) + # [END list_revisions] - client.delete_configuration_setting( - key="MyKey", - ) + client.delete_configuration_setting(key="MyKey") if __name__ == "__main__": diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample_async.py b/sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample_async.py index ff8be954270a7..0ffdc2f387511 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample_async.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample_async.py @@ -7,12 +7,12 @@ # -------------------------------------------------------------------------- """ -FILE: list_revision_async_sample.py +FILE: list_revision_sample_async.py DESCRIPTION: - This sample demos list revision operations for app configuration + This sample demos how to get configuration setting revision history asynchronously. -USAGE: python list_revision_async_sample.py +USAGE: python list_revision_sample_async.py Set the environment variables with your own values before running the sample: 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. @@ -21,13 +21,12 @@ import os from azure.appconfiguration import ConfigurationSetting from azure.appconfiguration.aio import AzureAppConfigurationClient -from util import print_configuration_setting async def main(): CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] - # Create app config client + # Create an app config client client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) config_setting = ConfigurationSetting( @@ -39,14 +38,11 @@ async def main(): returned_config_setting.content_type = "new content type" await client.set_configuration_setting(config_setting) - items = client.list_revisions(key_filter="MyKey") + items = client.list_revisions(key_filter="MyKey", tags_filter=["my tag=my tag value"]) async for item in items: - print_configuration_setting(item) - print("") + print(item) - await client.delete_configuration_setting( - key="MyKey", - ) + await client.delete_configuration_setting(key="MyKey") if __name__ == "__main__": diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample.py b/sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample.py index 7133b042d788c..693fe13194969 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample.py @@ -10,7 +10,7 @@ FILE: read_only_sample.py DESCRIPTION: - This sample demos set_read_only operations for app configuration + This sample demos how to set and clear read-only for configuration settings synchronously. USAGE: python read_only_sample.py @@ -19,38 +19,39 @@ """ import os from azure.appconfiguration import AzureAppConfigurationClient, ConfigurationSetting -from util import print_configuration_setting def main(): CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] - # Create app config client + # Create an app config client client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) print("Set new configuration setting") config_setting = ConfigurationSetting( key="MyKey", value="my value", content_type="my content type", tags={"my tag": "my tag value"} ) - returned_config_setting = client.set_configuration_setting(config_setting) + updated_config_setting = client.set_configuration_setting(config_setting) print("New configuration setting:") - print_configuration_setting(returned_config_setting) + print(updated_config_setting) print("") print("Read only configuration setting:") - read_only_config_setting = client.set_read_only(returned_config_setting) - print_configuration_setting(read_only_config_setting) + # [START set_read_only] + read_only_config_setting = client.set_read_only(updated_config_setting) + # [END set_read_only] + print(read_only_config_setting) print("") print("Clear read only configuration setting:") - read_write_config_setting = client.set_read_only(returned_config_setting, False) - print_configuration_setting(read_write_config_setting) + # [START clear_read_only] + read_write_config_setting = client.set_read_only(updated_config_setting, False) + # [END clear_read_only] + print(read_write_config_setting) print("") print("Delete configuration setting") - client.delete_configuration_setting( - key="MyKey", - ) + client.delete_configuration_setting(key="MyKey") if __name__ == "__main__": diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample_async.py b/sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample_async.py index 632649a03f9dd..46b4137a2fe1b 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample_async.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample_async.py @@ -7,12 +7,12 @@ # -------------------------------------------------------------------------- """ -FILE: read_only_async_sample.py +FILE: read_only_sample_async.py DESCRIPTION: - This sample demos set_read_only operations for app configuration + This sample demos how to set and clear read-only for configuration settings asynchronously. -USAGE: python read_only_async_sample.py +USAGE: python read_only_sample_async.py Set the environment variables with your own values before running the sample: 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. @@ -21,38 +21,35 @@ import os from azure.appconfiguration import ConfigurationSetting from azure.appconfiguration.aio import AzureAppConfigurationClient -from util import print_configuration_setting async def main(): CONNECTION_STRING = os.environ["APPCONFIGURATION_CONNECTION_STRING"] - # Create app config client + # Create an app config client client = AzureAppConfigurationClient.from_connection_string(CONNECTION_STRING) print("Set new configuration setting") config_setting = ConfigurationSetting( key="MyKey", value="my value", content_type="my content type", tags={"my tag": "my tag value"} ) - returned_config_setting = await client.set_configuration_setting(config_setting) + updated_config_setting = await client.set_configuration_setting(config_setting) print("New configuration setting:") - print_configuration_setting(returned_config_setting) + print(updated_config_setting) print("") print("Read only configuration setting:") - read_only_config_setting = await client.set_read_only(returned_config_setting) - print_configuration_setting(read_only_config_setting) + read_only_config_setting = await client.set_read_only(updated_config_setting) + print(read_only_config_setting) print("") print("Clear read only configuration setting:") - read_write_config_setting = await client.set_read_only(returned_config_setting, False) - print_configuration_setting(read_write_config_setting) + read_write_config_setting = await client.set_read_only(updated_config_setting, False) + print(read_write_config_setting) print("") print("Delete configuration setting") - await client.delete_configuration_setting( - key="MyKey", - ) + await client.delete_configuration_setting(key="MyKey") if __name__ == "__main__": diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample.py b/sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample.py index 0593582adcd35..8af04ce58f40f 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample.py @@ -7,13 +7,13 @@ # -------------------------------------------------------------------------- """ -FILE: sample_send_request.py +FILE: send_request_sample.py DESCRIPTION: - This sample demonstrates how to make custom HTTP requests through a client pipeline. + This sample demonstrates how to make custom HTTP requests through a client pipeline synchronously. USAGE: - python sample_send_request.py + python send_request_sample.py Set the environment variables with your own values before running the sample: 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample_async.py b/sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample_async.py index 9e3a4530fb400..2995e74c4f77c 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample_async.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample_async.py @@ -7,13 +7,13 @@ # -------------------------------------------------------------------------- """ -FILE: sample_send_request_async.py +FILE: send_request_sample_async.py DESCRIPTION: - This sample demonstrates how to make custom HTTP requests through a client pipeline. + This sample demonstrates how to make custom HTTP requests through a client pipeline asynchronously. USAGE: - python sample_send_request_async.py + python send_request_sample_async.py Set the environment variables with your own values before running the sample: 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_samples.py b/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_sample.py similarity index 85% rename from sdk/appconfiguration/azure-appconfiguration/samples/snapshot_samples.py rename to sdk/appconfiguration/azure-appconfiguration/samples/snapshot_sample.py index 4ac5e083b501b..833e15969c8fd 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_samples.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_sample.py @@ -7,19 +7,18 @@ # -------------------------------------------------------------------------- """ -FILE: snapshot_samples.py +FILE: snapshot_sample.py DESCRIPTION: - This sample demos CRUD operations for app configuration setting snapshot. + This sample demos how to create/retrieve/archive/recover/list configuration settings snapshot and list configuration settings of a snapshot synchronously. -USAGE: python snapshot_samples.py +USAGE: python snapshot_sample.py Set the environment variables with your own values before running the sample: 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. """ import os from azure.appconfiguration import AzureAppConfigurationClient, ConfigurationSetting -from util import print_configuration_setting, print_snapshot from uuid import uuid4 @@ -38,35 +37,37 @@ def main(): filters = [ConfigurationSettingsFilter(key="my_key1", label="my_label1")] response = client.begin_create_snapshot(name=snapshot_name, filters=filters) created_snapshot = response.result() - print_snapshot(created_snapshot) # [END create_snapshot] + print(created_snapshot) print("") # [START get_snapshot] received_snapshot = client.get_snapshot(name=snapshot_name) # [END get_snapshot] + print(received_snapshot) + print("") # [START archive_snapshot] archived_snapshot = client.archive_snapshot(name=snapshot_name) - print_snapshot(archived_snapshot) # [END archive_snapshot] + print(archived_snapshot) print("") # [START recover_snapshot] recovered_snapshot = client.recover_snapshot(name=snapshot_name) - print_snapshot(recovered_snapshot) # [END recover_snapshot] + print(recovered_snapshot) print("") # [START list_snapshots] for snapshot in client.list_snapshots(): - print_snapshot(snapshot) + print(snapshot) # [END list_snapshots] print("") # [START list_configuration_settings_for_snapshot] for config_setting in client.list_configuration_settings(snapshot_name=snapshot_name): - print_configuration_setting(config_setting) + print(config_setting) # [END list_configuration_settings_for_snapshot] client.delete_configuration_setting(key=config_setting1.key, label=config_setting1.label) diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_samples_async.py b/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_sample_async.py similarity index 67% rename from sdk/appconfiguration/azure-appconfiguration/samples/snapshot_samples_async.py rename to sdk/appconfiguration/azure-appconfiguration/samples/snapshot_sample_async.py index caeab0e828688..e96883a680788 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_samples_async.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/snapshot_sample_async.py @@ -7,12 +7,12 @@ # -------------------------------------------------------------------------- """ -FILE: snapshot_samples_async.py +FILE: snapshot_sample_async.py DESCRIPTION: - This sample demos CRUD operations for app configuration setting snapshot. + This sample demos how to create/retrieve/archive/recover/list configuration settings snapshot and list configuration settings of a snapshot asynchronously. -USAGE: python snapshot_samples_async.py +USAGE: python snapshot_sample_async.py Set the environment variables with your own values before running the sample: 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. @@ -21,7 +21,6 @@ import os from azure.appconfiguration import ConfigurationSetting from azure.appconfiguration.aio import AzureAppConfigurationClient -from util import print_configuration_setting, print_snapshot from uuid import uuid4 @@ -34,43 +33,34 @@ async def main(): await client.add_configuration_setting(config_setting1) await client.add_configuration_setting(config_setting2) - # [START create_snapshot] from azure.appconfiguration import ConfigurationSettingsFilter filters = [ConfigurationSettingsFilter(key="my_key1", label="my_label1")] response = await client.begin_create_snapshot(name=snapshot_name, filters=filters) created_snapshot = await response.result() - print_snapshot(created_snapshot) - # [END create_snapshot] + print(created_snapshot) print("") - # [START get_snapshot] received_snapshot = await client.get_snapshot(name=snapshot_name) - # [END get_snapshot] + print(received_snapshot) print("") - # [START archive_snapshot] archived_snapshot = await client.archive_snapshot(name=snapshot_name) - print_snapshot(archived_snapshot) - # [END archive_snapshot] + print(archived_snapshot) print("") - # [START recover_snapshot] recovered_snapshot = await client.recover_snapshot(name=snapshot_name) - print_snapshot(recovered_snapshot) - # [END recover_snapshot] + print(recovered_snapshot) print("") - # [START list_snapshots] - async for snapshot in client.list_snapshots(): - print_snapshot(snapshot) - # [END list_snapshots] + snapshots = client.list_snapshots() + async for snapshot in snapshots: + print(snapshot) print("") - # [START list_configuration_settings_for_snapshot] - async for config_setting in client.list_configuration_settings(snapshot_name=snapshot_name): - print_configuration_setting(config_setting) - # [END list_configuration_settings_for_snapshot] + config_settings = client.list_configuration_settings(snapshot_name=snapshot_name) + async for config_setting in config_settings: + print(config_setting) await client.delete_configuration_setting(key=config_setting1.key, label=config_setting1.label) await client.delete_configuration_setting(key=config_setting2.key, label=config_setting2.label) diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_samples.py b/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_sample.py similarity index 89% rename from sdk/appconfiguration/azure-appconfiguration/samples/sync_token_samples.py rename to sdk/appconfiguration/azure-appconfiguration/samples/sync_token_sample.py index 7875654718dd2..14ded09f388bf 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_samples.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_sample.py @@ -7,13 +7,13 @@ # -------------------------------------------------------------------------- """ -FILE: sync_token_samples.py +FILE: sync_token_sample.py DESCRIPTION: - This sample demos update_sync_token for the AzureAppConfigurationClient + This sample demos how to update sync_token for an AzureAppConfigurationClient synchronously. -USAGE: python sync_token_samples.py +USAGE: python sync_token_sample.py Set the environment variables with your own values before running the sample: 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_samples_async.py b/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_sample_async.py similarity index 89% rename from sdk/appconfiguration/azure-appconfiguration/samples/sync_token_samples_async.py rename to sdk/appconfiguration/azure-appconfiguration/samples/sync_token_sample_async.py index 4d18b61cddf60..feb44c8a3e29c 100644 --- a/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_samples_async.py +++ b/sdk/appconfiguration/azure-appconfiguration/samples/sync_token_sample_async.py @@ -7,12 +7,12 @@ # -------------------------------------------------------------------------- """ -FILE: sync_token_async_samples.py +FILE: sync_token_sample_async.py DESCRIPTION: - This sample demos update_sync_token for the AzureAppConfigurationClient + This sample demos how to update sync_token for an AzureAppConfigurationClient asynchronously. -USAGE: python sync_token_async_samples.py +USAGE: python sync_token_sample_async.py Set the environment variables with your own values before running the sample: 1) APPCONFIGURATION_CONNECTION_STRING: Connection String used to access the Azure App Configuration. diff --git a/sdk/appconfiguration/azure-appconfiguration/samples/util.py b/sdk/appconfiguration/azure-appconfiguration/samples/util.py deleted file mode 100644 index 888a4a6069e91..0000000000000 --- a/sdk/appconfiguration/azure-appconfiguration/samples/util.py +++ /dev/null @@ -1,35 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - - -def print_configuration_setting(config_setting): - if not config_setting: - return - print(f"key: {config_setting.key}") - print(f"label: {config_setting.label}") - print(f"value: {config_setting.value}") - print(f"read_only: {config_setting.read_only}") - print(f"etag: {config_setting.etag}") - - -def print_snapshot(snapshot): - if not snapshot: - return - print(f"name: {snapshot.name}") - print(f"status: {snapshot.status}") - print("filers: ") - for config_setting_filter in snapshot.filters: - print(f"key: {config_setting_filter.key} label: {config_setting_filter.label}") - print(f"composition_type: {snapshot.composition_type}") - print(f"created: {snapshot.created}") - print(f"expires: {snapshot.expires}") - print(f"retention_period: {snapshot.retention_period}") - print(f"size: {snapshot.size}") - print(f"items_count: {snapshot.items_count}") - print(f"tags: {snapshot.tags}") - print(f"etag: {snapshot.etag}") diff --git a/sdk/appconfiguration/azure-appconfiguration/swagger/README.md b/sdk/appconfiguration/azure-appconfiguration/swagger/README.md index c17c18193e197..6188c6675fe5b 100644 --- a/sdk/appconfiguration/azure-appconfiguration/swagger/README.md +++ b/sdk/appconfiguration/azure-appconfiguration/swagger/README.md @@ -2,7 +2,7 @@ ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/2023-10-01/appconfiguration.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/c1af3ab8e803da2f40fc90217a6d023bc13b677f/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/2023-11-01/appconfiguration.json output-folder: "../azure/appconfiguration/_generated" namespace: azure.appconfiguration no-namespace-folders: true @@ -15,3 +15,21 @@ enable-xml: true vanilla: true version-tolerant: false ``` + +### Rename the enum "KeyValueFields" to "ConfigurationSettingFields" +```yaml +directive: + from: swagger-document + where: $.parameters.KeyValueFields + transform: > + $.items["x-ms-enum"]["name"] = "ConfigurationSettingFields" +``` + +### Rename the enum "CompositionType" to "SnapshotComposition" +```yaml +directive: + from: swagger-document + where: $.definitions.Snapshot.properties + transform: > + $.composition_type["x-ms-enum"].name = "SnapshotComposition" +``` diff --git a/sdk/appconfiguration/azure-appconfiguration/tests/asynctestcase.py b/sdk/appconfiguration/azure-appconfiguration/tests/asynctestcase.py index e11bd953b6f91..822351310db3a 100644 --- a/sdk/appconfiguration/azure-appconfiguration/tests/asynctestcase.py +++ b/sdk/appconfiguration/azure-appconfiguration/tests/asynctestcase.py @@ -25,9 +25,9 @@ async def add_for_test(self, client, config_setting): except ResourceExistsError: pass - async def convert_to_list(self, config_settings: AsyncItemPaged) -> List: + async def convert_to_list(self, items: AsyncItemPaged) -> List: list = [] - async for item in config_settings: + async for item in items: list.append(item) return list diff --git a/sdk/appconfiguration/azure-appconfiguration/tests/conftest.py b/sdk/appconfiguration/azure-appconfiguration/tests/conftest.py index 3b9920310d175..89f6f3d5d19d2 100644 --- a/sdk/appconfiguration/azure-appconfiguration/tests/conftest.py +++ b/sdk/appconfiguration/azure-appconfiguration/tests/conftest.py @@ -43,4 +43,5 @@ def add_sanitizers(test_proxy): # - AZSDK3447: $.key # - AZSDK3490: $..etag # - AZSDK3493: $..name - remove_batch_sanitizers(["AZSDK3447", "AZSDK3490", "AZSDK3493"]) + # - AZSDK4001: host name -> Sanitized + remove_batch_sanitizers(["AZSDK3447", "AZSDK3490", "AZSDK3493", "AZSDK4001"]) diff --git a/sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client.py b/sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client.py index b456c918c2d21..daeb1935e3917 100644 --- a/sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client.py +++ b/sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client.py @@ -14,6 +14,7 @@ ResourceModifiedError, ResourceNotFoundError, ResourceExistsError, + HttpResponseError, ) from azure.core.rest import HttpRequest from azure.appconfiguration import ( @@ -278,6 +279,18 @@ def test_list_configuration_settings_only_key(self, appconfiguration_connection_ assert all(x.key == KEY for x in items) self.tear_down() + @app_config_decorator + @recorded_by_proxy + def test_list_configuration_settings_with_tags_filter(self, appconfiguration_connection_string): + # response header and are missing in python38. + set_custom_default_matcher(compare_bodies=False, excluded_headers="x-ms-content-sha256,x-ms-date") + self.set_up(appconfiguration_connection_string) + items = list(self.client.list_configuration_settings(tags_filter=["tag1=value1"])) + assert len(items) == 1 + assert items[0].key == KEY + assert items[0].label == LABEL + self.tear_down() + @app_config_decorator @recorded_by_proxy def test_list_configuration_settings_fields(self, appconfiguration_connection_string): @@ -436,6 +449,18 @@ def test_list_revisions_key_no_label(self, appconfiguration_connection_string): assert all(x.key == KEY for x in items) self.tear_down() + @app_config_decorator + @recorded_by_proxy + def test_list_revisions_with_tags_filter(self, appconfiguration_connection_string): + # response header and are missing in python38. + set_custom_default_matcher(compare_bodies=False, excluded_headers="x-ms-content-sha256,x-ms-date") + self.set_up(appconfiguration_connection_string) + items = list(self.client.list_revisions(tags_filter=["tag1=value1"])) + assert len(items) >= 1 + assert all(x.key == KEY for x in items) + assert all(x.label == LABEL for x in items) + self.tear_down() + @app_config_decorator @recorded_by_proxy def test_list_revisions_fields(self, appconfiguration_connection_string): @@ -1045,15 +1070,24 @@ def test_list_snapshot_configuration_settings(self, appconfiguration_connection_ # response header and are missing in python38. set_custom_default_matcher(compare_bodies=False, excluded_headers="x-ms-content-sha256,x-ms-date") self.set_up(appconfiguration_connection_string) - snapshot_name = self.get_resource_name("snapshot") + snapshot_name1 = self.get_resource_name("snapshot1") filters = [ConfigurationSettingsFilter(key=KEY, label=LABEL)] - response = self.client.begin_create_snapshot(name=snapshot_name, filters=filters) + response = self.client.begin_create_snapshot(name=snapshot_name1, filters=filters) created_snapshot = response.result() assert created_snapshot.status == "ready" - items = self.client.list_configuration_settings(snapshot_name=snapshot_name) + items = self.client.list_configuration_settings(snapshot_name=snapshot_name1) assert len(list(items)) == 1 + snapshot_name2 = self.get_resource_name("snapshot2") + filters = [ConfigurationSettingsFilter(key=KEY, label=LABEL, tags=["tag1=invalid"])] + response = self.client.begin_create_snapshot(name=snapshot_name2, filters=filters) + created_snapshot = response.result() + assert created_snapshot.status == "ready" + + items = self.client.list_configuration_settings(snapshot_name=snapshot_name2) + assert len(list(items)) == 0 + self.tear_down() @app_config_decorator @@ -1168,6 +1202,31 @@ def test_monitor_configuration_settings_by_page_etag(self, appconfiguration_conn for config_setting in config_settings: client.delete_configuration_setting(key=config_setting.key, label=config_setting.label) + @app_config_decorator + @recorded_by_proxy + def test_list_labels(self, appconfiguration_connection_string): + self.set_up(appconfiguration_connection_string) + + rep = self.client.list_labels() + assert len(list(rep)) >= 2 + + rep = self.client.list_labels(name="test*") + assert len(list(rep)) == 1 + + rep = self.client.list_labels(name="test'@*$!%") + with pytest.raises(HttpResponseError) as error: + rep.next() + assert error.value.status_code == 400 + assert error.value.message == "Operation returned an invalid status 'Bad Request'" + assert ( + '"title":"Invalid request parameter \'label\'","name":"label","detail":"label(6): Invalid character"' + in str(error.value) + ) + + self.tear_down() + rep = self.client.list_labels() + assert len(list(rep)) == 0 + class TestAppConfigurationClientUnitTest: def test_type_error(self): diff --git a/sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client_aad_async.py b/sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client_aad_async.py index c2f17d993b8b8..a57eba58b6066 100644 --- a/sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client_aad_async.py +++ b/sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client_aad_async.py @@ -277,7 +277,7 @@ async def test_list_configuration_settings_reserved_chars(self, appconfiguration assert all(x.label == LABEL_RESERVED_CHARS for x in items) await client.delete_configuration_setting(reserved_char_kv.key) - # NOTE: Label filter does not support wildcard at beginning on filters. https://docs.microsoft.com/en-us/azure/azure-app-configuration/rest-api-key-value#supported-filters + # NOTE: Label filter does not support wildcard at beginning on filters. https://docs.microsoft.com/azure/azure-app-configuration/rest-api-key-value#supported-filters @app_config_aad_decorator_async @recorded_by_proxy_async async def test_list_configuration_settings_contains(self, appconfiguration_endpoint_string): diff --git a/sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client_async.py b/sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client_async.py index 01bc3dc881265..84a5311da9090 100644 --- a/sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client_async.py +++ b/sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client_async.py @@ -14,6 +14,7 @@ ResourceNotFoundError, ResourceExistsError, AzureError, + HttpResponseError, ) from azure.core.rest import HttpRequest from azure.appconfiguration import ( @@ -279,6 +280,18 @@ async def test_list_configuration_settings_only_key(self, appconfiguration_conne assert all(x.key == KEY for x in items) await self.tear_down() + @app_config_decorator_async + @recorded_by_proxy_async + async def test_list_configuration_settings_with_tags_filter(self, appconfiguration_connection_string): + # response header and are missing in python38. + set_custom_default_matcher(compare_bodies=False, excluded_headers="x-ms-content-sha256,x-ms-date") + await self.set_up(appconfiguration_connection_string) + items = await self.convert_to_list(self.client.list_configuration_settings(tags_filter=["tag1=value1"])) + assert len(items) == 1 + assert items[0].key == KEY + assert items[0].label == LABEL + self.tear_down() + @app_config_decorator_async @recorded_by_proxy_async async def test_list_configuration_settings_fields(self, appconfiguration_connection_string): @@ -443,6 +456,18 @@ async def test_list_revisions_key_no_label(self, appconfiguration_connection_str assert all(x.key == KEY for x in items) await self.tear_down() + @app_config_decorator_async + @recorded_by_proxy_async + async def test_list_revisions_with_tags_filter(self, appconfiguration_connection_string): + # response header and are missing in python38. + set_custom_default_matcher(compare_bodies=False, excluded_headers="x-ms-content-sha256,x-ms-date") + await self.set_up(appconfiguration_connection_string) + items = await self.convert_to_list(self.client.list_revisions(tags_filter=["tag1=value1"])) + assert len(items) >= 1 + assert all(x.key == KEY for x in items) + assert all(x.label == LABEL for x in items) + await self.tear_down() + @app_config_decorator_async @recorded_by_proxy_async async def test_list_revisions_fields(self, appconfiguration_connection_string): @@ -1068,15 +1093,24 @@ async def test_list_snapshot_configuration_settings(self, appconfiguration_conne # response header and are missing in python38. set_custom_default_matcher(compare_bodies=False, excluded_headers="x-ms-content-sha256,x-ms-date") await self.set_up(appconfiguration_connection_string) - snapshot_name = self.get_resource_name("snapshot") + snapshot_name1 = self.get_resource_name("snapshot1") filters = [ConfigurationSettingsFilter(key=KEY, label=LABEL)] - response = await self.client.begin_create_snapshot(name=snapshot_name, filters=filters) + response = await self.client.begin_create_snapshot(name=snapshot_name1, filters=filters) created_snapshot = await response.result() assert created_snapshot.status == "ready" - items = await self.convert_to_list(self.client.list_configuration_settings(snapshot_name=snapshot_name)) + items = await self.convert_to_list(self.client.list_configuration_settings(snapshot_name=snapshot_name1)) assert len(items) == 1 + snapshot_name2 = self.get_resource_name("snapshot2") + filters = [ConfigurationSettingsFilter(key=KEY, label=LABEL, tags=["tag1=invalid"])] + response = await self.client.begin_create_snapshot(name=snapshot_name2, filters=filters) + created_snapshot = await response.result() + assert created_snapshot.status == "ready" + + items = await self.convert_to_list(self.client.list_configuration_settings(snapshot_name=snapshot_name2)) + assert len(items) == 0 + await self.tear_down() @app_config_decorator_async @@ -1195,6 +1229,34 @@ async def test_monitor_configuration_settings_by_page_etag(self, appconfiguratio async for config_setting in config_settings: await client.delete_configuration_setting(key=config_setting.key, label=config_setting.label) + @app_config_decorator_async + @recorded_by_proxy_async + async def test_list_labels(self, appconfiguration_connection_string): + await self.set_up(appconfiguration_connection_string) + + rep = await self.convert_to_list(self.client.list_labels()) + assert len(list(rep)) >= 2 + + rep = await self.convert_to_list(self.client.list_labels(name="test*")) + assert len(list(rep)) == 1 + + with pytest.raises(HttpResponseError) as error: + await self.convert_to_list(self.client.list_labels(name="test'@*$!%")) + assert error.value.status_code == 400 + assert error.value.message == "Operation returned an invalid status 'Bad Request'" + assert ( + '"title":"Invalid request parameter \'label\'","name":"label","detail":"label(6): Invalid character"' + in str(error.value) + ) + + config_settings = self.client.list_configuration_settings() + async for config_setting in config_settings: + await self.client.delete_configuration_setting(key=config_setting.key, label=config_setting.label) + rep = await self.convert_to_list(self.client.list_labels()) + assert len(list(rep)) == 0 + + self.client.close() + class TestAppConfigurationClientUnitTest: @pytest.mark.asyncio diff --git a/sdk/appconfiguration/azure-appconfiguration/tests/testcase.py b/sdk/appconfiguration/azure-appconfiguration/tests/testcase.py index ee476f24b3ba3..3241a7a17656b 100644 --- a/sdk/appconfiguration/azure-appconfiguration/tests/testcase.py +++ b/sdk/appconfiguration/azure-appconfiguration/tests/testcase.py @@ -35,7 +35,7 @@ def create_config_setting(self): label=LABEL, value=TEST_VALUE, content_type=TEST_CONTENT_TYPE, - tags={"tag1": "tag1", "tag2": "tag2"}, + tags={"tag1": "value1", "tag2": "value2"}, ) def create_config_setting_no_label(self): @@ -44,7 +44,7 @@ def create_config_setting_no_label(self): label=None, value=TEST_VALUE, content_type=TEST_CONTENT_TYPE, - tags={"tag1": "tag1", "tag2": "tag2"}, + tags={"tag3": "value3", "tag4": "value4"}, ) def add_for_test(self, client, config_setting): diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/pyproject.toml b/sdk/appconfiguration/azure-mgmt-appconfiguration/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md b/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md index ba10466f817a5..cf90210b79ada 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md +++ b/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md @@ -1,5 +1,42 @@ # Release History +## 3.1.0 (2024-08-06) + +### Features Added + + - The 'azure.mgmt.appcontainers.ContainerAppsAPIClient' client method 'get_custom_domain_verification_id' was added in the current version + - The 'azure.mgmt.appcontainers.ContainerAppsAPIClient' client had operation group 'usages' added in the current version + - The 'azure.mgmt.appcontainers.ContainerAppsAPIClient' client had operation group 'managed_environment_usages' added in the current version + - The 'azure.mgmt.appcontainers.aio.ContainerAppsAPIClient' client method 'get_custom_domain_verification_id' was added in the current version + - The 'azure.mgmt.appcontainers.aio.ContainerAppsAPIClient' client had operation group 'usages' added in the current version + - The 'azure.mgmt.appcontainers.aio.ContainerAppsAPIClient' client had operation group 'managed_environment_usages' added in the current version + - The 'azure.mgmt.appcontainers.aio.operations.ContainerAppsAPIClientOperationsMixin' method 'get_custom_domain_verification_id' was added in the current version + - The 'azure.mgmt.appcontainers.aio.operations.JobsOperations' method 'get_detector' was added in the current version + - The 'azure.mgmt.appcontainers.aio.operations.JobsOperations' method 'list_detectors' was added in the current version + - The 'azure.mgmt.appcontainers.aio.operations.JobsOperations' method 'proxy_get' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentUsagesOperations' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.aio.operations.UsagesOperations' was added in the current version + - The 'azure.mgmt.appcontainers.operations.ContainerAppsAPIClientOperationsMixin' method 'get_custom_domain_verification_id' was added in the current version + - The 'azure.mgmt.appcontainers.operations.JobsOperations' method 'get_detector' was added in the current version + - The 'azure.mgmt.appcontainers.operations.JobsOperations' method 'list_detectors' was added in the current version + - The 'azure.mgmt.appcontainers.operations.JobsOperations' method 'proxy_get' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.operations.ManagedEnvironmentUsagesOperations' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.operations.UsagesOperations' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.AuthConfig' had property 'encryption_settings' added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.AvailableWorkloadProfileProperties' had property 'gpus' added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.Ingress' had property 'additional_port_mappings' added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.Login' had property 'token_store' added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.ManagedEnvironment' had property 'peer_traffic_configuration' added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.BlobStorageTokenStore' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.EncryptionSettings' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.IngressPortMapping' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.ListUsagesResult' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.TokenStore' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.Usage' was added in the current version + - The model or publicly exposed class 'azure.mgmt.appcontainers.models.UsageName' was added in the current version + ## 3.1.0b1 (2024-03-18) ### Features Added diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json index 071ce382b1837..bbe75cc919e33 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json +++ b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e5404d3e55f885d2cb8fdbff3fd1a03bcfc6bb4c", + "commit": "c4b33165c43ba9253bb5b36a8c907dbef570bb6f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.7", + "@autorest/python@6.17.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/app/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/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-2024-03 --use=@autorest/python@6.17.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/app/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py index 5f29dcf6e1180..6b5bc3fc56961 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py @@ -26,15 +26,15 @@ class ContainerAppsAPIClientConfiguration: # pylint: disable=too-many-instance- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-02-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-11-02-preview") + api_version: str = kwargs.pop("api_version", "2024-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py index 36b82db88f46c..f39b86b8ebb18 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -18,13 +19,8 @@ from ._configuration import ContainerAppsAPIClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( - AppResiliencyOperations, AvailableWorkloadProfilesOperations, BillingMetersOperations, - BuildAuthTokenOperations, - BuildersOperations, - BuildsByBuilderResourceOperations, - BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, @@ -37,11 +33,7 @@ ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSourceControlsOperations, - DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, - DaprSubscriptionsOperations, - DotNetComponentsOperations, - JavaComponentsOperations, JobsExecutionsOperations, JobsOperations, ManagedCertificatesOperations, @@ -65,8 +57,6 @@ class ContainerAppsAPIClient( ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ContainerAppsAPIClient. - :ivar app_resiliency: AppResiliencyOperations operations - :vartype app_resiliency: azure.mgmt.appcontainers.operations.AppResiliencyOperations :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations :vartype container_apps_auth_configs: azure.mgmt.appcontainers.operations.ContainerAppsAuthConfigsOperations @@ -75,15 +65,6 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.AvailableWorkloadProfilesOperations :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.appcontainers.operations.BillingMetersOperations - :ivar builders: BuildersOperations operations - :vartype builders: azure.mgmt.appcontainers.operations.BuildersOperations - :ivar builds_by_builder_resource: BuildsByBuilderResourceOperations operations - :vartype builds_by_builder_resource: - azure.mgmt.appcontainers.operations.BuildsByBuilderResourceOperations - :ivar builds: BuildsOperations operations - :vartype builds: azure.mgmt.appcontainers.operations.BuildsOperations - :ivar build_auth_token: BuildAuthTokenOperations operations - :vartype build_auth_token: azure.mgmt.appcontainers.operations.BuildAuthTokenOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.operations.ConnectedEnvironmentsOperations @@ -131,13 +112,8 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.ManagedCertificatesOperations :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.appcontainers.operations.NamespacesOperations - :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations - :vartype dapr_component_resiliency_policies: - azure.mgmt.appcontainers.operations.DaprComponentResiliencyPoliciesOperations :ivar dapr_components: DaprComponentsOperations operations :vartype dapr_components: azure.mgmt.appcontainers.operations.DaprComponentsOperations - :ivar dapr_subscriptions: DaprSubscriptionsOperations operations - :vartype dapr_subscriptions: azure.mgmt.appcontainers.operations.DaprSubscriptionsOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.operations.ManagedEnvironmentsStoragesOperations @@ -149,18 +125,14 @@ class ContainerAppsAPIClient( :ivar managed_environment_usages: ManagedEnvironmentUsagesOperations operations :vartype managed_environment_usages: azure.mgmt.appcontainers.operations.ManagedEnvironmentUsagesOperations - :ivar java_components: JavaComponentsOperations operations - :vartype java_components: azure.mgmt.appcontainers.operations.JavaComponentsOperations - :ivar dot_net_components: DotNetComponentsOperations operations - :vartype dot_net_components: azure.mgmt.appcontainers.operations.DotNetComponentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-11-02-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -200,7 +172,6 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.app_resiliency = AppResiliencyOperations(self._client, self._config, self._serialize, self._deserialize) self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -208,12 +179,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.billing_meters = BillingMetersOperations(self._client, self._config, self._serialize, self._deserialize) - self.builders = BuildersOperations(self._client, self._config, self._serialize, self._deserialize) - self.builds_by_builder_resource = BuildsByBuilderResourceOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_auth_token = BuildAuthTokenOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -253,13 +218,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) - self.dapr_component_resiliency_policies = DaprComponentResiliencyPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dapr_subscriptions = DaprSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -270,10 +229,6 @@ def __init__( self.managed_environment_usages = ManagedEnvironmentUsagesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dot_net_components = DotNetComponentsOperations( - self._client, self._config, self._serialize, self._deserialize - ) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -300,7 +255,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "ContainerAppsAPIClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_patch.py index f99e77fef9861..17dbc073e01b9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # 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(): diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py index 2f781d740827a..8139854b97bb8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py @@ -144,6 +144,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -1441,7 +1443,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py index 7f8fe378e76c2..869b8cac8a5ef 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import ContainerAppsAPIClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from ._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class ContainerAppsAPIClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py index 48b05f9c489c5..47babc28d5edf 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0b1" +VERSION = "3.1.0" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py index 079bed7fb5be5..4b656c0dc2705 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py @@ -26,15 +26,15 @@ class ContainerAppsAPIClientConfiguration: # pylint: disable=too-many-instance- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-02-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-11-02-preview") + api_version: str = kwargs.pop("api_version", "2024-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py index 33a91fe8d5ac5..9737997ee424b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -18,13 +19,8 @@ from .._serialization import Deserializer, Serializer from ._configuration import ContainerAppsAPIClientConfiguration from .operations import ( - AppResiliencyOperations, AvailableWorkloadProfilesOperations, BillingMetersOperations, - BuildAuthTokenOperations, - BuildersOperations, - BuildsByBuilderResourceOperations, - BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, @@ -37,11 +33,7 @@ ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSourceControlsOperations, - DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, - DaprSubscriptionsOperations, - DotNetComponentsOperations, - JavaComponentsOperations, JobsExecutionsOperations, JobsOperations, ManagedCertificatesOperations, @@ -65,8 +57,6 @@ class ContainerAppsAPIClient( ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ContainerAppsAPIClient. - :ivar app_resiliency: AppResiliencyOperations operations - :vartype app_resiliency: azure.mgmt.appcontainers.aio.operations.AppResiliencyOperations :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations :vartype container_apps_auth_configs: azure.mgmt.appcontainers.aio.operations.ContainerAppsAuthConfigsOperations @@ -75,15 +65,6 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.AvailableWorkloadProfilesOperations :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.appcontainers.aio.operations.BillingMetersOperations - :ivar builders: BuildersOperations operations - :vartype builders: azure.mgmt.appcontainers.aio.operations.BuildersOperations - :ivar builds_by_builder_resource: BuildsByBuilderResourceOperations operations - :vartype builds_by_builder_resource: - azure.mgmt.appcontainers.aio.operations.BuildsByBuilderResourceOperations - :ivar builds: BuildsOperations operations - :vartype builds: azure.mgmt.appcontainers.aio.operations.BuildsOperations - :ivar build_auth_token: BuildAuthTokenOperations operations - :vartype build_auth_token: azure.mgmt.appcontainers.aio.operations.BuildAuthTokenOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.aio.operations.ConnectedEnvironmentsOperations @@ -131,14 +112,8 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.ManagedCertificatesOperations :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.appcontainers.aio.operations.NamespacesOperations - :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations - :vartype dapr_component_resiliency_policies: - azure.mgmt.appcontainers.aio.operations.DaprComponentResiliencyPoliciesOperations :ivar dapr_components: DaprComponentsOperations operations :vartype dapr_components: azure.mgmt.appcontainers.aio.operations.DaprComponentsOperations - :ivar dapr_subscriptions: DaprSubscriptionsOperations operations - :vartype dapr_subscriptions: - azure.mgmt.appcontainers.aio.operations.DaprSubscriptionsOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsStoragesOperations @@ -150,18 +125,14 @@ class ContainerAppsAPIClient( :ivar managed_environment_usages: ManagedEnvironmentUsagesOperations operations :vartype managed_environment_usages: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentUsagesOperations - :ivar java_components: JavaComponentsOperations operations - :vartype java_components: azure.mgmt.appcontainers.aio.operations.JavaComponentsOperations - :ivar dot_net_components: DotNetComponentsOperations operations - :vartype dot_net_components: azure.mgmt.appcontainers.aio.operations.DotNetComponentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-11-02-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -201,7 +172,6 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.app_resiliency = AppResiliencyOperations(self._client, self._config, self._serialize, self._deserialize) self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -209,12 +179,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.billing_meters = BillingMetersOperations(self._client, self._config, self._serialize, self._deserialize) - self.builders = BuildersOperations(self._client, self._config, self._serialize, self._deserialize) - self.builds_by_builder_resource = BuildsByBuilderResourceOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_auth_token = BuildAuthTokenOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -254,13 +218,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) - self.dapr_component_resiliency_policies = DaprComponentResiliencyPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dapr_subscriptions = DaprSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -271,10 +229,6 @@ def __init__( self.managed_environment_usages = ManagedEnvironmentUsagesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dot_net_components = DotNetComponentsOperations( - self._client, self._config, self._serialize, self._deserialize - ) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any @@ -303,7 +257,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "ContainerAppsAPIClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_patch.py index f99e77fef9861..17dbc073e01b9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # 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(): diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_vendor.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_vendor.py index e2d7a96f702ca..4345e924ce42f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_vendor.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import ContainerAppsAPIClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py index 27819202ef8e5..1d1af7c18205d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py @@ -6,14 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._app_resiliency_operations import AppResiliencyOperations from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations from ._available_workload_profiles_operations import AvailableWorkloadProfilesOperations from ._billing_meters_operations import BillingMetersOperations -from ._builders_operations import BuildersOperations -from ._builds_by_builder_resource_operations import BuildsByBuilderResourceOperations -from ._builds_operations import BuildsOperations -from ._build_auth_token_operations import BuildAuthTokenOperations from ._connected_environments_operations import ConnectedEnvironmentsOperations from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations @@ -32,29 +27,20 @@ from ._certificates_operations import CertificatesOperations from ._managed_certificates_operations import ManagedCertificatesOperations from ._namespaces_operations import NamespacesOperations -from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations from ._dapr_components_operations import DaprComponentsOperations -from ._dapr_subscriptions_operations import DaprSubscriptionsOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations from ._usages_operations import UsagesOperations from ._managed_environment_usages_operations import ManagedEnvironmentUsagesOperations -from ._java_components_operations import JavaComponentsOperations -from ._dot_net_components_operations import DotNetComponentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AppResiliencyOperations", "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", - "BuildersOperations", - "BuildsByBuilderResourceOperations", - "BuildsOperations", - "BuildAuthTokenOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", @@ -73,15 +59,11 @@ "CertificatesOperations", "ManagedCertificatesOperations", "NamespacesOperations", - "DaprComponentResiliencyPoliciesOperations", "DaprComponentsOperations", - "DaprSubscriptionsOperations", "ManagedEnvironmentsStoragesOperations", "ContainerAppsSourceControlsOperations", "UsagesOperations", "ManagedEnvironmentUsagesOperations", - "JavaComponentsOperations", - "DotNetComponentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py deleted file mode 100644 index 6e7c5b2e63bd6..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py +++ /dev/null @@ -1,570 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._app_resiliency_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._vendor import ContainerAppsAPIClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AppResiliencyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s - :attr:`app_resiliency` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create_or_update( - self, - resource_group_name: str, - app_name: str, - name: str, - resiliency_envelope: _models.AppResiliency, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AppResiliency: - """Create or update an application's resiliency policy. - - Create or update container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :param resiliency_envelope: The resiliency policy to create or update. Required. - :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - app_name: str, - name: str, - resiliency_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AppResiliency: - """Create or update an application's resiliency policy. - - Create or update container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :param resiliency_envelope: The resiliency policy to create or update. Required. - :type resiliency_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - app_name: str, - name: str, - resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], - **kwargs: Any - ) -> _models.AppResiliency: - """Create or update an application's resiliency policy. - - Create or update container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :param resiliency_envelope: The resiliency policy to create or update. Is either a - AppResiliency type or a IO[bytes] type. Required. - :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resiliency_envelope, (IOBase, bytes)): - _content = resiliency_envelope - else: - _json = self._serialize.body(resiliency_envelope, "AppResiliency") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - app_name=app_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("AppResiliency", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppResiliency", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - app_name: str, - name: str, - resiliency_envelope: _models.AppResiliency, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AppResiliency: - """Update an application's resiliency policy. - - Update container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :param resiliency_envelope: The resiliency policy to update. Required. - :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - app_name: str, - name: str, - resiliency_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AppResiliency: - """Update an application's resiliency policy. - - Update container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :param resiliency_envelope: The resiliency policy to update. Required. - :type resiliency_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - app_name: str, - name: str, - resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], - **kwargs: Any - ) -> _models.AppResiliency: - """Update an application's resiliency policy. - - Update container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :param resiliency_envelope: The resiliency policy to update. Is either a AppResiliency type or - a IO[bytes] type. Required. - :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resiliency_envelope, (IOBase, bytes)): - _content = resiliency_envelope - else: - _json = self._serialize.body(resiliency_envelope, "AppResiliency") - - _request = build_update_request( - resource_group_name=resource_group_name, - app_name=app_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AppResiliency", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, app_name: str, name: str, **kwargs: Any - ) -> None: - """Delete an application's resiliency policy. - - Delete container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - app_name=app_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) -> _models.AppResiliency: - """Get an application's resiliency policy. - - Get container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - app_name=app_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AppResiliency", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, app_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResiliency"]: - """List an application's resiliency policies. - - List container app resiliency policies. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :return: An iterator like instance of either AppResiliency or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.AppResiliency] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AppResiliencyCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AppResiliencyCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py index e6c4bdb1ac4d6..d4e268c8e17e0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._available_workload_profiles_operations import build_get_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +76,7 @@ def get(self, location: str, **kwargs: Any) -> AsyncIterable["_models.AvailableW api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailableWorkloadProfilesCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +94,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +109,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py index c4cfa44feb19a..5fb56bf3db612 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,17 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._billing_meters_operations import build_get_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +66,7 @@ async def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollect :rtype: ~azure.mgmt.appcontainers.models.BillingMeterCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,7 +87,6 @@ async def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollect headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -99,7 +101,7 @@ async def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollect error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BillingMeterCollection", pipeline_response) + deserialized = self._deserialize("BillingMeterCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py deleted file mode 100644 index 2fb05c7a410f2..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py +++ /dev/null @@ -1,114 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._build_auth_token_operations import build_list_request -from .._vendor import ContainerAppsAPIClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildAuthTokenOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s - :attr:`build_auth_token` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list( - self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any - ) -> _models.BuildToken: - """Gets the token used to connect to the endpoint where source code can be uploaded for a build. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param build_name: The name of a build. Required. - :type build_name: str - :return: BuildToken or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.BuildToken - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BuildToken] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BuildToken", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py deleted file mode 100644 index 1caf40d02969a..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py +++ /dev/null @@ -1,781 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._builders_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) -from .._vendor import ContainerAppsAPIClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s - :attr:`builders` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.BuilderResource"]: - """List BuilderResource resources by subscription ID. - - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuilderCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuilderResource"]: - """List BuilderResource resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuilderCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _models.BuilderResource: - """Get a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BuilderResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> _models.BuilderResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_envelope, (IOBase, bytes)): - _content = builder_envelope - else: - _json = self._serialize.body(builder_envelope, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BuilderResource", pipeline_response) - - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = self._deserialize("BuilderResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: _models.BuilderResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuilderResource]: - """Create or update a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param builder_envelope: Resource create parameters. Required. - :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuilderResource]: - """Create or update a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param builder_envelope: Resource create parameters. Required. - :type builder_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuilderResource]: - """Create or update a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param builder_envelope: Resource create parameters. Is either a BuilderResource type or a - IO[bytes] type. Required. - :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - builder_name=builder_name, - builder_envelope=builder_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.BuilderResource]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.BuilderResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_envelope, (IOBase, bytes)): - _content = builder_envelope - else: - _json = self._serialize.body(builder_envelope, "BuilderResourceUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BuilderResource", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: _models.BuilderResourceUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuilderResource]: - """Update a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param builder_envelope: The resource properties to be updated. Required. - :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuilderResource]: - """Update a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param builder_envelope: The resource properties to be updated. Required. - :type builder_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuilderResource]: - """Update a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param builder_envelope: The resource properties to be updated. Is either a - BuilderResourceUpdate type or a IO[bytes] type. Required. - :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - builder_name=builder_name, - builder_envelope=builder_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, builder_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - builder_name=builder_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py deleted file mode 100644 index ae9dcaa12757b..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py +++ /dev/null @@ -1,140 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._builds_by_builder_resource_operations import build_list_request -from .._vendor import ContainerAppsAPIClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildsByBuilderResourceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s - :attr:`builds_by_builder_resource` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, builder_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildResource"]: - """List BuildResource resources by BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :return: An iterator like instance of either BuildResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuildResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py deleted file mode 100644 index 7ad0aa0094961..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py +++ /dev/null @@ -1,436 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._builds_operations import build_create_or_update_request, build_delete_request, build_get_request -from .._vendor import ContainerAppsAPIClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s - :attr:`builds` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any - ) -> _models.BuildResource: - """Get a BuildResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param build_name: The name of a build. Required. - :type build_name: str - :return: BuildResource or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.BuildResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BuildResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - builder_name: str, - build_name: str, - build_envelope: Union[_models.BuildResource, IO[bytes]], - **kwargs: Any - ) -> _models.BuildResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_envelope, (IOBase, bytes)): - _content = build_envelope - else: - _json = self._serialize.body(build_envelope, "BuildResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BuildResource", pipeline_response) - - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = self._deserialize("BuildResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - builder_name: str, - build_name: str, - build_envelope: _models.BuildResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildResource]: - """Create a BuildResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param build_name: The name of a build. Required. - :type build_name: str - :param build_envelope: Resource create or update parameters. Required. - :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - builder_name: str, - build_name: str, - build_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildResource]: - """Create a BuildResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param build_name: The name of a build. Required. - :type build_name: str - :param build_envelope: Resource create or update parameters. Required. - :type build_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BuildResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - builder_name: str, - build_name: str, - build_envelope: Union[_models.BuildResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildResource]: - """Create a BuildResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param build_name: The name of a build. Required. - :type build_name: str - :param build_envelope: Resource create or update parameters. Is either a BuildResource type or - a IO[bytes] type. Required. - :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either BuildResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - builder_name=builder_name, - build_name=build_name, - build_envelope=build_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BuildResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BuildResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a BuildResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param build_name: The name of a build. Required. - :type build_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - builder_name=builder_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py index 65ea9ecb3f086..08246e05e1faa 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +37,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -304,7 +304,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -342,7 +342,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +356,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +382,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +405,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -515,7 +513,7 @@ async def update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -550,7 +548,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -565,7 +562,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py index 55f2628d5fd26..b54c47d0ef4a2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._connected_environments_certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +37,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -304,7 +304,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -342,7 +342,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +356,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +382,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +405,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -515,7 +513,7 @@ async def update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -550,7 +548,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -565,7 +562,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py index 811b77b377202..fbf413a221352 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._connected_environments_dapr_components_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +37,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -304,7 +304,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +339,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +353,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -380,7 +379,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -403,7 +402,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -440,7 +438,7 @@ async def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -463,7 +461,6 @@ async def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -478,7 +475,7 @@ async def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprSecretsCollection", pipeline_response) + deserialized = self._deserialize("DaprSecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py index c10450558429c..6191edaee4a3f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._connected_environments_operations import ( build_check_name_availability_request, build_create_or_update_request, @@ -42,6 +43,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +88,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Connecte api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironmentCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -116,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -167,7 +170,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironmentCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -201,7 +203,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -246,7 +247,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,7 +269,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -283,7 +283,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,8 +296,8 @@ async def _create_or_update_initial( connected_environment_name: str, environment_envelope: Union[_models.ConnectedEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.ConnectedEnvironment: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -310,7 +310,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectedEnvironment] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -331,10 +331,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -342,15 +342,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,10 +460,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -488,10 +489,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, connected_environment_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +504,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -513,10 +514,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -524,6 +525,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -532,8 +537,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -561,7 +570,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, api_version=api_version, @@ -570,6 +579,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -610,7 +620,7 @@ async def update( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -632,7 +642,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +656,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -740,7 +749,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +783,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -789,7 +797,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py index adb4dbd26349a..70da937ebbc01 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._connected_environments_storages_operations import ( build_create_or_update_request, build_delete_request, @@ -34,6 +33,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +77,7 @@ async def list( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStoragesCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,7 +99,6 @@ async def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +113,7 @@ async def list( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStoragesCollection", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentStoragesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -137,7 +139,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -160,7 +162,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -175,7 +176,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -274,7 +275,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -309,7 +310,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -324,7 +324,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -350,7 +350,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,7 +373,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py index d7aa8aec4ac67..20b35af8390ff 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,25 +18,28 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_api_client_operations import ( build_get_custom_domain_verification_id_request, build_job_execution_request, ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ContainerAppsAPIClientOperationsMixin(ContainerAppsAPIClientMixinABC): + @distributed_trace_async async def job_execution( self, resource_group_name: str, job_name: str, job_execution_name: str, **kwargs: Any @@ -55,7 +59,7 @@ async def job_execution( :rtype: ~azure.mgmt.appcontainers.models.JobExecution :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -78,7 +82,6 @@ async def job_execution( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -93,7 +96,7 @@ async def job_execution( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobExecution", pipeline_response) + deserialized = self._deserialize("JobExecution", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -108,7 +111,7 @@ async def get_custom_domain_verification_id(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -128,7 +131,6 @@ async def get_custom_domain_verification_id(self, **kwargs: Any) -> str: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -143,7 +145,7 @@ async def get_custom_domain_verification_id(self, **kwargs: Any) -> str: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py index 8f13f8bbeac3e..25573af0b0d6f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_auth_configs_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +36,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +86,7 @@ def list_by_container_app( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthConfigCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -167,7 +168,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -190,7 +191,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -205,7 +205,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AuthConfig", pipeline_response) + deserialized = self._deserialize("AuthConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -303,7 +303,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -338,7 +338,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -353,7 +352,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AuthConfig", pipeline_response) + deserialized = self._deserialize("AuthConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -379,7 +378,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -402,7 +401,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py index b57a2ea40dd94..05113d05b56b7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_diagnostics_operations import ( build_get_detector_request, build_get_revision_request, @@ -37,6 +36,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +87,7 @@ def list_detectors( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +169,7 @@ async def get_detector( :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +192,6 @@ async def get_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +206,7 @@ async def get_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Diagnostics", pipeline_response) + deserialized = self._deserialize("Diagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -238,7 +238,7 @@ def list_revisions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RevisionCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +258,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +273,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -323,7 +321,7 @@ async def get_revision( :rtype: ~azure.mgmt.appcontainers.models.Revision :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +344,6 @@ async def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -361,7 +358,7 @@ async def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,11 +380,14 @@ async def get_root(self, resource_group_name: str, container_app_name: str, **kw :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -405,7 +405,6 @@ async def get_root(self, resource_group_name: str, container_app_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -420,7 +419,7 @@ async def get_root(self, resource_group_name: str, container_app_name: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py index 7cc1056bca9f7..73af128a7a962 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_operations import ( build_create_or_update_request, build_delete_request, @@ -46,6 +47,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Containe api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -167,7 +170,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -201,7 +203,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -246,11 +247,14 @@ async def get(self, resource_group_name: str, container_app_name: str, **kwargs: :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -268,7 +272,6 @@ async def get(self, resource_group_name: str, container_app_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -283,7 +286,7 @@ async def get(self, resource_group_name: str, container_app_name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,8 +299,8 @@ async def _create_or_update_initial( container_app_name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> _models.ContainerApp: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -310,7 +313,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -331,10 +334,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -342,15 +345,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -463,10 +466,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -491,10 +495,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -506,7 +510,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -516,10 +520,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -527,6 +531,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -535,8 +543,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -564,7 +576,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, container_app_name=container_app_name, api_version=api_version, @@ -573,6 +585,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -602,8 +615,8 @@ async def _update_initial( container_app_name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ContainerApp]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -616,7 +629,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -637,10 +650,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -648,18 +661,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -771,10 +786,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -815,7 +831,7 @@ async def list_custom_host_name_analysis( :rtype: ~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -838,7 +854,6 @@ async def list_custom_host_name_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -853,7 +868,7 @@ async def list_custom_host_name_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -877,7 +892,7 @@ async def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.SecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -899,7 +914,6 @@ async def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -914,7 +928,7 @@ async def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecretsCollection", pipeline_response) + deserialized = self._deserialize("SecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -938,11 +952,14 @@ async def get_auth_token( :rtype: ~azure.mgmt.appcontainers.models.ContainerAppAuthToken :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -960,7 +977,6 @@ async def get_auth_token( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -975,7 +991,7 @@ async def get_auth_token( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerAppAuthToken", pipeline_response) + deserialized = self._deserialize("ContainerAppAuthToken", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -984,8 +1000,8 @@ async def get_auth_token( async def _start_initial( self, resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> Optional[_models.ContainerApp]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -997,7 +1013,7 @@ async def _start_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -1007,10 +1023,10 @@ async def _start_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1018,18 +1034,20 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1071,10 +1089,11 @@ async def begin_start( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1100,8 +1119,8 @@ def get_long_running_output(pipeline_response): async def _stop_initial( self, resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> Optional[_models.ContainerApp]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1113,7 +1132,7 @@ async def _stop_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -1123,10 +1142,10 @@ async def _stop_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1134,18 +1153,20 @@ async def _stop_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1187,10 +1208,11 @@ async def begin_stop( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py index dfb01b7039785..7657e4cccb210 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,20 +18,22 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_revision_replicas_operations import ( build_get_replica_request, build_list_replicas_request, ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +78,7 @@ async def get_replica( :rtype: ~azure.mgmt.appcontainers.models.Replica :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,7 +102,6 @@ async def get_replica( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -114,7 +116,7 @@ async def get_replica( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Replica", pipeline_response) + deserialized = self._deserialize("Replica", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -140,7 +142,7 @@ async def list_replicas( :rtype: ~azure.mgmt.appcontainers.models.ReplicaCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,7 +165,6 @@ async def list_replicas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +179,7 @@ async def list_replicas( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ReplicaCollection", pipeline_response) + deserialized = self._deserialize("ReplicaCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py index ef844779c0802..08a0379c363c4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_revisions_operations import ( build_activate_revision_request, build_deactivate_revision_request, @@ -37,6 +36,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +88,7 @@ def list_revisions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RevisionCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -170,7 +171,7 @@ async def get_revision( :rtype: ~azure.mgmt.appcontainers.models.Revision :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,7 +194,6 @@ async def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -208,7 +208,7 @@ async def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -234,7 +234,7 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +257,6 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -294,7 +293,7 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -317,7 +316,6 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +352,7 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,7 +375,6 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py index f478e444bdc19..43a0e201411ff 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_source_controls_operations import ( build_create_or_update_request, build_delete_request, @@ -39,6 +40,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ def list_by_container_app( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -104,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +124,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -169,7 +172,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,7 +195,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -207,7 +209,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -221,8 +223,8 @@ async def _create_or_update_initial( source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SourceControl: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -235,7 +237,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -257,10 +259,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -268,15 +270,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -401,10 +403,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -426,10 +429,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +444,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -452,10 +455,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -463,12 +466,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -498,7 +509,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, @@ -508,6 +519,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py deleted file mode 100644 index 94f079c80704c..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py +++ /dev/null @@ -1,451 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._dapr_component_resiliency_policies_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._vendor import ContainerAppsAPIClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DaprComponentResiliencyPoliciesOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s - :attr:`dapr_component_resiliency_policies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, environment_name: str, component_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DaprComponentResiliencyPolicy"]: - """Get the resiliency policies for a Dapr component. - - Get the resiliency policies for a Dapr component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param component_name: Name of the Dapr Component. Required. - :type component_name: str - :return: An iterator like instance of either DaprComponentResiliencyPolicy or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DaprComponentResiliencyPoliciesCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - component_name=component_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DaprComponentResiliencyPoliciesCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any - ) -> _models.DaprComponentResiliencyPolicy: - """Get a Dapr component resiliency policy. - - Get a Dapr component resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param component_name: Name of the Dapr Component. Required. - :type component_name: str - :param name: Name of the Dapr Component Resiliency Policy. Required. - :type name: str - :return: DaprComponentResiliencyPolicy or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - component_name=component_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - environment_name: str, - component_name: str, - name: str, - dapr_component_resiliency_policy_envelope: _models.DaprComponentResiliencyPolicy, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DaprComponentResiliencyPolicy: - """Creates or updates a Dapr component resiliency policy. - - Creates or updates a resiliency policy for a Dapr component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param component_name: Name of the Dapr Component. Required. - :type component_name: str - :param name: Name of the Dapr Component Resiliency Policy. Required. - :type name: str - :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component - Resiliency Policy. Required. - :type dapr_component_resiliency_policy_envelope: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DaprComponentResiliencyPolicy or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - environment_name: str, - component_name: str, - name: str, - dapr_component_resiliency_policy_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DaprComponentResiliencyPolicy: - """Creates or updates a Dapr component resiliency policy. - - Creates or updates a resiliency policy for a Dapr component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param component_name: Name of the Dapr Component. Required. - :type component_name: str - :param name: Name of the Dapr Component Resiliency Policy. Required. - :type name: str - :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component - Resiliency Policy. Required. - :type dapr_component_resiliency_policy_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DaprComponentResiliencyPolicy or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - environment_name: str, - component_name: str, - name: str, - dapr_component_resiliency_policy_envelope: Union[_models.DaprComponentResiliencyPolicy, IO[bytes]], - **kwargs: Any - ) -> _models.DaprComponentResiliencyPolicy: - """Creates or updates a Dapr component resiliency policy. - - Creates or updates a resiliency policy for a Dapr component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param component_name: Name of the Dapr Component. Required. - :type component_name: str - :param name: Name of the Dapr Component Resiliency Policy. Required. - :type name: str - :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component - Resiliency Policy. Is either a DaprComponentResiliencyPolicy type or a IO[bytes] type. - Required. - :type dapr_component_resiliency_policy_envelope: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy or IO[bytes] - :return: DaprComponentResiliencyPolicy or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dapr_component_resiliency_policy_envelope, (IOBase, bytes)): - _content = dapr_component_resiliency_policy_envelope - else: - _json = self._serialize.body(dapr_component_resiliency_policy_envelope, "DaprComponentResiliencyPolicy") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - component_name=component_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any - ) -> None: - """Delete a Dapr component resiliency policy. - - Delete a resiliency policy for a Dapr component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param component_name: Name of the Dapr Component. Required. - :type component_name: str - :param name: Name of the Dapr Component Resiliency Policy. Required. - :type name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - component_name=component_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py index e083a4e5b17b8..8af3e37345a3a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._dapr_components_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +37,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -304,7 +304,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +339,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +353,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -380,7 +379,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -403,7 +402,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -440,7 +438,7 @@ async def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -463,7 +461,6 @@ async def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -478,7 +475,7 @@ async def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprSecretsCollection", pipeline_response) + deserialized = self._deserialize("DaprSecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py deleted file mode 100644 index 54b4c58c64408..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py +++ /dev/null @@ -1,427 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._dapr_subscriptions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._vendor import ContainerAppsAPIClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DaprSubscriptionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s - :attr:`dapr_subscriptions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, environment_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DaprSubscription"]: - """Get the Dapr subscriptions for a managed environment. - - Get the Dapr subscriptions for a managed environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :return: An iterator like instance of either DaprSubscription or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprSubscription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DaprSubscriptionsCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DaprSubscriptionsCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> _models.DaprSubscription: - """Get a dapr subscription. - - Get a dapr subscription. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Dapr subscription. Required. - :type name: str - :return: DaprSubscription or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DaprSubscription", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dapr_subscription_envelope: _models.DaprSubscription, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DaprSubscription: - """Creates or updates a Dapr subscription. - - Creates or updates a Dapr subscription in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Dapr subscription. Required. - :type name: str - :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. - :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DaprSubscription or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dapr_subscription_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DaprSubscription: - """Creates or updates a Dapr subscription. - - Creates or updates a Dapr subscription in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Dapr subscription. Required. - :type name: str - :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. - :type dapr_subscription_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DaprSubscription or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dapr_subscription_envelope: Union[_models.DaprSubscription, IO[bytes]], - **kwargs: Any - ) -> _models.DaprSubscription: - """Creates or updates a Dapr subscription. - - Creates or updates a Dapr subscription in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Dapr subscription. Required. - :type name: str - :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Is either a - DaprSubscription type or a IO[bytes] type. Required. - :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription or - IO[bytes] - :return: DaprSubscription or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dapr_subscription_envelope, (IOBase, bytes)): - _content = dapr_subscription_envelope - else: - _json = self._serialize.body(dapr_subscription_envelope, "DaprSubscription") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("DaprSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DaprSubscription", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> None: - """Delete a Dapr subscription. - - Delete a Dapr subscription from a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Dapr subscription. Required. - :type name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py deleted file mode 100644 index a2794217eb513..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py +++ /dev/null @@ -1,751 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._dot_net_components_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._vendor import ContainerAppsAPIClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DotNetComponentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s - :attr:`dot_net_components` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, environment_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DotNetComponent"]: - """Get the .NET Components for a managed environment. - - Get the .NET Components for a managed environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :return: An iterator like instance of either DotNetComponent or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DotNetComponentsCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DotNetComponentsCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> _models.DotNetComponent: - """Get a .NET Component. - - Get a .NET Component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :return: DotNetComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DotNetComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DotNetComponent", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], - **kwargs: Any - ) -> _models.DotNetComponent: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dot_net_component_envelope, (IOBase, bytes)): - _content = dot_net_component_envelope - else: - _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("DotNetComponent", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DotNetComponent", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: _models.DotNetComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DotNetComponent]: - """Creates or updates a .NET Component. - - Creates or updates a .NET Component in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :param dot_net_component_envelope: Configuration details of the .NET Component. Required. - :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DotNetComponent]: - """Creates or updates a .NET Component. - - Creates or updates a .NET Component in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :param dot_net_component_envelope: Configuration details of the .NET Component. Required. - :type dot_net_component_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DotNetComponent]: - """Creates or updates a .NET Component. - - Creates or updates a .NET Component in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a - DotNetComponent type or a IO[bytes] type. Required. - :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - dot_net_component_envelope=dot_net_component_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DotNetComponent", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DotNetComponent].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DotNetComponent]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.DotNetComponent]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.DotNetComponent]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dot_net_component_envelope, (IOBase, bytes)): - _content = dot_net_component_envelope - else: - _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") - - _request = build_update_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("DotNetComponent", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: _models.DotNetComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DotNetComponent]: - """Update properties of a .NET Component. - - Patches a .NET Component using JSON Merge Patch. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :param dot_net_component_envelope: Configuration details of the .NET Component. Required. - :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DotNetComponent]: - """Update properties of a .NET Component. - - Patches a .NET Component using JSON Merge Patch. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :param dot_net_component_envelope: Configuration details of the .NET Component. Required. - :type dot_net_component_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DotNetComponent]: - """Update properties of a .NET Component. - - Patches a .NET Component using JSON Merge Patch. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a - DotNetComponent type or a IO[bytes] type. Required. - :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - dot_net_component_envelope=dot_net_component_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DotNetComponent", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DotNetComponent].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DotNetComponent]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a .NET Component. - - Delete a .NET Component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py deleted file mode 100644 index 3c1d14fee1e57..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py +++ /dev/null @@ -1,750 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._java_components_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._vendor import ContainerAppsAPIClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class JavaComponentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s - :attr:`java_components` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, environment_name: str, **kwargs: Any - ) -> AsyncIterable["_models.JavaComponent"]: - """Get the Java Components for a managed environment. - - Get the Java Components for a managed environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :return: An iterator like instance of either JavaComponent or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.JavaComponentsCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("JavaComponentsCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> _models.JavaComponent: - """Get a Java Component. - - Get a Java Component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :return: JavaComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.JavaComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("JavaComponent", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: Union[_models.JavaComponent, IO[bytes]], - **kwargs: Any - ) -> _models.JavaComponent: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(java_component_envelope, (IOBase, bytes)): - _content = java_component_envelope - else: - _json = self._serialize.body(java_component_envelope, "JavaComponent") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("JavaComponent", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("JavaComponent", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: _models.JavaComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.JavaComponent]: - """Creates or updates a Java Component. - - Creates or updates a Java Component in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :param java_component_envelope: Configuration details of the Java Component. Required. - :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.JavaComponent]: - """Creates or updates a Java Component. - - Creates or updates a Java Component in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :param java_component_envelope: Configuration details of the Java Component. Required. - :type java_component_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: Union[_models.JavaComponent, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.JavaComponent]: - """Creates or updates a Java Component. - - Creates or updates a Java Component in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :param java_component_envelope: Configuration details of the Java Component. Is either a - JavaComponent type or a IO[bytes] type. Required. - :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] - :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - java_component_envelope=java_component_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JavaComponent", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.JavaComponent].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.JavaComponent]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: Union[_models.JavaComponent, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.JavaComponent]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.JavaComponent]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(java_component_envelope, (IOBase, bytes)): - _content = java_component_envelope - else: - _json = self._serialize.body(java_component_envelope, "JavaComponent") - - _request = build_update_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("JavaComponent", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: _models.JavaComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.JavaComponent]: - """Update properties of a Java Component. - - Patches a Java Component using JSON Merge Patch. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :param java_component_envelope: Configuration details of the Java Component. Required. - :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.JavaComponent]: - """Update properties of a Java Component. - - Patches a Java Component using JSON Merge Patch. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :param java_component_envelope: Configuration details of the Java Component. Required. - :type java_component_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: Union[_models.JavaComponent, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.JavaComponent]: - """Update properties of a Java Component. - - Patches a Java Component using JSON Merge Patch. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :param java_component_envelope: Configuration details of the Java Component. Is either a - JavaComponent type or a IO[bytes] type. Required. - :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] - :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - java_component_envelope=java_component_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JavaComponent", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.JavaComponent].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.JavaComponent]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Java Component. - - Delete a Java Component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py index 772caa7189f7c..315e67ddf9b23 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._jobs_executions_operations import build_list_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +81,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppJobExecutions] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -114,7 +116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py index 22276b34a13d6..b6fa273f0f714 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._jobs_operations import ( build_create_or_update_request, build_delete_request, @@ -48,6 +49,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,10 +76,10 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def list_detectors( + @distributed_trace + def list_detectors( self, resource_group_name: str, job_name: str, **kwargs: Any - ) -> _models.DiagnosticsCollection: + ) -> AsyncIterable["_models.Diagnostics"]: """Get the list of diagnostics for a given Container App Job. Get the list of diagnostics for a Container App Job. @@ -84,11 +89,17 @@ async def list_detectors( :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str - :return: DiagnosticsCollection or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection + :return: An iterator like instance of either Diagnostics or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Diagnostics] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,41 +107,60 @@ async def list_detectors( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) + _request = build_list_detectors_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_list_detectors_request( - resource_group_name=resource_group_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async async def get_detector( @@ -151,7 +181,7 @@ async def get_detector( :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -174,7 +204,6 @@ async def get_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -189,7 +218,7 @@ async def get_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Diagnostics", pipeline_response) + deserialized = self._deserialize("Diagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -197,8 +226,8 @@ async def get_detector( return deserialized # type: ignore @distributed_trace_async - async def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.Job: - """Get the properties for a given Container App Job. + async def proxy_get(self, resource_group_name: str, job_name: str, api_name: str, **kwargs: Any) -> _models.Job: + """Get the properties of a Container App Job. Get the properties of a Container App Job. @@ -207,11 +236,13 @@ async def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str + :param api_name: Proxy API Name for Container App Job. Required. + :type api_name: str :return: Job or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Job :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,20 +253,18 @@ async def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_name: Literal["rootApi"] = kwargs.pop("api_name", "rootApi") api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Job] = kwargs.pop("cls", None) _request = build_proxy_get_request( resource_group_name=resource_group_name, job_name=job_name, - subscription_id=self._config.subscription_id, api_name=api_name, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -250,7 +279,7 @@ async def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -273,7 +302,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Job"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -290,7 +319,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -306,7 +334,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -355,7 +382,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,7 +400,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -389,7 +415,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -434,7 +459,7 @@ async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ :rtype: ~azure.mgmt.appcontainers.models.Job :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -456,7 +481,6 @@ async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -471,7 +495,7 @@ async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -480,8 +504,8 @@ async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ async def _create_or_update_initial( self, resource_group_name: str, job_name: str, job_envelope: Union[_models.Job, IO[bytes]], **kwargs: Any - ) -> _models.Job: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -494,7 +518,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Job] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -515,10 +539,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -526,15 +550,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Job", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Job", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -640,10 +664,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -668,10 +693,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, job_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -683,7 +706,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -693,10 +716,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -704,6 +727,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -712,8 +739,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -739,7 +770,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, job_name=job_name, api_version=api_version, @@ -748,6 +779,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -777,8 +809,8 @@ async def _update_initial( job_name: str, job_envelope: Union[_models.JobPatchProperties, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Job]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -791,7 +823,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Job]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -812,10 +844,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -823,18 +855,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Job", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -943,10 +977,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -974,8 +1009,8 @@ async def _start_initial( job_name: str, template: Optional[Union[_models.JobExecutionTemplate, IO[bytes]]] = None, **kwargs: Any - ) -> Optional[_models.JobExecutionBase]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -988,7 +1023,7 @@ async def _start_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.JobExecutionBase]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1012,10 +1047,10 @@ async def _start_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1023,18 +1058,20 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("JobExecutionBase", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1146,10 +1183,11 @@ async def begin_start( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JobExecutionBase", pipeline_response) + deserialized = self._deserialize("JobExecutionBase", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1173,10 +1211,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _stop_execution_initial( # pylint: disable=inconsistent-return-statements + async def _stop_execution_initial( self, resource_group_name: str, job_name: str, job_execution_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1188,7 +1226,7 @@ async def _stop_execution_initial( # pylint: disable=inconsistent-return-statem _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_execution_request( resource_group_name=resource_group_name, @@ -1199,10 +1237,10 @@ async def _stop_execution_initial( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1210,6 +1248,10 @@ async def _stop_execution_initial( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1218,8 +1260,12 @@ async def _stop_execution_initial( # pylint: disable=inconsistent-return-statem if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_stop_execution( @@ -1249,7 +1295,7 @@ async def begin_stop_execution( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._stop_execution_initial( # type: ignore + raw_result = await self._stop_execution_initial( resource_group_name=resource_group_name, job_name=job_name, job_execution_name=job_execution_name, @@ -1259,6 +1305,7 @@ async def begin_stop_execution( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1284,8 +1331,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _stop_multiple_executions_initial( self, resource_group_name: str, job_name: str, **kwargs: Any - ) -> Optional[_models.ContainerAppJobExecutions]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1297,7 +1344,7 @@ async def _stop_multiple_executions_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ContainerAppJobExecutions]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_multiple_executions_request( resource_group_name=resource_group_name, @@ -1307,10 +1354,10 @@ async def _stop_multiple_executions_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1318,18 +1365,20 @@ async def _stop_multiple_executions_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1372,10 +1421,11 @@ async def begin_stop_multiple_executions( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response) + deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1416,7 +1466,7 @@ async def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.JobSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1438,7 +1488,6 @@ async def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1453,7 +1502,7 @@ async def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobSecretsCollection", pipeline_response) + deserialized = self._deserialize("JobSecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py index 3b252ae030d20..48dd8d1cb1476 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._managed_certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -40,6 +41,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -120,7 +124,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = self._deserialize("ManagedCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -134,13 +138,16 @@ async def _create_or_update_initial( managed_certificate_name: str, managed_certificate_envelope: Optional[Union[_models.ManagedCertificate, IO[bytes]]] = None, **kwargs: Any - ) -> _models.ManagedCertificate: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 400: lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), + 400: cast( + Type[HttpResponseError], + lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -149,7 +156,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedCertificate] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -174,10 +181,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -185,15 +192,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ManagedCertificate", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,10 +326,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = self._deserialize("ManagedCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -366,7 +374,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -389,7 +397,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -501,7 +508,7 @@ async def update( :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -536,7 +543,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -551,7 +557,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = self._deserialize("ManagedCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -582,7 +588,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedCertificateCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -601,7 +607,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -617,7 +622,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py index 7a7bc78871dc8..f7d05ad4b0fcf 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,20 +18,22 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._managed_environment_diagnostics_operations import ( build_get_detector_request, build_list_detectors_request, ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +74,7 @@ async def list_detectors( :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +96,6 @@ async def list_detectors( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -108,7 +110,7 @@ async def list_detectors( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) + deserialized = self._deserialize("DiagnosticsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -134,7 +136,7 @@ async def get_detector( :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +159,6 @@ async def get_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -172,7 +173,7 @@ async def get_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Diagnostics", pipeline_response) + deserialized = self._deserialize("Diagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py index bad1c1fbb2c01..32e5aba171df0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._managed_environment_usages_operations import build_list_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +75,7 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +94,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +109,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py index 898eb2987a588..72e6fae60a64d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,17 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._managed_environments_diagnostics_operations import build_get_root_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +71,7 @@ async def get_root( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +93,6 @@ async def get_root( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -105,7 +107,7 @@ async def get_root( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py index 95cc9648f12fb..7cec22ada4f3a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._managed_environments_operations import ( build_create_or_update_request, build_delete_request, @@ -43,6 +44,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +88,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ManagedE api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironmentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -116,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -168,7 +171,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironmentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +189,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -202,7 +204,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -247,7 +248,7 @@ async def get(self, resource_group_name: str, environment_name: str, **kwargs: A :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +270,6 @@ async def get(self, resource_group_name: str, environment_name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -284,7 +284,7 @@ async def get(self, resource_group_name: str, environment_name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -297,8 +297,8 @@ async def _create_or_update_initial( environment_name: str, environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.ManagedEnvironment: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -311,7 +311,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedEnvironment] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -332,10 +332,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -343,15 +343,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,10 +464,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -489,10 +490,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, environment_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +505,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -514,10 +515,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -525,12 +526,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -558,7 +567,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, environment_name=environment_name, api_version=api_version, @@ -567,6 +576,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -594,8 +604,8 @@ async def _update_initial( environment_name: str, environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ManagedEnvironment]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -608,7 +618,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ManagedEnvironment]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -629,10 +639,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -640,13 +650,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -759,10 +771,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -801,7 +814,7 @@ async def get_auth_token( :rtype: ~azure.mgmt.appcontainers.models.EnvironmentAuthToken :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -823,7 +836,6 @@ async def get_auth_token( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -838,7 +850,7 @@ async def get_auth_token( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EnvironmentAuthToken", pipeline_response) + deserialized = self._deserialize("EnvironmentAuthToken", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -870,7 +882,7 @@ def list_workload_profile_states( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkloadProfileStatesCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -889,7 +901,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -905,7 +916,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py index c70d7e6a5626c..6cba2a4bde272 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._managed_environments_storages_operations import ( build_create_or_update_request, build_delete_request, @@ -34,6 +33,10 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +77,7 @@ async def list( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStoragesCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,7 +99,6 @@ async def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +113,7 @@ async def list( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironmentStoragesCollection", pipeline_response) + deserialized = self._deserialize("ManagedEnvironmentStoragesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -137,7 +139,7 @@ async def get( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -160,7 +162,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -175,7 +176,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -273,7 +274,7 @@ async def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -308,7 +309,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -323,7 +323,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -349,7 +349,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +372,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py index c95740bbf0b1f..cc4441b9b1048 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._namespaces_operations import build_check_name_availability_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -136,7 +139,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -170,7 +173,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -185,7 +187,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py index 560fc6a10fe14..eede32e9e7529 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -100,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py index e882d2283742b..be6430b54a7ce 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_request from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +73,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -88,7 +91,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -104,7 +106,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py index d81009d3ad022..132ece90cb50e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py @@ -8,11 +8,8 @@ from ._models_py3 import AllowedAudiencesValidation from ._models_py3 import AllowedPrincipals -from ._models_py3 import AppInsightsConfiguration from ._models_py3 import AppLogsConfiguration from ._models_py3 import AppRegistration -from ._models_py3 import AppResiliency -from ._models_py3 import AppResiliencyCollection from ._models_py3 import Apple from ._models_py3 import AppleRegistration from ._models_py3 import AuthConfig @@ -35,21 +32,12 @@ from ._models_py3 import BillingMeterCollection from ._models_py3 import BillingMeterProperties from ._models_py3 import BlobStorageTokenStore -from ._models_py3 import BuildCollection -from ._models_py3 import BuildConfiguration -from ._models_py3 import BuildResource -from ._models_py3 import BuildToken -from ._models_py3 import BuilderCollection -from ._models_py3 import BuilderResource -from ._models_py3 import BuilderResourceUpdate from ._models_py3 import Certificate from ._models_py3 import CertificateCollection -from ._models_py3 import CertificateKeyVaultProperties from ._models_py3 import CertificatePatch from ._models_py3 import CertificateProperties from ._models_py3 import CheckNameAvailabilityRequest from ._models_py3 import CheckNameAvailabilityResponse -from ._models_py3 import CircuitBreakerPolicy from ._models_py3 import ClientRegistration from ._models_py3 import Configuration from ._models_py3 import ConnectedEnvironment @@ -67,8 +55,6 @@ from ._models_py3 import ContainerAppProbeHttpGetHttpHeadersItem from ._models_py3 import ContainerAppProbeTcpSocket from ._models_py3 import ContainerAppSecret -from ._models_py3 import ContainerRegistry -from ._models_py3 import ContainerRegistryWithCustomImage from ._models_py3 import ContainerResources from ._models_py3 import CookieExpiration from ._models_py3 import CorsPolicy @@ -81,31 +67,15 @@ from ._models_py3 import CustomScaleRule from ._models_py3 import Dapr from ._models_py3 import DaprComponent -from ._models_py3 import DaprComponentResiliencyPoliciesCollection -from ._models_py3 import DaprComponentResiliencyPolicy -from ._models_py3 import DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration -from ._models_py3 import DaprComponentResiliencyPolicyConfiguration -from ._models_py3 import DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration -from ._models_py3 import DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration -from ._models_py3 import DaprComponentResiliencyPolicyTimeoutPolicyConfiguration -from ._models_py3 import DaprComponentServiceBinding from ._models_py3 import DaprComponentsCollection from ._models_py3 import DaprConfiguration from ._models_py3 import DaprMetadata from ._models_py3 import DaprSecret from ._models_py3 import DaprSecretsCollection -from ._models_py3 import DaprServiceBindMetadata -from ._models_py3 import DaprSubscription -from ._models_py3 import DaprSubscriptionBulkSubscribeOptions -from ._models_py3 import DaprSubscriptionRouteRule -from ._models_py3 import DaprSubscriptionRoutes -from ._models_py3 import DaprSubscriptionsCollection -from ._models_py3 import DataDogConfiguration from ._models_py3 import DefaultAuthorizationPolicy from ._models_py3 import DefaultErrorResponse from ._models_py3 import DefaultErrorResponseError from ._models_py3 import DefaultErrorResponseErrorDetailsItem -from ._models_py3 import DestinationsConfiguration from ._models_py3 import DiagnosticDataProviderMetadata from ._models_py3 import DiagnosticDataProviderMetadataPropertyBagItem from ._models_py3 import DiagnosticDataTableResponseColumn @@ -118,14 +88,9 @@ from ._models_py3 import DiagnosticsDefinition from ._models_py3 import DiagnosticsProperties from ._models_py3 import DiagnosticsStatus -from ._models_py3 import DotNetComponent -from ._models_py3 import DotNetComponentConfigurationProperty -from ._models_py3 import DotNetComponentServiceBind -from ._models_py3 import DotNetComponentsCollection from ._models_py3 import EncryptionSettings from ._models_py3 import EnvironmentAuthToken from ._models_py3 import EnvironmentVar -from ._models_py3 import EnvironmentVariable from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse @@ -136,11 +101,6 @@ from ._models_py3 import GithubActionConfiguration from ._models_py3 import GlobalValidation from ._models_py3 import Google -from ._models_py3 import Header -from ._models_py3 import HeaderMatch -from ._models_py3 import HttpConnectionPool -from ._models_py3 import HttpGet -from ._models_py3 import HttpRetryPolicy from ._models_py3 import HttpScaleRule from ._models_py3 import HttpSettings from ._models_py3 import HttpSettingsRoutes @@ -150,10 +110,6 @@ from ._models_py3 import IngressStickySessions from ._models_py3 import InitContainer from ._models_py3 import IpSecurityRestrictionRule -from ._models_py3 import JavaComponent -from ._models_py3 import JavaComponentConfigurationProperty -from ._models_py3 import JavaComponentServiceBind -from ._models_py3 import JavaComponentsCollection from ._models_py3 import Job from ._models_py3 import JobConfiguration from ._models_py3 import JobConfigurationEventTriggerConfig @@ -178,31 +134,27 @@ from ._models_py3 import Login from ._models_py3 import LoginRoutes from ._models_py3 import LoginScopes -from ._models_py3 import LogsConfiguration from ._models_py3 import ManagedCertificate from ._models_py3 import ManagedCertificateCollection from ._models_py3 import ManagedCertificatePatch from ._models_py3 import ManagedCertificateProperties from ._models_py3 import ManagedEnvironment from ._models_py3 import ManagedEnvironmentPropertiesPeerAuthentication +from ._models_py3 import ManagedEnvironmentPropertiesPeerTrafficConfiguration +from ._models_py3 import ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption from ._models_py3 import ManagedEnvironmentStorage from ._models_py3 import ManagedEnvironmentStorageProperties from ._models_py3 import ManagedEnvironmentStoragesCollection from ._models_py3 import ManagedEnvironmentsCollection from ._models_py3 import ManagedServiceIdentity -from ._models_py3 import MetricsConfiguration from ._models_py3 import Mtls -from ._models_py3 import NfsAzureFileProperties from ._models_py3 import Nonce from ._models_py3 import OpenIdConnectClientCredential from ._models_py3 import OpenIdConnectConfig from ._models_py3 import OpenIdConnectLogin from ._models_py3 import OpenIdConnectRegistration -from ._models_py3 import OpenTelemetryConfiguration from ._models_py3 import OperationDetail from ._models_py3 import OperationDisplay -from ._models_py3 import OtlpConfiguration -from ._models_py3 import PreBuildStep from ._models_py3 import ProxyResource from ._models_py3 import QueueScaleRule from ._models_py3 import RegistryCredentials @@ -224,13 +176,9 @@ from ._models_py3 import SourceControl from ._models_py3 import SourceControlCollection from ._models_py3 import SystemData -from ._models_py3 import TcpConnectionPool -from ._models_py3 import TcpRetryPolicy from ._models_py3 import TcpScaleRule from ._models_py3 import Template -from ._models_py3 import TimeoutPolicy from ._models_py3 import TokenStore -from ._models_py3 import TracesConfiguration from ._models_py3 import TrackedResource from ._models_py3 import TrafficWeight from ._models_py3 import Twitter @@ -253,11 +201,7 @@ from ._container_apps_api_client_enums import AppProtocol from ._container_apps_api_client_enums import Applicability from ._container_apps_api_client_enums import BindingType -from ._container_apps_api_client_enums import BuildProvisioningState -from ._container_apps_api_client_enums import BuildStatus -from ._container_apps_api_client_enums import BuilderProvisioningState from ._container_apps_api_client_enums import CertificateProvisioningState -from ._container_apps_api_client_enums import CertificateType from ._container_apps_api_client_enums import CheckNameAvailabilityReason from ._container_apps_api_client_enums import ConnectedEnvironmentProvisioningState from ._container_apps_api_client_enums import ContainerAppContainerRunningState @@ -266,16 +210,11 @@ from ._container_apps_api_client_enums import CookieExpirationConvention from ._container_apps_api_client_enums import CreatedByType from ._container_apps_api_client_enums import DnsVerificationTestResult -from ._container_apps_api_client_enums import DotNetComponentProvisioningState -from ._container_apps_api_client_enums import DotNetComponentType from ._container_apps_api_client_enums import EnvironmentProvisioningState from ._container_apps_api_client_enums import ExtendedLocationTypes from ._container_apps_api_client_enums import ForwardProxyConvention from ._container_apps_api_client_enums import IngressClientCertificateMode -from ._container_apps_api_client_enums import IngressTargetPortHttpScheme from ._container_apps_api_client_enums import IngressTransportMethod -from ._container_apps_api_client_enums import JavaComponentProvisioningState -from ._container_apps_api_client_enums import JavaComponentType from ._container_apps_api_client_enums import JobExecutionRunningState from ._container_apps_api_client_enums import JobProvisioningState from ._container_apps_api_client_enums import LogLevel @@ -297,11 +236,8 @@ __all__ = [ "AllowedAudiencesValidation", "AllowedPrincipals", - "AppInsightsConfiguration", "AppLogsConfiguration", "AppRegistration", - "AppResiliency", - "AppResiliencyCollection", "Apple", "AppleRegistration", "AuthConfig", @@ -324,21 +260,12 @@ "BillingMeterCollection", "BillingMeterProperties", "BlobStorageTokenStore", - "BuildCollection", - "BuildConfiguration", - "BuildResource", - "BuildToken", - "BuilderCollection", - "BuilderResource", - "BuilderResourceUpdate", "Certificate", "CertificateCollection", - "CertificateKeyVaultProperties", "CertificatePatch", "CertificateProperties", "CheckNameAvailabilityRequest", "CheckNameAvailabilityResponse", - "CircuitBreakerPolicy", "ClientRegistration", "Configuration", "ConnectedEnvironment", @@ -356,8 +283,6 @@ "ContainerAppProbeHttpGetHttpHeadersItem", "ContainerAppProbeTcpSocket", "ContainerAppSecret", - "ContainerRegistry", - "ContainerRegistryWithCustomImage", "ContainerResources", "CookieExpiration", "CorsPolicy", @@ -370,31 +295,15 @@ "CustomScaleRule", "Dapr", "DaprComponent", - "DaprComponentResiliencyPoliciesCollection", - "DaprComponentResiliencyPolicy", - "DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration", - "DaprComponentResiliencyPolicyConfiguration", - "DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration", - "DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration", - "DaprComponentResiliencyPolicyTimeoutPolicyConfiguration", - "DaprComponentServiceBinding", "DaprComponentsCollection", "DaprConfiguration", "DaprMetadata", "DaprSecret", "DaprSecretsCollection", - "DaprServiceBindMetadata", - "DaprSubscription", - "DaprSubscriptionBulkSubscribeOptions", - "DaprSubscriptionRouteRule", - "DaprSubscriptionRoutes", - "DaprSubscriptionsCollection", - "DataDogConfiguration", "DefaultAuthorizationPolicy", "DefaultErrorResponse", "DefaultErrorResponseError", "DefaultErrorResponseErrorDetailsItem", - "DestinationsConfiguration", "DiagnosticDataProviderMetadata", "DiagnosticDataProviderMetadataPropertyBagItem", "DiagnosticDataTableResponseColumn", @@ -407,14 +316,9 @@ "DiagnosticsDefinition", "DiagnosticsProperties", "DiagnosticsStatus", - "DotNetComponent", - "DotNetComponentConfigurationProperty", - "DotNetComponentServiceBind", - "DotNetComponentsCollection", "EncryptionSettings", "EnvironmentAuthToken", "EnvironmentVar", - "EnvironmentVariable", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -425,11 +329,6 @@ "GithubActionConfiguration", "GlobalValidation", "Google", - "Header", - "HeaderMatch", - "HttpConnectionPool", - "HttpGet", - "HttpRetryPolicy", "HttpScaleRule", "HttpSettings", "HttpSettingsRoutes", @@ -439,10 +338,6 @@ "IngressStickySessions", "InitContainer", "IpSecurityRestrictionRule", - "JavaComponent", - "JavaComponentConfigurationProperty", - "JavaComponentServiceBind", - "JavaComponentsCollection", "Job", "JobConfiguration", "JobConfigurationEventTriggerConfig", @@ -467,31 +362,27 @@ "Login", "LoginRoutes", "LoginScopes", - "LogsConfiguration", "ManagedCertificate", "ManagedCertificateCollection", "ManagedCertificatePatch", "ManagedCertificateProperties", "ManagedEnvironment", "ManagedEnvironmentPropertiesPeerAuthentication", + "ManagedEnvironmentPropertiesPeerTrafficConfiguration", + "ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption", "ManagedEnvironmentStorage", "ManagedEnvironmentStorageProperties", "ManagedEnvironmentStoragesCollection", "ManagedEnvironmentsCollection", "ManagedServiceIdentity", - "MetricsConfiguration", "Mtls", - "NfsAzureFileProperties", "Nonce", "OpenIdConnectClientCredential", "OpenIdConnectConfig", "OpenIdConnectLogin", "OpenIdConnectRegistration", - "OpenTelemetryConfiguration", "OperationDetail", "OperationDisplay", - "OtlpConfiguration", - "PreBuildStep", "ProxyResource", "QueueScaleRule", "RegistryCredentials", @@ -513,13 +404,9 @@ "SourceControl", "SourceControlCollection", "SystemData", - "TcpConnectionPool", - "TcpRetryPolicy", "TcpScaleRule", "Template", - "TimeoutPolicy", "TokenStore", - "TracesConfiguration", "TrackedResource", "TrafficWeight", "Twitter", @@ -541,11 +428,7 @@ "AppProtocol", "Applicability", "BindingType", - "BuildProvisioningState", - "BuildStatus", - "BuilderProvisioningState", "CertificateProvisioningState", - "CertificateType", "CheckNameAvailabilityReason", "ConnectedEnvironmentProvisioningState", "ContainerAppContainerRunningState", @@ -554,16 +437,11 @@ "CookieExpirationConvention", "CreatedByType", "DnsVerificationTestResult", - "DotNetComponentProvisioningState", - "DotNetComponentType", "EnvironmentProvisioningState", "ExtendedLocationTypes", "ForwardProxyConvention", "IngressClientCertificateMode", - "IngressTargetPortHttpScheme", "IngressTransportMethod", - "JavaComponentProvisioningState", - "JavaComponentType", "JobExecutionRunningState", "JobProvisioningState", "LogLevel", diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py index 76e21fe999be6..694a6932ba5d3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py @@ -71,38 +71,6 @@ class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SNI_ENABLED = "SniEnabled" -class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Resource instance provisioning state.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Resource instance provisioning state.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - - -class BuildStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the build once it has been provisioned.""" - - NOT_STARTED = "NotStarted" - IN_PROGRESS = "InProgress" - SUCCEEDED = "Succeeded" - CANCELED = "Canceled" - FAILED = "Failed" - - class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the certificate.""" @@ -113,15 +81,6 @@ class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta) PENDING = "Pending" -class CertificateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the certificate. Allowed values are ``ServerSSLCertificate`` and - ``ImagePullTrustedCA``. - """ - - SERVER_SSL_CERTIFICATE = "ServerSSLCertificate" - IMAGE_PULL_TRUSTED_CA = "ImagePullTrustedCA" - - class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason why the given name is not available.""" @@ -192,23 +151,6 @@ class DnsVerificationTestResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): SKIPPED = "Skipped" -class DotNetComponentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the .NET Component.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - DELETING = "Deleting" - IN_PROGRESS = "InProgress" - - -class DotNetComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the .NET Component.""" - - ASPIRE_DASHBOARD = "AspireDashboard" - ASPIRE_RESOURCE_SERVER_API = "AspireResourceServerApi" - - class EnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Environment.""" @@ -249,13 +191,6 @@ class IngressClientCertificateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta) REQUIRE = "require" -class IngressTargetPortHttpScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether an http app listens on http or https.""" - - HTTP = "http" - HTTPS = "https" - - class IngressTransportMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Ingress transport protocol.""" @@ -265,24 +200,6 @@ class IngressTransportMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): TCP = "tcp" -class JavaComponentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the Java Component.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - DELETING = "Deleting" - IN_PROGRESS = "InProgress" - - -class JavaComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the Java Component.""" - - SPRING_BOOT_ADMIN = "SpringBootAdmin" - SPRING_CLOUD_EUREKA = "SpringCloudEureka" - SPRING_CLOUD_CONFIG = "SpringCloudConfig" - - class JobExecutionRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current running State of the job.""" @@ -386,7 +303,6 @@ class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_FILE = "AzureFile" EMPTY_DIR = "EmptyDir" SECRET = "Secret" - NFS_AZURE_FILE = "NfsAzureFile" class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py index e6f107c1bec78..d062d9bdef6d3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py @@ -74,26 +74,6 @@ def __init__( self.identities = identities -class AppInsightsConfiguration(_serialization.Model): - """Configuration of Application Insights. - - :ivar connection_string: Application Insights connection string. - :vartype connection_string: str - """ - - _attribute_map = { - "connection_string": {"key": "connectionString", "type": "str"}, - } - - def __init__(self, *, connection_string: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword connection_string: Application Insights connection string. - :paramtype connection_string: str - """ - super().__init__(**kwargs) - self.connection_string = connection_string - - class Apple(_serialization.Model): """The configuration settings of the Apple provider. @@ -289,123 +269,6 @@ class ProxyResource(Resource): """ -class AppResiliency(ProxyResource): - """Configuration to setup App Resiliency. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar timeout_policy: Policy to set request timeouts. - :vartype timeout_policy: ~azure.mgmt.appcontainers.models.TimeoutPolicy - :ivar http_retry_policy: Policy that defines http request retry conditions. - :vartype http_retry_policy: ~azure.mgmt.appcontainers.models.HttpRetryPolicy - :ivar tcp_retry_policy: Policy that defines tcp request retry conditions. - :vartype tcp_retry_policy: ~azure.mgmt.appcontainers.models.TcpRetryPolicy - :ivar circuit_breaker_policy: Policy that defines circuit breaker conditions. - :vartype circuit_breaker_policy: ~azure.mgmt.appcontainers.models.CircuitBreakerPolicy - :ivar http_connection_pool: Defines parameters for http connection pooling. - :vartype http_connection_pool: ~azure.mgmt.appcontainers.models.HttpConnectionPool - :ivar tcp_connection_pool: Defines parameters for tcp connection pooling. - :vartype tcp_connection_pool: ~azure.mgmt.appcontainers.models.TcpConnectionPool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "timeout_policy": {"key": "properties.timeoutPolicy", "type": "TimeoutPolicy"}, - "http_retry_policy": {"key": "properties.httpRetryPolicy", "type": "HttpRetryPolicy"}, - "tcp_retry_policy": {"key": "properties.tcpRetryPolicy", "type": "TcpRetryPolicy"}, - "circuit_breaker_policy": {"key": "properties.circuitBreakerPolicy", "type": "CircuitBreakerPolicy"}, - "http_connection_pool": {"key": "properties.httpConnectionPool", "type": "HttpConnectionPool"}, - "tcp_connection_pool": {"key": "properties.tcpConnectionPool", "type": "TcpConnectionPool"}, - } - - def __init__( - self, - *, - timeout_policy: Optional["_models.TimeoutPolicy"] = None, - http_retry_policy: Optional["_models.HttpRetryPolicy"] = None, - tcp_retry_policy: Optional["_models.TcpRetryPolicy"] = None, - circuit_breaker_policy: Optional["_models.CircuitBreakerPolicy"] = None, - http_connection_pool: Optional["_models.HttpConnectionPool"] = None, - tcp_connection_pool: Optional["_models.TcpConnectionPool"] = None, - **kwargs: Any - ) -> None: - """ - :keyword timeout_policy: Policy to set request timeouts. - :paramtype timeout_policy: ~azure.mgmt.appcontainers.models.TimeoutPolicy - :keyword http_retry_policy: Policy that defines http request retry conditions. - :paramtype http_retry_policy: ~azure.mgmt.appcontainers.models.HttpRetryPolicy - :keyword tcp_retry_policy: Policy that defines tcp request retry conditions. - :paramtype tcp_retry_policy: ~azure.mgmt.appcontainers.models.TcpRetryPolicy - :keyword circuit_breaker_policy: Policy that defines circuit breaker conditions. - :paramtype circuit_breaker_policy: ~azure.mgmt.appcontainers.models.CircuitBreakerPolicy - :keyword http_connection_pool: Defines parameters for http connection pooling. - :paramtype http_connection_pool: ~azure.mgmt.appcontainers.models.HttpConnectionPool - :keyword tcp_connection_pool: Defines parameters for tcp connection pooling. - :paramtype tcp_connection_pool: ~azure.mgmt.appcontainers.models.TcpConnectionPool - """ - super().__init__(**kwargs) - self.timeout_policy = timeout_policy - self.http_retry_policy = http_retry_policy - self.tcp_retry_policy = tcp_retry_policy - self.circuit_breaker_policy = circuit_breaker_policy - self.http_connection_pool = http_connection_pool - self.tcp_connection_pool = tcp_connection_pool - - -class AppResiliencyCollection(_serialization.Model): - """Collection of AppResiliency policies. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.AppResiliency] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[AppResiliency]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.AppResiliency"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.AppResiliency] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - class AuthConfig(ProxyResource): """Configuration settings for the Azure ContainerApp Service Authentication / Authorization feature. @@ -1371,127 +1234,6 @@ def __init__(self, *, sas_url_setting_name: str, **kwargs: Any) -> None: self.sas_url_setting_name = sas_url_setting_name -class BuildCollection(_serialization.Model): - """The response of a BuildResource list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The BuildResource items on this page. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.BuildResource] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[BuildResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.BuildResource"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The BuildResource items on this page. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.BuildResource] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildConfiguration(_serialization.Model): - """Configuration of the build. - - :ivar base_os: Base OS used to build and run the app. - :vartype base_os: str - :ivar platform: Platform to be used to build and run the app. - :vartype platform: str - :ivar platform_version: Platform version to be used to build and run the app. - :vartype platform_version: str - :ivar environment_variables: List of environment variables to be passed to the build, secrets - should not be used in environment variable. - :vartype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] - :ivar pre_build_steps: List of steps to perform before the build. - :vartype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] - """ - - _attribute_map = { - "base_os": {"key": "baseOs", "type": "str"}, - "platform": {"key": "platform", "type": "str"}, - "platform_version": {"key": "platformVersion", "type": "str"}, - "environment_variables": {"key": "environmentVariables", "type": "[EnvironmentVariable]"}, - "pre_build_steps": {"key": "preBuildSteps", "type": "[PreBuildStep]"}, - } - - def __init__( - self, - *, - base_os: Optional[str] = None, - platform: Optional[str] = None, - platform_version: Optional[str] = None, - environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, - pre_build_steps: Optional[List["_models.PreBuildStep"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword base_os: Base OS used to build and run the app. - :paramtype base_os: str - :keyword platform: Platform to be used to build and run the app. - :paramtype platform: str - :keyword platform_version: Platform version to be used to build and run the app. - :paramtype platform_version: str - :keyword environment_variables: List of environment variables to be passed to the build, - secrets should not be used in environment variable. - :paramtype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] - :keyword pre_build_steps: List of steps to perform before the build. - :paramtype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] - """ - super().__init__(**kwargs) - self.base_os = base_os - self.platform = platform - self.platform_version = platform_version - self.environment_variables = environment_variables - self.pre_build_steps = pre_build_steps - - -class BuilderCollection(_serialization.Model): - """The response of a BuilderResource list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The BuilderResource items on this page. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.BuilderResource] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[BuilderResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.BuilderResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The BuilderResource items on this page. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.BuilderResource] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - class TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. @@ -1546,8 +1288,8 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class BuilderResource(TrackedResource): - """Information about the SourceToCloud builder resource. +class Certificate(TrackedResource): + """Certificate used for Custom Domain bindings of Container Apps in a Managed Environment. Variables are only populated by the server, and will be ignored when sending a request. @@ -1568,17 +1310,8 @@ class BuilderResource(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :ivar provisioning_state: Provisioning state of a builder resource. Known values are: - "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuilderProvisioningState - :ivar environment_id: Resource ID of the container apps environment that the builder is - associated with. - :vartype environment_id: str - :ivar container_registries: List of mappings of container registries and the managed identity - used to connect to it. - :vartype container_registries: list[~azure.mgmt.appcontainers.models.ContainerRegistry] + :ivar properties: Certificate resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.CertificateProperties """ _validation = { @@ -1587,7 +1320,6 @@ class BuilderResource(TrackedResource): "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -1597,10 +1329,7 @@ class BuilderResource(TrackedResource): "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "environment_id": {"key": "properties.environmentId", "type": "str"}, - "container_registries": {"key": "properties.containerRegistries", "type": "[ContainerRegistry]"}, + "properties": {"key": "properties", "type": "CertificateProperties"}, } def __init__( @@ -1608,9 +1337,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - environment_id: Optional[str] = None, - container_registries: Optional[List["_models.ContainerRegistry"]] = None, + properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any ) -> None: """ @@ -1618,329 +1345,68 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword identity: The managed service identities assigned to this resource. - :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :keyword environment_id: Resource ID of the container apps environment that the builder is - associated with. - :paramtype environment_id: str - :keyword container_registries: List of mappings of container registries and the managed - identity used to connect to it. - :paramtype container_registries: list[~azure.mgmt.appcontainers.models.ContainerRegistry] + :keyword properties: Certificate resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.CertificateProperties """ super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.provisioning_state = None - self.environment_id = environment_id - self.container_registries = container_registries + self.properties = properties -class BuilderResourceUpdate(_serialization.Model): - """The type used for update operations of the BuilderResource. +class CertificateCollection(_serialization.Model): + """Collection of Certificates. - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar environment_id: Resource ID of the container apps environment that the builder is - associated with. - :vartype environment_id: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + _attribute_map = { - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "tags": {"key": "tags", "type": "{str}"}, - "environment_id": {"key": "properties.environmentId", "type": "str"}, + "value": {"key": "value", "type": "[Certificate]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - identity: Optional["_models.ManagedServiceIdentity"] = None, - tags: Optional[Dict[str, str]] = None, - environment_id: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, value: List["_models.Certificate"], **kwargs: Any) -> None: """ - :keyword identity: The managed service identities assigned to this resource. - :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword environment_id: Resource ID of the container apps environment that the builder is - associated with. - :paramtype environment_id: str + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Certificate] """ super().__init__(**kwargs) - self.identity = identity - self.tags = tags - self.environment_id = environment_id - + self.value = value + self.next_link = None -class BuildResource(ProxyResource): # pylint: disable=too-many-instance-attributes - """Information pertaining to an individual build. - Variables are only populated by the server, and will be ignored when sending a request. +class CertificatePatch(_serialization.Model): + """A certificate to update. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar provisioning_state: Build provisioning state. Known values are: "Succeeded", "Failed", - "Canceled", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuildProvisioningState - :ivar build_status: Status of the build once it has been provisioned. Known values are: - "NotStarted", "InProgress", "Succeeded", "Canceled", and "Failed". - :vartype build_status: str or ~azure.mgmt.appcontainers.models.BuildStatus - :ivar destination_container_registry: Container registry that the final image will be uploaded - to. - :vartype destination_container_registry: - ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage - :ivar configuration: Configuration of the build. - :vartype configuration: ~azure.mgmt.appcontainers.models.BuildConfiguration - :ivar upload_endpoint: Endpoint to which the source code should be uploaded. - :vartype upload_endpoint: str - :ivar log_stream_endpoint: Endpoint from which the build logs can be streamed. - :vartype log_stream_endpoint: str - :ivar token_endpoint: Endpoint to use to retrieve an authentication token for log streaming and - uploading source code. - :vartype token_endpoint: str + :ivar tags: Application-specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "build_status": {"readonly": True}, - "upload_endpoint": {"readonly": True}, - "log_stream_endpoint": {"readonly": True}, - "token_endpoint": {"readonly": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "build_status": {"key": "properties.buildStatus", "type": "str"}, - "destination_container_registry": { - "key": "properties.destinationContainerRegistry", - "type": "ContainerRegistryWithCustomImage", - }, - "configuration": {"key": "properties.configuration", "type": "BuildConfiguration"}, - "upload_endpoint": {"key": "properties.uploadEndpoint", "type": "str"}, - "log_stream_endpoint": {"key": "properties.logStreamEndpoint", "type": "str"}, - "token_endpoint": {"key": "properties.tokenEndpoint", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - destination_container_registry: Optional["_models.ContainerRegistryWithCustomImage"] = None, - configuration: Optional["_models.BuildConfiguration"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword destination_container_registry: Container registry that the final image will be - uploaded to. - :paramtype destination_container_registry: - ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage - :keyword configuration: Configuration of the build. - :paramtype configuration: ~azure.mgmt.appcontainers.models.BuildConfiguration + :keyword tags: Application-specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.provisioning_state = None - self.build_status = None - self.destination_container_registry = destination_container_registry - self.configuration = configuration - self.upload_endpoint = None - self.log_stream_endpoint = None - self.token_endpoint = None + self.tags = tags -class BuildToken(_serialization.Model): - """Build Auth Token. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar token: Authentication token. - :vartype token: str - :ivar expires: Token expiration date. - :vartype expires: ~datetime.datetime - """ - - _validation = { - "token": {"readonly": True}, - "expires": {"readonly": True}, - } - - _attribute_map = { - "token": {"key": "token", "type": "str"}, - "expires": {"key": "expires", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.token = None - self.expires = None - - -class Certificate(TrackedResource): - """Certificate used for Custom Domain bindings of Container Apps in a Managed Environment. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: Certificate resource specific properties. - :vartype properties: ~azure.mgmt.appcontainers.models.CertificateProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "CertificateProperties"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.CertificateProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword properties: Certificate resource specific properties. - :paramtype properties: ~azure.mgmt.appcontainers.models.CertificateProperties - """ - super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - - -class CertificateCollection(_serialization.Model): - """Collection of Certificates. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Certificate] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Certificate]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Certificate"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Certificate] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class CertificateKeyVaultProperties(_serialization.Model): - """Properties for a certificate stored in a Key Vault. - - :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or - System to use a system-assigned identity. - :vartype identity: str - :ivar key_vault_url: URL pointing to the Azure Key Vault secret that holds the certificate. - :vartype key_vault_url: str - """ - - _attribute_map = { - "identity": {"key": "identity", "type": "str"}, - "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, - } - - def __init__(self, *, identity: Optional[str] = None, key_vault_url: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or - System to use a system-assigned identity. - :paramtype identity: str - :keyword key_vault_url: URL pointing to the Azure Key Vault secret that holds the certificate. - :paramtype key_vault_url: str - """ - super().__init__(**kwargs) - self.identity = identity - self.key_vault_url = key_vault_url - - -class CertificatePatch(_serialization.Model): - """A certificate to update. - - :ivar tags: Application-specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Application-specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class CertificateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Certificate resource specific properties. +class CertificateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Certificate resource specific properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -1948,9 +1414,6 @@ class CertificateProperties(_serialization.Model): # pylint: disable=too-many-i "Failed", "Canceled", "DeleteFailed", and "Pending". :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.CertificateProvisioningState - :ivar certificate_key_vault_properties: Properties for a certificate stored in a Key Vault. - :vartype certificate_key_vault_properties: - ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :ivar password: Certificate password. :vartype password: str :ivar subject_name: Subject name of the certificate. @@ -1971,10 +1434,6 @@ class CertificateProperties(_serialization.Model): # pylint: disable=too-many-i :vartype valid: bool :ivar public_key_hash: Public key hash. :vartype public_key_hash: str - :ivar certificate_type: The type of the certificate. Allowed values are - ``ServerSSLCertificate`` and ``ImagePullTrustedCA``. Known values are: "ServerSSLCertificate" - and "ImagePullTrustedCA". - :vartype certificate_type: str or ~azure.mgmt.appcontainers.models.CertificateType """ _validation = { @@ -1991,10 +1450,6 @@ class CertificateProperties(_serialization.Model): # pylint: disable=too-many-i _attribute_map = { "provisioning_state": {"key": "provisioningState", "type": "str"}, - "certificate_key_vault_properties": { - "key": "certificateKeyVaultProperties", - "type": "CertificateKeyVaultProperties", - }, "password": {"key": "password", "type": "str"}, "subject_name": {"key": "subjectName", "type": "str"}, "subject_alternative_names": {"key": "subjectAlternativeNames", "type": "[str]"}, @@ -2005,34 +1460,17 @@ class CertificateProperties(_serialization.Model): # pylint: disable=too-many-i "thumbprint": {"key": "thumbprint", "type": "str"}, "valid": {"key": "valid", "type": "bool"}, "public_key_hash": {"key": "publicKeyHash", "type": "str"}, - "certificate_type": {"key": "certificateType", "type": "str"}, } - def __init__( - self, - *, - certificate_key_vault_properties: Optional["_models.CertificateKeyVaultProperties"] = None, - password: Optional[str] = None, - value: Optional[bytes] = None, - certificate_type: Optional[Union[str, "_models.CertificateType"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, password: Optional[str] = None, value: Optional[bytes] = None, **kwargs: Any) -> None: """ - :keyword certificate_key_vault_properties: Properties for a certificate stored in a Key Vault. - :paramtype certificate_key_vault_properties: - ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :keyword password: Certificate password. :paramtype password: str :keyword value: PFX or PEM blob. :paramtype value: bytes - :keyword certificate_type: The type of the certificate. Allowed values are - ``ServerSSLCertificate`` and ``ImagePullTrustedCA``. Known values are: "ServerSSLCertificate" - and "ImagePullTrustedCA". - :paramtype certificate_type: str or ~azure.mgmt.appcontainers.models.CertificateType """ super().__init__(**kwargs) self.provisioning_state = None - self.certificate_key_vault_properties = certificate_key_vault_properties self.password = password self.subject_name = None self.subject_alternative_names = None @@ -2043,7 +1481,6 @@ def __init__( self.thumbprint = None self.valid = None self.public_key_hash = None - self.certificate_type = certificate_type class CheckNameAvailabilityRequest(_serialization.Model): @@ -2113,51 +1550,6 @@ def __init__( self.message = message -class CircuitBreakerPolicy(_serialization.Model): - """Policy that defines circuit breaker conditions. - - :ivar consecutive_errors: Number of consecutive errors before the circuit breaker opens. - :vartype consecutive_errors: int - :ivar interval_in_seconds: The time interval, in seconds, between endpoint checks. This can - result in opening the circuit breaker if the check fails as well as closing the circuit breaker - if the check succeeds. Defaults to 10s. - :vartype interval_in_seconds: int - :ivar max_ejection_percent: Maximum percentage of hosts that will be ejected after failure - threshold has been met. - :vartype max_ejection_percent: int - """ - - _attribute_map = { - "consecutive_errors": {"key": "consecutiveErrors", "type": "int"}, - "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, - "max_ejection_percent": {"key": "maxEjectionPercent", "type": "int"}, - } - - def __init__( - self, - *, - consecutive_errors: Optional[int] = None, - interval_in_seconds: Optional[int] = None, - max_ejection_percent: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword consecutive_errors: Number of consecutive errors before the circuit breaker opens. - :paramtype consecutive_errors: int - :keyword interval_in_seconds: The time interval, in seconds, between endpoint checks. This can - result in opening the circuit breaker if the check fails as well as closing the circuit breaker - if the check succeeds. Defaults to 10s. - :paramtype interval_in_seconds: int - :keyword max_ejection_percent: Maximum percentage of hosts that will be ejected after failure - threshold has been met. - :paramtype max_ejection_percent: int - """ - super().__init__(**kwargs) - self.consecutive_errors = consecutive_errors - self.interval_in_seconds = interval_in_seconds - self.max_ejection_percent = max_ejection_percent - - class ClientRegistration(_serialization.Model): """The configuration settings of the app registration for providers that have client ids and client secrets. @@ -3153,77 +2545,6 @@ def __init__(self, **kwargs: Any) -> None: self.key_vault_url = None -class ContainerRegistry(_serialization.Model): - """Model representing a mapping from a container registry to the identity used to connect to it. - - All required parameters must be populated in order to send to server. - - :ivar container_registry_server: Login server of the container registry. Required. - :vartype container_registry_server: str - :ivar identity_resource_id: Resource ID of the managed identity. Required. - :vartype identity_resource_id: str - """ - - _validation = { - "container_registry_server": {"required": True}, - "identity_resource_id": {"required": True}, - } - - _attribute_map = { - "container_registry_server": {"key": "containerRegistryServer", "type": "str"}, - "identity_resource_id": {"key": "identityResourceId", "type": "str"}, - } - - def __init__(self, *, container_registry_server: str, identity_resource_id: str, **kwargs: Any) -> None: - """ - :keyword container_registry_server: Login server of the container registry. Required. - :paramtype container_registry_server: str - :keyword identity_resource_id: Resource ID of the managed identity. Required. - :paramtype identity_resource_id: str - """ - super().__init__(**kwargs) - self.container_registry_server = container_registry_server - self.identity_resource_id = identity_resource_id - - -class ContainerRegistryWithCustomImage(_serialization.Model): - """Container registry that the final image will be uploaded to. - - All required parameters must be populated in order to send to server. - - :ivar server: Login server of the container registry that the final image should be uploaded - to. Builder resource needs to have this container registry defined along with an identity to - use to access it. Required. - :vartype server: str - :ivar image: Full name that the final image should be uploaded as, including both image name - and tag. - :vartype image: str - """ - - _validation = { - "server": {"required": True}, - } - - _attribute_map = { - "server": {"key": "server", "type": "str"}, - "image": {"key": "image", "type": "str"}, - } - - def __init__(self, *, server: str, image: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword server: Login server of the container registry that the final image should be uploaded - to. Builder resource needs to have this container registry defined along with an identity to - use to access it. Required. - :paramtype server: str - :keyword image: Full name that the final image should be uploaded as, including both image name - and tag. - :paramtype image: str - """ - super().__init__(**kwargs) - self.server = server - self.image = image - - class ContainerResources(_serialization.Model): """Container App container resource requirements. @@ -3421,9 +2742,6 @@ class CustomDomainConfiguration(_serialization.Model): :vartype custom_domain_verification_id: str :ivar dns_suffix: Dns suffix for the environment domain. :vartype dns_suffix: str - :ivar certificate_key_vault_properties: Certificate stored in Azure Key Vault. - :vartype certificate_key_vault_properties: - ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :ivar certificate_value: PFX or PEM blob. :vartype certificate_value: bytes :ivar certificate_password: Certificate password. @@ -3446,10 +2764,6 @@ class CustomDomainConfiguration(_serialization.Model): _attribute_map = { "custom_domain_verification_id": {"key": "customDomainVerificationId", "type": "str"}, "dns_suffix": {"key": "dnsSuffix", "type": "str"}, - "certificate_key_vault_properties": { - "key": "certificateKeyVaultProperties", - "type": "CertificateKeyVaultProperties", - }, "certificate_value": {"key": "certificateValue", "type": "bytearray"}, "certificate_password": {"key": "certificatePassword", "type": "str"}, "expiration_date": {"key": "expirationDate", "type": "iso-8601"}, @@ -3461,7 +2775,6 @@ def __init__( self, *, dns_suffix: Optional[str] = None, - certificate_key_vault_properties: Optional["_models.CertificateKeyVaultProperties"] = None, certificate_value: Optional[bytes] = None, certificate_password: Optional[str] = None, **kwargs: Any @@ -3469,9 +2782,6 @@ def __init__( """ :keyword dns_suffix: Dns suffix for the environment domain. :paramtype dns_suffix: str - :keyword certificate_key_vault_properties: Certificate stored in Azure Key Vault. - :paramtype certificate_key_vault_properties: - ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :keyword certificate_value: PFX or PEM blob. :paramtype certificate_value: bytes :keyword certificate_password: Certificate password. @@ -3480,7 +2790,6 @@ def __init__( super().__init__(**kwargs) self.custom_domain_verification_id = None self.dns_suffix = dns_suffix - self.certificate_key_vault_properties = certificate_key_vault_properties self.certificate_value = certificate_value self.certificate_password = certificate_password self.expiration_date = None @@ -3882,10 +3191,6 @@ class DaprComponent(ProxyResource): # pylint: disable=too-many-instance-attribu :vartype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] :ivar scopes: Names of container apps that can use this Dapr component. :vartype scopes: list[str] - :ivar service_component_bind: List of container app services that are bound to the Dapr - component. - :vartype service_component_bind: - list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] """ _validation = { @@ -3908,7 +3213,6 @@ class DaprComponent(ProxyResource): # pylint: disable=too-many-instance-attribu "secret_store_component": {"key": "properties.secretStoreComponent", "type": "str"}, "metadata": {"key": "properties.metadata", "type": "[DaprMetadata]"}, "scopes": {"key": "properties.scopes", "type": "[str]"}, - "service_component_bind": {"key": "properties.serviceComponentBind", "type": "[DaprComponentServiceBinding]"}, } def __init__( @@ -3922,7 +3226,6 @@ def __init__( secret_store_component: Optional[str] = None, metadata: Optional[List["_models.DaprMetadata"]] = None, scopes: Optional[List[str]] = None, - service_component_bind: Optional[List["_models.DaprComponentServiceBinding"]] = None, **kwargs: Any ) -> None: """ @@ -3942,10 +3245,6 @@ def __init__( :paramtype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] :keyword scopes: Names of container apps that can use this Dapr component. :paramtype scopes: list[str] - :keyword service_component_bind: List of container app services that are bound to the Dapr - component. - :paramtype service_component_bind: - list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] """ super().__init__(**kwargs) self.component_type = component_type @@ -3956,18 +3255,17 @@ def __init__( self.secret_store_component = secret_store_component self.metadata = metadata self.scopes = scopes - self.service_component_bind = service_component_bind -class DaprComponentResiliencyPoliciesCollection(_serialization.Model): # pylint: disable=name-too-long - """Dapr Component Resiliency Policies ARM resource. +class DaprComponentsCollection(_serialization.Model): + """Dapr Components ARM resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] + :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponent] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -3978,353 +3276,31 @@ class DaprComponentResiliencyPoliciesCollection(_serialization.Model): # pylint } _attribute_map = { - "value": {"key": "value", "type": "[DaprComponentResiliencyPolicy]"}, + "value": {"key": "value", "type": "[DaprComponent]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.DaprComponentResiliencyPolicy"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.DaprComponent"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponent] """ super().__init__(**kwargs) self.value = value self.next_link = None -class DaprComponentResiliencyPolicy(ProxyResource): - """Dapr Component Resiliency Policy. +class DaprConfiguration(_serialization.Model): + """Configuration properties Dapr component. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar inbound_policy: The optional inbound component resiliency policy configuration. - :vartype inbound_policy: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration - :ivar outbound_policy: The optional outbound component resiliency policy configuration. - :vartype outbound_policy: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + :ivar version: The version of Dapr. + :vartype version: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "inbound_policy": {"key": "properties.inboundPolicy", "type": "DaprComponentResiliencyPolicyConfiguration"}, - "outbound_policy": {"key": "properties.outboundPolicy", "type": "DaprComponentResiliencyPolicyConfiguration"}, - } - - def __init__( - self, - *, - inbound_policy: Optional["_models.DaprComponentResiliencyPolicyConfiguration"] = None, - outbound_policy: Optional["_models.DaprComponentResiliencyPolicyConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword inbound_policy: The optional inbound component resiliency policy configuration. - :paramtype inbound_policy: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration - :keyword outbound_policy: The optional outbound component resiliency policy configuration. - :paramtype outbound_policy: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration - """ - super().__init__(**kwargs) - self.inbound_policy = inbound_policy - self.outbound_policy = outbound_policy - - -class DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration( - _serialization.Model -): # pylint: disable=name-too-long - """Dapr Component Resiliency Policy Circuit Breaker Policy Configuration. - - :ivar consecutive_errors: The number of consecutive errors before the circuit is opened. - :vartype consecutive_errors: int - :ivar timeout_in_seconds: The interval in seconds until a retry attempt is made after the - circuit is opened. - :vartype timeout_in_seconds: int - :ivar interval_in_seconds: The optional interval in seconds after which the error count resets - to 0. An interval of 0 will never reset. If not specified, the timeoutInSeconds value will be - used. - :vartype interval_in_seconds: int - """ - - _attribute_map = { - "consecutive_errors": {"key": "consecutiveErrors", "type": "int"}, - "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, - "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, - } - - def __init__( - self, - *, - consecutive_errors: Optional[int] = None, - timeout_in_seconds: Optional[int] = None, - interval_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword consecutive_errors: The number of consecutive errors before the circuit is opened. - :paramtype consecutive_errors: int - :keyword timeout_in_seconds: The interval in seconds until a retry attempt is made after the - circuit is opened. - :paramtype timeout_in_seconds: int - :keyword interval_in_seconds: The optional interval in seconds after which the error count - resets to 0. An interval of 0 will never reset. If not specified, the timeoutInSeconds value - will be used. - :paramtype interval_in_seconds: int - """ - super().__init__(**kwargs) - self.consecutive_errors = consecutive_errors - self.timeout_in_seconds = timeout_in_seconds - self.interval_in_seconds = interval_in_seconds - - -class DaprComponentResiliencyPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Dapr Component Resiliency Policy Configuration. - - :ivar http_retry_policy: The optional HTTP retry policy configuration. - :vartype http_retry_policy: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration - :ivar timeout_policy: The optional timeout policy configuration. - :vartype timeout_policy: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration - :ivar circuit_breaker_policy: The optional circuit breaker policy configuration. - :vartype circuit_breaker_policy: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration - """ - - _attribute_map = { - "http_retry_policy": { - "key": "httpRetryPolicy", - "type": "DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration", - }, - "timeout_policy": {"key": "timeoutPolicy", "type": "DaprComponentResiliencyPolicyTimeoutPolicyConfiguration"}, - "circuit_breaker_policy": { - "key": "circuitBreakerPolicy", - "type": "DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration", - }, - } - - def __init__( - self, - *, - http_retry_policy: Optional["_models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration"] = None, - timeout_policy: Optional["_models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration"] = None, - circuit_breaker_policy: Optional[ - "_models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration" - ] = None, - **kwargs: Any - ) -> None: - """ - :keyword http_retry_policy: The optional HTTP retry policy configuration. - :paramtype http_retry_policy: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration - :keyword timeout_policy: The optional timeout policy configuration. - :paramtype timeout_policy: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration - :keyword circuit_breaker_policy: The optional circuit breaker policy configuration. - :paramtype circuit_breaker_policy: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration - """ - super().__init__(**kwargs) - self.http_retry_policy = http_retry_policy - self.timeout_policy = timeout_policy - self.circuit_breaker_policy = circuit_breaker_policy - - -class DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Dapr Component Resiliency Policy HTTP Retry Backoff Configuration. - - :ivar initial_delay_in_milliseconds: The optional initial delay in milliseconds before an - operation is retried. - :vartype initial_delay_in_milliseconds: int - :ivar max_interval_in_milliseconds: The optional maximum time interval in milliseconds between - retry attempts. - :vartype max_interval_in_milliseconds: int - """ - - _attribute_map = { - "initial_delay_in_milliseconds": {"key": "initialDelayInMilliseconds", "type": "int"}, - "max_interval_in_milliseconds": {"key": "maxIntervalInMilliseconds", "type": "int"}, - } - - def __init__( - self, - *, - initial_delay_in_milliseconds: Optional[int] = None, - max_interval_in_milliseconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword initial_delay_in_milliseconds: The optional initial delay in milliseconds before an - operation is retried. - :paramtype initial_delay_in_milliseconds: int - :keyword max_interval_in_milliseconds: The optional maximum time interval in milliseconds - between retry attempts. - :paramtype max_interval_in_milliseconds: int - """ - super().__init__(**kwargs) - self.initial_delay_in_milliseconds = initial_delay_in_milliseconds - self.max_interval_in_milliseconds = max_interval_in_milliseconds - - -class DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Dapr Component Resiliency Policy HTTP Retry Policy Configuration. - - :ivar max_retries: The optional maximum number of retries. - :vartype max_retries: int - :ivar retry_back_off: The optional retry backoff configuration. - :vartype retry_back_off: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration - """ - - _attribute_map = { - "max_retries": {"key": "maxRetries", "type": "int"}, - "retry_back_off": {"key": "retryBackOff", "type": "DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration"}, - } - - def __init__( - self, - *, - max_retries: Optional[int] = None, - retry_back_off: Optional["_models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword max_retries: The optional maximum number of retries. - :paramtype max_retries: int - :keyword retry_back_off: The optional retry backoff configuration. - :paramtype retry_back_off: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration - """ - super().__init__(**kwargs) - self.max_retries = max_retries - self.retry_back_off = retry_back_off - - -class DaprComponentResiliencyPolicyTimeoutPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Dapr Component Resiliency Policy Timeout Policy Configuration. - - :ivar response_timeout_in_seconds: The optional response timeout in seconds. - :vartype response_timeout_in_seconds: int - """ - - _attribute_map = { - "response_timeout_in_seconds": {"key": "responseTimeoutInSeconds", "type": "int"}, - } - - def __init__(self, *, response_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword response_timeout_in_seconds: The optional response timeout in seconds. - :paramtype response_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.response_timeout_in_seconds = response_timeout_in_seconds - - -class DaprComponentsCollection(_serialization.Model): - """Dapr Components ARM resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponent] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[DaprComponent]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.DaprComponent"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponent] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class DaprComponentServiceBinding(_serialization.Model): - """Configuration to bind a Dapr Component to a dev ContainerApp Service. - - :ivar name: Name of the service bind. - :vartype name: str - :ivar service_id: Resource id of the target service. - :vartype service_id: str - :ivar metadata: Service bind metadata. - :vartype metadata: ~azure.mgmt.appcontainers.models.DaprServiceBindMetadata - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "service_id": {"key": "serviceId", "type": "str"}, - "metadata": {"key": "metadata", "type": "DaprServiceBindMetadata"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - service_id: Optional[str] = None, - metadata: Optional["_models.DaprServiceBindMetadata"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the service bind. - :paramtype name: str - :keyword service_id: Resource id of the target service. - :paramtype service_id: str - :keyword metadata: Service bind metadata. - :paramtype metadata: ~azure.mgmt.appcontainers.models.DaprServiceBindMetadata - """ - super().__init__(**kwargs) - self.name = name - self.service_id = service_id - self.metadata = metadata - - -class DaprConfiguration(_serialization.Model): - """Configuration properties Dapr component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The version of Dapr. - :vartype version: str - """ - - _validation = { - "version": {"readonly": True}, + "version": {"readonly": True}, } _attribute_map = { @@ -4432,289 +3408,6 @@ def __init__(self, *, value: List["_models.DaprSecret"], **kwargs: Any) -> None: self.value = value -class DaprServiceBindMetadata(_serialization.Model): - """Dapr component metadata. - - :ivar name: Service bind metadata property name. - :vartype name: str - :ivar value: Service bind metadata property value. - :vartype value: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Service bind metadata property name. - :paramtype name: str - :keyword value: Service bind metadata property value. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class DaprSubscription(ProxyResource): # pylint: disable=too-many-instance-attributes - """Dapr PubSub Event Subscription. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar pubsub_name: Dapr PubSub component name. - :vartype pubsub_name: str - :ivar topic: Topic name. - :vartype topic: str - :ivar dead_letter_topic: Deadletter topic name. - :vartype dead_letter_topic: str - :ivar routes: Subscription routes. - :vartype routes: ~azure.mgmt.appcontainers.models.DaprSubscriptionRoutes - :ivar scopes: Application scopes to restrict the subscription to specific apps. - :vartype scopes: list[str] - :ivar metadata: Subscription metadata. - :vartype metadata: dict[str, str] - :ivar bulk_subscribe: Bulk subscription options. - :vartype bulk_subscribe: ~azure.mgmt.appcontainers.models.DaprSubscriptionBulkSubscribeOptions - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "pubsub_name": {"key": "properties.pubsubName", "type": "str"}, - "topic": {"key": "properties.topic", "type": "str"}, - "dead_letter_topic": {"key": "properties.deadLetterTopic", "type": "str"}, - "routes": {"key": "properties.routes", "type": "DaprSubscriptionRoutes"}, - "scopes": {"key": "properties.scopes", "type": "[str]"}, - "metadata": {"key": "properties.metadata", "type": "{str}"}, - "bulk_subscribe": {"key": "properties.bulkSubscribe", "type": "DaprSubscriptionBulkSubscribeOptions"}, - } - - def __init__( - self, - *, - pubsub_name: Optional[str] = None, - topic: Optional[str] = None, - dead_letter_topic: Optional[str] = None, - routes: Optional["_models.DaprSubscriptionRoutes"] = None, - scopes: Optional[List[str]] = None, - metadata: Optional[Dict[str, str]] = None, - bulk_subscribe: Optional["_models.DaprSubscriptionBulkSubscribeOptions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword pubsub_name: Dapr PubSub component name. - :paramtype pubsub_name: str - :keyword topic: Topic name. - :paramtype topic: str - :keyword dead_letter_topic: Deadletter topic name. - :paramtype dead_letter_topic: str - :keyword routes: Subscription routes. - :paramtype routes: ~azure.mgmt.appcontainers.models.DaprSubscriptionRoutes - :keyword scopes: Application scopes to restrict the subscription to specific apps. - :paramtype scopes: list[str] - :keyword metadata: Subscription metadata. - :paramtype metadata: dict[str, str] - :keyword bulk_subscribe: Bulk subscription options. - :paramtype bulk_subscribe: - ~azure.mgmt.appcontainers.models.DaprSubscriptionBulkSubscribeOptions - """ - super().__init__(**kwargs) - self.pubsub_name = pubsub_name - self.topic = topic - self.dead_letter_topic = dead_letter_topic - self.routes = routes - self.scopes = scopes - self.metadata = metadata - self.bulk_subscribe = bulk_subscribe - - -class DaprSubscriptionBulkSubscribeOptions(_serialization.Model): - """Dapr PubSub Bulk Subscription Options. - - :ivar enabled: Enable bulk subscription. - :vartype enabled: bool - :ivar max_messages_count: Maximum number of messages to deliver in a bulk message. - :vartype max_messages_count: int - :ivar max_await_duration_ms: Maximum duration in milliseconds to wait before a bulk message is - sent to the app. - :vartype max_await_duration_ms: int - """ - - _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - "max_messages_count": {"key": "maxMessagesCount", "type": "int"}, - "max_await_duration_ms": {"key": "maxAwaitDurationMs", "type": "int"}, - } - - def __init__( - self, - *, - enabled: bool = False, - max_messages_count: Optional[int] = None, - max_await_duration_ms: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword enabled: Enable bulk subscription. - :paramtype enabled: bool - :keyword max_messages_count: Maximum number of messages to deliver in a bulk message. - :paramtype max_messages_count: int - :keyword max_await_duration_ms: Maximum duration in milliseconds to wait before a bulk message - is sent to the app. - :paramtype max_await_duration_ms: int - """ - super().__init__(**kwargs) - self.enabled = enabled - self.max_messages_count = max_messages_count - self.max_await_duration_ms = max_await_duration_ms - - -class DaprSubscriptionRouteRule(_serialization.Model): - """Dapr Pubsub Event Subscription Route Rule is used to specify the condition for sending a - message to a specific path. - - :ivar match: The optional CEL expression used to match the event. If the match is not - specified, then the route is considered the default. The rules are tested in the order - specified, so they should be define from most-to-least specific. The default route should - appear last in the list. - :vartype match: str - :ivar path: The path for events that match this rule. - :vartype path: str - """ - - _attribute_map = { - "match": {"key": "match", "type": "str"}, - "path": {"key": "path", "type": "str"}, - } - - def __init__(self, *, match: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword match: The optional CEL expression used to match the event. If the match is not - specified, then the route is considered the default. The rules are tested in the order - specified, so they should be define from most-to-least specific. The default route should - appear last in the list. - :paramtype match: str - :keyword path: The path for events that match this rule. - :paramtype path: str - """ - super().__init__(**kwargs) - self.match = match - self.path = path - - -class DaprSubscriptionRoutes(_serialization.Model): - """Dapr PubSub Event Subscription Routes configuration. - - :ivar rules: The list of Dapr PubSub Event Subscription Route Rules. - :vartype rules: list[~azure.mgmt.appcontainers.models.DaprSubscriptionRouteRule] - :ivar default: The default path to deliver events that do not match any of the rules. - :vartype default: str - """ - - _attribute_map = { - "rules": {"key": "rules", "type": "[DaprSubscriptionRouteRule]"}, - "default": {"key": "default", "type": "str"}, - } - - def __init__( - self, - *, - rules: Optional[List["_models.DaprSubscriptionRouteRule"]] = None, - default: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword rules: The list of Dapr PubSub Event Subscription Route Rules. - :paramtype rules: list[~azure.mgmt.appcontainers.models.DaprSubscriptionRouteRule] - :keyword default: The default path to deliver events that do not match any of the rules. - :paramtype default: str - """ - super().__init__(**kwargs) - self.rules = rules - self.default = default - - -class DaprSubscriptionsCollection(_serialization.Model): - """Dapr Subscriptions ARM resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.DaprSubscription] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[DaprSubscription]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.DaprSubscription"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.DaprSubscription] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class DataDogConfiguration(_serialization.Model): - """Configuration of datadog. - - :ivar site: The data dog site. - :vartype site: str - :ivar key: The data dog api key. - :vartype key: str - """ - - _attribute_map = { - "site": {"key": "site", "type": "str"}, - "key": {"key": "key", "type": "str"}, - } - - def __init__(self, *, site: Optional[str] = None, key: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword site: The data dog site. - :paramtype site: str - :keyword key: The data dog api key. - :paramtype key: str - """ - super().__init__(**kwargs) - self.site = site - self.key = key - - class DefaultAuthorizationPolicy(_serialization.Model): """The configuration settings of the Azure Active Directory default authorization policy. @@ -4854,38 +3547,6 @@ def __init__(self, **kwargs: Any) -> None: self.target = None -class DestinationsConfiguration(_serialization.Model): - """Configuration of Open Telemetry destinations. - - :ivar data_dog_configuration: Open telemetry datadog destination configuration. - :vartype data_dog_configuration: ~azure.mgmt.appcontainers.models.DataDogConfiguration - :ivar otlp_configurations: Open telemetry otlp configurations. - :vartype otlp_configurations: list[~azure.mgmt.appcontainers.models.OtlpConfiguration] - """ - - _attribute_map = { - "data_dog_configuration": {"key": "dataDogConfiguration", "type": "DataDogConfiguration"}, - "otlp_configurations": {"key": "otlpConfigurations", "type": "[OtlpConfiguration]"}, - } - - def __init__( - self, - *, - data_dog_configuration: Optional["_models.DataDogConfiguration"] = None, - otlp_configurations: Optional[List["_models.OtlpConfiguration"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword data_dog_configuration: Open telemetry datadog destination configuration. - :paramtype data_dog_configuration: ~azure.mgmt.appcontainers.models.DataDogConfiguration - :keyword otlp_configurations: Open telemetry otlp configurations. - :paramtype otlp_configurations: list[~azure.mgmt.appcontainers.models.OtlpConfiguration] - """ - super().__init__(**kwargs) - self.data_dog_configuration = data_dog_configuration - self.otlp_configurations = otlp_configurations - - class DiagnosticDataProviderMetadata(_serialization.Model): """Details of a diagnostics data provider. @@ -5328,188 +3989,29 @@ def __init__(self, *, message: Optional[str] = None, status_id: Optional[int] = class DiagnosticSupportTopic(_serialization.Model): """Support topic information. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Unique topic identifier. - :vartype id: str - :ivar pes_id: PES identifier. - :vartype pes_id: str - """ - - _validation = { - "id": {"readonly": True}, - "pes_id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "pes_id": {"key": "pesId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.pes_id = None - - -class DotNetComponent(ProxyResource): - """.NET Component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar component_type: Type of the .NET Component. Known values are: "AspireDashboard" and - "AspireResourceServerApi". - :vartype component_type: str or ~azure.mgmt.appcontainers.models.DotNetComponentType - :ivar provisioning_state: Provisioning state of the .NET Component. Known values are: - "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". - :vartype provisioning_state: str or - ~azure.mgmt.appcontainers.models.DotNetComponentProvisioningState - :ivar configurations: List of .NET Components configuration properties. - :vartype configurations: - list[~azure.mgmt.appcontainers.models.DotNetComponentConfigurationProperty] - :ivar service_binds: List of .NET Components that are bound to the .NET component. - :vartype service_binds: list[~azure.mgmt.appcontainers.models.DotNetComponentServiceBind] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "component_type": {"key": "properties.componentType", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "configurations": {"key": "properties.configurations", "type": "[DotNetComponentConfigurationProperty]"}, - "service_binds": {"key": "properties.serviceBinds", "type": "[DotNetComponentServiceBind]"}, - } - - def __init__( - self, - *, - component_type: Optional[Union[str, "_models.DotNetComponentType"]] = None, - configurations: Optional[List["_models.DotNetComponentConfigurationProperty"]] = None, - service_binds: Optional[List["_models.DotNetComponentServiceBind"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword component_type: Type of the .NET Component. Known values are: "AspireDashboard" and - "AspireResourceServerApi". - :paramtype component_type: str or ~azure.mgmt.appcontainers.models.DotNetComponentType - :keyword configurations: List of .NET Components configuration properties. - :paramtype configurations: - list[~azure.mgmt.appcontainers.models.DotNetComponentConfigurationProperty] - :keyword service_binds: List of .NET Components that are bound to the .NET component. - :paramtype service_binds: list[~azure.mgmt.appcontainers.models.DotNetComponentServiceBind] - """ - super().__init__(**kwargs) - self.component_type = component_type - self.provisioning_state = None - self.configurations = configurations - self.service_binds = service_binds - - -class DotNetComponentConfigurationProperty(_serialization.Model): - """Configuration properties for a .NET Component. - - :ivar property_name: The name of the property. - :vartype property_name: str - :ivar value: The value of the property. - :vartype value: str - """ - - _attribute_map = { - "property_name": {"key": "propertyName", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword property_name: The name of the property. - :paramtype property_name: str - :keyword value: The value of the property. - :paramtype value: str - """ - super().__init__(**kwargs) - self.property_name = property_name - self.value = value - - -class DotNetComponentsCollection(_serialization.Model): - """.NET Components ARM resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.DotNetComponent] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[DotNetComponent]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.DotNetComponent"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.DotNetComponent] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class DotNetComponentServiceBind(_serialization.Model): - """Configuration to bind a .NET Component to another .NET Component. - - :ivar name: Name of the service bind. - :vartype name: str - :ivar service_id: Resource id of the target service. - :vartype service_id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Unique topic identifier. + :vartype id: str + :ivar pes_id: PES identifier. + :vartype pes_id: str """ + _validation = { + "id": {"readonly": True}, + "pes_id": {"readonly": True}, + } + _attribute_map = { - "name": {"key": "name", "type": "str"}, - "service_id": {"key": "serviceId", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "pes_id": {"key": "pesId", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, service_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Name of the service bind. - :paramtype name: str - :keyword service_id: Resource id of the target service. - :paramtype service_id: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.name = name - self.service_id = service_id + self.id = None + self.pes_id = None class EncryptionSettings(_serialization.Model): @@ -5651,39 +4153,6 @@ def __init__( self.secret_ref = secret_ref -class EnvironmentVariable(_serialization.Model): - """Model representing an environment variable. - - All required parameters must be populated in order to send to server. - - :ivar name: Environment variable name. Required. - :vartype name: str - :ivar value: Environment variable value. Required. - :vartype value: str - """ - - _validation = { - "name": {"required": True}, - "value": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: - """ - :keyword name: Environment variable name. Required. - :paramtype name: str - :keyword value: Environment variable value. Required. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. @@ -5962,9 +4431,6 @@ class GithubActionConfiguration(_serialization.Model): :vartype runtime_stack: str :ivar runtime_version: Runtime version. :vartype runtime_version: str - :ivar build_environment_variables: List of environment variables to be passed to the build. - :vartype build_environment_variables: - list[~azure.mgmt.appcontainers.models.EnvironmentVariable] """ _attribute_map = { @@ -5977,7 +4443,6 @@ class GithubActionConfiguration(_serialization.Model): "os": {"key": "os", "type": "str"}, "runtime_stack": {"key": "runtimeStack", "type": "str"}, "runtime_version": {"key": "runtimeVersion", "type": "str"}, - "build_environment_variables": {"key": "buildEnvironmentVariables", "type": "[EnvironmentVariable]"}, } def __init__( @@ -5992,7 +4457,6 @@ def __init__( os: Optional[str] = None, runtime_stack: Optional[str] = None, runtime_version: Optional[str] = None, - build_environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, **kwargs: Any ) -> None: """ @@ -6014,9 +4478,6 @@ def __init__( :paramtype runtime_stack: str :keyword runtime_version: Runtime version. :paramtype runtime_version: str - :keyword build_environment_variables: List of environment variables to be passed to the build. - :paramtype build_environment_variables: - list[~azure.mgmt.appcontainers.models.EnvironmentVariable] """ super().__init__(**kwargs) self.registry_info = registry_info @@ -6028,7 +4489,6 @@ def __init__( self.os = os self.runtime_stack = runtime_stack self.runtime_version = runtime_version - self.build_environment_variables = build_environment_variables class GlobalValidation(_serialization.Model): @@ -6138,218 +4598,6 @@ def __init__( self.validation = validation -class Header(_serialization.Model): - """Header of otlp configuration. - - :ivar key: The key of otlp configuration header. - :vartype key: str - :ivar value: The value of otlp configuration header. - :vartype value: str - """ - - _attribute_map = { - "key": {"key": "key", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, key: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword key: The key of otlp configuration header. - :paramtype key: str - :keyword value: The value of otlp configuration header. - :paramtype value: str - """ - super().__init__(**kwargs) - self.key = key - self.value = value - - -class HeaderMatch(_serialization.Model): - """Conditions required to match a header. - - :ivar header: Name of the header. - :vartype header: str - :ivar exact_match: Exact value of the header. - :vartype exact_match: str - :ivar prefix_match: Prefix value of the header. - :vartype prefix_match: str - :ivar suffix_match: Suffix value of the header. - :vartype suffix_match: str - :ivar regex_match: Regex value of the header. - :vartype regex_match: str - """ - - _attribute_map = { - "header": {"key": "header", "type": "str"}, - "exact_match": {"key": "match.exactMatch", "type": "str"}, - "prefix_match": {"key": "match.prefixMatch", "type": "str"}, - "suffix_match": {"key": "match.suffixMatch", "type": "str"}, - "regex_match": {"key": "match.regexMatch", "type": "str"}, - } - - def __init__( - self, - *, - header: Optional[str] = None, - exact_match: Optional[str] = None, - prefix_match: Optional[str] = None, - suffix_match: Optional[str] = None, - regex_match: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword header: Name of the header. - :paramtype header: str - :keyword exact_match: Exact value of the header. - :paramtype exact_match: str - :keyword prefix_match: Prefix value of the header. - :paramtype prefix_match: str - :keyword suffix_match: Suffix value of the header. - :paramtype suffix_match: str - :keyword regex_match: Regex value of the header. - :paramtype regex_match: str - """ - super().__init__(**kwargs) - self.header = header - self.exact_match = exact_match - self.prefix_match = prefix_match - self.suffix_match = suffix_match - self.regex_match = regex_match - - -class HttpConnectionPool(_serialization.Model): - """Defines parameters for http connection pooling. - - :ivar http1_max_pending_requests: Maximum number of pending http1 requests allowed. - :vartype http1_max_pending_requests: int - :ivar http2_max_requests: Maximum number of http2 requests allowed. - :vartype http2_max_requests: int - """ - - _attribute_map = { - "http1_max_pending_requests": {"key": "http1MaxPendingRequests", "type": "int"}, - "http2_max_requests": {"key": "http2MaxRequests", "type": "int"}, - } - - def __init__( - self, - *, - http1_max_pending_requests: Optional[int] = None, - http2_max_requests: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword http1_max_pending_requests: Maximum number of pending http1 requests allowed. - :paramtype http1_max_pending_requests: int - :keyword http2_max_requests: Maximum number of http2 requests allowed. - :paramtype http2_max_requests: int - """ - super().__init__(**kwargs) - self.http1_max_pending_requests = http1_max_pending_requests - self.http2_max_requests = http2_max_requests - - -class HttpGet(_serialization.Model): - """Model representing a http get request. - - All required parameters must be populated in order to send to server. - - :ivar url: URL to make HTTP GET request against. Required. - :vartype url: str - :ivar file_name: Name of the file that the request should be saved to. - :vartype file_name: str - :ivar headers: List of headers to send with the request. - :vartype headers: list[str] - """ - - _validation = { - "url": {"required": True}, - } - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - "file_name": {"key": "fileName", "type": "str"}, - "headers": {"key": "headers", "type": "[str]"}, - } - - def __init__( - self, *, url: str, file_name: Optional[str] = None, headers: Optional[List[str]] = None, **kwargs: Any - ) -> None: - """ - :keyword url: URL to make HTTP GET request against. Required. - :paramtype url: str - :keyword file_name: Name of the file that the request should be saved to. - :paramtype file_name: str - :keyword headers: List of headers to send with the request. - :paramtype headers: list[str] - """ - super().__init__(**kwargs) - self.url = url - self.file_name = file_name - self.headers = headers - - -class HttpRetryPolicy(_serialization.Model): - """Policy that defines http request retry conditions. - - :ivar max_retries: Maximum number of times a request will retry. - :vartype max_retries: int - :ivar headers: Headers that must be present for a request to be retried. - :vartype headers: list[~azure.mgmt.appcontainers.models.HeaderMatch] - :ivar http_status_codes: Additional http status codes that can trigger a retry. - :vartype http_status_codes: list[int] - :ivar errors: Errors that can trigger a retry. - :vartype errors: list[str] - :ivar initial_delay_in_milliseconds: Initial delay, in milliseconds, before retrying a request. - :vartype initial_delay_in_milliseconds: int - :ivar max_interval_in_milliseconds: Maximum interval, in milliseconds, between retries. - :vartype max_interval_in_milliseconds: int - """ - - _attribute_map = { - "max_retries": {"key": "maxRetries", "type": "int"}, - "headers": {"key": "matches.headers", "type": "[HeaderMatch]"}, - "http_status_codes": {"key": "matches.httpStatusCodes", "type": "[int]"}, - "errors": {"key": "matches.errors", "type": "[str]"}, - "initial_delay_in_milliseconds": {"key": "retryBackOff.initialDelayInMilliseconds", "type": "int"}, - "max_interval_in_milliseconds": {"key": "retryBackOff.maxIntervalInMilliseconds", "type": "int"}, - } - - def __init__( - self, - *, - max_retries: Optional[int] = None, - headers: Optional[List["_models.HeaderMatch"]] = None, - http_status_codes: Optional[List[int]] = None, - errors: Optional[List[str]] = None, - initial_delay_in_milliseconds: Optional[int] = None, - max_interval_in_milliseconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword max_retries: Maximum number of times a request will retry. - :paramtype max_retries: int - :keyword headers: Headers that must be present for a request to be retried. - :paramtype headers: list[~azure.mgmt.appcontainers.models.HeaderMatch] - :keyword http_status_codes: Additional http status codes that can trigger a retry. - :paramtype http_status_codes: list[int] - :keyword errors: Errors that can trigger a retry. - :paramtype errors: list[str] - :keyword initial_delay_in_milliseconds: Initial delay, in milliseconds, before retrying a - request. - :paramtype initial_delay_in_milliseconds: int - :keyword max_interval_in_milliseconds: Maximum interval, in milliseconds, between retries. - :paramtype max_interval_in_milliseconds: int - """ - super().__init__(**kwargs) - self.max_retries = max_retries - self.headers = headers - self.http_status_codes = http_status_codes - self.errors = errors - self.initial_delay_in_milliseconds = initial_delay_in_milliseconds - self.max_interval_in_milliseconds = max_interval_in_milliseconds - - class HttpScaleRule(_serialization.Model): """Container App container Http scaling rule. @@ -6570,10 +4818,6 @@ class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attrib :vartype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy :ivar additional_port_mappings: Settings to expose additional ports on container app. :vartype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] - :ivar target_port_http_scheme: Whether an http app listens on http or https. Known values are: - "http" and "https". - :vartype target_port_http_scheme: str or - ~azure.mgmt.appcontainers.models.IngressTargetPortHttpScheme """ _validation = { @@ -6594,7 +4838,6 @@ class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attrib "client_certificate_mode": {"key": "clientCertificateMode", "type": "str"}, "cors_policy": {"key": "corsPolicy", "type": "CorsPolicy"}, "additional_port_mappings": {"key": "additionalPortMappings", "type": "[IngressPortMapping]"}, - "target_port_http_scheme": {"key": "targetPortHttpScheme", "type": "str"}, } def __init__( @@ -6612,7 +4855,6 @@ def __init__( client_certificate_mode: Optional[Union[str, "_models.IngressClientCertificateMode"]] = None, cors_policy: Optional["_models.CorsPolicy"] = None, additional_port_mappings: Optional[List["_models.IngressPortMapping"]] = None, - target_port_http_scheme: Optional[Union[str, "_models.IngressTargetPortHttpScheme"]] = None, **kwargs: Any ) -> None: """ @@ -6647,10 +4889,6 @@ def __init__( :paramtype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy :keyword additional_port_mappings: Settings to expose additional ports on container app. :paramtype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] - :keyword target_port_http_scheme: Whether an http app listens on http or https. Known values - are: "http" and "https". - :paramtype target_port_http_scheme: str or - ~azure.mgmt.appcontainers.models.IngressTargetPortHttpScheme """ super().__init__(**kwargs) self.fqdn = None @@ -6666,7 +4904,6 @@ def __init__( self.client_certificate_mode = client_certificate_mode self.cors_policy = cors_policy self.additional_port_mappings = additional_port_mappings - self.target_port_http_scheme = target_port_http_scheme class IngressPortMapping(_serialization.Model): @@ -6788,185 +5025,26 @@ def __init__( name: str, ip_address_range: str, action: Union[str, "_models.Action"], - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name for the IP restriction rule. Required. - :paramtype name: str - :keyword description: Describe the IP restriction rule that is being sent to the container-app. - This is an optional field. - :paramtype description: str - :keyword ip_address_range: CIDR notation to match incoming IP address. Required. - :paramtype ip_address_range: str - :keyword action: Allow or Deny rules to determine for incoming IP. Note: Rules can only consist - of ALL Allow or ALL Deny. Required. Known values are: "Allow" and "Deny". - :paramtype action: str or ~azure.mgmt.appcontainers.models.Action - """ - super().__init__(**kwargs) - self.name = name - self.description = description - self.ip_address_range = ip_address_range - self.action = action - - -class JavaComponent(ProxyResource): - """Java Component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar component_type: Type of the Java Component. Known values are: "SpringBootAdmin", - "SpringCloudEureka", and "SpringCloudConfig". - :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType - :ivar provisioning_state: Provisioning state of the Java Component. Known values are: - "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". - :vartype provisioning_state: str or - ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState - :ivar configurations: List of Java Components configuration properties. - :vartype configurations: - list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] - :ivar service_binds: List of Java Components that are bound to the Java component. - :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "component_type": {"key": "properties.componentType", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "configurations": {"key": "properties.configurations", "type": "[JavaComponentConfigurationProperty]"}, - "service_binds": {"key": "properties.serviceBinds", "type": "[JavaComponentServiceBind]"}, - } - - def __init__( - self, - *, - component_type: Optional[Union[str, "_models.JavaComponentType"]] = None, - configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, - service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword component_type: Type of the Java Component. Known values are: "SpringBootAdmin", - "SpringCloudEureka", and "SpringCloudConfig". - :paramtype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType - :keyword configurations: List of Java Components configuration properties. - :paramtype configurations: - list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] - :keyword service_binds: List of Java Components that are bound to the Java component. - :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] - """ - super().__init__(**kwargs) - self.component_type = component_type - self.provisioning_state = None - self.configurations = configurations - self.service_binds = service_binds - - -class JavaComponentConfigurationProperty(_serialization.Model): - """Configuration properties for a Java Component. - - :ivar property_name: The name of the property. - :vartype property_name: str - :ivar value: The value of the property. - :vartype value: str - """ - - _attribute_map = { - "property_name": {"key": "propertyName", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword property_name: The name of the property. - :paramtype property_name: str - :keyword value: The value of the property. - :paramtype value: str - """ - super().__init__(**kwargs) - self.property_name = property_name - self.value = value - - -class JavaComponentsCollection(_serialization.Model): - """Java Components ARM resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.JavaComponent] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[JavaComponent]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.JavaComponent"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.JavaComponent] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class JavaComponentServiceBind(_serialization.Model): - """Configuration to bind a Java Component to another Java Component. - - :ivar name: Name of the service bind. - :vartype name: str - :ivar service_id: Resource id of the target service. - :vartype service_id: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "service_id": {"key": "serviceId", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, service_id: Optional[str] = None, **kwargs: Any) -> None: + description: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword name: Name of the service bind. + :keyword name: Name for the IP restriction rule. Required. :paramtype name: str - :keyword service_id: Resource id of the target service. - :paramtype service_id: str + :keyword description: Describe the IP restriction rule that is being sent to the container-app. + This is an optional field. + :paramtype description: str + :keyword ip_address_range: CIDR notation to match incoming IP address. Required. + :paramtype ip_address_range: str + :keyword action: Allow or Deny rules to determine for incoming IP. Note: Rules can only consist + of ALL Allow or ALL Deny. Required. Known values are: "Allow" and "Deny". + :paramtype action: str or ~azure.mgmt.appcontainers.models.Action """ super().__init__(**kwargs) self.name = name - self.service_id = service_id + self.description = description + self.ip_address_range = ip_address_range + self.action = action class Job(TrackedResource): # pylint: disable=too-many-instance-attributes @@ -6991,8 +5069,6 @@ class Job(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar extended_location: The complex type of the extended location. - :vartype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation :ivar identity: Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity @@ -7031,7 +5107,6 @@ class Job(TrackedResource): # pylint: disable=too-many-instance-attributes "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "environment_id": {"key": "properties.environmentId", "type": "str"}, @@ -7047,7 +5122,6 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - extended_location: Optional["_models.ExtendedLocation"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, environment_id: Optional[str] = None, workload_profile_name: Optional[str] = None, @@ -7060,8 +5134,6 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword extended_location: The complex type of the extended location. - :paramtype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation :keyword identity: Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity @@ -7075,7 +5147,6 @@ def __init__( :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate """ super().__init__(tags=tags, location=location, **kwargs) - self.extended_location = extended_location self.identity = identity self.provisioning_state = None self.environment_id = environment_id @@ -7104,7 +5175,7 @@ class JobConfiguration(_serialization.Model): Properties replicaCompletionCount and parallelism would be set to 1 by default. :vartype manual_trigger_config: ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig - :ivar schedule_trigger_config: Cron formatted repeating trigger schedule ("\ * * * * *") for + :ivar schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") for cronjobs. Properties completions and parallelism would be set to 1 by default. :vartype schedule_trigger_config: ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig @@ -7159,8 +5230,8 @@ def __init__( Properties replicaCompletionCount and parallelism would be set to 1 by default. :paramtype manual_trigger_config: ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig - :keyword schedule_trigger_config: Cron formatted repeating trigger schedule ("\ * * * * *") for - cronjobs. Properties completions and parallelism would be set to 1 by default. + :keyword schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") + for cronjobs. Properties completions and parallelism would be set to 1 by default. :paramtype schedule_trigger_config: ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig :keyword event_trigger_config: Trigger configuration of an event driven job. @@ -7254,7 +5325,7 @@ def __init__( class JobConfigurationScheduleTriggerConfig(_serialization.Model): - """Cron formatted repeating trigger schedule ("\ * * * * *") for cronjobs. Properties completions + """Cron formatted repeating trigger schedule ("\\ * * * * *") for cronjobs. Properties completions and parallelism would be set to 1 by default. All required parameters must be populated in order to send to server. @@ -7262,7 +5333,7 @@ class JobConfigurationScheduleTriggerConfig(_serialization.Model): :ivar replica_completion_count: Minimum number of successful replica completions before overall job completion. :vartype replica_completion_count: int - :ivar cron_expression: Cron formatted repeating schedule ("\ * * * * *") of a Cron Job. + :ivar cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. Required. :vartype cron_expression: str :ivar parallelism: Number of parallel replicas of a job that can run at a given time. @@ -7291,7 +5362,7 @@ def __init__( :keyword replica_completion_count: Minimum number of successful replica completions before overall job completion. :paramtype replica_completion_count: int - :keyword cron_expression: Cron formatted repeating schedule ("\ * * * * *") of a Cron Job. + :keyword cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. Required. :paramtype cron_expression: str :keyword parallelism: Number of parallel replicas of a job that can run at a given time. @@ -7527,8 +5598,6 @@ def __init__( class JobPatchProperties(_serialization.Model): """Container Apps Job resource specific properties. - :ivar extended_location: The complex type of the extended location. - :vartype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation :ivar identity: Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity @@ -7539,7 +5608,6 @@ class JobPatchProperties(_serialization.Model): """ _attribute_map = { - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "tags": {"key": "tags", "type": "{str}"}, "properties": {"key": "properties", "type": "JobPatchPropertiesProperties"}, @@ -7548,15 +5616,12 @@ class JobPatchProperties(_serialization.Model): def __init__( self, *, - extended_location: Optional["_models.ExtendedLocation"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, tags: Optional[Dict[str, str]] = None, properties: Optional["_models.JobPatchPropertiesProperties"] = None, **kwargs: Any ) -> None: """ - :keyword extended_location: The complex type of the extended location. - :paramtype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation :keyword identity: Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity @@ -7566,7 +5631,6 @@ def __init__( :paramtype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties """ super().__init__(**kwargs) - self.extended_location = extended_location self.identity = identity self.tags = tags self.properties = properties @@ -7915,38 +5979,23 @@ class LogAnalyticsConfiguration(_serialization.Model): :vartype customer_id: str :ivar shared_key: Log analytics customer key. :vartype shared_key: str - :ivar dynamic_json_columns: Boolean indicating whether to parse json string log into dynamic - json columns. - :vartype dynamic_json_columns: bool """ _attribute_map = { "customer_id": {"key": "customerId", "type": "str"}, "shared_key": {"key": "sharedKey", "type": "str"}, - "dynamic_json_columns": {"key": "dynamicJsonColumns", "type": "bool"}, } - def __init__( - self, - *, - customer_id: Optional[str] = None, - shared_key: Optional[str] = None, - dynamic_json_columns: Optional[bool] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, customer_id: Optional[str] = None, shared_key: Optional[str] = None, **kwargs: Any) -> None: """ :keyword customer_id: Log analytics customer id. :paramtype customer_id: str :keyword shared_key: Log analytics customer key. :paramtype shared_key: str - :keyword dynamic_json_columns: Boolean indicating whether to parse json string log into dynamic - json columns. - :paramtype dynamic_json_columns: bool """ super().__init__(**kwargs) self.customer_id = customer_id self.shared_key = shared_key - self.dynamic_json_columns = dynamic_json_columns class Login(_serialization.Model): @@ -8058,26 +6107,6 @@ def __init__(self, *, scopes: Optional[List[str]] = None, **kwargs: Any) -> None self.scopes = scopes -class LogsConfiguration(_serialization.Model): - """Configuration of Open Telemetry logs. - - :ivar destinations: Open telemetry logs destinations. - :vartype destinations: list[str] - """ - - _attribute_map = { - "destinations": {"key": "destinations", "type": "[str]"}, - } - - def __init__(self, *, destinations: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword destinations: Open telemetry logs destinations. - :paramtype destinations: list[str] - """ - super().__init__(**kwargs) - self.destinations = destinations - - class ManagedCertificate(TrackedResource): """Managed certificates used for Custom Domain bindings of Container Apps in a Managed Environment. @@ -8279,9 +6308,6 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- :vartype location: str :ivar kind: Kind of the Environment. :vartype kind: str - :ivar identity: Managed identities for the Managed Environment to interact with other Azure - services without maintaining any secrets or credentials in code. - :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity :ivar provisioning_state: Provisioning state of the Environment. Known values are: "Succeeded", "Failed", "Canceled", "Waiting", "InitializationInProgress", "InfrastructureSetupInProgress", "InfrastructureSetupComplete", "ScheduledForDelete", "UpgradeRequested", and "UpgradeFailed". @@ -8305,11 +6331,6 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- app logs to a destination. Currently only "log-analytics" is supported. :vartype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration - :ivar app_insights_configuration: Environment level Application Insights configuration. - :vartype app_insights_configuration: ~azure.mgmt.appcontainers.models.AppInsightsConfiguration - :ivar open_telemetry_configuration: Environment Open Telemetry configuration. - :vartype open_telemetry_configuration: - ~azure.mgmt.appcontainers.models.OpenTelemetryConfiguration :ivar zone_redundant: Whether or not this Managed Environment is zone-redundant. :vartype zone_redundant: bool :ivar custom_domain_configuration: Custom domain configuration for the environment. @@ -8330,6 +6351,9 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- :ivar peer_authentication: Peer authentication settings for the Managed Environment. :vartype peer_authentication: ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication + :ivar peer_traffic_configuration: Peer traffic settings for the Managed Environment. + :vartype peer_traffic_configuration: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration """ _validation = { @@ -8353,7 +6377,6 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "kind": {"key": "kind", "type": "str"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "dapr_ai_instrumentation_key": {"key": "properties.daprAIInstrumentationKey", "type": "str"}, "dapr_ai_connection_string": {"key": "properties.daprAIConnectionString", "type": "str"}, @@ -8362,14 +6385,6 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "default_domain": {"key": "properties.defaultDomain", "type": "str"}, "static_ip": {"key": "properties.staticIp", "type": "str"}, "app_logs_configuration": {"key": "properties.appLogsConfiguration", "type": "AppLogsConfiguration"}, - "app_insights_configuration": { - "key": "properties.appInsightsConfiguration", - "type": "AppInsightsConfiguration", - }, - "open_telemetry_configuration": { - "key": "properties.openTelemetryConfiguration", - "type": "OpenTelemetryConfiguration", - }, "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, "custom_domain_configuration": { "key": "properties.customDomainConfiguration", @@ -8384,6 +6399,10 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "key": "properties.peerAuthentication", "type": "ManagedEnvironmentPropertiesPeerAuthentication", }, + "peer_traffic_configuration": { + "key": "properties.peerTrafficConfiguration", + "type": "ManagedEnvironmentPropertiesPeerTrafficConfiguration", + }, } def __init__( # pylint: disable=too-many-locals @@ -8392,13 +6411,10 @@ def __init__( # pylint: disable=too-many-locals location: str, tags: Optional[Dict[str, str]] = None, kind: Optional[str] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, dapr_ai_instrumentation_key: Optional[str] = None, dapr_ai_connection_string: Optional[str] = None, vnet_configuration: Optional["_models.VnetConfiguration"] = None, app_logs_configuration: Optional["_models.AppLogsConfiguration"] = None, - app_insights_configuration: Optional["_models.AppInsightsConfiguration"] = None, - open_telemetry_configuration: Optional["_models.OpenTelemetryConfiguration"] = None, zone_redundant: Optional[bool] = None, custom_domain_configuration: Optional["_models.CustomDomainConfiguration"] = None, workload_profiles: Optional[List["_models.WorkloadProfile"]] = None, @@ -8406,6 +6422,7 @@ def __init__( # pylint: disable=too-many-locals dapr_configuration: Optional["_models.DaprConfiguration"] = None, infrastructure_resource_group: Optional[str] = None, peer_authentication: Optional["_models.ManagedEnvironmentPropertiesPeerAuthentication"] = None, + peer_traffic_configuration: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfiguration"] = None, **kwargs: Any ) -> None: """ @@ -8415,9 +6432,6 @@ def __init__( # pylint: disable=too-many-locals :paramtype location: str :keyword kind: Kind of the Environment. :paramtype kind: str - :keyword identity: Managed identities for the Managed Environment to interact with other Azure - services without maintaining any secrets or credentials in code. - :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity :keyword dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export Service to Service communication telemetry. :paramtype dapr_ai_instrumentation_key: str @@ -8430,12 +6444,6 @@ def __init__( # pylint: disable=too-many-locals app logs to a destination. Currently only "log-analytics" is supported. :paramtype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration - :keyword app_insights_configuration: Environment level Application Insights configuration. - :paramtype app_insights_configuration: - ~azure.mgmt.appcontainers.models.AppInsightsConfiguration - :keyword open_telemetry_configuration: Environment Open Telemetry configuration. - :paramtype open_telemetry_configuration: - ~azure.mgmt.appcontainers.models.OpenTelemetryConfiguration :keyword zone_redundant: Whether or not this Managed Environment is zone-redundant. :paramtype zone_redundant: bool :keyword custom_domain_configuration: Custom domain configuration for the environment. @@ -8454,10 +6462,12 @@ def __init__( # pylint: disable=too-many-locals :keyword peer_authentication: Peer authentication settings for the Managed Environment. :paramtype peer_authentication: ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication + :keyword peer_traffic_configuration: Peer traffic settings for the Managed Environment. + :paramtype peer_traffic_configuration: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration """ super().__init__(tags=tags, location=location, **kwargs) self.kind = kind - self.identity = identity self.provisioning_state = None self.dapr_ai_instrumentation_key = dapr_ai_instrumentation_key self.dapr_ai_connection_string = dapr_ai_connection_string @@ -8466,8 +6476,6 @@ def __init__( # pylint: disable=too-many-locals self.default_domain = None self.static_ip = None self.app_logs_configuration = app_logs_configuration - self.app_insights_configuration = app_insights_configuration - self.open_telemetry_configuration = open_telemetry_configuration self.zone_redundant = zone_redundant self.custom_domain_configuration = custom_domain_configuration self.event_stream_endpoint = None @@ -8476,6 +6484,7 @@ def __init__( # pylint: disable=too-many-locals self.dapr_configuration = dapr_configuration self.infrastructure_resource_group = infrastructure_resource_group self.peer_authentication = peer_authentication + self.peer_traffic_configuration = peer_traffic_configuration class ManagedEnvironmentPropertiesPeerAuthentication(_serialization.Model): # pylint: disable=name-too-long @@ -8498,6 +6507,55 @@ def __init__(self, *, mtls: Optional["_models.Mtls"] = None, **kwargs: Any) -> N self.mtls = mtls +class ManagedEnvironmentPropertiesPeerTrafficConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Peer traffic settings for the Managed Environment. + + :ivar encryption: Peer traffic encryption settings for the Managed Environment. + :vartype encryption: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + """ + + _attribute_map = { + "encryption": {"key": "encryption", "type": "ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"}, + } + + def __init__( + self, + *, + encryption: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"] = None, + **kwargs: Any + ) -> None: + """ + :keyword encryption: Peer traffic encryption settings for the Managed Environment. + :paramtype encryption: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + """ + super().__init__(**kwargs) + self.encryption = encryption + + +class ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption( + _serialization.Model +): # pylint: disable=name-too-long + """Peer traffic encryption settings for the Managed Environment. + + :ivar enabled: Boolean indicating whether the peer traffic encryption is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Boolean indicating whether the peer traffic encryption is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + class ManagedEnvironmentsCollection(_serialization.Model): """Collection of Environments. @@ -8582,31 +6640,19 @@ class ManagedEnvironmentStorageProperties(_serialization.Model): :ivar azure_file: Azure file properties. :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties - :ivar nfs_azure_file: NFS Azure file properties. - :vartype nfs_azure_file: ~azure.mgmt.appcontainers.models.NfsAzureFileProperties """ _attribute_map = { "azure_file": {"key": "azureFile", "type": "AzureFileProperties"}, - "nfs_azure_file": {"key": "nfsAzureFile", "type": "NfsAzureFileProperties"}, } - def __init__( - self, - *, - azure_file: Optional["_models.AzureFileProperties"] = None, - nfs_azure_file: Optional["_models.NfsAzureFileProperties"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, azure_file: Optional["_models.AzureFileProperties"] = None, **kwargs: Any) -> None: """ :keyword azure_file: Azure file properties. :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties - :keyword nfs_azure_file: NFS Azure file properties. - :paramtype nfs_azure_file: ~azure.mgmt.appcontainers.models.NfsAzureFileProperties """ super().__init__(**kwargs) self.azure_file = azure_file - self.nfs_azure_file = nfs_azure_file class ManagedEnvironmentStoragesCollection(_serialization.Model): @@ -8699,26 +6745,6 @@ def __init__( self.user_assigned_identities = user_assigned_identities -class MetricsConfiguration(_serialization.Model): - """Configuration of Open Telemetry metrics. - - :ivar destinations: Open telemetry metrics destinations. - :vartype destinations: list[str] - """ - - _attribute_map = { - "destinations": {"key": "destinations", "type": "[str]"}, - } - - def __init__(self, *, destinations: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword destinations: Open telemetry metrics destinations. - :paramtype destinations: list[str] - """ - super().__init__(**kwargs) - self.destinations = destinations - - class Mtls(_serialization.Model): """Configuration properties for mutual TLS authentication. @@ -8739,45 +6765,6 @@ def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: self.enabled = enabled -class NfsAzureFileProperties(_serialization.Model): - """NFS Azure File Properties. - - :ivar server: Server for NFS azure file. - :vartype server: str - :ivar access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". - :vartype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode - :ivar share_name: NFS Azure file share name. - :vartype share_name: str - """ - - _attribute_map = { - "server": {"key": "server", "type": "str"}, - "access_mode": {"key": "accessMode", "type": "str"}, - "share_name": {"key": "shareName", "type": "str"}, - } - - def __init__( - self, - *, - server: Optional[str] = None, - access_mode: Optional[Union[str, "_models.AccessMode"]] = None, - share_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword server: Server for NFS azure file. - :paramtype server: str - :keyword access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". - :paramtype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode - :keyword share_name: NFS Azure file share name. - :paramtype share_name: str - """ - super().__init__(**kwargs) - self.server = server - self.access_mode = access_mode - self.share_name = share_name - - class Nonce(_serialization.Model): """The configuration settings of the nonce used in the login flow. @@ -8972,53 +6959,6 @@ def __init__( self.open_id_connect_configuration = open_id_connect_configuration -class OpenTelemetryConfiguration(_serialization.Model): - """Configuration of Open Telemetry. - - :ivar destinations_configuration: Open telemetry destinations configuration. - :vartype destinations_configuration: ~azure.mgmt.appcontainers.models.DestinationsConfiguration - :ivar traces_configuration: Open telemetry trace configuration. - :vartype traces_configuration: ~azure.mgmt.appcontainers.models.TracesConfiguration - :ivar logs_configuration: Open telemetry logs configuration. - :vartype logs_configuration: ~azure.mgmt.appcontainers.models.LogsConfiguration - :ivar metrics_configuration: Open telemetry metrics configuration. - :vartype metrics_configuration: ~azure.mgmt.appcontainers.models.MetricsConfiguration - """ - - _attribute_map = { - "destinations_configuration": {"key": "destinationsConfiguration", "type": "DestinationsConfiguration"}, - "traces_configuration": {"key": "tracesConfiguration", "type": "TracesConfiguration"}, - "logs_configuration": {"key": "logsConfiguration", "type": "LogsConfiguration"}, - "metrics_configuration": {"key": "metricsConfiguration", "type": "MetricsConfiguration"}, - } - - def __init__( - self, - *, - destinations_configuration: Optional["_models.DestinationsConfiguration"] = None, - traces_configuration: Optional["_models.TracesConfiguration"] = None, - logs_configuration: Optional["_models.LogsConfiguration"] = None, - metrics_configuration: Optional["_models.MetricsConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword destinations_configuration: Open telemetry destinations configuration. - :paramtype destinations_configuration: - ~azure.mgmt.appcontainers.models.DestinationsConfiguration - :keyword traces_configuration: Open telemetry trace configuration. - :paramtype traces_configuration: ~azure.mgmt.appcontainers.models.TracesConfiguration - :keyword logs_configuration: Open telemetry logs configuration. - :paramtype logs_configuration: ~azure.mgmt.appcontainers.models.LogsConfiguration - :keyword metrics_configuration: Open telemetry metrics configuration. - :paramtype metrics_configuration: ~azure.mgmt.appcontainers.models.MetricsConfiguration - """ - super().__init__(**kwargs) - self.destinations_configuration = destinations_configuration - self.traces_configuration = traces_configuration - self.logs_configuration = logs_configuration - self.metrics_configuration = metrics_configuration - - class OperationDetail(_serialization.Model): """Operation detail payload. @@ -9111,91 +7051,6 @@ def __init__( self.description = description -class OtlpConfiguration(_serialization.Model): - """Configuration of otlp. - - :ivar name: The name of otlp configuration. - :vartype name: str - :ivar endpoint: The endpoint of otlp configuration. - :vartype endpoint: str - :ivar insecure: Boolean indicating if otlp configuration is insecure. - :vartype insecure: bool - :ivar headers: Headers of otlp configurations. - :vartype headers: list[~azure.mgmt.appcontainers.models.Header] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "endpoint": {"key": "endpoint", "type": "str"}, - "insecure": {"key": "insecure", "type": "bool"}, - "headers": {"key": "headers", "type": "[Header]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - endpoint: Optional[str] = None, - insecure: Optional[bool] = None, - headers: Optional[List["_models.Header"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of otlp configuration. - :paramtype name: str - :keyword endpoint: The endpoint of otlp configuration. - :paramtype endpoint: str - :keyword insecure: Boolean indicating if otlp configuration is insecure. - :paramtype insecure: bool - :keyword headers: Headers of otlp configurations. - :paramtype headers: list[~azure.mgmt.appcontainers.models.Header] - """ - super().__init__(**kwargs) - self.name = name - self.endpoint = endpoint - self.insecure = insecure - self.headers = headers - - -class PreBuildStep(_serialization.Model): - """Model representing a pre-build step. - - :ivar description: Description of the pre-build step. - :vartype description: str - :ivar scripts: List of custom commands to run. - :vartype scripts: list[str] - :ivar http_get: Http get request to send before the build. - :vartype http_get: ~azure.mgmt.appcontainers.models.HttpGet - """ - - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "scripts": {"key": "scripts", "type": "[str]"}, - "http_get": {"key": "httpGet", "type": "HttpGet"}, - } - - def __init__( - self, - *, - description: Optional[str] = None, - scripts: Optional[List[str]] = None, - http_get: Optional["_models.HttpGet"] = None, - **kwargs: Any - ) -> None: - """ - :keyword description: Description of the pre-build step. - :paramtype description: str - :keyword scripts: List of custom commands to run. - :paramtype scripts: list[str] - :keyword http_get: Http get request to send before the build. - :paramtype http_get: ~azure.mgmt.appcontainers.models.HttpGet - """ - super().__init__(**kwargs) - self.description = description - self.scripts = scripts - self.http_get = http_get - - class QueueScaleRule(_serialization.Model): """Container App container Azure Queue based scaling rule. @@ -9892,43 +7747,23 @@ class ServiceBind(_serialization.Model): :vartype service_id: str :ivar name: Name of the service bind. :vartype name: str - :ivar client_type: Type of the client to be used to connect to the service. - :vartype client_type: str - :ivar customized_keys: Customized keys for customizing injected values to the app. - :vartype customized_keys: dict[str, str] """ _attribute_map = { "service_id": {"key": "serviceId", "type": "str"}, "name": {"key": "name", "type": "str"}, - "client_type": {"key": "clientType", "type": "str"}, - "customized_keys": {"key": "customizedKeys", "type": "{str}"}, } - def __init__( - self, - *, - service_id: Optional[str] = None, - name: Optional[str] = None, - client_type: Optional[str] = None, - customized_keys: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, service_id: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword service_id: Resource id of the target service. :paramtype service_id: str :keyword name: Name of the service bind. :paramtype name: str - :keyword client_type: Type of the client to be used to connect to the service. - :paramtype client_type: str - :keyword customized_keys: Customized keys for customizing injected values to the app. - :paramtype customized_keys: dict[str, str] """ super().__init__(**kwargs) self.service_id = service_id self.name = name - self.client_type = client_type - self.customized_keys = customized_keys class SourceControl(ProxyResource): @@ -10108,46 +7943,6 @@ def __init__( self.last_modified_at = last_modified_at -class TcpConnectionPool(_serialization.Model): - """Defines parameters for tcp connection pooling. - - :ivar max_connections: Maximum number of tcp connections allowed. - :vartype max_connections: int - """ - - _attribute_map = { - "max_connections": {"key": "maxConnections", "type": "int"}, - } - - def __init__(self, *, max_connections: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword max_connections: Maximum number of tcp connections allowed. - :paramtype max_connections: int - """ - super().__init__(**kwargs) - self.max_connections = max_connections - - -class TcpRetryPolicy(_serialization.Model): - """Policy that defines tcp request retry conditions. - - :ivar max_connect_attempts: Maximum number of attempts to connect to the tcp service. - :vartype max_connect_attempts: int - """ - - _attribute_map = { - "max_connect_attempts": {"key": "maxConnectAttempts", "type": "int"}, - } - - def __init__(self, *, max_connect_attempts: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword max_connect_attempts: Maximum number of attempts to connect to the tcp service. - :paramtype max_connect_attempts: int - """ - super().__init__(**kwargs) - self.max_connect_attempts = max_connect_attempts - - class TcpScaleRule(_serialization.Model): """Container App container Tcp scaling rule. @@ -10257,40 +8052,6 @@ def __init__( self.service_binds = service_binds -class TimeoutPolicy(_serialization.Model): - """Policy to set request timeouts. - - :ivar response_timeout_in_seconds: Timeout, in seconds, for a request to respond. - :vartype response_timeout_in_seconds: int - :ivar connection_timeout_in_seconds: Timeout, in seconds, for a request to initiate a - connection. - :vartype connection_timeout_in_seconds: int - """ - - _attribute_map = { - "response_timeout_in_seconds": {"key": "responseTimeoutInSeconds", "type": "int"}, - "connection_timeout_in_seconds": {"key": "connectionTimeoutInSeconds", "type": "int"}, - } - - def __init__( - self, - *, - response_timeout_in_seconds: Optional[int] = None, - connection_timeout_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword response_timeout_in_seconds: Timeout, in seconds, for a request to respond. - :paramtype response_timeout_in_seconds: int - :keyword connection_timeout_in_seconds: Timeout, in seconds, for a request to initiate a - connection. - :paramtype connection_timeout_in_seconds: int - """ - super().__init__(**kwargs) - self.response_timeout_in_seconds = response_timeout_in_seconds - self.connection_timeout_in_seconds = connection_timeout_in_seconds - - class TokenStore(_serialization.Model): """The configuration settings of the token store. @@ -10340,26 +8101,6 @@ def __init__( self.azure_blob_storage = azure_blob_storage -class TracesConfiguration(_serialization.Model): - """Configuration of Open Telemetry traces. - - :ivar destinations: Open telemetry traces destinations. - :vartype destinations: list[str] - """ - - _attribute_map = { - "destinations": {"key": "destinations", "type": "[str]"}, - } - - def __init__(self, *, destinations: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword destinations: Open telemetry traces destinations. - :paramtype destinations: list[str] - """ - super().__init__(**kwargs) - self.destinations = destinations - - class TrafficWeight(_serialization.Model): """Traffic weight assigned to a revision. @@ -10653,15 +8394,15 @@ class Volume(_serialization.Model): :ivar name: Volume name. :vartype name: str :ivar storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values - are: "AzureFile", "EmptyDir", "Secret", and "NfsAzureFile". + are: "AzureFile", "EmptyDir", and "Secret". :vartype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :ivar storage_name: Name of storage resource. No need to provide for EmptyDir and Secret. :vartype storage_name: str :ivar secrets: List of secrets to be added in volume. If no secrets are provided, all secrets in collection will be added to volume. :vartype secrets: list[~azure.mgmt.appcontainers.models.SecretVolumeItem] - :ivar mount_options: Mount options used while mounting the Azure file share or NFS Azure file - share. Must be a comma-separated string. + :ivar mount_options: Mount options used while mounting the AzureFile. Must be a comma-separated + string. :vartype mount_options: str """ @@ -10687,15 +8428,15 @@ def __init__( :keyword name: Volume name. :paramtype name: str :keyword storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values - are: "AzureFile", "EmptyDir", "Secret", and "NfsAzureFile". + are: "AzureFile", "EmptyDir", and "Secret". :paramtype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :keyword storage_name: Name of storage resource. No need to provide for EmptyDir and Secret. :paramtype storage_name: str :keyword secrets: List of secrets to be added in volume. If no secrets are provided, all secrets in collection will be added to volume. :paramtype secrets: list[~azure.mgmt.appcontainers.models.SecretVolumeItem] - :keyword mount_options: Mount options used while mounting the Azure file share or NFS Azure - file share. Must be a comma-separated string. + :keyword mount_options: Mount options used while mounting the AzureFile. Must be a + comma-separated string. :paramtype mount_options: str """ super().__init__(**kwargs) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py index 27819202ef8e5..1d1af7c18205d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py @@ -6,14 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._app_resiliency_operations import AppResiliencyOperations from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations from ._available_workload_profiles_operations import AvailableWorkloadProfilesOperations from ._billing_meters_operations import BillingMetersOperations -from ._builders_operations import BuildersOperations -from ._builds_by_builder_resource_operations import BuildsByBuilderResourceOperations -from ._builds_operations import BuildsOperations -from ._build_auth_token_operations import BuildAuthTokenOperations from ._connected_environments_operations import ConnectedEnvironmentsOperations from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations @@ -32,29 +27,20 @@ from ._certificates_operations import CertificatesOperations from ._managed_certificates_operations import ManagedCertificatesOperations from ._namespaces_operations import NamespacesOperations -from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations from ._dapr_components_operations import DaprComponentsOperations -from ._dapr_subscriptions_operations import DaprSubscriptionsOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations from ._usages_operations import UsagesOperations from ._managed_environment_usages_operations import ManagedEnvironmentUsagesOperations -from ._java_components_operations import JavaComponentsOperations -from ._dot_net_components_operations import DotNetComponentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AppResiliencyOperations", "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", - "BuildersOperations", - "BuildsByBuilderResourceOperations", - "BuildsOperations", - "BuildAuthTokenOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", @@ -73,15 +59,11 @@ "CertificatesOperations", "ManagedCertificatesOperations", "NamespacesOperations", - "DaprComponentResiliencyPoliciesOperations", "DaprComponentsOperations", - "DaprSubscriptionsOperations", "ManagedEnvironmentsStoragesOperations", "ContainerAppsSourceControlsOperations", "UsagesOperations", "ManagedEnvironmentUsagesOperations", - "JavaComponentsOperations", - "DotNetComponentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py deleted file mode 100644 index 335c0f80f99ec..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py +++ /dev/null @@ -1,738 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, app_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class AppResiliencyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s - :attr:`app_resiliency` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create_or_update( - self, - resource_group_name: str, - app_name: str, - name: str, - resiliency_envelope: _models.AppResiliency, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AppResiliency: - """Create or update an application's resiliency policy. - - Create or update container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :param resiliency_envelope: The resiliency policy to create or update. Required. - :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - app_name: str, - name: str, - resiliency_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AppResiliency: - """Create or update an application's resiliency policy. - - Create or update container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :param resiliency_envelope: The resiliency policy to create or update. Required. - :type resiliency_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - app_name: str, - name: str, - resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], - **kwargs: Any - ) -> _models.AppResiliency: - """Create or update an application's resiliency policy. - - Create or update container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :param resiliency_envelope: The resiliency policy to create or update. Is either a - AppResiliency type or a IO[bytes] type. Required. - :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resiliency_envelope, (IOBase, bytes)): - _content = resiliency_envelope - else: - _json = self._serialize.body(resiliency_envelope, "AppResiliency") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - app_name=app_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("AppResiliency", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppResiliency", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - app_name: str, - name: str, - resiliency_envelope: _models.AppResiliency, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AppResiliency: - """Update an application's resiliency policy. - - Update container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :param resiliency_envelope: The resiliency policy to update. Required. - :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - app_name: str, - name: str, - resiliency_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AppResiliency: - """Update an application's resiliency policy. - - Update container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :param resiliency_envelope: The resiliency policy to update. Required. - :type resiliency_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - app_name: str, - name: str, - resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], - **kwargs: Any - ) -> _models.AppResiliency: - """Update an application's resiliency policy. - - Update container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :param resiliency_envelope: The resiliency policy to update. Is either a AppResiliency type or - a IO[bytes] type. Required. - :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resiliency_envelope, (IOBase, bytes)): - _content = resiliency_envelope - else: - _json = self._serialize.body(resiliency_envelope, "AppResiliency") - - _request = build_update_request( - resource_group_name=resource_group_name, - app_name=app_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AppResiliency", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, app_name: str, name: str, **kwargs: Any - ) -> None: - """Delete an application's resiliency policy. - - Delete container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - app_name=app_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) -> _models.AppResiliency: - """Get an application's resiliency policy. - - Get container app resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :param name: Name of the resiliency policy. Required. - :type name: str - :return: AppResiliency or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.AppResiliency - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - app_name=app_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AppResiliency", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, app_name: str, **kwargs: Any) -> Iterable["_models.AppResiliency"]: - """List an application's resiliency policies. - - List container app resiliency policies. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param app_name: Name of the Container App. Required. - :type app_name: str - :return: An iterator like instance of either AppResiliency or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.AppResiliency] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AppResiliencyCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - app_name=app_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AppResiliencyCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py index b5b3325841aeb..8c26ddeffe620 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +53,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/availableManagedEnvironmentsWorkloadProfileTypes", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "location": _SERIALIZER.url("location", location, "str", min_length=1), } @@ -102,7 +106,7 @@ def get(self, location: str, **kwargs: Any) -> Iterable["_models.AvailableWorklo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailableWorkloadProfilesCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -136,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py index cc656256a0da5..531d90d1e9034 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +42,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +50,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/billingMeters" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "location": _SERIALIZER.url("location", location, "str", min_length=1), } @@ -92,7 +96,7 @@ def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollection: :rtype: ~azure.mgmt.appcontainers.models.BillingMeterCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +117,6 @@ def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollection: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -128,7 +131,7 @@ def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollection: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BillingMeterCollection", pipeline_response) + deserialized = self._deserialize("BillingMeterCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py deleted file mode 100644 index 03f2551599158..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py +++ /dev/null @@ -1,152 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}/listAuthToken", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "builderName": _SERIALIZER.url( - "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - "buildName": _SERIALIZER.url( - "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildAuthTokenOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s - :attr:`build_auth_token` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any) -> _models.BuildToken: - """Gets the token used to connect to the endpoint where source code can be uploaded for a build. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param build_name: The name of a build. Required. - :type build_name: str - :return: BuildToken or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.BuildToken - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BuildToken] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BuildToken", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py deleted file mode 100644 index 2ee9ea5294f4f..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py +++ /dev/null @@ -1,968 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/builders") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "builderName": _SERIALIZER.url( - "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "builderName": _SERIALIZER.url( - "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "builderName": _SERIALIZER.url( - "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "builderName": _SERIALIZER.url( - "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s - :attr:`builders` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.BuilderResource"]: - """List BuilderResource resources by subscription ID. - - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuilderCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.BuilderResource"]: - """List BuilderResource resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either BuilderResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuilderCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _models.BuilderResource: - """Get a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :return: BuilderResource or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.BuilderResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BuilderResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> _models.BuilderResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_envelope, (IOBase, bytes)): - _content = builder_envelope - else: - _json = self._serialize.body(builder_envelope, "BuilderResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BuilderResource", pipeline_response) - - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = self._deserialize("BuilderResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: _models.BuilderResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuilderResource]: - """Create or update a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param builder_envelope: Resource create parameters. Required. - :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuilderResource]: - """Create or update a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param builder_envelope: Resource create parameters. Required. - :type builder_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: Union[_models.BuilderResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BuilderResource]: - """Create or update a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param builder_envelope: Resource create parameters. Is either a BuilderResource type or a - IO[bytes] type. Required. - :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - builder_name=builder_name, - builder_envelope=builder_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.BuilderResource]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.BuilderResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(builder_envelope, (IOBase, bytes)): - _content = builder_envelope - else: - _json = self._serialize.body(builder_envelope, "BuilderResourceUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BuilderResource", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: _models.BuilderResourceUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuilderResource]: - """Update a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param builder_envelope: The resource properties to be updated. Required. - :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuilderResource]: - """Update a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param builder_envelope: The resource properties to be updated. Required. - :type builder_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - builder_name: str, - builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BuilderResource]: - """Update a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param builder_envelope: The resource properties to be updated. Is either a - BuilderResourceUpdate type or a IO[bytes] type. Required. - :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO[bytes] - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - builder_name=builder_name, - builder_envelope=builder_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuilderResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuilderResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuilderResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, builder_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - builder_name=builder_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py deleted file mode 100644 index b1a3d7ef324fa..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py +++ /dev/null @@ -1,173 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "builderName": _SERIALIZER.url( - "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildsByBuilderResourceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s - :attr:`builds_by_builder_resource` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> Iterable["_models.BuildResource"]: - """List BuildResource resources by BuilderResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :return: An iterator like instance of either BuildResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuildResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuildCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py deleted file mode 100644 index 8007534cc4aec..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py +++ /dev/null @@ -1,552 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "builderName": _SERIALIZER.url( - "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - "buildName": _SERIALIZER.url( - "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "builderName": _SERIALIZER.url( - "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - "buildName": _SERIALIZER.url( - "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "builderName": _SERIALIZER.url( - "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - "buildName": _SERIALIZER.url( - "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class BuildsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s - :attr:`builds` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any) -> _models.BuildResource: - """Get a BuildResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param build_name: The name of a build. Required. - :type build_name: str - :return: BuildResource or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.BuildResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BuildResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - builder_name: str, - build_name: str, - build_envelope: Union[_models.BuildResource, IO[bytes]], - **kwargs: Any - ) -> _models.BuildResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_envelope, (IOBase, bytes)): - _content = build_envelope - else: - _json = self._serialize.body(build_envelope, "BuildResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BuildResource", pipeline_response) - - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = self._deserialize("BuildResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - builder_name: str, - build_name: str, - build_envelope: _models.BuildResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildResource]: - """Create a BuildResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param build_name: The name of a build. Required. - :type build_name: str - :param build_envelope: Resource create or update parameters. Required. - :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - builder_name: str, - build_name: str, - build_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildResource]: - """Create a BuildResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param build_name: The name of a build. Required. - :type build_name: str - :param build_envelope: Resource create or update parameters. Required. - :type build_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BuildResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - builder_name: str, - build_name: str, - build_envelope: Union[_models.BuildResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BuildResource]: - """Create a BuildResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param build_name: The name of a build. Required. - :type build_name: str - :param build_envelope: Resource create or update parameters. Is either a BuildResource type or - a IO[bytes] type. Required. - :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO[bytes] - :return: An instance of LROPoller that returns either BuildResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - builder_name=builder_name, - build_name=build_name, - build_envelope=build_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BuildResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BuildResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BuildResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - builder_name=builder_name, - build_name=build_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a BuildResource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param builder_name: The name of the builder. Required. - :type builder_name: str - :param build_name: The name of a build. Required. - :type build_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - builder_name=builder_name, - build_name=build_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py index 2739382988f7f..b52f67269b186 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +56,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +89,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +114,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +124,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,7 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +160,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -181,7 +185,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -191,7 +195,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -252,7 +256,7 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -271,7 +275,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -287,7 +290,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -336,7 +338,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +361,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +375,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -472,7 +473,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +511,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -525,7 +525,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -551,7 +551,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -574,7 +574,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -683,7 +682,7 @@ def update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,7 +717,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -733,7 +731,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py index e06b5f9cbd783..5ee5787e9b13e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +56,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +93,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -118,7 +122,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +132,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -159,7 +163,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +172,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -197,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -207,7 +211,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -270,7 +274,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -289,7 +293,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -305,7 +308,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -354,7 +356,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,7 +379,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -392,7 +393,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -490,7 +491,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -528,7 +529,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -543,7 +543,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -569,7 +569,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -592,7 +592,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -701,7 +700,7 @@ def update( :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -736,7 +735,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -751,7 +749,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py index db1d06c8ffd30..e17fc47ace786 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +56,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +89,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +114,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +124,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,7 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +160,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -181,7 +185,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +194,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -251,7 +255,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -270,7 +274,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -286,7 +289,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -335,7 +337,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -358,7 +360,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -373,7 +374,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -471,7 +472,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -506,7 +507,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -521,7 +521,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +547,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -570,7 +570,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -607,7 +606,7 @@ def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -630,7 +629,6 @@ def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -645,7 +643,7 @@ def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprSecretsCollection", pipeline_response) + deserialized = self._deserialize("DaprSecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py index 8bc2e4540fbcd..8cc118ef41eda 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,13 +49,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +82,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -99,7 +105,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +114,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -132,7 +138,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +148,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -168,7 +174,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +183,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -201,7 +207,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,7 +216,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -234,7 +240,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -244,7 +250,7 @@ def build_check_name_availability_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/checkNameAvailability", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -300,7 +306,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ConnectedEnvi api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironmentCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -317,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -333,7 +338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -383,7 +387,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironmentCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -401,7 +405,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -417,7 +420,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -462,7 +464,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -484,7 +486,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -499,7 +500,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -512,8 +513,8 @@ def _create_or_update_initial( connected_environment_name: str, environment_envelope: Union[_models.ConnectedEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.ConnectedEnvironment: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -526,7 +527,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectedEnvironment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -547,10 +548,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -558,15 +559,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -673,10 +674,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -700,10 +702,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, connected_environment_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -715,7 +717,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -725,10 +727,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -736,6 +738,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -744,8 +750,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, connected_environment_name: str, **kwargs: Any) -> LROPoller[None]: @@ -771,7 +781,7 @@ def begin_delete(self, resource_group_name: str, connected_environment_name: str lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, api_version=api_version, @@ -780,6 +790,7 @@ def begin_delete(self, resource_group_name: str, connected_environment_name: str params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -820,7 +831,7 @@ def update( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -842,7 +853,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -857,7 +867,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -950,7 +960,7 @@ def check_name_availability( :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -984,7 +994,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -999,7 +1008,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py index 084b50d04075a..b3af32c3d6992 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +54,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -74,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +87,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -108,7 +112,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,7 +122,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -145,7 +149,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +158,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -209,7 +213,7 @@ def list( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStoragesCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +235,6 @@ def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -246,7 +249,7 @@ def list( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStoragesCollection", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentStoragesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -272,7 +275,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +298,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -310,7 +312,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +411,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,7 +446,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -459,7 +460,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -485,7 +486,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +509,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py index b959732eef687..1d368cb997b15 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_job_execution_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +53,7 @@ def build_job_execution_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +80,7 @@ def build_get_custom_domain_verification_id_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +88,7 @@ def build_get_custom_domain_verification_id_request( # pylint: disable=name-too "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/getCustomDomainVerificationId" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -99,6 +103,7 @@ def build_get_custom_domain_verification_id_request( # pylint: disable=name-too class ContainerAppsAPIClientOperationsMixin(ContainerAppsAPIClientMixinABC): + @distributed_trace def job_execution( self, resource_group_name: str, job_name: str, job_execution_name: str, **kwargs: Any @@ -118,7 +123,7 @@ def job_execution( :rtype: ~azure.mgmt.appcontainers.models.JobExecution :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -141,7 +146,6 @@ def job_execution( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -156,7 +160,7 @@ def job_execution( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobExecution", pipeline_response) + deserialized = self._deserialize("JobExecution", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -171,7 +175,7 @@ def get_custom_domain_verification_id(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +195,6 @@ def get_custom_domain_verification_id(self, **kwargs: Any) -> str: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +209,7 @@ def get_custom_domain_verification_id(self, **kwargs: Any) -> str: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py index 6d16ff0bbc57e..9a3a95761f7a1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_by_container_app_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +56,7 @@ def build_list_by_container_app_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +89,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +114,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +124,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,7 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +160,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -217,7 +221,7 @@ def list_by_container_app( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthConfigCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -236,7 +240,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -252,7 +255,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -301,7 +303,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,7 +326,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,7 +340,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AuthConfig", pipeline_response) + deserialized = self._deserialize("AuthConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -437,7 +438,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +473,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +487,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AuthConfig", pipeline_response) + deserialized = self._deserialize("AuthConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -513,7 +513,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -536,7 +536,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py index 5014cf298b1b4..e44dfadc1c0cd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, cast import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +46,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +55,7 @@ def build_list_detectors_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -75,7 +79,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +88,7 @@ def build_get_detector_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -114,7 +118,7 @@ def build_list_revisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +127,7 @@ def build_list_revisions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,7 +153,7 @@ def build_get_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +162,7 @@ def build_get_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/{revisionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -183,7 +187,7 @@ def build_get_root_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +196,7 @@ def build_get_root_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/rootApi/", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -253,7 +257,7 @@ def list_detectors( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -272,7 +276,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -288,7 +291,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -337,7 +339,7 @@ def get_detector( :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +362,6 @@ def get_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +376,7 @@ def get_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Diagnostics", pipeline_response) + deserialized = self._deserialize("Diagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -407,7 +408,7 @@ def list_revisions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RevisionCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +428,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -443,7 +443,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -492,7 +491,7 @@ def get_revision( :rtype: ~azure.mgmt.appcontainers.models.Revision :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -515,7 +514,6 @@ def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -530,7 +528,7 @@ def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -552,11 +550,14 @@ def get_root(self, resource_group_name: str, container_app_name: str, **kwargs: :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -574,7 +575,6 @@ def get_root(self, resource_group_name: str, container_app_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -589,7 +589,7 @@ def get_root(self, resource_group_name: str, container_app_name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py index c4bec66f23cef..00cdac90d313c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,13 +49,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +82,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -99,7 +105,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +114,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -132,7 +138,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +148,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -168,7 +174,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +183,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -201,7 +207,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -211,7 +217,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -242,7 +248,7 @@ def build_list_custom_host_name_analysis_request( # pylint: disable=name-too-lo _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +257,7 @@ def build_list_custom_host_name_analysis_request( # pylint: disable=name-too-lo "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -277,7 +283,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,7 +292,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -310,7 +316,7 @@ def build_get_auth_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -319,7 +325,7 @@ def build_get_auth_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/getAuthtoken", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -343,7 +349,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -352,7 +358,7 @@ def build_start_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/start", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -378,7 +384,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -387,7 +393,7 @@ def build_stop_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -442,7 +448,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ContainerApp" api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -459,7 +465,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -475,7 +480,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -524,7 +528,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +546,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -558,7 +561,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -603,11 +605,14 @@ def get(self, resource_group_name: str, container_app_name: str, **kwargs: Any) :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -625,7 +630,6 @@ def get(self, resource_group_name: str, container_app_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -640,7 +644,7 @@ def get(self, resource_group_name: str, container_app_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -653,8 +657,8 @@ def _create_or_update_initial( container_app_name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> _models.ContainerApp: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -667,7 +671,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -688,10 +692,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -699,15 +703,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -820,10 +824,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -847,10 +852,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -862,7 +865,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -872,10 +875,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -883,6 +886,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -891,8 +898,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> LROPoller[None]: @@ -918,7 +929,7 @@ def begin_delete(self, resource_group_name: str, container_app_name: str, **kwar lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, container_app_name=container_app_name, api_version=api_version, @@ -927,6 +938,7 @@ def begin_delete(self, resource_group_name: str, container_app_name: str, **kwar params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -956,8 +968,8 @@ def _update_initial( container_app_name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ContainerApp]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -970,7 +982,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -991,10 +1003,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1002,18 +1014,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1125,10 +1139,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1169,7 +1184,7 @@ def list_custom_host_name_analysis( :rtype: ~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1192,7 +1207,6 @@ def list_custom_host_name_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1207,7 +1221,7 @@ def list_custom_host_name_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1231,7 +1245,7 @@ def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.SecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1253,7 +1267,6 @@ def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1268,7 +1281,7 @@ def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecretsCollection", pipeline_response) + deserialized = self._deserialize("SecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1292,11 +1305,14 @@ def get_auth_token( :rtype: ~azure.mgmt.appcontainers.models.ContainerAppAuthToken :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -1314,7 +1330,6 @@ def get_auth_token( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1329,17 +1344,15 @@ def get_auth_token( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerAppAuthToken", pipeline_response) + deserialized = self._deserialize("ContainerAppAuthToken", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _start_initial( - self, resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> Optional[_models.ContainerApp]: - error_map = { + def _start_initial(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1351,7 +1364,7 @@ def _start_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -1361,10 +1374,10 @@ def _start_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1372,18 +1385,20 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1425,10 +1440,11 @@ def begin_start( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1452,10 +1468,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _stop_initial( - self, resource_group_name: str, container_app_name: str, **kwargs: Any - ) -> Optional[_models.ContainerApp]: - error_map = { + def _stop_initial(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1467,7 +1481,7 @@ def _stop_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -1477,10 +1491,10 @@ def _stop_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1488,18 +1502,20 @@ def _stop_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1541,10 +1557,11 @@ def begin_stop( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py index 513cfd8687bd9..d268ee7cc2120 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +49,7 @@ def build_get_replica_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +58,7 @@ def build_get_replica_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +84,7 @@ def build_list_replicas_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +93,7 @@ def build_list_replicas_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -148,7 +152,7 @@ def get_replica( :rtype: ~azure.mgmt.appcontainers.models.Replica :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -172,7 +176,6 @@ def get_replica( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -187,7 +190,7 @@ def get_replica( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Replica", pipeline_response) + deserialized = self._deserialize("Replica", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -213,7 +216,7 @@ def list_replicas( :rtype: ~azure.mgmt.appcontainers.models.ReplicaCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -236,7 +239,6 @@ def list_replicas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +253,7 @@ def list_replicas( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ReplicaCollection", pipeline_response) + deserialized = self._deserialize("ReplicaCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py index dbb59afb65585..cfe88374040ca 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +51,7 @@ def build_list_revisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +60,7 @@ def build_list_revisions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -82,7 +86,7 @@ def build_get_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +95,7 @@ def build_get_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -116,7 +120,7 @@ def build_activate_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +129,7 @@ def build_activate_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/activate", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -150,7 +154,7 @@ def build_deactivate_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +163,7 @@ def build_deactivate_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/deactivate", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -184,7 +188,7 @@ def build_restart_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -193,7 +197,7 @@ def build_restart_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/restart", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -256,7 +260,7 @@ def list_revisions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RevisionCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -276,7 +280,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -292,7 +295,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -341,7 +343,7 @@ def get_revision( :rtype: ~azure.mgmt.appcontainers.models.Revision :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -364,7 +366,6 @@ def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +380,7 @@ def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,7 +406,7 @@ def activate_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +429,6 @@ def activate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -465,7 +465,7 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +488,6 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -525,7 +524,7 @@ def restart_revision( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -548,7 +547,6 @@ def restart_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py index 5c56850d64f39..16bfd652f7ff0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +51,7 @@ def build_list_by_container_app_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +60,7 @@ def build_list_by_container_app_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +118,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -122,7 +128,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,7 +155,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +164,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -219,7 +225,7 @@ def list_by_container_app( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControlCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -238,7 +244,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -254,7 +259,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -303,7 +307,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +330,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -341,7 +344,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -355,8 +358,8 @@ def _create_or_update_initial( source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SourceControl: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,7 +372,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -391,10 +394,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -402,15 +405,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -535,10 +538,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -560,10 +564,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,7 +579,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -586,10 +590,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -597,12 +601,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -632,7 +644,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, @@ -642,6 +654,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py deleted file mode 100644 index 8651964a9c97b..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py +++ /dev/null @@ -1,589 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, environment_name: str, component_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, environment_name: str, component_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, environment_name: str, component_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, environment_name: str, component_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DaprComponentResiliencyPoliciesOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s - :attr:`dapr_component_resiliency_policies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, environment_name: str, component_name: str, **kwargs: Any - ) -> Iterable["_models.DaprComponentResiliencyPolicy"]: - """Get the resiliency policies for a Dapr component. - - Get the resiliency policies for a Dapr component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param component_name: Name of the Dapr Component. Required. - :type component_name: str - :return: An iterator like instance of either DaprComponentResiliencyPolicy or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DaprComponentResiliencyPoliciesCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - component_name=component_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DaprComponentResiliencyPoliciesCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any - ) -> _models.DaprComponentResiliencyPolicy: - """Get a Dapr component resiliency policy. - - Get a Dapr component resiliency policy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param component_name: Name of the Dapr Component. Required. - :type component_name: str - :param name: Name of the Dapr Component Resiliency Policy. Required. - :type name: str - :return: DaprComponentResiliencyPolicy or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - component_name=component_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - environment_name: str, - component_name: str, - name: str, - dapr_component_resiliency_policy_envelope: _models.DaprComponentResiliencyPolicy, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DaprComponentResiliencyPolicy: - """Creates or updates a Dapr component resiliency policy. - - Creates or updates a resiliency policy for a Dapr component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param component_name: Name of the Dapr Component. Required. - :type component_name: str - :param name: Name of the Dapr Component Resiliency Policy. Required. - :type name: str - :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component - Resiliency Policy. Required. - :type dapr_component_resiliency_policy_envelope: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DaprComponentResiliencyPolicy or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - environment_name: str, - component_name: str, - name: str, - dapr_component_resiliency_policy_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DaprComponentResiliencyPolicy: - """Creates or updates a Dapr component resiliency policy. - - Creates or updates a resiliency policy for a Dapr component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param component_name: Name of the Dapr Component. Required. - :type component_name: str - :param name: Name of the Dapr Component Resiliency Policy. Required. - :type name: str - :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component - Resiliency Policy. Required. - :type dapr_component_resiliency_policy_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DaprComponentResiliencyPolicy or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - environment_name: str, - component_name: str, - name: str, - dapr_component_resiliency_policy_envelope: Union[_models.DaprComponentResiliencyPolicy, IO[bytes]], - **kwargs: Any - ) -> _models.DaprComponentResiliencyPolicy: - """Creates or updates a Dapr component resiliency policy. - - Creates or updates a resiliency policy for a Dapr component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param component_name: Name of the Dapr Component. Required. - :type component_name: str - :param name: Name of the Dapr Component Resiliency Policy. Required. - :type name: str - :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component - Resiliency Policy. Is either a DaprComponentResiliencyPolicy type or a IO[bytes] type. - Required. - :type dapr_component_resiliency_policy_envelope: - ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy or IO[bytes] - :return: DaprComponentResiliencyPolicy or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dapr_component_resiliency_policy_envelope, (IOBase, bytes)): - _content = dapr_component_resiliency_policy_envelope - else: - _json = self._serialize.body(dapr_component_resiliency_policy_envelope, "DaprComponentResiliencyPolicy") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - component_name=component_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any - ) -> None: - """Delete a Dapr component resiliency policy. - - Delete a resiliency policy for a Dapr component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param component_name: Name of the Dapr Component. Required. - :type component_name: str - :param name: Name of the Dapr Component Resiliency Policy. Required. - :type name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - component_name=component_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py index 6185be9c9fbe3..a73f5b7efe742 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +56,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +89,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +114,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +124,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,7 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +160,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -181,7 +185,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +194,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -249,7 +253,7 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,7 +272,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -284,7 +287,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -333,7 +335,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -356,7 +358,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +372,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -469,7 +470,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +505,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -519,7 +519,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response) + deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -545,7 +545,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -568,7 +568,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -605,7 +604,7 @@ def list_secrets( :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -628,7 +627,6 @@ def list_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -643,7 +641,7 @@ def list_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprSecretsCollection", pipeline_response) + deserialized = self._deserialize("DaprSecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py deleted file mode 100644 index 8b2488ce964ae..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py +++ /dev/null @@ -1,560 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DaprSubscriptionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s - :attr:`dapr_subscriptions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, environment_name: str, **kwargs: Any - ) -> Iterable["_models.DaprSubscription"]: - """Get the Dapr subscriptions for a managed environment. - - Get the Dapr subscriptions for a managed environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :return: An iterator like instance of either DaprSubscription or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprSubscription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DaprSubscriptionsCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DaprSubscriptionsCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> _models.DaprSubscription: - """Get a dapr subscription. - - Get a dapr subscription. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Dapr subscription. Required. - :type name: str - :return: DaprSubscription or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DaprSubscription", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dapr_subscription_envelope: _models.DaprSubscription, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DaprSubscription: - """Creates or updates a Dapr subscription. - - Creates or updates a Dapr subscription in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Dapr subscription. Required. - :type name: str - :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. - :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DaprSubscription or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dapr_subscription_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DaprSubscription: - """Creates or updates a Dapr subscription. - - Creates or updates a Dapr subscription in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Dapr subscription. Required. - :type name: str - :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. - :type dapr_subscription_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DaprSubscription or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dapr_subscription_envelope: Union[_models.DaprSubscription, IO[bytes]], - **kwargs: Any - ) -> _models.DaprSubscription: - """Creates or updates a Dapr subscription. - - Creates or updates a Dapr subscription in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Dapr subscription. Required. - :type name: str - :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Is either a - DaprSubscription type or a IO[bytes] type. Required. - :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription or - IO[bytes] - :return: DaprSubscription or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dapr_subscription_envelope, (IOBase, bytes)): - _content = dapr_subscription_envelope - else: - _json = self._serialize.body(dapr_subscription_envelope, "DaprSubscription") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("DaprSubscription", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DaprSubscription", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> None: - """Delete a Dapr subscription. - - Delete a Dapr subscription from a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Dapr subscription. Required. - :type name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py deleted file mode 100644 index eb95db3a3c785..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py +++ /dev/null @@ -1,917 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class DotNetComponentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s - :attr:`dot_net_components` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, environment_name: str, **kwargs: Any - ) -> Iterable["_models.DotNetComponent"]: - """Get the .NET Components for a managed environment. - - Get the .NET Components for a managed environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :return: An iterator like instance of either DotNetComponent or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DotNetComponentsCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DotNetComponentsCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any) -> _models.DotNetComponent: - """Get a .NET Component. - - Get a .NET Component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :return: DotNetComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DotNetComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DotNetComponent", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], - **kwargs: Any - ) -> _models.DotNetComponent: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dot_net_component_envelope, (IOBase, bytes)): - _content = dot_net_component_envelope - else: - _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("DotNetComponent", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DotNetComponent", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: _models.DotNetComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DotNetComponent]: - """Creates or updates a .NET Component. - - Creates or updates a .NET Component in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :param dot_net_component_envelope: Configuration details of the .NET Component. Required. - :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DotNetComponent or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DotNetComponent]: - """Creates or updates a .NET Component. - - Creates or updates a .NET Component in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :param dot_net_component_envelope: Configuration details of the .NET Component. Required. - :type dot_net_component_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DotNetComponent or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DotNetComponent]: - """Creates or updates a .NET Component. - - Creates or updates a .NET Component in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a - DotNetComponent type or a IO[bytes] type. Required. - :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] - :return: An instance of LROPoller that returns either DotNetComponent or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - dot_net_component_envelope=dot_net_component_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DotNetComponent", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DotNetComponent].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DotNetComponent]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.DotNetComponent]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.DotNetComponent]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dot_net_component_envelope, (IOBase, bytes)): - _content = dot_net_component_envelope - else: - _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") - - _request = build_update_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("DotNetComponent", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: _models.DotNetComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DotNetComponent]: - """Update properties of a .NET Component. - - Patches a .NET Component using JSON Merge Patch. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :param dot_net_component_envelope: Configuration details of the .NET Component. Required. - :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DotNetComponent or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DotNetComponent]: - """Update properties of a .NET Component. - - Patches a .NET Component using JSON Merge Patch. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :param dot_net_component_envelope: Configuration details of the .NET Component. Required. - :type dot_net_component_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DotNetComponent or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DotNetComponent]: - """Update properties of a .NET Component. - - Patches a .NET Component using JSON Merge Patch. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a - DotNetComponent type or a IO[bytes] type. Required. - :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] - :return: An instance of LROPoller that returns either DotNetComponent or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - dot_net_component_envelope=dot_net_component_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DotNetComponent", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DotNetComponent].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DotNetComponent]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a .NET Component. - - Delete a .NET Component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the .NET Component. Required. - :type name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py deleted file mode 100644 index 46f755fed0e0c..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py +++ /dev/null @@ -1,915 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class JavaComponentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s - :attr:`java_components` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> Iterable["_models.JavaComponent"]: - """Get the Java Components for a managed environment. - - Get the Java Components for a managed environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :return: An iterator like instance of either JavaComponent or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.JavaComponentsCollection] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("JavaComponentsCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any) -> _models.JavaComponent: - """Get a Java Component. - - Get a Java Component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :return: JavaComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.JavaComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("JavaComponent", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: Union[_models.JavaComponent, IO[bytes]], - **kwargs: Any - ) -> _models.JavaComponent: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(java_component_envelope, (IOBase, bytes)): - _content = java_component_envelope - else: - _json = self._serialize.body(java_component_envelope, "JavaComponent") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("JavaComponent", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("JavaComponent", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: _models.JavaComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.JavaComponent]: - """Creates or updates a Java Component. - - Creates or updates a Java Component in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :param java_component_envelope: Configuration details of the Java Component. Required. - :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either JavaComponent or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.JavaComponent]: - """Creates or updates a Java Component. - - Creates or updates a Java Component in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :param java_component_envelope: Configuration details of the Java Component. Required. - :type java_component_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either JavaComponent or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: Union[_models.JavaComponent, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.JavaComponent]: - """Creates or updates a Java Component. - - Creates or updates a Java Component in a Managed Environment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :param java_component_envelope: Configuration details of the Java Component. Is either a - JavaComponent type or a IO[bytes] type. Required. - :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] - :return: An instance of LROPoller that returns either JavaComponent or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - java_component_envelope=java_component_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JavaComponent", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.JavaComponent].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.JavaComponent]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: Union[_models.JavaComponent, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.JavaComponent]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.JavaComponent]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(java_component_envelope, (IOBase, bytes)): - _content = java_component_envelope - else: - _json = self._serialize.body(java_component_envelope, "JavaComponent") - - _request = build_update_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("JavaComponent", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: _models.JavaComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.JavaComponent]: - """Update properties of a Java Component. - - Patches a Java Component using JSON Merge Patch. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :param java_component_envelope: Configuration details of the Java Component. Required. - :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either JavaComponent or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.JavaComponent]: - """Update properties of a Java Component. - - Patches a Java Component using JSON Merge Patch. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :param java_component_envelope: Configuration details of the Java Component. Required. - :type java_component_envelope: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either JavaComponent or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - environment_name: str, - name: str, - java_component_envelope: Union[_models.JavaComponent, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.JavaComponent]: - """Update properties of a Java Component. - - Patches a Java Component using JSON Merge Patch. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :param java_component_envelope: Configuration details of the Java Component. Is either a - JavaComponent type or a IO[bytes] type. Required. - :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] - :return: An instance of LROPoller that returns either JavaComponent or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - java_component_envelope=java_component_envelope, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JavaComponent", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.JavaComponent].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.JavaComponent]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Java Component. - - Delete a Java Component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param environment_name: Name of the Managed Environment. Required. - :type environment_name: str - :param name: Name of the Java Component. Required. - :type name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - environment_name=environment_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py index eee36884768af..2a817c4e35f75 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +55,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -115,7 +119,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppJobExecutions] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -135,7 +139,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -151,7 +154,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py index 9ad72330b0e7e..823ccca2a63e7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +51,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +60,7 @@ def build_list_detectors_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,7 +84,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +93,7 @@ def build_get_detector_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors/{detectorName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -107,13 +113,12 @@ def build_get_detector_request( def build_proxy_get_request( - resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, job_name: str, api_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_name: Literal["rootApi"] = kwargs.pop("api_name", "rootApi") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,12 +127,12 @@ def build_proxy_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectorProperties/{apiName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), - "apiName": _SERIALIZER.url("api_name", api_name, "str"), + "apiName": _SERIALIZER.url("api_name", api_name, "str", pattern=r"^[-\w\._]+$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -145,13 +150,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/jobs") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -169,7 +174,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +183,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -199,7 +204,7 @@ def build_get_request(resource_group_name: str, job_name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +213,7 @@ def build_get_request(resource_group_name: str, job_name: str, subscription_id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -232,7 +237,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -242,7 +247,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -266,7 +271,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -275,7 +280,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -297,7 +302,7 @@ def build_update_request(resource_group_name: str, job_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -307,7 +312,7 @@ def build_update_request(resource_group_name: str, job_name: str, subscription_i "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -331,7 +336,7 @@ def build_start_request(resource_group_name: str, job_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -341,7 +346,7 @@ def build_start_request(resource_group_name: str, job_name: str, subscription_id "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/start", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -367,7 +372,7 @@ def build_stop_execution_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -376,7 +381,7 @@ def build_stop_execution_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -403,7 +408,7 @@ def build_stop_multiple_executions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -412,7 +417,7 @@ def build_stop_multiple_executions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -436,7 +441,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -445,7 +450,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -483,7 +488,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_detectors(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.DiagnosticsCollection: + def list_detectors(self, resource_group_name: str, job_name: str, **kwargs: Any) -> Iterable["_models.Diagnostics"]: """Get the list of diagnostics for a given Container App Job. Get the list of diagnostics for a Container App Job. @@ -493,11 +498,17 @@ def list_detectors(self, resource_group_name: str, job_name: str, **kwargs: Any) :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str - :return: DiagnosticsCollection or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection + :return: An iterator like instance of either Diagnostics or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Diagnostics] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -505,41 +516,60 @@ def list_detectors(self, resource_group_name: str, job_name: str, **kwargs: Any) } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) + _request = build_list_detectors_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_list_detectors_request( - resource_group_name=resource_group_name, - job_name=job_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace def get_detector( @@ -560,7 +590,7 @@ def get_detector( :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -583,7 +613,6 @@ def get_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -598,7 +627,7 @@ def get_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Diagnostics", pipeline_response) + deserialized = self._deserialize("Diagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -606,8 +635,8 @@ def get_detector( return deserialized # type: ignore @distributed_trace - def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.Job: - """Get the properties for a given Container App Job. + def proxy_get(self, resource_group_name: str, job_name: str, api_name: str, **kwargs: Any) -> _models.Job: + """Get the properties of a Container App Job. Get the properties of a Container App Job. @@ -616,11 +645,13 @@ def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str + :param api_name: Proxy API Name for Container App Job. Required. + :type api_name: str :return: Job or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Job :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -631,20 +662,18 @@ def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_name: Literal["rootApi"] = kwargs.pop("api_name", "rootApi") api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Job] = kwargs.pop("cls", None) _request = build_proxy_get_request( resource_group_name=resource_group_name, job_name=job_name, - subscription_id=self._config.subscription_id, api_name=api_name, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -659,7 +688,7 @@ def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -682,7 +711,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Job"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -699,7 +728,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -715,7 +743,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -764,7 +791,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -782,7 +809,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -798,7 +824,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -843,7 +868,7 @@ def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models :rtype: ~azure.mgmt.appcontainers.models.Job :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -865,7 +890,6 @@ def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -880,7 +904,7 @@ def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -889,8 +913,8 @@ def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models def _create_or_update_initial( self, resource_group_name: str, job_name: str, job_envelope: Union[_models.Job, IO[bytes]], **kwargs: Any - ) -> _models.Job: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -903,7 +927,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Job] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -924,10 +948,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -935,15 +959,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Job", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Job", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1049,10 +1073,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1074,10 +1099,8 @@ def get_long_running_output(pipeline_response): ) return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, job_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1089,7 +1112,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -1099,10 +1122,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1110,6 +1133,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1118,8 +1145,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1145,7 +1176,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, job_name=job_name, api_version=api_version, @@ -1154,6 +1185,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1183,8 +1215,8 @@ def _update_initial( job_name: str, job_envelope: Union[_models.JobPatchProperties, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Job]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1197,7 +1229,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Job]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1218,10 +1250,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1229,18 +1261,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Job", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1349,10 +1383,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Job", pipeline_response) + deserialized = self._deserialize("Job", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1378,8 +1413,8 @@ def _start_initial( job_name: str, template: Optional[Union[_models.JobExecutionTemplate, IO[bytes]]] = None, **kwargs: Any - ) -> Optional[_models.JobExecutionBase]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1392,7 +1427,7 @@ def _start_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.JobExecutionBase]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1416,10 +1451,10 @@ def _start_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1427,18 +1462,20 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("JobExecutionBase", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1550,10 +1587,11 @@ def begin_start( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("JobExecutionBase", pipeline_response) + deserialized = self._deserialize("JobExecutionBase", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1577,10 +1615,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _stop_execution_initial( # pylint: disable=inconsistent-return-statements + def _stop_execution_initial( self, resource_group_name: str, job_name: str, job_execution_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1592,7 +1630,7 @@ def _stop_execution_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_execution_request( resource_group_name=resource_group_name, @@ -1603,10 +1641,10 @@ def _stop_execution_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1614,6 +1652,10 @@ def _stop_execution_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1622,8 +1664,12 @@ def _stop_execution_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_stop_execution( @@ -1653,7 +1699,7 @@ def begin_stop_execution( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._stop_execution_initial( # type: ignore + raw_result = self._stop_execution_initial( resource_group_name=resource_group_name, job_name=job_name, job_execution_name=job_execution_name, @@ -1663,6 +1709,7 @@ def begin_stop_execution( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1688,8 +1735,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _stop_multiple_executions_initial( self, resource_group_name: str, job_name: str, **kwargs: Any - ) -> Optional[_models.ContainerAppJobExecutions]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1701,7 +1748,7 @@ def _stop_multiple_executions_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ContainerAppJobExecutions]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_multiple_executions_request( resource_group_name=resource_group_name, @@ -1711,10 +1758,10 @@ def _stop_multiple_executions_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1722,18 +1769,20 @@ def _stop_multiple_executions_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1776,10 +1825,11 @@ def begin_stop_multiple_executions( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response) + deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1818,7 +1868,7 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - :rtype: ~azure.mgmt.appcontainers.models.JobSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1840,7 +1890,6 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1855,7 +1904,7 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobSecretsCollection", pipeline_response) + deserialized = self._deserialize("JobSecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py index 1d0a9bdec49f9..3a1b2fd048f18 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +51,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +60,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -79,7 +85,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -89,7 +95,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -116,7 +122,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +131,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -150,7 +156,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -160,7 +166,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -187,7 +193,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +202,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -252,7 +258,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,7 +281,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -290,7 +295,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = self._deserialize("ManagedCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -304,13 +309,16 @@ def _create_or_update_initial( managed_certificate_name: str, managed_certificate_envelope: Optional[Union[_models.ManagedCertificate, IO[bytes]]] = None, **kwargs: Any - ) -> _models.ManagedCertificate: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 400: lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), + 400: cast( + Type[HttpResponseError], + lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -319,7 +327,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedCertificate] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -344,10 +352,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -355,15 +363,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ManagedCertificate", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -489,10 +497,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = self._deserialize("ManagedCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -535,7 +544,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -558,7 +567,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -670,7 +678,7 @@ def update( :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -705,7 +713,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -720,7 +727,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedCertificate", pipeline_response) + deserialized = self._deserialize("ManagedCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +757,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedCertificateCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -769,7 +776,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -785,7 +791,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py index 36671189de6e7..28b2c8dd63f38 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +53,7 @@ def build_list_detectors_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -73,7 +77,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +86,7 @@ def build_get_detector_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -137,7 +141,7 @@ def list_detectors( :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +163,6 @@ def list_detectors( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -174,7 +177,7 @@ def list_detectors( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) + deserialized = self._deserialize("DiagnosticsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -200,7 +203,7 @@ def get_detector( :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -223,7 +226,6 @@ def get_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -238,7 +240,7 @@ def get_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Diagnostics", pipeline_response) + deserialized = self._deserialize("Diagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py index 82dec27ebb0a1..3cb052f8ef03a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +55,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/usages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -107,7 +111,7 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,7 +130,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +145,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py index 077dcd413febc..b5b544b084fb5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_get_root_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +53,7 @@ def build_get_root_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorProperties/rootApi/", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -101,7 +105,7 @@ def get_root(self, resource_group_name: str, environment_name: str, **kwargs: An :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +127,6 @@ def get_root(self, resource_group_name: str, environment_name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -138,7 +141,7 @@ def get_root(self, resource_group_name: str, environment_name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py index 4d29d04b1a481..eb2d6a4013389 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,13 +49,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +82,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -99,7 +105,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +114,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -132,7 +138,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +148,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -168,7 +174,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +183,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -201,7 +207,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -211,7 +217,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -237,7 +243,7 @@ def build_get_auth_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +252,7 @@ def build_get_auth_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/getAuthtoken", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -270,7 +276,7 @@ def build_list_workload_profile_states_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -279,7 +285,7 @@ def build_list_workload_profile_states_request( # pylint: disable=name-too-long "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/workloadProfileStates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -332,7 +338,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ManagedEnviro api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironmentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -349,7 +355,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -365,7 +370,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -414,7 +418,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironmentsCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -432,7 +436,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -448,7 +451,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -493,7 +495,7 @@ def get(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -515,7 +517,6 @@ def get(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -530,7 +531,7 @@ def get(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -543,8 +544,8 @@ def _create_or_update_initial( environment_name: str, environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.ManagedEnvironment: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -557,7 +558,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedEnvironment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -578,10 +579,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -589,15 +590,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -710,10 +711,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -735,10 +737,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, environment_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -750,7 +750,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -760,10 +760,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -771,12 +771,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> LROPoller[None]: @@ -802,7 +810,7 @@ def begin_delete(self, resource_group_name: str, environment_name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, environment_name=environment_name, api_version=api_version, @@ -811,6 +819,7 @@ def begin_delete(self, resource_group_name: str, environment_name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -838,8 +847,8 @@ def _update_initial( environment_name: str, environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ManagedEnvironment]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -852,7 +861,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ManagedEnvironment]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -873,10 +882,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -884,13 +893,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1003,10 +1014,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedEnvironment", pipeline_response) + deserialized = self._deserialize("ManagedEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1045,7 +1057,7 @@ def get_auth_token( :rtype: ~azure.mgmt.appcontainers.models.EnvironmentAuthToken :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1067,7 +1079,6 @@ def get_auth_token( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1082,7 +1093,7 @@ def get_auth_token( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EnvironmentAuthToken", pipeline_response) + deserialized = self._deserialize("EnvironmentAuthToken", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1113,7 +1124,7 @@ def list_workload_profile_states( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkloadProfileStatesCollection] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1132,7 +1143,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1148,7 +1158,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py index efdd9a9c7d606..cb9e48e718dee 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +54,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -74,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +87,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -108,7 +112,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,7 +122,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -145,7 +149,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +158,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -209,7 +213,7 @@ def list( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStoragesCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +235,6 @@ def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -246,7 +249,7 @@ def list( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironmentStoragesCollection", pipeline_response) + deserialized = self._deserialize("ManagedEnvironmentStoragesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -272,7 +275,7 @@ def get( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +298,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -310,7 +312,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -408,7 +410,7 @@ def create_or_update( :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -443,7 +445,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -458,7 +459,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response) + deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -484,7 +485,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +508,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py index 56f460ad18baa..0f1cef41dd137 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +45,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -51,7 +55,7 @@ def build_check_name_availability_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/checkNameAvailability", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -174,7 +178,7 @@ def check_name_availability( :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +212,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,7 +226,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py index 1a05294e44289..c0abef6f27ab6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +92,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailableOperations] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -104,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py index 03bc72d242448..a99b84cddefe5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC, _convert_request +from .._vendor import ContainerAppsAPIClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +44,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +53,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -99,7 +103,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -117,7 +121,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -133,7 +136,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/dev_requirements.txt b/sdk/appcontainers/azure-mgmt-appcontainers/dev_requirements.txt index 6ccb7f031ddd6..fa6811a93df07 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/dev_requirements.txt +++ b/sdk/appcontainers/azure-mgmt-appcontainers/dev_requirements.txt @@ -1 +1,3 @@ -e ../../../tools/azure-sdk-tools +-e ../../resources/azure-mgmt-resource +aiohttp \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py deleted file mode 100644 index e98b4e1f846bb..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py +++ /dev/null @@ -1,63 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python app_resiliency_create_or_update.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", - ) - - response = client.app_resiliency.create_or_update( - resource_group_name="rg", - app_name="testcontainerApp0", - name="resiliency-policy-1", - resiliency_envelope={ - "properties": { - "circuitBreakerPolicy": {"consecutiveErrors": 5, "intervalInSeconds": 10, "maxEjectionPercent": 50}, - "httpConnectionPool": {"http1MaxPendingRequests": 1024, "http2MaxRequests": 1024}, - "httpRetryPolicy": { - "matches": { - "errors": ["5xx", "connect-failure", "reset", "retriable-headers", "retriable-status-codes"], - "headers": [{"header": "X-Content-Type", "match": {"prefixMatch": "GOATS"}}], - "httpStatusCodes": [502, 503], - }, - "maxRetries": 5, - "retryBackOff": {"initialDelayInMilliseconds": 1000, "maxIntervalInMilliseconds": 10000}, - }, - "tcpConnectionPool": {"maxConnections": 100}, - "tcpRetryPolicy": {"maxConnectAttempts": 3}, - "timeoutPolicy": {"connectionTimeoutInSeconds": 5, "responseTimeoutInSeconds": 15}, - } - }, - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py deleted file mode 100644 index fab04833c2721..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python app_resiliency_delete.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", - ) - - client.app_resiliency.delete( - resource_group_name="rg", - app_name="testcontainerApp0", - name="resiliency-policy-1", - ) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py deleted file mode 100644 index e351bd2e4a3d7..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py +++ /dev/null @@ -1,48 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python app_resiliency_patch.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", - ) - - response = client.app_resiliency.update( - resource_group_name="rg", - app_name="testcontainerApp0", - name="resiliency-policy-1", - resiliency_envelope={ - "properties": {"timeoutPolicy": {"connectionTimeoutInSeconds": 40, "responseTimeoutInSeconds": 30}} - }, - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_Patch.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py index bbc6ec8fc9b31..624220b479337 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AuthConfigs_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py index 6c96c3fdc91d9..ba040bbd2aa27 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AuthConfigs_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py index 1095283b90d46..3938c1cbfe610 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AuthConfigs_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py index 8edbbff4ffae1..5e68fc393e08b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AuthConfigs_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_ListByContainer.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py index 865e1cbbd4fb6..983b5fa9ee203 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AvailableWorkloadProfiles_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AvailableWorkloadProfiles_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py index dff89c99c4397..a0d779a0e42b7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/BillingMeters_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/BillingMeters_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py deleted file mode 100644 index 0f6707c6de5b0..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python builders_create_or_update.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.builders.begin_create_or_update( - resource_group_name="rg", - builder_name="testBuilder", - builder_envelope={ - "identity": { - "type": "SystemAssigned,UserAssigned", - "userAssignedIdentities": { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": {} - }, - }, - "location": "eastus", - "properties": { - "containerRegistries": [ - { - "containerRegistryServer": "test.azurecr.io", - "identityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", - }, - { - "containerRegistryServer": "test2.azurecr.io", - "identityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", - }, - ], - "environmentId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv", - }, - "tags": {"company": "Microsoft"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py deleted file mode 100644 index 4fde89dd07ac2..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py +++ /dev/null @@ -1,72 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python builds_create_or_update.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.builds.begin_create_or_update( - resource_group_name="rg", - builder_name="testBuilder", - build_name="testBuild-123456789az", - build_envelope={ - "properties": { - "configuration": { - "baseOs": "DebianBullseye", - "environmentVariables": [{"name": "foo1", "value": "bar1"}, {"name": "foo2", "value": "bar2"}], - "platform": "dotnetcore", - "platformVersion": "7.0", - "preBuildSteps": [ - { - "description": "First pre build step.", - "httpGet": { - "fileName": "output.txt", - "headers": ["foo", "bar"], - "url": "https://microsoft.com", - }, - "scripts": ["echo 'hello'", "echo 'world'"], - }, - { - "description": "Second pre build step.", - "httpGet": {"fileName": "output.txt", "headers": ["foo"], "url": "https://microsoft.com"}, - "scripts": ["echo 'hello'", "echo 'again'"], - }, - ], - }, - "destinationContainerRegistry": {"image": "test.azurecr.io/repo:tag", "server": "test.azurecr.io"}, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py deleted file mode 100644 index 0adf09f0fcc0e..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python builds_list_auth_token.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.build_auth_token.list( - resource_group_name="rg", - builder_name="testBuilder", - build_name="testBuild", - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_ListAuthToken.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py deleted file mode 100644 index 804827d402612..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python builds_list_by_builder_resource.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.builds_by_builder_resource.list( - resource_group_name="rg", - builder_name="testBuilder", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_ListByBuilderResource.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py index 675eb5b8c4800..dff91853c9eab 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py deleted file mode 100644 index 68eda9fa19461..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python certificate_create_or_update_from_key_vault.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", - ) - - response = client.certificates.create_or_update( - resource_group_name="examplerg", - environment_name="testcontainerenv", - certificate_name="certificate-firendly-name", - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificate_CreateOrUpdate_FromKeyVault.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py index 2989b2951a35f..90bd4a513edee 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py index 49eeaff2ccb1b..5dcc3680dfa2a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py index 92c3839cc4654..54c16c926ef15 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificates_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py index ec5a8b88a5e70..2cc236f9fce07 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificates_ListByManagedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py index 4006011a62c58..d89bae1c7fdb3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py index 24c5e8187dd4f..cdca5d34c027f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py index eafde70f5640a..00f1ab1a0b5eb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py index f54e0c564dae3..ace6d53f08b06 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py index e7f0720877345..f22d461dea7c6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py index 06e06685241ea..913aa57949a63 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py index 49e23990fabfe..84aa2d9796cbd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py index 6e8f8e7c61407..0d2ee04d43ae3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py index 30dc14394373a..8e001608e83cf 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py @@ -49,13 +49,6 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secrets": [{"name": "masterkey", "value": "keyvalue"}], - "serviceComponentBind": [ - { - "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, - "name": "statestore", - "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", - } - ], "version": "v1", } }, @@ -63,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py index 14fe8bfd6a9f9..929cc80cc9782 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py index 4fbf110564f2b..d6f1966fd4bfb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py index f43c438ddde67..6a55a4e1d8a0f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py index 5c81a547ae0c9..6df6c3e051743 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py index 7bca2f8f07cd7..e73072b39b276 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py index 5d8f8bd244819..313b7128c5474 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py index 52df79f1d7132..ed8b13df7429a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py index 211eaa06ed11a..ede57b26a6555 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py index 860f287b5d10a..5f8bdb48eaf58 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py index adf5251229f18..d9472452801e0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py index d4ba700860eaa..9f302e2a539ca 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py index 2b2bf696fe9a4..0385ae5538092 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py index cec40e7e71268..5f3b4f472f245 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py index ce1cd05f4de82..6e2cdf2b61b5d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py index 9f04441300900..22d752c240f76 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py @@ -34,7 +34,7 @@ def main(): response = client.container_apps.begin_create_or_update( resource_group_name="rg", - container_app_name="testcontainerApp0", + container_app_name="testcontainerapp0", container_app_envelope={ "location": "East US", "properties": { @@ -91,7 +91,7 @@ def main(): ], "stickySessions": {"affinity": "sticky"}, "targetPort": 3000, - "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], + "traffic": [{"label": "production", "revisionName": "testcontainerapp0-ab1234", "weight": 100}], }, "maxInactiveRevisions": 10, "service": {"type": "redis"}, @@ -100,8 +100,8 @@ def main(): "template": { "containers": [ { - "image": "repo/testcontainerApp0:v1", - "name": "testcontainerApp0", + "image": "repo/testcontainerapp0:v1", + "name": "testcontainerapp0", "probes": [ { "httpGet": { @@ -114,19 +114,15 @@ def main(): "type": "Liveness", } ], - "volumeMounts": [ - {"mountPath": "/mnt/path1", "subPath": "subPath1", "volumeName": "azurefile"}, - {"mountPath": "/mnt/path2", "subPath": "subPath2", "volumeName": "nfsazurefile"}, - ], } ], "initContainers": [ { "args": ["-c", "while true; do echo hello; sleep 10;done"], "command": ["/bin/sh"], - "image": "repo/testcontainerApp0:v4", + "image": "repo/testcontainerapp0:v4", "name": "testinitcontainerApp0", - "resources": {"cpu": 0.2, "memory": "100Mi"}, + "resources": {"cpu": 0.5, "memory": "1Gi"}, } ], "scale": { @@ -141,16 +137,10 @@ def main(): }, "serviceBinds": [ { - "clientType": "dotnet", - "customizedKeys": {"DesiredKey": "defaultKey"}, "name": "redisService", "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService", } ], - "volumes": [ - {"name": "azurefile", "storageName": "storage", "storageType": "AzureFile"}, - {"name": "nfsazurefile", "storageName": "nfsStorage", "storageType": "NfsAzureFile"}, - ], }, "workloadProfileName": "My-GP-01", }, @@ -159,6 +149,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py deleted file mode 100644 index 02be9846c6a6c..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py +++ /dev/null @@ -1,150 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python container_apps_create_or_update_connected_environment.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", - ) - - response = client.container_apps.begin_create_or_update( - resource_group_name="rg", - container_app_name="testcontainerApp0", - container_app_envelope={ - "extendedLocation": { - "name": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", - "type": "CustomLocation", - }, - "location": "East US", - "properties": { - "configuration": { - "dapr": { - "appPort": 3000, - "appProtocol": "http", - "enableApiLogging": True, - "enabled": True, - "httpMaxRequestSize": 10, - "httpReadBufferSize": 30, - "logLevel": "debug", - }, - "ingress": { - "additionalPortMappings": [ - {"external": True, "targetPort": 1234}, - {"exposedPort": 3456, "external": False, "targetPort": 2345}, - ], - "clientCertificateMode": "accept", - "corsPolicy": { - "allowCredentials": True, - "allowedHeaders": ["HEADER1", "HEADER2"], - "allowedMethods": ["GET", "POST"], - "allowedOrigins": ["https://a.test.com", "https://b.test.com"], - "exposeHeaders": ["HEADER3", "HEADER4"], - "maxAge": 1234, - }, - "customDomains": [ - { - "bindingType": "SniEnabled", - "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com", - "name": "www.my-name.com", - }, - { - "bindingType": "SniEnabled", - "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com", - "name": "www.my-other-name.com", - }, - ], - "external": True, - "ipSecurityRestrictions": [ - { - "action": "Allow", - "description": "Allowing all IP's within the subnet below to access containerapp", - "ipAddressRange": "192.168.1.1/32", - "name": "Allow work IP A subnet", - }, - { - "action": "Allow", - "description": "Allowing all IP's within the subnet below to access containerapp", - "ipAddressRange": "192.168.1.1/8", - "name": "Allow work IP B subnet", - }, - ], - "stickySessions": {"affinity": "sticky"}, - "targetPort": 3000, - "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], - }, - "maxInactiveRevisions": 10, - }, - "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube", - "template": { - "containers": [ - { - "image": "repo/testcontainerApp0:v1", - "name": "testcontainerApp0", - "probes": [ - { - "httpGet": { - "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], - "path": "/health", - "port": 8080, - }, - "initialDelaySeconds": 3, - "periodSeconds": 3, - "type": "Liveness", - } - ], - } - ], - "initContainers": [ - { - "args": ["-c", "while true; do echo hello; sleep 10;done"], - "command": ["/bin/sh"], - "image": "repo/testcontainerApp0:v4", - "name": "testinitcontainerApp0", - "resources": {"cpu": 0.2, "memory": "100Mi"}, - } - ], - "scale": { - "maxReplicas": 5, - "minReplicas": 1, - "rules": [ - { - "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, - "name": "httpscalingrule", - } - ], - }, - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_CreateOrUpdate_ConnectedEnvironment.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py index d4b0b91bd67d2..5584e089d51f4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py @@ -32,10 +32,10 @@ def main(): client.container_apps.begin_delete( resource_group_name="rg", - container_app_name="testWorkerApp0", + container_app_name="testworkerapp0", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py index 0621e4623d72f..d930996c61b23 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerAppsDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerAppsDiagnostics_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py index 948e502bc3342..76593271c57f4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerAppsDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerAppsDiagnostics_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py index a8f09b0d5a5b9..90c811ae2ed6a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py @@ -30,13 +30,13 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps.get( + response = client.container_apps_diagnostics.get_root( resource_group_name="rg", - container_app_name="testcontainerApp0", + container_app_name="testcontainerapp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py index 97280c262a210..ccc19d0b27a3c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py @@ -32,11 +32,11 @@ def main(): response = client.container_apps.get_auth_token( resource_group_name="rg", - container_app_name="testcontainerApp0", + container_app_name="testcontainerapp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_GetAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py index 3ddd12b249a72..046c42b04668f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py index 762384b44e692..0c3297623ffba 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py index e39c067911649..658867e94928d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py @@ -32,11 +32,11 @@ def main(): response = client.container_apps.list_custom_host_name_analysis( resource_group_name="rg", - container_app_name="testcontainerApp0", + container_app_name="testcontainerapp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListCustomHostNameAnalysis.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py index eb5fab29e6b84..2f46811b10e5a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py @@ -32,11 +32,11 @@ def main(): response = client.container_apps.list_secrets( resource_group_name="rg", - container_app_name="testcontainerApp0", + container_app_name="testcontainerapp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py index 5c90c8d56eac5..3888d2106624c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py @@ -34,7 +34,7 @@ def main(): response = client.container_apps.begin_create_or_update( resource_group_name="rg", - container_app_name="testcontainerAppManagedBy", + container_app_name="testcontainerappmanagedby", container_app_envelope={ "location": "East US", "managedBy": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp", @@ -44,7 +44,7 @@ def main(): "exposedPort": 4000, "external": True, "targetPort": 3000, - "traffic": [{"revisionName": "testcontainerAppManagedBy-ab1234", "weight": 100}], + "traffic": [{"revisionName": "testcontainerappmanagedby-ab1234", "weight": 100}], "transport": "tcp", } }, @@ -52,8 +52,8 @@ def main(): "template": { "containers": [ { - "image": "repo/testcontainerAppManagedBy:v1", - "name": "testcontainerAppManagedBy", + "image": "repo/testcontainerappmanagedby:v1", + "name": "testcontainerappmanagedby", "probes": [ { "initialDelaySeconds": 3, @@ -76,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ManagedBy_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ManagedBy_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py index e0ebd96a01a58..8e098ca5d7535 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py @@ -34,7 +34,7 @@ def main(): response = client.container_apps.begin_update( resource_group_name="rg", - container_app_name="testcontainerApp0", + container_app_name="testcontainerapp0", container_app_envelope={ "location": "East US", "properties": { @@ -78,7 +78,7 @@ def main(): ], "stickySessions": {"affinity": "sticky"}, "targetPort": 3000, - "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], + "traffic": [{"label": "production", "revisionName": "testcontainerapp0-ab1234", "weight": 100}], }, "maxInactiveRevisions": 10, "service": {"type": "redis"}, @@ -86,8 +86,8 @@ def main(): "template": { "containers": [ { - "image": "repo/testcontainerApp0:v1", - "name": "testcontainerApp0", + "image": "repo/testcontainerapp0:v1", + "name": "testcontainerapp0", "probes": [ { "httpGet": { @@ -104,9 +104,9 @@ def main(): ], "initContainers": [ { - "image": "repo/testcontainerApp0:v4", + "image": "repo/testcontainerapp0:v4", "name": "testinitcontainerApp0", - "resources": {"cpu": 0.2, "memory": "100Mi"}, + "resources": {"cpu": 0.5, "memory": "1Gi"}, } ], "scale": { @@ -121,8 +121,6 @@ def main(): }, "serviceBinds": [ { - "clientType": "dotnet", - "customizedKeys": {"DesiredKey": "defaultKey"}, "name": "service", "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/service", } @@ -135,6 +133,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py index 9125f2d8182a6..4b0f2b9068d65 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py @@ -32,11 +32,11 @@ def main(): response = client.container_apps.begin_start( resource_group_name="rg", - container_app_name="testWorkerApp0", + container_app_name="testworkerapp0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Start.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py index 0fc89828ced74..89a46875376b9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py @@ -32,11 +32,11 @@ def main(): response = client.container_apps.begin_stop( resource_group_name="rg", - container_app_name="testWorkerApp0", + container_app_name="testworkerApp0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Stop.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Stop.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py index bd84fa656785b..6a91c457e976f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py @@ -34,7 +34,7 @@ def main(): response = client.container_apps.begin_create_or_update( resource_group_name="rg", - container_app_name="testcontainerAppTcp", + container_app_name="testcontainerapptcp", container_app_envelope={ "location": "East US", "properties": { @@ -43,7 +43,7 @@ def main(): "exposedPort": 4000, "external": True, "targetPort": 3000, - "traffic": [{"revisionName": "testcontainerAppTcp-ab1234", "weight": 100}], + "traffic": [{"revisionName": "testcontainerapptcp-ab1234", "weight": 100}], "transport": "tcp", } }, @@ -51,8 +51,8 @@ def main(): "template": { "containers": [ { - "image": "repo/testcontainerAppTcp:v1", - "name": "testcontainerAppTcp", + "image": "repo/testcontainerapptcp:v1", + "name": "testcontainerapptcp", "probes": [ { "initialDelaySeconds": 3, @@ -75,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_TcpApp_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_TcpApp_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py deleted file mode 100644 index eb3c02bb76d0b..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_component_resiliency_policies_delete.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - client.dapr_component_resiliency_policies.delete( - resource_group_name="examplerg", - environment_name="myenvironment", - component_name="mydaprcomponent", - name="myresiliencypolicy", - ) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicies_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py deleted file mode 100644 index d3a007f916808..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_component_resiliency_policies_get.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dapr_component_resiliency_policies.get( - resource_group_name="examplerg", - environment_name="myenvironment", - component_name="mydaprcomponent", - name="myresiliencypolicy", - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicies_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py deleted file mode 100644 index 1fc552c48b8b0..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_component_resiliency_policies_list.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dapr_component_resiliency_policies.list( - resource_group_name="examplerg", - environment_name="myenvironment", - component_name="mydaprcomponent", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicies_List.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py deleted file mode 100644 index 399c7ed65abf2..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py +++ /dev/null @@ -1,66 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_component_resiliency_policy_create_or_update_all_options.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dapr_component_resiliency_policies.create_or_update( - resource_group_name="examplerg", - environment_name="myenvironment", - component_name="mydaprcomponent", - name="myresiliencypolicy", - dapr_component_resiliency_policy_envelope={ - "properties": { - "inboundPolicy": { - "circuitBreakerPolicy": {"consecutiveErrors": 5, "intervalInSeconds": 4, "timeoutInSeconds": 10}, - "httpRetryPolicy": { - "maxRetries": 15, - "retryBackOff": {"initialDelayInMilliseconds": 2000, "maxIntervalInMilliseconds": 5500}, - }, - "timeoutPolicy": {"responseTimeoutInSeconds": 30}, - }, - "outboundPolicy": { - "circuitBreakerPolicy": {"consecutiveErrors": 3, "intervalInSeconds": 60, "timeoutInSeconds": 20}, - "httpRetryPolicy": { - "maxRetries": 5, - "retryBackOff": {"initialDelayInMilliseconds": 100, "maxIntervalInMilliseconds": 30000}, - }, - "timeoutPolicy": {"responseTimeoutInSeconds": 12}, - }, - } - }, - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_AllOptions.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py deleted file mode 100644 index f3b4323bad94f..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py +++ /dev/null @@ -1,58 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_component_resiliency_policy_create_or_update_outbound_only.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dapr_component_resiliency_policies.create_or_update( - resource_group_name="examplerg", - environment_name="myenvironment", - component_name="mydaprcomponent", - name="myresiliencypolicy", - dapr_component_resiliency_policy_envelope={ - "properties": { - "outboundPolicy": { - "circuitBreakerPolicy": {"consecutiveErrors": 3, "intervalInSeconds": 60, "timeoutInSeconds": 20}, - "httpRetryPolicy": { - "maxRetries": 5, - "retryBackOff": {"initialDelayInMilliseconds": 100, "maxIntervalInMilliseconds": 30000}, - }, - "timeoutPolicy": {"responseTimeoutInSeconds": 12}, - } - } - }, - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_OutboundOnly.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py deleted file mode 100644 index 692e76e00cf4a..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py +++ /dev/null @@ -1,58 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_component_resiliency_policy_create_or_update_sparse_options.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dapr_component_resiliency_policies.create_or_update( - resource_group_name="examplerg", - environment_name="myenvironment", - component_name="mydaprcomponent", - name="myresiliencypolicy", - dapr_component_resiliency_policy_envelope={ - "properties": { - "inboundPolicy": { - "circuitBreakerPolicy": {"consecutiveErrors": 3, "timeoutInSeconds": 20}, - "httpRetryPolicy": { - "maxRetries": 5, - "retryBackOff": {"initialDelayInMilliseconds": 2000, "maxIntervalInMilliseconds": 5500}, - }, - }, - "outboundPolicy": {"timeoutPolicy": {"responseTimeoutInSeconds": 12}}, - } - }, - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_SparseOptions.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py index 98d1b2f380e41..fe6d1a18e37d4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py @@ -49,13 +49,6 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secretStoreComponent": "my-secret-store", - "serviceComponentBind": [ - { - "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, - "name": "statestore", - "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", - } - ], "version": "v1", } }, @@ -63,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py index adff70eea4af7..5e087e9e1be11 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py @@ -49,13 +49,6 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secrets": [{"name": "masterkey", "value": "keyvalue"}], - "serviceComponentBind": [ - { - "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, - "name": "statestore", - "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", - } - ], "version": "v1", } }, @@ -63,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_CreateOrUpdate_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_CreateOrUpdate_Secrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py index edfbdb28f8678..b77e9e25a41b1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py index ec4b1a935bb79..704a23da3223f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_Get_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_Get_SecretStoreComponent.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py index e797ea7a4c3b7..6770615c84dc7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_Get_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_Get_Secrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py index 742c780dd0943..94ea0da382ea4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py index 6071afa6717dc..134ef9102bade 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py deleted file mode 100644 index c78a49eb395b0..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dapr_subscriptions.create_or_update( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mysubscription", - dapr_subscription_envelope={ - "properties": { - "bulkSubscribe": {"enabled": True, "maxAwaitDurationMs": 500, "maxMessagesCount": 123}, - "pubsubName": "mypubsubcomponent", - "routes": {"default": "/products"}, - "scopes": ["warehouseapp", "customersupportapp"], - "topic": "inventory", - } - }, - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_CreateOrUpdate_BulkSubscribeAndScopes.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py deleted file mode 100644 index 4756e5f0cf949..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py +++ /dev/null @@ -1,48 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_subscriptions_create_or_update_default_route.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dapr_subscriptions.create_or_update( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mysubscription", - dapr_subscription_envelope={ - "properties": {"pubsubName": "mypubsubcomponent", "routes": {"default": "/products"}, "topic": "inventory"} - }, - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_CreateOrUpdate_DefaultRoute.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py deleted file mode 100644 index 1005320a7c2a6..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py +++ /dev/null @@ -1,59 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_subscriptions_create_or_update_route_rules_and_metadata.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dapr_subscriptions.create_or_update( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mysubscription", - dapr_subscription_envelope={ - "properties": { - "metadata": {"foo": "bar", "hello": "world"}, - "pubsubName": "mypubsubcomponent", - "routes": { - "default": "/products", - "rules": [ - {"match": "event.type == 'widget'", "path": "/widgets"}, - {"match": "event.type == 'gadget'", "path": "/gadgets"}, - ], - }, - "topic": "inventory", - } - }, - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_CreateOrUpdate_RouteRulesAndMetadata.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py deleted file mode 100644 index ba81e2ee54183..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_subscriptions_delete.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - client.dapr_subscriptions.delete( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mysubscription", - ) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py deleted file mode 100644 index 65b1aaafe2ec7..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_subscriptions_get_bulk_subscribe_and_scopes.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dapr_subscriptions.get( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mypubsubcomponent", - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_Get_BulkSubscribeAndScopes.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py deleted file mode 100644 index 505a1dc57b794..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_subscriptions_get_default_route.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dapr_subscriptions.get( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mypubsubcomponent", - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_Get_DefaultRoute.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py deleted file mode 100644 index 1b75ba87e1558..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_subscriptions_get_route_rules_and_metadata.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dapr_subscriptions.get( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mypubsubcomponent", - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_Get_RouteRulesAndMetadata.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py deleted file mode 100644 index 53d9fdff5473c..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dapr_subscriptions_list.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dapr_subscriptions.list( - resource_group_name="examplerg", - environment_name="myenvironment", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_List.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py deleted file mode 100644 index 083c21be55887..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py +++ /dev/null @@ -1,51 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dot_net_components_create_or_update.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dot_net_components.begin_create_or_update( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mydotnetcomponent", - dot_net_component_envelope={ - "properties": { - "componentType": "AspireDashboard", - "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py deleted file mode 100644 index 124f25f97468a..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py +++ /dev/null @@ -1,57 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dot_net_components_create_or_update_service_bind.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dot_net_components.begin_create_or_update( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mydotnetcomponent", - dot_net_component_envelope={ - "properties": { - "componentType": "AspireDashboard", - "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], - "serviceBinds": [ - { - "name": "yellowcat", - "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat", - } - ], - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_CreateOrUpdate_ServiceBind.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py deleted file mode 100644 index 527ce8b43bcb9..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dot_net_components_get.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dot_net_components.get( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mydotnetcomponent", - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py deleted file mode 100644 index bffb648b2e74d..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dot_net_components_get_service_bind.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dot_net_components.get( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mydotnetcomponent", - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Get_ServiceBind.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py deleted file mode 100644 index 0505fb4bf3955..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dot_net_components_list.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dot_net_components.list( - resource_group_name="examplerg", - environment_name="myenvironment", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_List.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py deleted file mode 100644 index fd153eb24c563..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dot_net_components_list_service_bind.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dot_net_components.list( - resource_group_name="examplerg", - environment_name="myenvironment", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_List_ServiceBind.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py deleted file mode 100644 index 7289c041a76c5..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py +++ /dev/null @@ -1,57 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python dot_net_components_patch_service_bind.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.dot_net_components.begin_update( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mydotnetcomponent", - dot_net_component_envelope={ - "properties": { - "componentType": "AspireDashboard", - "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], - "serviceBinds": [ - { - "name": "yellowcat", - "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat", - } - ], - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Patch_ServiceBind.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py deleted file mode 100644 index 703c852b67360..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python java_components_create_or_update.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.java_components.begin_create_or_update( - resource_group_name="examplerg", - environment_name="myenvironment", - name="myjavacomponent", - java_component_envelope={ - "properties": { - "componentType": "SpringBootAdmin", - "configurations": [ - {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, - {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, - ], - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py deleted file mode 100644 index a7fd208f05a60..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py +++ /dev/null @@ -1,60 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python java_components_create_or_update_service_bind.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.java_components.begin_create_or_update( - resource_group_name="examplerg", - environment_name="myenvironment", - name="myjavacomponent", - java_component_envelope={ - "properties": { - "componentType": "SpringBootAdmin", - "configurations": [ - {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, - {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, - ], - "serviceBinds": [ - { - "name": "yellowcat", - "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat", - } - ], - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_CreateOrUpdate_ServiceBind.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py deleted file mode 100644 index c90fd77d7b3d9..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python java_components_delete.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - client.java_components.begin_delete( - resource_group_name="examplerg", - environment_name="myenvironment", - name="myjavacomponent", - ).result() - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py deleted file mode 100644 index 957441f7e6b64..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python java_components_get.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.java_components.get( - resource_group_name="examplerg", - environment_name="myenvironment", - name="myjavacomponent", - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py deleted file mode 100644 index 51378453d7993..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python java_components_get_service_bind.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.java_components.get( - resource_group_name="examplerg", - environment_name="myenvironment", - name="myjavacomponent", - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Get_ServiceBind.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py deleted file mode 100644 index bfbbba681c61c..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python java_components_list_service_bind.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.java_components.list( - resource_group_name="examplerg", - environment_name="myenvironment", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_List_ServiceBind.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py deleted file mode 100644 index 95689cb92c435..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python java_components_patch.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.java_components.begin_update( - resource_group_name="examplerg", - environment_name="myenvironment", - name="myjavacomponent", - java_component_envelope={ - "properties": { - "componentType": "SpringBootAdmin", - "configurations": [ - {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, - {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, - ], - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Patch.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py deleted file mode 100644 index 4c0daf6835f08..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py +++ /dev/null @@ -1,60 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python java_components_patch_service_bind.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.java_components.begin_update( - resource_group_name="examplerg", - environment_name="myenvironment", - name="myjavacomponent", - java_component_envelope={ - "properties": { - "componentType": "SpringBootAdmin", - "configurations": [ - {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, - {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, - ], - "serviceBinds": [ - { - "name": "yellowcat", - "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat", - } - ], - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Patch_ServiceBind.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py index 226e0f4c27dce..f3ddb4bcde781 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py @@ -34,7 +34,7 @@ def main(): response = client.jobs.begin_create_or_update( resource_group_name="rg", - job_name="testcontainerAppsJob0", + job_name="testcontainerappsjob0", job_envelope={ "location": "East US", "properties": { @@ -48,8 +48,8 @@ def main(): "template": { "containers": [ { - "image": "repo/testcontainerAppsJob0:v1", - "name": "testcontainerAppsJob0", + "image": "repo/testcontainerappsjob0:v1", + "name": "testcontainerappsjob0", "probes": [ { "httpGet": { @@ -62,19 +62,15 @@ def main(): "type": "Liveness", } ], - "volumeMounts": [ - {"mountPath": "/mnt/path1", "subPath": "subPath1", "volumeName": "azurefile"}, - {"mountPath": "/mnt/path2", "subPath": "subPath2", "volumeName": "nfsazurefile"}, - ], } ], "initContainers": [ { "args": ["-c", "while true; do echo hello; sleep 10;done"], "command": ["/bin/sh"], - "image": "repo/testcontainerAppsJob0:v4", + "image": "repo/testcontainerappsjob0:v4", "name": "testinitcontainerAppsJob0", - "resources": {"cpu": 0.2, "memory": "100Mi"}, + "resources": {"cpu": 0.5, "memory": "1Gi"}, } ], }, @@ -84,6 +80,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_CreateorUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_CreateorUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_connected_environment.py deleted file mode 100644 index 3a34b6d23ba3d..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_connected_environment.py +++ /dev/null @@ -1,89 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python job_createor_update_connected_environment.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", - ) - - response = client.jobs.begin_create_or_update( - resource_group_name="rg", - job_name="testcontainerAppsJob0", - job_envelope={ - "extendedLocation": { - "name": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", - "type": "CustomLocation", - }, - "location": "East US", - "properties": { - "configuration": { - "manualTriggerConfig": {"parallelism": 4, "replicaCompletionCount": 1}, - "replicaRetryLimit": 10, - "replicaTimeout": 10, - "triggerType": "Manual", - }, - "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube", - "template": { - "containers": [ - { - "image": "repo/testcontainerAppsJob0:v1", - "name": "testcontainerAppsJob0", - "probes": [ - { - "httpGet": { - "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], - "path": "/health", - "port": 8080, - }, - "initialDelaySeconds": 5, - "periodSeconds": 3, - "type": "Liveness", - } - ], - } - ], - "initContainers": [ - { - "args": ["-c", "while true; do echo hello; sleep 10;done"], - "command": ["/bin/sh"], - "image": "repo/testcontainerAppsJob0:v4", - "name": "testinitcontainerAppsJob0", - "resources": {"cpu": 0.2, "memory": "100Mi"}, - } - ], - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_CreateorUpdate_ConnectedEnvironment.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py index 76642c7b3be05..5e948fcbfd823 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py @@ -34,7 +34,7 @@ def main(): response = client.jobs.begin_create_or_update( resource_group_name="rg", - job_name="testcontainerAppsJob0", + job_name="testcontainerappsjob0", job_envelope={ "location": "East US", "properties": { @@ -61,14 +61,14 @@ def main(): }, "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", "template": { - "containers": [{"image": "repo/testcontainerAppsJob0:v1", "name": "testcontainerAppsJob0"}], + "containers": [{"image": "repo/testcontainerappsjob0:v1", "name": "testcontainerappsjob0"}], "initContainers": [ { "args": ["-c", "while true; do echo hello; sleep 10;done"], "command": ["/bin/sh"], - "image": "repo/testcontainerAppsJob0:v4", + "image": "repo/testcontainerappsjob0:v4", "name": "testinitcontainerAppsJob0", - "resources": {"cpu": 0.2, "memory": "100Mi"}, + "resources": {"cpu": 0.5, "memory": "1Gi"}, } ], }, @@ -78,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_CreateorUpdate_EventTrigger.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_CreateorUpdate_EventTrigger.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py index 707d5be599a98..6b06c167dcf1f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py @@ -32,10 +32,10 @@ def main(): client.jobs.begin_delete( resource_group_name="rg", - job_name="testWorkerContainerAppsJob0", + job_name="testworkercontainerappsjob0", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py index 71e6f219196e9..2f3c4ab1467ce 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py @@ -32,12 +32,12 @@ def main(): response = client.job_execution( resource_group_name="rg", - job_name="testcontainerAppsJob0", + job_name="testcontainerappsjob0", job_execution_name="jobExecution1", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Execution_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Execution_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py index 5c42446c93b7b..ef8f87ed75b2d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py @@ -32,12 +32,12 @@ def main(): response = client.jobs_executions.list( resource_group_name="rg", - job_name="testcontainerAppsJob0", + job_name="testcontainerappsjob0", ) for item in response: print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Executions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Executions_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py index 13df12d0d25af..7e30b8cdc1d29 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py @@ -32,11 +32,11 @@ def main(): response = client.jobs.get( resource_group_name="rg", - job_name="testcontainerAppsJob0", + job_name="testcontainerappsjob0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py index 34492b40251ef..babc393e6e1c0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_GetDetector.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_GetDetector.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py index 43aa91b84e69e..ecd35bee287b2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py @@ -34,9 +34,10 @@ def main(): resource_group_name="mikono-workerapp-test-rg", job_name="mikonojob1", ) - print(response) + for item in response: + print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_ListDetectors.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_ListDetectors.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py index a00a65ae0774d..d8e658773abe5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py @@ -32,11 +32,11 @@ def main(): response = client.jobs.list_secrets( resource_group_name="rg", - job_name="testcontainerAppsJob0", + job_name="testcontainerappsjob0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py index fdd90a62cd4dd..a923c994dd366 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py @@ -34,7 +34,7 @@ def main(): response = client.jobs.begin_update( resource_group_name="rg", - job_name="testcontainerAppsJob0", + job_name="testcontainerappsjob0", job_envelope={ "properties": { "configuration": { @@ -46,8 +46,8 @@ def main(): "template": { "containers": [ { - "image": "repo/testcontainerAppsJob0:v1", - "name": "testcontainerAppsJob0", + "image": "repo/testcontainerappsjob0:v1", + "name": "testcontainerappsjob0", "probes": [ { "httpGet": { @@ -66,9 +66,9 @@ def main(): { "args": ["-c", "while true; do echo hello; sleep 10;done"], "command": ["/bin/sh"], - "image": "repo/testcontainerAppsJob0:v4", + "image": "repo/testcontainerappsjob0:v4", "name": "testinitcontainerAppsJob0", - "resources": {"cpu": 0.2, "memory": "100Mi"}, + "resources": {"cpu": 0.5, "memory": "1Gi"}, } ], }, @@ -78,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py index cb08ef600bde0..2df4d15dc8db2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py @@ -32,11 +32,12 @@ def main(): response = client.jobs.proxy_get( resource_group_name="rg", - job_name="testcontainerAppsJob0", + job_name="testcontainerappsjob0", + api_name="rootApi", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_ProxyGet.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_ProxyGet.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py index 9c45dd9143a22..883c1318f5c0f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py @@ -32,11 +32,11 @@ def main(): response = client.jobs.begin_start( resource_group_name="rg", - job_name="testcontainerAppsJob0", + job_name="testcontainerappsjob0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Start.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py index a35dbe1fdb88b..09a27e753cf65 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py @@ -32,11 +32,11 @@ def main(): client.jobs.begin_stop_execution( resource_group_name="rg", - job_name="testcontainerAppsJob0", + job_name="testcontainerappsjob0", job_execution_name="jobExecution1", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Stop_Execution.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Stop_Execution.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py index fc6afaa7d9e47..e9587c0e5e854 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py @@ -32,11 +32,11 @@ def main(): response = client.jobs.begin_stop_multiple_executions( resource_group_name="rg", - job_name="testcontainerAppsJob0", + job_name="testcontainerappsjob0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Stop_Multiple.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Stop_Multiple.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py index bb74c063d810d..650ce4e217b8b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Jobs_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Jobs_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py index 417ccd48b7b57..043b2a59bb3a9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Jobs_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Jobs_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py index f82b4b92f33ec..ddfc5f4f71b92 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py index d81ae7f29fbe4..7cd14a089046f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py index fcf0c6f806e7b..a7ccc42102b2d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py index 7d3485b3dc423..4941f24b8a2f5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificates_ListByManagedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py index 3d48fd6833788..a1ee2af5d93a3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py index 9654c3282d2cc..9c5737f1cd689 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentDiagnostics_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py index 5869e15ea3a58..60b3bed0ac13c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentDiagnostics_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py index 49df9cba2d413..16677f20f1e66 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentUsages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentUsages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py index d14f9aa12b11e..1ceb49120e57e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py @@ -36,47 +36,17 @@ def main(): resource_group_name="examplerg", environment_name="testcontainerenv", environment_envelope={ - "identity": { - "type": "SystemAssigned, UserAssigned", - "userAssignedIdentities": { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {} - }, - }, "location": "East US", "properties": { - "appInsightsConfiguration": { - "connectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/" - }, - "appLogsConfiguration": { - "logAnalyticsConfiguration": { - "customerId": "string", - "dynamicJsonColumns": True, - "sharedKey": "string", - } - }, + "appLogsConfiguration": {"logAnalyticsConfiguration": {"customerId": "string", "sharedKey": "string"}}, "customDomainConfiguration": { "certificatePassword": "1234", "certificateValue": "Y2VydA==", "dnsSuffix": "www.my-name.com", }, "daprAIConnectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/", - "openTelemetryConfiguration": { - "destinationsConfiguration": { - "dataDogConfiguration": {"key": "000000000000000000000000", "site": "string"}, - "otlpConfigurations": [ - { - "endpoint": "dashboard.k8s.region.azurecontainerapps.io:80", - "headers": [{"key": "api-key", "value": "xxxxxxxxxxx"}], - "insecure": True, - "name": "dashboard", - } - ], - }, - "logsConfiguration": {"destinations": ["appInsights"]}, - "metricsConfiguration": {"destinations": ["dataDog"]}, - "tracesConfiguration": {"destinations": ["appInsights"]}, - }, "peerAuthentication": {"mtls": {"enabled": True}}, + "peerTrafficConfiguration": {"encryption": {"enabled": True}}, "vnetConfiguration": { "infrastructureSubnetId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1" }, @@ -108,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py index bf8b11e1fa3d9..75aab76e8862d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py @@ -77,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py index 75019f367c6cc..69b97651992a4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py index 0f70c08f33661..21ecd8d3baffe 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py @@ -9,7 +9,6 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient - """ # PREREQUISITES pip install azure-identity @@ -22,21 +21,20 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ - - def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - response = client.managed_environments_diagnostics.get_root( - resource_group_name="examplerg", - environment_name="jlaw-demo1", + response = client.managed_environments.get( + resource_group_name='examplerg', + environment_name='jlaw-demo1', ) print(response) - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Get.json if __name__ == "__main__": main() +n__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py index e2020d33fdc3e..3a452548c78ab 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_GetAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py index 6a42e68a13fb3..529bada3b593b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py index 157f4e41569a4..934110969aaf3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py index 7fbce5c401117..fad3cedf2a2dc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_ListWorkloadProfileStates.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_ListWorkloadProfileStates.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py index 6c8a286e29f80..7a89e7285d6f8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py index e1b2ea86cf934..85711c657610f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py deleted file mode 100644 index 41af4163e5811..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py +++ /dev/null @@ -1,48 +0,0 @@ -# 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 typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python managed_environments_storages_create_or_update_nfs_azure_file.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.managed_environments_storages.create_or_update( - resource_group_name="examplerg", - environment_name="managedEnv", - storage_name="jlaw-demo1", - storage_envelope={ - "properties": {"nfsAzureFile": {"accessMode": "ReadOnly", "server": "server1", "shareName": "share1"}} - }, - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate_NfsAzureFile.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py index 2998b568b579d..a942a596aaf20 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py index 0d0955564cd33..6d47c9f474d1a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py deleted file mode 100644 index e61419aaacb15..0000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python managed_environments_storages_get_nfs_azure_file.py - - Before run the sample, please 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. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", - ) - - response = client.managed_environments_storages.get( - resource_group_name="examplerg", - environment_name="managedEnv", - storage_name="jlaw-demo1", - ) - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_Get_NfsAzureFile.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py index eed274629609e..3fa7a7d4b11a2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py index 119af87df18cb..8b3049de36383 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Operations_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py index f1e6923b9510f..f90a1ec8bc8ad 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Replicas_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Replicas_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py index ced67bc699450..d6bda773f347b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Replicas_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Replicas_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py index 16bf6566e1a4d..7b0ed29bf13e0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_Activate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Activate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py index 12cf26fe99f83..e26fdd3716c8c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_Deactivate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Deactivate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py index dd0b6278c92e4..732d0564a0d3a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py @@ -30,7 +30,7 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps_revisions.get_revision( + response = client.container_apps_diagnostics.get_revision( resource_group_name="rg", container_app_name="testcontainerApp0", revision_name="testcontainerApp0-pjxhsye", @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py index c9bde6a3e2c6b..68f48f1db6ded 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py @@ -30,7 +30,7 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps_revisions.list_revisions( + response = client.container_apps_diagnostics.list_revisions( resource_group_name="rg", container_app_name="testcontainerApp0", ) @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py index 3e581135da721..faafa805c6960 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_Restart.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Restart.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py index b2a93c97a1faa..ce791ab93ee03 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py @@ -46,7 +46,6 @@ def main(): "kind": "feaderated", "tenantId": "", }, - "buildEnvironmentVariables": [{"name": "foo1", "value": "bar1"}, {"name": "foo2", "value": "bar2"}], "contextPath": "./", "githubPersonalAccessToken": "test", "image": "image/tag", @@ -63,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/SourceControls_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py index ca22d4352d202..6d0b6b9625766 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/SourceControls_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py index 9276b931e3143..2b0cc9cb70cdc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/SourceControls_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py index 3d8e2b44f0180..1351c607e646a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/SourceControls_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_ListByContainer.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py index cea7244da0989..10e891b6f3b8a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Subscriptions_GetCustomDomainVerificationId.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Subscriptions_GetCustomDomainVerificationId.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py index c3633f4f65d5d..e40fedb4050e5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Usages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Usages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/conftest.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/conftest.py new file mode 100644 index 0000000000000..961ce7cf468ae --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# 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. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + containerappsapi_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + containerappsapi_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + containerappsapi_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + containerappsapi_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerappsapi_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerappsapi_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerappsapi_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerappsapi_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py new file mode 100644 index 0000000000000..d82f71473a23e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py @@ -0,0 +1,42 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPI(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_job_execution(self, resource_group): + response = self.client.job_execution( + resource_group_name=resource_group.name, + job_name="str", + job_execution_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_custom_domain_verification_id(self, resource_group): + response = self.client.get_custom_domain_verification_id( + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py new file mode 100644 index 0000000000000..716eb1d912353 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py @@ -0,0 +1,43 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_job_execution(self, resource_group): + response = await self.client.job_execution( + resource_group_name=resource_group.name, + job_name="str", + job_execution_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_custom_domain_verification_id(self, resource_group): + response = await self.client.get_custom_domain_verification_id( + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py new file mode 100644 index 0000000000000..6948c249259bf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIAvailableWorkloadProfilesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.available_workload_profiles.get( + location="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py new file mode 100644 index 0000000000000..e6ab51877e5e5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py @@ -0,0 +1,31 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIAvailableWorkloadProfilesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = self.client.available_workload_profiles.get( + location="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py new file mode 100644 index 0000000000000..37180bee78a0b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBillingMetersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.billing_meters.get( + location="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py new file mode 100644 index 0000000000000..82c9273ce85eb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py @@ -0,0 +1,31 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBillingMetersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.billing_meters.get( + location="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py new file mode 100644 index 0000000000000..4121a6412c411 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py @@ -0,0 +1,84 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPICertificatesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.certificates.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.certificates.get( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.certificates.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.certificates.delete( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.certificates.update( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py new file mode 100644 index 0000000000000..6d55ddc67e4ba --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py @@ -0,0 +1,85 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPICertificatesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.certificates.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.certificates.get( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.certificates.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.certificates.delete( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.certificates.update( + resource_group_name=resource_group.name, + environment_name="str", + certificate_name="str", + certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py new file mode 100644 index 0000000000000..ae2bdb1f1c8fe --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py @@ -0,0 +1,84 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsCertificatesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.connected_environments_certificates.list( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.connected_environments_certificates.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.connected_environments_certificates.create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.connected_environments_certificates.delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.connected_environments_certificates.update( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py new file mode 100644 index 0000000000000..fdb2391bf1746 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py @@ -0,0 +1,85 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsCertificatesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.connected_environments_certificates.list( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.connected_environments_certificates.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.connected_environments_certificates.create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.connected_environments_certificates.delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.connected_environments_certificates.update( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py new file mode 100644 index 0000000000000..fb3d650fb0acf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py @@ -0,0 +1,104 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsDaprComponentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.connected_environments_dapr_components.list( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.connected_environments_dapr_components.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.connected_environments_dapr_components.create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + dapr_component_envelope={ + "componentType": "str", + "id": "str", + "ignoreErrors": False, + "initTimeout": "str", + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "name": "str", + "scopes": ["str"], + "secretStoreComponent": "str", + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "str", + }, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.connected_environments_dapr_components.delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_secrets(self, resource_group): + response = self.client.connected_environments_dapr_components.list_secrets( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py new file mode 100644 index 0000000000000..988b44a31192a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py @@ -0,0 +1,105 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsDaprComponentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.connected_environments_dapr_components.list( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.connected_environments_dapr_components.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.connected_environments_dapr_components.create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + dapr_component_envelope={ + "componentType": "str", + "id": "str", + "ignoreErrors": False, + "initTimeout": "str", + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "name": "str", + "scopes": ["str"], + "secretStoreComponent": "str", + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "str", + }, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.connected_environments_dapr_components.delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_secrets(self, resource_group): + response = await self.client.connected_environments_dapr_components.list_secrets( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py new file mode 100644 index 0000000000000..ae8eb9f64b0e8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py @@ -0,0 +1,131 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.connected_environments.list_by_subscription( + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.connected_environments.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.connected_environments.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.connected_environments.begin_create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + environment_envelope={ + "location": "str", + "customDomainConfiguration": { + "certificatePassword": "str", + "certificateValue": bytes("bytes", encoding="utf-8"), + "customDomainVerificationId": "str", + "dnsSuffix": "str", + "expirationDate": "2020-02-20 00:00:00", + "subjectName": "str", + "thumbprint": "str", + }, + "daprAIConnectionString": "str", + "defaultDomain": "str", + "deploymentErrors": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "name": "str", + "provisioningState": "str", + "staticIp": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.connected_environments.begin_delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.connected_environments.update( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_name_availability(self, resource_group): + response = self.client.connected_environments.check_name_availability( + resource_group_name=resource_group.name, + connected_environment_name="str", + check_name_availability_request={"name": "str", "type": "str"}, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py new file mode 100644 index 0000000000000..17f6e480b79d4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py @@ -0,0 +1,136 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.connected_environments.list_by_subscription( + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.connected_environments.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.connected_environments.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.connected_environments.begin_create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + environment_envelope={ + "location": "str", + "customDomainConfiguration": { + "certificatePassword": "str", + "certificateValue": bytes("bytes", encoding="utf-8"), + "customDomainVerificationId": "str", + "dnsSuffix": "str", + "expirationDate": "2020-02-20 00:00:00", + "subjectName": "str", + "thumbprint": "str", + }, + "daprAIConnectionString": "str", + "defaultDomain": "str", + "deploymentErrors": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "name": "str", + "provisioningState": "str", + "staticIp": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.connected_environments.begin_delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.connected_environments.update( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_name_availability(self, resource_group): + response = await self.client.connected_environments.check_name_availability( + resource_group_name=resource_group.name, + connected_environment_name="str", + check_name_availability_request={"name": "str", "type": "str"}, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py new file mode 100644 index 0000000000000..49e6968e87c30 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py @@ -0,0 +1,86 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsStoragesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.connected_environments_storages.list( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.connected_environments_storages.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.connected_environments_storages.create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + storage_envelope={ + "id": "str", + "name": "str", + "properties": { + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.connected_environments_storages.delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py new file mode 100644 index 0000000000000..e0735233e1c3e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py @@ -0,0 +1,87 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIConnectedEnvironmentsStoragesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = await self.client.connected_environments_storages.list( + resource_group_name=resource_group.name, + connected_environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.connected_environments_storages.get( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.connected_environments_storages.create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + storage_envelope={ + "id": "str", + "name": "str", + "properties": { + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.connected_environments_storages.delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py new file mode 100644 index 0000000000000..72c31728e0873 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py @@ -0,0 +1,181 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsAuthConfigsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_auth_configs.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_auth_configs.get( + resource_group_name=resource_group.name, + container_app_name="str", + auth_config_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.container_apps_auth_configs.create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + auth_config_name="str", + auth_config_envelope={ + "encryptionSettings": { + "containerAppAuthEncryptionSecretName": "str", + "containerAppAuthSigningSecretName": "str", + }, + "globalValidation": { + "excludedPaths": ["str"], + "redirectToProvider": "str", + "unauthenticatedClientAction": "str", + }, + "httpSettings": { + "forwardProxy": { + "convention": "str", + "customHostHeaderName": "str", + "customProtoHeaderName": "str", + }, + "requireHttps": bool, + "routes": {"apiPrefix": "str"}, + }, + "id": "str", + "identityProviders": { + "apple": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "azureActiveDirectory": { + "enabled": bool, + "isAutoProvisioned": bool, + "login": {"disableWWWAuthenticate": bool, "loginParameters": ["str"]}, + "registration": { + "clientId": "str", + "clientSecretCertificateIssuer": "str", + "clientSecretCertificateSubjectAlternativeName": "str", + "clientSecretCertificateThumbprint": "str", + "clientSecretSettingName": "str", + "openIdIssuer": "str", + }, + "validation": { + "allowedAudiences": ["str"], + "defaultAuthorizationPolicy": { + "allowedApplications": ["str"], + "allowedPrincipals": {"groups": ["str"], "identities": ["str"]}, + }, + "jwtClaimChecks": {"allowedClientApplications": ["str"], "allowedGroups": ["str"]}, + }, + }, + "azureStaticWebApps": {"enabled": bool, "registration": {"clientId": "str"}}, + "customOpenIdConnectProviders": { + "str": { + "enabled": bool, + "login": {"nameClaimType": "str", "scopes": ["str"]}, + "registration": { + "clientCredential": {"clientSecretSettingName": "str", "method": "ClientSecretPost"}, + "clientId": "str", + "openIdConnectConfiguration": { + "authorizationEndpoint": "str", + "certificationUri": "str", + "issuer": "str", + "tokenEndpoint": "str", + "wellKnownOpenIdConfiguration": "str", + }, + }, + } + }, + "facebook": { + "enabled": bool, + "graphApiVersion": "str", + "login": {"scopes": ["str"]}, + "registration": {"appId": "str", "appSecretSettingName": "str"}, + }, + "gitHub": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "google": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + "validation": {"allowedAudiences": ["str"]}, + }, + "twitter": { + "enabled": bool, + "registration": {"consumerKey": "str", "consumerSecretSettingName": "str"}, + }, + }, + "login": { + "allowedExternalRedirectUrls": ["str"], + "cookieExpiration": {"convention": "str", "timeToExpiration": "str"}, + "nonce": {"nonceExpirationInterval": "str", "validateNonce": bool}, + "preserveUrlFragmentsForLogins": bool, + "routes": {"logoutEndpoint": "str"}, + "tokenStore": { + "azureBlobStorage": {"sasUrlSettingName": "str"}, + "enabled": bool, + "tokenRefreshExtensionHours": 0.0, + }, + }, + "name": "str", + "platform": {"enabled": bool, "runtimeVersion": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.container_apps_auth_configs.delete( + resource_group_name=resource_group.name, + container_app_name="str", + auth_config_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py new file mode 100644 index 0000000000000..86a7203c755f3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py @@ -0,0 +1,182 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsAuthConfigsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_auth_configs.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_auth_configs.get( + resource_group_name=resource_group.name, + container_app_name="str", + auth_config_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.container_apps_auth_configs.create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + auth_config_name="str", + auth_config_envelope={ + "encryptionSettings": { + "containerAppAuthEncryptionSecretName": "str", + "containerAppAuthSigningSecretName": "str", + }, + "globalValidation": { + "excludedPaths": ["str"], + "redirectToProvider": "str", + "unauthenticatedClientAction": "str", + }, + "httpSettings": { + "forwardProxy": { + "convention": "str", + "customHostHeaderName": "str", + "customProtoHeaderName": "str", + }, + "requireHttps": bool, + "routes": {"apiPrefix": "str"}, + }, + "id": "str", + "identityProviders": { + "apple": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "azureActiveDirectory": { + "enabled": bool, + "isAutoProvisioned": bool, + "login": {"disableWWWAuthenticate": bool, "loginParameters": ["str"]}, + "registration": { + "clientId": "str", + "clientSecretCertificateIssuer": "str", + "clientSecretCertificateSubjectAlternativeName": "str", + "clientSecretCertificateThumbprint": "str", + "clientSecretSettingName": "str", + "openIdIssuer": "str", + }, + "validation": { + "allowedAudiences": ["str"], + "defaultAuthorizationPolicy": { + "allowedApplications": ["str"], + "allowedPrincipals": {"groups": ["str"], "identities": ["str"]}, + }, + "jwtClaimChecks": {"allowedClientApplications": ["str"], "allowedGroups": ["str"]}, + }, + }, + "azureStaticWebApps": {"enabled": bool, "registration": {"clientId": "str"}}, + "customOpenIdConnectProviders": { + "str": { + "enabled": bool, + "login": {"nameClaimType": "str", "scopes": ["str"]}, + "registration": { + "clientCredential": {"clientSecretSettingName": "str", "method": "ClientSecretPost"}, + "clientId": "str", + "openIdConnectConfiguration": { + "authorizationEndpoint": "str", + "certificationUri": "str", + "issuer": "str", + "tokenEndpoint": "str", + "wellKnownOpenIdConfiguration": "str", + }, + }, + } + }, + "facebook": { + "enabled": bool, + "graphApiVersion": "str", + "login": {"scopes": ["str"]}, + "registration": {"appId": "str", "appSecretSettingName": "str"}, + }, + "gitHub": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "google": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + "validation": {"allowedAudiences": ["str"]}, + }, + "twitter": { + "enabled": bool, + "registration": {"consumerKey": "str", "consumerSecretSettingName": "str"}, + }, + }, + "login": { + "allowedExternalRedirectUrls": ["str"], + "cookieExpiration": {"convention": "str", "timeToExpiration": "str"}, + "nonce": {"nonceExpirationInterval": "str", "validateNonce": bool}, + "preserveUrlFragmentsForLogins": bool, + "routes": {"logoutEndpoint": "str"}, + "tokenStore": { + "azureBlobStorage": {"sasUrlSettingName": "str"}, + "enabled": bool, + "tokenRefreshExtensionHours": 0.0, + }, + }, + "name": "str", + "platform": {"enabled": bool, "runtimeVersion": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.container_apps_auth_configs.delete( + resource_group_name=resource_group.name, + container_app_name="str", + auth_config_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py new file mode 100644 index 0000000000000..6a8d78112bc94 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py @@ -0,0 +1,81 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsDiagnosticsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_detectors(self, resource_group): + response = self.client.container_apps_diagnostics.list_detectors( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_detector(self, resource_group): + response = self.client.container_apps_diagnostics.get_detector( + resource_group_name=resource_group.name, + container_app_name="str", + detector_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_revisions(self, resource_group): + response = self.client.container_apps_diagnostics.list_revisions( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_revision(self, resource_group): + response = self.client.container_apps_diagnostics.get_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_root(self, resource_group): + response = self.client.container_apps_diagnostics.get_root( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py new file mode 100644 index 0000000000000..4531aa56ad900 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py @@ -0,0 +1,82 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsDiagnosticsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_detectors(self, resource_group): + response = self.client.container_apps_diagnostics.list_detectors( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_detector(self, resource_group): + response = await self.client.container_apps_diagnostics.get_detector( + resource_group_name=resource_group.name, + container_app_name="str", + detector_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_revisions(self, resource_group): + response = self.client.container_apps_diagnostics.list_revisions( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_revision(self, resource_group): + response = await self.client.container_apps_diagnostics.get_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_root(self, resource_group): + response = await self.client.container_apps_diagnostics.get_root( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py new file mode 100644 index 0000000000000..6c517f7440be9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py @@ -0,0 +1,460 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.container_apps.list_by_subscription( + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps.get( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.container_apps.begin_create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + container_app_envelope={ + "location": "str", + "configuration": { + "activeRevisionsMode": "Single", + "dapr": { + "appId": "str", + "appPort": 0, + "appProtocol": "http", + "enableApiLogging": bool, + "enabled": False, + "httpMaxRequestSize": 0, + "httpReadBufferSize": 0, + "logLevel": "str", + }, + "ingress": { + "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], + "allowInsecure": False, + "clientCertificateMode": "str", + "corsPolicy": { + "allowedOrigins": ["str"], + "allowCredentials": bool, + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "exposeHeaders": ["str"], + "maxAge": 0, + }, + "customDomains": [{"name": "str", "bindingType": "str", "certificateId": "str"}], + "exposedPort": 0, + "external": False, + "fqdn": "str", + "ipSecurityRestrictions": [ + {"action": "str", "ipAddressRange": "str", "name": "str", "description": "str"} + ], + "stickySessions": {"affinity": "str"}, + "targetPort": 0, + "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], + "transport": "auto", + }, + "maxInactiveRevisions": 0, + "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "service": {"type": "str"}, + }, + "customDomainVerificationId": "str", + "environmentId": "str", + "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "latestReadyRevisionName": "str", + "latestRevisionFqdn": "str", + "latestRevisionName": "str", + "managedBy": "str", + "managedEnvironmentId": "str", + "name": "str", + "outboundIpAddresses": ["str"], + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "revisionSuffix": "str", + "scale": { + "maxReplicas": 10, + "minReplicas": 0, + "rules": [ + { + "azureQueue": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "queueLength": 0, + "queueName": "str", + }, + "custom": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + "type": "str", + }, + "http": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + }, + "name": "str", + "tcp": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + }, + } + ], + }, + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "terminationGracePeriodSeconds": 0, + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + "type": "str", + "workloadProfileName": "str", + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.container_apps.begin_update( + resource_group_name=resource_group.name, + container_app_name="str", + container_app_envelope={ + "location": "str", + "configuration": { + "activeRevisionsMode": "Single", + "dapr": { + "appId": "str", + "appPort": 0, + "appProtocol": "http", + "enableApiLogging": bool, + "enabled": False, + "httpMaxRequestSize": 0, + "httpReadBufferSize": 0, + "logLevel": "str", + }, + "ingress": { + "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], + "allowInsecure": False, + "clientCertificateMode": "str", + "corsPolicy": { + "allowedOrigins": ["str"], + "allowCredentials": bool, + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "exposeHeaders": ["str"], + "maxAge": 0, + }, + "customDomains": [{"name": "str", "bindingType": "str", "certificateId": "str"}], + "exposedPort": 0, + "external": False, + "fqdn": "str", + "ipSecurityRestrictions": [ + {"action": "str", "ipAddressRange": "str", "name": "str", "description": "str"} + ], + "stickySessions": {"affinity": "str"}, + "targetPort": 0, + "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], + "transport": "auto", + }, + "maxInactiveRevisions": 0, + "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "service": {"type": "str"}, + }, + "customDomainVerificationId": "str", + "environmentId": "str", + "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "latestReadyRevisionName": "str", + "latestRevisionFqdn": "str", + "latestRevisionName": "str", + "managedBy": "str", + "managedEnvironmentId": "str", + "name": "str", + "outboundIpAddresses": ["str"], + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "revisionSuffix": "str", + "scale": { + "maxReplicas": 10, + "minReplicas": 0, + "rules": [ + { + "azureQueue": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "queueLength": 0, + "queueName": "str", + }, + "custom": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + "type": "str", + }, + "http": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + }, + "name": "str", + "tcp": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + }, + } + ], + }, + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "terminationGracePeriodSeconds": 0, + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + "type": "str", + "workloadProfileName": "str", + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_custom_host_name_analysis(self, resource_group): + response = self.client.container_apps.list_custom_host_name_analysis( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_secrets(self, resource_group): + response = self.client.container_apps.list_secrets( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_auth_token(self, resource_group): + response = self.client.container_apps.get_auth_token( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start(self, resource_group): + response = self.client.container_apps.begin_start( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_stop(self, resource_group): + response = self.client.container_apps.begin_stop( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py new file mode 100644 index 0000000000000..1a16c76a581c4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py @@ -0,0 +1,475 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.container_apps.list_by_subscription( + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps.get( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.container_apps.begin_create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + container_app_envelope={ + "location": "str", + "configuration": { + "activeRevisionsMode": "Single", + "dapr": { + "appId": "str", + "appPort": 0, + "appProtocol": "http", + "enableApiLogging": bool, + "enabled": False, + "httpMaxRequestSize": 0, + "httpReadBufferSize": 0, + "logLevel": "str", + }, + "ingress": { + "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], + "allowInsecure": False, + "clientCertificateMode": "str", + "corsPolicy": { + "allowedOrigins": ["str"], + "allowCredentials": bool, + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "exposeHeaders": ["str"], + "maxAge": 0, + }, + "customDomains": [{"name": "str", "bindingType": "str", "certificateId": "str"}], + "exposedPort": 0, + "external": False, + "fqdn": "str", + "ipSecurityRestrictions": [ + {"action": "str", "ipAddressRange": "str", "name": "str", "description": "str"} + ], + "stickySessions": {"affinity": "str"}, + "targetPort": 0, + "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], + "transport": "auto", + }, + "maxInactiveRevisions": 0, + "registries": [ + {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} + ], + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "service": {"type": "str"}, + }, + "customDomainVerificationId": "str", + "environmentId": "str", + "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "latestReadyRevisionName": "str", + "latestRevisionFqdn": "str", + "latestRevisionName": "str", + "managedBy": "str", + "managedEnvironmentId": "str", + "name": "str", + "outboundIpAddresses": ["str"], + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "revisionSuffix": "str", + "scale": { + "maxReplicas": 10, + "minReplicas": 0, + "rules": [ + { + "azureQueue": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "queueLength": 0, + "queueName": "str", + }, + "custom": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + "type": "str", + }, + "http": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + }, + "name": "str", + "tcp": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + }, + } + ], + }, + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "terminationGracePeriodSeconds": 0, + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + "type": "str", + "workloadProfileName": "str", + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.container_apps.begin_update( + resource_group_name=resource_group.name, + container_app_name="str", + container_app_envelope={ + "location": "str", + "configuration": { + "activeRevisionsMode": "Single", + "dapr": { + "appId": "str", + "appPort": 0, + "appProtocol": "http", + "enableApiLogging": bool, + "enabled": False, + "httpMaxRequestSize": 0, + "httpReadBufferSize": 0, + "logLevel": "str", + }, + "ingress": { + "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], + "allowInsecure": False, + "clientCertificateMode": "str", + "corsPolicy": { + "allowedOrigins": ["str"], + "allowCredentials": bool, + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "exposeHeaders": ["str"], + "maxAge": 0, + }, + "customDomains": [{"name": "str", "bindingType": "str", "certificateId": "str"}], + "exposedPort": 0, + "external": False, + "fqdn": "str", + "ipSecurityRestrictions": [ + {"action": "str", "ipAddressRange": "str", "name": "str", "description": "str"} + ], + "stickySessions": {"affinity": "str"}, + "targetPort": 0, + "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], + "transport": "auto", + }, + "maxInactiveRevisions": 0, + "registries": [ + {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} + ], + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "service": {"type": "str"}, + }, + "customDomainVerificationId": "str", + "environmentId": "str", + "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "latestReadyRevisionName": "str", + "latestRevisionFqdn": "str", + "latestRevisionName": "str", + "managedBy": "str", + "managedEnvironmentId": "str", + "name": "str", + "outboundIpAddresses": ["str"], + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "revisionSuffix": "str", + "scale": { + "maxReplicas": 10, + "minReplicas": 0, + "rules": [ + { + "azureQueue": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "queueLength": 0, + "queueName": "str", + }, + "custom": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + "type": "str", + }, + "http": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + }, + "name": "str", + "tcp": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + }, + } + ], + }, + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "terminationGracePeriodSeconds": 0, + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + "type": "str", + "workloadProfileName": "str", + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_custom_host_name_analysis(self, resource_group): + response = await self.client.container_apps.list_custom_host_name_analysis( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_secrets(self, resource_group): + response = await self.client.container_apps.list_secrets( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_auth_token(self, resource_group): + response = await self.client.container_apps.get_auth_token( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start(self, resource_group): + response = await ( + await self.client.container_apps.begin_start( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_stop(self, resource_group): + response = await ( + await self.client.container_apps.begin_stop( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py new file mode 100644 index 0000000000000..68a3485ac903f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py @@ -0,0 +1,46 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsRevisionReplicasOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_replica(self, resource_group): + response = self.client.container_apps_revision_replicas.get_replica( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + replica_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_replicas(self, resource_group): + response = self.client.container_apps_revision_replicas.list_replicas( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py new file mode 100644 index 0000000000000..d0b7c534e6544 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py @@ -0,0 +1,47 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsRevisionReplicasOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_replica(self, resource_group): + response = await self.client.container_apps_revision_replicas.get_replica( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + replica_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_replicas(self, resource_group): + response = await self.client.container_apps_revision_replicas.list_replicas( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py new file mode 100644 index 0000000000000..4223cedc2daa1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py @@ -0,0 +1,83 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsRevisionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_revisions(self, resource_group): + response = self.client.container_apps_revisions.list_revisions( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_revision(self, resource_group): + response = self.client.container_apps_revisions.get_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_activate_revision(self, resource_group): + response = self.client.container_apps_revisions.activate_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deactivate_revision(self, resource_group): + response = self.client.container_apps_revisions.deactivate_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restart_revision(self, resource_group): + response = self.client.container_apps_revisions.restart_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py new file mode 100644 index 0000000000000..9de3f96e46c0c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py @@ -0,0 +1,84 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsRevisionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_revisions(self, resource_group): + response = self.client.container_apps_revisions.list_revisions( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_revision(self, resource_group): + response = await self.client.container_apps_revisions.get_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_activate_revision(self, resource_group): + response = await self.client.container_apps_revisions.activate_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deactivate_revision(self, resource_group): + response = await self.client.container_apps_revisions.deactivate_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restart_revision(self, resource_group): + response = await self.client.container_apps_revisions.restart_revision( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py new file mode 100644 index 0000000000000..fdce9d3156fae --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py @@ -0,0 +1,103 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsSourceControlsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_source_controls.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_source_controls.get( + resource_group_name=resource_group.name, + container_app_name="str", + source_control_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.container_apps_source_controls.begin_create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + source_control_name="str", + source_control_envelope={ + "branch": "str", + "githubActionConfiguration": { + "azureCredentials": { + "clientId": "str", + "clientSecret": "str", + "kind": "str", + "subscriptionId": "str", + "tenantId": "str", + }, + "contextPath": "str", + "githubPersonalAccessToken": "str", + "image": "str", + "os": "str", + "publishType": "str", + "registryInfo": {"registryPassword": "str", "registryUrl": "str", "registryUserName": "str"}, + "runtimeStack": "str", + "runtimeVersion": "str", + }, + "id": "str", + "name": "str", + "operationState": "str", + "repoUrl": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps_source_controls.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + source_control_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py new file mode 100644 index 0000000000000..08788e157cf6c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py @@ -0,0 +1,108 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsSourceControlsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_source_controls.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_source_controls.get( + resource_group_name=resource_group.name, + container_app_name="str", + source_control_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.container_apps_source_controls.begin_create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + source_control_name="str", + source_control_envelope={ + "branch": "str", + "githubActionConfiguration": { + "azureCredentials": { + "clientId": "str", + "clientSecret": "str", + "kind": "str", + "subscriptionId": "str", + "tenantId": "str", + }, + "contextPath": "str", + "githubPersonalAccessToken": "str", + "image": "str", + "os": "str", + "publishType": "str", + "registryInfo": {"registryPassword": "str", "registryUrl": "str", "registryUserName": "str"}, + "runtimeStack": "str", + "runtimeVersion": "str", + }, + "id": "str", + "name": "str", + "operationState": "str", + "repoUrl": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps_source_controls.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + source_control_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py new file mode 100644 index 0000000000000..8d774741aa160 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py @@ -0,0 +1,104 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprComponentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dapr_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dapr_components.get( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.dapr_components.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + dapr_component_envelope={ + "componentType": "str", + "id": "str", + "ignoreErrors": False, + "initTimeout": "str", + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "name": "str", + "scopes": ["str"], + "secretStoreComponent": "str", + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "str", + }, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.dapr_components.delete( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_secrets(self, resource_group): + response = self.client.dapr_components.list_secrets( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py new file mode 100644 index 0000000000000..fa5ed26ad6c21 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py @@ -0,0 +1,105 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprComponentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dapr_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dapr_components.get( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.dapr_components.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + dapr_component_envelope={ + "componentType": "str", + "id": "str", + "ignoreErrors": False, + "initTimeout": "str", + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "name": "str", + "scopes": ["str"], + "secretStoreComponent": "str", + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "str", + }, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.dapr_components.delete( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_secrets(self, resource_group): + response = await self.client.dapr_components.list_secrets( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py new file mode 100644 index 0000000000000..b5e07d699dce7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py @@ -0,0 +1,31 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJobsExecutionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.jobs_executions.list( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py new file mode 100644 index 0000000000000..0ef51f590a961 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJobsExecutionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.jobs_executions.list( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py new file mode 100644 index 0000000000000..18f7393473490 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py @@ -0,0 +1,377 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJobsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_detectors(self, resource_group): + response = self.client.jobs.list_detectors( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_detector(self, resource_group): + response = self.client.jobs.get_detector( + resource_group_name=resource_group.name, + job_name="str", + detector_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_proxy_get(self, resource_group): + response = self.client.jobs.proxy_get( + resource_group_name=resource_group.name, + job_name="str", + api_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.jobs.list_by_subscription( + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.jobs.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.jobs.get( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.jobs.begin_create_or_update( + resource_group_name=resource_group.name, + job_name="str", + job_envelope={ + "location": "str", + "configuration": { + "replicaTimeout": 0, + "triggerType": "Manual", + "eventTriggerConfig": { + "parallelism": 0, + "replicaCompletionCount": 0, + "scale": { + "maxExecutions": 100, + "minExecutions": 0, + "pollingInterval": 0, + "rules": [ + { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {}, + "name": "str", + "type": "str", + } + ], + }, + }, + "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, + "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], + "replicaRetryLimit": 0, + "scheduleTriggerConfig": {"cronExpression": "str", "parallelism": 0, "replicaCompletionCount": 0}, + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + }, + "environmentId": "str", + "eventStreamEndpoint": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "outboundIpAddresses": ["str"], + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + "type": "str", + "workloadProfileName": "str", + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.jobs.begin_delete( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.jobs.begin_update( + resource_group_name=resource_group.name, + job_name="str", + job_envelope={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "configuration": { + "replicaTimeout": 0, + "triggerType": "Manual", + "eventTriggerConfig": { + "parallelism": 0, + "replicaCompletionCount": 0, + "scale": { + "maxExecutions": 100, + "minExecutions": 0, + "pollingInterval": 0, + "rules": [ + { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {}, + "name": "str", + "type": "str", + } + ], + }, + }, + "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, + "registries": [ + {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} + ], + "replicaRetryLimit": 0, + "scheduleTriggerConfig": { + "cronExpression": "str", + "parallelism": 0, + "replicaCompletionCount": 0, + }, + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + }, + "environmentId": "str", + "eventStreamEndpoint": "str", + "outboundIpAddresses": ["str"], + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + }, + "tags": {"str": "str"}, + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start(self, resource_group): + response = self.client.jobs.begin_start( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_stop_execution(self, resource_group): + response = self.client.jobs.begin_stop_execution( + resource_group_name=resource_group.name, + job_name="str", + job_execution_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_stop_multiple_executions(self, resource_group): + response = self.client.jobs.begin_stop_multiple_executions( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_secrets(self, resource_group): + response = self.client.jobs.list_secrets( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py new file mode 100644 index 0000000000000..07737e683da40 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py @@ -0,0 +1,396 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJobsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_detectors(self, resource_group): + response = self.client.jobs.list_detectors( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_detector(self, resource_group): + response = await self.client.jobs.get_detector( + resource_group_name=resource_group.name, + job_name="str", + detector_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_proxy_get(self, resource_group): + response = await self.client.jobs.proxy_get( + resource_group_name=resource_group.name, + job_name="str", + api_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.jobs.list_by_subscription( + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.jobs.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.jobs.get( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.jobs.begin_create_or_update( + resource_group_name=resource_group.name, + job_name="str", + job_envelope={ + "location": "str", + "configuration": { + "replicaTimeout": 0, + "triggerType": "Manual", + "eventTriggerConfig": { + "parallelism": 0, + "replicaCompletionCount": 0, + "scale": { + "maxExecutions": 100, + "minExecutions": 0, + "pollingInterval": 0, + "rules": [ + { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {}, + "name": "str", + "type": "str", + } + ], + }, + }, + "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, + "registries": [ + {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} + ], + "replicaRetryLimit": 0, + "scheduleTriggerConfig": { + "cronExpression": "str", + "parallelism": 0, + "replicaCompletionCount": 0, + }, + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + }, + "environmentId": "str", + "eventStreamEndpoint": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "outboundIpAddresses": ["str"], + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + "type": "str", + "workloadProfileName": "str", + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.jobs.begin_delete( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.jobs.begin_update( + resource_group_name=resource_group.name, + job_name="str", + job_envelope={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "configuration": { + "replicaTimeout": 0, + "triggerType": "Manual", + "eventTriggerConfig": { + "parallelism": 0, + "replicaCompletionCount": 0, + "scale": { + "maxExecutions": 100, + "minExecutions": 0, + "pollingInterval": 0, + "rules": [ + { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {}, + "name": "str", + "type": "str", + } + ], + }, + }, + "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, + "registries": [ + {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} + ], + "replicaRetryLimit": 0, + "scheduleTriggerConfig": { + "cronExpression": "str", + "parallelism": 0, + "replicaCompletionCount": 0, + }, + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + }, + "environmentId": "str", + "eventStreamEndpoint": "str", + "outboundIpAddresses": ["str"], + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "initContainers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], + } + ], + "volumes": [ + { + "mountOptions": "str", + "name": "str", + "secrets": [{"path": "str", "secretRef": "str"}], + "storageName": "str", + "storageType": "str", + } + ], + }, + }, + "tags": {"str": "str"}, + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start(self, resource_group): + response = await ( + await self.client.jobs.begin_start( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_stop_execution(self, resource_group): + response = await ( + await self.client.jobs.begin_stop_execution( + resource_group_name=resource_group.name, + job_name="str", + job_execution_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_stop_multiple_executions(self, resource_group): + response = await ( + await self.client.jobs.begin_stop_multiple_executions( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_secrets(self, resource_group): + response = await self.client.jobs.list_secrets( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py new file mode 100644 index 0000000000000..c7067137fd904 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py @@ -0,0 +1,84 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedCertificatesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.managed_certificates.get( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.managed_certificates.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.managed_certificates.delete( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.managed_certificates.update( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + managed_certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_certificates.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py new file mode 100644 index 0000000000000..5f1ba6b1f5d8f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py @@ -0,0 +1,87 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedCertificatesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.managed_certificates.get( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.managed_certificates.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.managed_certificates.delete( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.managed_certificates.update( + resource_group_name=resource_group.name, + environment_name="str", + managed_certificate_name="str", + managed_certificate_envelope={"tags": {"str": "str"}}, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.managed_certificates.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py new file mode 100644 index 0000000000000..642873ae7bfe0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py @@ -0,0 +1,44 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentDiagnosticsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_detectors(self, resource_group): + response = self.client.managed_environment_diagnostics.list_detectors( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_detector(self, resource_group): + response = self.client.managed_environment_diagnostics.get_detector( + resource_group_name=resource_group.name, + environment_name="str", + detector_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py new file mode 100644 index 0000000000000..d8bee226eb4f7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py @@ -0,0 +1,45 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentDiagnosticsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_detectors(self, resource_group): + response = await self.client.managed_environment_diagnostics.list_detectors( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_detector(self, resource_group): + response = await self.client.managed_environment_diagnostics.get_detector( + resource_group_name=resource_group.name, + environment_name="str", + detector_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py new file mode 100644 index 0000000000000..89a46c6bdae7d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py @@ -0,0 +1,31 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentUsagesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_environment_usages.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py new file mode 100644 index 0000000000000..66b6e816f9c9d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentUsagesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.managed_environment_usages.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py new file mode 100644 index 0000000000000..f8935803c0dfb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py @@ -0,0 +1,31 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentsDiagnosticsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_root(self, resource_group): + response = self.client.managed_environments_diagnostics.get_root( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py new file mode 100644 index 0000000000000..45c096f994d88 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentsDiagnosticsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_root(self, resource_group): + response = await self.client.managed_environments_diagnostics.get_root( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py new file mode 100644 index 0000000000000..c3693ddfef44b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py @@ -0,0 +1,216 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.managed_environments.list_by_subscription( + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.managed_environments.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.managed_environments.get( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.managed_environments.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + environment_envelope={ + "location": "str", + "appLogsConfiguration": { + "destination": "str", + "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + }, + "customDomainConfiguration": { + "certificatePassword": "str", + "certificateValue": bytes("bytes", encoding="utf-8"), + "customDomainVerificationId": "str", + "dnsSuffix": "str", + "expirationDate": "2020-02-20 00:00:00", + "subjectName": "str", + "thumbprint": "str", + }, + "daprAIConnectionString": "str", + "daprAIInstrumentationKey": "str", + "daprConfiguration": {"version": "str"}, + "defaultDomain": "str", + "deploymentErrors": "str", + "eventStreamEndpoint": "str", + "id": "str", + "infrastructureResourceGroup": "str", + "kedaConfiguration": {"version": "str"}, + "kind": "str", + "name": "str", + "peerAuthentication": {"mtls": {"enabled": bool}}, + "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "provisioningState": "str", + "staticIp": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "vnetConfiguration": { + "dockerBridgeCidr": "str", + "infrastructureSubnetId": "str", + "internal": bool, + "platformReservedCidr": "str", + "platformReservedDnsIP": "str", + }, + "workloadProfiles": [ + {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + ], + "zoneRedundant": bool, + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.managed_environments.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.managed_environments.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + environment_envelope={ + "location": "str", + "appLogsConfiguration": { + "destination": "str", + "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + }, + "customDomainConfiguration": { + "certificatePassword": "str", + "certificateValue": bytes("bytes", encoding="utf-8"), + "customDomainVerificationId": "str", + "dnsSuffix": "str", + "expirationDate": "2020-02-20 00:00:00", + "subjectName": "str", + "thumbprint": "str", + }, + "daprAIConnectionString": "str", + "daprAIInstrumentationKey": "str", + "daprConfiguration": {"version": "str"}, + "defaultDomain": "str", + "deploymentErrors": "str", + "eventStreamEndpoint": "str", + "id": "str", + "infrastructureResourceGroup": "str", + "kedaConfiguration": {"version": "str"}, + "kind": "str", + "name": "str", + "peerAuthentication": {"mtls": {"enabled": bool}}, + "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "provisioningState": "str", + "staticIp": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "vnetConfiguration": { + "dockerBridgeCidr": "str", + "infrastructureSubnetId": "str", + "internal": bool, + "platformReservedCidr": "str", + "platformReservedDnsIP": "str", + }, + "workloadProfiles": [ + {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + ], + "zoneRedundant": bool, + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_auth_token(self, resource_group): + response = self.client.managed_environments.get_auth_token( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_workload_profile_states(self, resource_group): + response = self.client.managed_environments.list_workload_profile_states( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py new file mode 100644 index 0000000000000..a82a4daec142f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py @@ -0,0 +1,223 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.managed_environments.list_by_subscription( + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.managed_environments.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.managed_environments.get( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.managed_environments.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + environment_envelope={ + "location": "str", + "appLogsConfiguration": { + "destination": "str", + "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + }, + "customDomainConfiguration": { + "certificatePassword": "str", + "certificateValue": bytes("bytes", encoding="utf-8"), + "customDomainVerificationId": "str", + "dnsSuffix": "str", + "expirationDate": "2020-02-20 00:00:00", + "subjectName": "str", + "thumbprint": "str", + }, + "daprAIConnectionString": "str", + "daprAIInstrumentationKey": "str", + "daprConfiguration": {"version": "str"}, + "defaultDomain": "str", + "deploymentErrors": "str", + "eventStreamEndpoint": "str", + "id": "str", + "infrastructureResourceGroup": "str", + "kedaConfiguration": {"version": "str"}, + "kind": "str", + "name": "str", + "peerAuthentication": {"mtls": {"enabled": bool}}, + "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "provisioningState": "str", + "staticIp": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "vnetConfiguration": { + "dockerBridgeCidr": "str", + "infrastructureSubnetId": "str", + "internal": bool, + "platformReservedCidr": "str", + "platformReservedDnsIP": "str", + }, + "workloadProfiles": [ + {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + ], + "zoneRedundant": bool, + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.managed_environments.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.managed_environments.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + environment_envelope={ + "location": "str", + "appLogsConfiguration": { + "destination": "str", + "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + }, + "customDomainConfiguration": { + "certificatePassword": "str", + "certificateValue": bytes("bytes", encoding="utf-8"), + "customDomainVerificationId": "str", + "dnsSuffix": "str", + "expirationDate": "2020-02-20 00:00:00", + "subjectName": "str", + "thumbprint": "str", + }, + "daprAIConnectionString": "str", + "daprAIInstrumentationKey": "str", + "daprConfiguration": {"version": "str"}, + "defaultDomain": "str", + "deploymentErrors": "str", + "eventStreamEndpoint": "str", + "id": "str", + "infrastructureResourceGroup": "str", + "kedaConfiguration": {"version": "str"}, + "kind": "str", + "name": "str", + "peerAuthentication": {"mtls": {"enabled": bool}}, + "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "provisioningState": "str", + "staticIp": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "vnetConfiguration": { + "dockerBridgeCidr": "str", + "infrastructureSubnetId": "str", + "internal": bool, + "platformReservedCidr": "str", + "platformReservedDnsIP": "str", + }, + "workloadProfiles": [ + {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + ], + "zoneRedundant": bool, + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_auth_token(self, resource_group): + response = await self.client.managed_environments.get_auth_token( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_workload_profile_states(self, resource_group): + response = self.client.managed_environments.list_workload_profile_states( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py new file mode 100644 index 0000000000000..b644b17854cf5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py @@ -0,0 +1,86 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentsStoragesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_environments_storages.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.managed_environments_storages.get( + resource_group_name=resource_group.name, + environment_name="str", + storage_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.managed_environments_storages.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + storage_name="str", + storage_envelope={ + "id": "str", + "name": "str", + "properties": { + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.managed_environments_storages.delete( + resource_group_name=resource_group.name, + environment_name="str", + storage_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py new file mode 100644 index 0000000000000..f44a5e0b43042 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py @@ -0,0 +1,87 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentsStoragesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = await self.client.managed_environments_storages.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.managed_environments_storages.get( + resource_group_name=resource_group.name, + environment_name="str", + storage_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.managed_environments_storages.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + storage_name="str", + storage_envelope={ + "id": "str", + "name": "str", + "properties": { + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.managed_environments_storages.delete( + resource_group_name=resource_group.name, + environment_name="str", + storage_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py new file mode 100644 index 0000000000000..e2b8fb59bc410 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPINamespacesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_name_availability(self, resource_group): + response = self.client.namespaces.check_name_availability( + resource_group_name=resource_group.name, + environment_name="str", + check_name_availability_request={"name": "str", "type": "str"}, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py new file mode 100644 index 0000000000000..daeee7c5da1cc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py @@ -0,0 +1,33 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPINamespacesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_name_availability(self, resource_group): + response = await self.client.namespaces.check_name_availability( + resource_group_name=resource_group.name, + environment_name="str", + check_name_availability_request={"name": "str", "type": "str"}, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py new file mode 100644 index 0000000000000..e80fa5ba763c7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py new file mode 100644 index 0000000000000..7dfd8600db2bf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py new file mode 100644 index 0000000000000..4572a67a7083b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIUsagesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.usages.list( + location="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py new file mode 100644 index 0000000000000..4e439a0bc453e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py @@ -0,0 +1,31 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIUsagesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.usages.list( + location="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/pyproject.toml b/sdk/appcontainers/azure-mgmt-appcontainers/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml b/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml index 9b9e139e8165d..f16da30326545 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml +++ b/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-appcontainers" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Appcontainers Management" package_doc_id = "" -is_stable = false +is_stable = true is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/setup.py b/sdk/appcontainers/azure-mgmt-appcontainers/setup.py index 98a7edfe26ee6..5a173047c2720 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/setup.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/setup.py @@ -49,7 +49,7 @@ url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", @@ -75,6 +75,7 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", "azure-mgmt-core>=1.3.2", ], diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/tests/conftest.py b/sdk/appcontainers/azure-mgmt-appcontainers/tests/conftest.py new file mode 100644 index 0000000000000..961ce7cf468ae --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/tests/conftest.py @@ -0,0 +1,35 @@ +# 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. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + containerappsapi_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + containerappsapi_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + containerappsapi_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + containerappsapi_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerappsapi_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerappsapi_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerappsapi_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerappsapi_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/tests/test_container_apps_api_container_apps_operations_async_test.py b/sdk/appcontainers/azure-mgmt-appcontainers/tests/test_container_apps_api_container_apps_operations_async_test.py new file mode 100644 index 0000000000000..44596435c048b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/tests/test_container_apps_api_container_apps_operations_async_test.py @@ -0,0 +1,41 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestContainerAppsAPIContainerAppsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.container_apps.list_by_subscription( + api_version="2024-03-01", + ) + result = [r async for r in response] + assert response + + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-03-01", + ) + result = [r async for r in response] + assert result == [] + \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/tests/test_container_apps_api_container_apps_operations_test.py b/sdk/appcontainers/azure-mgmt-appcontainers/tests/test_container_apps_api_container_apps_operations_test.py new file mode 100644 index 0000000000000..f1577648cdac9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/tests/test_container_apps_api_container_apps_operations_test.py @@ -0,0 +1,39 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestContainerAppsAPIContainerAppsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.container_apps.list_by_subscription( + api_version="2024-03-01", + ) + result = [r for r in response] + assert response + + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-03-01", + ) + result = [r for r in response] + assert result == [] diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/tests/test_container_apps_api_operations_async_test.py b/sdk/appcontainers/azure-mgmt-appcontainers/tests/test_container_apps_api_operations_async_test.py new file mode 100644 index 0000000000000..e7203bf24f9d2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/tests/test_container_apps_api_operations_async_test.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestContainerAppsAPIOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-03-01", + ) + result = [r async for r in response] + assert result + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/tests/test_container_apps_api_operations_test.py b/sdk/appcontainers/azure-mgmt-appcontainers/tests/test_container_apps_api_operations_test.py new file mode 100644 index 0000000000000..32551e3b59b1a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/tests/test_container_apps_api_operations_test.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestContainerAppsAPIOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-03-01", + ) + result = [r for r in response] + assert result + diff --git a/sdk/appcontainers/ci.yml b/sdk/appcontainers/ci.yml index 8a0095edb46cc..422aafd1dd11e 100644 --- a/sdk/appcontainers/ci.yml +++ b/sdk/appcontainers/ci.yml @@ -28,6 +28,7 @@ extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: appcontainers + TestProxy: true Artifacts: - name: azure-mgmt-appcontainers safeName: azuremgmtappcontainers diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/pyproject.toml b/sdk/applicationinsights/azure-mgmt-applicationinsights/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/appplatform/azure-mgmt-appplatform/pyproject.toml b/sdk/appplatform/azure-mgmt-appplatform/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/appservice/azure-mgmt-web/CHANGELOG.md b/sdk/appservice/azure-mgmt-web/CHANGELOG.md index 418c1294ff883..8f26c1dfad8bd 100644 --- a/sdk/appservice/azure-mgmt-web/CHANGELOG.md +++ b/sdk/appservice/azure-mgmt-web/CHANGELOG.md @@ -1,5 +1,14 @@ # Release History +## 7.3.1 (2024-08-19) + +### Bugs Fixed + + - Fix type of property instance_count in model FunctionsAlwaysReadyConfig from float to int + - Fix type of property maximum_instance_count in model FunctionsScaleAndConcurrency from float to int + - Fix type of property instance_memory_mb in model FunctionsScaleAndConcurrency from float to int + - Fix type of property per_instance_concurrency in model FunctionsScaleAndConcurrencyTriggersHttp from float to int + ## 7.3.0 (2024-06-17) ### Features Added diff --git a/sdk/appservice/azure-mgmt-web/_meta.json b/sdk/appservice/azure-mgmt-web/_meta.json index 6a5684debebfb..2680526d4e8b4 100644 --- a/sdk/appservice/azure-mgmt-web/_meta.json +++ b/sdk/appservice/azure-mgmt-web/_meta.json @@ -1,12 +1,12 @@ { - "commit": "b22c642b361e6d6e7d72a2347a09b0bcf6075d70", + "commit": "c1d839d48ee936c9338431c38f2cbbfbc9879ea2", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.16", + "@autorest/python@6.17.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/web/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/python@6.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/web/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.17.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/web/resource-manager/readme.md", "package-2023-01": "fatal: invalid object name 'from'. from: WebApps.json", "package-2022-09": "fatal: invalid object name 'from'. from: WebApps.json", diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_serialization.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_serialization.py index 75e26c415d2c5..59f1fcf71bc97 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_serialization.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_serialization.py @@ -144,6 +144,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -1447,7 +1449,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_version.py index e1dc778a2e143..dc7c4aa5d482b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_web_site_management_client.py index 174b250e2db00..2c9da67e504ca 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/_web_site_management_client.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from typing import Any, Optional, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.mgmt.core import ARMPipelineClient diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client.py index 4813d1dc75a1c..8f005ea7ce82a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/aio/_web_site_management_client.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from typing import Any, Optional, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.mgmt.core import AsyncARMPipelineClient diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_metadata.json index 022a54bc44b63..7d947c523b5dc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff1..0000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_web_site_management_client.py index c43bdaba98b83..dd9cd966fb211 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -115,7 +116,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client.py index 9baefb2269326..c43893e5f6b91 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -117,7 +118,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domain_registration_provider_operations.py index 348c798d0e56f..42b3f26a0227c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domain_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_registration_provider_operations import build_list_operations_request if sys.version_info >= (3, 9): @@ -94,7 +92,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -110,7 +107,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domains_operations.py index 4b6a149f02c3b..2f00af0eb6660 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_check_availability_request, build_create_or_update_ownership_identifier_request, @@ -161,7 +161,6 @@ async def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -175,7 +174,7 @@ async def check_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailablilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailablilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -215,7 +214,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -231,7 +229,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -290,7 +287,6 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -304,7 +300,7 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -404,7 +400,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -420,7 +415,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -485,7 +479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -501,7 +494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -566,7 +558,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -580,7 +571,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -589,7 +580,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -603,7 +594,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -624,10 +615,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -635,14 +626,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -748,10 +739,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -816,7 +808,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -946,7 +937,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -960,11 +950,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1014,7 +1000,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1030,7 +1015,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1100,7 +1084,6 @@ async def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1114,7 +1097,7 @@ async def get_ownership_identifier( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1253,7 +1236,6 @@ async def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1267,7 +1249,7 @@ async def create_or_update_ownership_identifier( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1315,7 +1297,6 @@ async def delete_ownership_identifier( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1464,7 +1445,6 @@ async def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1478,7 +1458,7 @@ async def update_ownership_identifier( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1523,7 +1503,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_top_level_domains_operations.py index ff8b7b3849b28..0188d6e1475b0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/aio/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_level_domains_operations import ( build_get_request, build_list_agreements_request, @@ -98,7 +96,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -114,7 +111,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -176,7 +172,6 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -190,7 +185,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -298,7 +293,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -314,7 +308,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domain_registration_provider_operations.py index b56c1f7d37bb3..ca9a5f4bd74ba 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domain_registration_provider_operations.py @@ -20,15 +20,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +114,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +129,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py index 2965058f415b2..1374c446b4baa 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -682,7 +682,6 @@ def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -696,7 +695,7 @@ def check_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailablilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailablilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -736,7 +735,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -752,7 +750,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -811,7 +808,6 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -825,7 +821,7 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -922,7 +918,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -938,7 +933,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1003,7 +997,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1019,7 +1012,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1084,7 +1076,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1098,7 +1089,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1107,7 +1098,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1121,7 +1112,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1142,10 +1133,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1153,14 +1144,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1263,10 +1254,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1331,7 +1323,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1461,7 +1452,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1475,11 +1465,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1529,7 +1515,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1545,7 +1530,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1615,7 +1599,6 @@ def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1629,7 +1612,7 @@ def get_ownership_identifier( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1768,7 +1751,6 @@ def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1782,7 +1764,7 @@ def create_or_update_ownership_identifier( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1830,7 +1812,6 @@ def delete_ownership_identifier( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1979,7 +1960,6 @@ def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1993,7 +1973,7 @@ def update_ownership_identifier( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2038,7 +2018,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_top_level_domains_operations.py index c47fa50e59a11..fbabcd6799450 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +177,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +192,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -257,7 +253,6 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -271,7 +266,7 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -376,7 +371,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -392,7 +386,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_metadata.json index 77054c3de3290..2421644b31f5f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff1..0000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_web_site_management_client.py index 918f209f54b68..2102744187ae7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -113,7 +114,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client.py index 82540b1392c9b..abe5e27b99b16 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -115,7 +116,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_app_service_certificate_orders_operations.py index 19e548e3a680d..d7e6febdb8fd2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_certificate_orders_operations import ( build_create_or_update_certificate_request, build_create_or_update_request, @@ -118,7 +132,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -134,7 +147,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -252,7 +264,6 @@ async def validate_purchase_information( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -309,7 +320,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -325,7 +335,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -392,7 +401,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -406,7 +414,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -419,7 +427,7 @@ async def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -433,7 +441,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -454,10 +462,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -465,14 +473,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -589,10 +597,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -652,7 +661,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -786,7 +794,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -800,11 +807,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -854,7 +857,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -870,7 +872,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -940,7 +941,6 @@ async def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -954,7 +954,7 @@ async def get_certificate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -968,7 +968,7 @@ async def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -982,7 +982,7 @@ async def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1004,10 +1004,10 @@ async def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1015,14 +1015,14 @@ async def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1146,10 +1146,11 @@ async def begin_create_or_update_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1212,7 +1213,6 @@ async def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1354,7 +1354,6 @@ async def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1368,11 +1367,7 @@ async def update_certificate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1494,7 +1489,6 @@ async def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1626,7 +1620,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1681,7 +1674,6 @@ async def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1811,7 +1803,6 @@ async def resend_request_emails( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1941,7 +1932,6 @@ async def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1955,7 +1945,7 @@ async def retrieve_site_seal( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2000,7 +1990,6 @@ async def verify_domain_ownership( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2055,7 +2044,6 @@ async def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2069,7 +2057,7 @@ async def retrieve_certificate_actions( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2114,7 +2102,6 @@ async def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2128,7 +2115,7 @@ async def retrieve_certificate_email_history( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_certificate_registration_provider_operations.py index 068321b751e5c..b05605b92436c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/aio/operations/_certificate_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_registration_provider_operations import build_list_operations_request if sys.version_info >= (3, 9): @@ -94,7 +92,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -110,7 +107,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_app_service_certificate_orders_operations.py index edcde2d9d6485..8cfd97f13e4f3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -830,7 +830,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -846,7 +845,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -964,7 +962,6 @@ def validate_purchase_information( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1021,7 +1018,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1037,7 +1033,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1104,7 +1099,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1118,7 +1112,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1131,7 +1125,7 @@ def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1145,7 +1139,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1166,10 +1160,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1177,14 +1171,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1301,10 +1295,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1364,7 +1359,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1498,7 +1492,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1512,11 +1505,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1566,7 +1555,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1582,7 +1570,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1652,7 +1639,6 @@ def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1666,7 +1652,7 @@ def get_certificate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1680,7 +1666,7 @@ def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1694,7 +1680,7 @@ def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1716,10 +1702,10 @@ def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1727,14 +1713,14 @@ def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1858,10 +1844,11 @@ def begin_create_or_update_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1924,7 +1911,6 @@ def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2066,7 +2052,6 @@ def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2080,11 +2065,7 @@ def update_certificate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2206,7 +2187,6 @@ def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2338,7 +2318,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2393,7 +2372,6 @@ def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2523,7 +2501,6 @@ def resend_request_emails( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2653,7 +2630,6 @@ def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2667,7 +2643,7 @@ def retrieve_site_seal( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2712,7 +2688,6 @@ def verify_domain_ownership( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2767,7 +2742,6 @@ def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2781,7 +2755,7 @@ def retrieve_certificate_actions( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2826,7 +2800,6 @@ def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2840,7 +2813,7 @@ def retrieve_certificate_email_history( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_certificate_registration_provider_operations.py index 957160a2ba511..31d5aff69af49 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_08_01/operations/_certificate_registration_provider_operations.py @@ -20,15 +20,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +114,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +129,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_metadata.json index e618d26dc8528..8929526947731 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_vendor.py index fd66631892ed1..abd2e5566a353 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from .._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class WebSiteManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_web_site_management_client.py index 3aa9fb199736e..5a82511b83fcc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -144,7 +145,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_vendor.py index 39f69956b8888..6e80ec49ed289 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client.py index ba7fa46b862c2..98639c306ae40 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -146,7 +147,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_billing_meters_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_billing_meters_operations.py index 7122262459f85..810a880cc9f70 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_billing_meters_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_billing_meters_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._billing_meters_operations import build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -96,7 +94,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -112,7 +109,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_certificates_operations.py index e85b71e5f5326..dec3538cb536c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -101,7 +99,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -182,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -198,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +257,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -277,7 +270,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -397,7 +390,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +403,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -456,7 +448,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -587,7 +578,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -601,7 +591,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_deleted_web_apps_operations.py index 9644878cb9bef..ded76c8c85ff6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_deleted_web_apps_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_web_apps_operations import build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -92,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -108,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_diagnostics_operations.py index a536ea9a61c1e..374083a43c218 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._diagnostics_operations import ( build_execute_site_analysis_request, build_execute_site_analysis_slot_request, @@ -126,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -228,7 +224,6 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +237,7 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -291,7 +286,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -307,7 +301,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -393,7 +386,6 @@ async def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -407,7 +399,7 @@ async def get_site_detector_response( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -456,7 +448,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -472,7 +463,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -542,7 +532,6 @@ async def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -556,7 +545,7 @@ async def get_site_diagnostic_category( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -608,7 +597,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -624,7 +612,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -697,7 +684,6 @@ async def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -711,7 +697,7 @@ async def get_site_analysis( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -779,7 +765,6 @@ async def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +778,7 @@ async def execute_site_analysis( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -845,7 +830,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -861,7 +845,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -938,7 +921,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -954,7 +936,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1044,7 +1025,6 @@ async def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1058,7 +1038,7 @@ async def execute_site_detector( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1110,7 +1090,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1126,7 +1105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1216,7 +1194,6 @@ async def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1230,7 +1207,7 @@ async def get_site_detector_response_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1282,7 +1259,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1298,7 +1274,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1371,7 +1346,6 @@ async def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1385,7 +1359,7 @@ async def get_site_diagnostic_category_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1440,7 +1414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1456,7 +1429,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1538,7 +1510,6 @@ async def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1552,7 +1523,7 @@ async def get_site_analysis_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1624,7 +1595,6 @@ async def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1638,7 +1608,7 @@ async def execute_site_analysis_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1693,7 +1663,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1709,7 +1678,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1795,7 +1763,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1811,7 +1778,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1905,7 +1871,6 @@ async def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1919,7 +1884,7 @@ async def execute_site_detector_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_provider_operations.py index eaf38191affae..294b910b1570c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._provider_operations import ( build_get_available_stacks_on_prem_request, build_get_available_stacks_request, @@ -101,7 +99,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -182,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -198,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -266,7 +260,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -282,7 +275,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_recommendations_operations.py index b822489167c58..0f1278e2d09bb 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_recommendations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommendations_operations import ( build_disable_all_for_web_app_request, build_disable_recommendation_for_site_request, @@ -116,7 +114,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +129,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -191,7 +187,6 @@ async def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -243,7 +238,6 @@ async def disable_recommendation_for_subscription( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -307,7 +301,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -323,7 +316,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -408,7 +400,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -424,7 +415,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -491,7 +481,6 @@ async def disable_all_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -546,7 +535,6 @@ async def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -618,7 +606,6 @@ async def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -632,7 +619,7 @@ async def get_rule_details_by_web_app( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -680,7 +667,6 @@ async def disable_recommendation_for_site( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_resource_health_metadata_operations.py index bf44549988307..fff5e37920e2a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_resource_health_metadata_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._resource_health_metadata_operations import ( build_get_by_site_request, build_get_by_site_slot_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -277,7 +271,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -293,7 +286,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -359,7 +351,6 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +365,7 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -428,7 +419,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +434,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -516,7 +505,6 @@ async def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -531,7 +519,7 @@ async def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_web_site_management_client_operations.py index 1129b04e9ac15..3aec438966be0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/aio/operations/_web_site_management_client_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_site_management_client_operations import ( build_check_name_availability_request, build_get_publishing_user_request, @@ -95,7 +93,6 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +106,7 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -198,7 +195,6 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +208,7 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -254,7 +250,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -270,7 +265,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -333,7 +327,6 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -347,7 +340,7 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -455,7 +448,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -469,7 +461,7 @@ async def update_source_control( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -524,7 +516,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -538,7 +529,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -578,7 +569,6 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -592,7 +582,7 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -647,7 +637,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -663,7 +652,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -782,7 +770,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -798,7 +785,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -863,7 +849,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -879,7 +864,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -940,7 +924,6 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -954,7 +937,7 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1053,7 +1036,6 @@ async def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1067,7 +1049,7 @@ async def verify_hosting_environment_vnet( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1180,7 +1162,6 @@ async def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1299,7 +1280,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1313,7 +1293,7 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1426,7 +1406,6 @@ async def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_billing_meters_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_billing_meters_operations.py index 7d63dd33cd72a..37adc385425d2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_billing_meters_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_billing_meters_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -123,7 +122,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +137,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_certificates_operations.py index ac4c2979f0330..c014957d8477a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_certificates_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -300,7 +299,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -316,7 +314,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -381,7 +378,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -397,7 +393,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -462,7 +457,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -476,7 +470,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -596,7 +590,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -610,7 +603,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -655,7 +648,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -786,7 +778,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -800,7 +791,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_deleted_web_apps_operations.py index 5941cf6833c6f..ed7bf9acfab56 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_deleted_web_apps_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -118,7 +117,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -134,7 +132,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_diagnostics_operations.py index 624e6a8a17721..868e64bdf7dbc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1101,7 +1100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1117,7 +1115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1203,7 +1200,6 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1217,7 +1213,7 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1265,7 +1261,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1281,7 +1276,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1367,7 +1361,6 @@ def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1381,7 +1374,7 @@ def get_site_detector_response( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1429,7 +1422,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1445,7 +1437,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1515,7 +1506,6 @@ def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1529,7 +1519,7 @@ def get_site_diagnostic_category( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1580,7 +1570,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1596,7 +1585,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1669,7 +1657,6 @@ def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1683,7 +1670,7 @@ def get_site_analysis( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1751,7 +1738,6 @@ def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1765,7 +1751,7 @@ def execute_site_analysis( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1816,7 +1802,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1832,7 +1817,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1908,7 +1892,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1924,7 +1907,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2014,7 +1996,6 @@ def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2028,7 +2009,7 @@ def execute_site_detector( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2079,7 +2060,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2095,7 +2075,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2185,7 +2164,6 @@ def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2199,7 +2177,7 @@ def get_site_detector_response_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2250,7 +2228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2266,7 +2243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2339,7 +2315,6 @@ def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2353,7 +2328,7 @@ def get_site_diagnostic_category_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2407,7 +2382,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2423,7 +2397,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2505,7 +2478,6 @@ def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2519,7 +2491,7 @@ def get_site_analysis_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2591,7 +2563,6 @@ def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2605,7 +2576,7 @@ def execute_site_analysis_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2659,7 +2630,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2675,7 +2645,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2760,7 +2729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2776,7 +2744,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2870,7 +2837,6 @@ def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2884,7 +2850,7 @@ def execute_site_detector_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_provider_operations.py index 510c3c977ae6f..de2a42bac4b3b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -168,7 +167,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -184,7 +182,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -249,7 +246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -265,7 +261,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -332,7 +327,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -348,7 +342,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_recommendations_operations.py index 76fb67531f00b..d39b6f0dd5090 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_recommendations_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -412,7 +411,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -428,7 +426,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -487,7 +484,6 @@ def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -539,7 +535,6 @@ def disable_recommendation_for_subscription( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -602,7 +597,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -618,7 +612,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -702,7 +695,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -718,7 +710,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -785,7 +776,6 @@ def disable_all_for_web_app( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -840,7 +830,6 @@ def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -912,7 +901,6 @@ def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -926,7 +914,7 @@ def get_rule_details_by_web_app( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -974,7 +962,6 @@ def disable_recommendation_for_site( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_resource_health_metadata_operations.py index ffa5d8c98db29..7dcd8bbb1a42e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_resource_health_metadata_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -389,7 +386,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -405,7 +401,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -477,7 +472,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -493,7 +487,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -559,7 +552,6 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +566,7 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -627,7 +619,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -643,7 +634,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -715,7 +705,6 @@ def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -730,7 +719,7 @@ def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_web_site_management_client_operations.py index 6c8794204dfa3..102c0c334b2c8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_03_01/operations/_web_site_management_client_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -494,7 +493,6 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -508,7 +506,7 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -597,7 +595,6 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +608,7 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -652,7 +649,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -668,7 +664,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -731,7 +726,6 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -745,7 +739,7 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -853,7 +847,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -867,7 +860,7 @@ def update_source_control( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -922,7 +915,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -936,7 +928,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -976,7 +968,6 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -990,7 +981,7 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1045,7 +1036,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1061,7 +1051,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1180,7 +1169,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1196,7 +1184,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1260,7 +1247,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1276,7 +1262,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1337,7 +1322,6 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1351,7 +1335,7 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1450,7 +1434,6 @@ def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1464,7 +1447,7 @@ def verify_hosting_environment_vnet( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1577,7 +1560,6 @@ def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1696,7 +1678,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1710,7 +1691,7 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1823,7 +1804,6 @@ def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_metadata.json index 9b444ab006dc1..eb86456e5acb2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff1..0000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_web_site_management_client.py index 9db14b70789d8..ce5b78b6af91c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -104,7 +105,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client.py index 110d1e1c001bf..136a23bb5e1e7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -106,7 +107,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations/_web_apps_operations.py index 5e4c7d174e1e7..28b13eda21652 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/aio/operations/_web_apps_operations.py @@ -32,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -45,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_apps_operations import ( build_add_premier_add_on_request, build_add_premier_add_on_slot_request, @@ -421,7 +421,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -437,7 +436,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -509,7 +507,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -525,7 +522,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -590,7 +586,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -606,7 +601,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -615,7 +610,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio async def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -629,7 +624,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -650,10 +645,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -661,14 +656,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -780,10 +775,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -855,7 +851,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -994,7 +989,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1008,11 +1002,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1060,7 +1050,6 @@ async def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1074,7 +1063,7 @@ async def analyze_custom_hostname( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1194,7 +1183,6 @@ async def apply_slot_config_to_production( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1322,7 +1310,6 @@ async def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1336,7 +1323,7 @@ async def backup( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1382,7 +1369,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1398,7 +1384,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1538,7 +1523,6 @@ async def discover_restore( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1552,7 +1536,7 @@ async def discover_restore( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1600,7 +1584,6 @@ async def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1614,7 +1597,7 @@ async def get_backup_status( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1662,7 +1645,6 @@ async def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1814,7 +1796,6 @@ async def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1828,7 +1809,7 @@ async def list_backup_status_secrets( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1842,7 +1823,7 @@ async def _restore_initial( backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> _models.RestoreResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1856,7 +1837,7 @@ async def _restore_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestoreResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1878,10 +1859,10 @@ async def _restore_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1889,10 +1870,14 @@ async def _restore_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2012,10 +1997,11 @@ async def begin_restore( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RestoreResponse", pipeline_response) + deserialized = self._deserialize("RestoreResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2079,7 +2065,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2095,7 +2080,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2237,7 +2221,6 @@ async def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2251,7 +2234,7 @@ async def update_application_settings( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2296,7 +2279,6 @@ async def list_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2310,7 +2292,7 @@ async def list_application_settings( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2430,7 +2412,6 @@ async def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2444,7 +2425,7 @@ async def update_auth_settings( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2487,7 +2468,6 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2501,7 +2481,7 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2617,7 +2597,6 @@ async def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2631,7 +2610,7 @@ async def update_backup_configuration( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2676,7 +2655,6 @@ async def delete_backup_configuration( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2731,7 +2709,6 @@ async def get_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2745,7 +2722,7 @@ async def get_backup_configuration( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2868,7 +2845,6 @@ async def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2882,7 +2858,7 @@ async def update_connection_strings( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2927,7 +2903,6 @@ async def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2941,7 +2916,7 @@ async def list_connection_strings( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2986,7 +2961,6 @@ async def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3000,7 +2974,7 @@ async def get_diagnostic_logs_configuration( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3123,7 +3097,6 @@ async def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3137,7 +3110,7 @@ async def update_diagnostic_logs_config( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3253,7 +3226,6 @@ async def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3267,7 +3239,7 @@ async def update_metadata( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3310,7 +3282,6 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3324,7 +3295,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3333,7 +3304,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any async def _list_publishing_credentials_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3346,7 +3317,7 @@ async def _list_publishing_credentials_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -3356,10 +3327,10 @@ async def _list_publishing_credentials_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3367,10 +3338,14 @@ async def _list_publishing_credentials_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3411,10 +3386,11 @@ async def begin_list_publishing_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3545,7 +3521,6 @@ async def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3559,7 +3534,7 @@ async def update_site_push_settings( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3602,7 +3577,6 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3616,7 +3590,7 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3661,7 +3635,6 @@ async def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3675,7 +3648,7 @@ async def list_slot_configuration_names( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3804,7 +3777,6 @@ async def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3818,7 +3790,7 @@ async def update_slot_configuration_names( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3863,7 +3835,6 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3877,7 +3848,7 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3997,7 +3968,6 @@ async def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4011,7 +3981,7 @@ async def create_or_update_configuration( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4131,7 +4101,6 @@ async def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4145,7 +4114,7 @@ async def update_configuration( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4197,7 +4166,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4213,7 +4181,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4283,7 +4250,6 @@ async def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4297,7 +4263,7 @@ async def get_configuration_snapshot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4345,7 +4311,6 @@ async def recover_site_configuration_snapshot( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4400,9 +4365,9 @@ async def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4411,12 +4376,16 @@ async def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4461,9 +4430,9 @@ async def get_web_site_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4472,12 +4441,16 @@ async def get_web_site_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4526,7 +4499,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4542,7 +4514,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4612,7 +4583,6 @@ async def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4628,7 +4598,7 @@ async def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4676,7 +4646,6 @@ async def delete_continuous_web_job( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4734,7 +4703,6 @@ async def start_continuous_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4792,7 +4760,6 @@ async def stop_continuous_web_job( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4850,7 +4817,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4866,7 +4832,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4934,7 +4899,6 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4948,7 +4912,7 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5078,7 +5042,6 @@ async def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5092,7 +5055,7 @@ async def create_deployment( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5140,7 +5103,6 @@ async def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5199,7 +5161,6 @@ async def list_deployment_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5213,7 +5174,7 @@ async def list_deployment_log( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5261,7 +5222,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5277,7 +5237,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5347,7 +5306,6 @@ async def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5361,7 +5319,7 @@ async def get_domain_ownership_identifier( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5493,7 +5451,6 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5507,7 +5464,7 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5555,7 +5512,6 @@ async def delete_domain_ownership_identifier( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5697,7 +5653,6 @@ async def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5711,7 +5666,7 @@ async def update_domain_ownership_identifier( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5754,7 +5709,6 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5768,7 +5722,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5777,7 +5731,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar async def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5791,7 +5745,7 @@ async def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5812,10 +5766,10 @@ async def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5823,12 +5777,14 @@ async def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5934,10 +5890,11 @@ async def begin_create_ms_deploy_operation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5997,7 +5954,6 @@ async def get_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6013,7 +5969,7 @@ async def get_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6062,7 +6018,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6078,7 +6033,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6143,7 +6097,6 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6157,7 +6110,7 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6205,7 +6158,6 @@ async def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6221,7 +6173,7 @@ async def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6235,7 +6187,7 @@ async def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6249,7 +6201,7 @@ async def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6271,10 +6223,10 @@ async def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6282,10 +6234,14 @@ async def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6405,10 +6361,11 @@ async def begin_create_function( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6471,7 +6428,6 @@ async def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6529,7 +6485,6 @@ async def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6543,7 +6498,7 @@ async def list_function_secrets( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6592,7 +6547,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6608,7 +6562,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6678,7 +6631,6 @@ async def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6692,7 +6644,7 @@ async def get_host_name_binding( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6824,7 +6776,6 @@ async def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6838,7 +6789,7 @@ async def create_or_update_host_name_binding( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6886,7 +6837,6 @@ async def delete_host_name_binding( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6947,7 +6897,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6961,7 +6910,7 @@ async def get_hybrid_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7101,7 +7050,6 @@ async def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7115,7 +7063,7 @@ async def create_or_update_hybrid_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7166,7 +7114,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7316,7 +7263,6 @@ async def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7330,7 +7276,7 @@ async def update_hybrid_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7381,7 +7327,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7395,7 +7340,7 @@ async def list_hybrid_connection_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7440,7 +7385,6 @@ async def list_hybrid_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7454,7 +7398,7 @@ async def list_hybrid_connections( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7499,7 +7443,6 @@ async def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7513,7 +7456,7 @@ async def list_relay_service_connections( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7561,7 +7504,6 @@ async def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7575,7 +7517,7 @@ async def get_relay_service_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7706,7 +7648,6 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7720,7 +7661,7 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7768,7 +7709,6 @@ async def delete_relay_service_connection( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7909,7 +7849,6 @@ async def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7923,7 +7862,7 @@ async def update_relay_service_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7972,7 +7911,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7988,7 +7926,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8058,7 +7995,6 @@ async def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8072,7 +8008,7 @@ async def get_instance_ms_deploy_status( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8086,7 +8022,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8100,7 +8036,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -8122,10 +8058,10 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8133,12 +8069,14 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8258,10 +8196,11 @@ async def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8324,7 +8263,6 @@ async def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8340,7 +8278,7 @@ async def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8394,7 +8332,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8410,7 +8347,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8484,7 +8420,6 @@ async def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8500,7 +8435,7 @@ async def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8554,7 +8489,6 @@ async def delete_instance_process( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8616,9 +8550,9 @@ async def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8627,12 +8561,16 @@ async def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8690,7 +8628,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8706,7 +8643,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8783,7 +8719,6 @@ async def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8799,7 +8734,7 @@ async def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8855,7 +8790,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8871,7 +8805,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8950,7 +8883,6 @@ async def get_instance_process_thread( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8966,7 +8898,7 @@ async def get_instance_process_thread( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9009,7 +8941,6 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9023,7 +8954,7 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9068,7 +8999,6 @@ async def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9082,7 +9012,7 @@ async def list_sync_function_triggers( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9132,7 +9062,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9148,7 +9077,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9234,7 +9162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9250,7 +9177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9286,7 +9212,7 @@ async def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9300,7 +9226,7 @@ async def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -9322,10 +9248,10 @@ async def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9333,10 +9259,14 @@ async def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9460,10 +9390,11 @@ async def begin_migrate_storage( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9491,7 +9422,7 @@ async def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9505,7 +9436,7 @@ async def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -9526,10 +9457,10 @@ async def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9537,10 +9468,14 @@ async def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9651,10 +9586,11 @@ async def begin_migrate_my_sql( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9716,7 +9652,6 @@ async def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9730,7 +9665,7 @@ async def get_migrate_my_sql_status( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9778,7 +9713,6 @@ async def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9794,7 +9728,7 @@ async def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9854,7 +9788,6 @@ async def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9868,7 +9801,7 @@ async def start_web_site_network_trace( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9911,7 +9844,6 @@ async def stop_web_site_network_trace(self, resource_group_name: str, name: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9925,7 +9857,7 @@ async def stop_web_site_network_trace(self, resource_group_name: str, name: str, map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9970,7 +9902,6 @@ async def generate_new_site_publishing_password( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10034,7 +9965,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10050,7 +9980,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10117,7 +10046,6 @@ async def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10131,7 +10059,7 @@ async def get_site_php_error_log_flag( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10174,7 +10102,6 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10188,7 +10115,7 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10236,7 +10163,6 @@ async def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10250,7 +10176,7 @@ async def get_premier_add_on( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10380,7 +10306,6 @@ async def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10394,7 +10319,7 @@ async def add_premier_add_on( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10442,7 +10367,6 @@ async def delete_premier_add_on( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10502,7 +10426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10518,7 +10441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10588,7 +10510,6 @@ async def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10604,7 +10525,7 @@ async def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10654,7 +10575,6 @@ async def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10712,9 +10632,9 @@ async def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10723,12 +10643,16 @@ async def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10782,7 +10706,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10798,7 +10721,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10871,7 +10793,6 @@ async def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10887,7 +10808,7 @@ async def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10939,7 +10860,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10955,7 +10875,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11030,7 +10949,6 @@ async def get_process_thread( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11046,7 +10964,7 @@ async def get_process_thread( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11095,7 +11013,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11111,7 +11028,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11181,7 +11097,6 @@ async def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11195,7 +11110,7 @@ async def get_public_certificate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11327,7 +11242,6 @@ async def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11341,7 +11255,7 @@ async def create_or_update_public_certificate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11389,7 +11303,6 @@ async def delete_public_certificate( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11524,9 +11437,9 @@ async def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11535,23 +11448,27 @@ async def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _recover_initial( # pylint: disable=inconsistent-return-statements + async def _recover_initial( self, resource_group_name: str, name: str, recovery_entity: Union[_models.SnapshotRecoveryRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11565,7 +11482,7 @@ async def _recover_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11586,10 +11503,10 @@ async def _recover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11597,11 +11514,19 @@ async def _recover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_recover( @@ -11695,7 +11620,7 @@ async def begin_recover( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._recover_initial( # type: ignore + raw_result = await self._recover_initial( resource_group_name=resource_group_name, name=name, recovery_entity=recovery_entity, @@ -11706,6 +11631,7 @@ async def begin_recover( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -11767,7 +11693,6 @@ async def reset_production_slot_config( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11836,7 +11761,6 @@ async def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11895,7 +11819,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11911,7 +11834,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11981,7 +11903,6 @@ async def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11997,7 +11918,7 @@ async def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12006,7 +11927,7 @@ async def get_site_extension( async def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12019,7 +11940,7 @@ async def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -12030,10 +11951,10 @@ async def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -12041,15 +11962,14 @@ async def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12095,10 +12015,11 @@ async def begin_install_site_extension( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12161,7 +12082,6 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12217,7 +12137,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -12233,7 +12152,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -12302,7 +12220,6 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12318,7 +12235,7 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12336,7 +12253,7 @@ async def _create_or_update_slot_initial( force_dns_registration: Optional[bool] = None, ttl_in_seconds: Optional[str] = None, **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12350,7 +12267,7 @@ async def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -12376,10 +12293,10 @@ async def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -12387,14 +12304,14 @@ async def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12578,10 +12495,11 @@ async def begin_create_or_update_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12663,7 +12581,6 @@ async def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12870,7 +12787,6 @@ async def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12884,11 +12800,7 @@ async def update_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12940,7 +12852,6 @@ async def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12954,7 +12865,7 @@ async def analyze_custom_hostname_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13087,7 +12998,6 @@ async def apply_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13232,7 +13142,6 @@ async def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13246,7 +13155,7 @@ async def backup_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13298,7 +13207,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13314,7 +13222,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13471,7 +13378,6 @@ async def discover_restore_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13485,7 +13391,7 @@ async def discover_restore_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13537,7 +13443,6 @@ async def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13551,7 +13456,7 @@ async def get_backup_status_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13603,7 +13508,6 @@ async def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13768,7 +13672,6 @@ async def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13782,7 +13685,7 @@ async def list_backup_status_secrets_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13797,7 +13700,7 @@ async def _restore_slot_initial( slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> _models.RestoreResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13811,7 +13714,7 @@ async def _restore_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestoreResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -13834,10 +13737,10 @@ async def _restore_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13845,10 +13748,14 @@ async def _restore_slot_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13981,10 +13888,11 @@ async def begin_restore_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RestoreResponse", pipeline_response) + deserialized = self._deserialize("RestoreResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14052,7 +13960,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14068,7 +13975,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14223,7 +14129,6 @@ async def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14237,7 +14142,7 @@ async def update_application_settings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14286,7 +14191,6 @@ async def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14300,7 +14204,7 @@ async def list_application_settings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14433,7 +14337,6 @@ async def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14447,7 +14350,7 @@ async def update_auth_settings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14496,7 +14399,6 @@ async def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14510,7 +14412,7 @@ async def get_auth_settings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14643,7 +14545,6 @@ async def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14657,7 +14558,7 @@ async def update_backup_configuration_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14706,7 +14607,6 @@ async def delete_backup_configuration_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14765,7 +14665,6 @@ async def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14779,7 +14678,7 @@ async def get_backup_configuration_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14915,7 +14814,6 @@ async def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14929,7 +14827,7 @@ async def update_connection_strings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14978,7 +14876,6 @@ async def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14992,7 +14889,7 @@ async def list_connection_strings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15041,7 +14938,6 @@ async def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15055,7 +14951,7 @@ async def get_diagnostic_logs_configuration_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15191,7 +15087,6 @@ async def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15205,7 +15100,7 @@ async def update_diagnostic_logs_config_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15338,7 +15233,6 @@ async def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15352,7 +15246,7 @@ async def update_metadata_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15401,7 +15295,6 @@ async def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15415,7 +15308,7 @@ async def list_metadata_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15424,7 +15317,7 @@ async def list_metadata_slot( async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15437,7 +15330,7 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -15448,10 +15341,10 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15459,10 +15352,14 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15507,10 +15404,11 @@ async def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15658,7 +15556,6 @@ async def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15672,7 +15569,7 @@ async def update_site_push_settings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15721,7 +15618,6 @@ async def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15735,7 +15631,7 @@ async def list_site_push_settings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15786,7 +15682,6 @@ async def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15800,7 +15695,7 @@ async def get_configuration_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15933,7 +15828,6 @@ async def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15947,7 +15841,7 @@ async def create_or_update_configuration_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16080,7 +15974,6 @@ async def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16094,7 +15987,7 @@ async def update_configuration_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16150,7 +16043,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16166,7 +16058,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16240,7 +16131,6 @@ async def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16254,7 +16144,7 @@ async def get_configuration_snapshot_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16306,7 +16196,6 @@ async def recover_site_configuration_snapshot_slot( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16365,9 +16254,9 @@ async def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16376,12 +16265,16 @@ async def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16430,9 +16323,9 @@ async def get_web_site_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16441,12 +16334,16 @@ async def get_web_site_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16499,7 +16396,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16515,7 +16411,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16589,7 +16484,6 @@ async def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16605,7 +16499,7 @@ async def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16657,7 +16551,6 @@ async def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16719,7 +16612,6 @@ async def start_continuous_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16781,7 +16673,6 @@ async def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16843,7 +16734,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16859,7 +16749,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16933,7 +16822,6 @@ async def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16947,7 +16835,7 @@ async def get_deployment_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17090,7 +16978,6 @@ async def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17104,7 +16991,7 @@ async def create_deployment_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17156,7 +17043,6 @@ async def delete_deployment_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17219,7 +17105,6 @@ async def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17233,7 +17118,7 @@ async def list_deployment_log_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17285,7 +17170,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17301,7 +17185,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17375,7 +17258,6 @@ async def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17389,7 +17271,7 @@ async def get_domain_ownership_identifier_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17534,7 +17416,6 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17548,7 +17429,7 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17600,7 +17481,6 @@ async def delete_domain_ownership_identifier_slot( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17755,7 +17635,6 @@ async def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17769,7 +17648,7 @@ async def update_domain_ownership_identifier_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17818,7 +17697,6 @@ async def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17832,7 +17710,7 @@ async def get_ms_deploy_status_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17846,7 +17724,7 @@ async def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17860,7 +17738,7 @@ async def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17882,10 +17760,10 @@ async def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17893,12 +17771,14 @@ async def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18021,10 +17901,11 @@ async def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -18088,7 +17969,6 @@ async def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18104,7 +17984,7 @@ async def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18157,7 +18037,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18173,7 +18052,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18244,7 +18122,6 @@ async def get_functions_admin_token_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18258,7 +18135,7 @@ async def get_functions_admin_token_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18310,7 +18187,6 @@ async def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18326,7 +18202,7 @@ async def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18341,7 +18217,7 @@ async def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18355,7 +18231,7 @@ async def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -18378,10 +18254,10 @@ async def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -18389,10 +18265,14 @@ async def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18525,10 +18405,11 @@ async def begin_create_instance_function_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -18595,7 +18476,6 @@ async def delete_instance_function_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18657,7 +18537,6 @@ async def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18671,7 +18550,7 @@ async def list_function_secrets_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18724,7 +18603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18740,7 +18618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18814,7 +18691,6 @@ async def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18828,7 +18704,7 @@ async def get_host_name_binding_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18973,7 +18849,6 @@ async def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18987,7 +18862,7 @@ async def create_or_update_host_name_binding_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19039,7 +18914,6 @@ async def delete_host_name_binding_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19103,7 +18977,6 @@ async def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19117,7 +18990,7 @@ async def get_hybrid_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19267,7 +19140,6 @@ async def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19281,7 +19153,7 @@ async def create_or_update_hybrid_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19335,7 +19207,6 @@ async def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19495,7 +19366,6 @@ async def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19509,7 +19379,7 @@ async def update_hybrid_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19563,7 +19433,6 @@ async def list_hybrid_connection_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19577,7 +19446,7 @@ async def list_hybrid_connection_keys_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19625,7 +19494,6 @@ async def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19639,7 +19507,7 @@ async def list_hybrid_connections_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19688,7 +19556,6 @@ async def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19702,7 +19569,7 @@ async def list_relay_service_connections_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19754,7 +19621,6 @@ async def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19768,7 +19634,7 @@ async def get_relay_service_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19912,7 +19778,6 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19926,7 +19791,7 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19978,7 +19843,6 @@ async def delete_relay_service_connection_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20132,7 +19996,6 @@ async def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20146,7 +20009,7 @@ async def update_relay_service_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20199,7 +20062,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20215,7 +20077,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20289,7 +20150,6 @@ async def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20303,7 +20163,7 @@ async def get_instance_ms_deploy_status_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20318,7 +20178,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20332,7 +20192,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -20355,10 +20215,10 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20366,12 +20226,14 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20504,10 +20366,11 @@ async def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=nam params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20574,7 +20437,6 @@ async def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20590,7 +20452,7 @@ async def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20648,7 +20510,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20664,7 +20525,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20742,7 +20602,6 @@ async def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20758,7 +20617,7 @@ async def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20816,7 +20675,6 @@ async def delete_instance_process_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20882,9 +20740,9 @@ async def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20893,12 +20751,16 @@ async def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20960,7 +20822,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20976,7 +20837,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21064,7 +20924,6 @@ async def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21080,7 +20939,7 @@ async def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21140,7 +20999,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21156,7 +21014,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21246,7 +21103,6 @@ async def get_instance_process_thread_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21262,7 +21118,7 @@ async def get_instance_process_thread_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21311,7 +21167,6 @@ async def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21325,7 +21180,7 @@ async def is_cloneable_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21374,7 +21229,6 @@ async def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21388,7 +21242,7 @@ async def list_sync_function_triggers_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21442,7 +21296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21458,7 +21311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21549,7 +21401,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21565,7 +21416,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21637,7 +21487,6 @@ async def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21651,7 +21500,7 @@ async def get_migrate_my_sql_status_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21703,7 +21552,6 @@ async def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21719,7 +21567,7 @@ async def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21783,7 +21631,6 @@ async def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21797,7 +21644,7 @@ async def start_web_site_network_trace_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21845,7 +21692,6 @@ async def stop_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21859,7 +21705,7 @@ async def stop_web_site_network_trace_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21908,7 +21754,6 @@ async def generate_new_site_publishing_password_slot( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21976,7 +21821,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21992,7 +21836,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22063,7 +21906,6 @@ async def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22077,7 +21919,7 @@ async def get_site_php_error_log_flag_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22126,7 +21968,6 @@ async def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22140,7 +21981,7 @@ async def list_premier_add_ons_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22192,7 +22033,6 @@ async def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22206,7 +22046,7 @@ async def get_premier_add_on_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22349,7 +22189,6 @@ async def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22363,7 +22202,7 @@ async def add_premier_add_on_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22415,7 +22254,6 @@ async def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22479,7 +22317,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22495,7 +22332,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22569,7 +22405,6 @@ async def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22585,7 +22420,7 @@ async def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22639,7 +22474,6 @@ async def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22701,9 +22535,9 @@ async def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22712,12 +22546,16 @@ async def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22775,7 +22613,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22791,7 +22628,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22868,7 +22704,6 @@ async def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22884,7 +22719,7 @@ async def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22940,7 +22775,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22956,7 +22790,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23035,7 +22868,6 @@ async def get_process_thread_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23051,7 +22883,7 @@ async def get_process_thread_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23104,7 +22936,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23120,7 +22951,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23194,7 +23024,6 @@ async def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23208,7 +23037,7 @@ async def get_public_certificate_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23353,7 +23182,6 @@ async def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23367,7 +23195,7 @@ async def create_or_update_public_certificate_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23419,7 +23247,6 @@ async def delete_public_certificate_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23567,9 +23394,9 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23578,24 +23405,28 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _recover_slot_initial( # pylint: disable=inconsistent-return-statements + async def _recover_slot_initial( self, resource_group_name: str, name: str, slot: str, recovery_entity: Union[_models.SnapshotRecoveryRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23609,7 +23440,7 @@ async def _recover_slot_initial( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23631,10 +23462,10 @@ async def _recover_slot_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23642,11 +23473,19 @@ async def _recover_slot_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_recover_slot( @@ -23752,7 +23591,7 @@ async def begin_recover_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._recover_slot_initial( # type: ignore + raw_result = await self._recover_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -23764,6 +23603,7 @@ async def begin_recover_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -23829,7 +23669,6 @@ async def reset_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23903,7 +23742,6 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23966,7 +23804,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23982,7 +23819,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24056,7 +23892,6 @@ async def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24072,7 +23907,7 @@ async def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24081,7 +23916,7 @@ async def get_site_extension_slot( async def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24094,7 +23929,7 @@ async def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -24106,10 +23941,10 @@ async def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24117,15 +23952,14 @@ async def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24175,10 +24009,11 @@ async def begin_install_site_extension_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24245,7 +24080,6 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24393,7 +24227,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24409,7 +24242,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24438,14 +24270,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24459,7 +24291,7 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24481,10 +24313,10 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24492,11 +24324,19 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot( @@ -24599,7 +24439,7 @@ async def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_initial( # type: ignore + raw_result = await self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -24611,6 +24451,7 @@ async def begin_swap_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -24676,7 +24517,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24692,7 +24532,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24763,7 +24602,6 @@ async def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24777,14 +24615,7 @@ async def get_source_control_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24798,7 +24629,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24812,7 +24643,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24834,10 +24665,10 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24845,17 +24676,14 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24983,10 +24811,11 @@ async def begin_create_or_update_source_control_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25050,7 +24879,6 @@ async def delete_source_control_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25195,7 +25023,6 @@ async def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25209,11 +25036,7 @@ async def update_source_control_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25262,7 +25085,6 @@ async def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25321,7 +25143,6 @@ async def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25380,7 +25201,6 @@ async def sync_repository_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25439,7 +25259,6 @@ async def sync_function_triggers_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25502,7 +25321,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25518,7 +25336,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25592,7 +25409,6 @@ async def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25608,7 +25424,7 @@ async def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25660,7 +25476,6 @@ async def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25726,7 +25541,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25742,7 +25556,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25819,7 +25632,6 @@ async def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25835,7 +25647,7 @@ async def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25887,7 +25699,6 @@ async def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25956,7 +25767,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25972,7 +25782,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26043,7 +25852,6 @@ async def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26057,7 +25865,7 @@ async def list_vnet_connections_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26109,7 +25917,6 @@ async def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26123,7 +25930,7 @@ async def get_vnet_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26274,7 +26081,6 @@ async def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26288,7 +26094,7 @@ async def create_or_update_vnet_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26340,7 +26146,6 @@ async def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26501,7 +26306,6 @@ async def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26515,7 +26319,7 @@ async def update_vnet_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26571,7 +26375,6 @@ async def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26587,7 +26390,7 @@ async def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26743,7 +26546,6 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26757,7 +26559,7 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26913,7 +26715,6 @@ async def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26927,7 +26728,7 @@ async def update_vnet_connection_gateway_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26979,7 +26780,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26995,7 +26795,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27069,7 +26868,6 @@ async def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27083,7 +26881,7 @@ async def get_web_job_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27208,7 +27006,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27224,7 +27021,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27253,13 +27049,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27273,7 +27069,7 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -27294,10 +27090,10 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27305,11 +27101,19 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot_with_production( @@ -27400,7 +27204,7 @@ async def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_with_production_initial( # type: ignore + raw_result = await self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -27411,6 +27215,7 @@ async def begin_swap_slot_with_production( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -27471,7 +27276,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27487,7 +27291,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27552,7 +27355,6 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27566,14 +27368,7 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27586,7 +27381,7 @@ async def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27600,7 +27395,7 @@ async def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -27621,10 +27416,10 @@ async def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27632,17 +27427,14 @@ async def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27757,10 +27549,11 @@ async def begin_create_or_update_source_control( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27820,7 +27613,6 @@ async def delete_source_control( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27952,7 +27744,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27966,11 +27757,7 @@ async def update_source_control( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28015,7 +27802,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28070,7 +27856,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28125,7 +27910,6 @@ async def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28180,7 +27964,6 @@ async def sync_function_triggers( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28239,7 +28022,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28255,7 +28037,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28325,7 +28106,6 @@ async def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28341,7 +28121,7 @@ async def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28389,7 +28169,6 @@ async def delete_triggered_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28451,7 +28230,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28467,7 +28245,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28540,7 +28317,6 @@ async def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28556,7 +28332,7 @@ async def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28604,7 +28380,6 @@ async def run_triggered_web_job( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28669,7 +28444,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28685,7 +28459,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28750,7 +28523,6 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28764,7 +28536,7 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28812,7 +28584,6 @@ async def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28826,7 +28597,7 @@ async def get_vnet_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28964,7 +28735,6 @@ async def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28978,7 +28748,7 @@ async def create_or_update_vnet_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29026,7 +28796,6 @@ async def delete_vnet_connection( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29174,7 +28943,6 @@ async def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29188,7 +28956,7 @@ async def update_vnet_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29240,7 +29008,6 @@ async def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29256,7 +29023,7 @@ async def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29399,7 +29166,6 @@ async def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29413,7 +29179,7 @@ async def create_or_update_vnet_connection_gateway( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29556,7 +29322,6 @@ async def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29570,7 +29335,7 @@ async def update_vnet_connection_gateway( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29616,7 +29381,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29632,7 +29396,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29702,7 +29465,6 @@ async def get_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29716,7 +29478,7 @@ async def get_web_job( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/_web_apps_operations.py index f12f6ce9be5e7..ab388a2406664 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_08_01/operations/_web_apps_operations.py @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -12403,7 +12403,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -12419,7 +12418,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -12491,7 +12489,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -12507,7 +12504,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -12572,7 +12568,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12588,7 +12583,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12597,7 +12592,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12611,7 +12606,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -12632,10 +12627,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -12643,14 +12638,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12762,10 +12757,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12837,7 +12833,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12976,7 +12971,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12990,11 +12984,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13042,7 +13032,6 @@ def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13056,7 +13045,7 @@ def analyze_custom_hostname( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13176,7 +13165,6 @@ def apply_slot_config_to_production( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13304,7 +13292,6 @@ def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13318,7 +13305,7 @@ def backup( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13364,7 +13351,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13380,7 +13366,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13520,7 +13505,6 @@ def discover_restore( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13534,7 +13518,7 @@ def discover_restore( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13582,7 +13566,6 @@ def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13596,7 +13579,7 @@ def get_backup_status( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13644,7 +13627,6 @@ def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13796,7 +13778,6 @@ def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13810,7 +13791,7 @@ def list_backup_status_secrets( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13824,7 +13805,7 @@ def _restore_initial( backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> _models.RestoreResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13838,7 +13819,7 @@ def _restore_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestoreResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -13860,10 +13841,10 @@ def _restore_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13871,10 +13852,14 @@ def _restore_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13994,10 +13979,11 @@ def begin_restore( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RestoreResponse", pipeline_response) + deserialized = self._deserialize("RestoreResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14060,7 +14046,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14076,7 +14061,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14218,7 +14202,6 @@ def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14232,7 +14215,7 @@ def update_application_settings( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14275,7 +14258,6 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14289,7 +14271,7 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14409,7 +14391,6 @@ def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14423,7 +14404,7 @@ def update_auth_settings( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14466,7 +14447,6 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14480,7 +14460,7 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14596,7 +14576,6 @@ def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14610,7 +14589,7 @@ def update_backup_configuration( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14655,7 +14634,6 @@ def delete_backup_configuration( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14708,7 +14686,6 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14722,7 +14699,7 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14845,7 +14822,6 @@ def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14859,7 +14835,7 @@ def update_connection_strings( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14904,7 +14880,6 @@ def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14918,7 +14893,7 @@ def list_connection_strings( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14963,7 +14938,6 @@ def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14977,7 +14951,7 @@ def get_diagnostic_logs_configuration( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15100,7 +15074,6 @@ def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15114,7 +15087,7 @@ def update_diagnostic_logs_config( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15230,7 +15203,6 @@ def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15244,7 +15216,7 @@ def update_metadata( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15287,7 +15259,6 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15301,14 +15272,16 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _list_publishing_credentials_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.User: + def _list_publishing_credentials_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15321,7 +15294,7 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -15331,10 +15304,10 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15342,10 +15315,14 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15386,10 +15363,11 @@ def begin_list_publishing_credentials( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15520,7 +15498,6 @@ def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15534,7 +15511,7 @@ def update_site_push_settings( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15577,7 +15554,6 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15591,7 +15567,7 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15636,7 +15612,6 @@ def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15650,7 +15625,7 @@ def list_slot_configuration_names( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15779,7 +15754,6 @@ def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15793,7 +15767,7 @@ def update_slot_configuration_names( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15838,7 +15812,6 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15852,7 +15825,7 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15972,7 +15945,6 @@ def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15986,7 +15958,7 @@ def create_or_update_configuration( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16106,7 +16078,6 @@ def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16120,7 +16091,7 @@ def update_configuration( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16172,7 +16143,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16188,7 +16158,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16258,7 +16227,6 @@ def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16272,7 +16240,7 @@ def get_configuration_snapshot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16320,7 +16288,6 @@ def recover_site_configuration_snapshot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16375,9 +16342,9 @@ def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16386,12 +16353,16 @@ def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16436,9 +16407,9 @@ def get_web_site_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16447,12 +16418,16 @@ def get_web_site_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16500,7 +16475,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16516,7 +16490,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16586,7 +16559,6 @@ def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16602,7 +16574,7 @@ def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16650,7 +16622,6 @@ def delete_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16708,7 +16679,6 @@ def start_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16766,7 +16736,6 @@ def stop_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16822,7 +16791,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16838,7 +16806,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16906,7 +16873,6 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16920,7 +16886,7 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17050,7 +17016,6 @@ def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17064,7 +17029,7 @@ def create_deployment( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17112,7 +17077,6 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17169,7 +17133,6 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17183,7 +17146,7 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17231,7 +17194,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17247,7 +17209,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17317,7 +17278,6 @@ def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17331,7 +17291,7 @@ def get_domain_ownership_identifier( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17463,7 +17423,6 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17477,7 +17436,7 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17525,7 +17484,6 @@ def delete_domain_ownership_identifier( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17667,7 +17625,6 @@ def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17681,7 +17638,7 @@ def update_domain_ownership_identifier( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17724,7 +17681,6 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17738,7 +17694,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17747,7 +17703,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17761,7 +17717,7 @@ def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17782,10 +17738,10 @@ def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17793,12 +17749,14 @@ def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17904,10 +17862,11 @@ def begin_create_ms_deploy_operation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -17965,7 +17924,6 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17981,7 +17939,7 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18029,7 +17987,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18045,7 +18002,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18110,7 +18066,6 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18124,7 +18079,7 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18172,7 +18127,6 @@ def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18188,7 +18142,7 @@ def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18202,7 +18156,7 @@ def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18216,7 +18170,7 @@ def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -18238,10 +18192,10 @@ def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -18249,10 +18203,14 @@ def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18372,10 +18330,11 @@ def begin_create_function( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -18438,7 +18397,6 @@ def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18496,7 +18454,6 @@ def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18510,7 +18467,7 @@ def list_function_secrets( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18558,7 +18515,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18574,7 +18530,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18644,7 +18599,6 @@ def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18658,7 +18612,7 @@ def get_host_name_binding( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18790,7 +18744,6 @@ def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18804,7 +18757,7 @@ def create_or_update_host_name_binding( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18852,7 +18805,6 @@ def delete_host_name_binding( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18913,7 +18865,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18927,7 +18878,7 @@ def get_hybrid_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19067,7 +19018,6 @@ def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19081,7 +19031,7 @@ def create_or_update_hybrid_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19132,7 +19082,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19282,7 +19231,6 @@ def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19296,7 +19244,7 @@ def update_hybrid_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19347,7 +19295,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19361,7 +19308,7 @@ def list_hybrid_connection_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19404,7 +19351,6 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19418,7 +19364,7 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19463,7 +19409,6 @@ def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19477,7 +19422,7 @@ def list_relay_service_connections( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19525,7 +19470,6 @@ def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19539,7 +19483,7 @@ def get_relay_service_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19670,7 +19614,6 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19684,7 +19627,7 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19732,7 +19675,6 @@ def delete_relay_service_connection( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19873,7 +19815,6 @@ def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19887,7 +19828,7 @@ def update_relay_service_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19935,7 +19876,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19951,7 +19891,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20021,7 +19960,6 @@ def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20035,7 +19973,7 @@ def get_instance_ms_deploy_status( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20049,7 +19987,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20063,7 +20001,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -20085,10 +20023,10 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20096,12 +20034,14 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20221,10 +20161,11 @@ def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20287,7 +20228,6 @@ def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20303,7 +20243,7 @@ def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20357,7 +20297,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20373,7 +20312,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20447,7 +20385,6 @@ def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20463,7 +20400,7 @@ def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20517,7 +20454,6 @@ def delete_instance_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20579,9 +20515,9 @@ def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20590,12 +20526,16 @@ def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20652,7 +20592,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20668,7 +20607,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20745,7 +20683,6 @@ def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20761,7 +20698,7 @@ def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20816,7 +20753,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20832,7 +20768,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20911,7 +20846,6 @@ def get_instance_process_thread( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20927,7 +20861,7 @@ def get_instance_process_thread( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20970,7 +20904,6 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20984,7 +20917,7 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21029,7 +20962,6 @@ def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21043,7 +20975,7 @@ def list_sync_function_triggers( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21093,7 +21025,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21109,7 +21040,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21194,7 +21124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21210,7 +21139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21246,7 +21174,7 @@ def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21260,7 +21188,7 @@ def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21282,10 +21210,10 @@ def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21293,10 +21221,14 @@ def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21420,10 +21352,11 @@ def begin_migrate_storage( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21451,7 +21384,7 @@ def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21465,7 +21398,7 @@ def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21486,10 +21419,10 @@ def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21497,10 +21430,14 @@ def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21608,10 +21545,11 @@ def begin_migrate_my_sql( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21673,7 +21611,6 @@ def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21687,7 +21624,7 @@ def get_migrate_my_sql_status( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21735,7 +21672,6 @@ def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21751,7 +21687,7 @@ def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21811,7 +21747,6 @@ def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21825,7 +21760,7 @@ def start_web_site_network_trace( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21868,7 +21803,6 @@ def stop_web_site_network_trace(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21882,7 +21816,7 @@ def stop_web_site_network_trace(self, resource_group_name: str, name: str, **kwa map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21927,7 +21861,6 @@ def generate_new_site_publishing_password( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21990,7 +21923,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22006,7 +21938,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22073,7 +22004,6 @@ def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22087,7 +22017,7 @@ def get_site_php_error_log_flag( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22130,7 +22060,6 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22144,7 +22073,7 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22192,7 +22121,6 @@ def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22206,7 +22134,7 @@ def get_premier_add_on( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22336,7 +22264,6 @@ def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22350,7 +22277,7 @@ def add_premier_add_on( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22398,7 +22325,6 @@ def delete_premier_add_on( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22456,7 +22382,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22472,7 +22397,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22542,7 +22466,6 @@ def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22558,7 +22481,7 @@ def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22608,7 +22531,6 @@ def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22666,9 +22588,9 @@ def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22677,12 +22599,16 @@ def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22735,7 +22661,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22751,7 +22676,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22824,7 +22748,6 @@ def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22840,7 +22763,7 @@ def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22891,7 +22814,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22907,7 +22829,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22982,7 +22903,6 @@ def get_process_thread( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22998,7 +22918,7 @@ def get_process_thread( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23046,7 +22966,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23062,7 +22981,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23132,7 +23050,6 @@ def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23146,7 +23063,7 @@ def get_public_certificate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23278,7 +23195,6 @@ def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23292,7 +23208,7 @@ def create_or_update_public_certificate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23340,7 +23256,6 @@ def delete_public_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23475,9 +23390,9 @@ def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23486,23 +23401,27 @@ def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _recover_initial( # pylint: disable=inconsistent-return-statements + def _recover_initial( self, resource_group_name: str, name: str, recovery_entity: Union[_models.SnapshotRecoveryRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23516,7 +23435,7 @@ def _recover_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23537,10 +23456,10 @@ def _recover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23548,11 +23467,19 @@ def _recover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_recover( @@ -23646,7 +23573,7 @@ def begin_recover( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._recover_initial( # type: ignore + raw_result = self._recover_initial( resource_group_name=resource_group_name, name=name, recovery_entity=recovery_entity, @@ -23657,6 +23584,7 @@ def begin_recover( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -23718,7 +23646,6 @@ def reset_production_slot_config( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23787,7 +23714,6 @@ def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23845,7 +23771,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23861,7 +23786,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23931,7 +23855,6 @@ def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23947,7 +23870,7 @@ def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23956,7 +23879,7 @@ def get_site_extension( def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23969,7 +23892,7 @@ def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -23980,10 +23903,10 @@ def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23991,15 +23914,14 @@ def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24044,10 +23966,11 @@ def begin_install_site_extension( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24110,7 +24033,6 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24166,7 +24088,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24182,7 +24103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24251,7 +24171,6 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24267,7 +24186,7 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24285,7 +24204,7 @@ def _create_or_update_slot_initial( force_dns_registration: Optional[bool] = None, ttl_in_seconds: Optional[str] = None, **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24299,7 +24218,7 @@ def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24325,10 +24244,10 @@ def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24336,14 +24255,14 @@ def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24527,10 +24446,11 @@ def begin_create_or_update_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24612,7 +24532,6 @@ def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24819,7 +24738,6 @@ def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24833,11 +24751,7 @@ def update_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24889,7 +24803,6 @@ def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24903,7 +24816,7 @@ def analyze_custom_hostname_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25036,7 +24949,6 @@ def apply_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25181,7 +25093,6 @@ def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25195,7 +25106,7 @@ def backup_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25247,7 +25158,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25263,7 +25173,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25420,7 +25329,6 @@ def discover_restore_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25434,7 +25342,7 @@ def discover_restore_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25486,7 +25394,6 @@ def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25500,7 +25407,7 @@ def get_backup_status_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25552,7 +25459,6 @@ def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25717,7 +25623,6 @@ def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25731,7 +25636,7 @@ def list_backup_status_secrets_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25746,7 +25651,7 @@ def _restore_slot_initial( slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> _models.RestoreResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25760,7 +25665,7 @@ def _restore_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestoreResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25783,10 +25688,10 @@ def _restore_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25794,10 +25699,14 @@ def _restore_slot_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25930,10 +25839,11 @@ def begin_restore_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RestoreResponse", pipeline_response) + deserialized = self._deserialize("RestoreResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26000,7 +25910,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26016,7 +25925,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26171,7 +26079,6 @@ def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26185,7 +26092,7 @@ def update_application_settings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26234,7 +26141,6 @@ def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26248,7 +26154,7 @@ def list_application_settings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26381,7 +26287,6 @@ def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26395,7 +26300,7 @@ def update_auth_settings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26444,7 +26349,6 @@ def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26458,7 +26362,7 @@ def get_auth_settings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26591,7 +26495,6 @@ def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26605,7 +26508,7 @@ def update_backup_configuration_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26654,7 +26557,6 @@ def delete_backup_configuration_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26713,7 +26615,6 @@ def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26727,7 +26628,7 @@ def get_backup_configuration_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26863,7 +26764,6 @@ def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26877,7 +26777,7 @@ def update_connection_strings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26926,7 +26826,6 @@ def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26940,7 +26839,7 @@ def list_connection_strings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26989,7 +26888,6 @@ def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27003,7 +26901,7 @@ def get_diagnostic_logs_configuration_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27139,7 +27037,6 @@ def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27153,7 +27050,7 @@ def update_diagnostic_logs_config_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27286,7 +27183,6 @@ def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27300,7 +27196,7 @@ def update_metadata_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27349,7 +27245,6 @@ def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27363,7 +27258,7 @@ def list_metadata_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27372,7 +27267,7 @@ def list_metadata_slot( def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27385,7 +27280,7 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -27396,10 +27291,10 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27407,10 +27302,14 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27455,10 +27354,11 @@ def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27606,7 +27506,6 @@ def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27620,7 +27519,7 @@ def update_site_push_settings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27669,7 +27568,6 @@ def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27683,7 +27581,7 @@ def list_site_push_settings_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27734,7 +27632,6 @@ def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27748,7 +27645,7 @@ def get_configuration_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27881,7 +27778,6 @@ def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27895,7 +27791,7 @@ def create_or_update_configuration_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28028,7 +27924,6 @@ def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28042,7 +27937,7 @@ def update_configuration_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28098,7 +27993,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28114,7 +28008,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28188,7 +28081,6 @@ def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28202,7 +28094,7 @@ def get_configuration_snapshot_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28254,7 +28146,6 @@ def recover_site_configuration_snapshot_slot( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28313,9 +28204,9 @@ def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28324,12 +28215,16 @@ def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28378,9 +28273,9 @@ def get_web_site_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28389,12 +28284,16 @@ def get_web_site_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28446,7 +28345,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28462,7 +28360,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28536,7 +28433,6 @@ def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28552,7 +28448,7 @@ def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28604,7 +28500,6 @@ def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28666,7 +28561,6 @@ def start_continuous_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28728,7 +28622,6 @@ def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28790,7 +28683,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28806,7 +28698,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28880,7 +28771,6 @@ def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28894,7 +28784,7 @@ def get_deployment_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29037,7 +28927,6 @@ def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29051,7 +28940,7 @@ def create_deployment_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29103,7 +28992,6 @@ def delete_deployment_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29166,7 +29054,6 @@ def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29180,7 +29067,7 @@ def list_deployment_log_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29232,7 +29119,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29248,7 +29134,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29322,7 +29207,6 @@ def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29336,7 +29220,7 @@ def get_domain_ownership_identifier_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29481,7 +29365,6 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29495,7 +29378,7 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29547,7 +29430,6 @@ def delete_domain_ownership_identifier_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29702,7 +29584,6 @@ def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29716,7 +29597,7 @@ def update_domain_ownership_identifier_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29765,7 +29646,6 @@ def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29779,7 +29659,7 @@ def get_ms_deploy_status_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29793,7 +29673,7 @@ def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29807,7 +29687,7 @@ def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29829,10 +29709,10 @@ def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29840,12 +29720,14 @@ def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29968,10 +29850,11 @@ def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30035,7 +29918,6 @@ def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30051,7 +29933,7 @@ def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30103,7 +29985,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30119,7 +30000,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30188,7 +30068,6 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30202,7 +30081,7 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30254,7 +30133,6 @@ def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30270,7 +30148,7 @@ def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30285,7 +30163,7 @@ def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30299,7 +30177,7 @@ def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30322,10 +30200,10 @@ def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30333,10 +30211,14 @@ def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30469,10 +30351,11 @@ def begin_create_instance_function_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30539,7 +30422,6 @@ def delete_instance_function_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30601,7 +30483,6 @@ def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30615,7 +30496,7 @@ def list_function_secrets_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30667,7 +30548,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30683,7 +30563,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30757,7 +30636,6 @@ def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30771,7 +30649,7 @@ def get_host_name_binding_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30916,7 +30794,6 @@ def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30930,7 +30807,7 @@ def create_or_update_host_name_binding_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30982,7 +30859,6 @@ def delete_host_name_binding_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31046,7 +30922,6 @@ def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31060,7 +30935,7 @@ def get_hybrid_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31210,7 +31085,6 @@ def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31224,7 +31098,7 @@ def create_or_update_hybrid_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31278,7 +31152,6 @@ def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31438,7 +31311,6 @@ def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31452,7 +31324,7 @@ def update_hybrid_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31506,7 +31378,6 @@ def list_hybrid_connection_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31520,7 +31391,7 @@ def list_hybrid_connection_keys_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31568,7 +31439,6 @@ def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31582,7 +31452,7 @@ def list_hybrid_connections_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31631,7 +31501,6 @@ def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31645,7 +31514,7 @@ def list_relay_service_connections_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31697,7 +31566,6 @@ def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31711,7 +31579,7 @@ def get_relay_service_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31855,7 +31723,6 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31869,7 +31736,7 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31921,7 +31788,6 @@ def delete_relay_service_connection_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32075,7 +31941,6 @@ def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32089,7 +31954,7 @@ def update_relay_service_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32141,7 +32006,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32157,7 +32021,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32231,7 +32094,6 @@ def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32245,7 +32107,7 @@ def get_instance_ms_deploy_status_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32260,7 +32122,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32274,7 +32136,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32297,10 +32159,10 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32308,12 +32170,14 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32446,10 +32310,11 @@ def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=name-too- params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32516,7 +32381,6 @@ def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32532,7 +32396,7 @@ def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32590,7 +32454,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32606,7 +32469,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32684,7 +32546,6 @@ def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32700,7 +32561,7 @@ def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32758,7 +32619,6 @@ def delete_instance_process_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32824,9 +32684,9 @@ def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -32835,12 +32695,16 @@ def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32901,7 +32765,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32917,7 +32780,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33005,7 +32867,6 @@ def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33021,7 +32882,7 @@ def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33080,7 +32941,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33096,7 +32956,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33186,7 +33045,6 @@ def get_instance_process_thread_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33202,7 +33060,7 @@ def get_instance_process_thread_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33251,7 +33109,6 @@ def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33265,7 +33122,7 @@ def is_cloneable_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33314,7 +33171,6 @@ def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33328,7 +33184,7 @@ def list_sync_function_triggers_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33382,7 +33238,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33398,7 +33253,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33488,7 +33342,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33504,7 +33357,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33576,7 +33428,6 @@ def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33590,7 +33441,7 @@ def get_migrate_my_sql_status_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33642,7 +33493,6 @@ def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33658,7 +33508,7 @@ def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33722,7 +33572,6 @@ def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33736,7 +33585,7 @@ def start_web_site_network_trace_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33782,7 +33631,6 @@ def stop_web_site_network_trace_slot(self, resource_group_name: str, name: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33796,7 +33644,7 @@ def stop_web_site_network_trace_slot(self, resource_group_name: str, name: str, map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33845,7 +33693,6 @@ def generate_new_site_publishing_password_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33912,7 +33759,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33928,7 +33774,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33999,7 +33844,6 @@ def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34013,7 +33857,7 @@ def get_site_php_error_log_flag_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34062,7 +33906,6 @@ def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34076,7 +33919,7 @@ def list_premier_add_ons_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34128,7 +33971,6 @@ def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34142,7 +33984,7 @@ def get_premier_add_on_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34285,7 +34127,6 @@ def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34299,7 +34140,7 @@ def add_premier_add_on_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34351,7 +34192,6 @@ def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34415,7 +34255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34431,7 +34270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34505,7 +34343,6 @@ def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34521,7 +34358,7 @@ def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34575,7 +34412,6 @@ def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34637,9 +34473,9 @@ def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -34648,12 +34484,16 @@ def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34710,7 +34550,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34726,7 +34565,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34803,7 +34641,6 @@ def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34819,7 +34656,7 @@ def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34874,7 +34711,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34890,7 +34726,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34969,7 +34804,6 @@ def get_process_thread_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34985,7 +34819,7 @@ def get_process_thread_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35037,7 +34871,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35053,7 +34886,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35127,7 +34959,6 @@ def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35141,7 +34972,7 @@ def get_public_certificate_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35286,7 +35117,6 @@ def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35300,7 +35130,7 @@ def create_or_update_public_certificate_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35352,7 +35182,6 @@ def delete_public_certificate_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35500,9 +35329,9 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -35511,24 +35340,28 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _recover_slot_initial( # pylint: disable=inconsistent-return-statements + def _recover_slot_initial( self, resource_group_name: str, name: str, slot: str, recovery_entity: Union[_models.SnapshotRecoveryRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35542,7 +35375,7 @@ def _recover_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -35564,10 +35397,10 @@ def _recover_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35575,11 +35408,19 @@ def _recover_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_recover_slot( @@ -35685,7 +35526,7 @@ def begin_recover_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._recover_slot_initial( # type: ignore + raw_result = self._recover_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -35697,6 +35538,7 @@ def begin_recover_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -35762,7 +35604,6 @@ def reset_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35836,7 +35677,6 @@ def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35898,7 +35738,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35914,7 +35753,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35988,7 +35826,6 @@ def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36004,7 +35841,7 @@ def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36013,7 +35850,7 @@ def get_site_extension_slot( def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36026,7 +35863,7 @@ def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -36038,10 +35875,10 @@ def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36049,15 +35886,14 @@ def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36106,10 +35942,11 @@ def begin_install_site_extension_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36176,7 +36013,6 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36321,7 +36157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36337,7 +36172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36366,14 +36200,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36387,7 +36221,7 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -36409,10 +36243,10 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36420,11 +36254,19 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot( @@ -36527,7 +36369,7 @@ def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_initial( # type: ignore + raw_result = self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -36539,6 +36381,7 @@ def begin_swap_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -36604,7 +36447,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36620,7 +36462,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36691,7 +36532,6 @@ def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36705,14 +36545,7 @@ def get_source_control_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36726,7 +36559,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36740,7 +36573,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -36762,10 +36595,10 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36773,17 +36606,14 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36908,10 +36738,11 @@ def begin_create_or_update_source_control_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36975,7 +36806,6 @@ def delete_source_control_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37120,7 +36950,6 @@ def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37134,11 +36963,7 @@ def update_source_control_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37187,7 +37012,6 @@ def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37246,7 +37070,6 @@ def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37305,7 +37128,6 @@ def sync_repository_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37364,7 +37186,6 @@ def sync_function_triggers_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37426,7 +37247,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37442,7 +37262,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37516,7 +37335,6 @@ def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37532,7 +37350,7 @@ def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37584,7 +37402,6 @@ def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37649,7 +37466,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37665,7 +37481,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37742,7 +37557,6 @@ def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37758,7 +37572,7 @@ def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37810,7 +37624,6 @@ def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37878,7 +37691,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37894,7 +37706,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37965,7 +37776,6 @@ def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37979,7 +37789,7 @@ def list_vnet_connections_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38031,7 +37841,6 @@ def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38045,7 +37854,7 @@ def get_vnet_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38196,7 +38005,6 @@ def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38210,7 +38018,7 @@ def create_or_update_vnet_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38262,7 +38070,6 @@ def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38423,7 +38230,6 @@ def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38437,7 +38243,7 @@ def update_vnet_connection_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38493,7 +38299,6 @@ def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38509,7 +38314,7 @@ def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38665,7 +38470,6 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38679,7 +38483,7 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38835,7 +38639,6 @@ def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38849,7 +38652,7 @@ def update_vnet_connection_gateway_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38901,7 +38704,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38917,7 +38719,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38991,7 +38792,6 @@ def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39005,7 +38805,7 @@ def get_web_job_slot( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39127,7 +38927,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39143,7 +38942,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39172,13 +38970,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -39192,7 +38990,7 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -39213,10 +39011,10 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -39224,11 +39022,19 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot_with_production( @@ -39319,7 +39125,7 @@ def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_with_production_initial( # type: ignore + raw_result = self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -39330,6 +39136,7 @@ def begin_swap_slot_with_production( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -39390,7 +39197,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39406,7 +39212,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39471,7 +39276,6 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39485,14 +39289,7 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39505,7 +39302,7 @@ def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -39519,7 +39316,7 @@ def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -39540,10 +39337,10 @@ def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -39551,17 +39348,14 @@ def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39673,10 +39467,11 @@ def begin_create_or_update_source_control( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -39736,7 +39531,6 @@ def delete_source_control( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39868,7 +39662,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39882,11 +39675,7 @@ def update_source_control( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39931,7 +39720,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39986,7 +39774,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40041,7 +39828,6 @@ def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40096,7 +39882,6 @@ def sync_function_triggers( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40154,7 +39939,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40170,7 +39954,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40240,7 +40023,6 @@ def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40256,7 +40038,7 @@ def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40304,7 +40086,6 @@ def delete_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40365,7 +40146,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40381,7 +40161,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40454,7 +40233,6 @@ def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40470,7 +40248,7 @@ def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40518,7 +40296,6 @@ def run_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40582,7 +40359,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40598,7 +40374,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40663,7 +40438,6 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40677,7 +40451,7 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40725,7 +40499,6 @@ def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40739,7 +40512,7 @@ def get_vnet_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40877,7 +40650,6 @@ def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40891,7 +40663,7 @@ def create_or_update_vnet_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40939,7 +40711,6 @@ def delete_vnet_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41087,7 +40858,6 @@ def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41101,7 +40871,7 @@ def update_vnet_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41153,7 +40923,6 @@ def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41169,7 +40938,7 @@ def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41312,7 +41081,6 @@ def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41326,7 +41094,7 @@ def create_or_update_vnet_connection_gateway( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41469,7 +41237,6 @@ def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41483,7 +41250,7 @@ def update_vnet_connection_gateway( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41529,7 +41296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41545,7 +41311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41613,7 +41378,6 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41627,7 +41391,7 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_metadata.json index 55d5b5b931ffd..51435e28ef91f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff1..0000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_web_site_management_client.py index 3d2bc7102c50a..30f10abea1e75 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -112,7 +113,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client.py index 247a0c0f66ef3..19497d59dbef1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -114,7 +115,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_environments_operations.py index bc1bfd06ea203..5d562fa856d1d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_environments_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_environments_operations import ( build_create_or_update_multi_role_pool_request, build_create_or_update_request, @@ -137,7 +151,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -153,7 +166,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -222,7 +234,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -238,7 +249,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -303,7 +313,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -317,7 +326,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -330,7 +339,7 @@ async def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AppServiceEnvironmentResource]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -344,7 +353,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.AppServiceEnvironmentResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -365,10 +374,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -376,15 +385,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -501,10 +509,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -526,9 +535,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -541,7 +550,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -552,10 +561,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -563,11 +572,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204, 400, 404, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -598,7 +615,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -608,6 +625,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -746,7 +764,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -761,11 +778,7 @@ async def update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -814,7 +827,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -830,7 +842,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -895,7 +906,6 @@ async def list_vips(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -909,7 +919,7 @@ async def list_vips(self, resource_group_name: str, name: str, **kwargs: Any) -> map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -954,7 +964,6 @@ async def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -968,7 +977,7 @@ async def list_diagnostics( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1016,7 +1025,6 @@ async def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1030,7 +1038,7 @@ async def get_diagnostics_item( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1075,7 +1083,6 @@ async def list_metric_definitions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1089,7 +1096,7 @@ async def list_metric_definitions( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MetricDefinition", pipeline_response) + deserialized = self._deserialize("MetricDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1153,7 +1160,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1169,7 +1175,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1240,7 +1245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1256,7 +1260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1323,7 +1326,6 @@ async def get_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1337,7 +1339,7 @@ async def get_multi_role_pool( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1350,7 +1352,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkerPoolResource]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1364,7 +1366,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.WorkerPoolResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1385,10 +1387,10 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1396,15 +1398,14 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1518,10 +1519,11 @@ async def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1657,7 +1659,6 @@ async def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1672,11 +1673,7 @@ async def update_multi_role_pool( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1731,7 +1728,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1747,7 +1743,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1825,7 +1820,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1841,7 +1835,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1913,7 +1906,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1929,7 +1921,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2027,7 +2018,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2043,7 +2033,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2113,7 +2102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2129,7 +2117,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2199,7 +2186,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2215,7 +2201,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2280,7 +2265,6 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2294,7 +2278,7 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2339,7 +2323,6 @@ async def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2356,7 +2339,7 @@ async def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2369,7 +2352,7 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -2379,10 +2362,10 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2390,14 +2373,14 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2448,7 +2431,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2464,13 +2446,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2504,6 +2485,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2573,7 +2555,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2589,7 +2570,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2663,7 +2643,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2679,7 +2658,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2708,7 +2686,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2721,7 +2699,7 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -2731,10 +2709,10 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2742,14 +2720,14 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2800,7 +2778,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2816,13 +2793,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2856,6 +2832,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2931,7 +2908,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2947,7 +2923,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3018,7 +2993,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3034,7 +3008,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3104,7 +3077,6 @@ async def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3118,7 +3090,7 @@ async def get_worker_pool( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3132,7 +3104,7 @@ async def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkerPoolResource]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3146,7 +3118,7 @@ async def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.WorkerPoolResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3168,10 +3140,10 @@ async def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3179,15 +3151,14 @@ async def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3310,10 +3281,11 @@ async def begin_create_or_update_worker_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3458,7 +3430,6 @@ async def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3473,11 +3444,7 @@ async def update_worker_pool( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3533,7 +3500,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3549,7 +3515,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3643,7 +3608,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3659,7 +3623,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3734,7 +3697,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3750,7 +3712,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3840,7 +3801,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3856,7 +3816,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3929,7 +3888,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3945,7 +3903,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4018,7 +3975,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4034,7 +3990,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_plans_operations.py index 3f84beb20a264..d8d6a991ac822 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/aio/operations/_app_service_plans_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_plans_operations import ( build_create_or_update_request, build_create_or_update_vnet_route_request, @@ -132,7 +146,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -148,7 +161,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -216,7 +228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -297,7 +307,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -313,7 +322,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -326,7 +335,7 @@ async def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -340,7 +349,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -361,10 +370,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -372,17 +381,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -492,10 +498,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -555,7 +562,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -686,7 +692,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -700,11 +705,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -747,7 +748,6 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -761,7 +761,7 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -812,7 +812,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -826,7 +825,7 @@ async def get_hybrid_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -877,7 +876,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -938,7 +936,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -952,7 +949,7 @@ async def list_hybrid_connection_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1006,7 +1003,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1022,7 +1018,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1089,7 +1084,6 @@ async def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1103,7 +1097,7 @@ async def get_hybrid_connection_plan_limit( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1152,7 +1146,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1168,7 +1161,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1240,7 +1232,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1256,7 +1247,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1342,7 +1332,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1358,7 +1347,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1431,7 +1419,6 @@ async def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1508,7 +1495,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1524,7 +1510,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1589,7 +1574,6 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1603,7 +1587,7 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1657,7 +1641,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1673,7 +1656,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1738,7 +1720,6 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1752,7 +1733,7 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1800,7 +1781,6 @@ async def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1816,7 +1796,7 @@ async def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1867,7 +1847,6 @@ async def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1881,7 +1860,7 @@ async def get_vnet_gateway( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2021,7 +2000,6 @@ async def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2035,7 +2013,7 @@ async def update_vnet_gateway( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2083,7 +2061,6 @@ async def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2097,7 +2074,7 @@ async def list_routes_for_vnet( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2148,7 +2125,6 @@ async def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2164,7 +2140,7 @@ async def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2304,7 +2280,6 @@ async def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2320,7 +2295,7 @@ async def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2371,7 +2346,6 @@ async def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2521,7 +2495,6 @@ async def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2537,7 +2510,7 @@ async def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2585,7 +2558,6 @@ async def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_environments_operations.py index 242db42a6976e..dd9d6da73dc7c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1643,7 +1643,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1659,7 +1658,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1728,7 +1726,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1744,7 +1741,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1809,7 +1805,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1823,7 +1818,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1836,7 +1831,7 @@ def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AppServiceEnvironmentResource]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1850,7 +1845,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.AppServiceEnvironmentResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1871,10 +1866,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1882,15 +1877,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2007,10 +2001,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2032,9 +2027,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2047,7 +2042,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -2058,10 +2053,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2069,11 +2064,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204, 400, 404, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -2104,7 +2107,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -2114,6 +2117,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2252,7 +2256,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2267,11 +2270,7 @@ def update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2317,7 +2316,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2333,7 +2331,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2398,7 +2395,6 @@ def list_vips(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2412,7 +2408,7 @@ def list_vips(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2457,7 +2453,6 @@ def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2471,7 +2466,7 @@ def list_diagnostics( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2519,7 +2514,6 @@ def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2533,7 +2527,7 @@ def get_diagnostics_item( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2576,7 +2570,6 @@ def list_metric_definitions(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2590,7 +2583,7 @@ def list_metric_definitions(self, resource_group_name: str, name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MetricDefinition", pipeline_response) + deserialized = self._deserialize("MetricDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2653,7 +2646,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2669,7 +2661,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2739,7 +2730,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2755,7 +2745,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2820,7 +2809,6 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2834,7 +2822,7 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2847,7 +2835,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkerPoolResource]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2861,7 +2849,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.WorkerPoolResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2882,10 +2870,10 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2893,15 +2881,14 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3012,10 +2999,11 @@ def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3151,7 +3139,6 @@ def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3166,11 +3153,7 @@ def update_multi_role_pool( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3225,7 +3208,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3241,7 +3223,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3318,7 +3299,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3334,7 +3314,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3406,7 +3385,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3422,7 +3400,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3519,7 +3496,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3535,7 +3511,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3605,7 +3580,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3621,7 +3595,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3689,7 +3662,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3705,7 +3677,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3770,7 +3741,6 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3784,7 +3754,7 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3829,7 +3799,6 @@ def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3846,7 +3815,7 @@ def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3859,7 +3828,7 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -3869,10 +3838,10 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3880,14 +3849,14 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3936,7 +3905,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3952,13 +3920,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3992,6 +3959,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -4060,7 +4028,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4076,7 +4043,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4150,7 +4116,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4166,7 +4131,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4195,7 +4159,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4208,7 +4172,7 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -4218,10 +4182,10 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4229,14 +4193,14 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4285,7 +4249,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4301,13 +4264,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4341,6 +4303,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -4415,7 +4378,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4431,7 +4393,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4501,7 +4462,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4517,7 +4477,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4587,7 +4546,6 @@ def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4601,7 +4559,7 @@ def get_worker_pool( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4615,7 +4573,7 @@ def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkerPoolResource]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4629,7 +4587,7 @@ def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.WorkerPoolResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4651,10 +4609,10 @@ def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4662,15 +4620,14 @@ def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4790,10 +4747,11 @@ def begin_create_or_update_worker_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4938,7 +4896,6 @@ def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4953,11 +4910,7 @@ def update_worker_pool( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5013,7 +4966,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5029,7 +4981,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5122,7 +5073,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5138,7 +5088,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5213,7 +5162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5229,7 +5177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5318,7 +5265,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5334,7 +5280,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5407,7 +5352,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5423,7 +5367,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5496,7 +5439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5512,7 +5454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_plans_operations.py index 8083f9d7900af..979fd1aad9a84 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2016_09_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1217,7 +1217,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1233,7 +1232,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1298,7 +1296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1314,7 +1311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1379,7 +1375,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1395,7 +1390,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1408,7 +1403,7 @@ def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1422,7 +1417,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1443,10 +1438,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1454,17 +1449,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1574,10 +1566,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1637,7 +1630,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1768,7 +1760,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1782,11 +1773,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1829,7 +1816,6 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1843,7 +1829,7 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1894,7 +1880,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1908,7 +1893,7 @@ def get_hybrid_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1959,7 +1944,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2020,7 +2004,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2034,7 +2017,7 @@ def list_hybrid_connection_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2088,7 +2071,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2104,7 +2086,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2171,7 +2152,6 @@ def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2185,7 +2165,7 @@ def get_hybrid_connection_plan_limit( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2233,7 +2213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2249,7 +2228,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2321,7 +2299,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2337,7 +2314,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2422,7 +2398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2438,7 +2413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2511,7 +2485,6 @@ def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2588,7 +2561,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2604,7 +2576,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2669,7 +2640,6 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2683,7 +2653,7 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2736,7 +2706,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2752,7 +2721,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2817,7 +2785,6 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2831,7 +2798,7 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2879,7 +2846,6 @@ def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2895,7 +2861,7 @@ def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2946,7 +2912,6 @@ def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2960,7 +2925,7 @@ def get_vnet_gateway( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3100,7 +3065,6 @@ def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3114,7 +3078,7 @@ def update_vnet_gateway( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3162,7 +3126,6 @@ def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3176,7 +3139,7 @@ def list_routes_for_vnet( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3227,7 +3190,6 @@ def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3243,7 +3205,7 @@ def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3383,7 +3345,6 @@ def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3399,7 +3360,7 @@ def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3450,7 +3411,6 @@ def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3600,7 +3560,6 @@ def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3616,7 +3575,7 @@ def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3664,7 +3623,6 @@ def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_metadata.json index 58f0d38f9f883..daf8fbf6ce30e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_vendor.py index fd66631892ed1..abd2e5566a353 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from .._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class WebSiteManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_web_site_management_client.py index 21477247d93db..ed84607f6a831 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -188,7 +189,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_vendor.py index 39f69956b8888..6e80ec49ed289 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client.py index b1d45a97cd9d5..ede8f0b328f7f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -190,7 +191,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_certificate_orders_operations.py index ed1896d397699..00f2bfd4678c7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_certificate_orders_operations import ( build_create_or_update_certificate_request, build_create_or_update_request, @@ -119,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -254,7 +266,6 @@ async def validate_purchase_information( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -311,7 +322,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -327,7 +337,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -395,7 +404,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -410,7 +418,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -423,7 +431,7 @@ async def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -437,7 +445,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -458,10 +466,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -469,15 +477,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -594,10 +602,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -657,7 +666,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -791,7 +799,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -806,11 +813,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -860,7 +863,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -876,7 +878,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -947,7 +948,6 @@ async def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -962,7 +962,7 @@ async def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -976,7 +976,7 @@ async def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -990,7 +990,7 @@ async def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1012,10 +1012,10 @@ async def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1023,15 +1023,15 @@ async def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1155,10 +1155,11 @@ async def begin_create_or_update_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1221,7 +1222,6 @@ async def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1363,7 +1363,6 @@ async def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1378,11 +1377,7 @@ async def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1504,7 +1499,6 @@ async def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1636,7 +1630,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1684,6 @@ async def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1821,7 +1813,6 @@ async def resend_request_emails( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1951,7 +1942,6 @@ async def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1966,7 +1956,7 @@ async def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2011,7 +2001,6 @@ async def verify_domain_ownership( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2066,7 +2055,6 @@ async def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2081,7 +2069,7 @@ async def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2126,7 +2114,6 @@ async def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2141,7 +2128,7 @@ async def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_environments_operations.py index a3f78b135582b..40471ccca1fc6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_environments_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_environments_operations import ( build_change_vnet_request, build_create_or_update_multi_role_pool_request, @@ -141,7 +155,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -157,7 +170,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -227,7 +239,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -243,7 +254,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -309,7 +319,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -324,7 +333,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +346,7 @@ async def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AppServiceEnvironmentResource]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -351,7 +360,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.AppServiceEnvironmentResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -372,10 +381,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -383,15 +392,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -508,10 +516,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -533,9 +542,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -548,7 +557,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -559,10 +568,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -570,11 +579,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204, 400, 404, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -605,7 +622,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -615,6 +632,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -753,7 +771,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -768,11 +785,7 @@ async def update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -821,7 +834,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -837,7 +849,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -903,7 +914,6 @@ async def list_vips(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -918,7 +928,7 @@ async def list_vips(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -931,7 +941,7 @@ async def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -945,7 +955,7 @@ async def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -966,10 +976,10 @@ async def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -977,15 +987,15 @@ async def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1114,7 +1124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1130,13 +1139,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1173,6 +1181,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -1238,7 +1247,6 @@ async def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1253,7 +1261,7 @@ async def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1301,7 +1309,6 @@ async def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1316,7 +1323,7 @@ async def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1366,7 +1373,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1382,7 +1388,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1450,7 +1455,6 @@ async def list_metric_definitions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1465,7 +1469,7 @@ async def list_metric_definitions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MetricDefinition", pipeline_response) + deserialized = self._deserialize("MetricDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1529,7 +1533,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1545,7 +1548,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1617,7 +1619,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1633,7 +1634,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1701,7 +1701,6 @@ async def get_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1716,7 +1715,7 @@ async def get_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1729,7 +1728,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkerPoolResource]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1743,7 +1742,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.WorkerPoolResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1764,10 +1763,10 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1775,15 +1774,14 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1897,10 +1895,11 @@ async def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2036,7 +2035,6 @@ async def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2051,11 +2049,7 @@ async def update_multi_role_pool( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2110,7 +2104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2126,7 +2119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2205,7 +2197,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2221,7 +2212,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2294,7 +2284,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2310,7 +2299,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2409,7 +2397,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2425,7 +2412,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2496,7 +2482,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2512,7 +2497,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2583,7 +2567,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2599,7 +2582,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2665,7 +2647,6 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2680,7 +2661,7 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2730,7 +2711,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2746,7 +2726,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2814,7 +2793,6 @@ async def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2831,7 +2809,7 @@ async def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2844,7 +2822,7 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -2854,10 +2832,10 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2865,15 +2843,15 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2924,7 +2902,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2940,13 +2917,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2981,6 +2957,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3050,7 +3027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3066,7 +3042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3141,7 +3116,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3157,7 +3131,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3187,7 +3160,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3200,7 +3173,7 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -3210,10 +3183,10 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3221,15 +3194,15 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3280,7 +3253,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3296,13 +3268,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3337,6 +3308,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3412,7 +3384,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3428,7 +3399,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3500,7 +3470,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3516,7 +3485,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3587,7 +3555,6 @@ async def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3602,7 +3569,7 @@ async def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3616,7 +3583,7 @@ async def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkerPoolResource]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3630,7 +3597,7 @@ async def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.WorkerPoolResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3652,10 +3619,10 @@ async def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3663,15 +3630,14 @@ async def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3794,10 +3760,11 @@ async def begin_create_or_update_worker_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3942,7 +3909,6 @@ async def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3957,11 +3923,7 @@ async def update_worker_pool( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4017,7 +3979,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4033,7 +3994,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4128,7 +4088,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4144,7 +4103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4220,7 +4178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4236,7 +4193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4327,7 +4283,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4343,7 +4298,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4417,7 +4371,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4433,7 +4386,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4507,7 +4459,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4523,7 +4474,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_plans_operations.py index 28d65aaf38945..59544e32d577c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_app_service_plans_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_plans_operations import ( build_create_or_update_request, build_create_or_update_vnet_route_request, @@ -133,7 +147,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -149,7 +162,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -218,7 +230,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -234,7 +245,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -300,7 +310,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -316,7 +325,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +338,7 @@ async def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -343,7 +352,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -364,10 +373,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -375,18 +384,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -496,10 +502,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -559,7 +566,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -690,7 +696,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -705,11 +710,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -752,7 +753,6 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -767,7 +767,7 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -818,7 +818,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -833,7 +832,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -884,7 +883,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -945,7 +943,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -960,7 +957,7 @@ async def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1014,7 +1011,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1030,7 +1026,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1098,7 +1093,6 @@ async def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1113,7 +1107,7 @@ async def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1162,7 +1156,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1178,7 +1171,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1251,7 +1243,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1267,7 +1258,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1354,7 +1344,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1370,7 +1359,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1444,7 +1432,6 @@ async def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1521,7 +1508,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1537,7 +1523,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1603,7 +1588,6 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1618,7 +1602,7 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1672,7 +1656,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1688,7 +1671,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1754,7 +1736,6 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1769,7 +1750,7 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1817,7 +1798,6 @@ async def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1833,7 +1813,7 @@ async def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1884,7 +1864,6 @@ async def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1899,7 +1878,7 @@ async def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2039,7 +2018,6 @@ async def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2054,7 +2032,7 @@ async def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2102,7 +2080,6 @@ async def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2117,7 +2094,7 @@ async def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2168,7 +2145,6 @@ async def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2184,7 +2160,7 @@ async def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2324,7 +2300,6 @@ async def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2340,7 +2315,7 @@ async def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2391,7 +2366,6 @@ async def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2541,7 +2515,6 @@ async def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2557,7 +2530,7 @@ async def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2605,7 +2578,6 @@ async def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificate_registration_provider_operations.py index 8463a3c0b69a2..bb2c07acda47f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificate_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificates_operations.py index 5457ad096dbcc..08d8d4fad3664 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -101,7 +99,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -183,7 +179,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -199,7 +194,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -265,7 +259,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +273,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +393,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -415,7 +407,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -591,7 +582,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -606,7 +596,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_deleted_web_apps_operations.py index d6d033a259053..143a99518bc1f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_deleted_web_apps_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_web_apps_operations import ( build_get_deleted_web_app_by_location_request, build_list_by_location_request, @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -179,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +257,6 @@ async def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +271,7 @@ async def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_diagnostics_operations.py index e5f2f45688787..f61d20016dd89 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._diagnostics_operations import ( build_execute_site_analysis_request, build_execute_site_analysis_slot_request, @@ -126,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +225,6 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +239,7 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,7 +288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -309,7 +303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +389,6 @@ async def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +403,7 @@ async def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -476,7 +467,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -547,7 +537,6 @@ async def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -562,7 +551,7 @@ async def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -630,7 +618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -704,7 +691,6 @@ async def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,7 +705,7 @@ async def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +773,6 @@ async def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +787,7 @@ async def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -854,7 +839,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -870,7 +854,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -948,7 +931,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -964,7 +946,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1055,7 +1036,6 @@ async def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1070,7 +1050,7 @@ async def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1122,7 +1102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1138,7 +1117,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1229,7 +1207,6 @@ async def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1244,7 +1221,7 @@ async def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1296,7 +1273,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1312,7 +1288,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1386,7 +1361,6 @@ async def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1401,7 +1375,7 @@ async def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1456,7 +1430,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1472,7 +1445,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1555,7 +1527,6 @@ async def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1570,7 +1541,7 @@ async def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1642,7 +1613,6 @@ async def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1657,7 +1627,7 @@ async def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1712,7 +1682,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1728,7 +1697,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1815,7 +1783,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1831,7 +1798,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1926,7 +1892,6 @@ async def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1941,7 +1906,7 @@ async def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domain_registration_provider_operations.py index bd995297903b8..1a944e9c3465d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domain_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domains_operations.py index d89b5f94fe251..933ef9539ac02 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_check_availability_request, build_create_or_update_ownership_identifier_request, @@ -162,7 +162,6 @@ async def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -177,7 +176,7 @@ async def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailablilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailablilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -217,7 +216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -233,7 +231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +290,6 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -308,7 +304,7 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -408,7 +404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -424,7 +419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -490,7 +484,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -506,7 +499,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -572,7 +564,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -587,7 +578,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -596,7 +587,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -610,7 +601,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,10 +622,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -642,15 +633,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,10 +747,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -824,7 +816,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -954,7 +945,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -969,11 +959,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1023,7 +1009,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1039,7 +1024,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1110,7 +1094,6 @@ async def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1125,7 +1108,7 @@ async def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1264,7 +1247,6 @@ async def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1279,7 +1261,7 @@ async def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1327,7 +1309,6 @@ async def delete_ownership_identifier( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1476,7 +1457,6 @@ async def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1491,7 +1471,7 @@ async def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1536,7 +1516,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_provider_operations.py index 756d36b9fbc12..d557c77ccb8f1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._provider_operations import ( build_get_available_stacks_on_prem_request, build_get_available_stacks_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -184,7 +180,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -200,7 +195,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -270,7 +264,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -286,7 +279,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_recommendations_operations.py index 2ef38c930a21a..afab6d0e27a45 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_recommendations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommendations_operations import ( build_disable_all_for_hosting_environment_request, build_disable_all_for_web_app_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -198,7 +194,6 @@ async def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -250,7 +245,6 @@ async def disable_recommendation_for_subscription( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -324,7 +318,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -340,7 +333,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -426,7 +418,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -442,7 +433,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -513,7 +503,6 @@ async def disable_all_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -571,7 +560,6 @@ async def reset_all_filters_for_hosting_environment( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -643,7 +631,6 @@ async def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -658,7 +645,7 @@ async def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -709,7 +696,6 @@ async def disable_recommendation_for_hosting_environment( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -783,7 +769,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -799,7 +784,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -885,7 +869,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -901,7 +884,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -969,7 +951,6 @@ async def disable_all_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1024,7 +1005,6 @@ async def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1096,7 +1076,6 @@ async def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1111,7 +1090,7 @@ async def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1159,7 +1138,6 @@ async def disable_recommendation_for_site( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_resource_health_metadata_operations.py index 6715f56359c52..47ddf9a24c0d3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_resource_health_metadata_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._resource_health_metadata_operations import ( build_get_by_site_request, build_get_by_site_slot_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -277,7 +271,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -293,7 +286,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -359,7 +351,6 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +365,7 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -428,7 +419,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +434,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -516,7 +505,6 @@ async def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -531,7 +519,7 @@ async def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_top_level_domains_operations.py index babf7c4a408c9..cd2d16f3c2cf4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_level_domains_operations import ( build_get_request, build_list_agreements_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -178,7 +174,6 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_apps_operations.py index 478531238b619..a16d35c7414e9 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_apps_operations.py @@ -32,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -45,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_apps_operations import ( build_add_premier_add_on_request, build_add_premier_add_on_slot_request, @@ -476,7 +476,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -492,7 +491,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -565,7 +563,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -581,7 +578,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -647,7 +643,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -663,7 +658,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -672,7 +667,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio async def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -686,7 +681,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -707,10 +702,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -718,15 +713,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -838,10 +833,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -913,7 +909,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1052,7 +1047,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1067,11 +1061,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1119,7 +1109,6 @@ async def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1134,7 +1123,7 @@ async def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1254,7 +1243,6 @@ async def apply_slot_config_to_production( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1382,7 +1370,6 @@ async def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1397,7 +1384,7 @@ async def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1443,7 +1430,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1459,7 +1445,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1530,7 +1515,6 @@ async def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1545,7 +1529,7 @@ async def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1593,7 +1577,6 @@ async def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1745,7 +1728,6 @@ async def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1760,21 +1742,21 @@ async def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_initial( # pylint: disable=inconsistent-return-statements + async def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1788,7 +1770,7 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1810,10 +1792,10 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1821,11 +1803,19 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore( @@ -1925,7 +1915,7 @@ async def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_initial( # type: ignore + raw_result = await self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -1937,6 +1927,7 @@ async def begin_restore( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2000,7 +1991,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2016,7 +2006,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2159,7 +2148,6 @@ async def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2174,7 +2162,7 @@ async def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2219,7 +2207,6 @@ async def list_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2234,7 +2221,7 @@ async def list_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2354,7 +2341,6 @@ async def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2369,7 +2355,7 @@ async def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2412,7 +2398,6 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2427,7 +2412,7 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2549,7 +2534,6 @@ async def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2564,7 +2548,7 @@ async def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2609,7 +2593,6 @@ async def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2624,7 +2607,7 @@ async def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2740,7 +2723,6 @@ async def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2755,7 +2737,7 @@ async def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2800,7 +2782,6 @@ async def delete_backup_configuration( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2855,7 +2836,6 @@ async def get_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2870,7 +2850,7 @@ async def get_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2993,7 +2973,6 @@ async def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3008,7 +2987,7 @@ async def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3053,7 +3032,6 @@ async def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3068,7 +3046,7 @@ async def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3113,7 +3091,6 @@ async def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3128,7 +3105,7 @@ async def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3251,7 +3228,6 @@ async def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3266,7 +3242,7 @@ async def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3382,7 +3358,6 @@ async def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3397,7 +3372,7 @@ async def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3440,7 +3415,6 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3455,7 +3429,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3464,7 +3438,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any async def _list_publishing_credentials_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3477,7 +3451,7 @@ async def _list_publishing_credentials_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -3487,10 +3461,10 @@ async def _list_publishing_credentials_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3498,11 +3472,15 @@ async def _list_publishing_credentials_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3543,10 +3521,11 @@ async def begin_list_publishing_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3677,7 +3656,6 @@ async def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3692,7 +3670,7 @@ async def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3735,7 +3713,6 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3750,7 +3727,7 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3795,7 +3772,6 @@ async def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3810,7 +3786,7 @@ async def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3939,7 +3915,6 @@ async def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3954,7 +3929,7 @@ async def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3999,7 +3974,6 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4014,7 +3988,7 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4134,7 +4108,6 @@ async def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4149,7 +4122,7 @@ async def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4269,7 +4242,6 @@ async def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4284,7 +4256,7 @@ async def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4336,7 +4308,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4352,7 +4323,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4423,7 +4393,6 @@ async def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4438,7 +4407,7 @@ async def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4486,7 +4455,6 @@ async def recover_site_configuration_snapshot( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4541,9 +4509,9 @@ async def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4552,12 +4520,16 @@ async def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4602,9 +4574,9 @@ async def get_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4613,12 +4585,16 @@ async def get_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4667,7 +4643,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4683,7 +4658,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4754,7 +4728,6 @@ async def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4770,7 +4743,7 @@ async def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4818,7 +4791,6 @@ async def delete_continuous_web_job( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4876,7 +4848,6 @@ async def start_continuous_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4934,7 +4905,6 @@ async def stop_continuous_web_job( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4992,7 +4962,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5008,7 +4977,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5077,7 +5045,6 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5092,7 +5059,7 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5222,7 +5189,6 @@ async def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5237,7 +5203,7 @@ async def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5285,7 +5251,6 @@ async def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5344,7 +5309,6 @@ async def list_deployment_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5359,7 +5323,7 @@ async def list_deployment_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5483,7 +5447,6 @@ async def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5498,7 +5461,7 @@ async def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5546,7 +5509,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5562,7 +5524,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5633,7 +5594,6 @@ async def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5648,7 +5608,7 @@ async def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5780,7 +5740,6 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5795,7 +5754,7 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5843,7 +5802,6 @@ async def delete_domain_ownership_identifier( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5985,7 +5943,6 @@ async def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6000,7 +5957,7 @@ async def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6043,7 +6000,6 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6058,7 +6014,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6067,7 +6023,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar async def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6081,7 +6037,7 @@ async def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6102,10 +6058,10 @@ async def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6113,12 +6069,14 @@ async def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6224,10 +6182,11 @@ async def begin_create_ms_deploy_operation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6287,7 +6246,6 @@ async def get_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6303,7 +6261,7 @@ async def get_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6352,7 +6310,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6368,7 +6325,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6433,7 +6389,6 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6448,7 +6403,7 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6496,7 +6451,6 @@ async def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6512,7 +6466,7 @@ async def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6526,7 +6480,7 @@ async def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6540,7 +6494,7 @@ async def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6562,10 +6516,10 @@ async def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6573,11 +6527,15 @@ async def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6697,10 +6655,11 @@ async def begin_create_function( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6763,7 +6722,6 @@ async def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6913,7 +6871,6 @@ async def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6928,11 +6885,7 @@ async def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6983,7 +6936,6 @@ async def delete_function_secret( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7041,7 +6993,6 @@ async def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7056,7 +7007,7 @@ async def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7104,7 +7055,6 @@ async def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7119,7 +7069,7 @@ async def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7162,7 +7112,6 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7177,7 +7126,7 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7222,7 +7171,6 @@ async def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7278,7 +7226,6 @@ async def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7428,7 +7375,6 @@ async def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7443,11 +7389,7 @@ async def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7498,7 +7440,6 @@ async def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7558,7 +7499,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7574,7 +7514,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7645,7 +7584,6 @@ async def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7660,7 +7598,7 @@ async def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7792,7 +7730,6 @@ async def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7807,7 +7744,7 @@ async def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7855,7 +7792,6 @@ async def delete_host_name_binding( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7916,7 +7852,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7931,7 +7866,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8071,7 +8006,6 @@ async def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8086,7 +8020,7 @@ async def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8137,7 +8071,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8287,7 +8220,6 @@ async def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8302,7 +8234,7 @@ async def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8353,7 +8285,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8368,7 +8299,7 @@ async def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8413,7 +8344,6 @@ async def list_hybrid_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8428,7 +8358,7 @@ async def list_hybrid_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8473,7 +8403,6 @@ async def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8488,7 +8417,7 @@ async def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8536,7 +8465,6 @@ async def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8551,7 +8479,7 @@ async def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8682,7 +8610,6 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8697,7 +8624,7 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8745,7 +8672,6 @@ async def delete_relay_service_connection( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8886,7 +8812,6 @@ async def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8901,7 +8826,7 @@ async def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8950,7 +8875,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8966,7 +8890,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9037,7 +8960,6 @@ async def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9052,7 +8974,7 @@ async def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9066,7 +8988,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9080,7 +9002,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -9102,10 +9024,10 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9113,12 +9035,14 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9238,10 +9162,11 @@ async def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9304,7 +9229,6 @@ async def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9320,7 +9244,7 @@ async def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9374,7 +9298,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9390,7 +9313,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9464,7 +9386,6 @@ async def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9480,7 +9401,7 @@ async def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9534,7 +9455,6 @@ async def delete_instance_process( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9596,9 +9516,9 @@ async def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9607,12 +9527,16 @@ async def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9670,7 +9594,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9686,7 +9609,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9763,7 +9685,6 @@ async def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9779,7 +9700,7 @@ async def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9835,7 +9756,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9851,7 +9771,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9930,7 +9849,6 @@ async def get_instance_process_thread( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9946,7 +9864,7 @@ async def get_instance_process_thread( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9989,7 +9907,6 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10004,7 +9921,7 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10049,7 +9966,6 @@ async def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10064,7 +9980,7 @@ async def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10114,7 +10030,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10130,7 +10045,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10217,7 +10131,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10233,7 +10146,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10270,7 +10182,7 @@ async def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10284,7 +10196,7 @@ async def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10306,10 +10218,10 @@ async def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10317,11 +10229,15 @@ async def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10445,10 +10361,11 @@ async def begin_migrate_storage( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10476,7 +10393,7 @@ async def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10490,7 +10407,7 @@ async def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10511,10 +10428,10 @@ async def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10522,11 +10439,15 @@ async def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10637,10 +10558,11 @@ async def begin_migrate_my_sql( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10702,7 +10624,6 @@ async def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10717,7 +10638,7 @@ async def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10762,7 +10683,6 @@ async def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10777,7 +10697,7 @@ async def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10917,7 +10837,6 @@ async def create_or_update_swift_virtual_network_connection( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10932,7 +10851,7 @@ async def create_or_update_swift_virtual_network_connection( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10977,7 +10896,6 @@ async def delete_swift_virtual_network( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11127,7 +11045,6 @@ async def update_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11142,7 +11059,7 @@ async def update_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11190,7 +11107,6 @@ async def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11206,7 +11122,7 @@ async def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11254,7 +11170,6 @@ async def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11269,11 +11184,7 @@ async def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11333,7 +11244,6 @@ async def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11348,7 +11258,7 @@ async def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11363,7 +11273,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11376,7 +11286,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -11389,10 +11299,10 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11400,15 +11310,15 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11466,10 +11376,11 @@ async def begin_start_web_site_network_trace_operation( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11529,7 +11440,6 @@ async def stop_web_site_network_trace( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11587,7 +11497,6 @@ async def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11602,7 +11511,7 @@ async def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11650,7 +11559,6 @@ async def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11665,11 +11573,7 @@ async def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11717,7 +11621,6 @@ async def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11732,7 +11635,7 @@ async def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11777,7 +11680,6 @@ async def generate_new_site_publishing_password( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11841,7 +11743,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11857,7 +11758,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11925,7 +11825,6 @@ async def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11940,7 +11839,7 @@ async def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11983,7 +11882,6 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11998,7 +11896,7 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12046,7 +11944,6 @@ async def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12061,7 +11958,7 @@ async def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12191,7 +12088,6 @@ async def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12206,7 +12102,7 @@ async def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12254,7 +12150,6 @@ async def delete_premier_add_on( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12394,7 +12289,6 @@ async def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12409,7 +12303,7 @@ async def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12454,7 +12348,6 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12469,7 +12362,7 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12591,7 +12484,6 @@ async def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12606,7 +12498,7 @@ async def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12656,7 +12548,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -12672,7 +12563,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -12742,7 +12632,6 @@ async def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12758,7 +12647,7 @@ async def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12808,7 +12697,6 @@ async def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12866,9 +12754,9 @@ async def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12877,12 +12765,16 @@ async def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12936,7 +12828,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -12952,7 +12843,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13025,7 +12915,6 @@ async def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13041,7 +12930,7 @@ async def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13093,7 +12982,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13109,7 +12997,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13184,7 +13071,6 @@ async def get_process_thread( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13200,7 +13086,7 @@ async def get_process_thread( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13249,7 +13135,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13265,7 +13150,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13336,7 +13220,6 @@ async def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13351,7 +13234,7 @@ async def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13483,7 +13366,6 @@ async def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13498,7 +13380,7 @@ async def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13546,7 +13428,6 @@ async def delete_public_certificate( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13681,9 +13562,9 @@ async def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13692,11 +13573,15 @@ async def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13743,7 +13628,6 @@ async def reset_production_slot_config( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13812,7 +13696,6 @@ async def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13829,9 +13712,9 @@ async def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13845,7 +13728,7 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -13866,10 +13749,10 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13877,11 +13760,19 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob( @@ -13968,7 +13859,7 @@ async def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -13979,6 +13870,7 @@ async def begin_restore_from_backup_blob( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -14000,13 +13892,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14020,7 +13912,7 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14041,10 +13933,10 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14052,11 +13944,19 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app( @@ -14147,7 +14047,7 @@ async def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -14158,6 +14058,7 @@ async def begin_restore_from_deleted_app( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -14179,13 +14080,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14199,7 +14100,7 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14220,10 +14121,10 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14231,11 +14132,19 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot( @@ -14329,7 +14238,7 @@ async def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_initial( # type: ignore + raw_result = await self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -14340,6 +14249,7 @@ async def begin_restore_snapshot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -14403,7 +14313,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14419,7 +14328,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14489,7 +14397,6 @@ async def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14505,7 +14412,7 @@ async def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14514,7 +14421,7 @@ async def get_site_extension( async def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14527,7 +14434,7 @@ async def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -14538,10 +14445,10 @@ async def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14549,15 +14456,14 @@ async def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14603,10 +14509,11 @@ async def begin_install_site_extension( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14669,7 +14576,6 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14725,7 +14631,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14741,7 +14646,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14811,7 +14715,6 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14827,7 +14730,7 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14841,7 +14744,7 @@ async def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14855,7 +14758,7 @@ async def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14877,10 +14780,10 @@ async def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14888,15 +14791,15 @@ async def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15025,10 +14928,11 @@ async def begin_create_or_update_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15106,7 +15010,6 @@ async def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15258,7 +15161,6 @@ async def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15273,11 +15175,7 @@ async def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15329,7 +15227,6 @@ async def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15344,7 +15241,7 @@ async def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15477,7 +15374,6 @@ async def apply_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15622,7 +15518,6 @@ async def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15637,7 +15532,7 @@ async def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15689,7 +15584,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15705,7 +15599,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15780,7 +15673,6 @@ async def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15795,7 +15687,7 @@ async def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15847,7 +15739,6 @@ async def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16012,7 +15903,6 @@ async def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16027,14 +15917,14 @@ async def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -16042,7 +15932,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16056,7 +15946,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16079,10 +15969,10 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16090,11 +15980,19 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_slot( @@ -16206,7 +16104,7 @@ async def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_slot_initial( # type: ignore + raw_result = await self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -16219,6 +16117,7 @@ async def begin_restore_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16286,7 +16185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16302,7 +16200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16458,7 +16355,6 @@ async def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16473,7 +16369,7 @@ async def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16522,7 +16418,6 @@ async def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16537,7 +16432,7 @@ async def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16670,7 +16565,6 @@ async def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16685,7 +16579,7 @@ async def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16734,7 +16628,6 @@ async def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16749,7 +16642,7 @@ async def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16884,7 +16777,6 @@ async def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16899,7 +16791,7 @@ async def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16948,7 +16840,6 @@ async def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16963,7 +16854,7 @@ async def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17096,7 +16987,6 @@ async def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17111,7 +17001,7 @@ async def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17160,7 +17050,6 @@ async def delete_backup_configuration_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17219,7 +17108,6 @@ async def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17234,7 +17122,7 @@ async def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17370,7 +17258,6 @@ async def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17385,7 +17272,7 @@ async def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17434,7 +17321,6 @@ async def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17449,7 +17335,7 @@ async def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17498,7 +17384,6 @@ async def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17513,7 +17398,7 @@ async def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17649,7 +17534,6 @@ async def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17664,7 +17548,7 @@ async def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17797,7 +17681,6 @@ async def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17812,7 +17695,7 @@ async def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17861,7 +17744,6 @@ async def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17876,7 +17758,7 @@ async def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17885,7 +17767,7 @@ async def list_metadata_slot( async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17898,7 +17780,7 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -17909,10 +17791,10 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17920,11 +17802,15 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17969,10 +17855,11 @@ async def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -18120,7 +18007,6 @@ async def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18135,7 +18021,7 @@ async def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18184,7 +18070,6 @@ async def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18199,7 +18084,7 @@ async def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18250,7 +18135,6 @@ async def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18265,7 +18149,7 @@ async def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18398,7 +18282,6 @@ async def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18413,7 +18296,7 @@ async def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18546,7 +18429,6 @@ async def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18561,7 +18443,7 @@ async def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18617,7 +18499,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18633,7 +18514,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18708,7 +18588,6 @@ async def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18723,7 +18602,7 @@ async def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18775,7 +18654,6 @@ async def recover_site_configuration_snapshot_slot( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18834,9 +18712,9 @@ async def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18845,12 +18723,16 @@ async def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18899,9 +18781,9 @@ async def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18910,12 +18792,16 @@ async def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18968,7 +18854,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18984,7 +18869,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19059,7 +18943,6 @@ async def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19075,7 +18958,7 @@ async def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19127,7 +19010,6 @@ async def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19189,7 +19071,6 @@ async def start_continuous_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19251,7 +19132,6 @@ async def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19313,7 +19193,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19329,7 +19208,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19404,7 +19282,6 @@ async def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19419,7 +19296,7 @@ async def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19562,7 +19439,6 @@ async def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19577,7 +19453,7 @@ async def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19629,7 +19505,6 @@ async def delete_deployment_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19692,7 +19567,6 @@ async def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19707,7 +19581,7 @@ async def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19848,7 +19722,6 @@ async def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19863,7 +19736,7 @@ async def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19915,7 +19788,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19931,7 +19803,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20006,7 +19877,6 @@ async def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20021,7 +19891,7 @@ async def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20166,7 +20036,6 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20181,7 +20050,7 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20233,7 +20102,6 @@ async def delete_domain_ownership_identifier_slot( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20388,7 +20256,6 @@ async def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20403,7 +20270,7 @@ async def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20452,7 +20319,6 @@ async def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20467,7 +20333,7 @@ async def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20481,7 +20347,7 @@ async def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20495,7 +20361,7 @@ async def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -20517,10 +20383,10 @@ async def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20528,12 +20394,14 @@ async def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20656,10 +20524,11 @@ async def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20723,7 +20592,6 @@ async def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20739,7 +20607,7 @@ async def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20791,7 +20659,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20807,7 +20674,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20878,7 +20744,6 @@ async def get_functions_admin_token_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20893,7 +20758,7 @@ async def get_functions_admin_token_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20944,7 +20809,6 @@ async def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20960,7 +20824,7 @@ async def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20975,7 +20839,7 @@ async def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20989,7 +20853,7 @@ async def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21012,10 +20876,10 @@ async def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21023,11 +20887,15 @@ async def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21157,10 +21025,11 @@ async def begin_create_instance_function_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21226,7 +21095,6 @@ async def delete_instance_function_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21386,7 +21254,6 @@ async def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21401,11 +21268,7 @@ async def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21459,7 +21322,6 @@ async def delete_function_secret_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21520,7 +21382,6 @@ async def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21535,7 +21396,7 @@ async def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21586,7 +21447,6 @@ async def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21601,7 +21461,7 @@ async def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21649,7 +21509,6 @@ async def list_host_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21664,7 +21523,7 @@ async def list_host_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21712,7 +21571,6 @@ async def list_sync_status_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21771,7 +21629,6 @@ async def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21932,7 +21789,6 @@ async def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21947,11 +21803,7 @@ async def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22005,7 +21857,6 @@ async def delete_host_secret_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22069,7 +21920,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22085,7 +21935,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22160,7 +22009,6 @@ async def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22175,7 +22023,7 @@ async def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22320,7 +22168,6 @@ async def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22335,7 +22182,7 @@ async def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22387,7 +22234,6 @@ async def delete_host_name_binding_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22451,7 +22297,6 @@ async def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22466,7 +22311,7 @@ async def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22616,7 +22461,6 @@ async def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22631,7 +22475,7 @@ async def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22685,7 +22529,6 @@ async def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22845,7 +22688,6 @@ async def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22860,7 +22702,7 @@ async def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22914,7 +22756,6 @@ async def list_hybrid_connection_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22929,7 +22770,7 @@ async def list_hybrid_connection_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22977,7 +22818,6 @@ async def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22992,7 +22832,7 @@ async def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23041,7 +22881,6 @@ async def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23056,7 +22895,7 @@ async def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23108,7 +22947,6 @@ async def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23123,7 +22961,7 @@ async def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23267,7 +23105,6 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23282,7 +23119,7 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23334,7 +23171,6 @@ async def delete_relay_service_connection_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23488,7 +23324,6 @@ async def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23503,7 +23338,7 @@ async def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23556,7 +23391,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23572,7 +23406,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23647,7 +23480,6 @@ async def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23662,7 +23494,7 @@ async def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23677,7 +23509,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23691,7 +23523,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23714,10 +23546,10 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23725,12 +23557,14 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23863,10 +23697,11 @@ async def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=nam params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23933,7 +23768,6 @@ async def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23949,7 +23783,7 @@ async def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24007,7 +23841,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24023,7 +23856,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24101,7 +23933,6 @@ async def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24117,7 +23948,7 @@ async def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24175,7 +24006,6 @@ async def delete_instance_process_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24241,9 +24071,9 @@ async def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24252,12 +24082,16 @@ async def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24319,7 +24153,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24335,7 +24168,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24423,7 +24255,6 @@ async def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24439,7 +24270,7 @@ async def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24499,7 +24330,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24515,7 +24345,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24605,7 +24434,6 @@ async def get_instance_process_thread_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24621,7 +24449,7 @@ async def get_instance_process_thread_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24670,7 +24498,6 @@ async def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24685,7 +24512,7 @@ async def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24733,7 +24560,6 @@ async def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24748,7 +24574,7 @@ async def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24802,7 +24628,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24818,7 +24643,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24910,7 +24734,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24926,7 +24749,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24999,7 +24821,6 @@ async def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25014,7 +24835,7 @@ async def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25063,7 +24884,6 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25078,7 +24898,7 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25231,7 +25051,6 @@ async def create_or_update_swift_virtual_network_connection_slot( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25246,7 +25065,7 @@ async def create_or_update_swift_virtual_network_connection_slot( # pylint: dis error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25295,7 +25114,6 @@ async def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25458,7 +25276,6 @@ async def update_swift_virtual_network_connection_slot( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25473,7 +25290,7 @@ async def update_swift_virtual_network_connection_slot( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25525,7 +25342,6 @@ async def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25541,7 +25357,7 @@ async def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25593,7 +25409,6 @@ async def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25608,11 +25423,7 @@ async def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25676,7 +25487,6 @@ async def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25691,7 +25501,7 @@ async def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25707,7 +25517,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25720,7 +25530,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -25734,10 +25544,10 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25745,15 +25555,15 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25815,10 +25625,11 @@ async def begin_start_web_site_network_trace_operation_slot( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25881,7 +25692,6 @@ async def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25943,7 +25753,6 @@ async def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25958,7 +25767,7 @@ async def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26010,7 +25819,6 @@ async def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26025,11 +25833,7 @@ async def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26081,7 +25885,6 @@ async def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26096,7 +25899,7 @@ async def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26145,7 +25948,6 @@ async def generate_new_site_publishing_password_slot( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26213,7 +26015,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26229,7 +26030,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26301,7 +26101,6 @@ async def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26316,7 +26115,7 @@ async def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26365,7 +26164,6 @@ async def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26380,7 +26178,7 @@ async def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26432,7 +26230,6 @@ async def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26447,7 +26244,7 @@ async def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26590,7 +26387,6 @@ async def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26605,7 +26401,7 @@ async def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26657,7 +26453,6 @@ async def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26810,7 +26605,6 @@ async def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26825,7 +26619,7 @@ async def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26875,7 +26669,6 @@ async def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26890,7 +26683,7 @@ async def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27026,7 +26819,6 @@ async def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27041,7 +26833,7 @@ async def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27095,7 +26887,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27111,7 +26902,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27185,7 +26975,6 @@ async def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27201,7 +26990,7 @@ async def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27255,7 +27044,6 @@ async def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27317,9 +27105,9 @@ async def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27328,12 +27116,16 @@ async def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27391,7 +27183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27407,7 +27198,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27484,7 +27274,6 @@ async def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27500,7 +27289,7 @@ async def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27556,7 +27345,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27572,7 +27360,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27651,7 +27438,6 @@ async def get_process_thread_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27667,7 +27453,7 @@ async def get_process_thread_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27720,7 +27506,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27736,7 +27521,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27811,7 +27595,6 @@ async def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27826,7 +27609,7 @@ async def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27971,7 +27754,6 @@ async def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27986,7 +27768,7 @@ async def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28038,7 +27820,6 @@ async def delete_public_certificate_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28186,9 +27967,9 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28197,11 +27978,15 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28252,7 +28037,6 @@ async def reset_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28326,7 +28110,6 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28343,14 +28126,14 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28364,7 +28147,7 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28386,10 +28169,10 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28397,11 +28180,19 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob_slot( @@ -28504,7 +28295,7 @@ async def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -28516,6 +28307,7 @@ async def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -28537,14 +28329,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28558,7 +28350,7 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28580,10 +28372,10 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28591,11 +28383,19 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app_slot( @@ -28698,7 +28498,7 @@ async def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -28710,6 +28510,7 @@ async def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -28731,14 +28532,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28752,7 +28553,7 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28774,10 +28575,10 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28785,11 +28586,19 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot_slot( @@ -28895,7 +28704,7 @@ async def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_slot_initial( # type: ignore + raw_result = await self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -28907,6 +28716,7 @@ async def begin_restore_snapshot_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -28974,7 +28784,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28990,7 +28799,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29064,7 +28872,6 @@ async def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29080,7 +28887,7 @@ async def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29089,7 +28896,7 @@ async def get_site_extension_slot( async def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29102,7 +28909,7 @@ async def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -29114,10 +28921,10 @@ async def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29125,15 +28932,14 @@ async def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29183,10 +28989,11 @@ async def begin_install_site_extension_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29253,7 +29060,6 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29401,7 +29207,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29417,7 +29222,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29447,14 +29251,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29468,7 +29272,7 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29490,10 +29294,10 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29501,11 +29305,19 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot( @@ -29608,7 +29420,7 @@ async def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_initial( # type: ignore + raw_result = await self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -29620,6 +29432,7 @@ async def begin_swap_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29685,7 +29498,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29701,7 +29513,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29775,7 +29586,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29791,7 +29601,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29863,7 +29672,6 @@ async def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29878,14 +29686,7 @@ async def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29899,7 +29700,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29913,7 +29714,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29935,10 +29736,10 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29946,18 +29747,15 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30085,10 +29883,11 @@ async def begin_create_or_update_source_control_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30152,7 +29951,6 @@ async def delete_source_control_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30297,7 +30095,6 @@ async def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30312,14 +30109,7 @@ async def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30368,7 +30158,6 @@ async def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30394,7 +30183,7 @@ async def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30407,7 +30196,7 @@ async def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -30421,10 +30210,10 @@ async def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30432,15 +30221,15 @@ async def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30502,10 +30291,11 @@ async def begin_start_network_trace_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30569,7 +30359,6 @@ async def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30627,7 +30416,6 @@ async def stop_network_trace_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30686,7 +30474,6 @@ async def sync_repository_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30744,7 +30531,6 @@ async def sync_function_triggers_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30807,7 +30593,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30823,7 +30608,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30898,7 +30682,6 @@ async def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30914,7 +30697,7 @@ async def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30966,7 +30749,6 @@ async def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31032,7 +30814,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31048,7 +30829,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31125,7 +30905,6 @@ async def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31141,7 +30920,7 @@ async def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31193,7 +30972,6 @@ async def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31262,7 +31040,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31278,7 +31055,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31350,7 +31126,6 @@ async def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31365,7 +31140,7 @@ async def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31417,7 +31192,6 @@ async def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31432,7 +31206,7 @@ async def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31583,7 +31357,6 @@ async def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31598,7 +31371,7 @@ async def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31650,7 +31423,6 @@ async def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31811,7 +31583,6 @@ async def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31826,7 +31597,7 @@ async def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31882,7 +31653,6 @@ async def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31898,7 +31668,7 @@ async def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32054,7 +31824,6 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32069,7 +31838,7 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32225,7 +31994,6 @@ async def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32240,7 +32008,7 @@ async def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32292,7 +32060,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32308,7 +32075,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32383,7 +32149,6 @@ async def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32398,7 +32163,7 @@ async def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32523,7 +32288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32539,7 +32303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32569,13 +32332,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32589,7 +32352,7 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32610,10 +32373,10 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32621,11 +32384,19 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot_with_production( @@ -32716,7 +32487,7 @@ async def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_with_production_initial( # type: ignore + raw_result = await self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -32727,6 +32498,7 @@ async def begin_swap_slot_with_production( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32787,7 +32559,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32803,7 +32574,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32874,7 +32644,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32890,7 +32659,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32956,7 +32724,6 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32971,14 +32738,7 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32991,7 +32751,7 @@ async def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33005,7 +32765,7 @@ async def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33026,10 +32786,10 @@ async def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33037,18 +32797,15 @@ async def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33163,10 +32920,11 @@ async def begin_create_or_update_source_control( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33226,7 +32984,6 @@ async def delete_source_control( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33358,7 +33115,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33373,14 +33129,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33425,7 +33174,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33450,7 +33198,7 @@ async def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33463,7 +33211,7 @@ async def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -33476,10 +33224,10 @@ async def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33487,15 +33235,15 @@ async def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33553,10 +33301,11 @@ async def begin_start_network_trace( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33616,7 +33365,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33671,7 +33419,6 @@ async def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33726,7 +33473,6 @@ async def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33781,7 +33527,6 @@ async def sync_function_triggers( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33840,7 +33585,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33856,7 +33600,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33927,7 +33670,6 @@ async def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33943,7 +33685,7 @@ async def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33991,7 +33733,6 @@ async def delete_triggered_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34053,7 +33794,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34069,7 +33809,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34142,7 +33881,6 @@ async def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34158,7 +33896,7 @@ async def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34206,7 +33944,6 @@ async def run_triggered_web_job( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34271,7 +34008,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34287,7 +34023,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34353,7 +34088,6 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34368,7 +34102,7 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34416,7 +34150,6 @@ async def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34431,7 +34164,7 @@ async def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34569,7 +34302,6 @@ async def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34584,7 +34316,7 @@ async def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34632,7 +34364,6 @@ async def delete_vnet_connection( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34780,7 +34511,6 @@ async def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34795,7 +34525,7 @@ async def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34847,7 +34577,6 @@ async def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34863,7 +34592,7 @@ async def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35006,7 +34735,6 @@ async def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35021,7 +34749,7 @@ async def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35164,7 +34892,6 @@ async def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35179,7 +34906,7 @@ async def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35225,7 +34952,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35241,7 +34967,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35312,7 +35037,6 @@ async def get_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35327,7 +35051,7 @@ async def get_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_site_management_client_operations.py index 01b81ec17c49b..e36a3a318f863 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/aio/operations/_web_site_management_client_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_site_management_client_operations import ( build_check_name_availability_request, build_get_publishing_user_request, @@ -98,7 +96,6 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +110,7 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -202,7 +199,6 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -217,7 +213,7 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -259,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -275,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -339,7 +333,6 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +347,7 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -462,7 +455,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -477,7 +469,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -528,7 +520,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -544,7 +535,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -622,7 +612,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -637,7 +626,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -677,7 +666,6 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -692,7 +680,7 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -758,7 +746,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -774,7 +761,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -894,7 +880,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -910,7 +895,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -976,7 +960,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -992,7 +975,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1054,7 +1036,6 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1069,7 +1050,7 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1168,7 +1149,6 @@ async def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1183,7 +1163,7 @@ async def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1296,7 +1276,6 @@ async def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1415,7 +1394,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1430,7 +1408,7 @@ async def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1544,7 +1522,6 @@ async def validate_container_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1559,7 +1536,7 @@ async def validate_container_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1672,7 +1649,6 @@ async def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_certificate_orders_operations.py index d13e56b3f6b89..f7545689b1b94 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -830,7 +831,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -846,7 +846,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -965,7 +964,6 @@ def validate_purchase_information( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1022,7 +1020,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1038,7 +1035,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1106,7 +1102,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1121,7 +1116,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1134,7 +1129,7 @@ def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1148,7 +1143,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1169,10 +1164,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1180,15 +1175,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1305,10 +1300,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1368,7 +1364,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1502,7 +1497,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1517,11 +1511,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1571,7 +1561,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1587,7 +1576,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1658,7 +1646,6 @@ def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1673,7 +1660,7 @@ def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1687,7 +1674,7 @@ def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1701,7 +1688,7 @@ def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1723,10 +1710,10 @@ def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1734,15 +1721,15 @@ def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1866,10 +1853,11 @@ def begin_create_or_update_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1932,7 +1920,6 @@ def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2074,7 +2061,6 @@ def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2089,11 +2075,7 @@ def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2215,7 +2197,6 @@ def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2347,7 +2328,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2402,7 +2382,6 @@ def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2532,7 +2511,6 @@ def resend_request_emails( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2662,7 +2640,6 @@ def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2677,7 +2654,7 @@ def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2722,7 +2699,6 @@ def verify_domain_ownership( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2777,7 +2753,6 @@ def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2792,7 +2767,7 @@ def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2837,7 +2812,6 @@ def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2852,7 +2826,7 @@ def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_environments_operations.py index faf4f4fd79631..d64eda7171b4b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1758,7 +1759,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1774,7 +1774,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1844,7 +1843,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1860,7 +1858,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1926,7 +1923,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1941,7 +1937,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1954,7 +1950,7 @@ def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AppServiceEnvironmentResource]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1968,7 +1964,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.AppServiceEnvironmentResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1989,10 +1985,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2000,15 +1996,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2125,10 +2120,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2150,9 +2146,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2165,7 +2161,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -2176,10 +2172,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2187,11 +2183,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204, 400, 404, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -2222,7 +2226,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -2232,6 +2236,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2370,7 +2375,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2385,11 +2389,7 @@ def update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2435,7 +2435,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2451,7 +2450,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2517,7 +2515,6 @@ def list_vips(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2532,7 +2529,7 @@ def list_vips(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2545,7 +2542,7 @@ def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2559,7 +2556,7 @@ def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2580,10 +2577,10 @@ def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2591,15 +2588,15 @@ def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2728,7 +2725,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2744,13 +2740,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2787,6 +2782,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2852,7 +2848,6 @@ def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2867,7 +2862,7 @@ def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2915,7 +2910,6 @@ def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2930,7 +2924,7 @@ def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2980,7 +2974,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2996,7 +2989,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3062,7 +3054,6 @@ def list_metric_definitions(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3077,7 +3068,7 @@ def list_metric_definitions(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MetricDefinition", pipeline_response) + deserialized = self._deserialize("MetricDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3140,7 +3131,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3156,7 +3146,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3227,7 +3216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3243,7 +3231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3309,7 +3296,6 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3324,7 +3310,7 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3337,7 +3323,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkerPoolResource]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3351,7 +3337,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.WorkerPoolResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3372,10 +3358,10 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3383,15 +3369,14 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3502,10 +3487,11 @@ def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3641,7 +3627,6 @@ def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3656,11 +3641,7 @@ def update_multi_role_pool( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3715,7 +3696,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3731,7 +3711,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3809,7 +3788,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3825,7 +3803,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3898,7 +3875,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3914,7 +3890,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4012,7 +3987,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4028,7 +4002,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4099,7 +4072,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4115,7 +4087,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4184,7 +4155,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4200,7 +4170,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4266,7 +4235,6 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4281,7 +4249,7 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4331,7 +4299,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4347,7 +4314,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4415,7 +4381,6 @@ def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4432,7 +4397,7 @@ def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4445,7 +4410,7 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -4455,10 +4420,10 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4466,15 +4431,15 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4523,7 +4488,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4539,13 +4503,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4580,6 +4543,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -4648,7 +4612,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4664,7 +4627,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4739,7 +4701,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4755,7 +4716,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4785,7 +4745,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4798,7 +4758,7 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -4808,10 +4768,10 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4819,15 +4779,15 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4876,7 +4836,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4892,13 +4851,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4933,6 +4891,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5007,7 +4966,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5023,7 +4981,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5094,7 +5051,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5110,7 +5066,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5181,7 +5136,6 @@ def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5196,7 +5150,7 @@ def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5210,7 +5164,7 @@ def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.WorkerPoolResource]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5224,7 +5178,7 @@ def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.WorkerPoolResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5246,10 +5200,10 @@ def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5257,15 +5211,14 @@ def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 400, 404, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5385,10 +5338,11 @@ def begin_create_or_update_worker_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5533,7 +5487,6 @@ def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5548,11 +5501,7 @@ def update_worker_pool( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5608,7 +5557,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5624,7 +5572,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5718,7 +5665,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5734,7 +5680,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5810,7 +5755,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5826,7 +5770,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5916,7 +5859,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5932,7 +5874,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6006,7 +5947,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6022,7 +5962,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6096,7 +6035,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6112,7 +6050,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_plans_operations.py index b04f9380fa5f6..2f22779a90d27 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1217,7 +1218,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1233,7 +1233,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1299,7 +1298,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1315,7 +1313,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1381,7 +1378,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1397,7 +1393,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1410,7 +1406,7 @@ def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1424,7 +1420,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1445,10 +1441,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1456,18 +1452,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1577,10 +1570,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1640,7 +1634,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1771,7 +1764,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1786,11 +1778,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1833,7 +1821,6 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1848,7 +1835,7 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1899,7 +1886,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1914,7 +1900,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1965,7 +1951,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2026,7 +2011,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2041,7 +2025,7 @@ def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2095,7 +2079,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2111,7 +2094,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2179,7 +2161,6 @@ def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2194,7 +2175,7 @@ def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2242,7 +2223,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2258,7 +2238,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2331,7 +2310,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2347,7 +2325,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2433,7 +2410,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2449,7 +2425,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2523,7 +2498,6 @@ def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2600,7 +2574,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2616,7 +2589,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2682,7 +2654,6 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2697,7 +2668,7 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2750,7 +2721,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2766,7 +2736,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2832,7 +2801,6 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2847,7 +2815,7 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2895,7 +2863,6 @@ def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2911,7 +2878,7 @@ def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2962,7 +2929,6 @@ def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2977,7 +2943,7 @@ def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3117,7 +3083,6 @@ def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3132,7 +3097,7 @@ def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3180,7 +3145,6 @@ def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3195,7 +3159,7 @@ def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3246,7 +3210,6 @@ def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3262,7 +3225,7 @@ def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3402,7 +3365,6 @@ def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3418,7 +3380,7 @@ def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3469,7 +3431,6 @@ def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3619,7 +3580,6 @@ def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3635,7 +3595,7 @@ def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3683,7 +3643,6 @@ def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificate_registration_provider_operations.py index 0749e617a7fdc..9fc2d197e62c6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificate_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py index 5c17a34adb1b9..0aef837ef9a94 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -300,7 +299,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -316,7 +314,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -382,7 +379,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -398,7 +394,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -464,7 +459,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -479,7 +473,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -599,7 +593,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -614,7 +607,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -659,7 +652,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -790,7 +782,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -805,7 +796,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_deleted_web_apps_operations.py index a51c6198e8325..ef0fa0bcfbfb3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_deleted_web_apps_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -176,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -192,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -342,7 +337,6 @@ def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +351,7 @@ def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_diagnostics_operations.py index 0946cfdfed873..58c9d372c2afb 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1101,7 +1100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1117,7 +1115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1204,7 +1201,6 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1219,7 +1215,7 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1267,7 +1263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1283,7 +1278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1370,7 +1364,6 @@ def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1385,7 +1378,7 @@ def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1433,7 +1426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1449,7 +1441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1520,7 +1511,6 @@ def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1535,7 +1525,7 @@ def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1602,7 +1591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1676,7 +1664,6 @@ def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1678,7 @@ def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1759,7 +1746,6 @@ def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,7 +1760,7 @@ def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1825,7 +1811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1841,7 +1826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1918,7 +1902,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1934,7 +1917,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2025,7 +2007,6 @@ def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2040,7 +2021,7 @@ def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2091,7 +2072,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2107,7 +2087,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2198,7 +2177,6 @@ def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2213,7 +2191,7 @@ def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2264,7 +2242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2280,7 +2257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2354,7 +2330,6 @@ def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2369,7 +2344,7 @@ def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2423,7 +2398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2439,7 +2413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2522,7 +2495,6 @@ def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2537,7 +2509,7 @@ def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2609,7 +2581,6 @@ def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2624,7 +2595,7 @@ def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2678,7 +2649,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2694,7 +2664,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2780,7 +2749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2796,7 +2764,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2891,7 +2858,6 @@ def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2906,7 +2872,7 @@ def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domain_registration_provider_operations.py index 87d7e7b03cb40..9e0dd1215d4a7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domain_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domains_operations.py index 3f4e87c0df5d2..e563d1c167d5d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -676,7 +677,6 @@ def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -691,7 +691,7 @@ def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailablilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailablilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -731,7 +731,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -747,7 +746,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -807,7 +805,6 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -822,7 +819,7 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -919,7 +916,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -935,7 +931,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1001,7 +996,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1017,7 +1011,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1083,7 +1076,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1098,7 +1090,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1107,7 +1099,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1121,7 +1113,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1142,10 +1134,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1153,15 +1145,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1264,10 +1256,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1332,7 +1325,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1462,7 +1454,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1477,11 +1468,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1531,7 +1518,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1547,7 +1533,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1618,7 +1603,6 @@ def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1633,7 +1617,7 @@ def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1772,7 +1756,6 @@ def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1787,7 +1770,7 @@ def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1835,7 +1818,6 @@ def delete_ownership_identifier( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1984,7 +1966,6 @@ def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1999,7 +1980,7 @@ def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2044,7 +2025,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_provider_operations.py index c2ac9ee88bba6..2a9f1604bb300 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -169,7 +168,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -185,7 +183,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -251,7 +248,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -267,7 +263,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -336,7 +331,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -352,7 +346,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_recommendations_operations.py index 7b22a1a79736f..aeb64dcb3db2a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_recommendations_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -682,7 +681,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -698,7 +696,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -758,7 +755,6 @@ def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -810,7 +806,6 @@ def disable_recommendation_for_subscription( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -883,7 +878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -899,7 +893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -984,7 +977,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1000,7 +992,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1071,7 +1062,6 @@ def disable_all_for_hosting_environment( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1129,7 +1119,6 @@ def reset_all_filters_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1201,7 +1190,6 @@ def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1216,7 +1204,7 @@ def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1267,7 +1255,6 @@ def disable_recommendation_for_hosting_environment( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1340,7 +1327,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1356,7 +1342,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1441,7 +1426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1457,7 +1441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1525,7 +1508,6 @@ def disable_all_for_web_app( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1580,7 +1562,6 @@ def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1652,7 +1633,6 @@ def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1667,7 +1647,7 @@ def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1715,7 +1695,6 @@ def disable_recommendation_for_site( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_resource_health_metadata_operations.py index d2a28a85a146c..61b727e203313 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_resource_health_metadata_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -389,7 +386,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -405,7 +401,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -477,7 +472,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -493,7 +487,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -559,7 +552,6 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +566,7 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -627,7 +619,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -643,7 +634,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -715,7 +705,6 @@ def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -730,7 +719,7 @@ def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_top_level_domains_operations.py index 05681ad03d13d..b4ef5899d8e3c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_top_level_domains_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_apps_operations.py index ca2baa8d7da3a..48475b7d44bf6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_apps_operations.py @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -14519,7 +14520,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14535,7 +14535,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14608,7 +14607,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14624,7 +14622,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14690,7 +14687,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14706,7 +14702,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14715,7 +14711,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14729,7 +14725,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14750,10 +14746,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14761,15 +14757,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14881,10 +14877,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14956,7 +14953,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15095,7 +15091,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15110,11 +15105,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15162,7 +15153,6 @@ def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15177,7 +15167,7 @@ def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15297,7 +15287,6 @@ def apply_slot_config_to_production( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15425,7 +15414,6 @@ def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15440,7 +15428,7 @@ def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15486,7 +15474,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15502,7 +15489,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15573,7 +15559,6 @@ def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15588,7 +15573,7 @@ def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15636,7 +15621,6 @@ def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15788,7 +15772,6 @@ def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15803,21 +15786,21 @@ def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_initial( # pylint: disable=inconsistent-return-statements + def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15831,7 +15814,7 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15853,10 +15836,10 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15864,11 +15847,19 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore( @@ -15968,7 +15959,7 @@ def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_initial( # type: ignore + raw_result = self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -15980,6 +15971,7 @@ def begin_restore( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16042,7 +16034,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16058,7 +16049,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16201,7 +16191,6 @@ def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16216,7 +16205,7 @@ def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16259,7 +16248,6 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16274,7 +16262,7 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16394,7 +16382,6 @@ def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16409,7 +16396,7 @@ def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16452,7 +16439,6 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16467,7 +16453,7 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16589,7 +16575,6 @@ def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16604,7 +16589,7 @@ def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16649,7 +16634,6 @@ def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16664,7 +16648,7 @@ def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16780,7 +16764,6 @@ def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16795,7 +16778,7 @@ def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16840,7 +16823,6 @@ def delete_backup_configuration( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16893,7 +16875,6 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16908,7 +16889,7 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17031,7 +17012,6 @@ def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17046,7 +17026,7 @@ def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17091,7 +17071,6 @@ def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17106,7 +17085,7 @@ def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17151,7 +17130,6 @@ def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17166,7 +17144,7 @@ def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17289,7 +17267,6 @@ def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17304,7 +17281,7 @@ def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17420,7 +17397,6 @@ def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17435,7 +17411,7 @@ def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17478,7 +17454,6 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17493,14 +17468,16 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _list_publishing_credentials_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.User: + def _list_publishing_credentials_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17513,7 +17490,7 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -17523,10 +17500,10 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17534,11 +17511,15 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17579,10 +17560,11 @@ def begin_list_publishing_credentials( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -17713,7 +17695,6 @@ def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17728,7 +17709,7 @@ def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17771,7 +17752,6 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17786,7 +17766,7 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17831,7 +17811,6 @@ def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17846,7 +17825,7 @@ def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17975,7 +17954,6 @@ def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17990,7 +17968,7 @@ def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18035,7 +18013,6 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18050,7 +18027,7 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18170,7 +18147,6 @@ def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18185,7 +18161,7 @@ def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18305,7 +18281,6 @@ def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18320,7 +18295,7 @@ def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18372,7 +18347,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18388,7 +18362,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18459,7 +18432,6 @@ def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18474,7 +18446,7 @@ def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18522,7 +18494,6 @@ def recover_site_configuration_snapshot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18577,9 +18548,9 @@ def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18588,12 +18559,16 @@ def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18636,9 +18611,9 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18647,12 +18622,16 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18700,7 +18679,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18716,7 +18694,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18787,7 +18764,6 @@ def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18803,7 +18779,7 @@ def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18851,7 +18827,6 @@ def delete_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18909,7 +18884,6 @@ def start_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18967,7 +18941,6 @@ def stop_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19023,7 +18996,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19039,7 +19011,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19108,7 +19079,6 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19123,7 +19093,7 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19253,7 +19223,6 @@ def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19268,7 +19237,7 @@ def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19316,7 +19285,6 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19373,7 +19341,6 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19388,7 +19355,7 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19512,7 +19479,6 @@ def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19527,7 +19493,7 @@ def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19575,7 +19541,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19591,7 +19556,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19662,7 +19626,6 @@ def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19677,7 +19640,7 @@ def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19809,7 +19772,6 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19824,7 +19786,7 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19872,7 +19834,6 @@ def delete_domain_ownership_identifier( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20014,7 +19975,6 @@ def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20029,7 +19989,7 @@ def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20072,7 +20032,6 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20087,7 +20046,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20096,7 +20055,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20110,7 +20069,7 @@ def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -20131,10 +20090,10 @@ def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20142,12 +20101,14 @@ def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20253,10 +20214,11 @@ def begin_create_ms_deploy_operation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20314,7 +20276,6 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20330,7 +20291,7 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20378,7 +20339,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20394,7 +20354,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20459,7 +20418,6 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20474,7 +20432,7 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20522,7 +20480,6 @@ def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20538,7 +20495,7 @@ def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20552,7 +20509,7 @@ def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20566,7 +20523,7 @@ def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -20588,10 +20545,10 @@ def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20599,11 +20556,15 @@ def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20723,10 +20684,11 @@ def begin_create_function( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20789,7 +20751,6 @@ def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20939,7 +20900,6 @@ def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20954,11 +20914,7 @@ def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21009,7 +20965,6 @@ def delete_function_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21067,7 +21022,6 @@ def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21082,7 +21036,7 @@ def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21130,7 +21084,6 @@ def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21145,7 +21098,7 @@ def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21188,7 +21141,6 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21203,7 +21155,7 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21248,7 +21200,6 @@ def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21304,7 +21255,6 @@ def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21454,7 +21404,6 @@ def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21469,11 +21418,7 @@ def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21524,7 +21469,6 @@ def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21583,7 +21527,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21599,7 +21542,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21670,7 +21612,6 @@ def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21685,7 +21626,7 @@ def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21817,7 +21758,6 @@ def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21832,7 +21772,7 @@ def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21880,7 +21820,6 @@ def delete_host_name_binding( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21941,7 +21880,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21956,7 +21894,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22096,7 +22034,6 @@ def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22111,7 +22048,7 @@ def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22162,7 +22099,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22312,7 +22248,6 @@ def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22327,7 +22262,7 @@ def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22378,7 +22313,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22393,7 +22327,7 @@ def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22436,7 +22370,6 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22451,7 +22384,7 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22496,7 +22429,6 @@ def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22511,7 +22443,7 @@ def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22559,7 +22491,6 @@ def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22574,7 +22505,7 @@ def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22705,7 +22636,6 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22720,7 +22650,7 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22768,7 +22698,6 @@ def delete_relay_service_connection( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22909,7 +22838,6 @@ def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22924,7 +22852,7 @@ def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22972,7 +22900,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22988,7 +22915,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23059,7 +22985,6 @@ def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23074,7 +22999,7 @@ def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23088,7 +23013,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23102,7 +23027,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23124,10 +23049,10 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23135,12 +23060,14 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23260,10 +23187,11 @@ def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23326,7 +23254,6 @@ def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23342,7 +23269,7 @@ def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23396,7 +23323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23412,7 +23338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23486,7 +23411,6 @@ def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23502,7 +23426,7 @@ def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23556,7 +23480,6 @@ def delete_instance_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23618,9 +23541,9 @@ def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23629,12 +23552,16 @@ def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23691,7 +23618,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23707,7 +23633,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23784,7 +23709,6 @@ def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23800,7 +23724,7 @@ def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23855,7 +23779,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23871,7 +23794,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23950,7 +23872,6 @@ def get_instance_process_thread( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23966,7 +23887,7 @@ def get_instance_process_thread( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24009,7 +23930,6 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24024,7 +23944,7 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24069,7 +23989,6 @@ def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24084,7 +24003,7 @@ def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24134,7 +24053,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24150,7 +24068,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24236,7 +24153,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24252,7 +24168,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24289,7 +24204,7 @@ def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24303,7 +24218,7 @@ def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24325,10 +24240,10 @@ def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24336,11 +24251,15 @@ def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24464,10 +24383,11 @@ def begin_migrate_storage( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24495,7 +24415,7 @@ def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24509,7 +24429,7 @@ def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24530,10 +24450,10 @@ def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24541,11 +24461,15 @@ def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24653,10 +24577,11 @@ def begin_migrate_my_sql( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24718,7 +24643,6 @@ def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24733,7 +24657,7 @@ def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24778,7 +24702,6 @@ def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24793,7 +24716,7 @@ def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24933,7 +24856,6 @@ def create_or_update_swift_virtual_network_connection( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24948,7 +24870,7 @@ def create_or_update_swift_virtual_network_connection( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24993,7 +24915,6 @@ def delete_swift_virtual_network( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25143,7 +25064,6 @@ def update_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25158,7 +25078,7 @@ def update_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25206,7 +25126,6 @@ def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25222,7 +25141,7 @@ def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25270,7 +25189,6 @@ def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25285,11 +25203,7 @@ def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25349,7 +25263,6 @@ def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25364,7 +25277,7 @@ def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25379,7 +25292,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25392,7 +25305,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -25405,10 +25318,10 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25416,15 +25329,15 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25481,10 +25394,11 @@ def begin_start_web_site_network_trace_operation( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25544,7 +25458,6 @@ def stop_web_site_network_trace( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25602,7 +25515,6 @@ def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25617,7 +25529,7 @@ def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25665,7 +25577,6 @@ def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25680,11 +25591,7 @@ def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25732,7 +25639,6 @@ def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25747,7 +25653,7 @@ def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25792,7 +25698,6 @@ def generate_new_site_publishing_password( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25855,7 +25760,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25871,7 +25775,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25939,7 +25842,6 @@ def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25954,7 +25856,7 @@ def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25997,7 +25899,6 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26012,7 +25913,7 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26060,7 +25961,6 @@ def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26075,7 +25975,7 @@ def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26205,7 +26105,6 @@ def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26220,7 +26119,7 @@ def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26268,7 +26167,6 @@ def delete_premier_add_on( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26408,7 +26306,6 @@ def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26423,7 +26320,7 @@ def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26468,7 +26365,6 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26483,7 +26379,7 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26605,7 +26501,6 @@ def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26620,7 +26515,7 @@ def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26668,7 +26563,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26684,7 +26578,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26754,7 +26647,6 @@ def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26770,7 +26662,7 @@ def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26820,7 +26712,6 @@ def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26878,9 +26769,9 @@ def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26889,12 +26780,16 @@ def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26947,7 +26842,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26963,7 +26857,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27036,7 +26929,6 @@ def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27052,7 +26944,7 @@ def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27103,7 +26995,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27119,7 +27010,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27194,7 +27084,6 @@ def get_process_thread( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27210,7 +27099,7 @@ def get_process_thread( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27258,7 +27147,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27274,7 +27162,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27345,7 +27232,6 @@ def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27360,7 +27246,7 @@ def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27492,7 +27378,6 @@ def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27507,7 +27392,7 @@ def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27555,7 +27440,6 @@ def delete_public_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27690,9 +27574,9 @@ def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27701,11 +27585,15 @@ def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27752,7 +27640,6 @@ def reset_production_slot_config( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27821,7 +27708,6 @@ def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27838,9 +27724,9 @@ def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27854,7 +27740,7 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -27875,10 +27761,10 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27886,11 +27772,19 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob( @@ -27977,7 +27871,7 @@ def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_initial( # type: ignore + raw_result = self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -27988,6 +27882,7 @@ def begin_restore_from_backup_blob( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -28009,13 +27904,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28029,7 +27924,7 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28050,10 +27945,10 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28061,11 +27956,19 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app( @@ -28156,7 +28059,7 @@ def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_initial( # type: ignore + raw_result = self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -28167,6 +28070,7 @@ def begin_restore_from_deleted_app( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -28188,13 +28092,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28208,7 +28112,7 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28229,10 +28133,10 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28240,11 +28144,19 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot( @@ -28338,7 +28250,7 @@ def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_initial( # type: ignore + raw_result = self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -28349,6 +28261,7 @@ def begin_restore_snapshot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -28411,7 +28324,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28427,7 +28339,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28497,7 +28408,6 @@ def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28513,7 +28423,7 @@ def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28522,7 +28432,7 @@ def get_site_extension( def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28535,7 +28445,7 @@ def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -28546,10 +28456,10 @@ def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28557,15 +28467,14 @@ def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28610,10 +28519,11 @@ def begin_install_site_extension( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28676,7 +28586,6 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28732,7 +28641,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28748,7 +28656,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28818,7 +28725,6 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28834,7 +28740,7 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28848,7 +28754,7 @@ def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28862,7 +28768,7 @@ def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28884,10 +28790,10 @@ def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28895,15 +28801,15 @@ def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29032,10 +28938,11 @@ def begin_create_or_update_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29113,7 +29020,6 @@ def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29265,7 +29171,6 @@ def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29280,11 +29185,7 @@ def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29336,7 +29237,6 @@ def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29351,7 +29251,7 @@ def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29484,7 +29384,6 @@ def apply_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29629,7 +29528,6 @@ def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29644,7 +29542,7 @@ def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29696,7 +29594,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29712,7 +29609,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29787,7 +29683,6 @@ def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29802,7 +29697,7 @@ def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29854,7 +29749,6 @@ def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30019,7 +29913,6 @@ def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30034,14 +29927,14 @@ def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -30049,7 +29942,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30063,7 +29956,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30086,10 +29979,10 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30097,11 +29990,19 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_slot( @@ -30213,7 +30114,7 @@ def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_slot_initial( # type: ignore + raw_result = self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -30226,6 +30127,7 @@ def begin_restore_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30292,7 +30194,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30308,7 +30209,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30464,7 +30364,6 @@ def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30479,7 +30378,7 @@ def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30528,7 +30427,6 @@ def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30543,7 +30441,7 @@ def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30676,7 +30574,6 @@ def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30691,7 +30588,7 @@ def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30740,7 +30637,6 @@ def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30755,7 +30651,7 @@ def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30890,7 +30786,6 @@ def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30905,7 +30800,7 @@ def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30954,7 +30849,6 @@ def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30969,7 +30863,7 @@ def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31102,7 +30996,6 @@ def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31117,7 +31010,7 @@ def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31166,7 +31059,6 @@ def delete_backup_configuration_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31225,7 +31117,6 @@ def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31240,7 +31131,7 @@ def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31376,7 +31267,6 @@ def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31391,7 +31281,7 @@ def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31440,7 +31330,6 @@ def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31455,7 +31344,7 @@ def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31504,7 +31393,6 @@ def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31519,7 +31407,7 @@ def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31655,7 +31543,6 @@ def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31670,7 +31557,7 @@ def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31803,7 +31690,6 @@ def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31818,7 +31704,7 @@ def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31867,7 +31753,6 @@ def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31882,7 +31767,7 @@ def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31891,7 +31776,7 @@ def list_metadata_slot( def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31904,7 +31789,7 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -31915,10 +31800,10 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31926,11 +31811,15 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31975,10 +31864,11 @@ def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32126,7 +32016,6 @@ def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32141,7 +32030,7 @@ def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32190,7 +32079,6 @@ def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32205,7 +32093,7 @@ def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32256,7 +32144,6 @@ def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32271,7 +32158,7 @@ def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32404,7 +32291,6 @@ def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32419,7 +32305,7 @@ def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32552,7 +32438,6 @@ def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32567,7 +32452,7 @@ def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32623,7 +32508,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32639,7 +32523,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32714,7 +32597,6 @@ def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32729,7 +32611,7 @@ def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32781,7 +32663,6 @@ def recover_site_configuration_snapshot_slot( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32840,9 +32721,9 @@ def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -32851,12 +32732,16 @@ def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32905,9 +32790,9 @@ def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -32916,12 +32801,16 @@ def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32973,7 +32862,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32989,7 +32877,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33064,7 +32951,6 @@ def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33080,7 +32966,7 @@ def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33132,7 +33018,6 @@ def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33194,7 +33079,6 @@ def start_continuous_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33256,7 +33140,6 @@ def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33318,7 +33201,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33334,7 +33216,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33409,7 +33290,6 @@ def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33424,7 +33304,7 @@ def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33567,7 +33447,6 @@ def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33582,7 +33461,7 @@ def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33634,7 +33513,6 @@ def delete_deployment_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33697,7 +33575,6 @@ def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33712,7 +33589,7 @@ def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33853,7 +33730,6 @@ def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33868,7 +33744,7 @@ def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33920,7 +33796,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33936,7 +33811,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34011,7 +33885,6 @@ def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34026,7 +33899,7 @@ def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34171,7 +34044,6 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34186,7 +34058,7 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34238,7 +34110,6 @@ def delete_domain_ownership_identifier_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34393,7 +34264,6 @@ def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34408,7 +34278,7 @@ def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34457,7 +34327,6 @@ def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34472,7 +34341,7 @@ def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34486,7 +34355,7 @@ def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34500,7 +34369,7 @@ def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -34522,10 +34391,10 @@ def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34533,12 +34402,14 @@ def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34661,10 +34532,11 @@ def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -34728,7 +34600,6 @@ def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34744,7 +34615,7 @@ def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34795,7 +34666,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34811,7 +34681,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34880,7 +34749,6 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34895,7 +34763,7 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34946,7 +34814,6 @@ def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34962,7 +34829,7 @@ def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34977,7 +34844,7 @@ def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34991,7 +34858,7 @@ def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -35014,10 +34881,10 @@ def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35025,11 +34892,15 @@ def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35159,10 +35030,11 @@ def begin_create_instance_function_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -35228,7 +35100,6 @@ def delete_instance_function_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35388,7 +35259,6 @@ def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35403,11 +35273,7 @@ def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35461,7 +35327,6 @@ def delete_function_secret_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35522,7 +35387,6 @@ def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35537,7 +35401,7 @@ def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35588,7 +35452,6 @@ def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35603,7 +35466,7 @@ def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35649,7 +35512,6 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35664,7 +35526,7 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35712,7 +35574,6 @@ def list_sync_status_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35771,7 +35632,6 @@ def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35932,7 +35792,6 @@ def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35947,11 +35806,7 @@ def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36005,7 +35860,6 @@ def delete_host_secret_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36068,7 +35922,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36084,7 +35937,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36159,7 +36011,6 @@ def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36174,7 +36025,7 @@ def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36319,7 +36170,6 @@ def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36334,7 +36184,7 @@ def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36386,7 +36236,6 @@ def delete_host_name_binding_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36450,7 +36299,6 @@ def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36465,7 +36313,7 @@ def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36615,7 +36463,6 @@ def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36630,7 +36477,7 @@ def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36684,7 +36531,6 @@ def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36844,7 +36690,6 @@ def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36859,7 +36704,7 @@ def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36913,7 +36758,6 @@ def list_hybrid_connection_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36928,7 +36772,7 @@ def list_hybrid_connection_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36976,7 +36820,6 @@ def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36991,7 +36834,7 @@ def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37040,7 +36883,6 @@ def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37055,7 +36897,7 @@ def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37107,7 +36949,6 @@ def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37122,7 +36963,7 @@ def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37266,7 +37107,6 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37281,7 +37121,7 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37333,7 +37173,6 @@ def delete_relay_service_connection_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37487,7 +37326,6 @@ def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37502,7 +37340,7 @@ def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37554,7 +37392,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37570,7 +37407,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37645,7 +37481,6 @@ def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37660,7 +37495,7 @@ def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37675,7 +37510,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37689,7 +37524,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -37712,10 +37547,10 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -37723,12 +37558,14 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37861,10 +37698,11 @@ def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=name-too- params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -37931,7 +37769,6 @@ def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37947,7 +37784,7 @@ def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38005,7 +37842,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38021,7 +37857,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38099,7 +37934,6 @@ def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38115,7 +37949,7 @@ def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38173,7 +38007,6 @@ def delete_instance_process_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38239,9 +38072,9 @@ def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -38250,12 +38083,16 @@ def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38316,7 +38153,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38332,7 +38168,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38420,7 +38255,6 @@ def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38436,7 +38270,7 @@ def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38495,7 +38329,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38511,7 +38344,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38601,7 +38433,6 @@ def get_instance_process_thread_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38617,7 +38448,7 @@ def get_instance_process_thread_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38666,7 +38497,6 @@ def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38681,7 +38511,7 @@ def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38729,7 +38559,6 @@ def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38744,7 +38573,7 @@ def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38798,7 +38627,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38814,7 +38642,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38905,7 +38732,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38921,7 +38747,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38994,7 +38819,6 @@ def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39009,7 +38833,7 @@ def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39058,7 +38882,6 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39073,7 +38896,7 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39226,7 +39049,6 @@ def create_or_update_swift_virtual_network_connection_slot( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39241,7 +39063,7 @@ def create_or_update_swift_virtual_network_connection_slot( # pylint: disable=n error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39290,7 +39112,6 @@ def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39453,7 +39274,6 @@ def update_swift_virtual_network_connection_slot( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39468,7 +39288,7 @@ def update_swift_virtual_network_connection_slot( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39520,7 +39340,6 @@ def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39536,7 +39355,7 @@ def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39588,7 +39407,6 @@ def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39603,11 +39421,7 @@ def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39671,7 +39485,6 @@ def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39686,7 +39499,7 @@ def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39702,7 +39515,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -39715,7 +39528,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -39729,10 +39542,10 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -39740,15 +39553,15 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39809,10 +39622,11 @@ def begin_start_web_site_network_trace_operation_slot( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -39875,7 +39689,6 @@ def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39937,7 +39750,6 @@ def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39952,7 +39764,7 @@ def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40004,7 +39816,6 @@ def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40019,11 +39830,7 @@ def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40075,7 +39882,6 @@ def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40090,7 +39896,7 @@ def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40139,7 +39945,6 @@ def generate_new_site_publishing_password_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40206,7 +40011,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40222,7 +40026,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40294,7 +40097,6 @@ def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40309,7 +40111,7 @@ def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40358,7 +40160,6 @@ def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40373,7 +40174,7 @@ def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40425,7 +40226,6 @@ def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40440,7 +40240,7 @@ def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40583,7 +40383,6 @@ def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40598,7 +40397,7 @@ def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40650,7 +40449,6 @@ def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40803,7 +40601,6 @@ def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40818,7 +40615,7 @@ def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40868,7 +40665,6 @@ def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40883,7 +40679,7 @@ def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41019,7 +40815,6 @@ def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41034,7 +40829,7 @@ def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41088,7 +40883,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41104,7 +40898,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41178,7 +40971,6 @@ def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41194,7 +40986,7 @@ def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41248,7 +41040,6 @@ def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41310,9 +41101,9 @@ def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -41321,12 +41112,16 @@ def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41383,7 +41178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41399,7 +41193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41476,7 +41269,6 @@ def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41492,7 +41284,7 @@ def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41547,7 +41339,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41563,7 +41354,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41642,7 +41432,6 @@ def get_process_thread_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41658,7 +41447,7 @@ def get_process_thread_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessThreadInfo", pipeline_response) + deserialized = self._deserialize("ProcessThreadInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41710,7 +41499,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41726,7 +41514,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41801,7 +41588,6 @@ def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41816,7 +41602,7 @@ def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41961,7 +41747,6 @@ def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41976,7 +41761,7 @@ def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42028,7 +41813,6 @@ def delete_public_certificate_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42176,9 +41960,9 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -42187,11 +41971,15 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42242,7 +42030,6 @@ def reset_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42316,7 +42103,6 @@ def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42333,14 +42119,14 @@ def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42354,7 +42140,7 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -42376,10 +42162,10 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -42387,11 +42173,19 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob_slot( @@ -42494,7 +42288,7 @@ def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -42506,6 +42300,7 @@ def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -42527,14 +42322,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42548,7 +42343,7 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -42570,10 +42365,10 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -42581,11 +42376,19 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app_slot( @@ -42688,7 +42491,7 @@ def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -42700,6 +42503,7 @@ def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -42721,14 +42525,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42742,7 +42546,7 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -42764,10 +42568,10 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -42775,11 +42579,19 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot_slot( @@ -42885,7 +42697,7 @@ def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_slot_initial( # type: ignore + raw_result = self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -42897,6 +42709,7 @@ def begin_restore_snapshot_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -42963,7 +42776,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42979,7 +42791,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43053,7 +42864,6 @@ def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43069,7 +42879,7 @@ def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43078,7 +42888,7 @@ def get_site_extension_slot( def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -43091,7 +42901,7 @@ def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -43103,10 +42913,10 @@ def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -43114,15 +42924,14 @@ def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43171,10 +42980,11 @@ def begin_install_site_extension_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -43241,7 +43051,6 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43386,7 +43195,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43402,7 +43210,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43432,14 +43239,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -43453,7 +43260,7 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -43475,10 +43282,10 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -43486,11 +43293,19 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot( @@ -43593,7 +43408,7 @@ def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_initial( # type: ignore + raw_result = self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -43605,6 +43420,7 @@ def begin_swap_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -43670,7 +43486,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43686,7 +43501,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43760,7 +43574,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43776,7 +43589,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43848,7 +43660,6 @@ def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43863,14 +43674,7 @@ def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43884,7 +43688,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -43898,7 +43702,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -43920,10 +43724,10 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -43931,18 +43735,15 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44067,10 +43868,11 @@ def begin_create_or_update_source_control_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -44134,7 +43936,6 @@ def delete_source_control_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44279,7 +44080,6 @@ def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44294,14 +44094,7 @@ def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44350,7 +44143,6 @@ def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44376,7 +44168,7 @@ def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44389,7 +44181,7 @@ def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -44403,10 +44195,10 @@ def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44414,15 +44206,15 @@ def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44483,10 +44275,11 @@ def begin_start_network_trace_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -44550,7 +44343,6 @@ def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44608,7 +44400,6 @@ def stop_network_trace_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44667,7 +44458,6 @@ def sync_repository_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44725,7 +44515,6 @@ def sync_function_triggers_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44787,7 +44576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44803,7 +44591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44878,7 +44665,6 @@ def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44894,7 +44680,7 @@ def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44946,7 +44732,6 @@ def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45011,7 +44796,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45027,7 +44811,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45104,7 +44887,6 @@ def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45120,7 +44902,7 @@ def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45172,7 +44954,6 @@ def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45240,7 +45021,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45256,7 +45036,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45328,7 +45107,6 @@ def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45343,7 +45121,7 @@ def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45395,7 +45173,6 @@ def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45410,7 +45187,7 @@ def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45561,7 +45338,6 @@ def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45576,7 +45352,7 @@ def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45628,7 +45404,6 @@ def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45789,7 +45564,6 @@ def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45804,7 +45578,7 @@ def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45860,7 +45634,6 @@ def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45876,7 +45649,7 @@ def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46032,7 +45805,6 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46047,7 +45819,7 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46203,7 +45975,6 @@ def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46218,7 +45989,7 @@ def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46270,7 +46041,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46286,7 +46056,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46361,7 +46130,6 @@ def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46376,7 +46144,7 @@ def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46498,7 +46266,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46514,7 +46281,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46544,13 +46310,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46564,7 +46330,7 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -46585,10 +46351,10 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46596,11 +46362,19 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot_with_production( @@ -46691,7 +46465,7 @@ def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_with_production_initial( # type: ignore + raw_result = self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -46702,6 +46476,7 @@ def begin_swap_slot_with_production( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -46762,7 +46537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46778,7 +46552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46849,7 +46622,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46865,7 +46637,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46931,7 +46702,6 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46946,14 +46716,7 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46966,7 +46729,7 @@ def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46980,7 +46743,7 @@ def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -47001,10 +46764,10 @@ def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47012,18 +46775,15 @@ def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47135,10 +46895,11 @@ def begin_create_or_update_source_control( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -47198,7 +46959,6 @@ def delete_source_control( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47330,7 +47090,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47345,14 +47104,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47397,7 +47149,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47422,7 +47173,7 @@ def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47435,7 +47186,7 @@ def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -47448,10 +47199,10 @@ def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47459,15 +47210,15 @@ def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47524,10 +47275,11 @@ def begin_start_network_trace( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -47587,7 +47339,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47642,7 +47393,6 @@ def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47697,7 +47447,6 @@ def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47752,7 +47501,6 @@ def sync_function_triggers( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47810,7 +47558,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47826,7 +47573,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47897,7 +47643,6 @@ def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47913,7 +47658,7 @@ def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47961,7 +47706,6 @@ def delete_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48022,7 +47766,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48038,7 +47781,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48111,7 +47853,6 @@ def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48127,7 +47868,7 @@ def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48175,7 +47916,6 @@ def run_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48239,7 +47979,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48255,7 +47994,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48321,7 +48059,6 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48336,7 +48073,7 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48384,7 +48121,6 @@ def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48399,7 +48135,7 @@ def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48537,7 +48273,6 @@ def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48552,7 +48287,7 @@ def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48600,7 +48335,6 @@ def delete_vnet_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48748,7 +48482,6 @@ def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48763,7 +48496,7 @@ def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48815,7 +48548,6 @@ def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48831,7 +48563,7 @@ def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48974,7 +48706,6 @@ def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48989,7 +48720,7 @@ def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49132,7 +48863,6 @@ def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49147,7 +48877,7 @@ def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49193,7 +48923,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49209,7 +48938,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49278,7 +49006,6 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49293,7 +49020,7 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_site_management_client_operations.py index 97521ce5615b8..db68fe1733ed7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_web_site_management_client_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -573,7 +572,6 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -588,7 +586,7 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -677,7 +675,6 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -692,7 +689,7 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -733,7 +730,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -749,7 +745,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -813,7 +808,6 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -828,7 +822,7 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -936,7 +930,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -951,7 +944,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1001,7 +994,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1017,7 +1009,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1095,7 +1086,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1110,7 +1100,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1150,7 +1140,6 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1165,7 +1154,7 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1231,7 +1220,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1247,7 +1235,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1367,7 +1354,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1383,7 +1369,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1448,7 +1433,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1464,7 +1448,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1526,7 +1509,6 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1541,7 +1523,7 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1640,7 +1622,6 @@ def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1655,7 +1636,7 @@ def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1768,7 +1749,6 @@ def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1887,7 +1867,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1902,7 +1881,7 @@ def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2016,7 +1995,6 @@ def validate_container_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2031,7 +2009,7 @@ def validate_container_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2144,7 +2122,6 @@ def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_metadata.json index 0d5ccebd3a510..82517bf2737b9 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff1..0000000000000 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_web_site_management_client.py index c55a5c4f0193e..84bf1a53086fd 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -104,7 +105,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client.py index b2d2e79823100..aeff89067fe70 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -106,7 +107,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations/_certificates_operations.py index e85ced77adb4a..5b70cace64453 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -100,7 +98,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -116,7 +113,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -182,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -198,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -264,7 +258,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -279,7 +272,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -399,7 +392,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -414,7 +406,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -459,7 +451,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -590,7 +581,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -605,7 +595,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/_certificates_operations.py index 8b88983453a68..8354986408a7f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_11_01/operations/_certificates_operations.py @@ -21,15 +21,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -300,7 +298,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -316,7 +313,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -382,7 +378,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -398,7 +393,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -464,7 +458,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -479,7 +472,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -599,7 +592,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -614,7 +606,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -659,7 +651,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -790,7 +781,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -805,7 +795,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_metadata.json index 65ccf50fd929f..4a07c7f556f56 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_vendor.py index fd66631892ed1..abd2e5566a353 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from .._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class WebSiteManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_web_site_management_client.py index d1cc8163c33b4..324a2ac3abd57 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -194,7 +195,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_vendor.py index 39f69956b8888..6e80ec49ed289 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client.py index 1b2cbfd748282..fa2e5a4b97514 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -196,7 +197,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_certificate_orders_operations.py index 46dfa77879523..da23b9defcf8b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_certificate_orders_operations import ( build_create_or_update_certificate_request, build_create_or_update_request, @@ -119,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -254,7 +266,6 @@ async def validate_purchase_information( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +405,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +419,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +432,7 @@ async def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -438,7 +446,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -459,10 +467,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -470,15 +478,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -595,10 +603,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -658,7 +667,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +801,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -808,11 +815,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -862,7 +865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -878,7 +880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -949,7 +950,6 @@ async def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -964,7 +964,7 @@ async def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -978,7 +978,7 @@ async def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -992,7 +992,7 @@ async def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1014,10 +1014,10 @@ async def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1025,15 +1025,15 @@ async def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1157,10 +1157,11 @@ async def begin_create_or_update_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1223,7 +1224,6 @@ async def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1366,7 +1366,6 @@ async def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1381,11 +1380,7 @@ async def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1507,7 +1502,6 @@ async def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1640,7 +1634,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1696,7 +1689,6 @@ async def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1827,7 +1819,6 @@ async def resend_request_emails( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1958,7 +1949,6 @@ async def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1973,7 +1963,7 @@ async def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2018,7 +2008,6 @@ async def verify_domain_ownership( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2074,7 +2063,6 @@ async def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2089,7 +2077,7 @@ async def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2134,7 +2122,6 @@ async def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2149,7 +2136,7 @@ async def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_environments_operations.py index 0ef7d07accd24..360755cfd40ad 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_environments_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_environments_operations import ( build_change_vnet_request, build_create_or_update_multi_role_pool_request, @@ -135,7 +149,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -151,7 +164,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -221,7 +233,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -237,7 +248,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -303,7 +313,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -318,7 +327,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -331,7 +340,7 @@ async def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -345,7 +354,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -366,10 +375,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -377,18 +386,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -505,10 +511,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -530,9 +537,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -545,7 +552,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -556,10 +563,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -567,12 +574,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -603,7 +618,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -613,6 +628,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -751,7 +767,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -766,14 +781,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,7 +830,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -838,7 +845,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -904,7 +910,6 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -919,7 +924,7 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -932,7 +937,7 @@ async def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -946,7 +951,7 @@ async def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -967,10 +972,10 @@ async def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -978,15 +983,15 @@ async def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1115,7 +1120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1131,13 +1135,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1174,6 +1177,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -1239,7 +1243,6 @@ async def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1254,7 +1257,7 @@ async def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1302,7 +1305,6 @@ async def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1317,7 +1319,7 @@ async def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1367,7 +1369,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1383,7 +1384,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1455,7 +1455,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1471,7 +1470,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1539,7 +1537,6 @@ async def get_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1554,7 +1551,7 @@ async def get_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1567,7 +1564,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1581,7 +1578,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1602,10 +1599,10 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1613,15 +1610,15 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1735,10 +1732,11 @@ async def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1874,7 +1872,6 @@ async def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1889,11 +1886,7 @@ async def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1948,7 +1941,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1964,7 +1956,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2037,7 +2028,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2053,7 +2043,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2124,7 +2113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2140,7 +2128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2211,7 +2198,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2227,7 +2213,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2293,7 +2278,6 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2308,7 +2292,7 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2358,7 +2342,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2374,7 +2357,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2442,7 +2424,6 @@ async def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2460,7 +2441,7 @@ async def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2473,7 +2454,7 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -2483,10 +2464,10 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2494,15 +2475,15 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2553,7 +2534,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2569,13 +2549,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2610,6 +2589,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2679,7 +2659,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2695,7 +2674,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2770,7 +2748,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2786,7 +2763,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2816,7 +2792,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2829,7 +2805,7 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -2839,10 +2815,10 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2850,15 +2826,15 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2909,7 +2885,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2925,13 +2900,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2966,6 +2940,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3041,7 +3016,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3057,7 +3031,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3129,7 +3102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3145,7 +3117,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3216,7 +3187,6 @@ async def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3231,7 +3201,7 @@ async def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3245,7 +3215,7 @@ async def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3259,7 +3229,7 @@ async def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3281,10 +3251,10 @@ async def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3292,15 +3262,15 @@ async def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3423,10 +3393,11 @@ async def begin_create_or_update_worker_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3571,7 +3542,6 @@ async def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3586,11 +3556,7 @@ async def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3646,7 +3612,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3662,7 +3627,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3738,7 +3702,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3754,7 +3717,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3828,7 +3790,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3844,7 +3805,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3918,7 +3878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3934,7 +3893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_plans_operations.py index 30da45c2b30ec..cab3286715852 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_app_service_plans_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_plans_operations import ( build_create_or_update_request, build_create_or_update_vnet_route_request, @@ -131,7 +145,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -147,7 +160,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -216,7 +228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -298,7 +308,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +324,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +337,7 @@ async def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -342,7 +351,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -363,10 +372,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -374,15 +383,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -492,10 +501,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -555,7 +565,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -687,7 +696,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -702,11 +710,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -749,7 +753,6 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -764,7 +767,7 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -815,7 +818,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -830,7 +832,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -881,7 +883,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -943,7 +944,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -958,7 +958,7 @@ async def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1012,7 +1012,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1028,7 +1027,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1096,7 +1094,6 @@ async def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1111,7 +1108,7 @@ async def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1160,7 +1157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1176,7 +1172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1250,7 +1245,6 @@ async def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1328,7 +1322,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1344,7 +1337,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1410,7 +1402,6 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1425,7 +1416,7 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1479,7 +1470,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1495,7 +1485,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1561,7 +1550,6 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1576,7 +1564,7 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1624,7 +1612,6 @@ async def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1641,7 +1628,7 @@ async def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1692,7 +1679,6 @@ async def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1693,7 @@ async def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1847,7 +1833,6 @@ async def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1862,7 +1847,7 @@ async def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1910,7 +1895,6 @@ async def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1925,7 +1909,7 @@ async def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1976,7 +1960,6 @@ async def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1993,7 +1976,7 @@ async def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2133,7 +2116,6 @@ async def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2150,7 +2132,7 @@ async def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2201,7 +2183,6 @@ async def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2352,7 +2333,6 @@ async def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2369,7 +2349,7 @@ async def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2417,7 +2397,6 @@ async def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificate_registration_provider_operations.py index ba4b4d1f636e4..447dca12ab134 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificate_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificates_operations.py index b2899fc4a423f..d3cf217b3a19e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -101,7 +99,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -183,7 +179,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -199,7 +194,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -265,7 +259,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +273,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +393,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -415,7 +407,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -592,7 +583,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -607,7 +597,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_deleted_web_apps_operations.py index 0b24205ba5500..2fd6ee062cb78 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_deleted_web_apps_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_web_apps_operations import ( build_get_deleted_web_app_by_location_request, build_list_by_location_request, @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -179,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +257,6 @@ async def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +271,7 @@ async def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_diagnostics_operations.py index bcac00d06b692..42e1968392a07 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._diagnostics_operations import ( build_execute_site_analysis_request, build_execute_site_analysis_slot_request, @@ -126,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +225,6 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +239,7 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,7 +288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -309,7 +303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +389,6 @@ async def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +403,7 @@ async def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -476,7 +467,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -547,7 +537,6 @@ async def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -562,7 +551,7 @@ async def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -630,7 +618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -704,7 +691,6 @@ async def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,7 +705,7 @@ async def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +773,6 @@ async def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +787,7 @@ async def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -854,7 +839,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -870,7 +854,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -944,7 +927,6 @@ async def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -959,7 +941,7 @@ async def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1027,7 +1009,6 @@ async def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1042,7 +1023,7 @@ async def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1094,7 +1075,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1110,7 +1090,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1201,7 +1180,6 @@ async def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1216,7 +1194,7 @@ async def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1268,7 +1246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1284,7 +1261,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1358,7 +1334,6 @@ async def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1373,7 +1348,7 @@ async def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1428,7 +1403,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1444,7 +1418,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1527,7 +1500,6 @@ async def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1542,7 +1514,7 @@ async def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1614,7 +1586,6 @@ async def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1629,7 +1600,7 @@ async def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1684,7 +1655,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1700,7 +1670,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1783,7 +1752,6 @@ async def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1798,7 +1766,7 @@ async def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1870,7 +1838,6 @@ async def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1885,7 +1852,7 @@ async def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domain_registration_provider_operations.py index f228aae814c72..7f659b905d6e1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domain_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domains_operations.py index d1d0874127778..6bd2295cc0e78 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_check_availability_request, build_create_or_update_ownership_identifier_request, @@ -162,7 +162,6 @@ async def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -177,7 +176,7 @@ async def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -217,7 +216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -233,7 +231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +290,6 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -308,7 +304,7 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -408,7 +404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -424,7 +419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -490,7 +484,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -506,7 +499,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -572,7 +564,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -587,7 +578,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -596,7 +587,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -610,7 +601,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,10 +622,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -642,15 +633,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,10 +747,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -824,7 +816,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -955,7 +946,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -970,11 +960,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1024,7 +1010,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1040,7 +1025,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1111,7 +1095,6 @@ async def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1126,7 +1109,7 @@ async def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1265,7 +1248,6 @@ async def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1280,7 +1262,7 @@ async def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1328,7 +1310,6 @@ async def delete_ownership_identifier( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1478,7 +1459,6 @@ async def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1493,7 +1473,7 @@ async def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1538,7 +1518,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_provider_operations.py index aee9933e8a9c9..c2a42ab8dd2b5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._provider_operations import ( build_get_available_stacks_on_prem_request, build_get_available_stacks_request, @@ -103,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -185,7 +181,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -201,7 +196,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -272,7 +266,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -288,7 +281,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_recommendations_operations.py index d3ec57a2bbb79..5b7c2f1da9577 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_recommendations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommendations_operations import ( build_disable_all_for_hosting_environment_request, build_disable_all_for_web_app_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -198,7 +194,6 @@ async def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +246,6 @@ async def disable_recommendation_for_subscription( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -326,7 +320,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -342,7 +335,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -428,7 +420,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +435,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -515,7 +505,6 @@ async def disable_all_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +563,6 @@ async def reset_all_filters_for_hosting_environment( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +635,6 @@ async def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -662,7 +649,7 @@ async def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -713,7 +700,6 @@ async def disable_recommendation_for_hosting_environment( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -788,7 +774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -804,7 +789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -890,7 +874,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -906,7 +889,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +956,6 @@ async def disable_all_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1030,7 +1011,6 @@ async def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1103,7 +1083,6 @@ async def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1118,7 +1097,7 @@ async def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1145,6 @@ async def disable_recommendation_for_site( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_resource_health_metadata_operations.py index a51b0c12a1a07..30c62ba58415e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_resource_health_metadata_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._resource_health_metadata_operations import ( build_get_by_site_request, build_get_by_site_slot_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -277,7 +271,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -293,7 +286,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -359,7 +351,6 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +365,7 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -428,7 +419,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +434,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -516,7 +505,6 @@ async def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -531,7 +519,7 @@ async def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_static_sites_operations.py index 5c865541ca130..4414d35a92fbc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_static_sites_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._static_sites_operations import ( build_create_or_update_static_site_build_function_app_settings_request, build_create_or_update_static_site_custom_domain_request, @@ -123,7 +121,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +136,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -209,7 +205,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -225,7 +220,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +287,6 @@ async def get_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -308,7 +301,7 @@ async def get_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -431,7 +424,6 @@ async def create_or_update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -446,11 +438,7 @@ async def create_or_update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -495,7 +483,6 @@ async def delete_static_site( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -629,7 +616,6 @@ async def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -644,11 +630,7 @@ async def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -701,7 +683,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -717,7 +698,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -791,7 +771,6 @@ async def delete_static_site_user( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -945,7 +924,6 @@ async def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -960,7 +938,7 @@ async def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1010,7 +988,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1026,7 +1003,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1097,7 +1073,6 @@ async def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1112,7 +1087,7 @@ async def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1160,7 +1135,6 @@ async def delete_static_site_build( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1300,7 +1274,6 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1315,11 +1288,7 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1372,7 +1341,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1388,7 +1356,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1459,7 +1426,6 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1474,11 +1440,7 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1597,7 +1559,6 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1612,11 +1573,7 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1740,7 +1697,6 @@ async def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1755,7 +1711,7 @@ async def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1805,7 +1761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1821,7 +1776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1892,7 +1846,6 @@ async def create_or_update_static_site_custom_domain( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1907,11 +1860,7 @@ async def create_or_update_static_site_custom_domain( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1959,7 +1908,6 @@ async def delete_static_site_custom_domain( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2018,7 +1966,6 @@ async def validate_custom_domain_can_be_added_to_static_site( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2074,7 +2021,6 @@ async def detach_static_site( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2135,7 +2081,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2151,7 +2096,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2219,7 +2163,6 @@ async def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2234,11 +2177,7 @@ async def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2283,7 +2222,6 @@ async def list_static_site_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2298,7 +2236,7 @@ async def list_static_site_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2420,7 +2358,6 @@ async def reset_static_site_api_key( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_top_level_domains_operations.py index c129e09591d03..9d4a4b793877f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_level_domains_operations import ( build_get_request, build_list_agreements_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -178,7 +174,6 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_apps_operations.py index 4e6193964a00d..29f3ff20d56ac 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_apps_operations.py @@ -32,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -45,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_apps_operations import ( build_add_premier_add_on_request, build_add_premier_add_on_slot_request, @@ -484,7 +484,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -500,7 +499,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -573,7 +571,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -589,7 +586,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -655,7 +651,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -672,7 +667,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -681,7 +676,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio async def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -695,7 +690,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -716,10 +711,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -727,15 +722,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -847,10 +842,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -922,7 +918,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1062,7 +1057,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1077,11 +1071,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1129,7 +1119,6 @@ async def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1144,7 +1133,7 @@ async def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1264,7 +1253,6 @@ async def apply_slot_config_to_production( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1393,7 +1381,6 @@ async def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1408,7 +1395,7 @@ async def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1454,7 +1441,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1470,7 +1456,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1541,7 +1526,6 @@ async def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1556,7 +1540,7 @@ async def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1604,7 +1588,6 @@ async def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1757,7 +1740,6 @@ async def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1772,21 +1754,21 @@ async def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_initial( # pylint: disable=inconsistent-return-statements + async def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1800,7 +1782,7 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1822,10 +1804,10 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1833,12 +1815,20 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore( @@ -1938,7 +1928,7 @@ async def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_initial( # type: ignore + raw_result = await self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -1950,6 +1940,7 @@ async def begin_restore( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2009,7 +2000,6 @@ async def get_basic_publishing_credentials_policies( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2024,7 +2014,7 @@ async def get_basic_publishing_credentials_policies( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2069,7 +2059,6 @@ async def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2084,7 +2073,7 @@ async def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2208,7 +2197,6 @@ async def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2223,7 +2211,7 @@ async def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2268,7 +2256,6 @@ async def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2283,7 +2270,7 @@ async def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2407,7 +2394,6 @@ async def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2422,7 +2408,7 @@ async def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2471,7 +2457,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2487,7 +2472,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2630,7 +2614,6 @@ async def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2645,7 +2628,7 @@ async def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2690,7 +2673,6 @@ async def list_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2705,7 +2687,7 @@ async def list_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2825,7 +2807,6 @@ async def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2840,7 +2821,7 @@ async def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2883,7 +2864,6 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2898,7 +2878,7 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3020,7 +3000,6 @@ async def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3035,7 +3014,7 @@ async def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3080,7 +3059,6 @@ async def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3095,7 +3073,7 @@ async def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3211,7 +3189,6 @@ async def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3226,7 +3203,7 @@ async def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3271,7 +3248,6 @@ async def delete_backup_configuration( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3327,7 +3303,6 @@ async def get_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3342,7 +3317,7 @@ async def get_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3387,7 +3362,6 @@ async def get_app_settings_key_vault_references( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3402,7 +3376,7 @@ async def get_app_settings_key_vault_references( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KeyVaultReferenceCollection", pipeline_response) + deserialized = self._deserialize("KeyVaultReferenceCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3450,7 +3424,6 @@ async def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3465,7 +3438,7 @@ async def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KeyVaultReferenceResource", pipeline_response) + deserialized = self._deserialize("KeyVaultReferenceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3588,7 +3561,6 @@ async def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3603,7 +3575,7 @@ async def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3648,7 +3620,6 @@ async def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3663,7 +3634,7 @@ async def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3708,7 +3679,6 @@ async def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3723,7 +3693,7 @@ async def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3846,7 +3816,6 @@ async def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3861,7 +3830,7 @@ async def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3977,7 +3946,6 @@ async def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3992,7 +3960,7 @@ async def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4035,7 +4003,6 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4050,7 +4017,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4059,7 +4026,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any async def _list_publishing_credentials_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4072,7 +4039,7 @@ async def _list_publishing_credentials_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -4082,10 +4049,10 @@ async def _list_publishing_credentials_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4093,11 +4060,15 @@ async def _list_publishing_credentials_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4138,10 +4109,11 @@ async def begin_list_publishing_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4272,7 +4244,6 @@ async def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4287,7 +4258,7 @@ async def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4330,7 +4301,6 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4345,7 +4315,7 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4390,7 +4360,6 @@ async def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4405,7 +4374,7 @@ async def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4534,7 +4503,6 @@ async def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4549,7 +4517,7 @@ async def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4594,7 +4562,6 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4609,7 +4576,7 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4729,7 +4696,6 @@ async def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4744,7 +4710,7 @@ async def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4864,7 +4830,6 @@ async def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4879,7 +4844,7 @@ async def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4931,7 +4896,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4947,7 +4911,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5018,7 +4981,6 @@ async def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5033,7 +4995,7 @@ async def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5081,7 +5043,6 @@ async def recover_site_configuration_snapshot( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5137,9 +5098,9 @@ async def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5148,12 +5109,16 @@ async def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5198,9 +5163,9 @@ async def get_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5209,12 +5174,16 @@ async def get_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5263,7 +5232,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5279,7 +5247,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5350,7 +5317,6 @@ async def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5367,7 +5333,7 @@ async def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5415,7 +5381,6 @@ async def delete_continuous_web_job( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5474,7 +5439,6 @@ async def start_continuous_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5533,7 +5497,6 @@ async def stop_continuous_web_job( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5592,7 +5555,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5608,7 +5570,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5677,7 +5638,6 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5692,7 +5652,7 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5822,7 +5782,6 @@ async def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5837,7 +5796,7 @@ async def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5885,7 +5844,6 @@ async def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5945,7 +5903,6 @@ async def list_deployment_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5960,7 +5917,7 @@ async def list_deployment_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6084,7 +6041,6 @@ async def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6099,7 +6055,7 @@ async def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6147,7 +6103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6163,7 +6118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6234,7 +6188,6 @@ async def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6249,7 +6202,7 @@ async def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6381,7 +6334,6 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6396,7 +6348,7 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6444,7 +6396,6 @@ async def delete_domain_ownership_identifier( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6587,7 +6538,6 @@ async def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6602,7 +6552,7 @@ async def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6645,7 +6595,6 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6660,7 +6609,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6669,7 +6618,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar async def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6683,7 +6632,7 @@ async def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6704,10 +6653,10 @@ async def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6715,13 +6664,15 @@ async def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6827,10 +6778,11 @@ async def begin_create_ms_deploy_operation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6890,7 +6842,6 @@ async def get_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6907,7 +6858,7 @@ async def get_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6956,7 +6907,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6972,7 +6922,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7038,7 +6987,6 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7053,7 +7001,7 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7101,7 +7049,6 @@ async def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7118,7 +7065,7 @@ async def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7132,7 +7079,7 @@ async def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7146,7 +7093,7 @@ async def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7168,10 +7115,10 @@ async def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7179,11 +7126,15 @@ async def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7303,10 +7254,11 @@ async def begin_create_function( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7369,7 +7321,6 @@ async def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7520,7 +7471,6 @@ async def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7535,11 +7485,7 @@ async def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7590,7 +7536,6 @@ async def delete_function_secret( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7649,7 +7594,6 @@ async def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7664,7 +7608,7 @@ async def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7712,7 +7656,6 @@ async def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7727,7 +7670,7 @@ async def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7770,7 +7713,6 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7785,7 +7727,7 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7830,7 +7772,6 @@ async def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7886,7 +7827,6 @@ async def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8037,7 +7977,6 @@ async def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8052,11 +7991,7 @@ async def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8107,7 +8042,6 @@ async def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8167,7 +8101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8183,7 +8116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8254,7 +8186,6 @@ async def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8269,7 +8200,7 @@ async def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8401,7 +8332,6 @@ async def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8416,7 +8346,7 @@ async def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8464,7 +8394,6 @@ async def delete_host_name_binding( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8526,7 +8455,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8541,7 +8469,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8681,7 +8609,6 @@ async def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8696,7 +8623,7 @@ async def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8747,7 +8674,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8898,7 +8824,6 @@ async def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8913,7 +8838,7 @@ async def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8958,7 +8883,6 @@ async def list_hybrid_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8973,7 +8897,7 @@ async def list_hybrid_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9018,7 +8942,6 @@ async def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9033,7 +8956,7 @@ async def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9081,7 +9004,6 @@ async def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9096,7 +9018,7 @@ async def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9227,7 +9149,6 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9242,7 +9163,7 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9290,7 +9211,6 @@ async def delete_relay_service_connection( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9432,7 +9352,6 @@ async def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9447,7 +9366,7 @@ async def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9496,7 +9415,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9512,7 +9430,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9583,7 +9500,6 @@ async def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9598,7 +9514,7 @@ async def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9646,7 +9562,6 @@ async def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9661,7 +9576,7 @@ async def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9675,7 +9590,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9689,7 +9604,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -9711,10 +9626,10 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9722,13 +9637,15 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9848,10 +9765,11 @@ async def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9914,7 +9832,6 @@ async def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9931,7 +9848,7 @@ async def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9985,7 +9902,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10001,7 +9917,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10076,7 +9991,6 @@ async def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10093,7 +10007,7 @@ async def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10147,7 +10061,6 @@ async def delete_instance_process( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10210,9 +10123,9 @@ async def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10221,13 +10134,17 @@ async def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10285,7 +10202,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10301,7 +10217,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10379,7 +10294,6 @@ async def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10396,7 +10310,7 @@ async def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10452,7 +10366,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10468,7 +10381,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10534,7 +10446,6 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10549,7 +10460,7 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10597,7 +10508,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10613,7 +10523,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10681,7 +10590,6 @@ async def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10696,7 +10604,7 @@ async def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10710,7 +10618,7 @@ async def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10724,7 +10632,7 @@ async def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10746,10 +10654,10 @@ async def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10757,11 +10665,15 @@ async def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10885,10 +10797,11 @@ async def begin_migrate_storage( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10916,7 +10829,7 @@ async def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10930,7 +10843,7 @@ async def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10951,10 +10864,10 @@ async def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10962,11 +10875,15 @@ async def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11077,10 +10994,11 @@ async def begin_migrate_my_sql( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11142,7 +11060,6 @@ async def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11157,7 +11074,7 @@ async def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11202,7 +11119,6 @@ async def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11217,7 +11133,7 @@ async def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11357,7 +11273,6 @@ async def create_or_update_swift_virtual_network_connection( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11372,7 +11287,7 @@ async def create_or_update_swift_virtual_network_connection( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11417,7 +11332,6 @@ async def delete_swift_virtual_network( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11568,7 +11482,6 @@ async def update_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11583,7 +11496,7 @@ async def update_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11631,7 +11544,6 @@ async def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11648,7 +11560,7 @@ async def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11696,7 +11608,6 @@ async def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11711,11 +11622,7 @@ async def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11775,7 +11682,6 @@ async def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11790,7 +11696,7 @@ async def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11805,7 +11711,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11818,7 +11724,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -11831,10 +11737,10 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11842,15 +11748,15 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11908,10 +11814,11 @@ async def begin_start_web_site_network_trace_operation( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11971,7 +11878,6 @@ async def stop_web_site_network_trace( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12030,7 +11936,6 @@ async def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12045,7 +11950,7 @@ async def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12093,7 +11998,6 @@ async def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12108,11 +12012,7 @@ async def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12160,7 +12060,6 @@ async def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12175,7 +12074,7 @@ async def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12220,7 +12119,6 @@ async def generate_new_site_publishing_password( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12285,7 +12183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -12301,7 +12198,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -12369,7 +12265,6 @@ async def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12384,7 +12279,7 @@ async def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12427,7 +12322,6 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12442,7 +12336,7 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12490,7 +12384,6 @@ async def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12505,7 +12398,7 @@ async def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12635,7 +12528,6 @@ async def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12650,7 +12542,7 @@ async def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12698,7 +12590,6 @@ async def delete_premier_add_on( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12839,7 +12730,6 @@ async def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12854,7 +12744,7 @@ async def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12899,7 +12789,6 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12914,7 +12803,7 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13036,7 +12925,6 @@ async def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13051,7 +12939,7 @@ async def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13101,7 +12989,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13117,7 +13004,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13188,7 +13074,6 @@ async def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13205,7 +13090,7 @@ async def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13255,7 +13140,6 @@ async def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13314,9 +13198,9 @@ async def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13325,13 +13209,17 @@ async def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13385,7 +13273,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13401,7 +13288,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13475,7 +13361,6 @@ async def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13492,7 +13377,7 @@ async def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13544,7 +13429,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13560,7 +13444,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13632,7 +13515,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13648,7 +13530,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13719,7 +13600,6 @@ async def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13734,7 +13614,7 @@ async def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13866,7 +13746,6 @@ async def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13881,7 +13760,7 @@ async def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13929,7 +13808,6 @@ async def delete_public_certificate( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14065,9 +13943,9 @@ async def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14076,11 +13954,15 @@ async def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14127,7 +14009,6 @@ async def reset_production_slot_config( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14197,7 +14078,6 @@ async def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14215,9 +14095,9 @@ async def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14231,7 +14111,7 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14252,10 +14132,10 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14263,12 +14143,20 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob( @@ -14355,7 +14243,7 @@ async def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -14366,6 +14254,7 @@ async def begin_restore_from_backup_blob( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -14387,13 +14276,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14407,7 +14296,7 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14428,10 +14317,10 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14439,12 +14328,20 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app( @@ -14535,7 +14432,7 @@ async def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -14546,6 +14443,7 @@ async def begin_restore_from_deleted_app( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -14567,13 +14465,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14587,7 +14485,7 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14608,10 +14506,10 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14619,12 +14517,20 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot( @@ -14718,7 +14624,7 @@ async def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_initial( # type: ignore + raw_result = await self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -14729,6 +14635,7 @@ async def begin_restore_snapshot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -14792,7 +14699,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14808,7 +14714,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14879,7 +14784,6 @@ async def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14896,7 +14800,7 @@ async def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14905,7 +14809,7 @@ async def get_site_extension( async def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14918,7 +14822,7 @@ async def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -14929,10 +14833,10 @@ async def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14940,16 +14844,15 @@ async def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14995,10 +14898,11 @@ async def begin_install_site_extension( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15061,7 +14965,6 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15079,13 +14982,13 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statements + async def _copy_production_slot_initial( self, resource_group_name: str, name: str, copy_slot_entity: Union[_models.CsmCopySlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15099,7 +15002,7 @@ async def _copy_production_slot_initial( # pylint: disable=inconsistent-return- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15120,10 +15023,10 @@ async def _copy_production_slot_initial( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15131,12 +15034,20 @@ async def _copy_production_slot_initial( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_copy_production_slot( @@ -15230,7 +15141,7 @@ async def begin_copy_production_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._copy_production_slot_initial( # type: ignore + raw_result = await self._copy_production_slot_initial( resource_group_name=resource_group_name, name=name, copy_slot_entity=copy_slot_entity, @@ -15241,6 +15152,7 @@ async def begin_copy_production_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15301,7 +15213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15317,7 +15228,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15387,7 +15297,6 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15404,7 +15313,7 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15418,7 +15327,7 @@ async def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15432,7 +15341,7 @@ async def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15454,10 +15363,10 @@ async def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15465,15 +15374,15 @@ async def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15602,10 +15511,11 @@ async def begin_create_or_update_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15683,7 +15593,6 @@ async def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15836,7 +15745,6 @@ async def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15851,11 +15759,7 @@ async def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15907,7 +15811,6 @@ async def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15922,7 +15825,7 @@ async def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16055,7 +15958,6 @@ async def apply_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16201,7 +16103,6 @@ async def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16216,7 +16117,7 @@ async def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16268,7 +16169,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16284,7 +16184,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16359,7 +16258,6 @@ async def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16374,7 +16272,7 @@ async def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16426,7 +16324,6 @@ async def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16592,7 +16489,6 @@ async def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16607,14 +16503,14 @@ async def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -16622,7 +16518,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16636,7 +16532,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16659,10 +16555,10 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16670,12 +16566,20 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_slot( @@ -16787,7 +16691,7 @@ async def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_slot_initial( # type: ignore + raw_result = await self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -16800,6 +16704,7 @@ async def begin_restore_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16867,7 +16772,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16883,7 +16787,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17039,7 +16942,6 @@ async def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17054,7 +16956,7 @@ async def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17103,7 +17005,6 @@ async def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17118,7 +17019,7 @@ async def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17251,7 +17152,6 @@ async def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17266,7 +17166,7 @@ async def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17315,7 +17215,6 @@ async def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17330,7 +17229,7 @@ async def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17465,7 +17364,6 @@ async def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17480,7 +17378,7 @@ async def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17529,7 +17427,6 @@ async def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17544,7 +17441,7 @@ async def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17677,7 +17574,6 @@ async def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17692,7 +17588,7 @@ async def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17741,7 +17637,6 @@ async def delete_backup_configuration_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17801,7 +17696,6 @@ async def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17816,7 +17710,7 @@ async def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17952,7 +17846,6 @@ async def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17967,7 +17860,7 @@ async def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18016,7 +17909,6 @@ async def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18031,7 +17923,7 @@ async def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18080,7 +17972,6 @@ async def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18095,7 +17986,7 @@ async def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18231,7 +18122,6 @@ async def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18246,7 +18136,7 @@ async def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18379,7 +18269,6 @@ async def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18394,7 +18283,7 @@ async def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18443,7 +18332,6 @@ async def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18458,7 +18346,7 @@ async def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18467,7 +18355,7 @@ async def list_metadata_slot( async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18480,7 +18368,7 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -18491,10 +18379,10 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -18502,11 +18390,15 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18551,10 +18443,11 @@ async def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -18702,7 +18595,6 @@ async def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18717,7 +18609,7 @@ async def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18766,7 +18658,6 @@ async def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18781,7 +18672,7 @@ async def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18832,7 +18723,6 @@ async def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18847,7 +18737,7 @@ async def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18980,7 +18870,6 @@ async def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18995,7 +18884,7 @@ async def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19128,7 +19017,6 @@ async def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19143,7 +19031,7 @@ async def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19199,7 +19087,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19215,7 +19102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19290,7 +19176,6 @@ async def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19305,7 +19190,7 @@ async def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19357,7 +19242,6 @@ async def recover_site_configuration_snapshot_slot( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19417,9 +19301,9 @@ async def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19428,12 +19312,16 @@ async def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19482,9 +19370,9 @@ async def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19493,12 +19381,16 @@ async def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19551,7 +19443,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19567,7 +19458,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19642,7 +19532,6 @@ async def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19659,7 +19548,7 @@ async def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19711,7 +19600,6 @@ async def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19774,7 +19662,6 @@ async def start_continuous_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19837,7 +19724,6 @@ async def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19900,7 +19786,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19916,7 +19801,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19991,7 +19875,6 @@ async def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20006,7 +19889,7 @@ async def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20149,7 +20032,6 @@ async def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20164,7 +20046,7 @@ async def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20216,7 +20098,6 @@ async def delete_deployment_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20280,7 +20161,6 @@ async def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20295,7 +20175,7 @@ async def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20436,7 +20316,6 @@ async def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20451,7 +20330,7 @@ async def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20503,7 +20382,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20519,7 +20397,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20594,7 +20471,6 @@ async def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20609,7 +20485,7 @@ async def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20754,7 +20630,6 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20769,7 +20644,7 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20821,7 +20696,6 @@ async def delete_domain_ownership_identifier_slot( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20977,7 +20851,6 @@ async def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20992,7 +20865,7 @@ async def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21041,7 +20914,6 @@ async def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21056,7 +20928,7 @@ async def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21070,7 +20942,7 @@ async def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21084,7 +20956,7 @@ async def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21106,10 +20978,10 @@ async def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21117,13 +20989,15 @@ async def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21246,10 +21120,11 @@ async def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21313,7 +21188,6 @@ async def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21330,7 +21204,7 @@ async def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21382,7 +21256,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21398,7 +21271,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21470,7 +21342,6 @@ async def get_functions_admin_token_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21485,7 +21356,7 @@ async def get_functions_admin_token_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21536,7 +21407,6 @@ async def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21553,7 +21423,7 @@ async def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21568,7 +21438,7 @@ async def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21582,7 +21452,7 @@ async def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21605,10 +21475,10 @@ async def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21616,11 +21486,15 @@ async def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21750,10 +21624,11 @@ async def begin_create_instance_function_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21819,7 +21694,6 @@ async def delete_instance_function_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21980,7 +21854,6 @@ async def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21995,11 +21868,7 @@ async def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22053,7 +21922,6 @@ async def delete_function_secret_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22115,7 +21983,6 @@ async def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22130,7 +21997,7 @@ async def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22181,7 +22048,6 @@ async def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22196,7 +22062,7 @@ async def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22244,7 +22110,6 @@ async def list_host_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22259,7 +22124,7 @@ async def list_host_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22307,7 +22172,6 @@ async def list_sync_status_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22366,7 +22230,6 @@ async def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22527,7 +22390,6 @@ async def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22542,11 +22404,7 @@ async def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22600,7 +22458,6 @@ async def delete_host_secret_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22664,7 +22521,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22680,7 +22536,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22755,7 +22610,6 @@ async def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22770,7 +22624,7 @@ async def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22915,7 +22769,6 @@ async def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22930,7 +22783,7 @@ async def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22982,7 +22835,6 @@ async def delete_host_name_binding_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23047,7 +22899,6 @@ async def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23062,7 +22913,7 @@ async def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23212,7 +23063,6 @@ async def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23227,7 +23077,7 @@ async def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23281,7 +23131,6 @@ async def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23442,7 +23291,6 @@ async def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23457,7 +23305,7 @@ async def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23505,7 +23353,6 @@ async def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23520,7 +23367,7 @@ async def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23569,7 +23416,6 @@ async def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23584,7 +23430,7 @@ async def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23636,7 +23482,6 @@ async def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23651,7 +23496,7 @@ async def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23795,7 +23640,6 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23810,7 +23654,7 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23862,7 +23706,6 @@ async def delete_relay_service_connection_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24017,7 +23860,6 @@ async def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24032,7 +23874,7 @@ async def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24085,7 +23927,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24101,7 +23942,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24176,7 +24016,6 @@ async def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24191,7 +24030,7 @@ async def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24243,7 +24082,6 @@ async def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24258,7 +24096,7 @@ async def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24273,7 +24111,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24287,7 +24125,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24310,10 +24148,10 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24321,13 +24159,15 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24460,10 +24300,11 @@ async def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=nam params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24530,7 +24371,6 @@ async def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24547,7 +24387,7 @@ async def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24605,7 +24445,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24621,7 +24460,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24700,7 +24538,6 @@ async def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24717,7 +24554,7 @@ async def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24775,7 +24612,6 @@ async def delete_instance_process_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24842,9 +24678,9 @@ async def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24853,13 +24689,17 @@ async def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24921,7 +24761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24937,7 +24776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25026,7 +24864,6 @@ async def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25043,7 +24880,7 @@ async def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25103,7 +24940,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25119,7 +24955,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25191,7 +25026,6 @@ async def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25206,7 +25040,7 @@ async def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25258,7 +25092,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25274,7 +25107,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25345,7 +25177,6 @@ async def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25360,7 +25191,7 @@ async def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25410,7 +25241,6 @@ async def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25425,7 +25255,7 @@ async def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25474,7 +25304,6 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25489,7 +25318,7 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25642,7 +25471,6 @@ async def create_or_update_swift_virtual_network_connection_slot( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25657,7 +25485,7 @@ async def create_or_update_swift_virtual_network_connection_slot( # pylint: dis error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25706,7 +25534,6 @@ async def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25870,7 +25697,6 @@ async def update_swift_virtual_network_connection_slot( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25885,7 +25711,7 @@ async def update_swift_virtual_network_connection_slot( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25937,7 +25763,6 @@ async def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25954,7 +25779,7 @@ async def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26006,7 +25831,6 @@ async def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26021,11 +25845,7 @@ async def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26089,7 +25909,6 @@ async def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26104,7 +25923,7 @@ async def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26120,7 +25939,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26133,7 +25952,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -26147,10 +25966,10 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26158,15 +25977,15 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26228,10 +26047,11 @@ async def begin_start_web_site_network_trace_operation_slot( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26294,7 +26114,6 @@ async def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26357,7 +26176,6 @@ async def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26372,7 +26190,7 @@ async def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26424,7 +26242,6 @@ async def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26439,11 +26256,7 @@ async def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26495,7 +26308,6 @@ async def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26510,7 +26322,7 @@ async def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26559,7 +26371,6 @@ async def generate_new_site_publishing_password_slot( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26628,7 +26439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26644,7 +26454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26716,7 +26525,6 @@ async def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26731,7 +26539,7 @@ async def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26780,7 +26588,6 @@ async def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26795,7 +26602,7 @@ async def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26847,7 +26654,6 @@ async def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26862,7 +26668,7 @@ async def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27005,7 +26811,6 @@ async def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27020,7 +26825,7 @@ async def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27072,7 +26877,6 @@ async def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27226,7 +27030,6 @@ async def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27241,7 +27044,7 @@ async def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27291,7 +27094,6 @@ async def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27306,7 +27108,7 @@ async def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27442,7 +27244,6 @@ async def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27457,7 +27258,7 @@ async def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27505,7 +27306,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27520,7 +27320,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27534,7 +27334,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.PrivateEndpointConnectionResource, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnectionResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27548,7 +27348,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -27570,10 +27370,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27581,15 +27381,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27714,10 +27514,11 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27741,7 +27542,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27754,7 +27555,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -27765,10 +27566,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27776,18 +27577,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27831,10 +27629,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27892,7 +27691,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27907,7 +27705,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27961,7 +27759,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27977,7 +27774,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28052,7 +27848,6 @@ async def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28069,7 +27864,7 @@ async def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28123,7 +27918,6 @@ async def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28186,9 +27980,9 @@ async def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28197,13 +27991,17 @@ async def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28261,7 +28059,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28277,7 +28074,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28355,7 +28151,6 @@ async def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28372,7 +28167,7 @@ async def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28428,7 +28223,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28444,7 +28238,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28520,7 +28313,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28536,7 +28328,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28611,7 +28402,6 @@ async def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28626,7 +28416,7 @@ async def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28771,7 +28561,6 @@ async def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28786,7 +28575,7 @@ async def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28838,7 +28627,6 @@ async def delete_public_certificate_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28987,9 +28775,9 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28998,11 +28786,15 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29053,7 +28845,6 @@ async def reset_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29128,7 +28919,6 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29146,14 +28936,14 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29167,7 +28957,7 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29189,10 +28979,10 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29200,12 +28990,20 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob_slot( @@ -29308,7 +29106,7 @@ async def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -29320,6 +29118,7 @@ async def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29341,14 +29140,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29362,7 +29161,7 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29384,10 +29183,10 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29395,12 +29194,20 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app_slot( @@ -29503,7 +29310,7 @@ async def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -29515,6 +29322,7 @@ async def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29536,14 +29344,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29557,7 +29365,7 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29579,10 +29387,10 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29590,12 +29398,20 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot_slot( @@ -29701,7 +29517,7 @@ async def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_slot_initial( # type: ignore + raw_result = await self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -29713,6 +29529,7 @@ async def begin_restore_snapshot_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29780,7 +29597,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29796,7 +29612,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29871,7 +29686,6 @@ async def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29888,7 +29702,7 @@ async def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29897,7 +29711,7 @@ async def get_site_extension_slot( async def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29910,7 +29724,7 @@ async def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -29922,10 +29736,10 @@ async def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29933,16 +29747,15 @@ async def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29992,10 +29805,11 @@ async def begin_install_site_extension_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30062,7 +29876,6 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30080,14 +29893,14 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _copy_slot_initial( # pylint: disable=inconsistent-return-statements + async def _copy_slot_initial( self, resource_group_name: str, name: str, slot: str, copy_slot_entity: Union[_models.CsmCopySlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30101,7 +29914,7 @@ async def _copy_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30123,10 +29936,10 @@ async def _copy_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30134,12 +29947,20 @@ async def _copy_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_copy_slot( @@ -30245,7 +30066,7 @@ async def begin_copy_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._copy_slot_initial( # type: ignore + raw_result = await self._copy_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -30257,6 +30078,7 @@ async def begin_copy_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30409,7 +30231,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30425,7 +30246,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30455,14 +30275,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30476,7 +30296,7 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30498,10 +30318,10 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30509,12 +30329,20 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot( @@ -30617,7 +30445,7 @@ async def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_initial( # type: ignore + raw_result = await self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -30629,6 +30457,7 @@ async def begin_swap_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30694,7 +30523,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30710,7 +30538,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30784,7 +30611,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30800,7 +30626,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30872,7 +30697,6 @@ async def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30887,14 +30711,7 @@ async def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30908,7 +30725,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30922,7 +30739,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30944,10 +30761,10 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30955,18 +30772,15 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31094,10 +30908,11 @@ async def begin_create_or_update_source_control_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31161,7 +30976,6 @@ async def delete_source_control_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31307,7 +31121,6 @@ async def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31322,14 +31135,7 @@ async def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31378,7 +31184,6 @@ async def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31405,7 +31210,7 @@ async def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31418,7 +31223,7 @@ async def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -31432,10 +31237,10 @@ async def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31443,15 +31248,15 @@ async def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31513,10 +31318,11 @@ async def begin_start_network_trace_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31580,7 +31386,6 @@ async def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31639,7 +31444,6 @@ async def stop_network_trace_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31699,7 +31503,6 @@ async def sync_repository_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31758,7 +31561,6 @@ async def sync_function_triggers_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31822,7 +31624,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31838,7 +31639,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31913,7 +31713,6 @@ async def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31930,7 +31729,7 @@ async def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31982,7 +31781,6 @@ async def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32049,7 +31847,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32065,7 +31862,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32143,7 +31939,6 @@ async def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32160,7 +31955,7 @@ async def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32212,7 +32007,6 @@ async def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32282,7 +32076,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32298,7 +32091,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32370,7 +32162,6 @@ async def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32385,7 +32176,7 @@ async def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32437,7 +32228,6 @@ async def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32452,7 +32242,7 @@ async def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32603,7 +32393,6 @@ async def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32618,7 +32407,7 @@ async def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32670,7 +32459,6 @@ async def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32832,7 +32620,6 @@ async def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32847,7 +32634,7 @@ async def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32903,7 +32690,6 @@ async def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32920,7 +32706,7 @@ async def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33076,7 +32862,6 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33091,7 +32876,7 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33247,7 +33032,6 @@ async def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33262,7 +33046,7 @@ async def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33314,7 +33098,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33330,7 +33113,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33405,7 +33187,6 @@ async def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33420,7 +33201,7 @@ async def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33545,7 +33326,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33561,7 +33341,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33591,13 +33370,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33611,7 +33390,7 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33632,10 +33411,10 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33643,12 +33422,20 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot_with_production( @@ -33739,7 +33526,7 @@ async def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_with_production_initial( # type: ignore + raw_result = await self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -33750,6 +33537,7 @@ async def begin_swap_slot_with_production( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -33810,7 +33598,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33826,7 +33613,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33897,7 +33683,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33913,7 +33698,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33979,7 +33763,6 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33994,14 +33777,7 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34014,7 +33790,7 @@ async def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34028,7 +33804,7 @@ async def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -34049,10 +33825,10 @@ async def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34060,18 +33836,15 @@ async def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34186,10 +33959,11 @@ async def begin_create_or_update_source_control( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -34249,7 +34023,6 @@ async def delete_source_control( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34382,7 +34155,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34397,14 +34169,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34449,7 +34214,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34475,7 +34239,7 @@ async def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34488,7 +34252,7 @@ async def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -34501,10 +34265,10 @@ async def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34512,15 +34276,15 @@ async def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34578,10 +34342,11 @@ async def begin_start_network_trace( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -34641,7 +34406,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34697,7 +34461,6 @@ async def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34753,7 +34516,6 @@ async def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34809,7 +34571,6 @@ async def sync_function_triggers( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34869,7 +34630,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34885,7 +34645,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34956,7 +34715,6 @@ async def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34973,7 +34731,7 @@ async def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35021,7 +34779,6 @@ async def delete_triggered_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35084,7 +34841,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35100,7 +34856,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35174,7 +34929,6 @@ async def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35191,7 +34945,7 @@ async def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35239,7 +34993,6 @@ async def run_triggered_web_job( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35305,7 +35058,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35321,7 +35073,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35387,7 +35138,6 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35402,7 +35152,7 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35450,7 +35200,6 @@ async def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35465,7 +35214,7 @@ async def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35603,7 +35352,6 @@ async def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35618,7 +35366,7 @@ async def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35666,7 +35414,6 @@ async def delete_vnet_connection( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35815,7 +35562,6 @@ async def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35830,7 +35576,7 @@ async def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35882,7 +35628,6 @@ async def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35899,7 +35644,7 @@ async def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36042,7 +35787,6 @@ async def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36057,7 +35801,7 @@ async def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36200,7 +35944,6 @@ async def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36215,7 +35958,7 @@ async def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36261,7 +36004,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36277,7 +36019,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36348,7 +36089,6 @@ async def get_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36363,7 +36103,7 @@ async def get_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_site_management_client_operations.py index a99e800607ca2..d97951639c8f0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/aio/operations/_web_site_management_client_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_site_management_client_operations import ( build_check_name_availability_request, build_get_publishing_user_request, @@ -96,7 +94,6 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +108,7 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -200,7 +197,6 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,7 +253,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -273,7 +268,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -337,7 +331,6 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -352,7 +345,7 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +453,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -475,7 +467,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -526,7 +518,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -542,7 +533,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +610,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -635,7 +624,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -675,7 +664,6 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -690,7 +678,7 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,7 +744,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -772,7 +759,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -892,7 +878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -908,7 +893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +958,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -990,7 +973,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1052,7 +1034,6 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1067,7 +1048,7 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1147,6 @@ async def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1181,7 +1161,7 @@ async def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1294,7 +1274,6 @@ async def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1414,7 +1393,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1429,7 +1407,7 @@ async def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1542,7 +1520,6 @@ async def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_certificate_orders_operations.py index 5c9623640622e..630ade99352ad 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -866,7 +867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -882,7 +882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1001,7 +1000,6 @@ def validate_purchase_information( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1075,7 +1072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1143,7 +1139,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1158,7 +1153,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1171,7 +1166,7 @@ def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1185,7 +1180,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1206,10 +1201,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1217,15 +1212,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1342,10 +1337,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1405,7 +1401,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1540,7 +1535,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1555,11 +1549,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1609,7 +1599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1625,7 +1614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1696,7 +1684,6 @@ def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1711,7 +1698,7 @@ def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1725,7 +1712,7 @@ def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1739,7 +1726,7 @@ def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1761,10 +1748,10 @@ def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1772,15 +1759,15 @@ def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1904,10 +1891,11 @@ def begin_create_or_update_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1970,7 +1958,6 @@ def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2113,7 +2100,6 @@ def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2128,11 +2114,7 @@ def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2254,7 +2236,6 @@ def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2387,7 +2368,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2443,7 +2423,6 @@ def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2574,7 +2553,6 @@ def resend_request_emails( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2705,7 +2683,6 @@ def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2720,7 +2697,7 @@ def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2765,7 +2742,6 @@ def verify_domain_ownership( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2821,7 +2797,6 @@ def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2836,7 +2811,7 @@ def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2881,7 +2856,6 @@ def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2896,7 +2870,7 @@ def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_environments_operations.py index b78089359978c..8a1e9bc31ec78 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1478,7 +1479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1494,7 +1494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1564,7 +1563,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1580,7 +1578,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1646,7 +1643,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1661,7 +1657,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1674,7 +1670,7 @@ def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1688,7 +1684,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1709,10 +1705,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1720,18 +1716,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1848,10 +1841,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1873,9 +1867,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1888,7 +1882,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -1899,10 +1893,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1910,12 +1904,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -1946,7 +1948,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -1956,6 +1958,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2094,7 +2097,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2109,14 +2111,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2162,7 +2157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2178,7 +2172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2244,7 +2237,6 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2259,7 +2251,7 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2272,7 +2264,7 @@ def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2286,7 +2278,7 @@ def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2307,10 +2299,10 @@ def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2318,15 +2310,15 @@ def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2455,7 +2447,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2471,13 +2462,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2514,6 +2504,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2579,7 +2570,6 @@ def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2594,7 +2584,7 @@ def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2642,7 +2632,6 @@ def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2657,7 +2646,7 @@ def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2707,7 +2696,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2723,7 +2711,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2794,7 +2781,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2810,7 +2796,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2876,7 +2861,6 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2891,7 +2875,7 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2904,7 +2888,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2918,7 +2902,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2939,10 +2923,10 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2950,15 +2934,15 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3069,10 +3053,11 @@ def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3208,7 +3193,6 @@ def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3223,11 +3207,7 @@ def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3282,7 +3262,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3298,7 +3277,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3371,7 +3349,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3387,7 +3364,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3458,7 +3434,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3474,7 +3449,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3543,7 +3517,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3559,7 +3532,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3625,7 +3597,6 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3640,7 +3611,7 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3690,7 +3661,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3706,7 +3676,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3774,7 +3743,6 @@ def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3792,7 +3760,7 @@ def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3805,7 +3773,7 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -3815,10 +3783,10 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3826,15 +3794,15 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3883,7 +3851,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3899,13 +3866,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3940,6 +3906,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -4008,7 +3975,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4024,7 +3990,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4099,7 +4064,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4115,7 +4079,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4145,7 +4108,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4158,7 +4121,7 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -4168,10 +4131,10 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4179,15 +4142,15 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4236,7 +4199,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4252,13 +4214,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4293,6 +4254,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -4367,7 +4329,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4383,7 +4344,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4454,7 +4414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4470,7 +4429,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4541,7 +4499,6 @@ def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4556,7 +4513,7 @@ def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4570,7 +4527,7 @@ def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4584,7 +4541,7 @@ def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4606,10 +4563,10 @@ def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4617,15 +4574,15 @@ def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4745,10 +4702,11 @@ def begin_create_or_update_worker_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4893,7 +4851,6 @@ def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4908,11 +4865,7 @@ def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4968,7 +4921,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4984,7 +4936,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5060,7 +5011,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5076,7 +5026,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5150,7 +5099,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5166,7 +5114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5240,7 +5187,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5256,7 +5202,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_plans_operations.py index bf0f846fde89b..e07ef0719946d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1161,7 +1162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1243,7 +1242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1259,7 +1257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1325,7 +1322,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1342,7 +1338,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1355,7 +1351,7 @@ def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1369,7 +1365,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1390,10 +1386,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1401,15 +1397,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1519,10 +1515,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1582,7 +1579,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1714,7 +1710,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1729,11 +1724,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1776,7 +1767,6 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1791,7 +1781,7 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1842,7 +1832,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1857,7 +1846,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1908,7 +1897,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1970,7 +1958,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1985,7 +1972,7 @@ def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2039,7 +2026,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2055,7 +2041,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2123,7 +2108,6 @@ def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2138,7 +2122,7 @@ def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2186,7 +2170,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2202,7 +2185,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2276,7 +2258,6 @@ def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2354,7 +2335,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2370,7 +2350,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2436,7 +2415,6 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2451,7 +2429,7 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2504,7 +2482,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2520,7 +2497,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2586,7 +2562,6 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2601,7 +2576,7 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2649,7 +2624,6 @@ def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2666,7 +2640,7 @@ def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2717,7 +2691,6 @@ def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2732,7 +2705,7 @@ def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2872,7 +2845,6 @@ def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2887,7 +2859,7 @@ def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2935,7 +2907,6 @@ def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2950,7 +2921,7 @@ def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3001,7 +2972,6 @@ def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3018,7 +2988,7 @@ def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3158,7 +3128,6 @@ def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3175,7 +3144,7 @@ def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3226,7 +3195,6 @@ def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3377,7 +3345,6 @@ def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3394,7 +3361,7 @@ def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3442,7 +3409,6 @@ def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificate_registration_provider_operations.py index 3c1d4fe23e235..98f5bf227beea 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificate_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificates_operations.py index 814ef159a534b..abc0b6f25a783 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_certificates_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -306,7 +305,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -322,7 +320,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -388,7 +385,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -404,7 +400,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -470,7 +465,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -485,7 +479,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -605,7 +599,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -620,7 +613,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -665,7 +658,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -797,7 +789,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -812,7 +803,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_deleted_web_apps_operations.py index 53d7193a52fff..3478365a37246 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_deleted_web_apps_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -176,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -192,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -342,7 +337,6 @@ def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +351,7 @@ def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_diagnostics_operations.py index fc2bab1fdbc96..2a07baeb506a1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1101,7 +1100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1117,7 +1115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1204,7 +1201,6 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1219,7 +1215,7 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1267,7 +1263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1283,7 +1278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1370,7 +1364,6 @@ def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1385,7 +1378,7 @@ def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1433,7 +1426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1449,7 +1441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1520,7 +1511,6 @@ def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1535,7 +1525,7 @@ def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1602,7 +1591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1676,7 +1664,6 @@ def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1678,7 @@ def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1759,7 +1746,6 @@ def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,7 +1760,7 @@ def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1825,7 +1811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1841,7 +1826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1915,7 +1899,6 @@ def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1930,7 +1913,7 @@ def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,7 +1981,6 @@ def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2013,7 +1995,7 @@ def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,7 +2046,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2080,7 +2061,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2171,7 +2151,6 @@ def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2186,7 +2165,7 @@ def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2237,7 +2216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2253,7 +2231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2327,7 +2304,6 @@ def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2342,7 +2318,7 @@ def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2396,7 +2372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2412,7 +2387,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2495,7 +2469,6 @@ def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2510,7 +2483,7 @@ def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2582,7 +2555,6 @@ def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2597,7 +2569,7 @@ def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2651,7 +2623,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2667,7 +2638,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2750,7 +2720,6 @@ def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2765,7 +2734,7 @@ def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2837,7 +2806,6 @@ def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2852,7 +2820,7 @@ def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domain_registration_provider_operations.py index 5c4569d08f3a9..37525064b001c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domain_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domains_operations.py index 4367ed0f0b293..5bee4aeaa66c7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -694,7 +695,6 @@ def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -709,7 +709,7 @@ def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -749,7 +749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -765,7 +764,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -825,7 +823,6 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -840,7 +837,7 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -937,7 +934,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -953,7 +949,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1019,7 +1014,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1035,7 +1029,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1101,7 +1094,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1116,7 +1108,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1125,7 +1117,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1139,7 +1131,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1160,10 +1152,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1171,15 +1163,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1282,10 +1274,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1350,7 +1343,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1481,7 +1473,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1496,11 +1487,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1550,7 +1537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1566,7 +1552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1637,7 +1622,6 @@ def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1652,7 +1636,7 @@ def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1791,7 +1775,6 @@ def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1806,7 +1789,7 @@ def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1854,7 +1837,6 @@ def delete_ownership_identifier( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2004,7 +1986,6 @@ def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2019,7 +2000,7 @@ def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,7 +2045,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_provider_operations.py index 4f816a14c5ba2..a966dea0fa166 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -171,7 +170,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -187,7 +185,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -253,7 +250,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -269,7 +265,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -340,7 +335,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -356,7 +350,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_recommendations_operations.py index cf28f53e487f1..b61dd7a36153c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_recommendations_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -730,7 +729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -746,7 +744,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -806,7 +803,6 @@ def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -859,7 +855,6 @@ def disable_recommendation_for_subscription( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -933,7 +928,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -949,7 +943,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1034,7 +1027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1050,7 +1042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1121,7 +1112,6 @@ def disable_all_for_hosting_environment( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1180,7 +1170,6 @@ def reset_all_filters_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1253,7 +1242,6 @@ def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1268,7 +1256,7 @@ def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1319,7 +1307,6 @@ def disable_recommendation_for_hosting_environment( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1393,7 +1380,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1409,7 +1395,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1494,7 +1479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1510,7 +1494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1578,7 +1561,6 @@ def disable_all_for_web_app( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1634,7 +1616,6 @@ def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1688,6 @@ def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1722,7 +1702,7 @@ def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1770,7 +1750,6 @@ def disable_recommendation_for_site( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_resource_health_metadata_operations.py index 1c3c75f0ec9b5..598e44062759c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_resource_health_metadata_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -389,7 +386,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -405,7 +401,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -477,7 +472,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -493,7 +487,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -559,7 +552,6 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +566,7 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -627,7 +619,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -643,7 +634,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -715,7 +705,6 @@ def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -730,7 +719,7 @@ def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_static_sites_operations.py index bb86451053ae0..ae93ae555a709 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_static_sites_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1103,7 +1102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1119,7 +1117,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1188,7 +1185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1204,7 +1200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1270,7 +1265,6 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1285,7 +1279,7 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1408,7 +1402,6 @@ def create_or_update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1423,11 +1416,7 @@ def create_or_update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1472,7 +1461,6 @@ def delete_static_site( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1606,7 +1594,6 @@ def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1621,11 +1608,7 @@ def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1678,7 +1661,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1694,7 +1676,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1768,7 +1749,6 @@ def delete_static_site_user( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1922,7 +1902,6 @@ def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1937,7 +1916,7 @@ def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1987,7 +1966,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2003,7 +1981,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2074,7 +2051,6 @@ def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2089,7 +2065,7 @@ def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2137,7 +2113,6 @@ def delete_static_site_build( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2277,7 +2252,6 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2292,11 +2266,7 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2349,7 +2319,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2365,7 +2334,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2436,7 +2404,6 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2451,11 +2418,7 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2574,7 +2537,6 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2589,11 +2551,7 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2717,7 +2675,6 @@ def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2732,7 +2689,7 @@ def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2782,7 +2739,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2798,7 +2754,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2869,7 +2824,6 @@ def create_or_update_static_site_custom_domain( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2884,11 +2838,7 @@ def create_or_update_static_site_custom_domain( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2936,7 +2886,6 @@ def delete_static_site_custom_domain( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2995,7 +2944,6 @@ def validate_custom_domain_can_be_added_to_static_site( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3051,7 +2999,6 @@ def detach_static_site( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3112,7 +3059,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3128,7 +3074,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3196,7 +3141,6 @@ def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3211,11 +3155,7 @@ def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3258,7 +3198,6 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3273,7 +3212,7 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3395,7 +3334,6 @@ def reset_static_site_api_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_top_level_domains_operations.py index 4eb2a7631747a..73a727fa64563 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_top_level_domains_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_apps_operations.py index 945b6a32abcca..d90a81c777327 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_apps_operations.py @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -15195,7 +15196,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15211,7 +15211,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15284,7 +15283,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15300,7 +15298,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15366,7 +15363,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15383,7 +15379,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15392,7 +15388,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15406,7 +15402,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15427,10 +15423,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15438,15 +15434,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15558,10 +15554,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15633,7 +15630,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15773,7 +15769,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15788,11 +15783,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15840,7 +15831,6 @@ def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15855,7 +15845,7 @@ def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15975,7 +15965,6 @@ def apply_slot_config_to_production( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16104,7 +16093,6 @@ def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16119,7 +16107,7 @@ def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16165,7 +16153,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16181,7 +16168,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16252,7 +16238,6 @@ def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16267,7 +16252,7 @@ def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16315,7 +16300,6 @@ def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16468,7 +16452,6 @@ def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16483,21 +16466,21 @@ def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_initial( # pylint: disable=inconsistent-return-statements + def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16511,7 +16494,7 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16533,10 +16516,10 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16544,12 +16527,20 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore( @@ -16649,7 +16640,7 @@ def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_initial( # type: ignore + raw_result = self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -16661,6 +16652,7 @@ def begin_restore( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16720,7 +16712,6 @@ def get_basic_publishing_credentials_policies( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16735,7 +16726,7 @@ def get_basic_publishing_credentials_policies( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16780,7 +16771,6 @@ def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16795,7 +16785,7 @@ def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16919,7 +16909,6 @@ def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16934,7 +16923,7 @@ def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16979,7 +16968,6 @@ def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16994,7 +16982,7 @@ def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17118,7 +17106,6 @@ def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17133,7 +17120,7 @@ def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17181,7 +17168,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17197,7 +17183,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17340,7 +17325,6 @@ def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17355,7 +17339,7 @@ def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17398,7 +17382,6 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17413,7 +17396,7 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17533,7 +17516,6 @@ def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17548,7 +17530,7 @@ def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17591,7 +17573,6 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17606,7 +17587,7 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17728,7 +17709,6 @@ def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17743,7 +17723,7 @@ def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17788,7 +17768,6 @@ def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17803,7 +17782,7 @@ def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17919,7 +17898,6 @@ def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17934,7 +17912,7 @@ def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17979,7 +17957,6 @@ def delete_backup_configuration( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18033,7 +18010,6 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18048,7 +18024,7 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18093,7 +18069,6 @@ def get_app_settings_key_vault_references( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18108,7 +18083,7 @@ def get_app_settings_key_vault_references( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KeyVaultReferenceCollection", pipeline_response) + deserialized = self._deserialize("KeyVaultReferenceCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18156,7 +18131,6 @@ def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18171,7 +18145,7 @@ def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KeyVaultReferenceResource", pipeline_response) + deserialized = self._deserialize("KeyVaultReferenceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18294,7 +18268,6 @@ def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18309,7 +18282,7 @@ def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18354,7 +18327,6 @@ def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18369,7 +18341,7 @@ def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18414,7 +18386,6 @@ def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18429,7 +18400,7 @@ def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18552,7 +18523,6 @@ def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18567,7 +18537,7 @@ def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18683,7 +18653,6 @@ def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18698,7 +18667,7 @@ def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18741,7 +18710,6 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18756,14 +18724,16 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _list_publishing_credentials_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.User: + def _list_publishing_credentials_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18776,7 +18746,7 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -18786,10 +18756,10 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -18797,11 +18767,15 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18842,10 +18816,11 @@ def begin_list_publishing_credentials( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -18976,7 +18951,6 @@ def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18991,7 +18965,7 @@ def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19034,7 +19008,6 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19049,7 +19022,7 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19094,7 +19067,6 @@ def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19109,7 +19081,7 @@ def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19238,7 +19210,6 @@ def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19253,7 +19224,7 @@ def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19298,7 +19269,6 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19313,7 +19283,7 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19433,7 +19403,6 @@ def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19448,7 +19417,7 @@ def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19568,7 +19537,6 @@ def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19583,7 +19551,7 @@ def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19635,7 +19603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19651,7 +19618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19722,7 +19688,6 @@ def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19737,7 +19702,7 @@ def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19785,7 +19750,6 @@ def recover_site_configuration_snapshot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19841,9 +19805,9 @@ def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19852,12 +19816,16 @@ def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19900,9 +19868,9 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19911,12 +19879,16 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19964,7 +19936,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19980,7 +19951,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20051,7 +20021,6 @@ def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20068,7 +20037,7 @@ def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20116,7 +20085,6 @@ def delete_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20175,7 +20143,6 @@ def start_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20234,7 +20201,6 @@ def stop_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20291,7 +20257,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20307,7 +20272,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20376,7 +20340,6 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20391,7 +20354,7 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20521,7 +20484,6 @@ def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20536,7 +20498,7 @@ def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20584,7 +20546,6 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20642,7 +20603,6 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20657,7 +20617,7 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20781,7 +20741,6 @@ def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20796,7 +20755,7 @@ def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20844,7 +20803,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20860,7 +20818,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20931,7 +20888,6 @@ def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20946,7 +20902,7 @@ def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21078,7 +21034,6 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21093,7 +21048,7 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21141,7 +21096,6 @@ def delete_domain_ownership_identifier( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21284,7 +21238,6 @@ def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21299,7 +21252,7 @@ def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21342,7 +21295,6 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21357,7 +21309,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21366,7 +21318,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21380,7 +21332,7 @@ def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21401,10 +21353,10 @@ def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21412,13 +21364,15 @@ def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21524,10 +21478,11 @@ def begin_create_ms_deploy_operation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21585,7 +21540,6 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21602,7 +21556,7 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21650,7 +21604,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21666,7 +21619,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21732,7 +21684,6 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21747,7 +21698,7 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21795,7 +21746,6 @@ def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21812,7 +21762,7 @@ def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21826,7 +21776,7 @@ def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21840,7 +21790,7 @@ def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21862,10 +21812,10 @@ def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21873,11 +21823,15 @@ def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21997,10 +21951,11 @@ def begin_create_function( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22063,7 +22018,6 @@ def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22214,7 +22168,6 @@ def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22229,11 +22182,7 @@ def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22284,7 +22233,6 @@ def delete_function_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22343,7 +22291,6 @@ def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22358,7 +22305,7 @@ def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22406,7 +22353,6 @@ def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22421,7 +22367,7 @@ def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22464,7 +22410,6 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22479,7 +22424,7 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22524,7 +22469,6 @@ def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22580,7 +22524,6 @@ def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22731,7 +22674,6 @@ def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22746,11 +22688,7 @@ def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22801,7 +22739,6 @@ def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22860,7 +22797,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22876,7 +22812,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22947,7 +22882,6 @@ def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22962,7 +22896,7 @@ def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23094,7 +23028,6 @@ def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23109,7 +23042,7 @@ def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23157,7 +23090,6 @@ def delete_host_name_binding( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23219,7 +23151,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23234,7 +23165,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23374,7 +23305,6 @@ def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23389,7 +23319,7 @@ def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23440,7 +23370,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23591,7 +23520,6 @@ def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23606,7 +23534,7 @@ def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23649,7 +23577,6 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23664,7 +23591,7 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23709,7 +23636,6 @@ def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23724,7 +23650,7 @@ def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23772,7 +23698,6 @@ def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23787,7 +23712,7 @@ def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23918,7 +23843,6 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23933,7 +23857,7 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23981,7 +23905,6 @@ def delete_relay_service_connection( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24123,7 +24046,6 @@ def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24138,7 +24060,7 @@ def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24186,7 +24108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24202,7 +24123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24273,7 +24193,6 @@ def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24288,7 +24207,7 @@ def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24336,7 +24255,6 @@ def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24351,7 +24269,7 @@ def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24365,7 +24283,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24379,7 +24297,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24401,10 +24319,10 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24412,13 +24330,15 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24538,10 +24458,11 @@ def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24604,7 +24525,6 @@ def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24621,7 +24541,7 @@ def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24675,7 +24595,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24691,7 +24610,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24766,7 +24684,6 @@ def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24783,7 +24700,7 @@ def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24837,7 +24754,6 @@ def delete_instance_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24900,9 +24816,9 @@ def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24911,13 +24827,17 @@ def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24974,7 +24894,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24990,7 +24909,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25068,7 +24986,6 @@ def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25085,7 +25002,7 @@ def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25140,7 +25057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25156,7 +25072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25222,7 +25137,6 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25237,7 +25151,7 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25283,7 +25197,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25299,7 +25212,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25367,7 +25279,6 @@ def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25382,7 +25293,7 @@ def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25396,7 +25307,7 @@ def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25410,7 +25321,7 @@ def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25432,10 +25343,10 @@ def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25443,11 +25354,15 @@ def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25571,10 +25486,11 @@ def begin_migrate_storage( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25602,7 +25518,7 @@ def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25616,7 +25532,7 @@ def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25637,10 +25553,10 @@ def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25648,11 +25564,15 @@ def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25760,10 +25680,11 @@ def begin_migrate_my_sql( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25825,7 +25746,6 @@ def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25840,7 +25760,7 @@ def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25885,7 +25805,6 @@ def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25900,7 +25819,7 @@ def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26040,7 +25959,6 @@ def create_or_update_swift_virtual_network_connection( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26055,7 +25973,7 @@ def create_or_update_swift_virtual_network_connection( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26100,7 +26018,6 @@ def delete_swift_virtual_network( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26251,7 +26168,6 @@ def update_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26266,7 +26182,7 @@ def update_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26314,7 +26230,6 @@ def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26331,7 +26246,7 @@ def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26379,7 +26294,6 @@ def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26394,11 +26308,7 @@ def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26458,7 +26368,6 @@ def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26473,7 +26382,7 @@ def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26488,7 +26397,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26501,7 +26410,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -26514,10 +26423,10 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26525,15 +26434,15 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26590,10 +26499,11 @@ def begin_start_web_site_network_trace_operation( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26653,7 +26563,6 @@ def stop_web_site_network_trace( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26712,7 +26621,6 @@ def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26727,7 +26635,7 @@ def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26775,7 +26683,6 @@ def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26790,11 +26697,7 @@ def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26842,7 +26745,6 @@ def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26857,7 +26759,7 @@ def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26902,7 +26804,6 @@ def generate_new_site_publishing_password( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26966,7 +26867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26982,7 +26882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27050,7 +26949,6 @@ def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27065,7 +26963,7 @@ def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27108,7 +27006,6 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27123,7 +27020,7 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27171,7 +27068,6 @@ def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27186,7 +27082,7 @@ def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27316,7 +27212,6 @@ def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27331,7 +27226,7 @@ def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27379,7 +27274,6 @@ def delete_premier_add_on( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27520,7 +27414,6 @@ def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27535,7 +27428,7 @@ def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27580,7 +27473,6 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27595,7 +27487,7 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27717,7 +27609,6 @@ def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27732,7 +27623,7 @@ def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27780,7 +27671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27796,7 +27686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27867,7 +27756,6 @@ def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27884,7 +27772,7 @@ def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27934,7 +27822,6 @@ def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27993,9 +27880,9 @@ def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28004,13 +27891,17 @@ def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28063,7 +27954,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28079,7 +27969,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28153,7 +28042,6 @@ def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28170,7 +28058,7 @@ def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28221,7 +28109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28237,7 +28124,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28308,7 +28194,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28324,7 +28209,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28395,7 +28279,6 @@ def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28410,7 +28293,7 @@ def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28542,7 +28425,6 @@ def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28557,7 +28439,7 @@ def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28605,7 +28487,6 @@ def delete_public_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28741,9 +28622,9 @@ def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28752,11 +28633,15 @@ def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28803,7 +28688,6 @@ def reset_production_slot_config( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28873,7 +28757,6 @@ def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28891,9 +28774,9 @@ def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28907,7 +28790,7 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28928,10 +28811,10 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28939,12 +28822,20 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob( @@ -29031,7 +28922,7 @@ def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_initial( # type: ignore + raw_result = self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -29042,6 +28933,7 @@ def begin_restore_from_backup_blob( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29063,13 +28955,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29083,7 +28975,7 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29104,10 +28996,10 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29115,12 +29007,20 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app( @@ -29211,7 +29111,7 @@ def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_initial( # type: ignore + raw_result = self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -29222,6 +29122,7 @@ def begin_restore_from_deleted_app( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29243,13 +29144,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29263,7 +29164,7 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29284,10 +29185,10 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29295,12 +29196,20 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot( @@ -29394,7 +29303,7 @@ def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_initial( # type: ignore + raw_result = self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -29405,6 +29314,7 @@ def begin_restore_snapshot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29467,7 +29377,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29483,7 +29392,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29554,7 +29462,6 @@ def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29571,7 +29478,7 @@ def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29580,7 +29487,7 @@ def get_site_extension( def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29593,7 +29500,7 @@ def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -29604,10 +29511,10 @@ def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29615,16 +29522,15 @@ def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29669,10 +29575,11 @@ def begin_install_site_extension( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29735,7 +29642,6 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29753,13 +29659,13 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statements + def _copy_production_slot_initial( self, resource_group_name: str, name: str, copy_slot_entity: Union[_models.CsmCopySlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29773,7 +29679,7 @@ def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statem api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29794,10 +29700,10 @@ def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29805,12 +29711,20 @@ def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_copy_production_slot( @@ -29904,7 +29818,7 @@ def begin_copy_production_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._copy_production_slot_initial( # type: ignore + raw_result = self._copy_production_slot_initial( resource_group_name=resource_group_name, name=name, copy_slot_entity=copy_slot_entity, @@ -29915,6 +29829,7 @@ def begin_copy_production_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29975,7 +29890,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29991,7 +29905,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30061,7 +29974,6 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30078,7 +29990,7 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30092,7 +30004,7 @@ def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30106,7 +30018,7 @@ def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30128,10 +30040,10 @@ def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30139,15 +30051,15 @@ def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30276,10 +30188,11 @@ def begin_create_or_update_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30357,7 +30270,6 @@ def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30510,7 +30422,6 @@ def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30525,11 +30436,7 @@ def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30581,7 +30488,6 @@ def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30596,7 +30502,7 @@ def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30729,7 +30635,6 @@ def apply_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30875,7 +30780,6 @@ def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30890,7 +30794,7 @@ def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30942,7 +30846,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30958,7 +30861,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31033,7 +30935,6 @@ def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31048,7 +30949,7 @@ def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31100,7 +31001,6 @@ def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31266,7 +31166,6 @@ def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31281,14 +31180,14 @@ def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -31296,7 +31195,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31310,7 +31209,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31333,10 +31232,10 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31344,12 +31243,20 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_slot( @@ -31461,7 +31368,7 @@ def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_slot_initial( # type: ignore + raw_result = self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -31474,6 +31381,7 @@ def begin_restore_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31540,7 +31448,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31556,7 +31463,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31712,7 +31618,6 @@ def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31727,7 +31632,7 @@ def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31776,7 +31681,6 @@ def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31791,7 +31695,7 @@ def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31924,7 +31828,6 @@ def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31939,7 +31842,7 @@ def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31988,7 +31891,6 @@ def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32003,7 +31905,7 @@ def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32138,7 +32040,6 @@ def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32153,7 +32054,7 @@ def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32202,7 +32103,6 @@ def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32217,7 +32117,7 @@ def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32350,7 +32250,6 @@ def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32365,7 +32264,7 @@ def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32414,7 +32313,6 @@ def delete_backup_configuration_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32474,7 +32372,6 @@ def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32489,7 +32386,7 @@ def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32625,7 +32522,6 @@ def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32640,7 +32536,7 @@ def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32689,7 +32585,6 @@ def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32704,7 +32599,7 @@ def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32753,7 +32648,6 @@ def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32768,7 +32662,7 @@ def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32904,7 +32798,6 @@ def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32919,7 +32812,7 @@ def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33052,7 +32945,6 @@ def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33067,7 +32959,7 @@ def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33116,7 +33008,6 @@ def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33131,7 +33022,7 @@ def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33140,7 +33031,7 @@ def list_metadata_slot( def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33153,7 +33044,7 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -33164,10 +33055,10 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33175,11 +33066,15 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33224,10 +33119,11 @@ def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33375,7 +33271,6 @@ def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33390,7 +33285,7 @@ def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33439,7 +33334,6 @@ def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33454,7 +33348,7 @@ def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33505,7 +33399,6 @@ def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33520,7 +33413,7 @@ def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33653,7 +33546,6 @@ def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33668,7 +33560,7 @@ def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33801,7 +33693,6 @@ def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33816,7 +33707,7 @@ def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33872,7 +33763,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33888,7 +33778,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33963,7 +33852,6 @@ def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33978,7 +33866,7 @@ def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34030,7 +33918,6 @@ def recover_site_configuration_snapshot_slot( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34090,9 +33977,9 @@ def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -34101,12 +33988,16 @@ def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34155,9 +34046,9 @@ def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -34166,12 +34057,16 @@ def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34223,7 +34118,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34239,7 +34133,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34314,7 +34207,6 @@ def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34331,7 +34223,7 @@ def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34383,7 +34275,6 @@ def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34446,7 +34337,6 @@ def start_continuous_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34509,7 +34399,6 @@ def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34572,7 +34461,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34588,7 +34476,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34663,7 +34550,6 @@ def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34678,7 +34564,7 @@ def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34821,7 +34707,6 @@ def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34836,7 +34721,7 @@ def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34888,7 +34773,6 @@ def delete_deployment_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34952,7 +34836,6 @@ def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34967,7 +34850,7 @@ def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35108,7 +34991,6 @@ def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35123,7 +35005,7 @@ def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35175,7 +35057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35191,7 +35072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35266,7 +35146,6 @@ def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35281,7 +35160,7 @@ def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35426,7 +35305,6 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35441,7 +35319,7 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35493,7 +35371,6 @@ def delete_domain_ownership_identifier_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35649,7 +35526,6 @@ def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35664,7 +35540,7 @@ def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35713,7 +35589,6 @@ def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35728,7 +35603,7 @@ def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35742,7 +35617,7 @@ def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35756,7 +35631,7 @@ def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -35778,10 +35653,10 @@ def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35789,13 +35664,15 @@ def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35918,10 +35795,11 @@ def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -35985,7 +35863,6 @@ def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36002,7 +35879,7 @@ def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36053,7 +35930,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36069,7 +35945,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36139,7 +36014,6 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36154,7 +36028,7 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36205,7 +36079,6 @@ def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36222,7 +36095,7 @@ def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36237,7 +36110,7 @@ def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36251,7 +36124,7 @@ def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -36274,10 +36147,10 @@ def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36285,11 +36158,15 @@ def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36419,10 +36296,11 @@ def begin_create_instance_function_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36488,7 +36366,6 @@ def delete_instance_function_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36649,7 +36526,6 @@ def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36664,11 +36540,7 @@ def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36722,7 +36594,6 @@ def delete_function_secret_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36784,7 +36655,6 @@ def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36799,7 +36669,7 @@ def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36850,7 +36720,6 @@ def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36865,7 +36734,7 @@ def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36911,7 +36780,6 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36926,7 +36794,7 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36974,7 +36842,6 @@ def list_sync_status_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37033,7 +36900,6 @@ def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37194,7 +37060,6 @@ def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37209,11 +37074,7 @@ def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37267,7 +37128,6 @@ def delete_host_secret_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37330,7 +37190,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37346,7 +37205,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37421,7 +37279,6 @@ def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37436,7 +37293,7 @@ def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37581,7 +37438,6 @@ def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37596,7 +37452,7 @@ def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37648,7 +37504,6 @@ def delete_host_name_binding_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37713,7 +37568,6 @@ def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37728,7 +37582,7 @@ def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37878,7 +37732,6 @@ def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37893,7 +37746,7 @@ def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37947,7 +37800,6 @@ def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38108,7 +37960,6 @@ def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38123,7 +37974,7 @@ def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38171,7 +38022,6 @@ def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38186,7 +38036,7 @@ def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38235,7 +38085,6 @@ def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38250,7 +38099,7 @@ def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38302,7 +38151,6 @@ def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38317,7 +38165,7 @@ def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38461,7 +38309,6 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38476,7 +38323,7 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38528,7 +38375,6 @@ def delete_relay_service_connection_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38683,7 +38529,6 @@ def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38698,7 +38543,7 @@ def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38750,7 +38595,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38766,7 +38610,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38841,7 +38684,6 @@ def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38856,7 +38698,7 @@ def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38908,7 +38750,6 @@ def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38923,7 +38764,7 @@ def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38938,7 +38779,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -38952,7 +38793,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -38975,10 +38816,10 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -38986,13 +38827,15 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39125,10 +38968,11 @@ def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=name-too- params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -39195,7 +39039,6 @@ def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39212,7 +39055,7 @@ def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39270,7 +39113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39286,7 +39128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39365,7 +39206,6 @@ def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39382,7 +39222,7 @@ def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39440,7 +39280,6 @@ def delete_instance_process_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39507,9 +39346,9 @@ def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -39518,13 +39357,17 @@ def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39585,7 +39428,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39601,7 +39443,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39690,7 +39531,6 @@ def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39707,7 +39547,7 @@ def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39766,7 +39606,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39782,7 +39621,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39854,7 +39692,6 @@ def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39869,7 +39706,7 @@ def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39921,7 +39758,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39937,7 +39773,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40008,7 +39843,6 @@ def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40023,7 +39857,7 @@ def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40073,7 +39907,6 @@ def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40088,7 +39921,7 @@ def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40137,7 +39970,6 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40152,7 +39984,7 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40305,7 +40137,6 @@ def create_or_update_swift_virtual_network_connection_slot( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40320,7 +40151,7 @@ def create_or_update_swift_virtual_network_connection_slot( # pylint: disable=n error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40369,7 +40200,6 @@ def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40533,7 +40363,6 @@ def update_swift_virtual_network_connection_slot( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40548,7 +40377,7 @@ def update_swift_virtual_network_connection_slot( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40600,7 +40429,6 @@ def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40617,7 +40445,7 @@ def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40669,7 +40497,6 @@ def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40684,11 +40511,7 @@ def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40752,7 +40575,6 @@ def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40767,7 +40589,7 @@ def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40783,7 +40605,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -40796,7 +40618,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -40810,10 +40632,10 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -40821,15 +40643,15 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40890,10 +40712,11 @@ def begin_start_web_site_network_trace_operation_slot( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -40956,7 +40779,6 @@ def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41019,7 +40841,6 @@ def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41034,7 +40855,7 @@ def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41086,7 +40907,6 @@ def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41101,11 +40921,7 @@ def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41157,7 +40973,6 @@ def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41172,7 +40987,7 @@ def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41221,7 +41036,6 @@ def generate_new_site_publishing_password_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41289,7 +41103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41305,7 +41118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41377,7 +41189,6 @@ def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41392,7 +41203,7 @@ def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41441,7 +41252,6 @@ def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41456,7 +41266,7 @@ def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41508,7 +41318,6 @@ def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41523,7 +41332,7 @@ def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41666,7 +41475,6 @@ def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41681,7 +41489,7 @@ def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41733,7 +41541,6 @@ def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41887,7 +41694,6 @@ def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41902,7 +41708,7 @@ def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41952,7 +41758,6 @@ def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41967,7 +41772,7 @@ def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42103,7 +41908,6 @@ def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42118,7 +41922,7 @@ def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42166,7 +41970,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42181,7 +41984,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42195,7 +41998,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.PrivateEndpointConnectionResource, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnectionResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42209,7 +42012,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -42231,10 +42034,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -42242,15 +42045,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42375,10 +42178,11 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -42402,7 +42206,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42415,7 +42219,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -42426,10 +42230,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -42437,18 +42241,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42492,10 +42293,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -42553,7 +42355,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42568,7 +42369,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42622,7 +42423,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42638,7 +42438,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42713,7 +42512,6 @@ def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42730,7 +42528,7 @@ def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42784,7 +42582,6 @@ def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42847,9 +42644,9 @@ def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -42858,13 +42655,17 @@ def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42921,7 +42722,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42937,7 +42737,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43015,7 +42814,6 @@ def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43032,7 +42830,7 @@ def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43087,7 +42885,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43103,7 +42900,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43178,7 +42974,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43194,7 +42989,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43269,7 +43063,6 @@ def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43284,7 +43077,7 @@ def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43429,7 +43222,6 @@ def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43444,7 +43236,7 @@ def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43496,7 +43288,6 @@ def delete_public_certificate_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43645,9 +43436,9 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -43656,11 +43447,15 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43711,7 +43506,6 @@ def reset_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43786,7 +43580,6 @@ def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43804,14 +43597,14 @@ def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -43825,7 +43618,7 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -43847,10 +43640,10 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -43858,12 +43651,20 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob_slot( @@ -43966,7 +43767,7 @@ def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -43978,6 +43779,7 @@ def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -43999,14 +43801,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44020,7 +43822,7 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -44042,10 +43844,10 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44053,12 +43855,20 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app_slot( @@ -44161,7 +43971,7 @@ def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -44173,6 +43983,7 @@ def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -44194,14 +44005,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44215,7 +44026,7 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -44237,10 +44048,10 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44248,12 +44059,20 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot_slot( @@ -44359,7 +44178,7 @@ def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_slot_initial( # type: ignore + raw_result = self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -44371,6 +44190,7 @@ def begin_restore_snapshot_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -44437,7 +44257,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44453,7 +44272,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44528,7 +44346,6 @@ def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44545,7 +44362,7 @@ def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44554,7 +44371,7 @@ def get_site_extension_slot( def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44567,7 +44384,7 @@ def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -44579,10 +44396,10 @@ def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44590,16 +44407,15 @@ def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44648,10 +44464,11 @@ def begin_install_site_extension_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -44718,7 +44535,6 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44736,14 +44552,14 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) # type: ignore - def _copy_slot_initial( # pylint: disable=inconsistent-return-statements + def _copy_slot_initial( self, resource_group_name: str, name: str, slot: str, copy_slot_entity: Union[_models.CsmCopySlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44757,7 +44573,7 @@ def _copy_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -44779,10 +44595,10 @@ def _copy_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44790,12 +44606,20 @@ def _copy_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_copy_slot( @@ -44901,7 +44725,7 @@ def begin_copy_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._copy_slot_initial( # type: ignore + raw_result = self._copy_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -44913,6 +44737,7 @@ def begin_copy_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -45062,7 +44887,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45078,7 +44902,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45108,14 +44931,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45129,7 +44952,7 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -45151,10 +44974,10 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45162,12 +44985,20 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot( @@ -45270,7 +45101,7 @@ def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_initial( # type: ignore + raw_result = self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -45282,6 +45113,7 @@ def begin_swap_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -45347,7 +45179,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45363,7 +45194,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45437,7 +45267,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45453,7 +45282,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45525,7 +45353,6 @@ def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45540,14 +45367,7 @@ def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45561,7 +45381,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45575,7 +45395,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -45597,10 +45417,10 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45608,18 +45428,15 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45744,10 +45561,11 @@ def begin_create_or_update_source_control_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -45811,7 +45629,6 @@ def delete_source_control_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45957,7 +45774,6 @@ def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45972,14 +45788,7 @@ def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46028,7 +45837,6 @@ def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46055,7 +45863,7 @@ def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46068,7 +45876,7 @@ def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -46082,10 +45890,10 @@ def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46093,15 +45901,15 @@ def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46162,10 +45970,11 @@ def begin_start_network_trace_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -46229,7 +46038,6 @@ def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46288,7 +46096,6 @@ def stop_network_trace_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46348,7 +46155,6 @@ def sync_repository_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46407,7 +46213,6 @@ def sync_function_triggers_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46470,7 +46275,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46486,7 +46290,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46561,7 +46364,6 @@ def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46578,7 +46380,7 @@ def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46630,7 +46432,6 @@ def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46696,7 +46497,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46712,7 +46512,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46790,7 +46589,6 @@ def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46807,7 +46605,7 @@ def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46859,7 +46657,6 @@ def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46928,7 +46725,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46944,7 +46740,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47016,7 +46811,6 @@ def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47031,7 +46825,7 @@ def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47083,7 +46877,6 @@ def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47098,7 +46891,7 @@ def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47249,7 +47042,6 @@ def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47264,7 +47056,7 @@ def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47316,7 +47108,6 @@ def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47478,7 +47269,6 @@ def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47493,7 +47283,7 @@ def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47549,7 +47339,6 @@ def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47566,7 +47355,7 @@ def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47722,7 +47511,6 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47737,7 +47525,7 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47893,7 +47681,6 @@ def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47908,7 +47695,7 @@ def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47960,7 +47747,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47976,7 +47762,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48051,7 +47836,6 @@ def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48066,7 +47850,7 @@ def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48188,7 +47972,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48204,7 +47987,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48234,13 +48016,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48254,7 +48036,7 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48275,10 +48057,10 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48286,12 +48068,20 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot_with_production( @@ -48382,7 +48172,7 @@ def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_with_production_initial( # type: ignore + raw_result = self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -48393,6 +48183,7 @@ def begin_swap_slot_with_production( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -48453,7 +48244,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48469,7 +48259,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48540,7 +48329,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48556,7 +48344,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48622,7 +48409,6 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48637,14 +48423,7 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48657,7 +48436,7 @@ def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48671,7 +48450,7 @@ def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48692,10 +48471,10 @@ def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48703,18 +48482,15 @@ def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48826,10 +48602,11 @@ def begin_create_or_update_source_control( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -48889,7 +48666,6 @@ def delete_source_control( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49022,7 +48798,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49037,14 +48812,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49089,7 +48857,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49115,7 +48882,7 @@ def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -49128,7 +48895,7 @@ def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -49141,10 +48908,10 @@ def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -49152,15 +48919,15 @@ def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49217,10 +48984,11 @@ def begin_start_network_trace( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -49280,7 +49048,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49336,7 +49103,6 @@ def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49392,7 +49158,6 @@ def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49448,7 +49213,6 @@ def sync_function_triggers( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49507,7 +49271,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49523,7 +49286,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49594,7 +49356,6 @@ def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49611,7 +49372,7 @@ def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49659,7 +49420,6 @@ def delete_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49721,7 +49481,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49737,7 +49496,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49811,7 +49569,6 @@ def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49828,7 +49585,7 @@ def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49876,7 +49633,6 @@ def run_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49941,7 +49697,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49957,7 +49712,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50023,7 +49777,6 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50038,7 +49791,7 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50086,7 +49839,6 @@ def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50101,7 +49853,7 @@ def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50239,7 +49991,6 @@ def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50254,7 +50005,7 @@ def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50302,7 +50053,6 @@ def delete_vnet_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50451,7 +50201,6 @@ def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50466,7 +50215,7 @@ def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50518,7 +50267,6 @@ def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50535,7 +50283,7 @@ def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50678,7 +50426,6 @@ def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50693,7 +50440,7 @@ def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50836,7 +50583,6 @@ def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50851,7 +50597,7 @@ def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50897,7 +50643,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50913,7 +50658,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50982,7 +50726,6 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50997,7 +50740,7 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_site_management_client_operations.py index 54d32c4a42ab6..998292e753d2a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/operations/_web_site_management_client_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -538,7 +537,6 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -553,7 +551,7 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -642,7 +640,6 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -657,7 +654,7 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -698,7 +695,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -714,7 +710,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -778,7 +773,6 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +787,7 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -901,7 +895,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -916,7 +909,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -966,7 +959,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -982,7 +974,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1060,7 +1051,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1075,7 +1065,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1115,7 +1105,6 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1130,7 +1119,7 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1196,7 +1185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1212,7 +1200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1332,7 +1319,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1348,7 +1334,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1413,7 +1398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1429,7 +1413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1491,7 +1474,6 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1506,7 +1488,7 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1605,7 +1587,6 @@ def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1620,7 +1601,7 @@ def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1733,7 +1714,6 @@ def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1853,7 +1833,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1868,7 +1847,7 @@ def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1981,7 +1960,6 @@ def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_metadata.json index 163893e85884c..9558bfd8d5d7d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_vendor.py index fd66631892ed1..abd2e5566a353 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from .._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class WebSiteManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_web_site_management_client.py index 438402f2e2698..714bb45a07c17 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -194,7 +195,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/_vendor.py index 39f69956b8888..6e80ec49ed289 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/_web_site_management_client.py index 9f83040591bdb..43eaba30b26c7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -196,7 +197,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_app_service_certificate_orders_operations.py index 1f900cef0f9ab..6b3e9cc197355 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_certificate_orders_operations import ( build_create_or_update_certificate_request, build_create_or_update_request, @@ -119,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -254,7 +266,6 @@ async def validate_purchase_information( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +405,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +419,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +432,7 @@ async def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -438,7 +446,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -459,10 +467,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -470,15 +478,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -595,10 +603,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -658,7 +667,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +801,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -808,11 +815,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -862,7 +865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -878,7 +880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -949,7 +950,6 @@ async def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -964,7 +964,7 @@ async def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -978,7 +978,7 @@ async def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -992,7 +992,7 @@ async def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1014,10 +1014,10 @@ async def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1025,15 +1025,15 @@ async def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1157,10 +1157,11 @@ async def begin_create_or_update_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1223,7 +1224,6 @@ async def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1366,7 +1366,6 @@ async def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1381,11 +1380,7 @@ async def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1507,7 +1502,6 @@ async def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1640,7 +1634,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1696,7 +1689,6 @@ async def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1827,7 +1819,6 @@ async def resend_request_emails( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1958,7 +1949,6 @@ async def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1973,7 +1963,7 @@ async def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2018,7 +2008,6 @@ async def verify_domain_ownership( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2074,7 +2063,6 @@ async def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2089,7 +2077,7 @@ async def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2134,7 +2122,6 @@ async def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2149,7 +2136,7 @@ async def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_app_service_environments_operations.py index 914a73124f71c..574e89c6f6273 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_app_service_environments_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_environments_operations import ( build_change_vnet_request, build_create_or_update_multi_role_pool_request, @@ -135,7 +149,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -151,7 +164,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -221,7 +233,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -237,7 +248,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -303,7 +313,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -318,7 +327,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -331,7 +340,7 @@ async def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -345,7 +354,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -366,10 +375,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -377,18 +386,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -505,10 +511,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -530,9 +537,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -545,7 +552,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -556,10 +563,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -567,12 +574,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -603,7 +618,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -613,6 +628,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -751,7 +767,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -766,14 +781,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,7 +830,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -838,7 +845,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -904,7 +910,6 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -919,7 +924,7 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -932,7 +937,7 @@ async def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -946,7 +951,7 @@ async def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -967,10 +972,10 @@ async def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -978,15 +983,15 @@ async def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1115,7 +1120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1131,13 +1135,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1174,6 +1177,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -1239,7 +1243,6 @@ async def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1254,7 +1257,7 @@ async def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1302,7 +1305,6 @@ async def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1317,7 +1319,7 @@ async def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1367,7 +1369,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1383,7 +1384,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1455,7 +1455,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1471,7 +1470,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1539,7 +1537,6 @@ async def get_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1554,7 +1551,7 @@ async def get_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1567,7 +1564,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1581,7 +1578,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1602,10 +1599,10 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1613,15 +1610,15 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1735,10 +1732,11 @@ async def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1874,7 +1872,6 @@ async def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1889,11 +1886,7 @@ async def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1948,7 +1941,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1964,7 +1956,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2037,7 +2028,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2053,7 +2043,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2124,7 +2113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2140,7 +2128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2211,7 +2198,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2227,7 +2213,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2293,7 +2278,6 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2308,7 +2292,7 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2358,7 +2342,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2374,7 +2357,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2442,7 +2424,6 @@ async def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2460,7 +2441,7 @@ async def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2473,7 +2454,7 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -2483,10 +2464,10 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2494,15 +2475,15 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2553,7 +2534,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2569,13 +2549,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2610,6 +2589,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2679,7 +2659,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2695,7 +2674,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2770,7 +2748,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2786,7 +2763,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2816,7 +2792,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2829,7 +2805,7 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -2839,10 +2815,10 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2850,15 +2826,15 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2909,7 +2885,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2925,13 +2900,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2966,6 +2940,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3041,7 +3016,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3057,7 +3031,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3129,7 +3102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3145,7 +3117,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3216,7 +3187,6 @@ async def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3231,7 +3201,7 @@ async def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3245,7 +3215,7 @@ async def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3259,7 +3229,7 @@ async def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3281,10 +3251,10 @@ async def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3292,15 +3262,15 @@ async def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3423,10 +3393,11 @@ async def begin_create_or_update_worker_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3571,7 +3542,6 @@ async def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3586,11 +3556,7 @@ async def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3646,7 +3612,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3662,7 +3627,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3738,7 +3702,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3754,7 +3717,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3828,7 +3790,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3844,7 +3805,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3918,7 +3878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3934,7 +3893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_app_service_plans_operations.py index ca001fc89ebca..5050781a7d458 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_app_service_plans_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_plans_operations import ( build_create_or_update_request, build_create_or_update_vnet_route_request, @@ -131,7 +145,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -147,7 +160,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -216,7 +228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -298,7 +308,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +324,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +337,7 @@ async def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -342,7 +351,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -363,10 +372,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -374,15 +383,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -492,10 +501,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -555,7 +565,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -687,7 +696,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -702,11 +710,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -749,7 +753,6 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -764,7 +767,7 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -815,7 +818,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -830,7 +832,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -881,7 +883,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -943,7 +944,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -958,7 +958,7 @@ async def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1012,7 +1012,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1028,7 +1027,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1096,7 +1094,6 @@ async def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1111,7 +1108,7 @@ async def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1160,7 +1157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1176,7 +1172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1250,7 +1245,6 @@ async def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1328,7 +1322,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1344,7 +1337,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1410,7 +1402,6 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1425,7 +1416,7 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1479,7 +1470,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1495,7 +1485,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1561,7 +1550,6 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1576,7 +1564,7 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1624,7 +1612,6 @@ async def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1641,7 +1628,7 @@ async def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1692,7 +1679,6 @@ async def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1693,7 @@ async def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1847,7 +1833,6 @@ async def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1862,7 +1847,7 @@ async def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1910,7 +1895,6 @@ async def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1925,7 +1909,7 @@ async def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1976,7 +1960,6 @@ async def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1993,7 +1976,7 @@ async def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2133,7 +2116,6 @@ async def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2150,7 +2132,7 @@ async def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2201,7 +2183,6 @@ async def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2352,7 +2333,6 @@ async def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2369,7 +2349,7 @@ async def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2417,7 +2397,6 @@ async def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_certificate_registration_provider_operations.py index 81f10d217f9be..a155177b60b99 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_certificate_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_certificates_operations.py index f20dc55dadb90..12dda05272410 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -101,7 +99,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -183,7 +179,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -199,7 +194,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -265,7 +259,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +273,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +393,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -415,7 +407,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -592,7 +583,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -607,7 +597,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_deleted_web_apps_operations.py index 2cfea8a445899..a439470a7f01b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_deleted_web_apps_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_web_apps_operations import ( build_get_deleted_web_app_by_location_request, build_list_by_location_request, @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -179,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +257,6 @@ async def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +271,7 @@ async def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_diagnostics_operations.py index 25f21f782ba84..fb67daa535ee7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._diagnostics_operations import ( build_execute_site_analysis_request, build_execute_site_analysis_slot_request, @@ -126,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +225,6 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +239,7 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,7 +288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -309,7 +303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +389,6 @@ async def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +403,7 @@ async def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -476,7 +467,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -547,7 +537,6 @@ async def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -562,7 +551,7 @@ async def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -630,7 +618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -704,7 +691,6 @@ async def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,7 +705,7 @@ async def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +773,6 @@ async def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +787,7 @@ async def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -854,7 +839,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -870,7 +854,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -944,7 +927,6 @@ async def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -959,7 +941,7 @@ async def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1027,7 +1009,6 @@ async def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1042,7 +1023,7 @@ async def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1094,7 +1075,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1110,7 +1090,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1201,7 +1180,6 @@ async def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1216,7 +1194,7 @@ async def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1268,7 +1246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1284,7 +1261,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1358,7 +1334,6 @@ async def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1373,7 +1348,7 @@ async def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1428,7 +1403,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1444,7 +1418,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1527,7 +1500,6 @@ async def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1542,7 +1514,7 @@ async def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1614,7 +1586,6 @@ async def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1629,7 +1600,7 @@ async def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1684,7 +1655,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1700,7 +1670,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1783,7 +1752,6 @@ async def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1798,7 +1766,7 @@ async def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1870,7 +1838,6 @@ async def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1885,7 +1852,7 @@ async def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_domain_registration_provider_operations.py index a03009a8790ab..de0f6c3cf39b5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_domain_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_domains_operations.py index 1e20759bd24ae..d552003d41902 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_check_availability_request, build_create_or_update_ownership_identifier_request, @@ -162,7 +162,6 @@ async def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -177,7 +176,7 @@ async def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -217,7 +216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -233,7 +231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +290,6 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -308,7 +304,7 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -408,7 +404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -424,7 +419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -490,7 +484,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -506,7 +499,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -572,7 +564,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -587,7 +578,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -596,7 +587,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -610,7 +601,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,10 +622,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -642,15 +633,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,10 +747,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -824,7 +816,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -955,7 +946,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -970,11 +960,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1024,7 +1010,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1040,7 +1025,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1111,7 +1095,6 @@ async def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1126,7 +1109,7 @@ async def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1265,7 +1248,6 @@ async def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1280,7 +1262,7 @@ async def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1328,7 +1310,6 @@ async def delete_ownership_identifier( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1478,7 +1459,6 @@ async def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1493,7 +1473,7 @@ async def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1538,7 +1518,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_provider_operations.py index 0a83e0aa2dfaf..bdddfdc5d80df 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._provider_operations import ( build_get_available_stacks_on_prem_request, build_get_available_stacks_request, @@ -103,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -185,7 +181,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -201,7 +196,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -272,7 +266,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -288,7 +281,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_recommendations_operations.py index 4dba760382476..d7f7dc45fe0e1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_recommendations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommendations_operations import ( build_disable_all_for_hosting_environment_request, build_disable_all_for_web_app_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -198,7 +194,6 @@ async def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +246,6 @@ async def disable_recommendation_for_subscription( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -326,7 +320,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -342,7 +335,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -428,7 +420,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +435,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -515,7 +505,6 @@ async def disable_all_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +563,6 @@ async def reset_all_filters_for_hosting_environment( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +635,6 @@ async def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -662,7 +649,7 @@ async def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -713,7 +700,6 @@ async def disable_recommendation_for_hosting_environment( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -788,7 +774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -804,7 +789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -890,7 +874,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -906,7 +889,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +956,6 @@ async def disable_all_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1030,7 +1011,6 @@ async def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1103,7 +1083,6 @@ async def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1118,7 +1097,7 @@ async def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1145,6 @@ async def disable_recommendation_for_site( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_resource_health_metadata_operations.py index f90b312c63c24..50a8e17c09381 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_resource_health_metadata_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._resource_health_metadata_operations import ( build_get_by_site_request, build_get_by_site_slot_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -277,7 +271,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -293,7 +286,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -359,7 +351,6 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +365,7 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -428,7 +419,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +434,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -516,7 +505,6 @@ async def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -531,7 +519,7 @@ async def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_static_sites_operations.py index bd1984416d9cb..6437d36095e92 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_static_sites_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._static_sites_operations import ( build_create_or_update_static_site_build_function_app_settings_request, build_create_or_update_static_site_custom_domain_request, @@ -197,7 +195,6 @@ async def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +209,7 @@ async def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -254,7 +251,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -270,7 +266,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -340,7 +335,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -356,7 +350,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -424,7 +417,6 @@ async def get_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -439,7 +431,7 @@ async def get_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -562,7 +554,6 @@ async def create_or_update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -577,11 +568,7 @@ async def create_or_update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -626,7 +613,6 @@ async def delete_static_site( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -760,7 +746,6 @@ async def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -775,11 +760,7 @@ async def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -832,7 +813,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -848,7 +828,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -922,7 +901,6 @@ async def delete_static_site_user( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1076,7 +1054,6 @@ async def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1091,7 +1068,7 @@ async def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1141,7 +1118,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1157,7 +1133,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1228,7 +1203,6 @@ async def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1243,7 +1217,7 @@ async def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1291,7 +1265,6 @@ async def delete_static_site_build( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1431,7 +1404,6 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1446,11 +1418,7 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1503,7 +1471,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1519,7 +1486,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1590,7 +1556,6 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1605,11 +1570,7 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1728,7 +1689,6 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1743,11 +1703,7 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1871,7 +1827,6 @@ async def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1886,7 +1841,7 @@ async def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1936,7 +1891,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1952,7 +1906,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2023,7 +1976,6 @@ async def create_or_update_static_site_custom_domain( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2038,11 +1990,7 @@ async def create_or_update_static_site_custom_domain( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2090,7 +2038,6 @@ async def delete_static_site_custom_domain( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2149,7 +2096,6 @@ async def validate_custom_domain_can_be_added_to_static_site( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2205,7 +2151,6 @@ async def detach_static_site( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2266,7 +2211,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2282,7 +2226,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2350,7 +2293,6 @@ async def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2365,11 +2307,7 @@ async def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2414,7 +2352,6 @@ async def list_static_site_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2429,7 +2366,7 @@ async def list_static_site_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2551,7 +2488,6 @@ async def reset_static_site_api_key( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_top_level_domains_operations.py index 769e85f1f9f66..a6de88ced107e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_level_domains_operations import ( build_get_request, build_list_agreements_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -178,7 +174,6 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_web_apps_operations.py index c5ececdeb39f5..d6d22dbafd9a1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_web_apps_operations.py @@ -32,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -45,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_apps_operations import ( build_add_premier_add_on_request, build_add_premier_add_on_slot_request, @@ -486,7 +486,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -502,7 +501,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -575,7 +573,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -591,7 +588,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -657,7 +653,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -674,7 +669,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -683,7 +678,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio async def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -697,7 +692,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -718,10 +713,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -729,15 +724,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -849,10 +844,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -924,7 +920,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1064,7 +1059,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1079,11 +1073,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1131,7 +1121,6 @@ async def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1146,7 +1135,7 @@ async def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1266,7 +1255,6 @@ async def apply_slot_config_to_production( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1395,7 +1383,6 @@ async def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1410,7 +1397,7 @@ async def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1456,7 +1443,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1472,7 +1458,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1543,7 +1528,6 @@ async def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1558,7 +1542,7 @@ async def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1606,7 +1590,6 @@ async def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1759,7 +1742,6 @@ async def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,21 +1756,21 @@ async def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_initial( # pylint: disable=inconsistent-return-statements + async def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1802,7 +1784,7 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1824,10 +1806,10 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1835,12 +1817,20 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore( @@ -1940,7 +1930,7 @@ async def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_initial( # type: ignore + raw_result = await self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -1952,6 +1942,7 @@ async def begin_restore( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2011,7 +2002,6 @@ async def get_basic_publishing_credentials_policies( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2026,7 +2016,7 @@ async def get_basic_publishing_credentials_policies( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2071,7 +2061,6 @@ async def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2086,7 +2075,7 @@ async def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2210,7 +2199,6 @@ async def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2225,7 +2213,7 @@ async def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2270,7 +2258,6 @@ async def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2285,7 +2272,7 @@ async def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2409,7 +2396,6 @@ async def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2424,7 +2410,7 @@ async def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2473,7 +2459,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2489,7 +2474,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2632,7 +2616,6 @@ async def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2647,7 +2630,7 @@ async def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2692,7 +2675,6 @@ async def list_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2707,7 +2689,7 @@ async def list_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2827,7 +2809,6 @@ async def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2842,7 +2823,7 @@ async def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2885,7 +2866,6 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2900,7 +2880,7 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3020,7 +3000,6 @@ async def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3035,7 +3014,7 @@ async def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3080,7 +3059,6 @@ async def get_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3095,7 +3073,7 @@ async def get_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3217,7 +3195,6 @@ async def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3232,7 +3209,7 @@ async def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3277,7 +3254,6 @@ async def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3292,7 +3268,7 @@ async def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3408,7 +3384,6 @@ async def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3423,7 +3398,7 @@ async def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3468,7 +3443,6 @@ async def delete_backup_configuration( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3524,7 +3498,6 @@ async def get_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3539,7 +3512,7 @@ async def get_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3662,7 +3635,6 @@ async def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3677,7 +3649,7 @@ async def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3722,7 +3694,6 @@ async def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3737,7 +3708,7 @@ async def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3782,7 +3753,6 @@ async def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3797,7 +3767,7 @@ async def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3920,7 +3890,6 @@ async def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3935,7 +3904,7 @@ async def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4051,7 +4020,6 @@ async def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4066,7 +4034,7 @@ async def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4109,7 +4077,6 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4124,7 +4091,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4133,7 +4100,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any async def _list_publishing_credentials_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4146,7 +4113,7 @@ async def _list_publishing_credentials_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -4156,10 +4123,10 @@ async def _list_publishing_credentials_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4167,11 +4134,15 @@ async def _list_publishing_credentials_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4212,10 +4183,11 @@ async def begin_list_publishing_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4346,7 +4318,6 @@ async def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4361,7 +4332,7 @@ async def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4404,7 +4375,6 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4419,7 +4389,7 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4464,7 +4434,6 @@ async def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4479,7 +4448,7 @@ async def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4608,7 +4577,6 @@ async def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4623,7 +4591,7 @@ async def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4668,7 +4636,6 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4683,7 +4650,7 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4803,7 +4770,6 @@ async def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4818,7 +4784,7 @@ async def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4938,7 +4904,6 @@ async def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4953,7 +4918,7 @@ async def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5005,7 +4970,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5021,7 +4985,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5092,7 +5055,6 @@ async def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5107,7 +5069,7 @@ async def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5155,7 +5117,6 @@ async def recover_site_configuration_snapshot( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5211,9 +5172,9 @@ async def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5222,12 +5183,16 @@ async def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5272,9 +5237,9 @@ async def get_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5283,12 +5248,16 @@ async def get_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5337,7 +5306,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5353,7 +5321,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5424,7 +5391,6 @@ async def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5441,7 +5407,7 @@ async def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5489,7 +5455,6 @@ async def delete_continuous_web_job( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5548,7 +5513,6 @@ async def start_continuous_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5607,7 +5571,6 @@ async def stop_continuous_web_job( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5666,7 +5629,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5682,7 +5644,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5751,7 +5712,6 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5766,7 +5726,7 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5896,7 +5856,6 @@ async def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5911,7 +5870,7 @@ async def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5959,7 +5918,6 @@ async def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6019,7 +5977,6 @@ async def list_deployment_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6034,7 +5991,7 @@ async def list_deployment_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6158,7 +6115,6 @@ async def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6173,7 +6129,7 @@ async def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6221,7 +6177,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6237,7 +6192,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6308,7 +6262,6 @@ async def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6323,7 +6276,7 @@ async def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6455,7 +6408,6 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6470,7 +6422,7 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6518,7 +6470,6 @@ async def delete_domain_ownership_identifier( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6661,7 +6612,6 @@ async def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6676,7 +6626,7 @@ async def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6719,7 +6669,6 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6734,7 +6683,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6743,7 +6692,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar async def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6757,7 +6706,7 @@ async def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6778,10 +6727,10 @@ async def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6789,13 +6738,15 @@ async def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6901,10 +6852,11 @@ async def begin_create_ms_deploy_operation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6964,7 +6916,6 @@ async def get_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6981,7 +6932,7 @@ async def get_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7030,7 +6981,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7046,7 +6996,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7112,7 +7061,6 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7127,7 +7075,7 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7175,7 +7123,6 @@ async def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7192,7 +7139,7 @@ async def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7206,7 +7153,7 @@ async def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7220,7 +7167,7 @@ async def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7242,10 +7189,10 @@ async def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7253,11 +7200,15 @@ async def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7377,10 +7328,11 @@ async def begin_create_function( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7443,7 +7395,6 @@ async def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7594,7 +7545,6 @@ async def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7609,11 +7559,7 @@ async def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7664,7 +7610,6 @@ async def delete_function_secret( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7723,7 +7668,6 @@ async def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7738,7 +7682,7 @@ async def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7786,7 +7730,6 @@ async def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7801,7 +7744,7 @@ async def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7844,7 +7787,6 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7859,7 +7801,7 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7904,7 +7846,6 @@ async def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7960,7 +7901,6 @@ async def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8111,7 +8051,6 @@ async def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8126,11 +8065,7 @@ async def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8181,7 +8116,6 @@ async def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8241,7 +8175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8257,7 +8190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8328,7 +8260,6 @@ async def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8343,7 +8274,7 @@ async def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8475,7 +8406,6 @@ async def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8490,7 +8420,7 @@ async def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8538,7 +8468,6 @@ async def delete_host_name_binding( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8600,7 +8529,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8615,7 +8543,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8755,7 +8683,6 @@ async def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8770,7 +8697,7 @@ async def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8821,7 +8748,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8972,7 +8898,6 @@ async def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8987,7 +8912,7 @@ async def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9032,7 +8957,6 @@ async def list_hybrid_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9047,7 +8971,7 @@ async def list_hybrid_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9092,7 +9016,6 @@ async def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9107,7 +9030,7 @@ async def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9155,7 +9078,6 @@ async def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9170,7 +9092,7 @@ async def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9301,7 +9223,6 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9316,7 +9237,7 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9364,7 +9285,6 @@ async def delete_relay_service_connection( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9506,7 +9426,6 @@ async def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9521,7 +9440,7 @@ async def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9571,7 +9490,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9587,7 +9505,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9658,7 +9575,6 @@ async def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9673,7 +9589,7 @@ async def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9721,7 +9637,6 @@ async def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9736,7 +9651,7 @@ async def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9750,7 +9665,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9764,7 +9679,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -9786,10 +9701,10 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9797,13 +9712,15 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9923,10 +9840,11 @@ async def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9989,7 +9907,6 @@ async def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10006,7 +9923,7 @@ async def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10060,7 +9977,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10076,7 +9992,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10151,7 +10066,6 @@ async def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10168,7 +10082,7 @@ async def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10222,7 +10136,6 @@ async def delete_instance_process( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10285,9 +10198,9 @@ async def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10296,13 +10209,17 @@ async def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10360,7 +10277,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10376,7 +10292,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10454,7 +10369,6 @@ async def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10471,7 +10385,7 @@ async def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10527,7 +10441,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10543,7 +10456,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10609,7 +10521,6 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10624,7 +10535,7 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10672,7 +10583,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10688,7 +10598,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10756,7 +10665,6 @@ async def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10771,7 +10679,7 @@ async def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10785,7 +10693,7 @@ async def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10799,7 +10707,7 @@ async def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10821,10 +10729,10 @@ async def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10832,11 +10740,15 @@ async def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10960,10 +10872,11 @@ async def begin_migrate_storage( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10991,7 +10904,7 @@ async def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11005,7 +10918,7 @@ async def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11026,10 +10939,10 @@ async def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11037,11 +10950,15 @@ async def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11152,10 +11069,11 @@ async def begin_migrate_my_sql( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11217,7 +11135,6 @@ async def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11232,7 +11149,7 @@ async def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11277,7 +11194,6 @@ async def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11292,7 +11208,7 @@ async def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11432,7 +11348,6 @@ async def create_or_update_swift_virtual_network_connection( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11447,7 +11362,7 @@ async def create_or_update_swift_virtual_network_connection( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11492,7 +11407,6 @@ async def delete_swift_virtual_network( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11643,7 +11557,6 @@ async def update_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11658,7 +11571,7 @@ async def update_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11706,7 +11619,6 @@ async def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11723,7 +11635,7 @@ async def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11771,7 +11683,6 @@ async def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11786,11 +11697,7 @@ async def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11850,7 +11757,6 @@ async def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11865,7 +11771,7 @@ async def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11880,7 +11786,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11893,7 +11799,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -11906,10 +11812,10 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11917,15 +11823,15 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11983,10 +11889,11 @@ async def begin_start_web_site_network_trace_operation( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12046,7 +11953,6 @@ async def stop_web_site_network_trace( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12105,7 +12011,6 @@ async def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12120,7 +12025,7 @@ async def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12168,7 +12073,6 @@ async def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12183,11 +12087,7 @@ async def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12235,7 +12135,6 @@ async def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12250,7 +12149,7 @@ async def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12295,7 +12194,6 @@ async def generate_new_site_publishing_password( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12360,7 +12258,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -12376,7 +12273,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -12444,7 +12340,6 @@ async def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12459,7 +12354,7 @@ async def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12502,7 +12397,6 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12517,7 +12411,7 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12565,7 +12459,6 @@ async def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12580,7 +12473,7 @@ async def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12710,7 +12603,6 @@ async def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12725,7 +12617,7 @@ async def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12773,7 +12665,6 @@ async def delete_premier_add_on( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12914,7 +12805,6 @@ async def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12929,7 +12819,7 @@ async def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12974,7 +12864,6 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12989,7 +12878,7 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13111,7 +13000,6 @@ async def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13126,7 +13014,7 @@ async def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13176,7 +13064,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13192,7 +13079,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13263,7 +13149,6 @@ async def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13280,7 +13165,7 @@ async def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13330,7 +13215,6 @@ async def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13389,9 +13273,9 @@ async def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13400,13 +13284,17 @@ async def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13460,7 +13348,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13476,7 +13363,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13550,7 +13436,6 @@ async def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13567,7 +13452,7 @@ async def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13619,7 +13504,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13635,7 +13519,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13707,7 +13590,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13723,7 +13605,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13794,7 +13675,6 @@ async def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13809,7 +13689,7 @@ async def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13941,7 +13821,6 @@ async def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13956,7 +13835,7 @@ async def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14004,7 +13883,6 @@ async def delete_public_certificate( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14140,9 +14018,9 @@ async def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14151,11 +14029,15 @@ async def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14202,7 +14084,6 @@ async def reset_production_slot_config( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14272,7 +14153,6 @@ async def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14290,9 +14170,9 @@ async def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14306,7 +14186,7 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14327,10 +14207,10 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14338,12 +14218,20 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob( @@ -14430,7 +14318,7 @@ async def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -14441,6 +14329,7 @@ async def begin_restore_from_backup_blob( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -14462,13 +14351,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14482,7 +14371,7 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14503,10 +14392,10 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14514,12 +14403,20 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app( @@ -14610,7 +14507,7 @@ async def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -14621,6 +14518,7 @@ async def begin_restore_from_deleted_app( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -14642,13 +14540,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14662,7 +14560,7 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14683,10 +14581,10 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14694,12 +14592,20 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot( @@ -14793,7 +14699,7 @@ async def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_initial( # type: ignore + raw_result = await self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -14804,6 +14710,7 @@ async def begin_restore_snapshot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -14867,7 +14774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14883,7 +14789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14954,7 +14859,6 @@ async def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14971,7 +14875,7 @@ async def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14980,7 +14884,7 @@ async def get_site_extension( async def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14993,7 +14897,7 @@ async def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -15004,10 +14908,10 @@ async def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15015,16 +14919,15 @@ async def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15070,10 +14973,11 @@ async def begin_install_site_extension( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15136,7 +15040,6 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15154,13 +15057,13 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statements + async def _copy_production_slot_initial( self, resource_group_name: str, name: str, copy_slot_entity: Union[_models.CsmCopySlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15174,7 +15077,7 @@ async def _copy_production_slot_initial( # pylint: disable=inconsistent-return- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15195,10 +15098,10 @@ async def _copy_production_slot_initial( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15206,12 +15109,20 @@ async def _copy_production_slot_initial( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_copy_production_slot( @@ -15305,7 +15216,7 @@ async def begin_copy_production_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._copy_production_slot_initial( # type: ignore + raw_result = await self._copy_production_slot_initial( resource_group_name=resource_group_name, name=name, copy_slot_entity=copy_slot_entity, @@ -15316,6 +15227,7 @@ async def begin_copy_production_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15376,7 +15288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15392,7 +15303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15462,7 +15372,6 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15479,7 +15388,7 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15493,7 +15402,7 @@ async def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15507,7 +15416,7 @@ async def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15529,10 +15438,10 @@ async def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15540,15 +15449,15 @@ async def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15677,10 +15586,11 @@ async def begin_create_or_update_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15758,7 +15668,6 @@ async def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15911,7 +15820,6 @@ async def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15926,11 +15834,7 @@ async def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15982,7 +15886,6 @@ async def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15997,7 +15900,7 @@ async def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16130,7 +16033,6 @@ async def apply_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16276,7 +16178,6 @@ async def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16291,7 +16192,7 @@ async def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16343,7 +16244,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16359,7 +16259,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16434,7 +16333,6 @@ async def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16449,7 +16347,7 @@ async def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16501,7 +16399,6 @@ async def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16667,7 +16564,6 @@ async def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16682,14 +16578,14 @@ async def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -16697,7 +16593,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16711,7 +16607,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16734,10 +16630,10 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16745,12 +16641,20 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_slot( @@ -16862,7 +16766,7 @@ async def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_slot_initial( # type: ignore + raw_result = await self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -16875,6 +16779,7 @@ async def begin_restore_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16942,7 +16847,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16958,7 +16862,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17114,7 +17017,6 @@ async def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17129,7 +17031,7 @@ async def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17178,7 +17080,6 @@ async def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17193,7 +17094,7 @@ async def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17326,7 +17227,6 @@ async def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17341,7 +17241,7 @@ async def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17390,7 +17290,6 @@ async def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17405,7 +17304,7 @@ async def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17538,7 +17437,6 @@ async def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17553,7 +17451,7 @@ async def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17602,7 +17500,6 @@ async def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17617,7 +17514,7 @@ async def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17752,7 +17649,6 @@ async def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17767,7 +17663,7 @@ async def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17816,7 +17712,6 @@ async def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17831,7 +17726,7 @@ async def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17964,7 +17859,6 @@ async def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17979,7 +17873,7 @@ async def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18028,7 +17922,6 @@ async def delete_backup_configuration_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18088,7 +17981,6 @@ async def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18103,7 +17995,7 @@ async def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18239,7 +18131,6 @@ async def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18254,7 +18145,7 @@ async def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18303,7 +18194,6 @@ async def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18318,7 +18208,7 @@ async def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18367,7 +18257,6 @@ async def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18382,7 +18271,7 @@ async def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18518,7 +18407,6 @@ async def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18533,7 +18421,7 @@ async def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18666,7 +18554,6 @@ async def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18681,7 +18568,7 @@ async def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18730,7 +18617,6 @@ async def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18745,7 +18631,7 @@ async def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18754,7 +18640,7 @@ async def list_metadata_slot( async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18767,7 +18653,7 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -18778,10 +18664,10 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -18789,11 +18675,15 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18838,10 +18728,11 @@ async def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -18989,7 +18880,6 @@ async def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19004,7 +18894,7 @@ async def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19053,7 +18943,6 @@ async def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19068,7 +18957,7 @@ async def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19119,7 +19008,6 @@ async def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19134,7 +19022,7 @@ async def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19267,7 +19155,6 @@ async def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19282,7 +19169,7 @@ async def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19415,7 +19302,6 @@ async def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19430,7 +19316,7 @@ async def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19486,7 +19372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19502,7 +19387,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19577,7 +19461,6 @@ async def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19592,7 +19475,7 @@ async def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19644,7 +19527,6 @@ async def recover_site_configuration_snapshot_slot( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19704,9 +19586,9 @@ async def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19715,12 +19597,16 @@ async def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19769,9 +19655,9 @@ async def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19780,12 +19666,16 @@ async def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19838,7 +19728,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19854,7 +19743,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19929,7 +19817,6 @@ async def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19946,7 +19833,7 @@ async def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19998,7 +19885,6 @@ async def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20061,7 +19947,6 @@ async def start_continuous_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20124,7 +20009,6 @@ async def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20187,7 +20071,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20203,7 +20086,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20278,7 +20160,6 @@ async def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20293,7 +20174,7 @@ async def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20436,7 +20317,6 @@ async def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20451,7 +20331,7 @@ async def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20503,7 +20383,6 @@ async def delete_deployment_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20567,7 +20446,6 @@ async def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20582,7 +20460,7 @@ async def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20723,7 +20601,6 @@ async def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20738,7 +20615,7 @@ async def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20790,7 +20667,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20806,7 +20682,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20881,7 +20756,6 @@ async def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20896,7 +20770,7 @@ async def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21041,7 +20915,6 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21056,7 +20929,7 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21108,7 +20981,6 @@ async def delete_domain_ownership_identifier_slot( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21264,7 +21136,6 @@ async def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21279,7 +21150,7 @@ async def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21328,7 +21199,6 @@ async def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21343,7 +21213,7 @@ async def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21357,7 +21227,7 @@ async def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21371,7 +21241,7 @@ async def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21393,10 +21263,10 @@ async def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21404,13 +21274,15 @@ async def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21533,10 +21405,11 @@ async def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21600,7 +21473,6 @@ async def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21617,7 +21489,7 @@ async def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21669,7 +21541,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21685,7 +21556,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21757,7 +21627,6 @@ async def get_functions_admin_token_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21772,7 +21641,7 @@ async def get_functions_admin_token_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21823,7 +21692,6 @@ async def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21840,7 +21708,7 @@ async def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21855,7 +21723,7 @@ async def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21869,7 +21737,7 @@ async def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21892,10 +21760,10 @@ async def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21903,11 +21771,15 @@ async def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22037,10 +21909,11 @@ async def begin_create_instance_function_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22106,7 +21979,6 @@ async def delete_instance_function_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22267,7 +22139,6 @@ async def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22282,11 +22153,7 @@ async def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22340,7 +22207,6 @@ async def delete_function_secret_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22402,7 +22268,6 @@ async def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22417,7 +22282,7 @@ async def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22468,7 +22333,6 @@ async def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22483,7 +22347,7 @@ async def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22531,7 +22395,6 @@ async def list_host_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22546,7 +22409,7 @@ async def list_host_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22594,7 +22457,6 @@ async def list_sync_status_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22653,7 +22515,6 @@ async def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22814,7 +22675,6 @@ async def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22829,11 +22689,7 @@ async def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22887,7 +22743,6 @@ async def delete_host_secret_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22951,7 +22806,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22967,7 +22821,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23042,7 +22895,6 @@ async def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23057,7 +22909,7 @@ async def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23202,7 +23054,6 @@ async def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23217,7 +23068,7 @@ async def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23269,7 +23120,6 @@ async def delete_host_name_binding_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23334,7 +23184,6 @@ async def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23349,7 +23198,7 @@ async def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23499,7 +23348,6 @@ async def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23514,7 +23362,7 @@ async def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23568,7 +23416,6 @@ async def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23729,7 +23576,6 @@ async def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23744,7 +23590,7 @@ async def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23792,7 +23638,6 @@ async def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23807,7 +23652,7 @@ async def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23856,7 +23701,6 @@ async def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23871,7 +23715,7 @@ async def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23923,7 +23767,6 @@ async def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23938,7 +23781,7 @@ async def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24082,7 +23925,6 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24097,7 +23939,7 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24149,7 +23991,6 @@ async def delete_relay_service_connection_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24304,7 +24145,6 @@ async def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24319,7 +24159,7 @@ async def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24373,7 +24213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24389,7 +24228,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24464,7 +24302,6 @@ async def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24479,7 +24316,7 @@ async def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24531,7 +24368,6 @@ async def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24546,7 +24382,7 @@ async def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24561,7 +24397,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24575,7 +24411,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24598,10 +24434,10 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24609,13 +24445,15 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24748,10 +24586,11 @@ async def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=nam params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24818,7 +24657,6 @@ async def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24835,7 +24673,7 @@ async def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24893,7 +24731,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24909,7 +24746,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24988,7 +24824,6 @@ async def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25005,7 +24840,7 @@ async def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25063,7 +24898,6 @@ async def delete_instance_process_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25130,9 +24964,9 @@ async def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25141,13 +24975,17 @@ async def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25209,7 +25047,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25225,7 +25062,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25314,7 +25150,6 @@ async def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25331,7 +25166,7 @@ async def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25391,7 +25226,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25407,7 +25241,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25479,7 +25312,6 @@ async def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25494,7 +25326,7 @@ async def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25546,7 +25378,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25562,7 +25393,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25633,7 +25463,6 @@ async def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25648,7 +25477,7 @@ async def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25698,7 +25527,6 @@ async def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25713,7 +25541,7 @@ async def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25762,7 +25590,6 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25777,7 +25604,7 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25930,7 +25757,6 @@ async def create_or_update_swift_virtual_network_connection_slot( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25945,7 +25771,7 @@ async def create_or_update_swift_virtual_network_connection_slot( # pylint: dis error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25994,7 +25820,6 @@ async def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26158,7 +25983,6 @@ async def update_swift_virtual_network_connection_slot( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26173,7 +25997,7 @@ async def update_swift_virtual_network_connection_slot( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26225,7 +26049,6 @@ async def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26242,7 +26065,7 @@ async def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26294,7 +26117,6 @@ async def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26309,11 +26131,7 @@ async def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26377,7 +26195,6 @@ async def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26392,7 +26209,7 @@ async def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26408,7 +26225,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26421,7 +26238,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -26435,10 +26252,10 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26446,15 +26263,15 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26516,10 +26333,11 @@ async def begin_start_web_site_network_trace_operation_slot( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26582,7 +26400,6 @@ async def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26645,7 +26462,6 @@ async def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26660,7 +26476,7 @@ async def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26712,7 +26528,6 @@ async def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26727,11 +26542,7 @@ async def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26783,7 +26594,6 @@ async def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26798,7 +26608,7 @@ async def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26847,7 +26657,6 @@ async def generate_new_site_publishing_password_slot( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26916,7 +26725,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26932,7 +26740,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27004,7 +26811,6 @@ async def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27019,7 +26825,7 @@ async def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27068,7 +26874,6 @@ async def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27083,7 +26888,7 @@ async def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27135,7 +26940,6 @@ async def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27150,7 +26954,7 @@ async def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27293,7 +27097,6 @@ async def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27308,7 +27111,7 @@ async def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27360,7 +27163,6 @@ async def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27514,7 +27316,6 @@ async def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27529,7 +27330,7 @@ async def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27579,7 +27380,6 @@ async def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27594,7 +27394,7 @@ async def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27730,7 +27530,6 @@ async def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27745,7 +27544,7 @@ async def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27793,7 +27592,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27808,7 +27606,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27822,7 +27620,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.PrivateEndpointConnectionResource, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnectionResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27836,7 +27634,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -27858,10 +27656,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27869,15 +27667,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28002,10 +27800,11 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28029,7 +27828,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28042,7 +27841,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -28053,10 +27852,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28064,18 +27863,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28119,10 +27915,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28180,7 +27977,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28195,7 +27991,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28249,7 +28045,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28265,7 +28060,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28340,7 +28134,6 @@ async def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28357,7 +28150,7 @@ async def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28411,7 +28204,6 @@ async def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28474,9 +28266,9 @@ async def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28485,13 +28277,17 @@ async def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28549,7 +28345,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28565,7 +28360,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28643,7 +28437,6 @@ async def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28660,7 +28453,7 @@ async def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28716,7 +28509,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28732,7 +28524,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28808,7 +28599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28824,7 +28614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28899,7 +28688,6 @@ async def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28914,7 +28702,7 @@ async def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29059,7 +28847,6 @@ async def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29074,7 +28861,7 @@ async def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29126,7 +28913,6 @@ async def delete_public_certificate_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29275,9 +29061,9 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29286,11 +29072,15 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29341,7 +29131,6 @@ async def reset_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29416,7 +29205,6 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29434,14 +29222,14 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29455,7 +29243,7 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29477,10 +29265,10 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29488,12 +29276,20 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob_slot( @@ -29596,7 +29392,7 @@ async def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -29608,6 +29404,7 @@ async def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29629,14 +29426,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29650,7 +29447,7 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29672,10 +29469,10 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29683,12 +29480,20 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app_slot( @@ -29791,7 +29596,7 @@ async def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -29803,6 +29608,7 @@ async def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29824,14 +29630,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29845,7 +29651,7 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29867,10 +29673,10 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29878,12 +29684,20 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot_slot( @@ -29989,7 +29803,7 @@ async def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_slot_initial( # type: ignore + raw_result = await self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -30001,6 +29815,7 @@ async def begin_restore_snapshot_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30068,7 +29883,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30084,7 +29898,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30159,7 +29972,6 @@ async def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30176,7 +29988,7 @@ async def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30185,7 +29997,7 @@ async def get_site_extension_slot( async def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30198,7 +30010,7 @@ async def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -30210,10 +30022,10 @@ async def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30221,16 +30033,15 @@ async def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30280,10 +30091,11 @@ async def begin_install_site_extension_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30350,7 +30162,6 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30368,14 +30179,14 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _copy_slot_initial( # pylint: disable=inconsistent-return-statements + async def _copy_slot_initial( self, resource_group_name: str, name: str, slot: str, copy_slot_entity: Union[_models.CsmCopySlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30389,7 +30200,7 @@ async def _copy_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30411,10 +30222,10 @@ async def _copy_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30422,12 +30233,20 @@ async def _copy_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_copy_slot( @@ -30533,7 +30352,7 @@ async def begin_copy_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._copy_slot_initial( # type: ignore + raw_result = await self._copy_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -30545,6 +30364,7 @@ async def begin_copy_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30697,7 +30517,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30713,7 +30532,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30743,14 +30561,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30764,7 +30582,7 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30786,10 +30604,10 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30797,12 +30615,20 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot( @@ -30905,7 +30731,7 @@ async def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_initial( # type: ignore + raw_result = await self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -30917,6 +30743,7 @@ async def begin_swap_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30982,7 +30809,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30998,7 +30824,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31072,7 +30897,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31088,7 +30912,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31160,7 +30983,6 @@ async def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31175,14 +30997,7 @@ async def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31196,7 +31011,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31210,7 +31025,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31232,10 +31047,10 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31243,18 +31058,15 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31382,10 +31194,11 @@ async def begin_create_or_update_source_control_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31449,7 +31262,6 @@ async def delete_source_control_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31595,7 +31407,6 @@ async def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31610,14 +31421,7 @@ async def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31666,7 +31470,6 @@ async def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31693,7 +31496,7 @@ async def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31706,7 +31509,7 @@ async def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -31720,10 +31523,10 @@ async def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31731,15 +31534,15 @@ async def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31801,10 +31604,11 @@ async def begin_start_network_trace_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31868,7 +31672,6 @@ async def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31927,7 +31730,6 @@ async def stop_network_trace_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31987,7 +31789,6 @@ async def sync_repository_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32046,7 +31847,6 @@ async def sync_function_triggers_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32110,7 +31910,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32126,7 +31925,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32201,7 +31999,6 @@ async def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32218,7 +32015,7 @@ async def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32270,7 +32067,6 @@ async def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32337,7 +32133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32353,7 +32148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32431,7 +32225,6 @@ async def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32448,7 +32241,7 @@ async def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32500,7 +32293,6 @@ async def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32570,7 +32362,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32586,7 +32377,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32658,7 +32448,6 @@ async def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32673,7 +32462,7 @@ async def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32725,7 +32514,6 @@ async def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32740,7 +32528,7 @@ async def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32891,7 +32679,6 @@ async def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32906,7 +32693,7 @@ async def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32958,7 +32745,6 @@ async def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33120,7 +32906,6 @@ async def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33135,7 +32920,7 @@ async def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33191,7 +32976,6 @@ async def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33208,7 +32992,7 @@ async def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33364,7 +33148,6 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33379,7 +33162,7 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33535,7 +33318,6 @@ async def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33550,7 +33332,7 @@ async def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33602,7 +33384,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33618,7 +33399,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33693,7 +33473,6 @@ async def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33708,7 +33487,7 @@ async def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33833,7 +33612,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33849,7 +33627,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33879,13 +33656,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33899,7 +33676,7 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33920,10 +33697,10 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33931,12 +33708,20 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot_with_production( @@ -34027,7 +33812,7 @@ async def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_with_production_initial( # type: ignore + raw_result = await self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -34038,6 +33823,7 @@ async def begin_swap_slot_with_production( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -34098,7 +33884,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34114,7 +33899,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34185,7 +33969,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34201,7 +33984,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34267,7 +34049,6 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34282,14 +34063,7 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34302,7 +34076,7 @@ async def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34316,7 +34090,7 @@ async def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -34337,10 +34111,10 @@ async def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34348,18 +34122,15 @@ async def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34474,10 +34245,11 @@ async def begin_create_or_update_source_control( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -34537,7 +34309,6 @@ async def delete_source_control( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34670,7 +34441,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34685,14 +34455,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34737,7 +34500,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34763,7 +34525,7 @@ async def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34776,7 +34538,7 @@ async def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -34789,10 +34551,10 @@ async def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34800,15 +34562,15 @@ async def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34866,10 +34628,11 @@ async def begin_start_network_trace( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -34929,7 +34692,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34985,7 +34747,6 @@ async def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35041,7 +34802,6 @@ async def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35097,7 +34857,6 @@ async def sync_function_triggers( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35157,7 +34916,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35173,7 +34931,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35244,7 +35001,6 @@ async def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35261,7 +35017,7 @@ async def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35309,7 +35065,6 @@ async def delete_triggered_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35372,7 +35127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35388,7 +35142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35462,7 +35215,6 @@ async def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35479,7 +35231,7 @@ async def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35527,7 +35279,6 @@ async def run_triggered_web_job( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35593,7 +35344,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35609,7 +35359,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35675,7 +35424,6 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35690,7 +35438,7 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35738,7 +35486,6 @@ async def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35753,7 +35500,7 @@ async def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35891,7 +35638,6 @@ async def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35906,7 +35652,7 @@ async def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35954,7 +35700,6 @@ async def delete_vnet_connection( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36103,7 +35848,6 @@ async def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36118,7 +35862,7 @@ async def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36170,7 +35914,6 @@ async def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36187,7 +35930,7 @@ async def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36330,7 +36073,6 @@ async def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36345,7 +36087,7 @@ async def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36488,7 +36230,6 @@ async def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36503,7 +36244,7 @@ async def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36549,7 +36290,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36565,7 +36305,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36636,7 +36375,6 @@ async def get_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36651,7 +36389,7 @@ async def get_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_web_site_management_client_operations.py index dd0cd401c225c..f2a49e052c4a7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/aio/operations/_web_site_management_client_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_site_management_client_operations import ( build_check_name_availability_request, build_get_publishing_user_request, @@ -96,7 +94,6 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +108,7 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -200,7 +197,6 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,7 +253,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -273,7 +268,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -337,7 +331,6 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -352,7 +345,7 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +453,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -475,7 +467,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -526,7 +518,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -542,7 +533,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +610,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -635,7 +624,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -675,7 +664,6 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -690,7 +678,7 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,7 +744,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -772,7 +759,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -892,7 +878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -908,7 +893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +958,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -990,7 +973,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1052,7 +1034,6 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1067,7 +1048,7 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1147,6 @@ async def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1181,7 +1161,7 @@ async def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1294,7 +1274,6 @@ async def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1414,7 +1393,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1429,7 +1407,7 @@ async def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1542,7 +1520,6 @@ async def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_app_service_certificate_orders_operations.py index e25686b5deb2d..16a099a0f62ab 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -866,7 +867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -882,7 +882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1001,7 +1000,6 @@ def validate_purchase_information( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1075,7 +1072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1143,7 +1139,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1158,7 +1153,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1171,7 +1166,7 @@ def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1185,7 +1180,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1206,10 +1201,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1217,15 +1212,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1342,10 +1337,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1405,7 +1401,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1540,7 +1535,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1555,11 +1549,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1609,7 +1599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1625,7 +1614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1696,7 +1684,6 @@ def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1711,7 +1698,7 @@ def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1725,7 +1712,7 @@ def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1739,7 +1726,7 @@ def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1761,10 +1748,10 @@ def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1772,15 +1759,15 @@ def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1904,10 +1891,11 @@ def begin_create_or_update_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1970,7 +1958,6 @@ def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2113,7 +2100,6 @@ def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2128,11 +2114,7 @@ def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2254,7 +2236,6 @@ def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2387,7 +2368,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2443,7 +2423,6 @@ def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2574,7 +2553,6 @@ def resend_request_emails( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2705,7 +2683,6 @@ def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2720,7 +2697,7 @@ def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2765,7 +2742,6 @@ def verify_domain_ownership( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2821,7 +2797,6 @@ def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2836,7 +2811,7 @@ def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2881,7 +2856,6 @@ def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2896,7 +2870,7 @@ def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_app_service_environments_operations.py index 66b3b3806ef0c..54b1a280582ab 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1478,7 +1479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1494,7 +1494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1564,7 +1563,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1580,7 +1578,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1646,7 +1643,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1661,7 +1657,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1674,7 +1670,7 @@ def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1688,7 +1684,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1709,10 +1705,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1720,18 +1716,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1848,10 +1841,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1873,9 +1867,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1888,7 +1882,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -1899,10 +1893,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1910,12 +1904,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -1946,7 +1948,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -1956,6 +1958,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2094,7 +2097,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2109,14 +2111,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2162,7 +2157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2178,7 +2172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2244,7 +2237,6 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2259,7 +2251,7 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2272,7 +2264,7 @@ def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2286,7 +2278,7 @@ def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2307,10 +2299,10 @@ def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2318,15 +2310,15 @@ def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2455,7 +2447,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2471,13 +2462,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2514,6 +2504,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2579,7 +2570,6 @@ def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2594,7 +2584,7 @@ def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2642,7 +2632,6 @@ def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2657,7 +2646,7 @@ def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2707,7 +2696,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2723,7 +2711,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2794,7 +2781,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2810,7 +2796,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2876,7 +2861,6 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2891,7 +2875,7 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2904,7 +2888,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2918,7 +2902,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2939,10 +2923,10 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2950,15 +2934,15 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3069,10 +3053,11 @@ def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3208,7 +3193,6 @@ def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3223,11 +3207,7 @@ def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3282,7 +3262,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3298,7 +3277,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3371,7 +3349,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3387,7 +3364,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3458,7 +3434,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3474,7 +3449,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3543,7 +3517,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3559,7 +3532,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3625,7 +3597,6 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3640,7 +3611,7 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3690,7 +3661,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3706,7 +3676,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3774,7 +3743,6 @@ def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3792,7 +3760,7 @@ def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3805,7 +3773,7 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -3815,10 +3783,10 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3826,15 +3794,15 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3883,7 +3851,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3899,13 +3866,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3940,6 +3906,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -4008,7 +3975,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4024,7 +3990,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4099,7 +4064,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4115,7 +4079,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4145,7 +4108,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4158,7 +4121,7 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -4168,10 +4131,10 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4179,15 +4142,15 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4236,7 +4199,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4252,13 +4214,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4293,6 +4254,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -4367,7 +4329,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4383,7 +4344,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4454,7 +4414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4470,7 +4429,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4541,7 +4499,6 @@ def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4556,7 +4513,7 @@ def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4570,7 +4527,7 @@ def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4584,7 +4541,7 @@ def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4606,10 +4563,10 @@ def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4617,15 +4574,15 @@ def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4745,10 +4702,11 @@ def begin_create_or_update_worker_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4893,7 +4851,6 @@ def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4908,11 +4865,7 @@ def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4968,7 +4921,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4984,7 +4936,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5060,7 +5011,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5076,7 +5026,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5150,7 +5099,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5166,7 +5114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5240,7 +5187,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5256,7 +5202,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_app_service_plans_operations.py index d266f538fc568..516994782b302 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1161,7 +1162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1243,7 +1242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1259,7 +1257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1325,7 +1322,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1342,7 +1338,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1355,7 +1351,7 @@ def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1369,7 +1365,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1390,10 +1386,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1401,15 +1397,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1519,10 +1515,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1582,7 +1579,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1714,7 +1710,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1729,11 +1724,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1776,7 +1767,6 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1791,7 +1781,7 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1842,7 +1832,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1857,7 +1846,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1908,7 +1897,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1970,7 +1958,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1985,7 +1972,7 @@ def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2039,7 +2026,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2055,7 +2041,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2123,7 +2108,6 @@ def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2138,7 +2122,7 @@ def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2186,7 +2170,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2202,7 +2185,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2276,7 +2258,6 @@ def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2354,7 +2335,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2370,7 +2350,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2436,7 +2415,6 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2451,7 +2429,7 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2504,7 +2482,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2520,7 +2497,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2586,7 +2562,6 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2601,7 +2576,7 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2649,7 +2624,6 @@ def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2666,7 +2640,7 @@ def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2717,7 +2691,6 @@ def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2732,7 +2705,7 @@ def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2872,7 +2845,6 @@ def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2887,7 +2859,7 @@ def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2935,7 +2907,6 @@ def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2950,7 +2921,7 @@ def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3001,7 +2972,6 @@ def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3018,7 +2988,7 @@ def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3158,7 +3128,6 @@ def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3175,7 +3144,7 @@ def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3226,7 +3195,6 @@ def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3377,7 +3345,6 @@ def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3394,7 +3361,7 @@ def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3442,7 +3409,6 @@ def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_certificate_registration_provider_operations.py index 853e031df47b2..2abb8f1d2ef86 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_certificate_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_certificates_operations.py index 1cd3b4a73e97e..60387b497749a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_certificates_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -306,7 +305,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -322,7 +320,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -388,7 +385,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -404,7 +400,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -470,7 +465,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -485,7 +479,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -605,7 +599,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -620,7 +613,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -665,7 +658,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -797,7 +789,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -812,7 +803,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_deleted_web_apps_operations.py index 66ef55885b705..246330c396894 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_deleted_web_apps_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -176,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -192,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -342,7 +337,6 @@ def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +351,7 @@ def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_diagnostics_operations.py index de6794cf7a285..40c0684710b87 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1101,7 +1100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1117,7 +1115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1204,7 +1201,6 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1219,7 +1215,7 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1267,7 +1263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1283,7 +1278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1370,7 +1364,6 @@ def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1385,7 +1378,7 @@ def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1433,7 +1426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1449,7 +1441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1520,7 +1511,6 @@ def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1535,7 +1525,7 @@ def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1602,7 +1591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1676,7 +1664,6 @@ def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1678,7 @@ def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1759,7 +1746,6 @@ def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,7 +1760,7 @@ def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1825,7 +1811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1841,7 +1826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1915,7 +1899,6 @@ def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1930,7 +1913,7 @@ def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,7 +1981,6 @@ def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2013,7 +1995,7 @@ def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,7 +2046,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2080,7 +2061,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2171,7 +2151,6 @@ def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2186,7 +2165,7 @@ def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2237,7 +2216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2253,7 +2231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2327,7 +2304,6 @@ def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2342,7 +2318,7 @@ def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2396,7 +2372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2412,7 +2387,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2495,7 +2469,6 @@ def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2510,7 +2483,7 @@ def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2582,7 +2555,6 @@ def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2597,7 +2569,7 @@ def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2651,7 +2623,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2667,7 +2638,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2750,7 +2720,6 @@ def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2765,7 +2734,7 @@ def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2837,7 +2806,6 @@ def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2852,7 +2820,7 @@ def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_domain_registration_provider_operations.py index 24fc2ec7b11d1..a4b25459ef297 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_domain_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_domains_operations.py index bb42bd6c1dab4..d750d06b71db7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -694,7 +695,6 @@ def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -709,7 +709,7 @@ def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -749,7 +749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -765,7 +764,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -825,7 +823,6 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -840,7 +837,7 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -937,7 +934,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -953,7 +949,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1019,7 +1014,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1035,7 +1029,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1101,7 +1094,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1116,7 +1108,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1125,7 +1117,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1139,7 +1131,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1160,10 +1152,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1171,15 +1163,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1282,10 +1274,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1350,7 +1343,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1481,7 +1473,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1496,11 +1487,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1550,7 +1537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1566,7 +1552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1637,7 +1622,6 @@ def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1652,7 +1636,7 @@ def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1791,7 +1775,6 @@ def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1806,7 +1789,7 @@ def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1854,7 +1837,6 @@ def delete_ownership_identifier( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2004,7 +1986,6 @@ def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2019,7 +2000,7 @@ def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,7 +2045,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_provider_operations.py index bfa2ed8e19845..07b44c408ecb4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -171,7 +170,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -187,7 +185,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -253,7 +250,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -269,7 +265,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -340,7 +335,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -356,7 +350,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_recommendations_operations.py index 2e27da95f308b..20b8f1da4dae0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_recommendations_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -730,7 +729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -746,7 +744,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -806,7 +803,6 @@ def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -859,7 +855,6 @@ def disable_recommendation_for_subscription( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -933,7 +928,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -949,7 +943,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1034,7 +1027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1050,7 +1042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1121,7 +1112,6 @@ def disable_all_for_hosting_environment( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1180,7 +1170,6 @@ def reset_all_filters_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1253,7 +1242,6 @@ def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1268,7 +1256,7 @@ def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1319,7 +1307,6 @@ def disable_recommendation_for_hosting_environment( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1393,7 +1380,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1409,7 +1395,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1494,7 +1479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1510,7 +1494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1578,7 +1561,6 @@ def disable_all_for_web_app( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1634,7 +1616,6 @@ def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1688,6 @@ def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1722,7 +1702,7 @@ def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1770,7 +1750,6 @@ def disable_recommendation_for_site( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_resource_health_metadata_operations.py index 786703c01e654..c956bb8cb2285 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_resource_health_metadata_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -389,7 +386,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -405,7 +401,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -477,7 +472,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -493,7 +487,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -559,7 +552,6 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +566,7 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -627,7 +619,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -643,7 +634,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -715,7 +705,6 @@ def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -730,7 +719,7 @@ def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_static_sites_operations.py index b5a9ad42e58fb..e277275d07349 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_static_sites_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1208,7 +1207,6 @@ def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1223,7 +1221,7 @@ def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1264,7 +1262,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1280,7 +1277,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1349,7 +1345,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1365,7 +1360,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1431,7 +1425,6 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1446,7 +1439,7 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1569,7 +1562,6 @@ def create_or_update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1584,11 +1576,7 @@ def create_or_update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1633,7 +1621,6 @@ def delete_static_site( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1767,7 +1754,6 @@ def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1782,11 +1768,7 @@ def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1839,7 +1821,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1855,7 +1836,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1929,7 +1909,6 @@ def delete_static_site_user( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2083,7 +2062,6 @@ def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2098,7 +2076,7 @@ def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2148,7 +2126,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2164,7 +2141,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2235,7 +2211,6 @@ def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2250,7 +2225,7 @@ def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2298,7 +2273,6 @@ def delete_static_site_build( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2438,7 +2412,6 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2453,11 +2426,7 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2510,7 +2479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2526,7 +2494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2597,7 +2564,6 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2612,11 +2578,7 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2735,7 +2697,6 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2750,11 +2711,7 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2878,7 +2835,6 @@ def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2893,7 +2849,7 @@ def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2943,7 +2899,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2959,7 +2914,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3030,7 +2984,6 @@ def create_or_update_static_site_custom_domain( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3045,11 +2998,7 @@ def create_or_update_static_site_custom_domain( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3097,7 +3046,6 @@ def delete_static_site_custom_domain( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3156,7 +3104,6 @@ def validate_custom_domain_can_be_added_to_static_site( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3212,7 +3159,6 @@ def detach_static_site( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3273,7 +3219,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3289,7 +3234,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3357,7 +3301,6 @@ def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3372,11 +3315,7 @@ def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3419,7 +3358,6 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3434,7 +3372,7 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3556,7 +3494,6 @@ def reset_static_site_api_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_top_level_domains_operations.py index b748b5b4b92e6..19989eff7d746 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_top_level_domains_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_web_apps_operations.py index ede0d13f8b4bc..1d5a30f6eeabb 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_web_apps_operations.py @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -15278,7 +15279,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15294,7 +15294,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15367,7 +15366,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15383,7 +15381,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15449,7 +15446,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15466,7 +15462,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15475,7 +15471,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15489,7 +15485,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15510,10 +15506,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15521,15 +15517,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15641,10 +15637,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15716,7 +15713,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15856,7 +15852,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15871,11 +15866,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15923,7 +15914,6 @@ def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15938,7 +15928,7 @@ def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16058,7 +16048,6 @@ def apply_slot_config_to_production( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16187,7 +16176,6 @@ def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16202,7 +16190,7 @@ def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16248,7 +16236,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16264,7 +16251,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16335,7 +16321,6 @@ def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16350,7 +16335,7 @@ def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16398,7 +16383,6 @@ def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16551,7 +16535,6 @@ def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16566,21 +16549,21 @@ def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_initial( # pylint: disable=inconsistent-return-statements + def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16594,7 +16577,7 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16616,10 +16599,10 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16627,12 +16610,20 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore( @@ -16732,7 +16723,7 @@ def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_initial( # type: ignore + raw_result = self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -16744,6 +16735,7 @@ def begin_restore( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16803,7 +16795,6 @@ def get_basic_publishing_credentials_policies( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16818,7 +16809,7 @@ def get_basic_publishing_credentials_policies( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16863,7 +16854,6 @@ def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16878,7 +16868,7 @@ def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17002,7 +16992,6 @@ def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17017,7 +17006,7 @@ def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17062,7 +17051,6 @@ def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17077,7 +17065,7 @@ def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17201,7 +17189,6 @@ def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17216,7 +17203,7 @@ def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17264,7 +17251,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17280,7 +17266,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17423,7 +17408,6 @@ def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17438,7 +17422,7 @@ def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17481,7 +17465,6 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17496,7 +17479,7 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17616,7 +17599,6 @@ def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17631,7 +17613,7 @@ def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17674,7 +17656,6 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17689,7 +17670,7 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17809,7 +17790,6 @@ def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17824,7 +17804,7 @@ def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17867,7 +17847,6 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17882,7 +17861,7 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18004,7 +17983,6 @@ def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18019,7 +17997,7 @@ def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18064,7 +18042,6 @@ def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18079,7 +18056,7 @@ def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18195,7 +18172,6 @@ def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18210,7 +18186,7 @@ def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18255,7 +18231,6 @@ def delete_backup_configuration( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18309,7 +18284,6 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18324,7 +18298,7 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18447,7 +18421,6 @@ def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18462,7 +18435,7 @@ def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18507,7 +18480,6 @@ def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18522,7 +18494,7 @@ def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18567,7 +18539,6 @@ def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18582,7 +18553,7 @@ def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18705,7 +18676,6 @@ def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18720,7 +18690,7 @@ def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18836,7 +18806,6 @@ def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18851,7 +18820,7 @@ def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18894,7 +18863,6 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18909,14 +18877,16 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _list_publishing_credentials_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.User: + def _list_publishing_credentials_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18929,7 +18899,7 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -18939,10 +18909,10 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -18950,11 +18920,15 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18995,10 +18969,11 @@ def begin_list_publishing_credentials( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -19129,7 +19104,6 @@ def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19144,7 +19118,7 @@ def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19187,7 +19161,6 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19202,7 +19175,7 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19247,7 +19220,6 @@ def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19262,7 +19234,7 @@ def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19391,7 +19363,6 @@ def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19406,7 +19377,7 @@ def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19451,7 +19422,6 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19466,7 +19436,7 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19586,7 +19556,6 @@ def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19601,7 +19570,7 @@ def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19721,7 +19690,6 @@ def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19736,7 +19704,7 @@ def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19788,7 +19756,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19804,7 +19771,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19875,7 +19841,6 @@ def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19890,7 +19855,7 @@ def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19938,7 +19903,6 @@ def recover_site_configuration_snapshot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19994,9 +19958,9 @@ def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20005,12 +19969,16 @@ def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20053,9 +20021,9 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20064,12 +20032,16 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20117,7 +20089,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20133,7 +20104,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20204,7 +20174,6 @@ def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20221,7 +20190,7 @@ def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20269,7 +20238,6 @@ def delete_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20328,7 +20296,6 @@ def start_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20387,7 +20354,6 @@ def stop_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20444,7 +20410,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20460,7 +20425,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20529,7 +20493,6 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20544,7 +20507,7 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20674,7 +20637,6 @@ def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20689,7 +20651,7 @@ def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20737,7 +20699,6 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20795,7 +20756,6 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20810,7 +20770,7 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20934,7 +20894,6 @@ def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20949,7 +20908,7 @@ def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20997,7 +20956,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21013,7 +20971,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21084,7 +21041,6 @@ def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21099,7 +21055,7 @@ def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21231,7 +21187,6 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21246,7 +21201,7 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21294,7 +21249,6 @@ def delete_domain_ownership_identifier( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21437,7 +21391,6 @@ def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21452,7 +21405,7 @@ def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21495,7 +21448,6 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21510,7 +21462,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21519,7 +21471,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21533,7 +21485,7 @@ def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21554,10 +21506,10 @@ def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21565,13 +21517,15 @@ def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21677,10 +21631,11 @@ def begin_create_ms_deploy_operation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21738,7 +21693,6 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21755,7 +21709,7 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21803,7 +21757,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21819,7 +21772,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21885,7 +21837,6 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21900,7 +21851,7 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21948,7 +21899,6 @@ def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21965,7 +21915,7 @@ def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21979,7 +21929,7 @@ def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21993,7 +21943,7 @@ def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -22015,10 +21965,10 @@ def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22026,11 +21976,15 @@ def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22150,10 +22104,11 @@ def begin_create_function( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22216,7 +22171,6 @@ def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22367,7 +22321,6 @@ def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22382,11 +22335,7 @@ def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22437,7 +22386,6 @@ def delete_function_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22496,7 +22444,6 @@ def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22511,7 +22458,7 @@ def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22559,7 +22506,6 @@ def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22574,7 +22520,7 @@ def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22617,7 +22563,6 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22632,7 +22577,7 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22677,7 +22622,6 @@ def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22733,7 +22677,6 @@ def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22884,7 +22827,6 @@ def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22899,11 +22841,7 @@ def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22954,7 +22892,6 @@ def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23013,7 +22950,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23029,7 +22965,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23100,7 +23035,6 @@ def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23115,7 +23049,7 @@ def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23247,7 +23181,6 @@ def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23262,7 +23195,7 @@ def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23310,7 +23243,6 @@ def delete_host_name_binding( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23372,7 +23304,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23387,7 +23318,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23527,7 +23458,6 @@ def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23542,7 +23472,7 @@ def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23593,7 +23523,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23744,7 +23673,6 @@ def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23759,7 +23687,7 @@ def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23802,7 +23730,6 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23817,7 +23744,7 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23862,7 +23789,6 @@ def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23877,7 +23803,7 @@ def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23925,7 +23851,6 @@ def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23940,7 +23865,7 @@ def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24071,7 +23996,6 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24086,7 +24010,7 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24134,7 +24058,6 @@ def delete_relay_service_connection( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24276,7 +24199,6 @@ def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24291,7 +24213,7 @@ def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24340,7 +24262,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24356,7 +24277,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24427,7 +24347,6 @@ def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24442,7 +24361,7 @@ def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24490,7 +24409,6 @@ def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24505,7 +24423,7 @@ def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24519,7 +24437,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24533,7 +24451,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24555,10 +24473,10 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24566,13 +24484,15 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24692,10 +24612,11 @@ def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24758,7 +24679,6 @@ def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24775,7 +24695,7 @@ def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24829,7 +24749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24845,7 +24764,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24920,7 +24838,6 @@ def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24937,7 +24854,7 @@ def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24991,7 +24908,6 @@ def delete_instance_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25054,9 +24970,9 @@ def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25065,13 +24981,17 @@ def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25128,7 +25048,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25144,7 +25063,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25222,7 +25140,6 @@ def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25239,7 +25156,7 @@ def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25294,7 +25211,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25310,7 +25226,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25376,7 +25291,6 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25391,7 +25305,7 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25437,7 +25351,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25453,7 +25366,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25521,7 +25433,6 @@ def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25536,7 +25447,7 @@ def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25550,7 +25461,7 @@ def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25564,7 +25475,7 @@ def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25586,10 +25497,10 @@ def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25597,11 +25508,15 @@ def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25725,10 +25640,11 @@ def begin_migrate_storage( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25756,7 +25672,7 @@ def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25770,7 +25686,7 @@ def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25791,10 +25707,10 @@ def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25802,11 +25718,15 @@ def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25914,10 +25834,11 @@ def begin_migrate_my_sql( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25979,7 +25900,6 @@ def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25994,7 +25914,7 @@ def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26039,7 +25959,6 @@ def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26054,7 +25973,7 @@ def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26194,7 +26113,6 @@ def create_or_update_swift_virtual_network_connection( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26209,7 +26127,7 @@ def create_or_update_swift_virtual_network_connection( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26254,7 +26172,6 @@ def delete_swift_virtual_network( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26405,7 +26322,6 @@ def update_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26420,7 +26336,7 @@ def update_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26468,7 +26384,6 @@ def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26485,7 +26400,7 @@ def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26533,7 +26448,6 @@ def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26548,11 +26462,7 @@ def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26612,7 +26522,6 @@ def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26627,7 +26536,7 @@ def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26642,7 +26551,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26655,7 +26564,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -26668,10 +26577,10 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26679,15 +26588,15 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26744,10 +26653,11 @@ def begin_start_web_site_network_trace_operation( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26807,7 +26717,6 @@ def stop_web_site_network_trace( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26866,7 +26775,6 @@ def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26881,7 +26789,7 @@ def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26929,7 +26837,6 @@ def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26944,11 +26851,7 @@ def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26996,7 +26899,6 @@ def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27011,7 +26913,7 @@ def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27056,7 +26958,6 @@ def generate_new_site_publishing_password( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27120,7 +27021,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27136,7 +27036,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27204,7 +27103,6 @@ def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27219,7 +27117,7 @@ def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27262,7 +27160,6 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27277,7 +27174,7 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27325,7 +27222,6 @@ def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27340,7 +27236,7 @@ def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27470,7 +27366,6 @@ def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27485,7 +27380,7 @@ def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27533,7 +27428,6 @@ def delete_premier_add_on( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27674,7 +27568,6 @@ def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27689,7 +27582,7 @@ def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27734,7 +27627,6 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27749,7 +27641,7 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27871,7 +27763,6 @@ def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27886,7 +27777,7 @@ def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27934,7 +27825,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27950,7 +27840,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28021,7 +27910,6 @@ def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28038,7 +27926,7 @@ def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28088,7 +27976,6 @@ def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28147,9 +28034,9 @@ def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28158,13 +28045,17 @@ def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28217,7 +28108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28233,7 +28123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28307,7 +28196,6 @@ def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28324,7 +28212,7 @@ def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28375,7 +28263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28391,7 +28278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28462,7 +28348,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28478,7 +28363,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28549,7 +28433,6 @@ def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28564,7 +28447,7 @@ def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28696,7 +28579,6 @@ def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28711,7 +28593,7 @@ def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28759,7 +28641,6 @@ def delete_public_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28895,9 +28776,9 @@ def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28906,11 +28787,15 @@ def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28957,7 +28842,6 @@ def reset_production_slot_config( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29027,7 +28911,6 @@ def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29045,9 +28928,9 @@ def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29061,7 +28944,7 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29082,10 +28965,10 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29093,12 +28976,20 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob( @@ -29185,7 +29076,7 @@ def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_initial( # type: ignore + raw_result = self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -29196,6 +29087,7 @@ def begin_restore_from_backup_blob( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29217,13 +29109,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29237,7 +29129,7 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29258,10 +29150,10 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29269,12 +29161,20 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app( @@ -29365,7 +29265,7 @@ def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_initial( # type: ignore + raw_result = self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -29376,6 +29276,7 @@ def begin_restore_from_deleted_app( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29397,13 +29298,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29417,7 +29318,7 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29438,10 +29339,10 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29449,12 +29350,20 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot( @@ -29548,7 +29457,7 @@ def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_initial( # type: ignore + raw_result = self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -29559,6 +29468,7 @@ def begin_restore_snapshot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29621,7 +29531,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29637,7 +29546,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29708,7 +29616,6 @@ def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29725,7 +29632,7 @@ def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29734,7 +29641,7 @@ def get_site_extension( def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29747,7 +29654,7 @@ def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -29758,10 +29665,10 @@ def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29769,16 +29676,15 @@ def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29823,10 +29729,11 @@ def begin_install_site_extension( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29889,7 +29796,6 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29907,13 +29813,13 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statements + def _copy_production_slot_initial( self, resource_group_name: str, name: str, copy_slot_entity: Union[_models.CsmCopySlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29927,7 +29833,7 @@ def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statem api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29948,10 +29854,10 @@ def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29959,12 +29865,20 @@ def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_copy_production_slot( @@ -30058,7 +29972,7 @@ def begin_copy_production_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._copy_production_slot_initial( # type: ignore + raw_result = self._copy_production_slot_initial( resource_group_name=resource_group_name, name=name, copy_slot_entity=copy_slot_entity, @@ -30069,6 +29983,7 @@ def begin_copy_production_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30129,7 +30044,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30145,7 +30059,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30215,7 +30128,6 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30232,7 +30144,7 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30246,7 +30158,7 @@ def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30260,7 +30172,7 @@ def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30282,10 +30194,10 @@ def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30293,15 +30205,15 @@ def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30430,10 +30342,11 @@ def begin_create_or_update_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30511,7 +30424,6 @@ def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30664,7 +30576,6 @@ def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30679,11 +30590,7 @@ def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30735,7 +30642,6 @@ def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30750,7 +30656,7 @@ def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30883,7 +30789,6 @@ def apply_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31029,7 +30934,6 @@ def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31044,7 +30948,7 @@ def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31096,7 +31000,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31112,7 +31015,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31187,7 +31089,6 @@ def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31202,7 +31103,7 @@ def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31254,7 +31155,6 @@ def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31420,7 +31320,6 @@ def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31435,14 +31334,14 @@ def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -31450,7 +31349,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31464,7 +31363,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31487,10 +31386,10 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31498,12 +31397,20 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_slot( @@ -31615,7 +31522,7 @@ def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_slot_initial( # type: ignore + raw_result = self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -31628,6 +31535,7 @@ def begin_restore_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31694,7 +31602,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31710,7 +31617,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31866,7 +31772,6 @@ def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31881,7 +31786,7 @@ def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31930,7 +31835,6 @@ def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31945,7 +31849,7 @@ def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32078,7 +31982,6 @@ def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32093,7 +31996,7 @@ def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32142,7 +32045,6 @@ def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32157,7 +32059,7 @@ def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32290,7 +32192,6 @@ def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32305,7 +32206,7 @@ def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32354,7 +32255,6 @@ def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32369,7 +32269,7 @@ def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32504,7 +32404,6 @@ def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32519,7 +32418,7 @@ def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32568,7 +32467,6 @@ def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32583,7 +32481,7 @@ def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32716,7 +32614,6 @@ def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32731,7 +32628,7 @@ def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32780,7 +32677,6 @@ def delete_backup_configuration_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32840,7 +32736,6 @@ def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32855,7 +32750,7 @@ def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32991,7 +32886,6 @@ def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33006,7 +32900,7 @@ def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33055,7 +32949,6 @@ def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33070,7 +32963,7 @@ def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33119,7 +33012,6 @@ def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33134,7 +33026,7 @@ def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33270,7 +33162,6 @@ def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33285,7 +33176,7 @@ def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33418,7 +33309,6 @@ def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33433,7 +33323,7 @@ def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33482,7 +33372,6 @@ def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33497,7 +33386,7 @@ def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33506,7 +33395,7 @@ def list_metadata_slot( def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33519,7 +33408,7 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -33530,10 +33419,10 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33541,11 +33430,15 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33590,10 +33483,11 @@ def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33741,7 +33635,6 @@ def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33756,7 +33649,7 @@ def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33805,7 +33698,6 @@ def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33820,7 +33712,7 @@ def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33871,7 +33763,6 @@ def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33886,7 +33777,7 @@ def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34019,7 +33910,6 @@ def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34034,7 +33924,7 @@ def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34167,7 +34057,6 @@ def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34182,7 +34071,7 @@ def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34238,7 +34127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34254,7 +34142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34329,7 +34216,6 @@ def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34344,7 +34230,7 @@ def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34396,7 +34282,6 @@ def recover_site_configuration_snapshot_slot( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34456,9 +34341,9 @@ def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -34467,12 +34352,16 @@ def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34521,9 +34410,9 @@ def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -34532,12 +34421,16 @@ def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34589,7 +34482,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34605,7 +34497,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34680,7 +34571,6 @@ def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34697,7 +34587,7 @@ def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34749,7 +34639,6 @@ def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34812,7 +34701,6 @@ def start_continuous_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34875,7 +34763,6 @@ def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34938,7 +34825,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34954,7 +34840,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35029,7 +34914,6 @@ def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35044,7 +34928,7 @@ def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35187,7 +35071,6 @@ def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35202,7 +35085,7 @@ def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35254,7 +35137,6 @@ def delete_deployment_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35318,7 +35200,6 @@ def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35333,7 +35214,7 @@ def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35474,7 +35355,6 @@ def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35489,7 +35369,7 @@ def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35541,7 +35421,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35557,7 +35436,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35632,7 +35510,6 @@ def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35647,7 +35524,7 @@ def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35792,7 +35669,6 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35807,7 +35683,7 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35859,7 +35735,6 @@ def delete_domain_ownership_identifier_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36015,7 +35890,6 @@ def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36030,7 +35904,7 @@ def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36079,7 +35953,6 @@ def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36094,7 +35967,7 @@ def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36108,7 +35981,7 @@ def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36122,7 +35995,7 @@ def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -36144,10 +36017,10 @@ def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36155,13 +36028,15 @@ def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36284,10 +36159,11 @@ def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36351,7 +36227,6 @@ def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36368,7 +36243,7 @@ def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36419,7 +36294,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36435,7 +36309,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36505,7 +36378,6 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36520,7 +36392,7 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36571,7 +36443,6 @@ def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36588,7 +36459,7 @@ def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36603,7 +36474,7 @@ def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36617,7 +36488,7 @@ def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -36640,10 +36511,10 @@ def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36651,11 +36522,15 @@ def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36785,10 +36660,11 @@ def begin_create_instance_function_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36854,7 +36730,6 @@ def delete_instance_function_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37015,7 +36890,6 @@ def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37030,11 +36904,7 @@ def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37088,7 +36958,6 @@ def delete_function_secret_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37150,7 +37019,6 @@ def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37165,7 +37033,7 @@ def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37216,7 +37084,6 @@ def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37231,7 +37098,7 @@ def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37277,7 +37144,6 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37292,7 +37158,7 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37340,7 +37206,6 @@ def list_sync_status_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37399,7 +37264,6 @@ def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37560,7 +37424,6 @@ def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37575,11 +37438,7 @@ def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37633,7 +37492,6 @@ def delete_host_secret_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37696,7 +37554,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37712,7 +37569,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37787,7 +37643,6 @@ def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37802,7 +37657,7 @@ def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37947,7 +37802,6 @@ def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37962,7 +37816,7 @@ def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38014,7 +37868,6 @@ def delete_host_name_binding_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38079,7 +37932,6 @@ def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38094,7 +37946,7 @@ def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38244,7 +38096,6 @@ def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38259,7 +38110,7 @@ def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38313,7 +38164,6 @@ def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38474,7 +38324,6 @@ def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38489,7 +38338,7 @@ def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38537,7 +38386,6 @@ def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38552,7 +38400,7 @@ def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38601,7 +38449,6 @@ def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38616,7 +38463,7 @@ def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38668,7 +38515,6 @@ def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38683,7 +38529,7 @@ def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38827,7 +38673,6 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38842,7 +38687,7 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38894,7 +38739,6 @@ def delete_relay_service_connection_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39049,7 +38893,6 @@ def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39064,7 +38907,7 @@ def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39117,7 +38960,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39133,7 +38975,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39208,7 +39049,6 @@ def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39223,7 +39063,7 @@ def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39275,7 +39115,6 @@ def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39290,7 +39129,7 @@ def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39305,7 +39144,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -39319,7 +39158,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -39342,10 +39181,10 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -39353,13 +39192,15 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39492,10 +39333,11 @@ def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=name-too- params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -39562,7 +39404,6 @@ def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39579,7 +39420,7 @@ def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39637,7 +39478,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39653,7 +39493,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39732,7 +39571,6 @@ def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39749,7 +39587,7 @@ def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39807,7 +39645,6 @@ def delete_instance_process_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39874,9 +39711,9 @@ def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -39885,13 +39722,17 @@ def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39952,7 +39793,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39968,7 +39808,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40057,7 +39896,6 @@ def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40074,7 +39912,7 @@ def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40133,7 +39971,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40149,7 +39986,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40221,7 +40057,6 @@ def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40236,7 +40071,7 @@ def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40288,7 +40123,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40304,7 +40138,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40375,7 +40208,6 @@ def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40390,7 +40222,7 @@ def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40440,7 +40272,6 @@ def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40455,7 +40286,7 @@ def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40504,7 +40335,6 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40519,7 +40349,7 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40672,7 +40502,6 @@ def create_or_update_swift_virtual_network_connection_slot( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40687,7 +40516,7 @@ def create_or_update_swift_virtual_network_connection_slot( # pylint: disable=n error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40736,7 +40565,6 @@ def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40900,7 +40728,6 @@ def update_swift_virtual_network_connection_slot( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40915,7 +40742,7 @@ def update_swift_virtual_network_connection_slot( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40967,7 +40794,6 @@ def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40984,7 +40810,7 @@ def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41036,7 +40862,6 @@ def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41051,11 +40876,7 @@ def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41119,7 +40940,6 @@ def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41134,7 +40954,7 @@ def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41150,7 +40970,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -41163,7 +40983,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -41177,10 +40997,10 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -41188,15 +41008,15 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41257,10 +41077,11 @@ def begin_start_web_site_network_trace_operation_slot( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -41323,7 +41144,6 @@ def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41386,7 +41206,6 @@ def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41401,7 +41220,7 @@ def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41453,7 +41272,6 @@ def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41468,11 +41286,7 @@ def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41524,7 +41338,6 @@ def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41539,7 +41352,7 @@ def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41588,7 +41401,6 @@ def generate_new_site_publishing_password_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41656,7 +41468,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41672,7 +41483,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41744,7 +41554,6 @@ def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41759,7 +41568,7 @@ def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41808,7 +41617,6 @@ def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41823,7 +41631,7 @@ def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41875,7 +41683,6 @@ def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41890,7 +41697,7 @@ def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42033,7 +41840,6 @@ def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42048,7 +41854,7 @@ def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42100,7 +41906,6 @@ def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42254,7 +42059,6 @@ def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42269,7 +42073,7 @@ def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42319,7 +42123,6 @@ def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42334,7 +42137,7 @@ def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42470,7 +42273,6 @@ def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42485,7 +42287,7 @@ def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42533,7 +42335,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42548,7 +42349,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42562,7 +42363,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.PrivateEndpointConnectionResource, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnectionResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42576,7 +42377,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -42598,10 +42399,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -42609,15 +42410,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42742,10 +42543,11 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -42769,7 +42571,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42782,7 +42584,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -42793,10 +42595,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -42804,18 +42606,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42859,10 +42658,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -42920,7 +42720,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42935,7 +42734,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42989,7 +42788,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43005,7 +42803,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43080,7 +42877,6 @@ def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43097,7 +42893,7 @@ def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43151,7 +42947,6 @@ def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43214,9 +43009,9 @@ def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -43225,13 +43020,17 @@ def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43288,7 +43087,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43304,7 +43102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43382,7 +43179,6 @@ def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43399,7 +43195,7 @@ def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43454,7 +43250,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43470,7 +43265,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43545,7 +43339,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43561,7 +43354,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43636,7 +43428,6 @@ def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43651,7 +43442,7 @@ def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43796,7 +43587,6 @@ def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43811,7 +43601,7 @@ def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43863,7 +43653,6 @@ def delete_public_certificate_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44012,9 +43801,9 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -44023,11 +43812,15 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44078,7 +43871,6 @@ def reset_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44153,7 +43945,6 @@ def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44171,14 +43962,14 @@ def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44192,7 +43983,7 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -44214,10 +44005,10 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44225,12 +44016,20 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob_slot( @@ -44333,7 +44132,7 @@ def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -44345,6 +44144,7 @@ def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -44366,14 +44166,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44387,7 +44187,7 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -44409,10 +44209,10 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44420,12 +44220,20 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app_slot( @@ -44528,7 +44336,7 @@ def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -44540,6 +44348,7 @@ def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -44561,14 +44370,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44582,7 +44391,7 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -44604,10 +44413,10 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44615,12 +44424,20 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot_slot( @@ -44726,7 +44543,7 @@ def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_slot_initial( # type: ignore + raw_result = self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -44738,6 +44555,7 @@ def begin_restore_snapshot_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -44804,7 +44622,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44820,7 +44637,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44895,7 +44711,6 @@ def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44912,7 +44727,7 @@ def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44921,7 +44736,7 @@ def get_site_extension_slot( def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44934,7 +44749,7 @@ def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -44946,10 +44761,10 @@ def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44957,16 +44772,15 @@ def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45015,10 +44829,11 @@ def begin_install_site_extension_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -45085,7 +44900,6 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45103,14 +44917,14 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) # type: ignore - def _copy_slot_initial( # pylint: disable=inconsistent-return-statements + def _copy_slot_initial( self, resource_group_name: str, name: str, slot: str, copy_slot_entity: Union[_models.CsmCopySlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45124,7 +44938,7 @@ def _copy_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -45146,10 +44960,10 @@ def _copy_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45157,12 +44971,20 @@ def _copy_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_copy_slot( @@ -45268,7 +45090,7 @@ def begin_copy_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._copy_slot_initial( # type: ignore + raw_result = self._copy_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -45280,6 +45102,7 @@ def begin_copy_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -45429,7 +45252,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45445,7 +45267,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45475,14 +45296,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45496,7 +45317,7 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -45518,10 +45339,10 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45529,12 +45350,20 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot( @@ -45637,7 +45466,7 @@ def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_initial( # type: ignore + raw_result = self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -45649,6 +45478,7 @@ def begin_swap_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -45714,7 +45544,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45730,7 +45559,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45804,7 +45632,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45820,7 +45647,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45892,7 +45718,6 @@ def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45907,14 +45732,7 @@ def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45928,7 +45746,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45942,7 +45760,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -45964,10 +45782,10 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45975,18 +45793,15 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46111,10 +45926,11 @@ def begin_create_or_update_source_control_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -46178,7 +45994,6 @@ def delete_source_control_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46324,7 +46139,6 @@ def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46339,14 +46153,7 @@ def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46395,7 +46202,6 @@ def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46422,7 +46228,7 @@ def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46435,7 +46241,7 @@ def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -46449,10 +46255,10 @@ def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46460,15 +46266,15 @@ def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46529,10 +46335,11 @@ def begin_start_network_trace_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -46596,7 +46403,6 @@ def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46655,7 +46461,6 @@ def stop_network_trace_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46715,7 +46520,6 @@ def sync_repository_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46774,7 +46578,6 @@ def sync_function_triggers_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46837,7 +46640,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46853,7 +46655,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46928,7 +46729,6 @@ def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46945,7 +46745,7 @@ def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46997,7 +46797,6 @@ def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47063,7 +46862,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47079,7 +46877,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47157,7 +46954,6 @@ def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47174,7 +46970,7 @@ def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47226,7 +47022,6 @@ def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47295,7 +47090,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47311,7 +47105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47383,7 +47176,6 @@ def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47398,7 +47190,7 @@ def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47450,7 +47242,6 @@ def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47465,7 +47256,7 @@ def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47616,7 +47407,6 @@ def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47631,7 +47421,7 @@ def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47683,7 +47473,6 @@ def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47845,7 +47634,6 @@ def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47860,7 +47648,7 @@ def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47916,7 +47704,6 @@ def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47933,7 +47720,7 @@ def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48089,7 +47876,6 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48104,7 +47890,7 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48260,7 +48046,6 @@ def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48275,7 +48060,7 @@ def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48327,7 +48112,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48343,7 +48127,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48418,7 +48201,6 @@ def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48433,7 +48215,7 @@ def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48555,7 +48337,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48571,7 +48352,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48601,13 +48381,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48621,7 +48401,7 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48642,10 +48422,10 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48653,12 +48433,20 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot_with_production( @@ -48749,7 +48537,7 @@ def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_with_production_initial( # type: ignore + raw_result = self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -48760,6 +48548,7 @@ def begin_swap_slot_with_production( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -48820,7 +48609,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48836,7 +48624,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48907,7 +48694,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48923,7 +48709,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48989,7 +48774,6 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49004,14 +48788,7 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49024,7 +48801,7 @@ def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -49038,7 +48815,7 @@ def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -49059,10 +48836,10 @@ def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -49070,18 +48847,15 @@ def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49193,10 +48967,11 @@ def begin_create_or_update_source_control( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -49256,7 +49031,6 @@ def delete_source_control( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49389,7 +49163,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49404,14 +49177,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49456,7 +49222,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49482,7 +49247,7 @@ def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -49495,7 +49260,7 @@ def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-06-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -49508,10 +49273,10 @@ def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -49519,15 +49284,15 @@ def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49584,10 +49349,11 @@ def begin_start_network_trace( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -49647,7 +49413,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49703,7 +49468,6 @@ def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49759,7 +49523,6 @@ def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49815,7 +49578,6 @@ def sync_function_triggers( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49874,7 +49636,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49890,7 +49651,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49961,7 +49721,6 @@ def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49978,7 +49737,7 @@ def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50026,7 +49785,6 @@ def delete_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50088,7 +49846,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50104,7 +49861,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50178,7 +49934,6 @@ def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50195,7 +49950,7 @@ def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50243,7 +49998,6 @@ def run_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50308,7 +50062,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50324,7 +50077,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50390,7 +50142,6 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50405,7 +50156,7 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50453,7 +50204,6 @@ def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50468,7 +50218,7 @@ def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50606,7 +50356,6 @@ def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50621,7 +50370,7 @@ def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50669,7 +50418,6 @@ def delete_vnet_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50818,7 +50566,6 @@ def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50833,7 +50580,7 @@ def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50885,7 +50632,6 @@ def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50902,7 +50648,7 @@ def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51045,7 +50791,6 @@ def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51060,7 +50805,7 @@ def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51203,7 +50948,6 @@ def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51218,7 +50962,7 @@ def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51264,7 +51008,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51280,7 +51023,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51349,7 +51091,6 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51364,7 +51105,7 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_web_site_management_client_operations.py index eba76053b612f..4a1d375b63867 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_06_01/operations/_web_site_management_client_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -538,7 +537,6 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -553,7 +551,7 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -642,7 +640,6 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -657,7 +654,7 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -698,7 +695,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -714,7 +710,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -778,7 +773,6 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +787,7 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -901,7 +895,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -916,7 +909,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -966,7 +959,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -982,7 +974,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1060,7 +1051,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1075,7 +1065,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1115,7 +1105,6 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1130,7 +1119,7 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1196,7 +1185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1212,7 +1200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1332,7 +1319,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1348,7 +1334,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1413,7 +1398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1429,7 +1413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1491,7 +1474,6 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1506,7 +1488,7 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1605,7 +1587,6 @@ def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1620,7 +1601,7 @@ def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1733,7 +1714,6 @@ def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1853,7 +1833,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1868,7 +1847,7 @@ def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1981,7 +1960,6 @@ def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_metadata.json index 25ef227ae5d5c..935b8d5a10bfe 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_vendor.py index fd66631892ed1..abd2e5566a353 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from .._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class WebSiteManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_web_site_management_client.py index c8c670670b86b..ce697b15a7e58 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -194,7 +195,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/_vendor.py index 39f69956b8888..6e80ec49ed289 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/_web_site_management_client.py index 92bcf6f776828..0ef70eac95191 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -196,7 +197,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_app_service_certificate_orders_operations.py index 7ba04f631fadd..3bfdf3af04350 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_certificate_orders_operations import ( build_create_or_update_certificate_request, build_create_or_update_request, @@ -119,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -254,7 +266,6 @@ async def validate_purchase_information( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +405,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +419,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +432,7 @@ async def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -438,7 +446,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -459,10 +467,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -470,15 +478,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -595,10 +603,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -658,7 +667,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +801,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -808,11 +815,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -862,7 +865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -878,7 +880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -949,7 +950,6 @@ async def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -964,7 +964,7 @@ async def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -978,7 +978,7 @@ async def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -992,7 +992,7 @@ async def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1014,10 +1014,10 @@ async def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1025,15 +1025,15 @@ async def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1157,10 +1157,11 @@ async def begin_create_or_update_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1223,7 +1224,6 @@ async def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1366,7 +1366,6 @@ async def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1381,11 +1380,7 @@ async def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1507,7 +1502,6 @@ async def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1640,7 +1634,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1696,7 +1689,6 @@ async def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1827,7 +1819,6 @@ async def resend_request_emails( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1958,7 +1949,6 @@ async def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1973,7 +1963,7 @@ async def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2018,7 +2008,6 @@ async def verify_domain_ownership( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2074,7 +2063,6 @@ async def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2089,7 +2077,7 @@ async def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2134,7 +2122,6 @@ async def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2149,7 +2136,7 @@ async def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_app_service_environments_operations.py index 70e884ff9815d..77c0e59917927 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_app_service_environments_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_environments_operations import ( build_change_vnet_request, build_create_or_update_multi_role_pool_request, @@ -135,7 +149,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -151,7 +164,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -221,7 +233,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -237,7 +248,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -303,7 +313,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -318,7 +327,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -331,7 +340,7 @@ async def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -345,7 +354,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -366,10 +375,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -377,18 +386,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -505,10 +511,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -530,9 +537,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -545,7 +552,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -556,10 +563,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -567,12 +574,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -603,7 +618,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -613,6 +628,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -751,7 +767,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -766,14 +781,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,7 +830,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -838,7 +845,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -904,7 +910,6 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -919,7 +924,7 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -932,7 +937,7 @@ async def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -946,7 +951,7 @@ async def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -967,10 +972,10 @@ async def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -978,15 +983,15 @@ async def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1115,7 +1120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1131,13 +1135,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1174,6 +1177,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -1239,7 +1243,6 @@ async def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1254,7 +1257,7 @@ async def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1302,7 +1305,6 @@ async def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1317,7 +1319,7 @@ async def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1367,7 +1369,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1383,7 +1384,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1455,7 +1455,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1471,7 +1470,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1539,7 +1537,6 @@ async def get_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1554,7 +1551,7 @@ async def get_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1567,7 +1564,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1581,7 +1578,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1602,10 +1599,10 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1613,15 +1610,15 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1735,10 +1732,11 @@ async def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1874,7 +1872,6 @@ async def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1889,11 +1886,7 @@ async def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1948,7 +1941,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1964,7 +1956,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2037,7 +2028,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2053,7 +2043,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2124,7 +2113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2140,7 +2128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2211,7 +2198,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2227,7 +2213,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2293,7 +2278,6 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2308,7 +2292,7 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2358,7 +2342,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2374,7 +2357,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2442,7 +2424,6 @@ async def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2460,7 +2441,7 @@ async def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2473,7 +2454,7 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -2483,10 +2464,10 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2494,15 +2475,15 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2553,7 +2534,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2569,13 +2549,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2610,6 +2589,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2679,7 +2659,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2695,7 +2674,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2770,7 +2748,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2786,7 +2763,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2816,7 +2792,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2829,7 +2805,7 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -2839,10 +2815,10 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2850,15 +2826,15 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2909,7 +2885,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2925,13 +2900,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2966,6 +2940,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3041,7 +3016,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3057,7 +3031,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3129,7 +3102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3145,7 +3117,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3216,7 +3187,6 @@ async def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3231,7 +3201,7 @@ async def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3245,7 +3215,7 @@ async def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3259,7 +3229,7 @@ async def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3281,10 +3251,10 @@ async def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3292,15 +3262,15 @@ async def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3423,10 +3393,11 @@ async def begin_create_or_update_worker_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3571,7 +3542,6 @@ async def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3586,11 +3556,7 @@ async def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3646,7 +3612,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3662,7 +3627,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3738,7 +3702,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3754,7 +3717,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3828,7 +3790,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3844,7 +3805,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3918,7 +3878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3934,7 +3893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_app_service_plans_operations.py index 1636ab84804dd..db76838a776da 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_app_service_plans_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_plans_operations import ( build_create_or_update_request, build_create_or_update_vnet_route_request, @@ -131,7 +145,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -147,7 +160,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -216,7 +228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -298,7 +308,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +324,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +337,7 @@ async def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -342,7 +351,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -363,10 +372,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -374,15 +383,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -492,10 +501,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -555,7 +565,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -687,7 +696,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -702,11 +710,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -749,7 +753,6 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -764,7 +767,7 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -815,7 +818,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -830,7 +832,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -881,7 +883,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -943,7 +944,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -958,7 +958,7 @@ async def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1012,7 +1012,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1028,7 +1027,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1096,7 +1094,6 @@ async def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1111,7 +1108,7 @@ async def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1160,7 +1157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1176,7 +1172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1250,7 +1245,6 @@ async def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1328,7 +1322,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1344,7 +1337,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1410,7 +1402,6 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1425,7 +1416,7 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1479,7 +1470,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1495,7 +1485,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1561,7 +1550,6 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1576,7 +1564,7 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1624,7 +1612,6 @@ async def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1641,7 +1628,7 @@ async def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1692,7 +1679,6 @@ async def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1693,7 @@ async def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1847,7 +1833,6 @@ async def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1862,7 +1847,7 @@ async def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1910,7 +1895,6 @@ async def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1925,7 +1909,7 @@ async def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1976,7 +1960,6 @@ async def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1993,7 +1976,7 @@ async def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2133,7 +2116,6 @@ async def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2150,7 +2132,7 @@ async def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2201,7 +2183,6 @@ async def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2352,7 +2333,6 @@ async def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2369,7 +2349,7 @@ async def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2417,7 +2397,6 @@ async def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_certificate_registration_provider_operations.py index c138227aef154..42d916f25a4d8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_certificate_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_certificates_operations.py index 57b03a4166da1..b1f37f3d2acaf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -101,7 +99,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -183,7 +179,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -199,7 +194,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -265,7 +259,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +273,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +393,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -415,7 +407,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -592,7 +583,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -607,7 +597,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_deleted_web_apps_operations.py index 2b7deff1d23b7..b9b40a27ed128 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_deleted_web_apps_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_web_apps_operations import ( build_get_deleted_web_app_by_location_request, build_list_by_location_request, @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -179,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +257,6 @@ async def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +271,7 @@ async def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_diagnostics_operations.py index 021bb712dd6bf..5f198b0dec88a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._diagnostics_operations import ( build_execute_site_analysis_request, build_execute_site_analysis_slot_request, @@ -126,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +225,6 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +239,7 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,7 +288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -309,7 +303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +389,6 @@ async def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +403,7 @@ async def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -476,7 +467,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -547,7 +537,6 @@ async def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -562,7 +551,7 @@ async def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -630,7 +618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -704,7 +691,6 @@ async def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,7 +705,7 @@ async def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +773,6 @@ async def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +787,7 @@ async def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -854,7 +839,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -870,7 +854,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -944,7 +927,6 @@ async def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -959,7 +941,7 @@ async def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1027,7 +1009,6 @@ async def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1042,7 +1023,7 @@ async def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1094,7 +1075,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1110,7 +1090,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1201,7 +1180,6 @@ async def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1216,7 +1194,7 @@ async def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1268,7 +1246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1284,7 +1261,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1358,7 +1334,6 @@ async def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1373,7 +1348,7 @@ async def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1428,7 +1403,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1444,7 +1418,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1527,7 +1500,6 @@ async def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1542,7 +1514,7 @@ async def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1614,7 +1586,6 @@ async def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1629,7 +1600,7 @@ async def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1684,7 +1655,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1700,7 +1670,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1783,7 +1752,6 @@ async def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1798,7 +1766,7 @@ async def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1870,7 +1838,6 @@ async def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1885,7 +1852,7 @@ async def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_domain_registration_provider_operations.py index a5ca501c5e5c5..a7988fca5375f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_domain_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_domains_operations.py index 51fd81a7769bd..b824b6deb2713 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_check_availability_request, build_create_or_update_ownership_identifier_request, @@ -162,7 +162,6 @@ async def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -177,7 +176,7 @@ async def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -217,7 +216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -233,7 +231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +290,6 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -308,7 +304,7 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -408,7 +404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -424,7 +419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -490,7 +484,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -506,7 +499,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -572,7 +564,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -587,7 +578,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -596,7 +587,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -610,7 +601,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,10 +622,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -642,15 +633,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,10 +747,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -824,7 +816,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -955,7 +946,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -970,11 +960,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1024,7 +1010,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1040,7 +1025,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1111,7 +1095,6 @@ async def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1126,7 +1109,7 @@ async def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1265,7 +1248,6 @@ async def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1280,7 +1262,7 @@ async def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1328,7 +1310,6 @@ async def delete_ownership_identifier( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1478,7 +1459,6 @@ async def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1493,7 +1473,7 @@ async def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1538,7 +1518,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_provider_operations.py index 32f15827a41d8..fb800fd3b5fbf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._provider_operations import ( build_get_available_stacks_on_prem_request, build_get_available_stacks_request, @@ -103,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -185,7 +181,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -201,7 +196,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -272,7 +266,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -288,7 +281,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_recommendations_operations.py index c8f7e77ed4568..176599280d12f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_recommendations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommendations_operations import ( build_disable_all_for_hosting_environment_request, build_disable_all_for_web_app_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -198,7 +194,6 @@ async def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +246,6 @@ async def disable_recommendation_for_subscription( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -326,7 +320,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -342,7 +335,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -428,7 +420,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +435,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -515,7 +505,6 @@ async def disable_all_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +563,6 @@ async def reset_all_filters_for_hosting_environment( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +635,6 @@ async def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -662,7 +649,7 @@ async def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -713,7 +700,6 @@ async def disable_recommendation_for_hosting_environment( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -788,7 +774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -804,7 +789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -890,7 +874,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -906,7 +889,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +956,6 @@ async def disable_all_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1030,7 +1011,6 @@ async def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1103,7 +1083,6 @@ async def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1118,7 +1097,7 @@ async def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1145,6 @@ async def disable_recommendation_for_site( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_resource_health_metadata_operations.py index 23765fb9c21dc..42e54b264c83a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_resource_health_metadata_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._resource_health_metadata_operations import ( build_get_by_site_request, build_get_by_site_slot_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -277,7 +271,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -293,7 +286,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -359,7 +351,6 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +365,7 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -428,7 +419,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +434,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -516,7 +505,6 @@ async def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -531,7 +519,7 @@ async def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_static_sites_operations.py index 4f666a6bde3e8..f56b287b48a67 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_static_sites_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._static_sites_operations import ( build_create_or_update_static_site_build_function_app_settings_request, build_create_or_update_static_site_custom_domain_request, @@ -197,7 +195,6 @@ async def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +209,7 @@ async def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -254,7 +251,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -270,7 +266,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -340,7 +335,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -356,7 +350,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -424,7 +417,6 @@ async def get_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -439,7 +431,7 @@ async def get_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -562,7 +554,6 @@ async def create_or_update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -577,11 +568,7 @@ async def create_or_update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -626,7 +613,6 @@ async def delete_static_site( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -760,7 +746,6 @@ async def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -775,11 +760,7 @@ async def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -832,7 +813,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -848,7 +828,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -922,7 +901,6 @@ async def delete_static_site_user( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1076,7 +1054,6 @@ async def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1091,7 +1068,7 @@ async def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1141,7 +1118,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1157,7 +1133,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1228,7 +1203,6 @@ async def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1243,7 +1217,7 @@ async def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1291,7 +1265,6 @@ async def delete_static_site_build( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1431,7 +1404,6 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1446,11 +1418,7 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1503,7 +1471,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1519,7 +1486,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1590,7 +1556,6 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1605,11 +1570,7 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1728,7 +1689,6 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1743,11 +1703,7 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1871,7 +1827,6 @@ async def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1886,7 +1841,7 @@ async def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1936,7 +1891,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1952,7 +1906,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2023,7 +1976,6 @@ async def create_or_update_static_site_custom_domain( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2038,11 +1990,7 @@ async def create_or_update_static_site_custom_domain( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2090,7 +2038,6 @@ async def delete_static_site_custom_domain( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2149,7 +2096,6 @@ async def validate_custom_domain_can_be_added_to_static_site( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2205,7 +2151,6 @@ async def detach_static_site( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2266,7 +2211,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2282,7 +2226,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2350,7 +2293,6 @@ async def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2365,11 +2307,7 @@ async def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2414,7 +2352,6 @@ async def list_static_site_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2429,7 +2366,7 @@ async def list_static_site_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2551,7 +2488,6 @@ async def reset_static_site_api_key( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_top_level_domains_operations.py index ffddea8c9ec22..100c8a02e483e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_level_domains_operations import ( build_get_request, build_list_agreements_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -178,7 +174,6 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_web_apps_operations.py index d0fe62b99ff42..550b13ec97605 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_web_apps_operations.py @@ -32,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -45,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_apps_operations import ( build_add_premier_add_on_request, build_add_premier_add_on_slot_request, @@ -486,7 +486,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -502,7 +501,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -575,7 +573,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -591,7 +588,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -657,7 +653,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -674,7 +669,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -683,7 +678,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio async def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -697,7 +692,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -718,10 +713,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -729,15 +724,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -849,10 +844,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -924,7 +920,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1064,7 +1059,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1079,11 +1073,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1131,7 +1121,6 @@ async def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1146,7 +1135,7 @@ async def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1266,7 +1255,6 @@ async def apply_slot_config_to_production( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1395,7 +1383,6 @@ async def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1410,7 +1397,7 @@ async def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1456,7 +1443,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1472,7 +1458,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1543,7 +1528,6 @@ async def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1558,7 +1542,7 @@ async def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1606,7 +1590,6 @@ async def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1759,7 +1742,6 @@ async def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,21 +1756,21 @@ async def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_initial( # pylint: disable=inconsistent-return-statements + async def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1802,7 +1784,7 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1824,10 +1806,10 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1835,12 +1817,20 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore( @@ -1940,7 +1930,7 @@ async def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_initial( # type: ignore + raw_result = await self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -1952,6 +1942,7 @@ async def begin_restore( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2011,7 +2002,6 @@ async def get_basic_publishing_credentials_policies( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2026,7 +2016,7 @@ async def get_basic_publishing_credentials_policies( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2071,7 +2061,6 @@ async def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2086,7 +2075,7 @@ async def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2210,7 +2199,6 @@ async def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2225,7 +2213,7 @@ async def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2270,7 +2258,6 @@ async def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2285,7 +2272,7 @@ async def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2409,7 +2396,6 @@ async def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2424,7 +2410,7 @@ async def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2473,7 +2459,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2489,7 +2474,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2632,7 +2616,6 @@ async def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2647,7 +2630,7 @@ async def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2692,7 +2675,6 @@ async def list_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2707,7 +2689,7 @@ async def list_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2827,7 +2809,6 @@ async def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2842,7 +2823,7 @@ async def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2885,7 +2866,6 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2900,7 +2880,7 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3020,7 +3000,6 @@ async def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3035,7 +3014,7 @@ async def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3080,7 +3059,6 @@ async def get_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3095,7 +3073,7 @@ async def get_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3217,7 +3195,6 @@ async def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3232,7 +3209,7 @@ async def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3277,7 +3254,6 @@ async def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3292,7 +3268,7 @@ async def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3408,7 +3384,6 @@ async def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3423,7 +3398,7 @@ async def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3468,7 +3443,6 @@ async def delete_backup_configuration( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3524,7 +3498,6 @@ async def get_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3539,7 +3512,7 @@ async def get_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3662,7 +3635,6 @@ async def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3677,7 +3649,7 @@ async def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3722,7 +3694,6 @@ async def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3737,7 +3708,7 @@ async def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3782,7 +3753,6 @@ async def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3797,7 +3767,7 @@ async def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3920,7 +3890,6 @@ async def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3935,7 +3904,7 @@ async def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4051,7 +4020,6 @@ async def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4066,7 +4034,7 @@ async def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4109,7 +4077,6 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4124,7 +4091,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4133,7 +4100,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any async def _list_publishing_credentials_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4146,7 +4113,7 @@ async def _list_publishing_credentials_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -4156,10 +4123,10 @@ async def _list_publishing_credentials_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4167,11 +4134,15 @@ async def _list_publishing_credentials_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4212,10 +4183,11 @@ async def begin_list_publishing_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4346,7 +4318,6 @@ async def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4361,7 +4332,7 @@ async def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4404,7 +4375,6 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4419,7 +4389,7 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4464,7 +4434,6 @@ async def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4479,7 +4448,7 @@ async def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4608,7 +4577,6 @@ async def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4623,7 +4591,7 @@ async def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4668,7 +4636,6 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4683,7 +4650,7 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4803,7 +4770,6 @@ async def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4818,7 +4784,7 @@ async def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4938,7 +4904,6 @@ async def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4953,7 +4918,7 @@ async def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5005,7 +4970,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5021,7 +4985,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5092,7 +5055,6 @@ async def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5107,7 +5069,7 @@ async def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5155,7 +5117,6 @@ async def recover_site_configuration_snapshot( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5211,9 +5172,9 @@ async def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5222,12 +5183,16 @@ async def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5272,9 +5237,9 @@ async def get_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5283,12 +5248,16 @@ async def get_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5337,7 +5306,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5353,7 +5321,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5424,7 +5391,6 @@ async def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5441,7 +5407,7 @@ async def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5489,7 +5455,6 @@ async def delete_continuous_web_job( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5548,7 +5513,6 @@ async def start_continuous_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5607,7 +5571,6 @@ async def stop_continuous_web_job( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5666,7 +5629,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5682,7 +5644,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5751,7 +5712,6 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5766,7 +5726,7 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5896,7 +5856,6 @@ async def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5911,7 +5870,7 @@ async def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5959,7 +5918,6 @@ async def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6019,7 +5977,6 @@ async def list_deployment_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6034,7 +5991,7 @@ async def list_deployment_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6158,7 +6115,6 @@ async def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6173,7 +6129,7 @@ async def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6221,7 +6177,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6237,7 +6192,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6308,7 +6262,6 @@ async def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6323,7 +6276,7 @@ async def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6455,7 +6408,6 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6470,7 +6422,7 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6518,7 +6470,6 @@ async def delete_domain_ownership_identifier( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6661,7 +6612,6 @@ async def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6676,7 +6626,7 @@ async def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6719,7 +6669,6 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6734,7 +6683,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6743,7 +6692,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar async def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6757,7 +6706,7 @@ async def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6778,10 +6727,10 @@ async def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6789,13 +6738,15 @@ async def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6901,10 +6852,11 @@ async def begin_create_ms_deploy_operation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6964,7 +6916,6 @@ async def get_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6981,7 +6932,7 @@ async def get_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7030,7 +6981,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7046,7 +6996,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7112,7 +7061,6 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7127,7 +7075,7 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7175,7 +7123,6 @@ async def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7192,7 +7139,7 @@ async def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7206,7 +7153,7 @@ async def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7220,7 +7167,7 @@ async def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7242,10 +7189,10 @@ async def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7253,11 +7200,15 @@ async def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7377,10 +7328,11 @@ async def begin_create_function( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7443,7 +7395,6 @@ async def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7594,7 +7545,6 @@ async def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7609,11 +7559,7 @@ async def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7664,7 +7610,6 @@ async def delete_function_secret( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7723,7 +7668,6 @@ async def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7738,7 +7682,7 @@ async def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7786,7 +7730,6 @@ async def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7801,7 +7744,7 @@ async def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7844,7 +7787,6 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7859,7 +7801,7 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7904,7 +7846,6 @@ async def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7960,7 +7901,6 @@ async def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8111,7 +8051,6 @@ async def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8126,11 +8065,7 @@ async def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8181,7 +8116,6 @@ async def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8241,7 +8175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8257,7 +8190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8328,7 +8260,6 @@ async def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8343,7 +8274,7 @@ async def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8475,7 +8406,6 @@ async def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8490,7 +8420,7 @@ async def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8538,7 +8468,6 @@ async def delete_host_name_binding( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8600,7 +8529,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8615,7 +8543,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8755,7 +8683,6 @@ async def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8770,7 +8697,7 @@ async def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8821,7 +8748,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8972,7 +8898,6 @@ async def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8987,7 +8912,7 @@ async def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9032,7 +8957,6 @@ async def list_hybrid_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9047,7 +8971,7 @@ async def list_hybrid_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9092,7 +9016,6 @@ async def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9107,7 +9030,7 @@ async def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9155,7 +9078,6 @@ async def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9170,7 +9092,7 @@ async def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9301,7 +9223,6 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9316,7 +9237,7 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9364,7 +9285,6 @@ async def delete_relay_service_connection( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9506,7 +9426,6 @@ async def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9521,7 +9440,7 @@ async def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9571,7 +9490,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9587,7 +9505,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9658,7 +9575,6 @@ async def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9673,7 +9589,7 @@ async def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9721,7 +9637,6 @@ async def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9736,7 +9651,7 @@ async def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9750,7 +9665,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9764,7 +9679,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -9786,10 +9701,10 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9797,13 +9712,15 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9923,10 +9840,11 @@ async def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9989,7 +9907,6 @@ async def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10006,7 +9923,7 @@ async def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10060,7 +9977,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10076,7 +9992,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10151,7 +10066,6 @@ async def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10168,7 +10082,7 @@ async def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10222,7 +10136,6 @@ async def delete_instance_process( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10285,9 +10198,9 @@ async def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10296,13 +10209,17 @@ async def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10360,7 +10277,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10376,7 +10292,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10454,7 +10369,6 @@ async def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10471,7 +10385,7 @@ async def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10527,7 +10441,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10543,7 +10456,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10609,7 +10521,6 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10624,7 +10535,7 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10672,7 +10583,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10688,7 +10598,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10756,7 +10665,6 @@ async def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10771,7 +10679,7 @@ async def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10785,7 +10693,7 @@ async def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10799,7 +10707,7 @@ async def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10821,10 +10729,10 @@ async def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10832,11 +10740,15 @@ async def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10960,10 +10872,11 @@ async def begin_migrate_storage( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10991,7 +10904,7 @@ async def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11005,7 +10918,7 @@ async def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11026,10 +10939,10 @@ async def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11037,11 +10950,15 @@ async def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11152,10 +11069,11 @@ async def begin_migrate_my_sql( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11217,7 +11135,6 @@ async def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11232,7 +11149,7 @@ async def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11277,7 +11194,6 @@ async def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11292,7 +11208,7 @@ async def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11432,7 +11348,6 @@ async def create_or_update_swift_virtual_network_connection( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11447,7 +11362,7 @@ async def create_or_update_swift_virtual_network_connection( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11492,7 +11407,6 @@ async def delete_swift_virtual_network( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11643,7 +11557,6 @@ async def update_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11658,7 +11571,7 @@ async def update_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11706,7 +11619,6 @@ async def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11723,7 +11635,7 @@ async def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11771,7 +11683,6 @@ async def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11786,11 +11697,7 @@ async def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11850,7 +11757,6 @@ async def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11865,7 +11771,7 @@ async def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11880,7 +11786,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11893,7 +11799,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -11906,10 +11812,10 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11917,15 +11823,15 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11983,10 +11889,11 @@ async def begin_start_web_site_network_trace_operation( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12046,7 +11953,6 @@ async def stop_web_site_network_trace( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12105,7 +12011,6 @@ async def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12120,7 +12025,7 @@ async def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12168,7 +12073,6 @@ async def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12183,11 +12087,7 @@ async def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12235,7 +12135,6 @@ async def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12250,7 +12149,7 @@ async def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12295,7 +12194,6 @@ async def generate_new_site_publishing_password( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12360,7 +12258,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -12376,7 +12273,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -12444,7 +12340,6 @@ async def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12459,7 +12354,7 @@ async def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12502,7 +12397,6 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12517,7 +12411,7 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12565,7 +12459,6 @@ async def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12580,7 +12473,7 @@ async def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12710,7 +12603,6 @@ async def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12725,7 +12617,7 @@ async def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12773,7 +12665,6 @@ async def delete_premier_add_on( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12914,7 +12805,6 @@ async def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12929,7 +12819,7 @@ async def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12974,7 +12864,6 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12989,7 +12878,7 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13111,7 +13000,6 @@ async def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13126,7 +13014,7 @@ async def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13176,7 +13064,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13192,7 +13079,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13263,7 +13149,6 @@ async def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13280,7 +13165,7 @@ async def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13330,7 +13215,6 @@ async def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13389,9 +13273,9 @@ async def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13400,13 +13284,17 @@ async def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13460,7 +13348,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13476,7 +13363,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13550,7 +13436,6 @@ async def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13567,7 +13452,7 @@ async def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13619,7 +13504,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13635,7 +13519,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13707,7 +13590,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13723,7 +13605,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13794,7 +13675,6 @@ async def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13809,7 +13689,7 @@ async def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13941,7 +13821,6 @@ async def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13956,7 +13835,7 @@ async def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14004,7 +13883,6 @@ async def delete_public_certificate( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14140,9 +14018,9 @@ async def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14151,11 +14029,15 @@ async def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14202,7 +14084,6 @@ async def reset_production_slot_config( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14272,7 +14153,6 @@ async def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14290,9 +14170,9 @@ async def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14306,7 +14186,7 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14327,10 +14207,10 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14338,12 +14218,20 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob( @@ -14430,7 +14318,7 @@ async def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -14441,6 +14329,7 @@ async def begin_restore_from_backup_blob( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -14462,13 +14351,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14482,7 +14371,7 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14503,10 +14392,10 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14514,12 +14403,20 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app( @@ -14610,7 +14507,7 @@ async def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -14621,6 +14518,7 @@ async def begin_restore_from_deleted_app( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -14642,13 +14540,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14662,7 +14560,7 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14683,10 +14581,10 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14694,12 +14592,20 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot( @@ -14793,7 +14699,7 @@ async def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_initial( # type: ignore + raw_result = await self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -14804,6 +14710,7 @@ async def begin_restore_snapshot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -14867,7 +14774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14883,7 +14789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14954,7 +14859,6 @@ async def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14971,7 +14875,7 @@ async def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14980,7 +14884,7 @@ async def get_site_extension( async def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14993,7 +14897,7 @@ async def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -15004,10 +14908,10 @@ async def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15015,16 +14919,15 @@ async def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15070,10 +14973,11 @@ async def begin_install_site_extension( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15136,7 +15040,6 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15154,13 +15057,13 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statements + async def _copy_production_slot_initial( self, resource_group_name: str, name: str, copy_slot_entity: Union[_models.CsmCopySlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15174,7 +15077,7 @@ async def _copy_production_slot_initial( # pylint: disable=inconsistent-return- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15195,10 +15098,10 @@ async def _copy_production_slot_initial( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15206,12 +15109,20 @@ async def _copy_production_slot_initial( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_copy_production_slot( @@ -15305,7 +15216,7 @@ async def begin_copy_production_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._copy_production_slot_initial( # type: ignore + raw_result = await self._copy_production_slot_initial( resource_group_name=resource_group_name, name=name, copy_slot_entity=copy_slot_entity, @@ -15316,6 +15227,7 @@ async def begin_copy_production_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15376,7 +15288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15392,7 +15303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15462,7 +15372,6 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15479,7 +15388,7 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15493,7 +15402,7 @@ async def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15507,7 +15416,7 @@ async def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15529,10 +15438,10 @@ async def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15540,15 +15449,15 @@ async def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15677,10 +15586,11 @@ async def begin_create_or_update_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15758,7 +15668,6 @@ async def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15911,7 +15820,6 @@ async def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15926,11 +15834,7 @@ async def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15982,7 +15886,6 @@ async def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15997,7 +15900,7 @@ async def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16130,7 +16033,6 @@ async def apply_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16276,7 +16178,6 @@ async def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16291,7 +16192,7 @@ async def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16343,7 +16244,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16359,7 +16259,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16434,7 +16333,6 @@ async def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16449,7 +16347,7 @@ async def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16501,7 +16399,6 @@ async def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16667,7 +16564,6 @@ async def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16682,14 +16578,14 @@ async def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -16697,7 +16593,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16711,7 +16607,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16734,10 +16630,10 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16745,12 +16641,20 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_slot( @@ -16862,7 +16766,7 @@ async def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_slot_initial( # type: ignore + raw_result = await self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -16875,6 +16779,7 @@ async def begin_restore_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16942,7 +16847,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16958,7 +16862,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17114,7 +17017,6 @@ async def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17129,7 +17031,7 @@ async def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17178,7 +17080,6 @@ async def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17193,7 +17094,7 @@ async def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17326,7 +17227,6 @@ async def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17341,7 +17241,7 @@ async def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17390,7 +17290,6 @@ async def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17405,7 +17304,7 @@ async def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17538,7 +17437,6 @@ async def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17553,7 +17451,7 @@ async def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17602,7 +17500,6 @@ async def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17617,7 +17514,7 @@ async def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17752,7 +17649,6 @@ async def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17767,7 +17663,7 @@ async def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17816,7 +17712,6 @@ async def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17831,7 +17726,7 @@ async def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17964,7 +17859,6 @@ async def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17979,7 +17873,7 @@ async def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18028,7 +17922,6 @@ async def delete_backup_configuration_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18088,7 +17981,6 @@ async def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18103,7 +17995,7 @@ async def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18239,7 +18131,6 @@ async def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18254,7 +18145,7 @@ async def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18303,7 +18194,6 @@ async def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18318,7 +18208,7 @@ async def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18367,7 +18257,6 @@ async def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18382,7 +18271,7 @@ async def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18518,7 +18407,6 @@ async def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18533,7 +18421,7 @@ async def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18666,7 +18554,6 @@ async def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18681,7 +18568,7 @@ async def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18730,7 +18617,6 @@ async def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18745,7 +18631,7 @@ async def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18754,7 +18640,7 @@ async def list_metadata_slot( async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18767,7 +18653,7 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -18778,10 +18664,10 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -18789,11 +18675,15 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18838,10 +18728,11 @@ async def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -18989,7 +18880,6 @@ async def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19004,7 +18894,7 @@ async def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19053,7 +18943,6 @@ async def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19068,7 +18957,7 @@ async def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19119,7 +19008,6 @@ async def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19134,7 +19022,7 @@ async def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19267,7 +19155,6 @@ async def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19282,7 +19169,7 @@ async def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19415,7 +19302,6 @@ async def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19430,7 +19316,7 @@ async def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19486,7 +19372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19502,7 +19387,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19577,7 +19461,6 @@ async def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19592,7 +19475,7 @@ async def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19644,7 +19527,6 @@ async def recover_site_configuration_snapshot_slot( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19704,9 +19586,9 @@ async def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19715,12 +19597,16 @@ async def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19769,9 +19655,9 @@ async def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19780,12 +19666,16 @@ async def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19838,7 +19728,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19854,7 +19743,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19929,7 +19817,6 @@ async def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19946,7 +19833,7 @@ async def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19998,7 +19885,6 @@ async def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20061,7 +19947,6 @@ async def start_continuous_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20124,7 +20009,6 @@ async def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20187,7 +20071,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20203,7 +20086,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20278,7 +20160,6 @@ async def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20293,7 +20174,7 @@ async def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20436,7 +20317,6 @@ async def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20451,7 +20331,7 @@ async def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20503,7 +20383,6 @@ async def delete_deployment_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20567,7 +20446,6 @@ async def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20582,7 +20460,7 @@ async def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20723,7 +20601,6 @@ async def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20738,7 +20615,7 @@ async def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20790,7 +20667,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20806,7 +20682,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20881,7 +20756,6 @@ async def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20896,7 +20770,7 @@ async def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21041,7 +20915,6 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21056,7 +20929,7 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21108,7 +20981,6 @@ async def delete_domain_ownership_identifier_slot( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21264,7 +21136,6 @@ async def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21279,7 +21150,7 @@ async def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21328,7 +21199,6 @@ async def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21343,7 +21213,7 @@ async def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21357,7 +21227,7 @@ async def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21371,7 +21241,7 @@ async def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21393,10 +21263,10 @@ async def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21404,13 +21274,15 @@ async def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21533,10 +21405,11 @@ async def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21600,7 +21473,6 @@ async def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21617,7 +21489,7 @@ async def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21669,7 +21541,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21685,7 +21556,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21757,7 +21627,6 @@ async def get_functions_admin_token_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21772,7 +21641,7 @@ async def get_functions_admin_token_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21823,7 +21692,6 @@ async def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21840,7 +21708,7 @@ async def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21855,7 +21723,7 @@ async def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21869,7 +21737,7 @@ async def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21892,10 +21760,10 @@ async def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21903,11 +21771,15 @@ async def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22037,10 +21909,11 @@ async def begin_create_instance_function_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22106,7 +21979,6 @@ async def delete_instance_function_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22267,7 +22139,6 @@ async def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22282,11 +22153,7 @@ async def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22340,7 +22207,6 @@ async def delete_function_secret_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22402,7 +22268,6 @@ async def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22417,7 +22282,7 @@ async def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22468,7 +22333,6 @@ async def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22483,7 +22347,7 @@ async def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22531,7 +22395,6 @@ async def list_host_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22546,7 +22409,7 @@ async def list_host_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22594,7 +22457,6 @@ async def list_sync_status_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22653,7 +22515,6 @@ async def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22814,7 +22675,6 @@ async def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22829,11 +22689,7 @@ async def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22887,7 +22743,6 @@ async def delete_host_secret_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22951,7 +22806,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22967,7 +22821,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23042,7 +22895,6 @@ async def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23057,7 +22909,7 @@ async def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23202,7 +23054,6 @@ async def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23217,7 +23068,7 @@ async def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23269,7 +23120,6 @@ async def delete_host_name_binding_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23334,7 +23184,6 @@ async def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23349,7 +23198,7 @@ async def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23499,7 +23348,6 @@ async def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23514,7 +23362,7 @@ async def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23568,7 +23416,6 @@ async def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23729,7 +23576,6 @@ async def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23744,7 +23590,7 @@ async def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23792,7 +23638,6 @@ async def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23807,7 +23652,7 @@ async def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23856,7 +23701,6 @@ async def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23871,7 +23715,7 @@ async def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23923,7 +23767,6 @@ async def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23938,7 +23781,7 @@ async def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24082,7 +23925,6 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24097,7 +23939,7 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24149,7 +23991,6 @@ async def delete_relay_service_connection_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24304,7 +24145,6 @@ async def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24319,7 +24159,7 @@ async def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24373,7 +24213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24389,7 +24228,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24464,7 +24302,6 @@ async def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24479,7 +24316,7 @@ async def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24531,7 +24368,6 @@ async def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24546,7 +24382,7 @@ async def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24561,7 +24397,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24575,7 +24411,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24598,10 +24434,10 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24609,13 +24445,15 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24748,10 +24586,11 @@ async def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=nam params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24818,7 +24657,6 @@ async def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24835,7 +24673,7 @@ async def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24893,7 +24731,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24909,7 +24746,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24988,7 +24824,6 @@ async def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25005,7 +24840,7 @@ async def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25063,7 +24898,6 @@ async def delete_instance_process_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25130,9 +24964,9 @@ async def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25141,13 +24975,17 @@ async def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25209,7 +25047,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25225,7 +25062,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25314,7 +25150,6 @@ async def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25331,7 +25166,7 @@ async def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25391,7 +25226,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25407,7 +25241,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25479,7 +25312,6 @@ async def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25494,7 +25326,7 @@ async def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25546,7 +25378,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25562,7 +25393,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25633,7 +25463,6 @@ async def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25648,7 +25477,7 @@ async def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25698,7 +25527,6 @@ async def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25713,7 +25541,7 @@ async def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25762,7 +25590,6 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25777,7 +25604,7 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25930,7 +25757,6 @@ async def create_or_update_swift_virtual_network_connection_slot( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25945,7 +25771,7 @@ async def create_or_update_swift_virtual_network_connection_slot( # pylint: dis error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25994,7 +25820,6 @@ async def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26158,7 +25983,6 @@ async def update_swift_virtual_network_connection_slot( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26173,7 +25997,7 @@ async def update_swift_virtual_network_connection_slot( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26225,7 +26049,6 @@ async def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26242,7 +26065,7 @@ async def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26294,7 +26117,6 @@ async def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26309,11 +26131,7 @@ async def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26377,7 +26195,6 @@ async def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26392,7 +26209,7 @@ async def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26408,7 +26225,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26421,7 +26238,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -26435,10 +26252,10 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26446,15 +26263,15 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26516,10 +26333,11 @@ async def begin_start_web_site_network_trace_operation_slot( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26582,7 +26400,6 @@ async def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26645,7 +26462,6 @@ async def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26660,7 +26476,7 @@ async def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26712,7 +26528,6 @@ async def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26727,11 +26542,7 @@ async def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26783,7 +26594,6 @@ async def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26798,7 +26608,7 @@ async def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26847,7 +26657,6 @@ async def generate_new_site_publishing_password_slot( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26916,7 +26725,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26932,7 +26740,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27004,7 +26811,6 @@ async def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27019,7 +26825,7 @@ async def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27068,7 +26874,6 @@ async def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27083,7 +26888,7 @@ async def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27135,7 +26940,6 @@ async def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27150,7 +26954,7 @@ async def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27293,7 +27097,6 @@ async def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27308,7 +27111,7 @@ async def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27360,7 +27163,6 @@ async def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27514,7 +27316,6 @@ async def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27529,7 +27330,7 @@ async def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27579,7 +27380,6 @@ async def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27594,7 +27394,7 @@ async def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27730,7 +27530,6 @@ async def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27745,7 +27544,7 @@ async def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27793,7 +27592,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27808,7 +27606,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27822,7 +27620,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.PrivateEndpointConnectionResource, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnectionResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27836,7 +27634,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -27858,10 +27656,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27869,15 +27667,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28002,10 +27800,11 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28029,7 +27828,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28042,7 +27841,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -28053,10 +27852,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28064,18 +27863,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28119,10 +27915,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28180,7 +27977,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28195,7 +27991,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28249,7 +28045,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28265,7 +28060,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28340,7 +28134,6 @@ async def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28357,7 +28150,7 @@ async def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28411,7 +28204,6 @@ async def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28474,9 +28266,9 @@ async def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28485,13 +28277,17 @@ async def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28549,7 +28345,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28565,7 +28360,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28643,7 +28437,6 @@ async def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28660,7 +28453,7 @@ async def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28716,7 +28509,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28732,7 +28524,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28808,7 +28599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28824,7 +28614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28899,7 +28688,6 @@ async def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28914,7 +28702,7 @@ async def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29059,7 +28847,6 @@ async def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29074,7 +28861,7 @@ async def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29126,7 +28913,6 @@ async def delete_public_certificate_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29275,9 +29061,9 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29286,11 +29072,15 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29341,7 +29131,6 @@ async def reset_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29416,7 +29205,6 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29434,14 +29222,14 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29455,7 +29243,7 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29477,10 +29265,10 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29488,12 +29276,20 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob_slot( @@ -29596,7 +29392,7 @@ async def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -29608,6 +29404,7 @@ async def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29629,14 +29426,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29650,7 +29447,7 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29672,10 +29469,10 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29683,12 +29480,20 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app_slot( @@ -29791,7 +29596,7 @@ async def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -29803,6 +29608,7 @@ async def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29824,14 +29630,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29845,7 +29651,7 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29867,10 +29673,10 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29878,12 +29684,20 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot_slot( @@ -29989,7 +29803,7 @@ async def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_slot_initial( # type: ignore + raw_result = await self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -30001,6 +29815,7 @@ async def begin_restore_snapshot_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30068,7 +29883,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30084,7 +29898,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30159,7 +29972,6 @@ async def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30176,7 +29988,7 @@ async def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30185,7 +29997,7 @@ async def get_site_extension_slot( async def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30198,7 +30010,7 @@ async def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -30210,10 +30022,10 @@ async def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30221,16 +30033,15 @@ async def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30280,10 +30091,11 @@ async def begin_install_site_extension_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30350,7 +30162,6 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30368,14 +30179,14 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _copy_slot_initial( # pylint: disable=inconsistent-return-statements + async def _copy_slot_initial( self, resource_group_name: str, name: str, slot: str, copy_slot_entity: Union[_models.CsmCopySlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30389,7 +30200,7 @@ async def _copy_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30411,10 +30222,10 @@ async def _copy_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30422,12 +30233,20 @@ async def _copy_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_copy_slot( @@ -30533,7 +30352,7 @@ async def begin_copy_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._copy_slot_initial( # type: ignore + raw_result = await self._copy_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -30545,6 +30364,7 @@ async def begin_copy_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30697,7 +30517,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30713,7 +30532,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30743,14 +30561,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30764,7 +30582,7 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30786,10 +30604,10 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30797,12 +30615,20 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot( @@ -30905,7 +30731,7 @@ async def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_initial( # type: ignore + raw_result = await self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -30917,6 +30743,7 @@ async def begin_swap_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30982,7 +30809,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30998,7 +30824,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31072,7 +30897,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31088,7 +30912,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31160,7 +30983,6 @@ async def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31175,14 +30997,7 @@ async def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31196,7 +31011,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31210,7 +31025,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31232,10 +31047,10 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31243,18 +31058,15 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31382,10 +31194,11 @@ async def begin_create_or_update_source_control_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31449,7 +31262,6 @@ async def delete_source_control_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31595,7 +31407,6 @@ async def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31610,14 +31421,7 @@ async def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31666,7 +31470,6 @@ async def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31693,7 +31496,7 @@ async def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31706,7 +31509,7 @@ async def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -31720,10 +31523,10 @@ async def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31731,15 +31534,15 @@ async def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31801,10 +31604,11 @@ async def begin_start_network_trace_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31868,7 +31672,6 @@ async def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31927,7 +31730,6 @@ async def stop_network_trace_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31987,7 +31789,6 @@ async def sync_repository_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32046,7 +31847,6 @@ async def sync_function_triggers_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32110,7 +31910,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32126,7 +31925,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32201,7 +31999,6 @@ async def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32218,7 +32015,7 @@ async def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32270,7 +32067,6 @@ async def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32337,7 +32133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32353,7 +32148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32431,7 +32225,6 @@ async def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32448,7 +32241,7 @@ async def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32500,7 +32293,6 @@ async def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32570,7 +32362,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32586,7 +32377,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32658,7 +32448,6 @@ async def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32673,7 +32462,7 @@ async def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32725,7 +32514,6 @@ async def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32740,7 +32528,7 @@ async def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32891,7 +32679,6 @@ async def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32906,7 +32693,7 @@ async def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32958,7 +32745,6 @@ async def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33120,7 +32906,6 @@ async def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33135,7 +32920,7 @@ async def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33191,7 +32976,6 @@ async def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33208,7 +32992,7 @@ async def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33364,7 +33148,6 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33379,7 +33162,7 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33535,7 +33318,6 @@ async def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33550,7 +33332,7 @@ async def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33602,7 +33384,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33618,7 +33399,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33693,7 +33473,6 @@ async def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33708,7 +33487,7 @@ async def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33833,7 +33612,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33849,7 +33627,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33879,13 +33656,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33899,7 +33676,7 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33920,10 +33697,10 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33931,12 +33708,20 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot_with_production( @@ -34027,7 +33812,7 @@ async def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_with_production_initial( # type: ignore + raw_result = await self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -34038,6 +33823,7 @@ async def begin_swap_slot_with_production( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -34098,7 +33884,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34114,7 +33899,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34185,7 +33969,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34201,7 +33984,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34267,7 +34049,6 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34282,14 +34063,7 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34302,7 +34076,7 @@ async def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34316,7 +34090,7 @@ async def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -34337,10 +34111,10 @@ async def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34348,18 +34122,15 @@ async def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34474,10 +34245,11 @@ async def begin_create_or_update_source_control( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -34537,7 +34309,6 @@ async def delete_source_control( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34670,7 +34441,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34685,14 +34455,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34737,7 +34500,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34763,7 +34525,7 @@ async def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34776,7 +34538,7 @@ async def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -34789,10 +34551,10 @@ async def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34800,15 +34562,15 @@ async def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34866,10 +34628,11 @@ async def begin_start_network_trace( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -34929,7 +34692,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34985,7 +34747,6 @@ async def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35041,7 +34802,6 @@ async def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35097,7 +34857,6 @@ async def sync_function_triggers( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35157,7 +34916,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35173,7 +34931,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35244,7 +35001,6 @@ async def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35261,7 +35017,7 @@ async def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35309,7 +35065,6 @@ async def delete_triggered_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35372,7 +35127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35388,7 +35142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35462,7 +35215,6 @@ async def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35479,7 +35231,7 @@ async def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35527,7 +35279,6 @@ async def run_triggered_web_job( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35593,7 +35344,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35609,7 +35359,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35675,7 +35424,6 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35690,7 +35438,7 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35738,7 +35486,6 @@ async def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35753,7 +35500,7 @@ async def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35891,7 +35638,6 @@ async def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35906,7 +35652,7 @@ async def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35954,7 +35700,6 @@ async def delete_vnet_connection( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36103,7 +35848,6 @@ async def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36118,7 +35862,7 @@ async def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36170,7 +35914,6 @@ async def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36187,7 +35930,7 @@ async def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36330,7 +36073,6 @@ async def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36345,7 +36087,7 @@ async def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36488,7 +36230,6 @@ async def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36503,7 +36244,7 @@ async def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36549,7 +36290,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36565,7 +36305,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36636,7 +36375,6 @@ async def get_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36651,7 +36389,7 @@ async def get_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_web_site_management_client_operations.py index 4d1367e1b412d..70ee38a9c8570 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/aio/operations/_web_site_management_client_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_site_management_client_operations import ( build_check_name_availability_request, build_get_publishing_user_request, @@ -96,7 +94,6 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +108,7 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -200,7 +197,6 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,7 +253,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -273,7 +268,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -337,7 +331,6 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -352,7 +345,7 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +453,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -475,7 +467,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -526,7 +518,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -542,7 +533,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +610,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -635,7 +624,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -675,7 +664,6 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -690,7 +678,7 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,7 +744,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -772,7 +759,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -892,7 +878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -908,7 +893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +958,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -990,7 +973,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1052,7 +1034,6 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1067,7 +1048,7 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1147,6 @@ async def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1181,7 +1161,7 @@ async def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1294,7 +1274,6 @@ async def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1414,7 +1393,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1429,7 +1407,7 @@ async def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1542,7 +1520,6 @@ async def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_app_service_certificate_orders_operations.py index 4cd03bb985fee..162bba7a4f263 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -866,7 +867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -882,7 +882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1001,7 +1000,6 @@ def validate_purchase_information( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1075,7 +1072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1143,7 +1139,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1158,7 +1153,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1171,7 +1166,7 @@ def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1185,7 +1180,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1206,10 +1201,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1217,15 +1212,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1342,10 +1337,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1405,7 +1401,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1540,7 +1535,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1555,11 +1549,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1609,7 +1599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1625,7 +1614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1696,7 +1684,6 @@ def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1711,7 +1698,7 @@ def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1725,7 +1712,7 @@ def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1739,7 +1726,7 @@ def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1761,10 +1748,10 @@ def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1772,15 +1759,15 @@ def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1904,10 +1891,11 @@ def begin_create_or_update_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1970,7 +1958,6 @@ def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2113,7 +2100,6 @@ def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2128,11 +2114,7 @@ def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2254,7 +2236,6 @@ def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2387,7 +2368,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2443,7 +2423,6 @@ def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2574,7 +2553,6 @@ def resend_request_emails( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2705,7 +2683,6 @@ def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2720,7 +2697,7 @@ def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2765,7 +2742,6 @@ def verify_domain_ownership( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2821,7 +2797,6 @@ def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2836,7 +2811,7 @@ def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2881,7 +2856,6 @@ def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2896,7 +2870,7 @@ def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_app_service_environments_operations.py index 03fc96b21078a..426d9793bfbfe 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1478,7 +1479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1494,7 +1494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1564,7 +1563,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1580,7 +1578,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1646,7 +1643,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1661,7 +1657,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1674,7 +1670,7 @@ def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1688,7 +1684,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1709,10 +1705,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1720,18 +1716,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1848,10 +1841,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1873,9 +1867,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1888,7 +1882,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -1899,10 +1893,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1910,12 +1904,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -1946,7 +1948,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -1956,6 +1958,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2094,7 +2097,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2109,14 +2111,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2162,7 +2157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2178,7 +2172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2244,7 +2237,6 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2259,7 +2251,7 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2272,7 +2264,7 @@ def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2286,7 +2278,7 @@ def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2307,10 +2299,10 @@ def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2318,15 +2310,15 @@ def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2455,7 +2447,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2471,13 +2462,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2514,6 +2504,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2579,7 +2570,6 @@ def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2594,7 +2584,7 @@ def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2642,7 +2632,6 @@ def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2657,7 +2646,7 @@ def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2707,7 +2696,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2723,7 +2711,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2794,7 +2781,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2810,7 +2796,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2876,7 +2861,6 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2891,7 +2875,7 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2904,7 +2888,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2918,7 +2902,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2939,10 +2923,10 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2950,15 +2934,15 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3069,10 +3053,11 @@ def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3208,7 +3193,6 @@ def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3223,11 +3207,7 @@ def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3282,7 +3262,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3298,7 +3277,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3371,7 +3349,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3387,7 +3364,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3458,7 +3434,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3474,7 +3449,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3543,7 +3517,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3559,7 +3532,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3625,7 +3597,6 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3640,7 +3611,7 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3690,7 +3661,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3706,7 +3676,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3774,7 +3743,6 @@ def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3792,7 +3760,7 @@ def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3805,7 +3773,7 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -3815,10 +3783,10 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3826,15 +3794,15 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3883,7 +3851,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3899,13 +3866,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3940,6 +3906,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -4008,7 +3975,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4024,7 +3990,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4099,7 +4064,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4115,7 +4079,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4145,7 +4108,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4158,7 +4121,7 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -4168,10 +4131,10 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4179,15 +4142,15 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4236,7 +4199,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4252,13 +4214,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4293,6 +4254,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -4367,7 +4329,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4383,7 +4344,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4454,7 +4414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4470,7 +4429,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4541,7 +4499,6 @@ def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4556,7 +4513,7 @@ def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4570,7 +4527,7 @@ def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4584,7 +4541,7 @@ def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4606,10 +4563,10 @@ def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4617,15 +4574,15 @@ def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4745,10 +4702,11 @@ def begin_create_or_update_worker_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4893,7 +4851,6 @@ def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4908,11 +4865,7 @@ def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4968,7 +4921,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4984,7 +4936,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5060,7 +5011,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5076,7 +5026,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5150,7 +5099,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5166,7 +5114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5240,7 +5187,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5256,7 +5202,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_app_service_plans_operations.py index 5d07eaf362ac3..0b62a3d9ee622 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1161,7 +1162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1243,7 +1242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1259,7 +1257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1325,7 +1322,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1342,7 +1338,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1355,7 +1351,7 @@ def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1369,7 +1365,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1390,10 +1386,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1401,15 +1397,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1519,10 +1515,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1582,7 +1579,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1714,7 +1710,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1729,11 +1724,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1776,7 +1767,6 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1791,7 +1781,7 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1842,7 +1832,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1857,7 +1846,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1908,7 +1897,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1970,7 +1958,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1985,7 +1972,7 @@ def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2039,7 +2026,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2055,7 +2041,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2123,7 +2108,6 @@ def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2138,7 +2122,7 @@ def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2186,7 +2170,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2202,7 +2185,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2276,7 +2258,6 @@ def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2354,7 +2335,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2370,7 +2350,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2436,7 +2415,6 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2451,7 +2429,7 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2504,7 +2482,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2520,7 +2497,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2586,7 +2562,6 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2601,7 +2576,7 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2649,7 +2624,6 @@ def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2666,7 +2640,7 @@ def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2717,7 +2691,6 @@ def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2732,7 +2705,7 @@ def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2872,7 +2845,6 @@ def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2887,7 +2859,7 @@ def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2935,7 +2907,6 @@ def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2950,7 +2921,7 @@ def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3001,7 +2972,6 @@ def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3018,7 +2988,7 @@ def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3158,7 +3128,6 @@ def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3175,7 +3144,7 @@ def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3226,7 +3195,6 @@ def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3377,7 +3345,6 @@ def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3394,7 +3361,7 @@ def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3442,7 +3409,6 @@ def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_certificate_registration_provider_operations.py index 554c9aec48469..0bbfacc4353d1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_certificate_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_certificates_operations.py index 9ed1d57690fdc..42469eb4b4384 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_certificates_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -306,7 +305,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -322,7 +320,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -388,7 +385,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -404,7 +400,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -470,7 +465,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -485,7 +479,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -605,7 +599,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -620,7 +613,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -665,7 +658,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -797,7 +789,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -812,7 +803,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_deleted_web_apps_operations.py index d700577e8cf2d..7736e70b297d3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_deleted_web_apps_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -176,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -192,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -342,7 +337,6 @@ def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +351,7 @@ def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_diagnostics_operations.py index c6317f3eeb512..412eec1ddd996 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1101,7 +1100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1117,7 +1115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1204,7 +1201,6 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1219,7 +1215,7 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1267,7 +1263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1283,7 +1278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1370,7 +1364,6 @@ def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1385,7 +1378,7 @@ def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1433,7 +1426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1449,7 +1441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1520,7 +1511,6 @@ def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1535,7 +1525,7 @@ def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1602,7 +1591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1676,7 +1664,6 @@ def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1678,7 @@ def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1759,7 +1746,6 @@ def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,7 +1760,7 @@ def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1825,7 +1811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1841,7 +1826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1915,7 +1899,6 @@ def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1930,7 +1913,7 @@ def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,7 +1981,6 @@ def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2013,7 +1995,7 @@ def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,7 +2046,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2080,7 +2061,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2171,7 +2151,6 @@ def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2186,7 +2165,7 @@ def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2237,7 +2216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2253,7 +2231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2327,7 +2304,6 @@ def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2342,7 +2318,7 @@ def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2396,7 +2372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2412,7 +2387,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2495,7 +2469,6 @@ def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2510,7 +2483,7 @@ def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2582,7 +2555,6 @@ def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2597,7 +2569,7 @@ def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2651,7 +2623,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2667,7 +2638,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2750,7 +2720,6 @@ def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2765,7 +2734,7 @@ def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2837,7 +2806,6 @@ def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2852,7 +2820,7 @@ def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_domain_registration_provider_operations.py index c564773092e79..95d04023061da 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_domain_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_domains_operations.py index dc6f961ede422..a51e2b6616777 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -694,7 +695,6 @@ def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -709,7 +709,7 @@ def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -749,7 +749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -765,7 +764,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -825,7 +823,6 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -840,7 +837,7 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -937,7 +934,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -953,7 +949,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1019,7 +1014,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1035,7 +1029,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1101,7 +1094,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1116,7 +1108,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1125,7 +1117,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1139,7 +1131,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1160,10 +1152,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1171,15 +1163,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1282,10 +1274,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1350,7 +1343,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1481,7 +1473,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1496,11 +1487,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1550,7 +1537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1566,7 +1552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1637,7 +1622,6 @@ def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1652,7 +1636,7 @@ def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1791,7 +1775,6 @@ def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1806,7 +1789,7 @@ def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1854,7 +1837,6 @@ def delete_ownership_identifier( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2004,7 +1986,6 @@ def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2019,7 +2000,7 @@ def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,7 +2045,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_provider_operations.py index 83c75491be263..f130f11ec0a43 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -171,7 +170,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -187,7 +185,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -253,7 +250,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -269,7 +265,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -340,7 +335,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -356,7 +350,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_recommendations_operations.py index ce797d8073355..561f56e24fa50 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_recommendations_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -730,7 +729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -746,7 +744,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -806,7 +803,6 @@ def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -859,7 +855,6 @@ def disable_recommendation_for_subscription( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -933,7 +928,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -949,7 +943,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1034,7 +1027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1050,7 +1042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1121,7 +1112,6 @@ def disable_all_for_hosting_environment( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1180,7 +1170,6 @@ def reset_all_filters_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1253,7 +1242,6 @@ def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1268,7 +1256,7 @@ def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1319,7 +1307,6 @@ def disable_recommendation_for_hosting_environment( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1393,7 +1380,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1409,7 +1395,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1494,7 +1479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1510,7 +1494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1578,7 +1561,6 @@ def disable_all_for_web_app( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1634,7 +1616,6 @@ def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1688,6 @@ def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1722,7 +1702,7 @@ def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1770,7 +1750,6 @@ def disable_recommendation_for_site( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_resource_health_metadata_operations.py index 9721c9ba5e53e..f111bef9c1129 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_resource_health_metadata_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -389,7 +386,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -405,7 +401,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -477,7 +472,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -493,7 +487,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -559,7 +552,6 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +566,7 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -627,7 +619,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -643,7 +634,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -715,7 +705,6 @@ def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -730,7 +719,7 @@ def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_static_sites_operations.py index 37a735a384f65..dddffaba9076f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_static_sites_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1208,7 +1207,6 @@ def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1223,7 +1221,7 @@ def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1264,7 +1262,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1280,7 +1277,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1349,7 +1345,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1365,7 +1360,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1431,7 +1425,6 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1446,7 +1439,7 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1569,7 +1562,6 @@ def create_or_update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1584,11 +1576,7 @@ def create_or_update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1633,7 +1621,6 @@ def delete_static_site( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1767,7 +1754,6 @@ def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1782,11 +1768,7 @@ def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1839,7 +1821,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1855,7 +1836,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1929,7 +1909,6 @@ def delete_static_site_user( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2083,7 +2062,6 @@ def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2098,7 +2076,7 @@ def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2148,7 +2126,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2164,7 +2141,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2235,7 +2211,6 @@ def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2250,7 +2225,7 @@ def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2298,7 +2273,6 @@ def delete_static_site_build( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2438,7 +2412,6 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2453,11 +2426,7 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2510,7 +2479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2526,7 +2494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2597,7 +2564,6 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2612,11 +2578,7 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2735,7 +2697,6 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2750,11 +2711,7 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2878,7 +2835,6 @@ def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2893,7 +2849,7 @@ def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2943,7 +2899,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2959,7 +2914,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3030,7 +2984,6 @@ def create_or_update_static_site_custom_domain( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3045,11 +2998,7 @@ def create_or_update_static_site_custom_domain( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3097,7 +3046,6 @@ def delete_static_site_custom_domain( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3156,7 +3104,6 @@ def validate_custom_domain_can_be_added_to_static_site( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3212,7 +3159,6 @@ def detach_static_site( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3273,7 +3219,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3289,7 +3234,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3357,7 +3301,6 @@ def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3372,11 +3315,7 @@ def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StringDictionary", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3419,7 +3358,6 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3434,7 +3372,7 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3556,7 +3494,6 @@ def reset_static_site_api_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_top_level_domains_operations.py index b704798eff040..0a6f4920e37d6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_top_level_domains_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_web_apps_operations.py index 4b9383406b179..7754c5ea212d1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_web_apps_operations.py @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -15278,7 +15279,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15294,7 +15294,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15367,7 +15366,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15383,7 +15381,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15449,7 +15446,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15466,7 +15462,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15475,7 +15471,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15489,7 +15485,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15510,10 +15506,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15521,15 +15517,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15641,10 +15637,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15716,7 +15713,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15856,7 +15852,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15871,11 +15866,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15923,7 +15914,6 @@ def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15938,7 +15928,7 @@ def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16058,7 +16048,6 @@ def apply_slot_config_to_production( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16187,7 +16176,6 @@ def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16202,7 +16190,7 @@ def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16248,7 +16236,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16264,7 +16251,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16335,7 +16321,6 @@ def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16350,7 +16335,7 @@ def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16398,7 +16383,6 @@ def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16551,7 +16535,6 @@ def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16566,21 +16549,21 @@ def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_initial( # pylint: disable=inconsistent-return-statements + def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16594,7 +16577,7 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16616,10 +16599,10 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16627,12 +16610,20 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore( @@ -16732,7 +16723,7 @@ def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_initial( # type: ignore + raw_result = self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -16744,6 +16735,7 @@ def begin_restore( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16803,7 +16795,6 @@ def get_basic_publishing_credentials_policies( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16818,7 +16809,7 @@ def get_basic_publishing_credentials_policies( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16863,7 +16854,6 @@ def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16878,7 +16868,7 @@ def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17002,7 +16992,6 @@ def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17017,7 +17006,7 @@ def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17062,7 +17051,6 @@ def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17077,7 +17065,7 @@ def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17201,7 +17189,6 @@ def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17216,7 +17203,7 @@ def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17264,7 +17251,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17280,7 +17266,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17423,7 +17408,6 @@ def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17438,7 +17422,7 @@ def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17481,7 +17465,6 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17496,7 +17479,7 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17616,7 +17599,6 @@ def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17631,7 +17613,7 @@ def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17674,7 +17656,6 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17689,7 +17670,7 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17809,7 +17790,6 @@ def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17824,7 +17804,7 @@ def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17867,7 +17847,6 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17882,7 +17861,7 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18004,7 +17983,6 @@ def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18019,7 +17997,7 @@ def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18064,7 +18042,6 @@ def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18079,7 +18056,7 @@ def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18195,7 +18172,6 @@ def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18210,7 +18186,7 @@ def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18255,7 +18231,6 @@ def delete_backup_configuration( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18309,7 +18284,6 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18324,7 +18298,7 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18447,7 +18421,6 @@ def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18462,7 +18435,7 @@ def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18507,7 +18480,6 @@ def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18522,7 +18494,7 @@ def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18567,7 +18539,6 @@ def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18582,7 +18553,7 @@ def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18705,7 +18676,6 @@ def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18720,7 +18690,7 @@ def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18836,7 +18806,6 @@ def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18851,7 +18820,7 @@ def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18894,7 +18863,6 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18909,14 +18877,16 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _list_publishing_credentials_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.User: + def _list_publishing_credentials_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18929,7 +18899,7 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -18939,10 +18909,10 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -18950,11 +18920,15 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18995,10 +18969,11 @@ def begin_list_publishing_credentials( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -19129,7 +19104,6 @@ def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19144,7 +19118,7 @@ def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19187,7 +19161,6 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19202,7 +19175,7 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19247,7 +19220,6 @@ def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19262,7 +19234,7 @@ def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19391,7 +19363,6 @@ def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19406,7 +19377,7 @@ def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19451,7 +19422,6 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19466,7 +19436,7 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19586,7 +19556,6 @@ def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19601,7 +19570,7 @@ def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19721,7 +19690,6 @@ def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19736,7 +19704,7 @@ def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19788,7 +19756,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19804,7 +19771,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19875,7 +19841,6 @@ def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19890,7 +19855,7 @@ def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19938,7 +19903,6 @@ def recover_site_configuration_snapshot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19994,9 +19958,9 @@ def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20005,12 +19969,16 @@ def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20053,9 +20021,9 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20064,12 +20032,16 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20117,7 +20089,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20133,7 +20104,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20204,7 +20174,6 @@ def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20221,7 +20190,7 @@ def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20269,7 +20238,6 @@ def delete_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20328,7 +20296,6 @@ def start_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20387,7 +20354,6 @@ def stop_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20444,7 +20410,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20460,7 +20425,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20529,7 +20493,6 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20544,7 +20507,7 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20674,7 +20637,6 @@ def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20689,7 +20651,7 @@ def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20737,7 +20699,6 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20795,7 +20756,6 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20810,7 +20770,7 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20934,7 +20894,6 @@ def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20949,7 +20908,7 @@ def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20997,7 +20956,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21013,7 +20971,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21084,7 +21041,6 @@ def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21099,7 +21055,7 @@ def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21231,7 +21187,6 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21246,7 +21201,7 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21294,7 +21249,6 @@ def delete_domain_ownership_identifier( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21437,7 +21391,6 @@ def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21452,7 +21405,7 @@ def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21495,7 +21448,6 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21510,7 +21462,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21519,7 +21471,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21533,7 +21485,7 @@ def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21554,10 +21506,10 @@ def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21565,13 +21517,15 @@ def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21677,10 +21631,11 @@ def begin_create_ms_deploy_operation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21738,7 +21693,6 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21755,7 +21709,7 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21803,7 +21757,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21819,7 +21772,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21885,7 +21837,6 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21900,7 +21851,7 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21948,7 +21899,6 @@ def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21965,7 +21915,7 @@ def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21979,7 +21929,7 @@ def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21993,7 +21943,7 @@ def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -22015,10 +21965,10 @@ def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22026,11 +21976,15 @@ def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22150,10 +22104,11 @@ def begin_create_function( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22216,7 +22171,6 @@ def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22367,7 +22321,6 @@ def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22382,11 +22335,7 @@ def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22437,7 +22386,6 @@ def delete_function_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22496,7 +22444,6 @@ def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22511,7 +22458,7 @@ def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22559,7 +22506,6 @@ def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22574,7 +22520,7 @@ def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22617,7 +22563,6 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22632,7 +22577,7 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22677,7 +22622,6 @@ def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22733,7 +22677,6 @@ def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22884,7 +22827,6 @@ def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22899,11 +22841,7 @@ def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22954,7 +22892,6 @@ def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23013,7 +22950,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23029,7 +22965,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23100,7 +23035,6 @@ def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23115,7 +23049,7 @@ def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23247,7 +23181,6 @@ def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23262,7 +23195,7 @@ def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23310,7 +23243,6 @@ def delete_host_name_binding( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23372,7 +23304,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23387,7 +23318,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23527,7 +23458,6 @@ def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23542,7 +23472,7 @@ def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23593,7 +23523,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23744,7 +23673,6 @@ def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23759,7 +23687,7 @@ def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23802,7 +23730,6 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23817,7 +23744,7 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23862,7 +23789,6 @@ def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23877,7 +23803,7 @@ def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23925,7 +23851,6 @@ def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23940,7 +23865,7 @@ def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24071,7 +23996,6 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24086,7 +24010,7 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24134,7 +24058,6 @@ def delete_relay_service_connection( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24276,7 +24199,6 @@ def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24291,7 +24213,7 @@ def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24340,7 +24262,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24356,7 +24277,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24427,7 +24347,6 @@ def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24442,7 +24361,7 @@ def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24490,7 +24409,6 @@ def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24505,7 +24423,7 @@ def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24519,7 +24437,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24533,7 +24451,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24555,10 +24473,10 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24566,13 +24484,15 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24692,10 +24612,11 @@ def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24758,7 +24679,6 @@ def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24775,7 +24695,7 @@ def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24829,7 +24749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24845,7 +24764,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24920,7 +24838,6 @@ def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24937,7 +24854,7 @@ def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24991,7 +24908,6 @@ def delete_instance_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25054,9 +24970,9 @@ def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25065,13 +24981,17 @@ def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25128,7 +25048,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25144,7 +25063,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25222,7 +25140,6 @@ def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25239,7 +25156,7 @@ def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25294,7 +25211,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25310,7 +25226,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25376,7 +25291,6 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25391,7 +25305,7 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25437,7 +25351,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25453,7 +25366,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25521,7 +25433,6 @@ def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25536,7 +25447,7 @@ def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25550,7 +25461,7 @@ def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25564,7 +25475,7 @@ def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25586,10 +25497,10 @@ def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25597,11 +25508,15 @@ def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25725,10 +25640,11 @@ def begin_migrate_storage( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25756,7 +25672,7 @@ def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25770,7 +25686,7 @@ def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25791,10 +25707,10 @@ def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25802,11 +25718,15 @@ def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25914,10 +25834,11 @@ def begin_migrate_my_sql( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25979,7 +25900,6 @@ def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25994,7 +25914,7 @@ def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26039,7 +25959,6 @@ def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26054,7 +25973,7 @@ def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26194,7 +26113,6 @@ def create_or_update_swift_virtual_network_connection( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26209,7 +26127,7 @@ def create_or_update_swift_virtual_network_connection( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26254,7 +26172,6 @@ def delete_swift_virtual_network( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26405,7 +26322,6 @@ def update_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26420,7 +26336,7 @@ def update_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26468,7 +26384,6 @@ def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26485,7 +26400,7 @@ def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26533,7 +26448,6 @@ def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26548,11 +26462,7 @@ def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26612,7 +26522,6 @@ def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26627,7 +26536,7 @@ def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26642,7 +26551,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26655,7 +26564,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -26668,10 +26577,10 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26679,15 +26588,15 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26744,10 +26653,11 @@ def begin_start_web_site_network_trace_operation( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26807,7 +26717,6 @@ def stop_web_site_network_trace( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26866,7 +26775,6 @@ def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26881,7 +26789,7 @@ def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26929,7 +26837,6 @@ def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26944,11 +26851,7 @@ def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26996,7 +26899,6 @@ def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27011,7 +26913,7 @@ def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27056,7 +26958,6 @@ def generate_new_site_publishing_password( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27120,7 +27021,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27136,7 +27036,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27204,7 +27103,6 @@ def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27219,7 +27117,7 @@ def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27262,7 +27160,6 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27277,7 +27174,7 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27325,7 +27222,6 @@ def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27340,7 +27236,7 @@ def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27470,7 +27366,6 @@ def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27485,7 +27380,7 @@ def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27533,7 +27428,6 @@ def delete_premier_add_on( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27674,7 +27568,6 @@ def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27689,7 +27582,7 @@ def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27734,7 +27627,6 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27749,7 +27641,7 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27871,7 +27763,6 @@ def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27886,7 +27777,7 @@ def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27934,7 +27825,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27950,7 +27840,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28021,7 +27910,6 @@ def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28038,7 +27926,7 @@ def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28088,7 +27976,6 @@ def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28147,9 +28034,9 @@ def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28158,13 +28045,17 @@ def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28217,7 +28108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28233,7 +28123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28307,7 +28196,6 @@ def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28324,7 +28212,7 @@ def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28375,7 +28263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28391,7 +28278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28462,7 +28348,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28478,7 +28363,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28549,7 +28433,6 @@ def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28564,7 +28447,7 @@ def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28696,7 +28579,6 @@ def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28711,7 +28593,7 @@ def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28759,7 +28641,6 @@ def delete_public_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28895,9 +28776,9 @@ def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28906,11 +28787,15 @@ def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28957,7 +28842,6 @@ def reset_production_slot_config( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29027,7 +28911,6 @@ def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29045,9 +28928,9 @@ def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29061,7 +28944,7 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29082,10 +28965,10 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29093,12 +28976,20 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob( @@ -29185,7 +29076,7 @@ def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_initial( # type: ignore + raw_result = self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -29196,6 +29087,7 @@ def begin_restore_from_backup_blob( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29217,13 +29109,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29237,7 +29129,7 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29258,10 +29150,10 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29269,12 +29161,20 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app( @@ -29365,7 +29265,7 @@ def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_initial( # type: ignore + raw_result = self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -29376,6 +29276,7 @@ def begin_restore_from_deleted_app( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29397,13 +29298,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29417,7 +29318,7 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29438,10 +29339,10 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29449,12 +29350,20 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot( @@ -29548,7 +29457,7 @@ def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_initial( # type: ignore + raw_result = self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -29559,6 +29468,7 @@ def begin_restore_snapshot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -29621,7 +29531,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29637,7 +29546,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29708,7 +29616,6 @@ def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29725,7 +29632,7 @@ def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29734,7 +29641,7 @@ def get_site_extension( def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29747,7 +29654,7 @@ def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -29758,10 +29665,10 @@ def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29769,16 +29676,15 @@ def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29823,10 +29729,11 @@ def begin_install_site_extension( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29889,7 +29796,6 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29907,13 +29813,13 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statements + def _copy_production_slot_initial( self, resource_group_name: str, name: str, copy_slot_entity: Union[_models.CsmCopySlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29927,7 +29833,7 @@ def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statem api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29948,10 +29854,10 @@ def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29959,12 +29865,20 @@ def _copy_production_slot_initial( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_copy_production_slot( @@ -30058,7 +29972,7 @@ def begin_copy_production_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._copy_production_slot_initial( # type: ignore + raw_result = self._copy_production_slot_initial( resource_group_name=resource_group_name, name=name, copy_slot_entity=copy_slot_entity, @@ -30069,6 +29983,7 @@ def begin_copy_production_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30129,7 +30044,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30145,7 +30059,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30215,7 +30128,6 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30232,7 +30144,7 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30246,7 +30158,7 @@ def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30260,7 +30172,7 @@ def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30282,10 +30194,10 @@ def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30293,15 +30205,15 @@ def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30430,10 +30342,11 @@ def begin_create_or_update_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30511,7 +30424,6 @@ def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30664,7 +30576,6 @@ def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30679,11 +30590,7 @@ def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30735,7 +30642,6 @@ def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30750,7 +30656,7 @@ def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30883,7 +30789,6 @@ def apply_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31029,7 +30934,6 @@ def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31044,7 +30948,7 @@ def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31096,7 +31000,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31112,7 +31015,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31187,7 +31089,6 @@ def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31202,7 +31103,7 @@ def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31254,7 +31155,6 @@ def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31420,7 +31320,6 @@ def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31435,14 +31334,14 @@ def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -31450,7 +31349,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31464,7 +31363,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31487,10 +31386,10 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31498,12 +31397,20 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_slot( @@ -31615,7 +31522,7 @@ def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_slot_initial( # type: ignore + raw_result = self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -31628,6 +31535,7 @@ def begin_restore_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31694,7 +31602,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31710,7 +31617,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31866,7 +31772,6 @@ def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31881,7 +31786,7 @@ def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31930,7 +31835,6 @@ def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31945,7 +31849,7 @@ def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32078,7 +31982,6 @@ def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32093,7 +31996,7 @@ def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32142,7 +32045,6 @@ def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32157,7 +32059,7 @@ def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32290,7 +32192,6 @@ def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32305,7 +32206,7 @@ def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32354,7 +32255,6 @@ def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32369,7 +32269,7 @@ def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32504,7 +32404,6 @@ def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32519,7 +32418,7 @@ def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32568,7 +32467,6 @@ def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32583,7 +32481,7 @@ def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32716,7 +32614,6 @@ def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32731,7 +32628,7 @@ def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32780,7 +32677,6 @@ def delete_backup_configuration_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32840,7 +32736,6 @@ def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32855,7 +32750,7 @@ def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32991,7 +32886,6 @@ def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33006,7 +32900,7 @@ def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33055,7 +32949,6 @@ def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33070,7 +32963,7 @@ def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33119,7 +33012,6 @@ def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33134,7 +33026,7 @@ def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33270,7 +33162,6 @@ def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33285,7 +33176,7 @@ def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33418,7 +33309,6 @@ def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33433,7 +33323,7 @@ def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33482,7 +33372,6 @@ def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33497,7 +33386,7 @@ def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33506,7 +33395,7 @@ def list_metadata_slot( def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33519,7 +33408,7 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -33530,10 +33419,10 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33541,11 +33430,15 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33590,10 +33483,11 @@ def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33741,7 +33635,6 @@ def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33756,7 +33649,7 @@ def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33805,7 +33698,6 @@ def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33820,7 +33712,7 @@ def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33871,7 +33763,6 @@ def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33886,7 +33777,7 @@ def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34019,7 +33910,6 @@ def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34034,7 +33924,7 @@ def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34167,7 +34057,6 @@ def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34182,7 +34071,7 @@ def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34238,7 +34127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34254,7 +34142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34329,7 +34216,6 @@ def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34344,7 +34230,7 @@ def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34396,7 +34282,6 @@ def recover_site_configuration_snapshot_slot( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34456,9 +34341,9 @@ def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -34467,12 +34352,16 @@ def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34521,9 +34410,9 @@ def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -34532,12 +34421,16 @@ def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34589,7 +34482,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34605,7 +34497,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34680,7 +34571,6 @@ def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34697,7 +34587,7 @@ def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34749,7 +34639,6 @@ def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34812,7 +34701,6 @@ def start_continuous_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34875,7 +34763,6 @@ def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34938,7 +34825,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34954,7 +34840,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35029,7 +34914,6 @@ def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35044,7 +34928,7 @@ def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35187,7 +35071,6 @@ def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35202,7 +35085,7 @@ def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35254,7 +35137,6 @@ def delete_deployment_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35318,7 +35200,6 @@ def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35333,7 +35214,7 @@ def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35474,7 +35355,6 @@ def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35489,7 +35369,7 @@ def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35541,7 +35421,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35557,7 +35436,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35632,7 +35510,6 @@ def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35647,7 +35524,7 @@ def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35792,7 +35669,6 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35807,7 +35683,7 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35859,7 +35735,6 @@ def delete_domain_ownership_identifier_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36015,7 +35890,6 @@ def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36030,7 +35904,7 @@ def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36079,7 +35953,6 @@ def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36094,7 +35967,7 @@ def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36108,7 +35981,7 @@ def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36122,7 +35995,7 @@ def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -36144,10 +36017,10 @@ def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36155,13 +36028,15 @@ def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36284,10 +36159,11 @@ def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36351,7 +36227,6 @@ def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36368,7 +36243,7 @@ def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36419,7 +36294,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36435,7 +36309,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36505,7 +36378,6 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36520,7 +36392,7 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36571,7 +36443,6 @@ def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36588,7 +36459,7 @@ def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36603,7 +36474,7 @@ def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36617,7 +36488,7 @@ def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -36640,10 +36511,10 @@ def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36651,11 +36522,15 @@ def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36785,10 +36660,11 @@ def begin_create_instance_function_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36854,7 +36730,6 @@ def delete_instance_function_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37015,7 +36890,6 @@ def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37030,11 +36904,7 @@ def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37088,7 +36958,6 @@ def delete_function_secret_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37150,7 +37019,6 @@ def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37165,7 +37033,7 @@ def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37216,7 +37084,6 @@ def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37231,7 +37098,7 @@ def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37277,7 +37144,6 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37292,7 +37158,7 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37340,7 +37206,6 @@ def list_sync_status_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37399,7 +37264,6 @@ def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37560,7 +37424,6 @@ def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37575,11 +37438,7 @@ def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37633,7 +37492,6 @@ def delete_host_secret_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37696,7 +37554,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37712,7 +37569,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37787,7 +37643,6 @@ def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37802,7 +37657,7 @@ def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37947,7 +37802,6 @@ def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37962,7 +37816,7 @@ def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38014,7 +37868,6 @@ def delete_host_name_binding_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38079,7 +37932,6 @@ def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38094,7 +37946,7 @@ def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38244,7 +38096,6 @@ def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38259,7 +38110,7 @@ def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38313,7 +38164,6 @@ def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38474,7 +38324,6 @@ def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38489,7 +38338,7 @@ def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38537,7 +38386,6 @@ def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38552,7 +38400,7 @@ def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38601,7 +38449,6 @@ def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38616,7 +38463,7 @@ def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38668,7 +38515,6 @@ def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38683,7 +38529,7 @@ def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38827,7 +38673,6 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38842,7 +38687,7 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38894,7 +38739,6 @@ def delete_relay_service_connection_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39049,7 +38893,6 @@ def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39064,7 +38907,7 @@ def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39117,7 +38960,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39133,7 +38975,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39208,7 +39049,6 @@ def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39223,7 +39063,7 @@ def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39275,7 +39115,6 @@ def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39290,7 +39129,7 @@ def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39305,7 +39144,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -39319,7 +39158,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -39342,10 +39181,10 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -39353,13 +39192,15 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39492,10 +39333,11 @@ def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=name-too- params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -39562,7 +39404,6 @@ def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39579,7 +39420,7 @@ def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39637,7 +39478,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39653,7 +39493,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39732,7 +39571,6 @@ def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39749,7 +39587,7 @@ def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39807,7 +39645,6 @@ def delete_instance_process_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39874,9 +39711,9 @@ def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -39885,13 +39722,17 @@ def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39952,7 +39793,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39968,7 +39808,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40057,7 +39896,6 @@ def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40074,7 +39912,7 @@ def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40133,7 +39971,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40149,7 +39986,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40221,7 +40057,6 @@ def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40236,7 +40071,7 @@ def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40288,7 +40123,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40304,7 +40138,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40375,7 +40208,6 @@ def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40390,7 +40222,7 @@ def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40440,7 +40272,6 @@ def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40455,7 +40286,7 @@ def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40504,7 +40335,6 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40519,7 +40349,7 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40672,7 +40502,6 @@ def create_or_update_swift_virtual_network_connection_slot( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40687,7 +40516,7 @@ def create_or_update_swift_virtual_network_connection_slot( # pylint: disable=n error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40736,7 +40565,6 @@ def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40900,7 +40728,6 @@ def update_swift_virtual_network_connection_slot( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40915,7 +40742,7 @@ def update_swift_virtual_network_connection_slot( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40967,7 +40794,6 @@ def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40984,7 +40810,7 @@ def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41036,7 +40862,6 @@ def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41051,11 +40876,7 @@ def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41119,7 +40940,6 @@ def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41134,7 +40954,7 @@ def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41150,7 +40970,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -41163,7 +40983,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -41177,10 +40997,10 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -41188,15 +41008,15 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41257,10 +41077,11 @@ def begin_start_web_site_network_trace_operation_slot( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -41323,7 +41144,6 @@ def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41386,7 +41206,6 @@ def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41401,7 +41220,7 @@ def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41453,7 +41272,6 @@ def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41468,11 +41286,7 @@ def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41524,7 +41338,6 @@ def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41539,7 +41352,7 @@ def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41588,7 +41401,6 @@ def generate_new_site_publishing_password_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41656,7 +41468,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41672,7 +41483,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41744,7 +41554,6 @@ def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41759,7 +41568,7 @@ def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41808,7 +41617,6 @@ def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41823,7 +41631,7 @@ def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41875,7 +41683,6 @@ def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41890,7 +41697,7 @@ def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42033,7 +41840,6 @@ def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42048,7 +41854,7 @@ def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42100,7 +41906,6 @@ def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42254,7 +42059,6 @@ def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42269,7 +42073,7 @@ def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42319,7 +42123,6 @@ def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42334,7 +42137,7 @@ def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42470,7 +42273,6 @@ def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42485,7 +42287,7 @@ def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42533,7 +42335,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42548,7 +42349,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42562,7 +42363,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.PrivateEndpointConnectionResource, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnectionResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42576,7 +42377,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -42598,10 +42399,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -42609,15 +42410,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42742,10 +42543,11 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -42769,7 +42571,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42782,7 +42584,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -42793,10 +42595,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -42804,18 +42606,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42859,10 +42658,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -42920,7 +42720,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42935,7 +42734,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42989,7 +42788,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43005,7 +42803,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43080,7 +42877,6 @@ def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43097,7 +42893,7 @@ def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43151,7 +42947,6 @@ def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43214,9 +43009,9 @@ def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -43225,13 +43020,17 @@ def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43288,7 +43087,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43304,7 +43102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43382,7 +43179,6 @@ def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43399,7 +43195,7 @@ def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43454,7 +43250,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43470,7 +43265,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43545,7 +43339,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43561,7 +43354,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43636,7 +43428,6 @@ def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43651,7 +43442,7 @@ def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43796,7 +43587,6 @@ def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43811,7 +43601,7 @@ def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43863,7 +43653,6 @@ def delete_public_certificate_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44012,9 +43801,9 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -44023,11 +43812,15 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44078,7 +43871,6 @@ def reset_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44153,7 +43945,6 @@ def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44171,14 +43962,14 @@ def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44192,7 +43983,7 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -44214,10 +44005,10 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44225,12 +44016,20 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob_slot( @@ -44333,7 +44132,7 @@ def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -44345,6 +44144,7 @@ def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -44366,14 +44166,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44387,7 +44187,7 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -44409,10 +44209,10 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44420,12 +44220,20 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app_slot( @@ -44528,7 +44336,7 @@ def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -44540,6 +44348,7 @@ def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -44561,14 +44370,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44582,7 +44391,7 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -44604,10 +44413,10 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44615,12 +44424,20 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot_slot( @@ -44726,7 +44543,7 @@ def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_slot_initial( # type: ignore + raw_result = self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -44738,6 +44555,7 @@ def begin_restore_snapshot_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -44804,7 +44622,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44820,7 +44637,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44895,7 +44711,6 @@ def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44912,7 +44727,7 @@ def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44921,7 +44736,7 @@ def get_site_extension_slot( def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44934,7 +44749,7 @@ def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -44946,10 +44761,10 @@ def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44957,16 +44772,15 @@ def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45015,10 +44829,11 @@ def begin_install_site_extension_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -45085,7 +44900,6 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45103,14 +44917,14 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) # type: ignore - def _copy_slot_initial( # pylint: disable=inconsistent-return-statements + def _copy_slot_initial( self, resource_group_name: str, name: str, slot: str, copy_slot_entity: Union[_models.CsmCopySlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45124,7 +44938,7 @@ def _copy_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -45146,10 +44960,10 @@ def _copy_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45157,12 +44971,20 @@ def _copy_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_copy_slot( @@ -45268,7 +45090,7 @@ def begin_copy_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._copy_slot_initial( # type: ignore + raw_result = self._copy_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -45280,6 +45102,7 @@ def begin_copy_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -45429,7 +45252,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45445,7 +45267,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45475,14 +45296,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45496,7 +45317,7 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -45518,10 +45339,10 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45529,12 +45350,20 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot( @@ -45637,7 +45466,7 @@ def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_initial( # type: ignore + raw_result = self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -45649,6 +45478,7 @@ def begin_swap_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -45714,7 +45544,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45730,7 +45559,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45804,7 +45632,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45820,7 +45647,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45892,7 +45718,6 @@ def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45907,14 +45732,7 @@ def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45928,7 +45746,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45942,7 +45760,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -45964,10 +45782,10 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45975,18 +45793,15 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46111,10 +45926,11 @@ def begin_create_or_update_source_control_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -46178,7 +45994,6 @@ def delete_source_control_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46324,7 +46139,6 @@ def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46339,14 +46153,7 @@ def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46395,7 +46202,6 @@ def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46422,7 +46228,7 @@ def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46435,7 +46241,7 @@ def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -46449,10 +46255,10 @@ def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46460,15 +46266,15 @@ def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46529,10 +46335,11 @@ def begin_start_network_trace_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -46596,7 +46403,6 @@ def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46655,7 +46461,6 @@ def stop_network_trace_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46715,7 +46520,6 @@ def sync_repository_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46774,7 +46578,6 @@ def sync_function_triggers_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46837,7 +46640,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46853,7 +46655,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46928,7 +46729,6 @@ def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46945,7 +46745,7 @@ def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46997,7 +46797,6 @@ def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47063,7 +46862,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47079,7 +46877,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47157,7 +46954,6 @@ def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47174,7 +46970,7 @@ def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47226,7 +47022,6 @@ def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47295,7 +47090,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47311,7 +47105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47383,7 +47176,6 @@ def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47398,7 +47190,7 @@ def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47450,7 +47242,6 @@ def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47465,7 +47256,7 @@ def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47616,7 +47407,6 @@ def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47631,7 +47421,7 @@ def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47683,7 +47473,6 @@ def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47845,7 +47634,6 @@ def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47860,7 +47648,7 @@ def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47916,7 +47704,6 @@ def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47933,7 +47720,7 @@ def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48089,7 +47876,6 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48104,7 +47890,7 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48260,7 +48046,6 @@ def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48275,7 +48060,7 @@ def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48327,7 +48112,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48343,7 +48127,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48418,7 +48201,6 @@ def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48433,7 +48215,7 @@ def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48555,7 +48337,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48571,7 +48352,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48601,13 +48381,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48621,7 +48401,7 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48642,10 +48422,10 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48653,12 +48433,20 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot_with_production( @@ -48749,7 +48537,7 @@ def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_with_production_initial( # type: ignore + raw_result = self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -48760,6 +48548,7 @@ def begin_swap_slot_with_production( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -48820,7 +48609,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48836,7 +48624,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48907,7 +48694,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48923,7 +48709,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48989,7 +48774,6 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49004,14 +48788,7 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49024,7 +48801,7 @@ def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -49038,7 +48815,7 @@ def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -49059,10 +48836,10 @@ def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -49070,18 +48847,15 @@ def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49193,10 +48967,11 @@ def begin_create_or_update_source_control( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -49256,7 +49031,6 @@ def delete_source_control( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49389,7 +49163,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49404,14 +49177,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49456,7 +49222,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49482,7 +49247,7 @@ def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -49495,7 +49260,7 @@ def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -49508,10 +49273,10 @@ def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -49519,15 +49284,15 @@ def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49584,10 +49349,11 @@ def begin_start_network_trace( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -49647,7 +49413,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49703,7 +49468,6 @@ def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49759,7 +49523,6 @@ def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49815,7 +49578,6 @@ def sync_function_triggers( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49874,7 +49636,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49890,7 +49651,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49961,7 +49721,6 @@ def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49978,7 +49737,7 @@ def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50026,7 +49785,6 @@ def delete_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50088,7 +49846,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50104,7 +49861,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50178,7 +49934,6 @@ def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50195,7 +49950,7 @@ def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50243,7 +49998,6 @@ def run_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50308,7 +50062,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50324,7 +50077,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50390,7 +50142,6 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50405,7 +50156,7 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50453,7 +50204,6 @@ def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50468,7 +50218,7 @@ def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50606,7 +50356,6 @@ def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50621,7 +50370,7 @@ def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50669,7 +50418,6 @@ def delete_vnet_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50818,7 +50566,6 @@ def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50833,7 +50580,7 @@ def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50885,7 +50632,6 @@ def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50902,7 +50648,7 @@ def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51045,7 +50791,6 @@ def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51060,7 +50805,7 @@ def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51203,7 +50948,6 @@ def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51218,7 +50962,7 @@ def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51264,7 +51008,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51280,7 +51023,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51349,7 +51091,6 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51364,7 +51105,7 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_web_site_management_client_operations.py index 99e2787af9096..62bfca5f00bba 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_09_01/operations/_web_site_management_client_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -538,7 +537,6 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -553,7 +551,7 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -642,7 +640,6 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -657,7 +654,7 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -698,7 +695,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -714,7 +710,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -778,7 +773,6 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +787,7 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -901,7 +895,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -916,7 +909,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -966,7 +959,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -982,7 +974,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1060,7 +1051,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1075,7 +1065,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1115,7 +1105,6 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1130,7 +1119,7 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1196,7 +1185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1212,7 +1200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1332,7 +1319,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1348,7 +1334,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1413,7 +1398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1429,7 +1413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1491,7 +1474,6 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1506,7 +1488,7 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1605,7 +1587,6 @@ def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1620,7 +1601,7 @@ def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1733,7 +1714,6 @@ def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1853,7 +1833,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1868,7 +1847,7 @@ def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1981,7 +1960,6 @@ def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_metadata.json index b92c894218658..30176cc2f71a4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_vendor.py index fd66631892ed1..abd2e5566a353 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from .._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class WebSiteManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_web_site_management_client.py index ec299bd2f1759..ec5c6c68c4d66 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -207,7 +208,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/_vendor.py index 39f69956b8888..6e80ec49ed289 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/_web_site_management_client.py index 20d067b7ecce3..9cd5d018daa56 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -209,7 +210,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_app_service_certificate_orders_operations.py index bebd274507c53..13887db3894e5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_certificate_orders_operations import ( build_create_or_update_certificate_request, build_create_or_update_request, @@ -119,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -254,7 +266,6 @@ async def validate_purchase_information( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +405,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +419,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +432,7 @@ async def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -438,7 +446,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -459,10 +467,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -470,15 +478,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -595,10 +603,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -658,7 +667,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +801,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -808,11 +815,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -862,7 +865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -878,7 +880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -949,7 +950,6 @@ async def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -964,7 +964,7 @@ async def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -978,7 +978,7 @@ async def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -992,7 +992,7 @@ async def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1014,10 +1014,10 @@ async def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1025,15 +1025,15 @@ async def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1157,10 +1157,11 @@ async def begin_create_or_update_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1223,7 +1224,6 @@ async def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1366,7 +1366,6 @@ async def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1381,11 +1380,7 @@ async def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1507,7 +1502,6 @@ async def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1640,7 +1634,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1696,7 +1689,6 @@ async def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1827,7 +1819,6 @@ async def resend_request_emails( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1958,7 +1949,6 @@ async def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1973,7 +1963,7 @@ async def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2018,7 +2008,6 @@ async def verify_domain_ownership( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2074,7 +2063,6 @@ async def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2089,7 +2077,7 @@ async def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2134,7 +2122,6 @@ async def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2149,7 +2136,7 @@ async def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_app_service_environments_operations.py index 491a31acf36dd..902ce6eb5ad8a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_app_service_environments_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_environments_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_change_vnet_request, @@ -143,7 +157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -159,7 +172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +241,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -245,7 +256,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -311,7 +321,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -326,7 +335,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -339,7 +348,7 @@ async def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -353,7 +362,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -374,10 +383,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -385,18 +394,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -513,10 +519,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -538,9 +545,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -553,7 +560,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -564,10 +571,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -575,12 +582,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -611,7 +626,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -621,6 +636,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -759,7 +775,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -774,14 +789,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -830,7 +838,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -846,7 +853,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -912,7 +918,6 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -927,7 +932,7 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -940,7 +945,7 @@ async def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -954,7 +959,7 @@ async def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -975,10 +980,10 @@ async def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -986,15 +991,15 @@ async def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1123,7 +1128,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1139,13 +1143,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1182,6 +1185,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -1247,7 +1251,6 @@ async def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1262,7 +1265,7 @@ async def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1384,7 +1387,6 @@ async def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1399,7 +1401,7 @@ async def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1444,7 +1446,6 @@ async def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1459,7 +1460,7 @@ async def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1507,7 +1508,6 @@ async def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1522,7 +1522,7 @@ async def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1572,7 +1572,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1588,7 +1587,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1660,7 +1658,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1676,7 +1673,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1744,7 +1740,6 @@ async def get_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1759,7 +1754,7 @@ async def get_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1772,7 +1767,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1786,7 +1781,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1807,10 +1802,10 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1818,15 +1813,15 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1940,10 +1935,11 @@ async def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2079,7 +2075,6 @@ async def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2094,11 +2089,7 @@ async def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2153,7 +2144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2169,7 +2159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2242,7 +2231,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2258,7 +2246,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2329,7 +2316,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2345,7 +2331,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2416,7 +2401,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2432,7 +2416,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2498,7 +2481,6 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2513,7 +2495,7 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2563,7 +2545,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2579,7 +2560,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2652,7 +2632,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2668,7 +2647,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2739,7 +2717,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2754,7 +2731,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2768,7 +2745,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2782,7 +2759,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2804,10 +2781,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2815,15 +2792,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2948,10 +2925,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2975,7 +2955,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2988,7 +2968,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -2999,10 +2979,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3010,18 +2990,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3065,10 +3042,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3126,7 +3104,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3141,7 +3118,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3186,7 +3163,6 @@ async def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3204,7 +3180,7 @@ async def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3217,7 +3193,7 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -3227,10 +3203,10 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3238,15 +3214,15 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3297,7 +3273,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3313,13 +3288,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3354,6 +3328,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3423,7 +3398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3439,7 +3413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3514,7 +3487,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3530,7 +3502,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3560,7 +3531,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3573,7 +3544,7 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -3583,10 +3554,10 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3594,15 +3565,15 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3653,7 +3624,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3669,13 +3639,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3710,6 +3679,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3785,7 +3755,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3801,7 +3770,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3873,7 +3841,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3889,7 +3856,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3960,7 +3926,6 @@ async def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3975,7 +3940,7 @@ async def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3989,7 +3954,7 @@ async def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4003,7 +3968,7 @@ async def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4025,10 +3990,10 @@ async def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4036,15 +4001,15 @@ async def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4167,10 +4132,11 @@ async def begin_create_or_update_worker_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4315,7 +4281,6 @@ async def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4330,11 +4295,7 @@ async def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4390,7 +4351,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4406,7 +4366,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4482,7 +4441,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4498,7 +4456,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4572,7 +4529,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4588,7 +4544,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4662,7 +4617,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4678,7 +4632,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_app_service_plans_operations.py index ff4ab91a3522b..aa6cd848ac2df 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_app_service_plans_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_plans_operations import ( build_create_or_update_request, build_create_or_update_vnet_route_request, @@ -131,7 +145,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -147,7 +160,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -216,7 +228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -298,7 +308,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +324,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +337,7 @@ async def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -342,7 +351,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -363,10 +372,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -374,15 +383,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -492,10 +501,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -555,7 +565,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -687,7 +696,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -702,11 +710,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -749,7 +753,6 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -764,7 +767,7 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -815,7 +818,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -830,7 +832,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -881,7 +883,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -943,7 +944,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -958,7 +958,7 @@ async def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1012,7 +1012,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1028,7 +1027,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1096,7 +1094,6 @@ async def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1111,7 +1108,7 @@ async def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1160,7 +1157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1176,7 +1172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1250,7 +1245,6 @@ async def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1328,7 +1322,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1344,7 +1337,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1410,7 +1402,6 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1425,7 +1416,7 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1479,7 +1470,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1495,7 +1485,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1561,7 +1550,6 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1576,7 +1564,7 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1624,7 +1612,6 @@ async def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1641,7 +1628,7 @@ async def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1692,7 +1679,6 @@ async def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1693,7 @@ async def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1847,7 +1833,6 @@ async def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1862,7 +1847,7 @@ async def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1910,7 +1895,6 @@ async def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1925,7 +1909,7 @@ async def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1976,7 +1960,6 @@ async def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1993,7 +1976,7 @@ async def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2133,7 +2116,6 @@ async def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2150,7 +2132,7 @@ async def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2201,7 +2183,6 @@ async def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2352,7 +2333,6 @@ async def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2369,7 +2349,7 @@ async def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2417,7 +2397,6 @@ async def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_certificate_orders_diagnostics_operations.py index 1521104c3df91..a359a7972d993 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_orders_diagnostics_operations import ( build_get_app_service_certificate_order_detector_response_request, build_list_app_service_certificate_order_detector_response_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -211,7 +207,6 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +221,7 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_certificate_registration_provider_operations.py index cbf260d1444fe..44419753bbb83 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_certificate_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_certificates_operations.py index 07e2e6a7e9345..dd1aa5f0501a0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -105,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -187,7 +183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -203,7 +198,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -269,7 +263,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -284,7 +277,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -404,7 +397,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -419,7 +411,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +456,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +587,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +601,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_deleted_web_apps_operations.py index e4f943ecf07b8..bcecdcf604bdf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_deleted_web_apps_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_web_apps_operations import ( build_get_deleted_web_app_by_location_request, build_list_by_location_request, @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -179,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +257,6 @@ async def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +271,7 @@ async def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_diagnostics_operations.py index 893f89c3fd190..6c8fbb7a4d858 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._diagnostics_operations import ( build_execute_site_analysis_request, build_execute_site_analysis_slot_request, @@ -126,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +225,6 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +239,7 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,7 +288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -309,7 +303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +389,6 @@ async def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +403,7 @@ async def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -476,7 +467,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -547,7 +537,6 @@ async def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -562,7 +551,7 @@ async def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -630,7 +618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -704,7 +691,6 @@ async def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,7 +705,7 @@ async def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +773,6 @@ async def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +787,7 @@ async def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -854,7 +839,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -870,7 +854,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -944,7 +927,6 @@ async def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -959,7 +941,7 @@ async def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1027,7 +1009,6 @@ async def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1042,7 +1023,7 @@ async def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1094,7 +1075,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1110,7 +1090,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1201,7 +1180,6 @@ async def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1216,7 +1194,7 @@ async def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1268,7 +1246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1284,7 +1261,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1358,7 +1334,6 @@ async def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1373,7 +1348,7 @@ async def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1428,7 +1403,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1444,7 +1418,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1527,7 +1500,6 @@ async def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1542,7 +1514,7 @@ async def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1614,7 +1586,6 @@ async def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1629,7 +1600,7 @@ async def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1684,7 +1655,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1700,7 +1670,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1783,7 +1752,6 @@ async def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1798,7 +1766,7 @@ async def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1870,7 +1838,6 @@ async def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1885,7 +1852,7 @@ async def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_domain_registration_provider_operations.py index ac749494b9b0d..1cbb1c567e521 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_domain_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_domains_operations.py index 2a3b7735d9eb3..a7e5a904fe703 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_check_availability_request, build_create_or_update_ownership_identifier_request, @@ -162,7 +162,6 @@ async def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -177,7 +176,7 @@ async def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -217,7 +216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -233,7 +231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +290,6 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -308,7 +304,7 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -408,7 +404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -424,7 +419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -490,7 +484,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -506,7 +499,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -572,7 +564,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -587,7 +578,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -596,7 +587,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -610,7 +601,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,10 +622,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -642,15 +633,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,10 +747,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -824,7 +816,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -955,7 +946,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -970,11 +960,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1024,7 +1010,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1040,7 +1025,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1111,7 +1095,6 @@ async def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1126,7 +1109,7 @@ async def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1265,7 +1248,6 @@ async def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1280,7 +1262,7 @@ async def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1328,7 +1310,6 @@ async def delete_ownership_identifier( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1478,7 +1459,6 @@ async def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1493,7 +1473,7 @@ async def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1538,7 +1518,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_global_operations_operations.py index c095e222c1848..23a3ebd85c39d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_global_operations_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._global_operations_operations import ( build_get_deleted_web_app_request, build_get_deleted_web_app_snapshots_request, @@ -94,7 +92,6 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +106,7 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -149,7 +146,6 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -164,7 +160,7 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -209,7 +205,6 @@ async def get_subscription_operation_with_async_response( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_provider_operations.py index 704ae60717a04..a36af33043fdf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._provider_operations import ( build_get_available_stacks_on_prem_request, build_get_available_stacks_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -192,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -208,7 +203,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -280,7 +274,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -296,7 +289,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -367,7 +359,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -383,7 +374,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -449,7 +439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -465,7 +454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -533,7 +521,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -549,7 +536,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +606,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -636,7 +621,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_recommendations_operations.py index bb3026c3937c5..008a5c2ad4178 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_recommendations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommendations_operations import ( build_disable_all_for_hosting_environment_request, build_disable_all_for_web_app_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -198,7 +194,6 @@ async def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +246,6 @@ async def disable_recommendation_for_subscription( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -326,7 +320,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -342,7 +335,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -428,7 +420,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +435,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -515,7 +505,6 @@ async def disable_all_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +563,6 @@ async def reset_all_filters_for_hosting_environment( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +635,6 @@ async def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -662,7 +649,7 @@ async def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -713,7 +700,6 @@ async def disable_recommendation_for_hosting_environment( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -788,7 +774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -804,7 +789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -890,7 +874,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -906,7 +889,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +956,6 @@ async def disable_all_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1030,7 +1011,6 @@ async def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1103,7 +1083,6 @@ async def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1118,7 +1097,7 @@ async def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1145,6 @@ async def disable_recommendation_for_site( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_resource_health_metadata_operations.py index 71c9a8b6d15a1..bf7a8cb9b194d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_resource_health_metadata_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._resource_health_metadata_operations import ( build_get_by_site_request, build_get_by_site_slot_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -277,7 +271,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -293,7 +286,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -359,7 +351,6 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +365,7 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -428,7 +419,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +434,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -516,7 +505,6 @@ async def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -531,7 +519,7 @@ async def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_static_sites_operations.py index fff3259bbf50e..ced64ceb960ef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._static_sites_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_create_or_update_static_site_app_settings_request, @@ -221,7 +221,6 @@ async def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -236,7 +235,7 @@ async def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -278,7 +277,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -294,7 +292,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -364,7 +361,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -380,7 +376,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -448,7 +443,6 @@ async def get_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -463,7 +457,7 @@ async def get_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -476,7 +470,7 @@ async def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -490,7 +484,7 @@ async def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -511,10 +505,10 @@ async def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -522,15 +516,15 @@ async def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -646,10 +640,11 @@ async def begin_create_or_update_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -671,9 +666,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -686,7 +681,7 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -696,10 +691,10 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -707,12 +702,20 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site( @@ -739,7 +742,7 @@ async def begin_delete_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_initial( # type: ignore + raw_result = await self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -748,6 +751,7 @@ async def begin_delete_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -885,7 +889,6 @@ async def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -900,11 +903,7 @@ async def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -957,7 +956,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -973,7 +971,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1047,7 +1044,6 @@ async def delete_static_site_user( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1201,7 +1197,6 @@ async def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1216,7 +1211,7 @@ async def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1266,7 +1261,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1282,7 +1276,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1353,7 +1346,6 @@ async def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1368,16 +1360,16 @@ async def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1390,7 +1382,7 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -1401,10 +1393,10 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1412,12 +1404,20 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_build( @@ -1446,7 +1446,7 @@ async def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_build_initial( # type: ignore + raw_result = await self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -1456,6 +1456,7 @@ async def begin_delete_static_site_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1602,7 +1603,6 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1617,7 +1617,7 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1749,7 +1749,6 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1764,7 +1763,7 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1817,7 +1816,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1833,7 +1831,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1904,7 +1901,6 @@ async def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1919,7 +1915,7 @@ async def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1967,7 +1963,6 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1982,7 +1977,7 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2035,7 +2030,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2051,7 +2045,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2126,7 +2119,6 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2141,7 +2133,9 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2159,7 +2153,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2173,7 +2167,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2199,10 +2193,10 @@ async def _register_user_provided_function_app_with_static_site_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2210,15 +2204,15 @@ async def _register_user_provided_function_app_with_static_site_build_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2377,10 +2371,13 @@ async def begin_register_user_provided_function_app_with_static_site_build( # p params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2447,7 +2444,6 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2465,14 +2461,14 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2486,7 +2482,7 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2508,10 +2504,10 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2519,12 +2515,20 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -2629,7 +2633,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -2641,6 +2645,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2777,7 +2782,6 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2792,7 +2796,7 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2914,7 +2918,6 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2929,7 +2932,7 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3053,7 +3056,6 @@ async def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3068,7 +3070,7 @@ async def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3118,7 +3120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3134,7 +3135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3205,7 +3205,6 @@ async def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3220,7 +3219,7 @@ async def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3236,7 +3235,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3250,7 +3249,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3275,10 +3274,10 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3286,15 +3285,15 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3425,10 +3424,13 @@ async def begin_create_or_update_static_site_custom_domain( # pylint: disable=n params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3450,9 +3452,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3465,7 +3467,7 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -3476,10 +3478,10 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3487,12 +3489,20 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_custom_domain( @@ -3521,7 +3531,7 @@ async def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = await self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -3531,6 +3541,7 @@ async def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3552,7 +3563,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -3561,7 +3572,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3575,7 +3586,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3600,10 +3611,10 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3611,12 +3622,20 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -3724,7 +3743,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -3736,6 +3755,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3757,9 +3777,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _detach_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3772,7 +3792,7 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -3782,10 +3802,10 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3793,12 +3813,20 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_detach_static_site( @@ -3825,7 +3853,7 @@ async def begin_detach_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._detach_static_site_initial( # type: ignore + raw_result = await self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -3834,6 +3862,7 @@ async def begin_detach_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3898,7 +3927,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3914,7 +3942,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3982,7 +4009,6 @@ async def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3997,7 +4023,7 @@ async def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4042,7 +4068,6 @@ async def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4057,7 +4082,7 @@ async def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4102,7 +4127,6 @@ async def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4117,7 +4141,7 @@ async def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4162,7 +4186,6 @@ async def list_static_site_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4177,7 +4200,7 @@ async def list_static_site_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4227,7 +4250,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4243,7 +4265,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4314,7 +4335,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4329,7 +4349,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4343,7 +4363,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4357,7 +4377,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4379,10 +4399,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4390,15 +4410,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4523,10 +4543,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4550,7 +4573,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4563,7 +4586,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -4574,10 +4597,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4585,18 +4608,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4640,10 +4660,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4701,7 +4722,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4716,7 +4736,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4838,7 +4858,6 @@ async def reset_static_site_api_key( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4899,7 +4918,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4915,7 +4933,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4986,7 +5003,6 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5001,7 +5017,9 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5018,7 +5036,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5032,7 +5050,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5057,10 +5075,10 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5068,15 +5086,15 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5222,10 +5240,13 @@ async def begin_register_user_provided_function_app_with_static_site( # pylint: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5288,7 +5309,6 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5306,13 +5326,13 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5326,7 +5346,7 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5347,10 +5367,10 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5358,12 +5378,20 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -5459,7 +5487,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -5470,6 +5498,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_top_level_domains_operations.py index b76384afebfee..4d2f0352cf708 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_level_domains_operations import ( build_get_request, build_list_agreements_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -178,7 +174,6 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_web_apps_operations.py index 1f8728e17810f..e7d2e495a8934 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_web_apps_operations.py @@ -32,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -45,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_apps_operations import ( build_add_premier_add_on_request, build_add_premier_add_on_slot_request, @@ -500,7 +500,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -516,7 +515,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -589,7 +587,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -605,7 +602,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -671,7 +667,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -688,7 +683,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -697,7 +692,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio async def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -711,7 +706,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -732,10 +727,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -743,15 +738,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -863,10 +858,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -938,7 +934,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1078,7 +1073,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1093,11 +1087,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1145,7 +1135,6 @@ async def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1160,7 +1149,7 @@ async def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1280,7 +1269,6 @@ async def apply_slot_config_to_production( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1409,7 +1397,6 @@ async def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1424,7 +1411,7 @@ async def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1470,7 +1457,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1486,7 +1472,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1557,7 +1542,6 @@ async def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1572,7 +1556,7 @@ async def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1620,7 +1604,6 @@ async def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1773,7 +1756,6 @@ async def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1788,21 +1770,21 @@ async def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_initial( # pylint: disable=inconsistent-return-statements + async def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1816,7 +1798,7 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1838,10 +1820,10 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1849,12 +1831,20 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore( @@ -1954,7 +1944,7 @@ async def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_initial( # type: ignore + raw_result = await self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -1966,6 +1956,7 @@ async def begin_restore( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2025,7 +2016,6 @@ async def get_basic_publishing_credentials_policies( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2040,7 +2030,7 @@ async def get_basic_publishing_credentials_policies( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2085,7 +2075,6 @@ async def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2100,7 +2089,7 @@ async def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2224,7 +2213,6 @@ async def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2239,7 +2227,7 @@ async def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2284,7 +2272,6 @@ async def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2299,7 +2286,7 @@ async def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2423,7 +2410,6 @@ async def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2438,7 +2424,7 @@ async def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2487,7 +2473,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2503,7 +2488,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2646,7 +2630,6 @@ async def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2661,7 +2644,7 @@ async def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2706,7 +2689,6 @@ async def list_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2721,7 +2703,7 @@ async def list_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2841,7 +2823,6 @@ async def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2856,7 +2837,7 @@ async def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2899,7 +2880,6 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2914,7 +2894,7 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3034,7 +3014,6 @@ async def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3049,7 +3028,7 @@ async def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3094,7 +3073,6 @@ async def get_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3109,7 +3087,7 @@ async def get_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3231,7 +3209,6 @@ async def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3246,7 +3223,7 @@ async def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3291,7 +3268,6 @@ async def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3306,7 +3282,7 @@ async def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3422,7 +3398,6 @@ async def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3437,7 +3412,7 @@ async def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3482,7 +3457,6 @@ async def delete_backup_configuration( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3538,7 +3512,6 @@ async def get_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3553,7 +3526,7 @@ async def get_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3602,7 +3575,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3618,7 +3590,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3689,7 +3660,6 @@ async def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3704,7 +3674,7 @@ async def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3753,7 +3723,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3769,7 +3738,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3840,7 +3808,6 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3855,7 +3822,7 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3978,7 +3945,6 @@ async def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3993,7 +3959,7 @@ async def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4038,7 +4004,6 @@ async def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4053,7 +4018,7 @@ async def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4098,7 +4063,6 @@ async def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4113,7 +4077,7 @@ async def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4236,7 +4200,6 @@ async def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4251,7 +4214,7 @@ async def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4367,7 +4330,6 @@ async def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4382,7 +4344,7 @@ async def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4425,7 +4387,6 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4440,7 +4401,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4449,7 +4410,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any async def _list_publishing_credentials_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4462,7 +4423,7 @@ async def _list_publishing_credentials_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -4472,10 +4433,10 @@ async def _list_publishing_credentials_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4483,11 +4444,15 @@ async def _list_publishing_credentials_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4528,10 +4493,11 @@ async def begin_list_publishing_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4662,7 +4628,6 @@ async def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4677,7 +4642,7 @@ async def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4720,7 +4685,6 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4735,7 +4699,7 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4780,7 +4744,6 @@ async def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4795,7 +4758,7 @@ async def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4924,7 +4887,6 @@ async def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4939,7 +4901,7 @@ async def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4984,7 +4946,6 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4999,7 +4960,7 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5119,7 +5080,6 @@ async def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5134,7 +5094,7 @@ async def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5254,7 +5214,6 @@ async def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5269,7 +5228,7 @@ async def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5321,7 +5280,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5337,7 +5295,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5408,7 +5365,6 @@ async def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5423,7 +5379,7 @@ async def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5471,7 +5427,6 @@ async def recover_site_configuration_snapshot( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5527,9 +5482,9 @@ async def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5538,12 +5493,16 @@ async def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5588,9 +5547,9 @@ async def get_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5599,12 +5558,16 @@ async def get_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5653,7 +5616,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5669,7 +5631,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5740,7 +5701,6 @@ async def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5757,7 +5717,7 @@ async def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5805,7 +5765,6 @@ async def delete_continuous_web_job( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5864,7 +5823,6 @@ async def start_continuous_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5923,7 +5881,6 @@ async def stop_continuous_web_job( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5982,7 +5939,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5998,7 +5954,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6067,7 +6022,6 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6082,7 +6036,7 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6212,7 +6166,6 @@ async def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6227,7 +6180,7 @@ async def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6275,7 +6228,6 @@ async def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6335,7 +6287,6 @@ async def list_deployment_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6350,7 +6301,7 @@ async def list_deployment_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6474,7 +6425,6 @@ async def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6489,7 +6439,7 @@ async def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6537,7 +6487,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6553,7 +6502,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6624,7 +6572,6 @@ async def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6639,7 +6586,7 @@ async def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6771,7 +6718,6 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6786,7 +6732,7 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6834,7 +6780,6 @@ async def delete_domain_ownership_identifier( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6977,7 +6922,6 @@ async def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6992,7 +6936,7 @@ async def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7035,7 +6979,6 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7050,7 +6993,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7059,7 +7002,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar async def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7073,7 +7016,7 @@ async def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7094,10 +7037,10 @@ async def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7105,13 +7048,15 @@ async def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7217,10 +7162,11 @@ async def begin_create_ms_deploy_operation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7280,7 +7226,6 @@ async def get_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7297,7 +7242,7 @@ async def get_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7346,7 +7291,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7362,7 +7306,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7428,7 +7371,6 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7443,7 +7385,7 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7491,7 +7433,6 @@ async def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7508,7 +7449,7 @@ async def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7522,7 +7463,7 @@ async def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7536,7 +7477,7 @@ async def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7558,10 +7499,10 @@ async def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7569,11 +7510,15 @@ async def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7693,10 +7638,11 @@ async def begin_create_function( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7759,7 +7705,6 @@ async def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7910,7 +7855,6 @@ async def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7925,11 +7869,7 @@ async def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7980,7 +7920,6 @@ async def delete_function_secret( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8039,7 +7978,6 @@ async def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8054,7 +7992,7 @@ async def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8102,7 +8040,6 @@ async def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8117,7 +8054,7 @@ async def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8160,7 +8097,6 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8175,7 +8111,7 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8220,7 +8156,6 @@ async def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8276,7 +8211,6 @@ async def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8427,7 +8361,6 @@ async def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8442,11 +8375,7 @@ async def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8497,7 +8426,6 @@ async def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8557,7 +8485,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8573,7 +8500,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8644,7 +8570,6 @@ async def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8659,7 +8584,7 @@ async def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8791,7 +8716,6 @@ async def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8806,7 +8730,7 @@ async def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8854,7 +8778,6 @@ async def delete_host_name_binding( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8916,7 +8839,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8931,7 +8853,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9071,7 +8993,6 @@ async def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9086,7 +9007,7 @@ async def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9137,7 +9058,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9288,7 +9208,6 @@ async def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9303,7 +9222,7 @@ async def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9348,7 +9267,6 @@ async def list_hybrid_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9363,7 +9281,7 @@ async def list_hybrid_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9408,7 +9326,6 @@ async def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9423,7 +9340,7 @@ async def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9471,7 +9388,6 @@ async def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9486,7 +9402,7 @@ async def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9617,7 +9533,6 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9632,7 +9547,7 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9680,7 +9595,6 @@ async def delete_relay_service_connection( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9822,7 +9736,6 @@ async def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9837,7 +9750,7 @@ async def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9887,7 +9800,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9903,7 +9815,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9974,7 +9885,6 @@ async def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9989,7 +9899,7 @@ async def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10037,7 +9947,6 @@ async def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10052,7 +9961,7 @@ async def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10066,7 +9975,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10080,7 +9989,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10102,10 +10011,10 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10113,13 +10022,15 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10239,10 +10150,11 @@ async def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10305,7 +10217,6 @@ async def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10322,7 +10233,7 @@ async def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10376,7 +10287,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10392,7 +10302,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10467,7 +10376,6 @@ async def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10484,7 +10392,7 @@ async def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10538,7 +10446,6 @@ async def delete_instance_process( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10601,9 +10508,9 @@ async def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10612,13 +10519,17 @@ async def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10676,7 +10587,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10692,7 +10602,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10770,7 +10679,6 @@ async def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10787,7 +10695,7 @@ async def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10843,7 +10751,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10859,7 +10766,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10925,7 +10831,6 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10940,7 +10845,7 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10988,7 +10893,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11004,7 +10908,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11072,7 +10975,6 @@ async def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11087,7 +10989,7 @@ async def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11101,7 +11003,7 @@ async def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11115,7 +11017,7 @@ async def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11137,10 +11039,10 @@ async def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11148,11 +11050,15 @@ async def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11276,10 +11182,11 @@ async def begin_migrate_storage( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11307,7 +11214,7 @@ async def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11321,7 +11228,7 @@ async def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11342,10 +11249,10 @@ async def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11353,11 +11260,15 @@ async def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11468,10 +11379,11 @@ async def begin_migrate_my_sql( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11533,7 +11445,6 @@ async def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11548,7 +11459,7 @@ async def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11593,7 +11504,6 @@ async def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11608,7 +11518,7 @@ async def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11748,7 +11658,6 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11763,7 +11672,7 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11808,7 +11717,6 @@ async def delete_swift_virtual_network( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11867,7 +11775,6 @@ async def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11884,7 +11791,7 @@ async def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11932,7 +11839,6 @@ async def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11947,11 +11853,7 @@ async def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12011,7 +11913,6 @@ async def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12026,7 +11927,7 @@ async def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12041,7 +11942,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12054,7 +11955,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -12067,10 +11968,10 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -12078,15 +11979,15 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12144,10 +12045,11 @@ async def begin_start_web_site_network_trace_operation( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12207,7 +12109,6 @@ async def stop_web_site_network_trace( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12266,7 +12167,6 @@ async def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12281,7 +12181,7 @@ async def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12329,7 +12229,6 @@ async def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12344,11 +12243,7 @@ async def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12396,7 +12291,6 @@ async def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12411,7 +12305,7 @@ async def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12456,7 +12350,6 @@ async def generate_new_site_publishing_password( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12521,7 +12414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -12537,7 +12429,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -12605,7 +12496,6 @@ async def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12620,7 +12510,7 @@ async def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12663,7 +12553,6 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12678,7 +12567,7 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12726,7 +12615,6 @@ async def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12741,7 +12629,7 @@ async def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12871,7 +12759,6 @@ async def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12886,7 +12773,7 @@ async def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12934,7 +12821,6 @@ async def delete_premier_add_on( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13075,7 +12961,6 @@ async def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13090,7 +12975,7 @@ async def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13135,7 +13020,6 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13150,7 +13034,7 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13272,7 +13156,6 @@ async def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13287,7 +13170,7 @@ async def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13337,7 +13220,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13353,7 +13235,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13424,7 +13305,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13439,7 +13319,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13453,7 +13333,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13467,7 +13347,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -13489,10 +13369,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13500,15 +13380,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13633,10 +13513,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -13660,7 +13543,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13673,7 +13556,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -13684,10 +13567,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13695,18 +13578,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13750,10 +13630,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -13811,7 +13692,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13826,7 +13706,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13876,7 +13756,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13892,7 +13771,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13963,7 +13841,6 @@ async def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13980,7 +13857,7 @@ async def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14030,7 +13907,6 @@ async def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14089,9 +13965,9 @@ async def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14100,13 +13976,17 @@ async def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14160,7 +14040,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14176,7 +14055,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14250,7 +14128,6 @@ async def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14267,7 +14144,7 @@ async def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14319,7 +14196,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14335,7 +14211,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14407,7 +14282,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14423,7 +14297,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14494,7 +14367,6 @@ async def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14509,7 +14381,7 @@ async def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14641,7 +14513,6 @@ async def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14656,7 +14527,7 @@ async def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14704,7 +14575,6 @@ async def delete_public_certificate( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14840,9 +14710,9 @@ async def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14851,11 +14721,15 @@ async def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14902,7 +14776,6 @@ async def reset_production_slot_config( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14972,7 +14845,6 @@ async def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14990,9 +14862,9 @@ async def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15006,7 +14878,7 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15027,10 +14899,10 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15038,12 +14910,20 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob( @@ -15130,7 +15010,7 @@ async def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -15141,6 +15021,7 @@ async def begin_restore_from_backup_blob( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15162,13 +15043,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15182,7 +15063,7 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15203,10 +15084,10 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15214,12 +15095,20 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app( @@ -15310,7 +15199,7 @@ async def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -15321,6 +15210,7 @@ async def begin_restore_from_deleted_app( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15342,13 +15232,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15362,7 +15252,7 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15383,10 +15273,10 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15394,12 +15284,20 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot( @@ -15493,7 +15391,7 @@ async def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_initial( # type: ignore + raw_result = await self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -15504,6 +15402,7 @@ async def begin_restore_snapshot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15567,7 +15466,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15583,7 +15481,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15654,7 +15551,6 @@ async def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15671,7 +15567,7 @@ async def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15680,7 +15576,7 @@ async def get_site_extension( async def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15693,7 +15589,7 @@ async def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -15704,10 +15600,10 @@ async def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15715,16 +15611,15 @@ async def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15770,10 +15665,11 @@ async def begin_install_site_extension( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15836,7 +15732,6 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15893,7 +15788,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15909,7 +15803,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15979,7 +15872,6 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15996,7 +15888,7 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16010,7 +15902,7 @@ async def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16024,7 +15916,7 @@ async def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16046,10 +15938,10 @@ async def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16057,15 +15949,15 @@ async def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16194,10 +16086,11 @@ async def begin_create_or_update_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16274,7 +16167,6 @@ async def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16427,7 +16319,6 @@ async def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16442,11 +16333,7 @@ async def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16498,7 +16385,6 @@ async def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16513,7 +16399,7 @@ async def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16646,7 +16532,6 @@ async def apply_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16792,7 +16677,6 @@ async def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16807,7 +16691,7 @@ async def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16859,7 +16743,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16875,7 +16758,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16950,7 +16832,6 @@ async def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16965,7 +16846,7 @@ async def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17017,7 +16898,6 @@ async def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17183,7 +17063,6 @@ async def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17198,14 +17077,14 @@ async def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -17213,7 +17092,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17227,7 +17106,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17250,10 +17129,10 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17261,12 +17140,20 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_slot( @@ -17378,7 +17265,7 @@ async def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_slot_initial( # type: ignore + raw_result = await self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -17391,6 +17278,7 @@ async def begin_restore_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -17453,7 +17341,6 @@ async def get_basic_publishing_credentials_policies_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17468,7 +17355,7 @@ async def get_basic_publishing_credentials_policies_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17516,7 +17403,6 @@ async def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17531,7 +17417,7 @@ async def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17665,7 +17551,6 @@ async def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17680,7 +17565,7 @@ async def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17728,7 +17613,6 @@ async def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17743,7 +17627,7 @@ async def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17877,7 +17761,6 @@ async def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17892,7 +17775,7 @@ async def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17945,7 +17828,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17961,7 +17843,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18117,7 +17998,6 @@ async def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18132,7 +18012,7 @@ async def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18181,7 +18061,6 @@ async def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18196,7 +18075,7 @@ async def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18329,7 +18208,6 @@ async def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18344,7 +18222,7 @@ async def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18393,7 +18271,6 @@ async def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18408,7 +18285,7 @@ async def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18541,7 +18418,6 @@ async def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18556,7 +18432,7 @@ async def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18605,7 +18481,6 @@ async def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18620,7 +18495,7 @@ async def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18755,7 +18630,6 @@ async def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18770,7 +18644,7 @@ async def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18819,7 +18693,6 @@ async def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18834,7 +18707,7 @@ async def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18967,7 +18840,6 @@ async def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18982,7 +18854,7 @@ async def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19031,7 +18903,6 @@ async def delete_backup_configuration_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19091,7 +18962,6 @@ async def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19106,7 +18976,7 @@ async def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19158,7 +19028,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19174,7 +19043,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19248,7 +19116,6 @@ async def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19263,7 +19130,7 @@ async def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19315,7 +19182,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19331,7 +19197,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19405,7 +19270,6 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19420,7 +19284,7 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19556,7 +19420,6 @@ async def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19571,7 +19434,7 @@ async def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19620,7 +19483,6 @@ async def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19635,7 +19497,7 @@ async def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19684,7 +19546,6 @@ async def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19699,7 +19560,7 @@ async def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19835,7 +19696,6 @@ async def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19850,7 +19710,7 @@ async def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19983,7 +19843,6 @@ async def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19998,7 +19857,7 @@ async def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20047,7 +19906,6 @@ async def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20062,7 +19920,7 @@ async def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20071,7 +19929,7 @@ async def list_metadata_slot( async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20084,7 +19942,7 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -20095,10 +19953,10 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20106,11 +19964,15 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20155,10 +20017,11 @@ async def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20306,7 +20169,6 @@ async def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20321,7 +20183,7 @@ async def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20370,7 +20232,6 @@ async def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20385,7 +20246,7 @@ async def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20436,7 +20297,6 @@ async def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20451,7 +20311,7 @@ async def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20584,7 +20444,6 @@ async def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20599,7 +20458,7 @@ async def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20732,7 +20591,6 @@ async def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20747,7 +20605,7 @@ async def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20803,7 +20661,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20819,7 +20676,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20894,7 +20750,6 @@ async def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20909,7 +20764,7 @@ async def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20961,7 +20816,6 @@ async def recover_site_configuration_snapshot_slot( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21021,9 +20875,9 @@ async def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21032,12 +20886,16 @@ async def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21086,9 +20944,9 @@ async def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21097,12 +20955,16 @@ async def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21155,7 +21017,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21171,7 +21032,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21246,7 +21106,6 @@ async def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21263,7 +21122,7 @@ async def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21315,7 +21174,6 @@ async def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21378,7 +21236,6 @@ async def start_continuous_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21441,7 +21298,6 @@ async def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21504,7 +21360,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21520,7 +21375,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21595,7 +21449,6 @@ async def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21610,7 +21463,7 @@ async def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21753,7 +21606,6 @@ async def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21768,7 +21620,7 @@ async def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21820,7 +21672,6 @@ async def delete_deployment_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21884,7 +21735,6 @@ async def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21899,7 +21749,7 @@ async def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22040,7 +21890,6 @@ async def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22055,7 +21904,7 @@ async def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22107,7 +21956,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22123,7 +21971,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22198,7 +22045,6 @@ async def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22213,7 +22059,7 @@ async def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22358,7 +22204,6 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22373,7 +22218,7 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22425,7 +22270,6 @@ async def delete_domain_ownership_identifier_slot( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22581,7 +22425,6 @@ async def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22596,7 +22439,7 @@ async def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22645,7 +22488,6 @@ async def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22660,7 +22502,7 @@ async def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22674,7 +22516,7 @@ async def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22688,7 +22530,7 @@ async def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -22710,10 +22552,10 @@ async def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22721,13 +22563,15 @@ async def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22850,10 +22694,11 @@ async def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22917,7 +22762,6 @@ async def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22934,7 +22778,7 @@ async def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22986,7 +22830,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23002,7 +22845,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23074,7 +22916,6 @@ async def get_functions_admin_token_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23089,7 +22930,7 @@ async def get_functions_admin_token_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23140,7 +22981,6 @@ async def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23157,7 +22997,7 @@ async def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23172,7 +23012,7 @@ async def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23186,7 +23026,7 @@ async def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23209,10 +23049,10 @@ async def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23220,11 +23060,15 @@ async def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23354,10 +23198,11 @@ async def begin_create_instance_function_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23423,7 +23268,6 @@ async def delete_instance_function_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23584,7 +23428,6 @@ async def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23599,11 +23442,7 @@ async def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23657,7 +23496,6 @@ async def delete_function_secret_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23719,7 +23557,6 @@ async def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23734,7 +23571,7 @@ async def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23785,7 +23622,6 @@ async def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23800,7 +23636,7 @@ async def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23848,7 +23684,6 @@ async def list_host_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23863,7 +23698,7 @@ async def list_host_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23911,7 +23746,6 @@ async def list_sync_status_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23970,7 +23804,6 @@ async def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24131,7 +23964,6 @@ async def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24146,11 +23978,7 @@ async def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24204,7 +24032,6 @@ async def delete_host_secret_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24268,7 +24095,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24284,7 +24110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24359,7 +24184,6 @@ async def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24374,7 +24198,7 @@ async def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24519,7 +24343,6 @@ async def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24534,7 +24357,7 @@ async def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24586,7 +24409,6 @@ async def delete_host_name_binding_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24651,7 +24473,6 @@ async def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24666,7 +24487,7 @@ async def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24816,7 +24637,6 @@ async def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24831,7 +24651,7 @@ async def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24885,7 +24705,6 @@ async def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25046,7 +24865,6 @@ async def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25061,7 +24879,7 @@ async def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25109,7 +24927,6 @@ async def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25124,7 +24941,7 @@ async def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25173,7 +24990,6 @@ async def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25188,7 +25004,7 @@ async def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25240,7 +25056,6 @@ async def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25255,7 +25070,7 @@ async def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25399,7 +25214,6 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25414,7 +25228,7 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25466,7 +25280,6 @@ async def delete_relay_service_connection_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25621,7 +25434,6 @@ async def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25636,7 +25448,7 @@ async def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25690,7 +25502,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25706,7 +25517,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25781,7 +25591,6 @@ async def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25796,7 +25605,7 @@ async def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25848,7 +25657,6 @@ async def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25863,7 +25671,7 @@ async def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25878,7 +25686,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25892,7 +25700,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25915,10 +25723,10 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25926,13 +25734,15 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26065,10 +25875,11 @@ async def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=nam params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26135,7 +25946,6 @@ async def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26152,7 +25962,7 @@ async def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26210,7 +26020,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26226,7 +26035,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26305,7 +26113,6 @@ async def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26322,7 +26129,7 @@ async def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26380,7 +26187,6 @@ async def delete_instance_process_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26447,9 +26253,9 @@ async def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26458,13 +26264,17 @@ async def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26526,7 +26336,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26542,7 +26351,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26631,7 +26439,6 @@ async def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26648,7 +26455,7 @@ async def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26708,7 +26515,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26724,7 +26530,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26796,7 +26601,6 @@ async def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26811,7 +26615,7 @@ async def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26863,7 +26667,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26879,7 +26682,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26950,7 +26752,6 @@ async def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26965,7 +26766,7 @@ async def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27015,7 +26816,6 @@ async def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27030,7 +26830,7 @@ async def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27079,7 +26879,6 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27094,7 +26893,7 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27143,7 +26942,6 @@ async def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27206,7 +27004,6 @@ async def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27223,7 +27020,7 @@ async def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27275,7 +27072,6 @@ async def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27290,11 +27086,7 @@ async def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27358,7 +27150,6 @@ async def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27373,7 +27164,7 @@ async def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27389,7 +27180,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27402,7 +27193,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -27416,10 +27207,10 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27427,15 +27218,15 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27497,10 +27288,11 @@ async def begin_start_web_site_network_trace_operation_slot( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27563,7 +27355,6 @@ async def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27626,7 +27417,6 @@ async def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27641,7 +27431,7 @@ async def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27693,7 +27483,6 @@ async def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27708,11 +27497,7 @@ async def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27764,7 +27549,6 @@ async def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27779,7 +27563,7 @@ async def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27828,7 +27612,6 @@ async def generate_new_site_publishing_password_slot( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27897,7 +27680,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27913,7 +27695,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27985,7 +27766,6 @@ async def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28000,7 +27780,7 @@ async def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28049,7 +27829,6 @@ async def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28064,7 +27843,7 @@ async def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28116,7 +27895,6 @@ async def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28131,7 +27909,7 @@ async def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28274,7 +28052,6 @@ async def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28289,7 +28066,7 @@ async def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28341,7 +28118,6 @@ async def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28495,7 +28271,6 @@ async def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28510,7 +28285,7 @@ async def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28560,7 +28335,6 @@ async def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28575,7 +28349,7 @@ async def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28711,7 +28485,6 @@ async def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28726,7 +28499,7 @@ async def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28779,7 +28552,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28795,7 +28567,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28869,7 +28640,6 @@ async def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28884,7 +28654,7 @@ async def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28899,7 +28669,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28913,7 +28683,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28936,10 +28706,10 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28947,15 +28717,15 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29090,10 +28860,13 @@ async def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29117,7 +28890,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29130,7 +28903,7 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -29142,10 +28915,10 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29153,18 +28926,15 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29211,10 +28981,11 @@ async def begin_delete_private_endpoint_connection_slot( # pylint: disable=name params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29275,7 +29046,6 @@ async def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29290,7 +29060,7 @@ async def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29344,7 +29114,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29360,7 +29129,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29435,7 +29203,6 @@ async def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29452,7 +29219,7 @@ async def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29506,7 +29273,6 @@ async def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29569,9 +29335,9 @@ async def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29580,13 +29346,17 @@ async def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29644,7 +29414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29660,7 +29429,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29738,7 +29506,6 @@ async def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29755,7 +29522,7 @@ async def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29811,7 +29578,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29827,7 +29593,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29903,7 +29668,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29919,7 +29683,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29994,7 +29757,6 @@ async def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30009,7 +29771,7 @@ async def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30154,7 +29916,6 @@ async def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30169,7 +29930,7 @@ async def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30221,7 +29982,6 @@ async def delete_public_certificate_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30370,9 +30130,9 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30381,11 +30141,15 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30436,7 +30200,6 @@ async def reset_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30511,7 +30274,6 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30529,14 +30291,14 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30550,7 +30312,7 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30572,10 +30334,10 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30583,12 +30345,20 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob_slot( @@ -30691,7 +30461,7 @@ async def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -30703,6 +30473,7 @@ async def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30724,14 +30495,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30745,7 +30516,7 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30767,10 +30538,10 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30778,12 +30549,20 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app_slot( @@ -30886,7 +30665,7 @@ async def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -30898,6 +30677,7 @@ async def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30919,14 +30699,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30940,7 +30720,7 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30962,10 +30742,10 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30973,12 +30753,20 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot_slot( @@ -31084,7 +30872,7 @@ async def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_slot_initial( # type: ignore + raw_result = await self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -31096,6 +30884,7 @@ async def begin_restore_snapshot_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31163,7 +30952,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31179,7 +30967,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31254,7 +31041,6 @@ async def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31271,7 +31057,7 @@ async def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31280,7 +31066,7 @@ async def get_site_extension_slot( async def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31293,7 +31079,7 @@ async def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -31305,10 +31091,10 @@ async def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31316,16 +31102,15 @@ async def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31375,10 +31160,11 @@ async def begin_install_site_extension_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31445,7 +31231,6 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31594,7 +31379,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31610,7 +31394,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31640,14 +31423,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31661,7 +31444,7 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31683,10 +31466,10 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31694,12 +31477,20 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot( @@ -31802,7 +31593,7 @@ async def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_initial( # type: ignore + raw_result = await self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -31814,6 +31605,7 @@ async def begin_swap_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31879,7 +31671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31895,7 +31686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31969,7 +31759,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31985,7 +31774,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32057,7 +31845,6 @@ async def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32072,14 +31859,7 @@ async def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32093,7 +31873,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32107,7 +31887,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32129,10 +31909,10 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32140,18 +31920,15 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32279,10 +32056,11 @@ async def begin_create_or_update_source_control_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32349,7 +32127,6 @@ async def delete_source_control_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32495,7 +32272,6 @@ async def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32510,14 +32286,7 @@ async def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32566,7 +32335,6 @@ async def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32593,7 +32361,7 @@ async def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32606,7 +32374,7 @@ async def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -32620,10 +32388,10 @@ async def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32631,15 +32399,15 @@ async def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32701,10 +32469,11 @@ async def begin_start_network_trace_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32768,7 +32537,6 @@ async def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32827,7 +32595,6 @@ async def stop_network_trace_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32887,7 +32654,6 @@ async def sync_repository_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32946,7 +32712,6 @@ async def sync_function_triggers_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33010,7 +32775,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33026,7 +32790,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33101,7 +32864,6 @@ async def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33118,7 +32880,7 @@ async def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33170,7 +32932,6 @@ async def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33237,7 +32998,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33253,7 +33013,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33331,7 +33090,6 @@ async def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33348,7 +33106,7 @@ async def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33400,7 +33158,6 @@ async def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33470,7 +33227,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33486,7 +33242,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33558,7 +33313,6 @@ async def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33573,7 +33327,7 @@ async def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33625,7 +33379,6 @@ async def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33640,7 +33393,7 @@ async def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33791,7 +33544,6 @@ async def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33806,7 +33558,7 @@ async def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33858,7 +33610,6 @@ async def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34020,7 +33771,6 @@ async def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34035,7 +33785,7 @@ async def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34091,7 +33841,6 @@ async def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34108,7 +33857,7 @@ async def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34264,7 +34013,6 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34279,7 +34027,7 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34435,7 +34183,6 @@ async def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34450,7 +34197,7 @@ async def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34502,7 +34249,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34518,7 +34264,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34593,7 +34338,6 @@ async def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34608,7 +34352,7 @@ async def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34733,7 +34477,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34749,7 +34492,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34779,13 +34521,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34799,7 +34541,7 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -34820,10 +34562,10 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34831,12 +34573,20 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot_with_production( @@ -34927,7 +34677,7 @@ async def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_with_production_initial( # type: ignore + raw_result = await self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -34938,6 +34688,7 @@ async def begin_swap_slot_with_production( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -34998,7 +34749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35014,7 +34764,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35085,7 +34834,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35101,7 +34849,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35167,7 +34914,6 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35182,14 +34928,7 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35202,7 +34941,7 @@ async def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35216,7 +34955,7 @@ async def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -35237,10 +34976,10 @@ async def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35248,18 +34987,15 @@ async def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35374,10 +35110,11 @@ async def begin_create_or_update_source_control( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -35440,7 +35177,6 @@ async def delete_source_control( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35573,7 +35309,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35588,14 +35323,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35640,7 +35368,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35666,7 +35393,7 @@ async def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35679,7 +35406,7 @@ async def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -35692,10 +35419,10 @@ async def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35703,15 +35430,15 @@ async def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35769,10 +35496,11 @@ async def begin_start_network_trace( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -35832,7 +35560,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35888,7 +35615,6 @@ async def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35944,7 +35670,6 @@ async def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36000,7 +35725,6 @@ async def sync_function_triggers( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36060,7 +35784,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36076,7 +35799,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36147,7 +35869,6 @@ async def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36164,7 +35885,7 @@ async def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36212,7 +35933,6 @@ async def delete_triggered_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36275,7 +35995,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36291,7 +36010,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36365,7 +36083,6 @@ async def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36382,7 +36099,7 @@ async def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36430,7 +36147,6 @@ async def run_triggered_web_job( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36496,7 +36212,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36512,7 +36227,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36578,7 +36292,6 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36593,7 +36306,7 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36641,7 +36354,6 @@ async def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36656,7 +36368,7 @@ async def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36794,7 +36506,6 @@ async def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36809,7 +36520,7 @@ async def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36857,7 +36568,6 @@ async def delete_vnet_connection( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37006,7 +36716,6 @@ async def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37021,7 +36730,7 @@ async def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37073,7 +36782,6 @@ async def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37090,7 +36798,7 @@ async def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37233,7 +36941,6 @@ async def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37248,7 +36955,7 @@ async def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37391,7 +37098,6 @@ async def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37406,7 +37112,7 @@ async def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37452,7 +37158,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37468,7 +37173,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37539,7 +37243,6 @@ async def get_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37554,7 +37257,7 @@ async def get_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_web_site_management_client_operations.py index 9c1d1be7a1959..683f97bb0841e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/aio/operations/_web_site_management_client_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_site_management_client_operations import ( build_check_name_availability_request, build_get_publishing_user_request, @@ -96,7 +94,6 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +108,7 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -200,7 +197,6 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,7 +253,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -273,7 +268,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -337,7 +331,6 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -352,7 +345,7 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +453,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -475,7 +467,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -526,7 +518,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -542,7 +533,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +610,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -635,7 +624,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -675,7 +664,6 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -690,7 +678,7 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,7 +744,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -772,7 +759,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -892,7 +878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -908,7 +893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +958,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -990,7 +973,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1052,7 +1034,6 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1067,7 +1048,7 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1147,6 @@ async def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1181,7 +1161,7 @@ async def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1294,7 +1274,6 @@ async def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1414,7 +1393,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1429,7 +1407,7 @@ async def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1542,7 +1520,6 @@ async def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_app_service_certificate_orders_operations.py index 67b9576473147..ae066e62010f1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -866,7 +867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -882,7 +882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1001,7 +1000,6 @@ def validate_purchase_information( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1075,7 +1072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1143,7 +1139,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1158,7 +1153,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1171,7 +1166,7 @@ def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1185,7 +1180,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1206,10 +1201,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1217,15 +1212,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1342,10 +1337,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1405,7 +1401,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1540,7 +1535,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1555,11 +1549,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1609,7 +1599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1625,7 +1614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1696,7 +1684,6 @@ def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1711,7 +1698,7 @@ def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1725,7 +1712,7 @@ def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1739,7 +1726,7 @@ def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1761,10 +1748,10 @@ def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1772,15 +1759,15 @@ def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1904,10 +1891,11 @@ def begin_create_or_update_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1970,7 +1958,6 @@ def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2113,7 +2100,6 @@ def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2128,11 +2114,7 @@ def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2254,7 +2236,6 @@ def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2387,7 +2368,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2443,7 +2423,6 @@ def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2574,7 +2553,6 @@ def resend_request_emails( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2705,7 +2683,6 @@ def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2720,7 +2697,7 @@ def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2765,7 +2742,6 @@ def verify_domain_ownership( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2821,7 +2797,6 @@ def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2836,7 +2811,7 @@ def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2881,7 +2856,6 @@ def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2896,7 +2870,7 @@ def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_app_service_environments_operations.py index 8e8b5c5d7eff8..43e210b1a39bf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1760,7 +1761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1776,7 +1776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1846,7 +1845,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1862,7 +1860,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1928,7 +1925,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1943,7 +1939,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1956,7 +1952,7 @@ def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1970,7 +1966,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1991,10 +1987,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2002,18 +1998,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2130,10 +2123,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2155,9 +2149,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2170,7 +2164,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -2181,10 +2175,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2192,12 +2186,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -2228,7 +2230,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -2238,6 +2240,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2376,7 +2379,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2391,14 +2393,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2444,7 +2439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2460,7 +2454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2526,7 +2519,6 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2541,7 +2533,7 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2554,7 +2546,7 @@ def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2568,7 +2560,7 @@ def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2589,10 +2581,10 @@ def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2600,15 +2592,15 @@ def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2737,7 +2729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2753,13 +2744,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2796,6 +2786,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2861,7 +2852,6 @@ def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2876,7 +2866,7 @@ def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2998,7 +2988,6 @@ def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3013,7 +3002,7 @@ def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3058,7 +3047,6 @@ def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3073,7 +3061,7 @@ def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3121,7 +3109,6 @@ def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3136,7 +3123,7 @@ def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3186,7 +3173,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3202,7 +3188,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3273,7 +3258,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3289,7 +3273,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3355,7 +3338,6 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3370,7 +3352,7 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3383,7 +3365,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3397,7 +3379,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3418,10 +3400,10 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3429,15 +3411,15 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3548,10 +3530,11 @@ def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3687,7 +3670,6 @@ def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3702,11 +3684,7 @@ def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3761,7 +3739,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3777,7 +3754,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3850,7 +3826,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3866,7 +3841,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3937,7 +3911,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3953,7 +3926,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4022,7 +3994,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4038,7 +4009,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4104,7 +4074,6 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4119,7 +4088,7 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4169,7 +4138,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4185,7 +4153,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4258,7 +4225,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4274,7 +4240,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4345,7 +4310,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4360,7 +4324,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4374,7 +4338,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4388,7 +4352,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4410,10 +4374,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4421,15 +4385,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4554,10 +4518,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4581,7 +4548,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4594,7 +4561,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -4605,10 +4572,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4616,18 +4583,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4671,10 +4635,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4732,7 +4697,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4747,7 +4711,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4792,7 +4756,6 @@ def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4810,7 +4773,7 @@ def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4823,7 +4786,7 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -4833,10 +4796,10 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4844,15 +4807,15 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4901,7 +4864,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4917,13 +4879,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4958,6 +4919,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5026,7 +4988,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5042,7 +5003,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5117,7 +5077,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5133,7 +5092,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5163,7 +5121,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5176,7 +5134,7 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -5186,10 +5144,10 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5197,15 +5155,15 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5254,7 +5212,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5270,13 +5227,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -5311,6 +5267,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5385,7 +5342,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5401,7 +5357,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5472,7 +5427,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5488,7 +5442,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5559,7 +5512,6 @@ def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5574,7 +5526,7 @@ def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5588,7 +5540,7 @@ def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5602,7 +5554,7 @@ def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5624,10 +5576,10 @@ def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5635,15 +5587,15 @@ def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5763,10 +5715,11 @@ def begin_create_or_update_worker_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5911,7 +5864,6 @@ def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5926,11 +5878,7 @@ def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5986,7 +5934,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6002,7 +5949,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6078,7 +6024,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6094,7 +6039,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6168,7 +6112,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6184,7 +6127,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6258,7 +6200,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6274,7 +6215,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_app_service_plans_operations.py index 1e3cd09b243fd..4793689205aca 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1161,7 +1162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1243,7 +1242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1259,7 +1257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1325,7 +1322,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1342,7 +1338,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1355,7 +1351,7 @@ def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1369,7 +1365,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1390,10 +1386,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1401,15 +1397,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1519,10 +1515,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1582,7 +1579,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1714,7 +1710,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1729,11 +1724,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1776,7 +1767,6 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1791,7 +1781,7 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1842,7 +1832,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1857,7 +1846,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1908,7 +1897,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1970,7 +1958,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1985,7 +1972,7 @@ def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2039,7 +2026,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2055,7 +2041,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2123,7 +2108,6 @@ def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2138,7 +2122,7 @@ def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2186,7 +2170,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2202,7 +2185,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2276,7 +2258,6 @@ def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2354,7 +2335,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2370,7 +2350,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2436,7 +2415,6 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2451,7 +2429,7 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2504,7 +2482,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2520,7 +2497,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2586,7 +2562,6 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2601,7 +2576,7 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2649,7 +2624,6 @@ def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2666,7 +2640,7 @@ def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2717,7 +2691,6 @@ def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2732,7 +2705,7 @@ def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2872,7 +2845,6 @@ def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2887,7 +2859,7 @@ def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2935,7 +2907,6 @@ def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2950,7 +2921,7 @@ def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3001,7 +2972,6 @@ def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3018,7 +2988,7 @@ def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3158,7 +3128,6 @@ def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3175,7 +3144,7 @@ def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3226,7 +3195,6 @@ def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3377,7 +3345,6 @@ def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3394,7 +3361,7 @@ def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3442,7 +3409,6 @@ def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificate_orders_diagnostics_operations.py index 9f002cd30a586..060ab13055f7e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -195,7 +194,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -211,7 +209,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -299,7 +296,6 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -314,7 +310,7 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificate_registration_provider_operations.py index c2d8ab73e70a2..771d6c1b3ad94 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificate_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificates_operations.py index bc386dfb0ae11..34f51dd6cd15e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_certificates_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -312,7 +311,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +326,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -394,7 +391,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -410,7 +406,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -476,7 +471,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -491,7 +485,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -611,7 +605,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -626,7 +619,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -671,7 +664,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -803,7 +795,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -818,7 +809,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_deleted_web_apps_operations.py index b9735f3afe235..142a0af97ad2c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_deleted_web_apps_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -176,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -192,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -342,7 +337,6 @@ def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +351,7 @@ def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_diagnostics_operations.py index 1de1700846545..80d2a09328a72 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1101,7 +1100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1117,7 +1115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1204,7 +1201,6 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1219,7 +1215,7 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1267,7 +1263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1283,7 +1278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1370,7 +1364,6 @@ def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1385,7 +1378,7 @@ def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1433,7 +1426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1449,7 +1441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1520,7 +1511,6 @@ def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1535,7 +1525,7 @@ def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1602,7 +1591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1676,7 +1664,6 @@ def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1678,7 @@ def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1759,7 +1746,6 @@ def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,7 +1760,7 @@ def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1825,7 +1811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1841,7 +1826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1915,7 +1899,6 @@ def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1930,7 +1913,7 @@ def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,7 +1981,6 @@ def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2013,7 +1995,7 @@ def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,7 +2046,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2080,7 +2061,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2171,7 +2151,6 @@ def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2186,7 +2165,7 @@ def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2237,7 +2216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2253,7 +2231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2327,7 +2304,6 @@ def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2342,7 +2318,7 @@ def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2396,7 +2372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2412,7 +2387,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2495,7 +2469,6 @@ def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2510,7 +2483,7 @@ def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2582,7 +2555,6 @@ def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2597,7 +2569,7 @@ def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2651,7 +2623,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2667,7 +2638,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2750,7 +2720,6 @@ def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2765,7 +2734,7 @@ def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2837,7 +2806,6 @@ def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2852,7 +2820,7 @@ def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_domain_registration_provider_operations.py index cbd9c423828c6..52896ebdca6b4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_domain_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_domains_operations.py index ddc7f68668666..87e26e5acc8d0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -694,7 +695,6 @@ def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -709,7 +709,7 @@ def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -749,7 +749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -765,7 +764,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -825,7 +823,6 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -840,7 +837,7 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -937,7 +934,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -953,7 +949,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1019,7 +1014,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1035,7 +1029,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1101,7 +1094,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1116,7 +1108,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1125,7 +1117,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1139,7 +1131,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1160,10 +1152,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1171,15 +1163,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1282,10 +1274,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1350,7 +1343,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1481,7 +1473,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1496,11 +1487,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1550,7 +1537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1566,7 +1552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1637,7 +1622,6 @@ def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1652,7 +1636,7 @@ def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1791,7 +1775,6 @@ def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1806,7 +1789,7 @@ def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1854,7 +1837,6 @@ def delete_ownership_identifier( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2004,7 +1986,6 @@ def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2019,7 +2000,7 @@ def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,7 +2045,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_global_operations_operations.py index 6d27e89eb5989..3713a4c3450b8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_global_operations_operations.py @@ -18,15 +18,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -194,7 +192,7 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -234,7 +232,6 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -249,7 +246,7 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -294,7 +291,6 @@ def get_subscription_operation_with_async_response( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_provider_operations.py index 28427c4c765f5..e34383d73f1b1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -273,7 +272,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -289,7 +287,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -357,7 +354,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -373,7 +369,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -444,7 +439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -460,7 +454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -531,7 +524,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -547,7 +539,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -613,7 +604,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -629,7 +619,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -697,7 +686,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -713,7 +701,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -784,7 +771,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -800,7 +786,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_recommendations_operations.py index e107ccc0172dc..d88e04418e8b9 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_recommendations_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -730,7 +729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -746,7 +744,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -806,7 +803,6 @@ def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -859,7 +855,6 @@ def disable_recommendation_for_subscription( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -933,7 +928,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -949,7 +943,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1034,7 +1027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1050,7 +1042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1121,7 +1112,6 @@ def disable_all_for_hosting_environment( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1180,7 +1170,6 @@ def reset_all_filters_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1253,7 +1242,6 @@ def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1268,7 +1256,7 @@ def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1319,7 +1307,6 @@ def disable_recommendation_for_hosting_environment( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1393,7 +1380,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1409,7 +1395,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1494,7 +1479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1510,7 +1494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1578,7 +1561,6 @@ def disable_all_for_web_app( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1634,7 +1616,6 @@ def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1688,6 @@ def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1722,7 +1702,7 @@ def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1770,7 +1750,6 @@ def disable_recommendation_for_site( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_resource_health_metadata_operations.py index bc66465c46f94..653233d567087 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_resource_health_metadata_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -389,7 +386,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -405,7 +401,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -477,7 +472,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -493,7 +487,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -559,7 +552,6 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +566,7 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -627,7 +619,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -643,7 +634,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -715,7 +705,6 @@ def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -730,7 +719,7 @@ def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_static_sites_operations.py index 3795a3125656c..36a8a0fe0cddd 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -2086,7 +2087,6 @@ def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2101,7 +2101,7 @@ def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2142,7 +2142,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2158,7 +2157,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2227,7 +2225,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2243,7 +2240,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2309,7 +2305,6 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2324,7 +2319,7 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2337,7 +2332,7 @@ def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2351,7 +2346,7 @@ def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2372,10 +2367,10 @@ def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2383,15 +2378,15 @@ def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2504,10 +2499,11 @@ def begin_create_or_update_static_site( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2529,9 +2525,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2544,7 +2538,7 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -2554,10 +2548,10 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2565,12 +2559,20 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -2595,7 +2597,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_initial( # type: ignore + raw_result = self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -2604,6 +2606,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2741,7 +2744,6 @@ def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2756,11 +2758,7 @@ def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2813,7 +2811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2829,7 +2826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2903,7 +2899,6 @@ def delete_static_site_user( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3057,7 +3052,6 @@ def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3072,7 +3066,7 @@ def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3122,7 +3116,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3138,7 +3131,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3209,7 +3201,6 @@ def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3224,16 +3215,16 @@ def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3246,7 +3237,7 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -3257,10 +3248,10 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3268,12 +3259,20 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_build( @@ -3302,7 +3301,7 @@ def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_build_initial( # type: ignore + raw_result = self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -3312,6 +3311,7 @@ def begin_delete_static_site_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3458,7 +3458,6 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3473,7 +3472,7 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3605,7 +3604,6 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3620,7 +3618,7 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3673,7 +3671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3689,7 +3686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3760,7 +3756,6 @@ def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3775,7 +3770,7 @@ def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3823,7 +3818,6 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3838,7 +3832,7 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3891,7 +3885,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3907,7 +3900,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3982,7 +3974,6 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3997,7 +3988,9 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4015,7 +4008,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4029,7 +4022,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4055,10 +4048,10 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4066,15 +4059,15 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4233,10 +4226,13 @@ def begin_register_user_provided_function_app_with_static_site_build( # pylint: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4303,7 +4299,6 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4321,14 +4316,14 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4342,7 +4337,7 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4364,10 +4359,10 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4375,12 +4370,20 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -4485,7 +4488,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -4497,6 +4500,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4633,7 +4637,6 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4648,7 +4651,7 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4770,7 +4773,6 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4785,7 +4787,7 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4909,7 +4911,6 @@ def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4924,7 +4925,7 @@ def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4974,7 +4975,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4990,7 +4990,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5061,7 +5060,6 @@ def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5076,7 +5074,7 @@ def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5092,7 +5090,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5106,7 +5104,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5131,10 +5129,10 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5142,15 +5140,15 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5281,10 +5279,13 @@ def begin_create_or_update_static_site_custom_domain( # pylint: disable=name-to params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5306,9 +5307,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5321,7 +5322,7 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -5332,10 +5333,10 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5343,12 +5344,20 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_custom_domain( @@ -5377,7 +5386,7 @@ def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -5387,6 +5396,7 @@ def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5408,7 +5418,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -5417,7 +5427,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5431,7 +5441,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5456,10 +5466,10 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5467,12 +5477,20 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -5580,7 +5598,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -5592,6 +5610,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5613,9 +5632,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _detach_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5628,7 +5645,7 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -5638,10 +5655,10 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5649,12 +5666,20 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -5679,7 +5704,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._detach_static_site_initial( # type: ignore + raw_result = self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -5688,6 +5713,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5752,7 +5778,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5768,7 +5793,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5836,7 +5860,6 @@ def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5851,7 +5874,7 @@ def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5896,7 +5919,6 @@ def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5911,7 +5933,7 @@ def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5956,7 +5978,6 @@ def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5971,7 +5992,7 @@ def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6014,7 +6035,6 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6029,7 +6049,7 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6079,7 +6099,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6095,7 +6114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6166,7 +6184,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6181,7 +6198,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6195,7 +6212,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6209,7 +6226,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6231,10 +6248,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6242,15 +6259,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6375,10 +6392,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6402,7 +6422,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6415,7 +6435,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -6426,10 +6446,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6437,18 +6457,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6492,10 +6509,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6553,7 +6571,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6568,7 +6585,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6690,7 +6707,6 @@ def reset_static_site_api_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6751,7 +6767,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6767,7 +6782,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6838,7 +6852,6 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6853,7 +6866,9 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6870,7 +6885,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6884,7 +6899,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6909,10 +6924,10 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6920,15 +6935,15 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7074,10 +7089,13 @@ def begin_register_user_provided_function_app_with_static_site( # pylint: disab params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7140,7 +7158,6 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7158,13 +7175,13 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7178,7 +7195,7 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7199,10 +7216,10 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7210,12 +7227,20 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -7311,7 +7336,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -7322,6 +7347,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_top_level_domains_operations.py index 1cc48a99df14f..8e8d72fb8928e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_top_level_domains_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_web_apps_operations.py index b4380f569a937..b482044bc3b35 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_web_apps_operations.py @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -15853,7 +15854,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15869,7 +15869,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15942,7 +15941,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15958,7 +15956,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16024,7 +16021,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16041,7 +16037,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16050,7 +16046,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16064,7 +16060,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16085,10 +16081,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16096,15 +16092,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16216,10 +16212,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16291,7 +16288,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16431,7 +16427,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16446,11 +16441,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16498,7 +16489,6 @@ def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16513,7 +16503,7 @@ def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16633,7 +16623,6 @@ def apply_slot_config_to_production( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16762,7 +16751,6 @@ def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16777,7 +16765,7 @@ def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16823,7 +16811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16839,7 +16826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16910,7 +16896,6 @@ def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16925,7 +16910,7 @@ def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16973,7 +16958,6 @@ def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17126,7 +17110,6 @@ def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17141,21 +17124,21 @@ def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_initial( # pylint: disable=inconsistent-return-statements + def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17169,7 +17152,7 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17191,10 +17174,10 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17202,12 +17185,20 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore( @@ -17307,7 +17298,7 @@ def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_initial( # type: ignore + raw_result = self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -17319,6 +17310,7 @@ def begin_restore( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -17378,7 +17370,6 @@ def get_basic_publishing_credentials_policies( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17393,7 +17384,7 @@ def get_basic_publishing_credentials_policies( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17438,7 +17429,6 @@ def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17453,7 +17443,7 @@ def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17577,7 +17567,6 @@ def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17592,7 +17581,7 @@ def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17637,7 +17626,6 @@ def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17652,7 +17640,7 @@ def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17776,7 +17764,6 @@ def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17791,7 +17778,7 @@ def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17839,7 +17826,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17855,7 +17841,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17998,7 +17983,6 @@ def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18013,7 +17997,7 @@ def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18056,7 +18040,6 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18071,7 +18054,7 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18191,7 +18174,6 @@ def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18206,7 +18188,7 @@ def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18249,7 +18231,6 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18264,7 +18245,7 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18384,7 +18365,6 @@ def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18399,7 +18379,7 @@ def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18442,7 +18422,6 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18457,7 +18436,7 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18579,7 +18558,6 @@ def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18594,7 +18572,7 @@ def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18639,7 +18617,6 @@ def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18654,7 +18631,7 @@ def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18770,7 +18747,6 @@ def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18785,7 +18761,7 @@ def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18830,7 +18806,6 @@ def delete_backup_configuration( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18884,7 +18859,6 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18899,7 +18873,7 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18947,7 +18921,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18963,7 +18936,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19034,7 +19006,6 @@ def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19049,7 +19020,7 @@ def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19097,7 +19068,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19113,7 +19083,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19184,7 +19153,6 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19199,7 +19167,7 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19322,7 +19290,6 @@ def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19337,7 +19304,7 @@ def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19382,7 +19349,6 @@ def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19397,7 +19363,7 @@ def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19442,7 +19408,6 @@ def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19457,7 +19422,7 @@ def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19580,7 +19545,6 @@ def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19595,7 +19559,7 @@ def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19711,7 +19675,6 @@ def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19726,7 +19689,7 @@ def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19769,7 +19732,6 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19784,14 +19746,16 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _list_publishing_credentials_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.User: + def _list_publishing_credentials_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19804,7 +19768,7 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -19814,10 +19778,10 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -19825,11 +19789,15 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19870,10 +19838,11 @@ def begin_list_publishing_credentials( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20004,7 +19973,6 @@ def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20019,7 +19987,7 @@ def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20062,7 +20030,6 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20077,7 +20044,7 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20122,7 +20089,6 @@ def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20137,7 +20103,7 @@ def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20266,7 +20232,6 @@ def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20281,7 +20246,7 @@ def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20326,7 +20291,6 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20341,7 +20305,7 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20461,7 +20425,6 @@ def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20476,7 +20439,7 @@ def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20596,7 +20559,6 @@ def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20611,7 +20573,7 @@ def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20663,7 +20625,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20679,7 +20640,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20750,7 +20710,6 @@ def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20765,7 +20724,7 @@ def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20813,7 +20772,6 @@ def recover_site_configuration_snapshot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20869,9 +20827,9 @@ def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20880,12 +20838,16 @@ def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20928,9 +20890,9 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20939,12 +20901,16 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20992,7 +20958,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21008,7 +20973,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21079,7 +21043,6 @@ def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21096,7 +21059,7 @@ def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21144,7 +21107,6 @@ def delete_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21203,7 +21165,6 @@ def start_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21262,7 +21223,6 @@ def stop_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21319,7 +21279,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21335,7 +21294,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21404,7 +21362,6 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21419,7 +21376,7 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21549,7 +21506,6 @@ def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21564,7 +21520,7 @@ def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21612,7 +21568,6 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21670,7 +21625,6 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21685,7 +21639,7 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21809,7 +21763,6 @@ def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21824,7 +21777,7 @@ def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21872,7 +21825,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21888,7 +21840,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21959,7 +21910,6 @@ def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21974,7 +21924,7 @@ def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22106,7 +22056,6 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22121,7 +22070,7 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22169,7 +22118,6 @@ def delete_domain_ownership_identifier( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22312,7 +22260,6 @@ def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22327,7 +22274,7 @@ def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22370,7 +22317,6 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22385,7 +22331,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22394,7 +22340,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22408,7 +22354,7 @@ def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -22429,10 +22375,10 @@ def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22440,13 +22386,15 @@ def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22552,10 +22500,11 @@ def begin_create_ms_deploy_operation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22613,7 +22562,6 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22630,7 +22578,7 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22678,7 +22626,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22694,7 +22641,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22760,7 +22706,6 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22775,7 +22720,7 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22823,7 +22768,6 @@ def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22840,7 +22784,7 @@ def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22854,7 +22798,7 @@ def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22868,7 +22812,7 @@ def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -22890,10 +22834,10 @@ def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22901,11 +22845,15 @@ def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23025,10 +22973,11 @@ def begin_create_function( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23091,7 +23040,6 @@ def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23242,7 +23190,6 @@ def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23257,11 +23204,7 @@ def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23312,7 +23255,6 @@ def delete_function_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23371,7 +23313,6 @@ def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23386,7 +23327,7 @@ def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23434,7 +23375,6 @@ def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23449,7 +23389,7 @@ def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23492,7 +23432,6 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23507,7 +23446,7 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23552,7 +23491,6 @@ def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23608,7 +23546,6 @@ def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23759,7 +23696,6 @@ def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23774,11 +23710,7 @@ def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23829,7 +23761,6 @@ def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23888,7 +23819,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23904,7 +23834,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23975,7 +23904,6 @@ def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23990,7 +23918,7 @@ def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24122,7 +24050,6 @@ def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24137,7 +24064,7 @@ def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24185,7 +24112,6 @@ def delete_host_name_binding( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24247,7 +24173,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24262,7 +24187,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24402,7 +24327,6 @@ def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24417,7 +24341,7 @@ def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24468,7 +24392,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24619,7 +24542,6 @@ def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24634,7 +24556,7 @@ def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24677,7 +24599,6 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24692,7 +24613,7 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24737,7 +24658,6 @@ def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24752,7 +24672,7 @@ def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24800,7 +24720,6 @@ def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24815,7 +24734,7 @@ def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24946,7 +24865,6 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24961,7 +24879,7 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25009,7 +24927,6 @@ def delete_relay_service_connection( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25151,7 +25068,6 @@ def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25166,7 +25082,7 @@ def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25215,7 +25131,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25231,7 +25146,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25302,7 +25216,6 @@ def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25317,7 +25230,7 @@ def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25365,7 +25278,6 @@ def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25380,7 +25292,7 @@ def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25394,7 +25306,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25408,7 +25320,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25430,10 +25342,10 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25441,13 +25353,15 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25567,10 +25481,11 @@ def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25633,7 +25548,6 @@ def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25650,7 +25564,7 @@ def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25704,7 +25618,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25720,7 +25633,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25795,7 +25707,6 @@ def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25812,7 +25723,7 @@ def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25866,7 +25777,6 @@ def delete_instance_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25929,9 +25839,9 @@ def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25940,13 +25850,17 @@ def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26003,7 +25917,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26019,7 +25932,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26097,7 +26009,6 @@ def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26114,7 +26025,7 @@ def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26169,7 +26080,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26185,7 +26095,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26251,7 +26160,6 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26266,7 +26174,7 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26312,7 +26220,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26328,7 +26235,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26396,7 +26302,6 @@ def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26411,7 +26316,7 @@ def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26425,7 +26330,7 @@ def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26439,7 +26344,7 @@ def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26461,10 +26366,10 @@ def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26472,11 +26377,15 @@ def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26600,10 +26509,11 @@ def begin_migrate_storage( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26631,7 +26541,7 @@ def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26645,7 +26555,7 @@ def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26666,10 +26576,10 @@ def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26677,11 +26587,15 @@ def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26789,10 +26703,11 @@ def begin_migrate_my_sql( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26854,7 +26769,6 @@ def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26869,7 +26783,7 @@ def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26914,7 +26828,6 @@ def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26929,7 +26842,7 @@ def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27069,7 +26982,6 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27084,7 +26996,7 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27129,7 +27041,6 @@ def delete_swift_virtual_network( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27188,7 +27099,6 @@ def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27205,7 +27115,7 @@ def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27253,7 +27163,6 @@ def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27268,11 +27177,7 @@ def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27332,7 +27237,6 @@ def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27347,7 +27251,7 @@ def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27362,7 +27266,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27375,7 +27279,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -27388,10 +27292,10 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27399,15 +27303,15 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27464,10 +27368,11 @@ def begin_start_web_site_network_trace_operation( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27527,7 +27432,6 @@ def stop_web_site_network_trace( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27586,7 +27490,6 @@ def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27601,7 +27504,7 @@ def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27649,7 +27552,6 @@ def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27664,11 +27566,7 @@ def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27716,7 +27614,6 @@ def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27731,7 +27628,7 @@ def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27776,7 +27673,6 @@ def generate_new_site_publishing_password( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27840,7 +27736,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27856,7 +27751,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27924,7 +27818,6 @@ def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27939,7 +27832,7 @@ def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27982,7 +27875,6 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27997,7 +27889,7 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28045,7 +27937,6 @@ def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28060,7 +27951,7 @@ def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28190,7 +28081,6 @@ def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28205,7 +28095,7 @@ def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28253,7 +28143,6 @@ def delete_premier_add_on( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28394,7 +28283,6 @@ def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28409,7 +28297,7 @@ def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28454,7 +28342,6 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28469,7 +28356,7 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28591,7 +28478,6 @@ def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28606,7 +28492,7 @@ def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28656,7 +28542,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28672,7 +28557,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28743,7 +28627,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28758,7 +28641,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28772,7 +28655,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28786,7 +28669,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28808,10 +28691,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28819,15 +28702,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28952,10 +28835,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28979,7 +28865,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28992,7 +28878,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -29003,10 +28889,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29014,18 +28900,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29069,10 +28952,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29130,7 +29014,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29145,7 +29028,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29193,7 +29076,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29209,7 +29091,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29280,7 +29161,6 @@ def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29297,7 +29177,7 @@ def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29347,7 +29227,6 @@ def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29406,9 +29285,9 @@ def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29417,13 +29296,17 @@ def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29476,7 +29359,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29492,7 +29374,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29566,7 +29447,6 @@ def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29583,7 +29463,7 @@ def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29634,7 +29514,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29650,7 +29529,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29721,7 +29599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29737,7 +29614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29808,7 +29684,6 @@ def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29823,7 +29698,7 @@ def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29955,7 +29830,6 @@ def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29970,7 +29844,7 @@ def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30018,7 +29892,6 @@ def delete_public_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30154,9 +30027,9 @@ def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30165,11 +30038,15 @@ def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30216,7 +30093,6 @@ def reset_production_slot_config( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30286,7 +30162,6 @@ def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30304,9 +30179,9 @@ def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30320,7 +30195,7 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30341,10 +30216,10 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30352,12 +30227,20 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob( @@ -30444,7 +30327,7 @@ def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_initial( # type: ignore + raw_result = self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -30455,6 +30338,7 @@ def begin_restore_from_backup_blob( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30476,13 +30360,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30496,7 +30380,7 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30517,10 +30401,10 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30528,12 +30412,20 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app( @@ -30624,7 +30516,7 @@ def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_initial( # type: ignore + raw_result = self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -30635,6 +30527,7 @@ def begin_restore_from_deleted_app( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30656,13 +30549,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30676,7 +30569,7 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30697,10 +30590,10 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30708,12 +30601,20 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot( @@ -30807,7 +30708,7 @@ def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_initial( # type: ignore + raw_result = self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -30818,6 +30719,7 @@ def begin_restore_snapshot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30880,7 +30782,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30896,7 +30797,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30967,7 +30867,6 @@ def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30984,7 +30883,7 @@ def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30993,7 +30892,7 @@ def get_site_extension( def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31006,7 +30905,7 @@ def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -31017,10 +30916,10 @@ def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31028,16 +30927,15 @@ def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31082,10 +30980,11 @@ def begin_install_site_extension( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31148,7 +31047,6 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31205,7 +31103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31221,7 +31118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31291,7 +31187,6 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31308,7 +31203,7 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31322,7 +31217,7 @@ def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31336,7 +31231,7 @@ def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31358,10 +31253,10 @@ def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31369,15 +31264,15 @@ def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31506,10 +31401,11 @@ def begin_create_or_update_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31586,7 +31482,6 @@ def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31739,7 +31634,6 @@ def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31754,11 +31648,7 @@ def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31810,7 +31700,6 @@ def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31825,7 +31714,7 @@ def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31958,7 +31847,6 @@ def apply_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32104,7 +31992,6 @@ def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32119,7 +32006,7 @@ def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32171,7 +32058,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32187,7 +32073,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32262,7 +32147,6 @@ def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32277,7 +32161,7 @@ def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32329,7 +32213,6 @@ def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32495,7 +32378,6 @@ def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32510,14 +32392,14 @@ def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -32525,7 +32407,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32539,7 +32421,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32562,10 +32444,10 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32573,12 +32455,20 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_slot( @@ -32690,7 +32580,7 @@ def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_slot_initial( # type: ignore + raw_result = self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -32703,6 +32593,7 @@ def begin_restore_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32765,7 +32656,6 @@ def get_basic_publishing_credentials_policies_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32780,7 +32670,7 @@ def get_basic_publishing_credentials_policies_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32828,7 +32718,6 @@ def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32843,7 +32732,7 @@ def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32977,7 +32866,6 @@ def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32992,7 +32880,7 @@ def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33040,7 +32928,6 @@ def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33055,7 +32942,7 @@ def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33189,7 +33076,6 @@ def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33204,7 +33090,7 @@ def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33256,7 +33142,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33272,7 +33157,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33428,7 +33312,6 @@ def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33443,7 +33326,7 @@ def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33492,7 +33375,6 @@ def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33507,7 +33389,7 @@ def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33640,7 +33522,6 @@ def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33655,7 +33536,7 @@ def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33704,7 +33585,6 @@ def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33719,7 +33599,7 @@ def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33852,7 +33732,6 @@ def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33867,7 +33746,7 @@ def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33916,7 +33795,6 @@ def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33931,7 +33809,7 @@ def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34066,7 +33944,6 @@ def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34081,7 +33958,7 @@ def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34130,7 +34007,6 @@ def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34145,7 +34021,7 @@ def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34278,7 +34154,6 @@ def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34293,7 +34168,7 @@ def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34342,7 +34217,6 @@ def delete_backup_configuration_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34402,7 +34276,6 @@ def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34417,7 +34290,7 @@ def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34468,7 +34341,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34484,7 +34356,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34558,7 +34429,6 @@ def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34573,7 +34443,7 @@ def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34624,7 +34494,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34640,7 +34509,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34714,7 +34582,6 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34729,7 +34596,7 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34865,7 +34732,6 @@ def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34880,7 +34746,7 @@ def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34929,7 +34795,6 @@ def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34944,7 +34809,7 @@ def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34993,7 +34858,6 @@ def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35008,7 +34872,7 @@ def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35144,7 +35008,6 @@ def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35159,7 +35022,7 @@ def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35292,7 +35155,6 @@ def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35307,7 +35169,7 @@ def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35356,7 +35218,6 @@ def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35371,7 +35232,7 @@ def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35380,7 +35241,7 @@ def list_metadata_slot( def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35393,7 +35254,7 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -35404,10 +35265,10 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35415,11 +35276,15 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35464,10 +35329,11 @@ def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -35615,7 +35481,6 @@ def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35630,7 +35495,7 @@ def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35679,7 +35544,6 @@ def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35694,7 +35558,7 @@ def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35745,7 +35609,6 @@ def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35760,7 +35623,7 @@ def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35893,7 +35756,6 @@ def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35908,7 +35770,7 @@ def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36041,7 +35903,6 @@ def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36056,7 +35917,7 @@ def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36112,7 +35973,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36128,7 +35988,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36203,7 +36062,6 @@ def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36218,7 +36076,7 @@ def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36270,7 +36128,6 @@ def recover_site_configuration_snapshot_slot( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36330,9 +36187,9 @@ def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -36341,12 +36198,16 @@ def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36395,9 +36256,9 @@ def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -36406,12 +36267,16 @@ def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36463,7 +36328,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36479,7 +36343,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36554,7 +36417,6 @@ def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36571,7 +36433,7 @@ def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36623,7 +36485,6 @@ def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36686,7 +36547,6 @@ def start_continuous_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36749,7 +36609,6 @@ def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36812,7 +36671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36828,7 +36686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36903,7 +36760,6 @@ def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36918,7 +36774,7 @@ def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37061,7 +36917,6 @@ def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37076,7 +36931,7 @@ def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37128,7 +36983,6 @@ def delete_deployment_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37192,7 +37046,6 @@ def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37207,7 +37060,7 @@ def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37348,7 +37201,6 @@ def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37363,7 +37215,7 @@ def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37415,7 +37267,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37431,7 +37282,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37506,7 +37356,6 @@ def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37521,7 +37370,7 @@ def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37666,7 +37515,6 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37681,7 +37529,7 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37733,7 +37581,6 @@ def delete_domain_ownership_identifier_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37889,7 +37736,6 @@ def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37904,7 +37750,7 @@ def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37953,7 +37799,6 @@ def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37968,7 +37813,7 @@ def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37982,7 +37827,7 @@ def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37996,7 +37841,7 @@ def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -38018,10 +37863,10 @@ def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -38029,13 +37874,15 @@ def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38158,10 +38005,11 @@ def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -38225,7 +38073,6 @@ def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38242,7 +38089,7 @@ def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38293,7 +38140,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38309,7 +38155,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38379,7 +38224,6 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38394,7 +38238,7 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38445,7 +38289,6 @@ def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38462,7 +38305,7 @@ def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38477,7 +38320,7 @@ def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -38491,7 +38334,7 @@ def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -38514,10 +38357,10 @@ def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -38525,11 +38368,15 @@ def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38659,10 +38506,11 @@ def begin_create_instance_function_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -38728,7 +38576,6 @@ def delete_instance_function_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38889,7 +38736,6 @@ def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38904,11 +38750,7 @@ def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38962,7 +38804,6 @@ def delete_function_secret_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39024,7 +38865,6 @@ def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39039,7 +38879,7 @@ def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39090,7 +38930,6 @@ def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39105,7 +38944,7 @@ def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39151,7 +38990,6 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39166,7 +39004,7 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39214,7 +39052,6 @@ def list_sync_status_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39273,7 +39110,6 @@ def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39434,7 +39270,6 @@ def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39449,11 +39284,7 @@ def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39507,7 +39338,6 @@ def delete_host_secret_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39570,7 +39400,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39586,7 +39415,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39661,7 +39489,6 @@ def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39676,7 +39503,7 @@ def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39821,7 +39648,6 @@ def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39836,7 +39662,7 @@ def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39888,7 +39714,6 @@ def delete_host_name_binding_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39953,7 +39778,6 @@ def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39968,7 +39792,7 @@ def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40118,7 +39942,6 @@ def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40133,7 +39956,7 @@ def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40187,7 +40010,6 @@ def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40348,7 +40170,6 @@ def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40363,7 +40184,7 @@ def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40411,7 +40232,6 @@ def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40426,7 +40246,7 @@ def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40475,7 +40295,6 @@ def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40490,7 +40309,7 @@ def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40542,7 +40361,6 @@ def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40557,7 +40375,7 @@ def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40701,7 +40519,6 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40716,7 +40533,7 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40768,7 +40585,6 @@ def delete_relay_service_connection_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40923,7 +40739,6 @@ def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40938,7 +40753,7 @@ def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40991,7 +40806,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41007,7 +40821,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41082,7 +40895,6 @@ def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41097,7 +40909,7 @@ def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41149,7 +40961,6 @@ def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41164,7 +40975,7 @@ def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41179,7 +40990,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -41193,7 +41004,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -41216,10 +41027,10 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -41227,13 +41038,15 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41366,10 +41179,11 @@ def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=name-too- params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -41436,7 +41250,6 @@ def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41453,7 +41266,7 @@ def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41511,7 +41324,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41527,7 +41339,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41606,7 +41417,6 @@ def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41623,7 +41433,7 @@ def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41681,7 +41491,6 @@ def delete_instance_process_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41748,9 +41557,9 @@ def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -41759,13 +41568,17 @@ def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41826,7 +41639,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41842,7 +41654,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41931,7 +41742,6 @@ def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41948,7 +41758,7 @@ def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42007,7 +41817,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42023,7 +41832,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42095,7 +41903,6 @@ def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42110,7 +41917,7 @@ def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42162,7 +41969,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42178,7 +41984,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42249,7 +42054,6 @@ def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42264,7 +42068,7 @@ def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42314,7 +42118,6 @@ def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42329,7 +42132,7 @@ def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42378,7 +42181,6 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42393,7 +42195,7 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42442,7 +42244,6 @@ def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42505,7 +42306,6 @@ def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42522,7 +42322,7 @@ def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42574,7 +42374,6 @@ def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42589,11 +42388,7 @@ def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42657,7 +42452,6 @@ def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42672,7 +42466,7 @@ def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42688,7 +42482,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42701,7 +42495,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -42715,10 +42509,10 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -42726,15 +42520,15 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42795,10 +42589,11 @@ def begin_start_web_site_network_trace_operation_slot( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -42861,7 +42656,6 @@ def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42924,7 +42718,6 @@ def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42939,7 +42732,7 @@ def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42991,7 +42784,6 @@ def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43006,11 +42798,7 @@ def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43062,7 +42850,6 @@ def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43077,7 +42864,7 @@ def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43126,7 +42913,6 @@ def generate_new_site_publishing_password_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43194,7 +42980,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43210,7 +42995,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43282,7 +43066,6 @@ def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43297,7 +43080,7 @@ def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43346,7 +43129,6 @@ def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43361,7 +43143,7 @@ def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43413,7 +43195,6 @@ def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43428,7 +43209,7 @@ def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43571,7 +43352,6 @@ def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43586,7 +43366,7 @@ def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43638,7 +43418,6 @@ def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43792,7 +43571,6 @@ def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43807,7 +43585,7 @@ def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43857,7 +43635,6 @@ def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43872,7 +43649,7 @@ def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44008,7 +43785,6 @@ def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44023,7 +43799,7 @@ def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44076,7 +43852,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44092,7 +43867,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44166,7 +43940,6 @@ def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44181,7 +43954,7 @@ def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44196,7 +43969,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44210,7 +43983,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -44233,10 +44006,10 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44244,15 +44017,15 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44387,10 +44160,13 @@ def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -44414,7 +44190,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44427,7 +44203,7 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -44439,10 +44215,10 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44450,18 +44226,15 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44508,10 +44281,11 @@ def begin_delete_private_endpoint_connection_slot( # pylint: disable=name-too-l params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -44572,7 +44346,6 @@ def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44587,7 +44360,7 @@ def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44641,7 +44414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44657,7 +44429,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44732,7 +44503,6 @@ def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44749,7 +44519,7 @@ def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44803,7 +44573,6 @@ def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44866,9 +44635,9 @@ def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -44877,13 +44646,17 @@ def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44940,7 +44713,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44956,7 +44728,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45034,7 +44805,6 @@ def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45051,7 +44821,7 @@ def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45106,7 +44876,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45122,7 +44891,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45197,7 +44965,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45213,7 +44980,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45288,7 +45054,6 @@ def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45303,7 +45068,7 @@ def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45448,7 +45213,6 @@ def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45463,7 +45227,7 @@ def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45515,7 +45279,6 @@ def delete_public_certificate_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45664,9 +45427,9 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -45675,11 +45438,15 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45730,7 +45497,6 @@ def reset_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45805,7 +45571,6 @@ def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45823,14 +45588,14 @@ def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45844,7 +45609,7 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -45866,10 +45631,10 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45877,12 +45642,20 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob_slot( @@ -45985,7 +45758,7 @@ def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -45997,6 +45770,7 @@ def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -46018,14 +45792,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46039,7 +45813,7 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -46061,10 +45835,10 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46072,12 +45846,20 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app_slot( @@ -46180,7 +45962,7 @@ def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -46192,6 +45974,7 @@ def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -46213,14 +45996,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46234,7 +46017,7 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -46256,10 +46039,10 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46267,12 +46050,20 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot_slot( @@ -46378,7 +46169,7 @@ def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_slot_initial( # type: ignore + raw_result = self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -46390,6 +46181,7 @@ def begin_restore_snapshot_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -46456,7 +46248,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46472,7 +46263,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46547,7 +46337,6 @@ def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46564,7 +46353,7 @@ def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46573,7 +46362,7 @@ def get_site_extension_slot( def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46586,7 +46375,7 @@ def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -46598,10 +46387,10 @@ def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46609,16 +46398,15 @@ def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46667,10 +46455,11 @@ def begin_install_site_extension_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -46737,7 +46526,6 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46883,7 +46671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46899,7 +46686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46929,14 +46715,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46950,7 +46736,7 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -46972,10 +46758,10 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46983,12 +46769,20 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot( @@ -47091,7 +46885,7 @@ def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_initial( # type: ignore + raw_result = self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -47103,6 +46897,7 @@ def begin_swap_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -47168,7 +46963,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47184,7 +46978,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47258,7 +47051,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47274,7 +47066,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47346,7 +47137,6 @@ def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47361,14 +47151,7 @@ def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47382,7 +47165,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47396,7 +47179,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -47418,10 +47201,10 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47429,18 +47212,15 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47565,10 +47345,11 @@ def begin_create_or_update_source_control_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -47635,7 +47416,6 @@ def delete_source_control_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47781,7 +47561,6 @@ def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47796,14 +47575,7 @@ def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47852,7 +47624,6 @@ def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47879,7 +47650,7 @@ def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47892,7 +47663,7 @@ def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -47906,10 +47677,10 @@ def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47917,15 +47688,15 @@ def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47986,10 +47757,11 @@ def begin_start_network_trace_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -48053,7 +47825,6 @@ def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48112,7 +47883,6 @@ def stop_network_trace_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48172,7 +47942,6 @@ def sync_repository_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48231,7 +48000,6 @@ def sync_function_triggers_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48294,7 +48062,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48310,7 +48077,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48385,7 +48151,6 @@ def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48402,7 +48167,7 @@ def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48454,7 +48219,6 @@ def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48520,7 +48284,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48536,7 +48299,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48614,7 +48376,6 @@ def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48631,7 +48392,7 @@ def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48683,7 +48444,6 @@ def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48752,7 +48512,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48768,7 +48527,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48840,7 +48598,6 @@ def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48855,7 +48612,7 @@ def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48907,7 +48664,6 @@ def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48922,7 +48678,7 @@ def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49073,7 +48829,6 @@ def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49088,7 +48843,7 @@ def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49140,7 +48895,6 @@ def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49302,7 +49056,6 @@ def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49317,7 +49070,7 @@ def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49373,7 +49126,6 @@ def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49390,7 +49142,7 @@ def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49546,7 +49298,6 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49561,7 +49312,7 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49717,7 +49468,6 @@ def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49732,7 +49482,7 @@ def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49784,7 +49534,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49800,7 +49549,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49875,7 +49623,6 @@ def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49890,7 +49637,7 @@ def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50012,7 +49759,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50028,7 +49774,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50058,13 +49803,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -50078,7 +49823,7 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -50099,10 +49844,10 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -50110,12 +49855,20 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot_with_production( @@ -50206,7 +49959,7 @@ def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_with_production_initial( # type: ignore + raw_result = self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -50217,6 +49970,7 @@ def begin_swap_slot_with_production( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -50277,7 +50031,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50293,7 +50046,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50364,7 +50116,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50380,7 +50131,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50446,7 +50196,6 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50461,14 +50210,7 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50481,7 +50223,7 @@ def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -50495,7 +50237,7 @@ def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -50516,10 +50258,10 @@ def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -50527,18 +50269,15 @@ def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50650,10 +50389,11 @@ def begin_create_or_update_source_control( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -50716,7 +50456,6 @@ def delete_source_control( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50849,7 +50588,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50864,14 +50602,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50916,7 +50647,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50942,7 +50672,7 @@ def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -50955,7 +50685,7 @@ def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -50968,10 +50698,10 @@ def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -50979,15 +50709,15 @@ def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51044,10 +50774,11 @@ def begin_start_network_trace( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -51107,7 +50838,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51163,7 +50893,6 @@ def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51219,7 +50948,6 @@ def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51275,7 +51003,6 @@ def sync_function_triggers( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51334,7 +51061,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51350,7 +51076,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51421,7 +51146,6 @@ def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51438,7 +51162,7 @@ def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51486,7 +51210,6 @@ def delete_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51548,7 +51271,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51564,7 +51286,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51638,7 +51359,6 @@ def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51655,7 +51375,7 @@ def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51703,7 +51423,6 @@ def run_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51768,7 +51487,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51784,7 +51502,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51850,7 +51567,6 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51865,7 +51581,7 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51913,7 +51629,6 @@ def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51928,7 +51643,7 @@ def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52066,7 +51781,6 @@ def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52081,7 +51795,7 @@ def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52129,7 +51843,6 @@ def delete_vnet_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52278,7 +51991,6 @@ def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52293,7 +52005,7 @@ def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52345,7 +52057,6 @@ def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52362,7 +52073,7 @@ def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52505,7 +52216,6 @@ def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52520,7 +52230,7 @@ def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52663,7 +52373,6 @@ def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52678,7 +52387,7 @@ def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52724,7 +52433,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52740,7 +52448,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52809,7 +52516,6 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52824,7 +52530,7 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_web_site_management_client_operations.py index a35865899c203..dab617f84d705 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2020_12_01/operations/_web_site_management_client_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -538,7 +537,6 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -553,7 +551,7 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -642,7 +640,6 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -657,7 +654,7 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -698,7 +695,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -714,7 +710,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -778,7 +773,6 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +787,7 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -901,7 +895,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -916,7 +909,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -966,7 +959,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -982,7 +974,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1060,7 +1051,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1075,7 +1065,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1115,7 +1105,6 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1130,7 +1119,7 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1196,7 +1185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1212,7 +1200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1332,7 +1319,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1348,7 +1334,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1413,7 +1398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1429,7 +1413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1491,7 +1474,6 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1506,7 +1488,7 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1605,7 +1587,6 @@ def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1620,7 +1601,7 @@ def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1733,7 +1714,6 @@ def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1853,7 +1833,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1868,7 +1847,7 @@ def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1981,7 +1960,6 @@ def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_metadata.json index 73283ece2e3dc..97bc88db3d6f7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_vendor.py index fd66631892ed1..abd2e5566a353 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from .._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class WebSiteManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_web_site_management_client.py index f776ccd43a4df..5e0aa1a4bc50b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -213,7 +214,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/_vendor.py index 39f69956b8888..6e80ec49ed289 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/_web_site_management_client.py index fddc517f6b136..0f2224c279909 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -216,7 +217,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_certificate_orders_operations.py index ab18b9ab7bc7c..7ac380fe00caa 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_certificate_orders_operations import ( build_create_or_update_certificate_request, build_create_or_update_request, @@ -119,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -254,7 +266,6 @@ async def validate_purchase_information( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +405,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +419,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +432,7 @@ async def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -438,7 +446,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -459,10 +467,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -470,15 +478,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -595,10 +603,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -658,7 +667,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +801,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -808,11 +815,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -862,7 +865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -878,7 +880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -949,7 +950,6 @@ async def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -964,7 +964,7 @@ async def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -978,7 +978,7 @@ async def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -992,7 +992,7 @@ async def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1014,10 +1014,10 @@ async def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1025,15 +1025,15 @@ async def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1157,10 +1157,11 @@ async def begin_create_or_update_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1223,7 +1224,6 @@ async def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1366,7 +1366,6 @@ async def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1381,11 +1380,7 @@ async def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1507,7 +1502,6 @@ async def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1640,7 +1634,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1696,7 +1689,6 @@ async def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1827,7 +1819,6 @@ async def resend_request_emails( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1958,7 +1949,6 @@ async def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1973,7 +1963,7 @@ async def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2018,7 +2008,6 @@ async def verify_domain_ownership( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2074,7 +2063,6 @@ async def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2089,7 +2077,7 @@ async def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2134,7 +2122,6 @@ async def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2149,7 +2136,7 @@ async def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_environments_operations.py index f492f5a8dc6fe..8b2a594ea272f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_environments_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_environments_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_change_vnet_request, @@ -143,7 +157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -159,7 +172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +241,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -245,7 +256,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -311,7 +321,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -326,7 +335,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -339,7 +348,7 @@ async def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -353,7 +362,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -374,10 +383,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -385,18 +394,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -513,10 +519,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -538,9 +545,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -553,7 +560,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -564,10 +571,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -575,12 +582,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -611,7 +626,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -621,6 +636,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -759,7 +775,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -774,14 +789,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -830,7 +838,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -846,7 +853,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -912,7 +918,6 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -927,7 +932,7 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -940,7 +945,7 @@ async def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -954,7 +959,7 @@ async def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -975,10 +980,10 @@ async def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -986,15 +991,15 @@ async def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1123,7 +1128,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1139,13 +1143,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1182,6 +1185,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -1247,7 +1251,6 @@ async def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1262,7 +1265,7 @@ async def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1384,7 +1387,6 @@ async def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1399,7 +1401,7 @@ async def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1444,7 +1446,6 @@ async def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1459,7 +1460,7 @@ async def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1507,7 +1508,6 @@ async def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1522,7 +1522,7 @@ async def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1572,7 +1572,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1588,7 +1587,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1660,7 +1658,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1676,7 +1673,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1744,7 +1740,6 @@ async def get_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1759,7 +1754,7 @@ async def get_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1772,7 +1767,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1786,7 +1781,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1807,10 +1802,10 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1818,15 +1813,15 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1940,10 +1935,11 @@ async def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2079,7 +2075,6 @@ async def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2094,11 +2089,7 @@ async def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2153,7 +2144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2169,7 +2159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2242,7 +2231,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2258,7 +2246,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2329,7 +2316,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2345,7 +2331,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2416,7 +2401,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2432,7 +2416,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2498,7 +2481,6 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2513,7 +2495,7 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2563,7 +2545,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2579,7 +2560,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2652,7 +2632,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2668,7 +2647,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2739,7 +2717,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2754,7 +2731,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2768,7 +2745,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2782,7 +2759,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2804,10 +2781,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2815,15 +2792,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2948,10 +2925,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2975,7 +2955,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2988,7 +2968,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -2999,10 +2979,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3010,18 +2990,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3065,10 +3042,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3126,7 +3104,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3141,7 +3118,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3186,7 +3163,6 @@ async def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3204,7 +3180,7 @@ async def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3217,7 +3193,7 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -3227,10 +3203,10 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3238,15 +3214,15 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3297,7 +3273,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3313,13 +3288,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3354,6 +3328,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3423,7 +3398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3439,7 +3413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3514,7 +3487,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3530,7 +3502,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3560,7 +3531,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3573,7 +3544,7 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -3583,10 +3554,10 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3594,15 +3565,15 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3653,7 +3624,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3669,13 +3639,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3710,6 +3679,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3785,7 +3755,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3801,7 +3770,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3873,7 +3841,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3889,7 +3856,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3960,7 +3926,6 @@ async def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3975,7 +3940,7 @@ async def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3989,7 +3954,7 @@ async def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4003,7 +3968,7 @@ async def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4025,10 +3990,10 @@ async def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4036,15 +4001,15 @@ async def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4167,10 +4132,11 @@ async def begin_create_or_update_worker_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4315,7 +4281,6 @@ async def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4330,11 +4295,7 @@ async def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4390,7 +4351,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4406,7 +4366,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4482,7 +4441,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4498,7 +4456,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4572,7 +4529,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4588,7 +4544,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4662,7 +4617,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4678,7 +4632,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_plans_operations.py index 1f66ed47c73ae..63953773b33d2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_app_service_plans_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_plans_operations import ( build_create_or_update_request, build_create_or_update_vnet_route_request, @@ -131,7 +145,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -147,7 +160,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -216,7 +228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -298,7 +308,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +324,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +337,7 @@ async def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -342,7 +351,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -363,10 +372,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -374,15 +383,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -492,10 +501,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -555,7 +565,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -687,7 +696,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -702,11 +710,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -749,7 +753,6 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -764,7 +767,7 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -815,7 +818,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -830,7 +832,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -881,7 +883,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -943,7 +944,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -958,7 +958,7 @@ async def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1012,7 +1012,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1028,7 +1027,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1096,7 +1094,6 @@ async def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1111,7 +1108,7 @@ async def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1160,7 +1157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1176,7 +1172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1250,7 +1245,6 @@ async def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1328,7 +1322,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1344,7 +1337,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1410,7 +1402,6 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1425,7 +1416,7 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1479,7 +1470,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1495,7 +1485,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1561,7 +1550,6 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1576,7 +1564,7 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1624,7 +1612,6 @@ async def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1641,7 +1628,7 @@ async def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1692,7 +1679,6 @@ async def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1693,7 @@ async def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1847,7 +1833,6 @@ async def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1862,7 +1847,7 @@ async def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1910,7 +1895,6 @@ async def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1925,7 +1909,7 @@ async def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1976,7 +1960,6 @@ async def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1993,7 +1976,7 @@ async def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2133,7 +2116,6 @@ async def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2150,7 +2132,7 @@ async def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2201,7 +2183,6 @@ async def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2352,7 +2333,6 @@ async def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2369,7 +2349,7 @@ async def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2417,7 +2397,6 @@ async def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_certificate_orders_diagnostics_operations.py index cf7cf498383e3..38e947d7dac54 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_orders_diagnostics_operations import ( build_get_app_service_certificate_order_detector_response_request, build_list_app_service_certificate_order_detector_response_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -211,7 +207,6 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +221,7 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_certificate_registration_provider_operations.py index 7d4f53b829446..3b9ba84b8448e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_certificate_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_certificates_operations.py index a06e3caf18412..5cee8ebec3939 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -105,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -187,7 +183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -203,7 +198,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -269,7 +263,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -284,7 +277,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -404,7 +397,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -419,7 +411,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +456,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +587,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +601,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_deleted_web_apps_operations.py index 3cd3083522847..0eda4a3af02c5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_deleted_web_apps_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_web_apps_operations import ( build_get_deleted_web_app_by_location_request, build_list_by_location_request, @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -179,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +257,6 @@ async def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +271,7 @@ async def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_diagnostics_operations.py index 6530900d72ec6..248f4e6701cb0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._diagnostics_operations import ( build_execute_site_analysis_request, build_execute_site_analysis_slot_request, @@ -126,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +225,6 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +239,7 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,7 +288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -309,7 +303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +389,6 @@ async def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +403,7 @@ async def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -476,7 +467,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -547,7 +537,6 @@ async def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -562,7 +551,7 @@ async def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -630,7 +618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -704,7 +691,6 @@ async def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,7 +705,7 @@ async def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +773,6 @@ async def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +787,7 @@ async def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -854,7 +839,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -870,7 +854,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -944,7 +927,6 @@ async def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -959,7 +941,7 @@ async def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1027,7 +1009,6 @@ async def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1042,7 +1023,7 @@ async def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1094,7 +1075,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1110,7 +1090,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1201,7 +1180,6 @@ async def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1216,7 +1194,7 @@ async def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1268,7 +1246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1284,7 +1261,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1358,7 +1334,6 @@ async def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1373,7 +1348,7 @@ async def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1428,7 +1403,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1444,7 +1418,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1527,7 +1500,6 @@ async def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1542,7 +1514,7 @@ async def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1614,7 +1586,6 @@ async def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1629,7 +1600,7 @@ async def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1684,7 +1655,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1700,7 +1670,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1783,7 +1752,6 @@ async def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1798,7 +1766,7 @@ async def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1870,7 +1838,6 @@ async def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1885,7 +1852,7 @@ async def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_domain_registration_provider_operations.py index 46556214ff27b..8bfa8b0e88633 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_domain_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_domains_operations.py index a82a26a466715..c2b0cfd00f495 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_check_availability_request, build_create_or_update_ownership_identifier_request, @@ -162,7 +162,6 @@ async def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -177,7 +176,7 @@ async def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -217,7 +216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -233,7 +231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +290,6 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -308,7 +304,7 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -408,7 +404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -424,7 +419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -490,7 +484,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -506,7 +499,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -572,7 +564,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -587,7 +578,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -596,7 +587,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -610,7 +601,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,10 +622,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -642,15 +633,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,10 +747,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -824,7 +816,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -955,7 +946,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -970,11 +960,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1024,7 +1010,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1040,7 +1025,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1111,7 +1095,6 @@ async def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1126,7 +1109,7 @@ async def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1265,7 +1248,6 @@ async def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1280,7 +1262,7 @@ async def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1328,7 +1310,6 @@ async def delete_ownership_identifier( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1478,7 +1459,6 @@ async def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1493,7 +1473,7 @@ async def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1538,7 +1518,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_global_operations_operations.py index 736ee43f5cb96..d3159ee0a907b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_global_operations_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._global_operations_operations import ( build_get_deleted_web_app_request, build_get_deleted_web_app_snapshots_request, @@ -94,7 +92,6 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +106,7 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -149,7 +146,6 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -164,7 +160,7 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -209,7 +205,6 @@ async def get_subscription_operation_with_async_response( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_kube_environments_operations.py index cac5eb481ead0..92044333f62d1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_kube_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_kube_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._kube_environments_operations import ( build_create_or_update_request, build_delete_request, @@ -104,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -189,7 +187,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -205,7 +202,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -271,7 +267,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +281,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -299,7 +294,7 @@ async def _create_or_update_initial( name: str, kube_environment_envelope: Union[_models.KubeEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.KubeEnvironment: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -313,7 +308,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KubeEnvironment] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -334,10 +329,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -345,15 +340,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -466,10 +461,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -491,9 +487,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -506,7 +500,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -516,10 +510,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -527,12 +521,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -557,7 +559,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -566,6 +568,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -704,7 +707,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,11 +721,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_provider_operations.py index 444415346f0ef..a967bb99be8ba 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._provider_operations import ( build_get_available_stacks_on_prem_request, build_get_available_stacks_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -192,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -208,7 +203,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -280,7 +274,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -296,7 +289,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -367,7 +359,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -383,7 +374,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -449,7 +439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -465,7 +454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -533,7 +521,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -549,7 +536,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +606,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -636,7 +621,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_recommendations_operations.py index 8244d3edbf4ad..b9c4dd9c576d1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_recommendations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommendations_operations import ( build_disable_all_for_hosting_environment_request, build_disable_all_for_web_app_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -198,7 +194,6 @@ async def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +246,6 @@ async def disable_recommendation_for_subscription( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -326,7 +320,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -342,7 +335,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -428,7 +420,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +435,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -515,7 +505,6 @@ async def disable_all_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +563,6 @@ async def reset_all_filters_for_hosting_environment( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +635,6 @@ async def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -662,7 +649,7 @@ async def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -713,7 +700,6 @@ async def disable_recommendation_for_hosting_environment( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -788,7 +774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -804,7 +789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -890,7 +874,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -906,7 +889,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +956,6 @@ async def disable_all_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1030,7 +1011,6 @@ async def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1103,7 +1083,6 @@ async def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1118,7 +1097,7 @@ async def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1145,6 @@ async def disable_recommendation_for_site( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_resource_health_metadata_operations.py index 5be6de0bc6faa..0f17d85a75afb 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_resource_health_metadata_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._resource_health_metadata_operations import ( build_get_by_site_request, build_get_by_site_slot_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -277,7 +271,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -293,7 +286,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -359,7 +351,6 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +365,7 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -428,7 +419,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +434,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -516,7 +505,6 @@ async def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -531,7 +519,7 @@ async def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_static_sites_operations.py index 95b63f8051022..7efae7c081cfc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._static_sites_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_create_or_update_static_site_app_settings_request, @@ -221,7 +221,6 @@ async def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -236,7 +235,7 @@ async def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -278,7 +277,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -294,7 +292,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -364,7 +361,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -380,7 +376,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -448,7 +443,6 @@ async def get_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -463,7 +457,7 @@ async def get_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -476,7 +470,7 @@ async def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -490,7 +484,7 @@ async def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -511,10 +505,10 @@ async def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -522,15 +516,15 @@ async def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -646,10 +640,11 @@ async def begin_create_or_update_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -671,9 +666,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -686,7 +681,7 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -696,10 +691,10 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -707,12 +702,20 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site( @@ -739,7 +742,7 @@ async def begin_delete_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_initial( # type: ignore + raw_result = await self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -748,6 +751,7 @@ async def begin_delete_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -885,7 +889,6 @@ async def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -900,11 +903,7 @@ async def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -957,7 +956,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -973,7 +971,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1047,7 +1044,6 @@ async def delete_static_site_user( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1201,7 +1197,6 @@ async def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1216,7 +1211,7 @@ async def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1266,7 +1261,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1282,7 +1276,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1353,7 +1346,6 @@ async def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1368,16 +1360,16 @@ async def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1390,7 +1382,7 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -1401,10 +1393,10 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1412,12 +1404,20 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_build( @@ -1446,7 +1446,7 @@ async def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_build_initial( # type: ignore + raw_result = await self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -1456,6 +1456,7 @@ async def begin_delete_static_site_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1602,7 +1603,6 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1617,7 +1617,7 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1749,7 +1749,6 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1764,7 +1763,7 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1817,7 +1816,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1833,7 +1831,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1904,7 +1901,6 @@ async def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1919,7 +1915,7 @@ async def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1967,7 +1963,6 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1982,7 +1977,7 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2035,7 +2030,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2051,7 +2045,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2126,7 +2119,6 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2141,7 +2133,9 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2159,7 +2153,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2173,7 +2167,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2199,10 +2193,10 @@ async def _register_user_provided_function_app_with_static_site_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2210,15 +2204,15 @@ async def _register_user_provided_function_app_with_static_site_build_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2377,10 +2371,13 @@ async def begin_register_user_provided_function_app_with_static_site_build( # p params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2447,7 +2444,6 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2465,14 +2461,14 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2486,7 +2482,7 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2508,10 +2504,10 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2519,12 +2515,20 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -2629,7 +2633,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -2641,6 +2645,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2777,7 +2782,6 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2792,7 +2796,7 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2914,7 +2918,6 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2929,7 +2932,7 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3053,7 +3056,6 @@ async def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3068,7 +3070,7 @@ async def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3118,7 +3120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3134,7 +3135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3205,7 +3205,6 @@ async def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3220,7 +3219,7 @@ async def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3236,7 +3235,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3250,7 +3249,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3275,10 +3274,10 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3286,15 +3285,15 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3425,10 +3424,13 @@ async def begin_create_or_update_static_site_custom_domain( # pylint: disable=n params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3450,9 +3452,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3465,7 +3467,7 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -3476,10 +3478,10 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3487,12 +3489,20 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_custom_domain( @@ -3521,7 +3531,7 @@ async def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = await self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -3531,6 +3541,7 @@ async def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3552,7 +3563,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -3561,7 +3572,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3575,7 +3586,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3600,10 +3611,10 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3611,12 +3622,20 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -3724,7 +3743,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -3736,6 +3755,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3757,9 +3777,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _detach_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3772,7 +3792,7 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -3782,10 +3802,10 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3793,12 +3813,20 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_detach_static_site( @@ -3825,7 +3853,7 @@ async def begin_detach_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._detach_static_site_initial( # type: ignore + raw_result = await self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -3834,6 +3862,7 @@ async def begin_detach_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3898,7 +3927,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3914,7 +3942,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3982,7 +4009,6 @@ async def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3997,7 +4023,7 @@ async def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4042,7 +4068,6 @@ async def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4057,7 +4082,7 @@ async def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4102,7 +4127,6 @@ async def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4117,7 +4141,7 @@ async def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4162,7 +4186,6 @@ async def list_static_site_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4177,7 +4200,7 @@ async def list_static_site_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4227,7 +4250,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4243,7 +4265,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4314,7 +4335,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4329,7 +4349,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4343,7 +4363,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4357,7 +4377,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4379,10 +4399,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4390,15 +4410,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4523,10 +4543,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4550,7 +4573,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4563,7 +4586,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -4574,10 +4597,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4585,18 +4608,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4640,10 +4660,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4701,7 +4722,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4716,7 +4736,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4838,7 +4858,6 @@ async def reset_static_site_api_key( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4899,7 +4918,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4915,7 +4933,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4986,7 +5003,6 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5001,7 +5017,9 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5018,7 +5036,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5032,7 +5050,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5057,10 +5075,10 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5068,15 +5086,15 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5222,10 +5240,13 @@ async def begin_register_user_provided_function_app_with_static_site( # pylint: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5288,7 +5309,6 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5306,13 +5326,13 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5326,7 +5346,7 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5347,10 +5367,10 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5358,12 +5378,20 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -5459,7 +5487,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -5470,6 +5498,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_top_level_domains_operations.py index e4f655dc65ff3..b2b9228bf5bda 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_level_domains_operations import ( build_get_request, build_list_agreements_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -178,7 +174,6 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_web_apps_operations.py index d4d1cdab43a3d..a160e91e4c9db 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_web_apps_operations.py @@ -32,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -45,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_apps_operations import ( build_add_premier_add_on_request, build_add_premier_add_on_slot_request, @@ -500,7 +500,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -516,7 +515,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -589,7 +587,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -605,7 +602,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -671,7 +667,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -688,7 +683,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -697,7 +692,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio async def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -711,7 +706,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -732,10 +727,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -743,15 +738,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -863,10 +858,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -938,7 +934,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1078,7 +1073,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1093,11 +1087,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1145,7 +1135,6 @@ async def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1160,7 +1149,7 @@ async def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1280,7 +1269,6 @@ async def apply_slot_config_to_production( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1409,7 +1397,6 @@ async def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1424,7 +1411,7 @@ async def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1470,7 +1457,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1486,7 +1472,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1557,7 +1542,6 @@ async def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1572,7 +1556,7 @@ async def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1620,7 +1604,6 @@ async def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1773,7 +1756,6 @@ async def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1788,21 +1770,21 @@ async def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_initial( # pylint: disable=inconsistent-return-statements + async def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1816,7 +1798,7 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1838,10 +1820,10 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1849,12 +1831,20 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore( @@ -1954,7 +1944,7 @@ async def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_initial( # type: ignore + raw_result = await self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -1966,6 +1956,7 @@ async def begin_restore( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2025,7 +2016,6 @@ async def get_basic_publishing_credentials_policies( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2040,7 +2030,7 @@ async def get_basic_publishing_credentials_policies( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2085,7 +2075,6 @@ async def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2100,7 +2089,7 @@ async def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2224,7 +2213,6 @@ async def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2239,7 +2227,7 @@ async def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2284,7 +2272,6 @@ async def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2299,7 +2286,7 @@ async def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2423,7 +2410,6 @@ async def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2438,7 +2424,7 @@ async def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2487,7 +2473,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2503,7 +2488,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2646,7 +2630,6 @@ async def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2661,7 +2644,7 @@ async def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2706,7 +2689,6 @@ async def list_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2721,7 +2703,7 @@ async def list_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2841,7 +2823,6 @@ async def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2856,7 +2837,7 @@ async def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2899,7 +2880,6 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2914,7 +2894,7 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3034,7 +3014,6 @@ async def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3049,7 +3028,7 @@ async def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3094,7 +3073,6 @@ async def get_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3109,7 +3087,7 @@ async def get_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3231,7 +3209,6 @@ async def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3246,7 +3223,7 @@ async def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3291,7 +3268,6 @@ async def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3306,7 +3282,7 @@ async def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3422,7 +3398,6 @@ async def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3437,7 +3412,7 @@ async def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3482,7 +3457,6 @@ async def delete_backup_configuration( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3538,7 +3512,6 @@ async def get_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3553,7 +3526,7 @@ async def get_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3602,7 +3575,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3618,7 +3590,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3689,7 +3660,6 @@ async def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3704,7 +3674,7 @@ async def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3753,7 +3723,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3769,7 +3738,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3840,7 +3808,6 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3855,7 +3822,7 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3978,7 +3945,6 @@ async def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3993,7 +3959,7 @@ async def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4038,7 +4004,6 @@ async def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4053,7 +4018,7 @@ async def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4098,7 +4063,6 @@ async def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4113,7 +4077,7 @@ async def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4236,7 +4200,6 @@ async def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4251,7 +4214,7 @@ async def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4367,7 +4330,6 @@ async def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4382,7 +4344,7 @@ async def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4425,7 +4387,6 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4440,7 +4401,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4449,7 +4410,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any async def _list_publishing_credentials_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4462,7 +4423,7 @@ async def _list_publishing_credentials_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -4472,10 +4433,10 @@ async def _list_publishing_credentials_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4483,11 +4444,15 @@ async def _list_publishing_credentials_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4528,10 +4493,11 @@ async def begin_list_publishing_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4662,7 +4628,6 @@ async def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4677,7 +4642,7 @@ async def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4720,7 +4685,6 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4735,7 +4699,7 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4780,7 +4744,6 @@ async def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4795,7 +4758,7 @@ async def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4924,7 +4887,6 @@ async def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4939,7 +4901,7 @@ async def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4984,7 +4946,6 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4999,7 +4960,7 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5119,7 +5080,6 @@ async def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5134,7 +5094,7 @@ async def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5254,7 +5214,6 @@ async def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5269,7 +5228,7 @@ async def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5321,7 +5280,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5337,7 +5295,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5408,7 +5365,6 @@ async def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5423,7 +5379,7 @@ async def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5471,7 +5427,6 @@ async def recover_site_configuration_snapshot( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5527,9 +5482,9 @@ async def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5538,12 +5493,16 @@ async def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5588,9 +5547,9 @@ async def get_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5599,12 +5558,16 @@ async def get_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5653,7 +5616,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5669,7 +5631,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5740,7 +5701,6 @@ async def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5757,7 +5717,7 @@ async def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5805,7 +5765,6 @@ async def delete_continuous_web_job( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5864,7 +5823,6 @@ async def start_continuous_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5923,7 +5881,6 @@ async def stop_continuous_web_job( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5982,7 +5939,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5998,7 +5954,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6067,7 +6022,6 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6082,7 +6036,7 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6212,7 +6166,6 @@ async def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6227,7 +6180,7 @@ async def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6275,7 +6228,6 @@ async def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6335,7 +6287,6 @@ async def list_deployment_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6350,7 +6301,7 @@ async def list_deployment_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6474,7 +6425,6 @@ async def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6489,7 +6439,7 @@ async def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6537,7 +6487,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6553,7 +6502,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6624,7 +6572,6 @@ async def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6639,7 +6586,7 @@ async def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6771,7 +6718,6 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6786,7 +6732,7 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6834,7 +6780,6 @@ async def delete_domain_ownership_identifier( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6977,7 +6922,6 @@ async def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6992,7 +6936,7 @@ async def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7035,7 +6979,6 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7050,7 +6993,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7059,7 +7002,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar async def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7073,7 +7016,7 @@ async def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7094,10 +7037,10 @@ async def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7105,13 +7048,15 @@ async def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7217,10 +7162,11 @@ async def begin_create_ms_deploy_operation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7280,7 +7226,6 @@ async def get_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7297,7 +7242,7 @@ async def get_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7346,7 +7291,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7362,7 +7306,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7428,7 +7371,6 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7443,7 +7385,7 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7491,7 +7433,6 @@ async def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7508,7 +7449,7 @@ async def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7522,7 +7463,7 @@ async def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7536,7 +7477,7 @@ async def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7558,10 +7499,10 @@ async def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7569,11 +7510,15 @@ async def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7693,10 +7638,11 @@ async def begin_create_function( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7759,7 +7705,6 @@ async def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7910,7 +7855,6 @@ async def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7925,11 +7869,7 @@ async def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7980,7 +7920,6 @@ async def delete_function_secret( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8039,7 +7978,6 @@ async def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8054,7 +7992,7 @@ async def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8102,7 +8040,6 @@ async def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8117,7 +8054,7 @@ async def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8160,7 +8097,6 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8175,7 +8111,7 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8220,7 +8156,6 @@ async def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8276,7 +8211,6 @@ async def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8427,7 +8361,6 @@ async def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8442,11 +8375,7 @@ async def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8497,7 +8426,6 @@ async def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8557,7 +8485,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8573,7 +8500,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8644,7 +8570,6 @@ async def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8659,7 +8584,7 @@ async def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8791,7 +8716,6 @@ async def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8806,7 +8730,7 @@ async def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8854,7 +8778,6 @@ async def delete_host_name_binding( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8916,7 +8839,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8931,7 +8853,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9071,7 +8993,6 @@ async def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9086,7 +9007,7 @@ async def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9137,7 +9058,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9288,7 +9208,6 @@ async def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9303,7 +9222,7 @@ async def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9348,7 +9267,6 @@ async def list_hybrid_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9363,7 +9281,7 @@ async def list_hybrid_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9408,7 +9326,6 @@ async def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9423,7 +9340,7 @@ async def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9471,7 +9388,6 @@ async def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9486,7 +9402,7 @@ async def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9617,7 +9533,6 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9632,7 +9547,7 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9680,7 +9595,6 @@ async def delete_relay_service_connection( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9822,7 +9736,6 @@ async def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9837,7 +9750,7 @@ async def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9887,7 +9800,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9903,7 +9815,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9974,7 +9885,6 @@ async def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9989,7 +9899,7 @@ async def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10037,7 +9947,6 @@ async def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10052,7 +9961,7 @@ async def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10066,7 +9975,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10080,7 +9989,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10102,10 +10011,10 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10113,13 +10022,15 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10239,10 +10150,11 @@ async def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10305,7 +10217,6 @@ async def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10322,7 +10233,7 @@ async def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10376,7 +10287,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10392,7 +10302,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10467,7 +10376,6 @@ async def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10484,7 +10392,7 @@ async def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10538,7 +10446,6 @@ async def delete_instance_process( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10601,9 +10508,9 @@ async def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10612,13 +10519,17 @@ async def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10676,7 +10587,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10692,7 +10602,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10770,7 +10679,6 @@ async def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10787,7 +10695,7 @@ async def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10843,7 +10751,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10859,7 +10766,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10925,7 +10831,6 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10940,7 +10845,7 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10988,7 +10893,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11004,7 +10908,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11072,7 +10975,6 @@ async def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11087,7 +10989,7 @@ async def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11101,7 +11003,7 @@ async def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11115,7 +11017,7 @@ async def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11137,10 +11039,10 @@ async def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11148,11 +11050,15 @@ async def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11276,10 +11182,11 @@ async def begin_migrate_storage( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11307,7 +11214,7 @@ async def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11321,7 +11228,7 @@ async def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11342,10 +11249,10 @@ async def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11353,11 +11260,15 @@ async def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11468,10 +11379,11 @@ async def begin_migrate_my_sql( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11533,7 +11445,6 @@ async def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11548,7 +11459,7 @@ async def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11593,7 +11504,6 @@ async def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11608,7 +11518,7 @@ async def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11748,7 +11658,6 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11763,7 +11672,7 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11808,7 +11717,6 @@ async def delete_swift_virtual_network( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11867,7 +11775,6 @@ async def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11884,7 +11791,7 @@ async def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11932,7 +11839,6 @@ async def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11947,11 +11853,7 @@ async def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12011,7 +11913,6 @@ async def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12026,7 +11927,7 @@ async def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12041,7 +11942,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12054,7 +11955,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -12067,10 +11968,10 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -12078,15 +11979,15 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12144,10 +12045,11 @@ async def begin_start_web_site_network_trace_operation( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12207,7 +12109,6 @@ async def stop_web_site_network_trace( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12266,7 +12167,6 @@ async def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12281,7 +12181,7 @@ async def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12329,7 +12229,6 @@ async def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12344,11 +12243,7 @@ async def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12396,7 +12291,6 @@ async def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12411,7 +12305,7 @@ async def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12456,7 +12350,6 @@ async def generate_new_site_publishing_password( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12521,7 +12414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -12537,7 +12429,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -12605,7 +12496,6 @@ async def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12620,7 +12510,7 @@ async def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12663,7 +12553,6 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12678,7 +12567,7 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12726,7 +12615,6 @@ async def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12741,7 +12629,7 @@ async def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12871,7 +12759,6 @@ async def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12886,7 +12773,7 @@ async def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12934,7 +12821,6 @@ async def delete_premier_add_on( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13075,7 +12961,6 @@ async def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13090,7 +12975,7 @@ async def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13135,7 +13020,6 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13150,7 +13034,7 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13272,7 +13156,6 @@ async def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13287,7 +13170,7 @@ async def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13337,7 +13220,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13353,7 +13235,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13424,7 +13305,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13439,7 +13319,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13453,7 +13333,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13467,7 +13347,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -13489,10 +13369,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13500,15 +13380,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13633,10 +13513,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -13660,7 +13543,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13673,7 +13556,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -13684,10 +13567,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13695,18 +13578,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13750,10 +13630,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -13811,7 +13692,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13826,7 +13706,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13876,7 +13756,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13892,7 +13771,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13963,7 +13841,6 @@ async def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13980,7 +13857,7 @@ async def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14030,7 +13907,6 @@ async def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14089,9 +13965,9 @@ async def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14100,13 +13976,17 @@ async def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14160,7 +14040,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14176,7 +14055,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14250,7 +14128,6 @@ async def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14267,7 +14144,7 @@ async def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14319,7 +14196,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14335,7 +14211,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14407,7 +14282,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14423,7 +14297,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14494,7 +14367,6 @@ async def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14509,7 +14381,7 @@ async def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14641,7 +14513,6 @@ async def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14656,7 +14527,7 @@ async def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14704,7 +14575,6 @@ async def delete_public_certificate( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14840,9 +14710,9 @@ async def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14851,11 +14721,15 @@ async def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14902,7 +14776,6 @@ async def reset_production_slot_config( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14972,7 +14845,6 @@ async def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14990,9 +14862,9 @@ async def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15006,7 +14878,7 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15027,10 +14899,10 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15038,12 +14910,20 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob( @@ -15130,7 +15010,7 @@ async def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -15141,6 +15021,7 @@ async def begin_restore_from_backup_blob( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15162,13 +15043,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15182,7 +15063,7 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15203,10 +15084,10 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15214,12 +15095,20 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app( @@ -15310,7 +15199,7 @@ async def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -15321,6 +15210,7 @@ async def begin_restore_from_deleted_app( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15342,13 +15232,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15362,7 +15252,7 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15383,10 +15273,10 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15394,12 +15284,20 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot( @@ -15493,7 +15391,7 @@ async def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_initial( # type: ignore + raw_result = await self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -15504,6 +15402,7 @@ async def begin_restore_snapshot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15567,7 +15466,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15583,7 +15481,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15654,7 +15551,6 @@ async def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15671,7 +15567,7 @@ async def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15680,7 +15576,7 @@ async def get_site_extension( async def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15693,7 +15589,7 @@ async def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -15704,10 +15600,10 @@ async def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15715,16 +15611,15 @@ async def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15770,10 +15665,11 @@ async def begin_install_site_extension( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15836,7 +15732,6 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15893,7 +15788,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15909,7 +15803,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15979,7 +15872,6 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15996,7 +15888,7 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16010,7 +15902,7 @@ async def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16024,7 +15916,7 @@ async def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16046,10 +15938,10 @@ async def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16057,15 +15949,15 @@ async def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16194,10 +16086,11 @@ async def begin_create_or_update_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16274,7 +16167,6 @@ async def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16427,7 +16319,6 @@ async def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16442,11 +16333,7 @@ async def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16498,7 +16385,6 @@ async def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16513,7 +16399,7 @@ async def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16646,7 +16532,6 @@ async def apply_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16792,7 +16677,6 @@ async def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16807,7 +16691,7 @@ async def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16859,7 +16743,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16875,7 +16758,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16950,7 +16832,6 @@ async def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16965,7 +16846,7 @@ async def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17017,7 +16898,6 @@ async def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17183,7 +17063,6 @@ async def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17198,14 +17077,14 @@ async def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -17213,7 +17092,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17227,7 +17106,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17250,10 +17129,10 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17261,12 +17140,20 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_slot( @@ -17378,7 +17265,7 @@ async def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_slot_initial( # type: ignore + raw_result = await self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -17391,6 +17278,7 @@ async def begin_restore_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -17453,7 +17341,6 @@ async def get_basic_publishing_credentials_policies_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17468,7 +17355,7 @@ async def get_basic_publishing_credentials_policies_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17516,7 +17403,6 @@ async def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17531,7 +17417,7 @@ async def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17665,7 +17551,6 @@ async def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17680,7 +17565,7 @@ async def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17728,7 +17613,6 @@ async def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17743,7 +17627,7 @@ async def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17877,7 +17761,6 @@ async def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17892,7 +17775,7 @@ async def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17945,7 +17828,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17961,7 +17843,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18117,7 +17998,6 @@ async def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18132,7 +18012,7 @@ async def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18181,7 +18061,6 @@ async def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18196,7 +18075,7 @@ async def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18329,7 +18208,6 @@ async def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18344,7 +18222,7 @@ async def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18393,7 +18271,6 @@ async def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18408,7 +18285,7 @@ async def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18541,7 +18418,6 @@ async def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18556,7 +18432,7 @@ async def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18605,7 +18481,6 @@ async def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18620,7 +18495,7 @@ async def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18755,7 +18630,6 @@ async def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18770,7 +18644,7 @@ async def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18819,7 +18693,6 @@ async def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18834,7 +18707,7 @@ async def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18967,7 +18840,6 @@ async def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18982,7 +18854,7 @@ async def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19031,7 +18903,6 @@ async def delete_backup_configuration_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19091,7 +18962,6 @@ async def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19106,7 +18976,7 @@ async def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19158,7 +19028,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19174,7 +19043,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19248,7 +19116,6 @@ async def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19263,7 +19130,7 @@ async def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19315,7 +19182,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19331,7 +19197,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19405,7 +19270,6 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19420,7 +19284,7 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19556,7 +19420,6 @@ async def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19571,7 +19434,7 @@ async def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19620,7 +19483,6 @@ async def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19635,7 +19497,7 @@ async def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19684,7 +19546,6 @@ async def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19699,7 +19560,7 @@ async def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19835,7 +19696,6 @@ async def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19850,7 +19710,7 @@ async def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19983,7 +19843,6 @@ async def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19998,7 +19857,7 @@ async def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20047,7 +19906,6 @@ async def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20062,7 +19920,7 @@ async def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20071,7 +19929,7 @@ async def list_metadata_slot( async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20084,7 +19942,7 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -20095,10 +19953,10 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20106,11 +19964,15 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20155,10 +20017,11 @@ async def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20306,7 +20169,6 @@ async def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20321,7 +20183,7 @@ async def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20370,7 +20232,6 @@ async def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20385,7 +20246,7 @@ async def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20436,7 +20297,6 @@ async def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20451,7 +20311,7 @@ async def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20584,7 +20444,6 @@ async def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20599,7 +20458,7 @@ async def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20732,7 +20591,6 @@ async def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20747,7 +20605,7 @@ async def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20803,7 +20661,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20819,7 +20676,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20894,7 +20750,6 @@ async def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20909,7 +20764,7 @@ async def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20961,7 +20816,6 @@ async def recover_site_configuration_snapshot_slot( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21021,9 +20875,9 @@ async def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21032,12 +20886,16 @@ async def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21086,9 +20944,9 @@ async def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21097,12 +20955,16 @@ async def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21155,7 +21017,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21171,7 +21032,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21246,7 +21106,6 @@ async def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21263,7 +21122,7 @@ async def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21315,7 +21174,6 @@ async def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21378,7 +21236,6 @@ async def start_continuous_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21441,7 +21298,6 @@ async def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21504,7 +21360,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21520,7 +21375,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21595,7 +21449,6 @@ async def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21610,7 +21463,7 @@ async def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21753,7 +21606,6 @@ async def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21768,7 +21620,7 @@ async def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21820,7 +21672,6 @@ async def delete_deployment_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21884,7 +21735,6 @@ async def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21899,7 +21749,7 @@ async def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22040,7 +21890,6 @@ async def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22055,7 +21904,7 @@ async def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22107,7 +21956,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22123,7 +21971,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22198,7 +22045,6 @@ async def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22213,7 +22059,7 @@ async def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22358,7 +22204,6 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22373,7 +22218,7 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22425,7 +22270,6 @@ async def delete_domain_ownership_identifier_slot( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22581,7 +22425,6 @@ async def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22596,7 +22439,7 @@ async def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22645,7 +22488,6 @@ async def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22660,7 +22502,7 @@ async def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22674,7 +22516,7 @@ async def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22688,7 +22530,7 @@ async def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -22710,10 +22552,10 @@ async def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22721,13 +22563,15 @@ async def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22850,10 +22694,11 @@ async def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22917,7 +22762,6 @@ async def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22934,7 +22778,7 @@ async def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22986,7 +22830,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23002,7 +22845,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23074,7 +22916,6 @@ async def get_functions_admin_token_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23089,7 +22930,7 @@ async def get_functions_admin_token_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23140,7 +22981,6 @@ async def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23157,7 +22997,7 @@ async def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23172,7 +23012,7 @@ async def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23186,7 +23026,7 @@ async def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23209,10 +23049,10 @@ async def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23220,11 +23060,15 @@ async def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23354,10 +23198,11 @@ async def begin_create_instance_function_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23423,7 +23268,6 @@ async def delete_instance_function_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23584,7 +23428,6 @@ async def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23599,11 +23442,7 @@ async def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23657,7 +23496,6 @@ async def delete_function_secret_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23719,7 +23557,6 @@ async def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23734,7 +23571,7 @@ async def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23785,7 +23622,6 @@ async def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23800,7 +23636,7 @@ async def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23848,7 +23684,6 @@ async def list_host_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23863,7 +23698,7 @@ async def list_host_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23911,7 +23746,6 @@ async def list_sync_status_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23970,7 +23804,6 @@ async def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24131,7 +23964,6 @@ async def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24146,11 +23978,7 @@ async def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24204,7 +24032,6 @@ async def delete_host_secret_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24268,7 +24095,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24284,7 +24110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24359,7 +24184,6 @@ async def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24374,7 +24198,7 @@ async def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24519,7 +24343,6 @@ async def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24534,7 +24357,7 @@ async def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24586,7 +24409,6 @@ async def delete_host_name_binding_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24651,7 +24473,6 @@ async def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24666,7 +24487,7 @@ async def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24816,7 +24637,6 @@ async def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24831,7 +24651,7 @@ async def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24885,7 +24705,6 @@ async def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25046,7 +24865,6 @@ async def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25061,7 +24879,7 @@ async def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25109,7 +24927,6 @@ async def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25124,7 +24941,7 @@ async def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25173,7 +24990,6 @@ async def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25188,7 +25004,7 @@ async def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25240,7 +25056,6 @@ async def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25255,7 +25070,7 @@ async def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25399,7 +25214,6 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25414,7 +25228,7 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25466,7 +25280,6 @@ async def delete_relay_service_connection_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25621,7 +25434,6 @@ async def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25636,7 +25448,7 @@ async def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25690,7 +25502,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25706,7 +25517,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25781,7 +25591,6 @@ async def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25796,7 +25605,7 @@ async def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25848,7 +25657,6 @@ async def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25863,7 +25671,7 @@ async def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25878,7 +25686,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25892,7 +25700,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25915,10 +25723,10 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25926,13 +25734,15 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26065,10 +25875,11 @@ async def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=nam params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26135,7 +25946,6 @@ async def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26152,7 +25962,7 @@ async def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26210,7 +26020,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26226,7 +26035,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26305,7 +26113,6 @@ async def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26322,7 +26129,7 @@ async def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26380,7 +26187,6 @@ async def delete_instance_process_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26447,9 +26253,9 @@ async def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26458,13 +26264,17 @@ async def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26526,7 +26336,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26542,7 +26351,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26631,7 +26439,6 @@ async def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26648,7 +26455,7 @@ async def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26708,7 +26515,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26724,7 +26530,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26796,7 +26601,6 @@ async def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26811,7 +26615,7 @@ async def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26863,7 +26667,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26879,7 +26682,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26950,7 +26752,6 @@ async def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26965,7 +26766,7 @@ async def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27015,7 +26816,6 @@ async def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27030,7 +26830,7 @@ async def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27079,7 +26879,6 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27094,7 +26893,7 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27143,7 +26942,6 @@ async def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27206,7 +27004,6 @@ async def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27223,7 +27020,7 @@ async def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27275,7 +27072,6 @@ async def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27290,11 +27086,7 @@ async def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27358,7 +27150,6 @@ async def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27373,7 +27164,7 @@ async def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27389,7 +27180,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27402,7 +27193,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -27416,10 +27207,10 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27427,15 +27218,15 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27497,10 +27288,11 @@ async def begin_start_web_site_network_trace_operation_slot( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27563,7 +27355,6 @@ async def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27626,7 +27417,6 @@ async def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27641,7 +27431,7 @@ async def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27693,7 +27483,6 @@ async def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27708,11 +27497,7 @@ async def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27764,7 +27549,6 @@ async def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27779,7 +27563,7 @@ async def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27828,7 +27612,6 @@ async def generate_new_site_publishing_password_slot( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27897,7 +27680,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27913,7 +27695,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27985,7 +27766,6 @@ async def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28000,7 +27780,7 @@ async def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28049,7 +27829,6 @@ async def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28064,7 +27843,7 @@ async def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28116,7 +27895,6 @@ async def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28131,7 +27909,7 @@ async def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28274,7 +28052,6 @@ async def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28289,7 +28066,7 @@ async def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28341,7 +28118,6 @@ async def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28495,7 +28271,6 @@ async def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28510,7 +28285,7 @@ async def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28560,7 +28335,6 @@ async def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28575,7 +28349,7 @@ async def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28711,7 +28485,6 @@ async def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28726,7 +28499,7 @@ async def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28779,7 +28552,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28795,7 +28567,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28869,7 +28640,6 @@ async def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28884,7 +28654,7 @@ async def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28899,7 +28669,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28913,7 +28683,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28936,10 +28706,10 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28947,15 +28717,15 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29090,10 +28860,13 @@ async def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29117,7 +28890,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29130,7 +28903,7 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -29142,10 +28915,10 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29153,18 +28926,15 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29211,10 +28981,11 @@ async def begin_delete_private_endpoint_connection_slot( # pylint: disable=name params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29275,7 +29046,6 @@ async def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29290,7 +29060,7 @@ async def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29344,7 +29114,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29360,7 +29129,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29435,7 +29203,6 @@ async def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29452,7 +29219,7 @@ async def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29506,7 +29273,6 @@ async def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29569,9 +29335,9 @@ async def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29580,13 +29346,17 @@ async def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29644,7 +29414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29660,7 +29429,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29738,7 +29506,6 @@ async def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29755,7 +29522,7 @@ async def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29811,7 +29578,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29827,7 +29593,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29903,7 +29668,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29919,7 +29683,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29994,7 +29757,6 @@ async def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30009,7 +29771,7 @@ async def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30154,7 +29916,6 @@ async def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30169,7 +29930,7 @@ async def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30221,7 +29982,6 @@ async def delete_public_certificate_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30370,9 +30130,9 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30381,11 +30141,15 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30436,7 +30200,6 @@ async def reset_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30511,7 +30274,6 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30529,14 +30291,14 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30550,7 +30312,7 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30572,10 +30334,10 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30583,12 +30345,20 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob_slot( @@ -30691,7 +30461,7 @@ async def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -30703,6 +30473,7 @@ async def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30724,14 +30495,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30745,7 +30516,7 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30767,10 +30538,10 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30778,12 +30549,20 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app_slot( @@ -30886,7 +30665,7 @@ async def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -30898,6 +30677,7 @@ async def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30919,14 +30699,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30940,7 +30720,7 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30962,10 +30742,10 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30973,12 +30753,20 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot_slot( @@ -31084,7 +30872,7 @@ async def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_slot_initial( # type: ignore + raw_result = await self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -31096,6 +30884,7 @@ async def begin_restore_snapshot_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31163,7 +30952,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31179,7 +30967,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31254,7 +31041,6 @@ async def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31271,7 +31057,7 @@ async def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31280,7 +31066,7 @@ async def get_site_extension_slot( async def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31293,7 +31079,7 @@ async def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -31305,10 +31091,10 @@ async def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31316,16 +31102,15 @@ async def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31375,10 +31160,11 @@ async def begin_install_site_extension_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31445,7 +31231,6 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31594,7 +31379,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31610,7 +31394,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31640,14 +31423,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31661,7 +31444,7 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31683,10 +31466,10 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31694,12 +31477,20 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot( @@ -31802,7 +31593,7 @@ async def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_initial( # type: ignore + raw_result = await self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -31814,6 +31605,7 @@ async def begin_swap_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31879,7 +31671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31895,7 +31686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31969,7 +31759,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31985,7 +31774,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32057,7 +31845,6 @@ async def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32072,14 +31859,7 @@ async def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32093,7 +31873,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32107,7 +31887,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32129,10 +31909,10 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32140,18 +31920,15 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32279,10 +32056,11 @@ async def begin_create_or_update_source_control_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32349,7 +32127,6 @@ async def delete_source_control_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32495,7 +32272,6 @@ async def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32510,14 +32286,7 @@ async def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32566,7 +32335,6 @@ async def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32593,7 +32361,7 @@ async def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32606,7 +32374,7 @@ async def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -32620,10 +32388,10 @@ async def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32631,15 +32399,15 @@ async def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32701,10 +32469,11 @@ async def begin_start_network_trace_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32768,7 +32537,6 @@ async def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32827,7 +32595,6 @@ async def stop_network_trace_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32887,7 +32654,6 @@ async def sync_repository_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32946,7 +32712,6 @@ async def sync_function_triggers_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33010,7 +32775,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33026,7 +32790,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33101,7 +32864,6 @@ async def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33118,7 +32880,7 @@ async def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33170,7 +32932,6 @@ async def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33237,7 +32998,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33253,7 +33013,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33331,7 +33090,6 @@ async def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33348,7 +33106,7 @@ async def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33400,7 +33158,6 @@ async def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33470,7 +33227,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33486,7 +33242,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33558,7 +33313,6 @@ async def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33573,7 +33327,7 @@ async def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33625,7 +33379,6 @@ async def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33640,7 +33393,7 @@ async def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33791,7 +33544,6 @@ async def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33806,7 +33558,7 @@ async def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33858,7 +33610,6 @@ async def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34020,7 +33771,6 @@ async def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34035,7 +33785,7 @@ async def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34091,7 +33841,6 @@ async def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34108,7 +33857,7 @@ async def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34264,7 +34013,6 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34279,7 +34027,7 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34435,7 +34183,6 @@ async def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34450,7 +34197,7 @@ async def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34502,7 +34249,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34518,7 +34264,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34593,7 +34338,6 @@ async def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34608,7 +34352,7 @@ async def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34733,7 +34477,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34749,7 +34492,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34779,13 +34521,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34799,7 +34541,7 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -34820,10 +34562,10 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34831,12 +34573,20 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot_with_production( @@ -34927,7 +34677,7 @@ async def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_with_production_initial( # type: ignore + raw_result = await self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -34938,6 +34688,7 @@ async def begin_swap_slot_with_production( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -34998,7 +34749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35014,7 +34764,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35085,7 +34834,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35101,7 +34849,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35167,7 +34914,6 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35182,14 +34928,7 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35202,7 +34941,7 @@ async def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35216,7 +34955,7 @@ async def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -35237,10 +34976,10 @@ async def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35248,18 +34987,15 @@ async def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35374,10 +35110,11 @@ async def begin_create_or_update_source_control( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -35440,7 +35177,6 @@ async def delete_source_control( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35573,7 +35309,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35588,14 +35323,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35640,7 +35368,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35666,7 +35393,7 @@ async def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35679,7 +35406,7 @@ async def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -35692,10 +35419,10 @@ async def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35703,15 +35430,15 @@ async def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35769,10 +35496,11 @@ async def begin_start_network_trace( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -35832,7 +35560,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35888,7 +35615,6 @@ async def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35944,7 +35670,6 @@ async def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36000,7 +35725,6 @@ async def sync_function_triggers( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36060,7 +35784,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36076,7 +35799,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36147,7 +35869,6 @@ async def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36164,7 +35885,7 @@ async def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36212,7 +35933,6 @@ async def delete_triggered_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36275,7 +35995,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36291,7 +36010,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36365,7 +36083,6 @@ async def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36382,7 +36099,7 @@ async def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36430,7 +36147,6 @@ async def run_triggered_web_job( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36496,7 +36212,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36512,7 +36227,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36578,7 +36292,6 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36593,7 +36306,7 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36641,7 +36354,6 @@ async def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36656,7 +36368,7 @@ async def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36794,7 +36506,6 @@ async def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36809,7 +36520,7 @@ async def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36857,7 +36568,6 @@ async def delete_vnet_connection( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37006,7 +36716,6 @@ async def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37021,7 +36730,7 @@ async def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37073,7 +36782,6 @@ async def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37090,7 +36798,7 @@ async def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37233,7 +36941,6 @@ async def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37248,7 +36955,7 @@ async def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37391,7 +37098,6 @@ async def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37406,7 +37112,7 @@ async def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37452,7 +37158,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37468,7 +37173,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37539,7 +37243,6 @@ async def get_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37554,7 +37257,7 @@ async def get_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_web_site_management_client_operations.py index a8fda1bc04109..f19884de0c8e7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/aio/operations/_web_site_management_client_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_site_management_client_operations import ( build_check_name_availability_request, build_get_publishing_user_request, @@ -96,7 +94,6 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +108,7 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -200,7 +197,6 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,7 +253,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -273,7 +268,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -337,7 +331,6 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -352,7 +345,7 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +453,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -475,7 +467,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -526,7 +518,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -542,7 +533,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +610,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -635,7 +624,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -675,7 +664,6 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -690,7 +678,7 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,7 +744,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -772,7 +759,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -892,7 +878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -908,7 +893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +958,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -990,7 +973,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1052,7 +1034,6 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1067,7 +1048,7 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1147,6 @@ async def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1181,7 +1161,7 @@ async def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1294,7 +1274,6 @@ async def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1414,7 +1393,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1429,7 +1407,7 @@ async def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1542,7 +1520,6 @@ async def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_certificate_orders_operations.py index 946e3693d011d..a0dd404af8e1a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -866,7 +867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -882,7 +882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1001,7 +1000,6 @@ def validate_purchase_information( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1075,7 +1072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1143,7 +1139,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1158,7 +1153,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1171,7 +1166,7 @@ def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1185,7 +1180,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1206,10 +1201,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1217,15 +1212,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1342,10 +1337,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1405,7 +1401,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1540,7 +1535,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1555,11 +1549,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1609,7 +1599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1625,7 +1614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1696,7 +1684,6 @@ def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1711,7 +1698,7 @@ def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1725,7 +1712,7 @@ def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1739,7 +1726,7 @@ def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1761,10 +1748,10 @@ def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1772,15 +1759,15 @@ def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1904,10 +1891,11 @@ def begin_create_or_update_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1970,7 +1958,6 @@ def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2113,7 +2100,6 @@ def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2128,11 +2114,7 @@ def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2254,7 +2236,6 @@ def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2387,7 +2368,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2443,7 +2423,6 @@ def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2574,7 +2553,6 @@ def resend_request_emails( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2705,7 +2683,6 @@ def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2720,7 +2697,7 @@ def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2765,7 +2742,6 @@ def verify_domain_ownership( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2821,7 +2797,6 @@ def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2836,7 +2811,7 @@ def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2881,7 +2856,6 @@ def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2896,7 +2870,7 @@ def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_environments_operations.py index bac7c9ac25715..ef99bc7ff48ed 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1760,7 +1761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1776,7 +1776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1846,7 +1845,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1862,7 +1860,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1928,7 +1925,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1943,7 +1939,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1956,7 +1952,7 @@ def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1970,7 +1966,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1991,10 +1987,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2002,18 +1998,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2130,10 +2123,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2155,9 +2149,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2170,7 +2164,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -2181,10 +2175,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2192,12 +2186,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -2228,7 +2230,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -2238,6 +2240,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2376,7 +2379,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2391,14 +2393,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2444,7 +2439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2460,7 +2454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2526,7 +2519,6 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2541,7 +2533,7 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2554,7 +2546,7 @@ def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2568,7 +2560,7 @@ def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2589,10 +2581,10 @@ def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2600,15 +2592,15 @@ def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2737,7 +2729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2753,13 +2744,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2796,6 +2786,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2861,7 +2852,6 @@ def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2876,7 +2866,7 @@ def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2998,7 +2988,6 @@ def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3013,7 +3002,7 @@ def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3058,7 +3047,6 @@ def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3073,7 +3061,7 @@ def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3121,7 +3109,6 @@ def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3136,7 +3123,7 @@ def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3186,7 +3173,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3202,7 +3188,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3273,7 +3258,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3289,7 +3273,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3355,7 +3338,6 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3370,7 +3352,7 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3383,7 +3365,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3397,7 +3379,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3418,10 +3400,10 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3429,15 +3411,15 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3548,10 +3530,11 @@ def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3687,7 +3670,6 @@ def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3702,11 +3684,7 @@ def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3761,7 +3739,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3777,7 +3754,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3850,7 +3826,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3866,7 +3841,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3937,7 +3911,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3953,7 +3926,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4022,7 +3994,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4038,7 +4009,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4104,7 +4074,6 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4119,7 +4088,7 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4169,7 +4138,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4185,7 +4153,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4258,7 +4225,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4274,7 +4240,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4345,7 +4310,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4360,7 +4324,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4374,7 +4338,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4388,7 +4352,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4410,10 +4374,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4421,15 +4385,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4554,10 +4518,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4581,7 +4548,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4594,7 +4561,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -4605,10 +4572,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4616,18 +4583,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4671,10 +4635,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4732,7 +4697,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4747,7 +4711,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4792,7 +4756,6 @@ def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4810,7 +4773,7 @@ def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4823,7 +4786,7 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -4833,10 +4796,10 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4844,15 +4807,15 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4901,7 +4864,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4917,13 +4879,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4958,6 +4919,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5026,7 +4988,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5042,7 +5003,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5117,7 +5077,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5133,7 +5092,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5163,7 +5121,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5176,7 +5134,7 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -5186,10 +5144,10 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5197,15 +5155,15 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5254,7 +5212,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5270,13 +5227,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -5311,6 +5267,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5385,7 +5342,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5401,7 +5357,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5472,7 +5427,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5488,7 +5442,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5559,7 +5512,6 @@ def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5574,7 +5526,7 @@ def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5588,7 +5540,7 @@ def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5602,7 +5554,7 @@ def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5624,10 +5576,10 @@ def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5635,15 +5587,15 @@ def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5763,10 +5715,11 @@ def begin_create_or_update_worker_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5911,7 +5864,6 @@ def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5926,11 +5878,7 @@ def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5986,7 +5934,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6002,7 +5949,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6078,7 +6024,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6094,7 +6039,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6168,7 +6112,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6184,7 +6127,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6258,7 +6200,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6274,7 +6215,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_plans_operations.py index a157d48d412ac..ef1d3fd320657 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1161,7 +1162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1243,7 +1242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1259,7 +1257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1325,7 +1322,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1342,7 +1338,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1355,7 +1351,7 @@ def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1369,7 +1365,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1390,10 +1386,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1401,15 +1397,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1519,10 +1515,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1582,7 +1579,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1714,7 +1710,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1729,11 +1724,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1776,7 +1767,6 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1791,7 +1781,7 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1842,7 +1832,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1857,7 +1846,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1908,7 +1897,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1970,7 +1958,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1985,7 +1972,7 @@ def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2039,7 +2026,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2055,7 +2041,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2123,7 +2108,6 @@ def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2138,7 +2122,7 @@ def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2186,7 +2170,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2202,7 +2185,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2276,7 +2258,6 @@ def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2354,7 +2335,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2370,7 +2350,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2436,7 +2415,6 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2451,7 +2429,7 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2504,7 +2482,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2520,7 +2497,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2586,7 +2562,6 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2601,7 +2576,7 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2649,7 +2624,6 @@ def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2666,7 +2640,7 @@ def get_vnet_from_server_farm( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2717,7 +2691,6 @@ def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2732,7 +2705,7 @@ def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2872,7 +2845,6 @@ def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2887,7 +2859,7 @@ def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2935,7 +2907,6 @@ def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2950,7 +2921,7 @@ def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3001,7 +2972,6 @@ def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3018,7 +2988,7 @@ def get_route_for_vnet( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3158,7 +3128,6 @@ def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3175,7 +3144,7 @@ def create_or_update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3226,7 +3195,6 @@ def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3377,7 +3345,6 @@ def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3394,7 +3361,7 @@ def update_vnet_route( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3442,7 +3409,6 @@ def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_certificate_orders_diagnostics_operations.py index a4c96116870fa..52fb27f16379b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -195,7 +194,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -211,7 +209,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -299,7 +296,6 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -314,7 +310,7 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_certificate_registration_provider_operations.py index 1637bfbfe44c8..2b2690fa5e280 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_certificate_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_certificates_operations.py index 45d0ba3e20d1a..e28376f88216b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_certificates_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -312,7 +311,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +326,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -394,7 +391,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -410,7 +406,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -476,7 +471,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -491,7 +485,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -611,7 +605,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -626,7 +619,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -671,7 +664,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -803,7 +795,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -818,7 +809,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_deleted_web_apps_operations.py index d89ca4df6a13f..d21b251c9d2e1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_deleted_web_apps_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -176,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -192,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -342,7 +337,6 @@ def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +351,7 @@ def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_diagnostics_operations.py index 1eb5170438793..4f72b26d56a33 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1101,7 +1100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1117,7 +1115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1204,7 +1201,6 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1219,7 +1215,7 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1267,7 +1263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1283,7 +1278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1370,7 +1364,6 @@ def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1385,7 +1378,7 @@ def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1433,7 +1426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1449,7 +1441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1520,7 +1511,6 @@ def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1535,7 +1525,7 @@ def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1602,7 +1591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1676,7 +1664,6 @@ def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1678,7 @@ def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1759,7 +1746,6 @@ def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,7 +1760,7 @@ def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1825,7 +1811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1841,7 +1826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1915,7 +1899,6 @@ def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1930,7 +1913,7 @@ def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,7 +1981,6 @@ def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2013,7 +1995,7 @@ def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,7 +2046,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2080,7 +2061,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2171,7 +2151,6 @@ def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2186,7 +2165,7 @@ def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2237,7 +2216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2253,7 +2231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2327,7 +2304,6 @@ def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2342,7 +2318,7 @@ def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2396,7 +2372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2412,7 +2387,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2495,7 +2469,6 @@ def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2510,7 +2483,7 @@ def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2582,7 +2555,6 @@ def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2597,7 +2569,7 @@ def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2651,7 +2623,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2667,7 +2638,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2750,7 +2720,6 @@ def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2765,7 +2734,7 @@ def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2837,7 +2806,6 @@ def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2852,7 +2820,7 @@ def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_domain_registration_provider_operations.py index a0b68b0161434..ed0152a357b50 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_domain_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_domains_operations.py index 7bdd5bd54c30c..b04bb4c8cc7ae 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -694,7 +695,6 @@ def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -709,7 +709,7 @@ def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -749,7 +749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -765,7 +764,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -825,7 +823,6 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -840,7 +837,7 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -937,7 +934,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -953,7 +949,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1019,7 +1014,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1035,7 +1029,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1101,7 +1094,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1116,7 +1108,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1125,7 +1117,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1139,7 +1131,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1160,10 +1152,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1171,15 +1163,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1282,10 +1274,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1350,7 +1343,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1481,7 +1473,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1496,11 +1487,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1550,7 +1537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1566,7 +1552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1637,7 +1622,6 @@ def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1652,7 +1636,7 @@ def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1791,7 +1775,6 @@ def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1806,7 +1789,7 @@ def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1854,7 +1837,6 @@ def delete_ownership_identifier( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2004,7 +1986,6 @@ def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2019,7 +2000,7 @@ def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,7 +2045,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_global_operations_operations.py index 133d9f53abe10..d59e0f07a1e8c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_global_operations_operations.py @@ -18,15 +18,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -194,7 +192,7 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -234,7 +232,6 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -249,7 +246,7 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -294,7 +291,6 @@ def get_subscription_operation_with_async_response( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_kube_environments_operations.py index 313abbf0d6827..562c7981e1f27 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_kube_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_kube_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -308,7 +309,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -324,7 +324,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -390,7 +389,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -406,7 +404,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -472,7 +469,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Kub headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +483,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Kub error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -500,7 +496,7 @@ def _create_or_update_initial( name: str, kube_environment_envelope: Union[_models.KubeEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.KubeEnvironment: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -514,7 +510,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KubeEnvironment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -535,10 +531,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -546,15 +542,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -667,10 +663,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -692,9 +689,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -707,7 +702,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -717,10 +712,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -728,12 +723,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -758,7 +761,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -767,6 +770,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -905,7 +909,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -920,11 +923,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_provider_operations.py index 65bf53acb5879..99028e8674a08 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -273,7 +272,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -289,7 +287,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -357,7 +354,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -373,7 +369,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -444,7 +439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -460,7 +454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -531,7 +524,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -547,7 +539,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -613,7 +604,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -629,7 +619,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -697,7 +686,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -713,7 +701,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -784,7 +771,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -800,7 +786,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_recommendations_operations.py index 09ea3dc15a2ba..0b14a730f8dd9 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_recommendations_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -730,7 +729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -746,7 +744,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -806,7 +803,6 @@ def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -859,7 +855,6 @@ def disable_recommendation_for_subscription( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -933,7 +928,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -949,7 +943,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1034,7 +1027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1050,7 +1042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1121,7 +1112,6 @@ def disable_all_for_hosting_environment( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1180,7 +1170,6 @@ def reset_all_filters_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1253,7 +1242,6 @@ def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1268,7 +1256,7 @@ def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1319,7 +1307,6 @@ def disable_recommendation_for_hosting_environment( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1393,7 +1380,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1409,7 +1395,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1494,7 +1479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1510,7 +1494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1578,7 +1561,6 @@ def disable_all_for_web_app( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1634,7 +1616,6 @@ def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1688,6 @@ def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1722,7 +1702,7 @@ def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1770,7 +1750,6 @@ def disable_recommendation_for_site( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_resource_health_metadata_operations.py index 5836b8c8b0278..812fa90b41ccf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_resource_health_metadata_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -389,7 +386,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -405,7 +401,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -477,7 +472,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -493,7 +487,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -559,7 +552,6 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +566,7 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -627,7 +619,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -643,7 +634,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -715,7 +705,6 @@ def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -730,7 +719,7 @@ def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_static_sites_operations.py index b108946bc17c5..61b8c9c4aedea 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -2086,7 +2087,6 @@ def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2101,7 +2101,7 @@ def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2142,7 +2142,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2158,7 +2157,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2227,7 +2225,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2243,7 +2240,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2309,7 +2305,6 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2324,7 +2319,7 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2337,7 +2332,7 @@ def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2351,7 +2346,7 @@ def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2372,10 +2367,10 @@ def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2383,15 +2378,15 @@ def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2504,10 +2499,11 @@ def begin_create_or_update_static_site( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2529,9 +2525,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2544,7 +2538,7 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -2554,10 +2548,10 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2565,12 +2559,20 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -2595,7 +2597,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_initial( # type: ignore + raw_result = self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -2604,6 +2606,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2741,7 +2744,6 @@ def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2756,11 +2758,7 @@ def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2813,7 +2811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2829,7 +2826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2903,7 +2899,6 @@ def delete_static_site_user( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3057,7 +3052,6 @@ def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3072,7 +3066,7 @@ def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3122,7 +3116,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3138,7 +3131,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3209,7 +3201,6 @@ def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3224,16 +3215,16 @@ def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3246,7 +3237,7 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -3257,10 +3248,10 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3268,12 +3259,20 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_build( @@ -3302,7 +3301,7 @@ def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_build_initial( # type: ignore + raw_result = self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -3312,6 +3311,7 @@ def begin_delete_static_site_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3458,7 +3458,6 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3473,7 +3472,7 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3605,7 +3604,6 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3620,7 +3618,7 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3673,7 +3671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3689,7 +3686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3760,7 +3756,6 @@ def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3775,7 +3770,7 @@ def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3823,7 +3818,6 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3838,7 +3832,7 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3891,7 +3885,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3907,7 +3900,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3982,7 +3974,6 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3997,7 +3988,9 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4015,7 +4008,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4029,7 +4022,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4055,10 +4048,10 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4066,15 +4059,15 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4233,10 +4226,13 @@ def begin_register_user_provided_function_app_with_static_site_build( # pylint: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4303,7 +4299,6 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4321,14 +4316,14 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4342,7 +4337,7 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4364,10 +4359,10 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4375,12 +4370,20 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -4485,7 +4488,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -4497,6 +4500,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4633,7 +4637,6 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4648,7 +4651,7 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4770,7 +4773,6 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4785,7 +4787,7 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4909,7 +4911,6 @@ def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4924,7 +4925,7 @@ def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4974,7 +4975,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4990,7 +4990,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5061,7 +5060,6 @@ def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5076,7 +5074,7 @@ def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5092,7 +5090,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5106,7 +5104,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5131,10 +5129,10 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5142,15 +5140,15 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5281,10 +5279,13 @@ def begin_create_or_update_static_site_custom_domain( # pylint: disable=name-to params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5306,9 +5307,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5321,7 +5322,7 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -5332,10 +5333,10 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5343,12 +5344,20 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_custom_domain( @@ -5377,7 +5386,7 @@ def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -5387,6 +5396,7 @@ def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5408,7 +5418,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -5417,7 +5427,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5431,7 +5441,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5456,10 +5466,10 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5467,12 +5477,20 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -5580,7 +5598,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -5592,6 +5610,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5613,9 +5632,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _detach_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5628,7 +5645,7 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -5638,10 +5655,10 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5649,12 +5666,20 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -5679,7 +5704,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._detach_static_site_initial( # type: ignore + raw_result = self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -5688,6 +5713,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5752,7 +5778,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5768,7 +5793,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5836,7 +5860,6 @@ def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5851,7 +5874,7 @@ def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5896,7 +5919,6 @@ def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5911,7 +5933,7 @@ def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5956,7 +5978,6 @@ def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5971,7 +5992,7 @@ def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6014,7 +6035,6 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6029,7 +6049,7 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6079,7 +6099,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6095,7 +6114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6166,7 +6184,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6181,7 +6198,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6195,7 +6212,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6209,7 +6226,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6231,10 +6248,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6242,15 +6259,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6375,10 +6392,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6402,7 +6422,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6415,7 +6435,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -6426,10 +6446,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6437,18 +6457,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6492,10 +6509,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6553,7 +6571,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6568,7 +6585,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6690,7 +6707,6 @@ def reset_static_site_api_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6751,7 +6767,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6767,7 +6782,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6838,7 +6852,6 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6853,7 +6866,9 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6870,7 +6885,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6884,7 +6899,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6909,10 +6924,10 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6920,15 +6935,15 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7074,10 +7089,13 @@ def begin_register_user_provided_function_app_with_static_site( # pylint: disab params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7140,7 +7158,6 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7158,13 +7175,13 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7178,7 +7195,7 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7199,10 +7216,10 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7210,12 +7227,20 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -7311,7 +7336,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -7322,6 +7347,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_top_level_domains_operations.py index 35c9ff744e62f..660a812ae61aa 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_top_level_domains_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_web_apps_operations.py index 5818422cf7306..48f02eb4ba614 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_web_apps_operations.py @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -15853,7 +15854,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15869,7 +15869,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15942,7 +15941,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15958,7 +15956,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16024,7 +16021,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16041,7 +16037,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16050,7 +16046,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16064,7 +16060,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16085,10 +16081,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16096,15 +16092,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16216,10 +16212,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16291,7 +16288,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16431,7 +16427,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16446,11 +16441,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16498,7 +16489,6 @@ def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16513,7 +16503,7 @@ def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16633,7 +16623,6 @@ def apply_slot_config_to_production( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16762,7 +16751,6 @@ def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16777,7 +16765,7 @@ def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16823,7 +16811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16839,7 +16826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16910,7 +16896,6 @@ def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16925,7 +16910,7 @@ def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16973,7 +16958,6 @@ def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17126,7 +17110,6 @@ def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17141,21 +17124,21 @@ def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_initial( # pylint: disable=inconsistent-return-statements + def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17169,7 +17152,7 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17191,10 +17174,10 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17202,12 +17185,20 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore( @@ -17307,7 +17298,7 @@ def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_initial( # type: ignore + raw_result = self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -17319,6 +17310,7 @@ def begin_restore( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -17378,7 +17370,6 @@ def get_basic_publishing_credentials_policies( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17393,7 +17384,7 @@ def get_basic_publishing_credentials_policies( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17438,7 +17429,6 @@ def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17453,7 +17443,7 @@ def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17577,7 +17567,6 @@ def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17592,7 +17581,7 @@ def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17637,7 +17626,6 @@ def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17652,7 +17640,7 @@ def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17776,7 +17764,6 @@ def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17791,7 +17778,7 @@ def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17839,7 +17826,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17855,7 +17841,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17998,7 +17983,6 @@ def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18013,7 +17997,7 @@ def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18056,7 +18040,6 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18071,7 +18054,7 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18191,7 +18174,6 @@ def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18206,7 +18188,7 @@ def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18249,7 +18231,6 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18264,7 +18245,7 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18384,7 +18365,6 @@ def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18399,7 +18379,7 @@ def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18442,7 +18422,6 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18457,7 +18436,7 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18579,7 +18558,6 @@ def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18594,7 +18572,7 @@ def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18639,7 +18617,6 @@ def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18654,7 +18631,7 @@ def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18770,7 +18747,6 @@ def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18785,7 +18761,7 @@ def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18830,7 +18806,6 @@ def delete_backup_configuration( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18884,7 +18859,6 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18899,7 +18873,7 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18947,7 +18921,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18963,7 +18936,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19034,7 +19006,6 @@ def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19049,7 +19020,7 @@ def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19097,7 +19068,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19113,7 +19083,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19184,7 +19153,6 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19199,7 +19167,7 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19322,7 +19290,6 @@ def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19337,7 +19304,7 @@ def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19382,7 +19349,6 @@ def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19397,7 +19363,7 @@ def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19442,7 +19408,6 @@ def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19457,7 +19422,7 @@ def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19580,7 +19545,6 @@ def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19595,7 +19559,7 @@ def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19711,7 +19675,6 @@ def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19726,7 +19689,7 @@ def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19769,7 +19732,6 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19784,14 +19746,16 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _list_publishing_credentials_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.User: + def _list_publishing_credentials_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19804,7 +19768,7 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -19814,10 +19778,10 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -19825,11 +19789,15 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19870,10 +19838,11 @@ def begin_list_publishing_credentials( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20004,7 +19973,6 @@ def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20019,7 +19987,7 @@ def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20062,7 +20030,6 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20077,7 +20044,7 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20122,7 +20089,6 @@ def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20137,7 +20103,7 @@ def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20266,7 +20232,6 @@ def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20281,7 +20246,7 @@ def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20326,7 +20291,6 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20341,7 +20305,7 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20461,7 +20425,6 @@ def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20476,7 +20439,7 @@ def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20596,7 +20559,6 @@ def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20611,7 +20573,7 @@ def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20663,7 +20625,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20679,7 +20640,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20750,7 +20710,6 @@ def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20765,7 +20724,7 @@ def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20813,7 +20772,6 @@ def recover_site_configuration_snapshot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20869,9 +20827,9 @@ def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20880,12 +20838,16 @@ def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20928,9 +20890,9 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20939,12 +20901,16 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20992,7 +20958,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21008,7 +20973,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21079,7 +21043,6 @@ def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21096,7 +21059,7 @@ def get_continuous_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21144,7 +21107,6 @@ def delete_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21203,7 +21165,6 @@ def start_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21262,7 +21223,6 @@ def stop_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21319,7 +21279,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21335,7 +21294,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21404,7 +21362,6 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21419,7 +21376,7 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21549,7 +21506,6 @@ def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21564,7 +21520,7 @@ def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21612,7 +21568,6 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21670,7 +21625,6 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21685,7 +21639,7 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21809,7 +21763,6 @@ def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21824,7 +21777,7 @@ def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21872,7 +21825,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21888,7 +21840,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21959,7 +21910,6 @@ def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21974,7 +21924,7 @@ def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22106,7 +22056,6 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22121,7 +22070,7 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22169,7 +22118,6 @@ def delete_domain_ownership_identifier( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22312,7 +22260,6 @@ def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22327,7 +22274,7 @@ def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22370,7 +22317,6 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22385,7 +22331,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22394,7 +22340,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22408,7 +22354,7 @@ def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -22429,10 +22375,10 @@ def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22440,13 +22386,15 @@ def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22552,10 +22500,11 @@ def begin_create_ms_deploy_operation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22613,7 +22562,6 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22630,7 +22578,7 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22678,7 +22626,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22694,7 +22641,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22760,7 +22706,6 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22775,7 +22720,7 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22823,7 +22768,6 @@ def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22840,7 +22784,7 @@ def get_function( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22854,7 +22798,7 @@ def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22868,7 +22812,7 @@ def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -22890,10 +22834,10 @@ def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22901,11 +22845,15 @@ def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23025,10 +22973,11 @@ def begin_create_function( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23091,7 +23040,6 @@ def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23242,7 +23190,6 @@ def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23257,11 +23204,7 @@ def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23312,7 +23255,6 @@ def delete_function_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23371,7 +23313,6 @@ def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23386,7 +23327,7 @@ def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23434,7 +23375,6 @@ def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23449,7 +23389,7 @@ def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23492,7 +23432,6 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23507,7 +23446,7 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23552,7 +23491,6 @@ def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23608,7 +23546,6 @@ def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23759,7 +23696,6 @@ def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23774,11 +23710,7 @@ def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23829,7 +23761,6 @@ def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23888,7 +23819,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23904,7 +23834,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23975,7 +23904,6 @@ def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23990,7 +23918,7 @@ def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24122,7 +24050,6 @@ def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24137,7 +24064,7 @@ def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24185,7 +24112,6 @@ def delete_host_name_binding( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24247,7 +24173,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24262,7 +24187,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24402,7 +24327,6 @@ def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24417,7 +24341,7 @@ def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24468,7 +24392,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24619,7 +24542,6 @@ def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24634,7 +24556,7 @@ def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24677,7 +24599,6 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24692,7 +24613,7 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24737,7 +24658,6 @@ def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24752,7 +24672,7 @@ def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24800,7 +24720,6 @@ def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24815,7 +24734,7 @@ def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24946,7 +24865,6 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24961,7 +24879,7 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25009,7 +24927,6 @@ def delete_relay_service_connection( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25151,7 +25068,6 @@ def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25166,7 +25082,7 @@ def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25215,7 +25131,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25231,7 +25146,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25302,7 +25216,6 @@ def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25317,7 +25230,7 @@ def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25365,7 +25278,6 @@ def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25380,7 +25292,7 @@ def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25394,7 +25306,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25408,7 +25320,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25430,10 +25342,10 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25441,13 +25353,15 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25567,10 +25481,11 @@ def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25633,7 +25548,6 @@ def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25650,7 +25564,7 @@ def get_instance_ms_deploy_log( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25704,7 +25618,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25720,7 +25633,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25795,7 +25707,6 @@ def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25812,7 +25723,7 @@ def get_instance_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25866,7 +25777,6 @@ def delete_instance_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25929,9 +25839,9 @@ def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25940,13 +25850,17 @@ def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26003,7 +25917,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26019,7 +25932,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26097,7 +26009,6 @@ def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26114,7 +26025,7 @@ def get_instance_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26169,7 +26080,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26185,7 +26095,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26251,7 +26160,6 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26266,7 +26174,7 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26312,7 +26220,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26328,7 +26235,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26396,7 +26302,6 @@ def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26411,7 +26316,7 @@ def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26425,7 +26330,7 @@ def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26439,7 +26344,7 @@ def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26461,10 +26366,10 @@ def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26472,11 +26377,15 @@ def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26600,10 +26509,11 @@ def begin_migrate_storage( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26631,7 +26541,7 @@ def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26645,7 +26555,7 @@ def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26666,10 +26576,10 @@ def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26677,11 +26587,15 @@ def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26789,10 +26703,11 @@ def begin_migrate_my_sql( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26854,7 +26769,6 @@ def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26869,7 +26783,7 @@ def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26914,7 +26828,6 @@ def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26929,7 +26842,7 @@ def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27069,7 +26982,6 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27084,7 +26996,7 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27129,7 +27041,6 @@ def delete_swift_virtual_network( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27188,7 +27099,6 @@ def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27205,7 +27115,7 @@ def list_network_features( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27253,7 +27163,6 @@ def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27268,11 +27177,7 @@ def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27332,7 +27237,6 @@ def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27347,7 +27251,7 @@ def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27362,7 +27266,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27375,7 +27279,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -27388,10 +27292,10 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27399,15 +27303,15 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27464,10 +27368,11 @@ def begin_start_web_site_network_trace_operation( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27527,7 +27432,6 @@ def stop_web_site_network_trace( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27586,7 +27490,6 @@ def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27601,7 +27504,7 @@ def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27649,7 +27552,6 @@ def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27664,11 +27566,7 @@ def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27716,7 +27614,6 @@ def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27731,7 +27628,7 @@ def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27776,7 +27673,6 @@ def generate_new_site_publishing_password( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27840,7 +27736,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27856,7 +27751,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27924,7 +27818,6 @@ def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27939,7 +27832,7 @@ def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27982,7 +27875,6 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27997,7 +27889,7 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28045,7 +27937,6 @@ def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28060,7 +27951,7 @@ def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28190,7 +28081,6 @@ def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28205,7 +28095,7 @@ def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28253,7 +28143,6 @@ def delete_premier_add_on( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28394,7 +28283,6 @@ def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28409,7 +28297,7 @@ def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28454,7 +28342,6 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28469,7 +28356,7 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28591,7 +28478,6 @@ def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28606,7 +28492,7 @@ def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28656,7 +28542,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28672,7 +28557,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28743,7 +28627,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28758,7 +28641,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28772,7 +28655,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28786,7 +28669,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28808,10 +28691,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28819,15 +28702,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28952,10 +28835,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28979,7 +28865,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28992,7 +28878,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -29003,10 +28889,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29014,18 +28900,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29069,10 +28952,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29130,7 +29014,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29145,7 +29028,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29193,7 +29076,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29209,7 +29091,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29280,7 +29161,6 @@ def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29297,7 +29177,7 @@ def get_process( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29347,7 +29227,6 @@ def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29406,9 +29285,9 @@ def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29417,13 +29296,17 @@ def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29476,7 +29359,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29492,7 +29374,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29566,7 +29447,6 @@ def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29583,7 +29463,7 @@ def get_process_module( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29634,7 +29514,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29650,7 +29529,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29721,7 +29599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29737,7 +29614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29808,7 +29684,6 @@ def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29823,7 +29698,7 @@ def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29955,7 +29830,6 @@ def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29970,7 +29844,7 @@ def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30018,7 +29892,6 @@ def delete_public_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30154,9 +30027,9 @@ def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30165,11 +30038,15 @@ def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30216,7 +30093,6 @@ def reset_production_slot_config( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30286,7 +30162,6 @@ def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30304,9 +30179,9 @@ def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30320,7 +30195,7 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30341,10 +30216,10 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30352,12 +30227,20 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob( @@ -30444,7 +30327,7 @@ def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_initial( # type: ignore + raw_result = self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -30455,6 +30338,7 @@ def begin_restore_from_backup_blob( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30476,13 +30360,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30496,7 +30380,7 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30517,10 +30401,10 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30528,12 +30412,20 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app( @@ -30624,7 +30516,7 @@ def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_initial( # type: ignore + raw_result = self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -30635,6 +30527,7 @@ def begin_restore_from_deleted_app( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30656,13 +30549,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30676,7 +30569,7 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30697,10 +30590,10 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30708,12 +30601,20 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot( @@ -30807,7 +30708,7 @@ def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_initial( # type: ignore + raw_result = self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -30818,6 +30719,7 @@ def begin_restore_snapshot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30880,7 +30782,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30896,7 +30797,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30967,7 +30867,6 @@ def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30984,7 +30883,7 @@ def get_site_extension( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30993,7 +30892,7 @@ def get_site_extension( def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31006,7 +30905,7 @@ def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -31017,10 +30916,10 @@ def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31028,16 +30927,15 @@ def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31082,10 +30980,11 @@ def begin_install_site_extension( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31148,7 +31047,6 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31205,7 +31103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31221,7 +31118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31291,7 +31187,6 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31308,7 +31203,7 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31322,7 +31217,7 @@ def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31336,7 +31231,7 @@ def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31358,10 +31253,10 @@ def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31369,15 +31264,15 @@ def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31506,10 +31401,11 @@ def begin_create_or_update_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31586,7 +31482,6 @@ def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31739,7 +31634,6 @@ def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31754,11 +31648,7 @@ def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31810,7 +31700,6 @@ def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31825,7 +31714,7 @@ def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31958,7 +31847,6 @@ def apply_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32104,7 +31992,6 @@ def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32119,7 +32006,7 @@ def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32171,7 +32058,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32187,7 +32073,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32262,7 +32147,6 @@ def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32277,7 +32161,7 @@ def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32329,7 +32213,6 @@ def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32495,7 +32378,6 @@ def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32510,14 +32392,14 @@ def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -32525,7 +32407,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32539,7 +32421,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32562,10 +32444,10 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32573,12 +32455,20 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_slot( @@ -32690,7 +32580,7 @@ def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_slot_initial( # type: ignore + raw_result = self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -32703,6 +32593,7 @@ def begin_restore_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32765,7 +32656,6 @@ def get_basic_publishing_credentials_policies_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32780,7 +32670,7 @@ def get_basic_publishing_credentials_policies_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32828,7 +32718,6 @@ def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32843,7 +32732,7 @@ def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32977,7 +32866,6 @@ def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32992,7 +32880,7 @@ def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33040,7 +32928,6 @@ def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33055,7 +32942,7 @@ def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33189,7 +33076,6 @@ def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33204,7 +33090,7 @@ def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33256,7 +33142,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33272,7 +33157,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33428,7 +33312,6 @@ def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33443,7 +33326,7 @@ def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33492,7 +33375,6 @@ def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33507,7 +33389,7 @@ def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33640,7 +33522,6 @@ def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33655,7 +33536,7 @@ def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33704,7 +33585,6 @@ def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33719,7 +33599,7 @@ def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33852,7 +33732,6 @@ def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33867,7 +33746,7 @@ def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33916,7 +33795,6 @@ def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33931,7 +33809,7 @@ def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34066,7 +33944,6 @@ def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34081,7 +33958,7 @@ def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34130,7 +34007,6 @@ def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34145,7 +34021,7 @@ def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34278,7 +34154,6 @@ def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34293,7 +34168,7 @@ def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34342,7 +34217,6 @@ def delete_backup_configuration_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34402,7 +34276,6 @@ def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34417,7 +34290,7 @@ def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34468,7 +34341,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34484,7 +34356,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34558,7 +34429,6 @@ def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34573,7 +34443,7 @@ def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34624,7 +34494,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34640,7 +34509,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34714,7 +34582,6 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34729,7 +34596,7 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34865,7 +34732,6 @@ def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34880,7 +34746,7 @@ def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34929,7 +34795,6 @@ def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34944,7 +34809,7 @@ def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34993,7 +34858,6 @@ def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35008,7 +34872,7 @@ def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35144,7 +35008,6 @@ def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35159,7 +35022,7 @@ def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35292,7 +35155,6 @@ def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35307,7 +35169,7 @@ def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35356,7 +35218,6 @@ def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35371,7 +35232,7 @@ def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35380,7 +35241,7 @@ def list_metadata_slot( def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35393,7 +35254,7 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -35404,10 +35265,10 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35415,11 +35276,15 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35464,10 +35329,11 @@ def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -35615,7 +35481,6 @@ def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35630,7 +35495,7 @@ def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35679,7 +35544,6 @@ def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35694,7 +35558,7 @@ def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35745,7 +35609,6 @@ def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35760,7 +35623,7 @@ def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35893,7 +35756,6 @@ def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35908,7 +35770,7 @@ def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36041,7 +35903,6 @@ def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36056,7 +35917,7 @@ def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36112,7 +35973,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36128,7 +35988,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36203,7 +36062,6 @@ def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36218,7 +36076,7 @@ def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36270,7 +36128,6 @@ def recover_site_configuration_snapshot_slot( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36330,9 +36187,9 @@ def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -36341,12 +36198,16 @@ def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36395,9 +36256,9 @@ def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -36406,12 +36267,16 @@ def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36463,7 +36328,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36479,7 +36343,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36554,7 +36417,6 @@ def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36571,7 +36433,7 @@ def get_continuous_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36623,7 +36485,6 @@ def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36686,7 +36547,6 @@ def start_continuous_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36749,7 +36609,6 @@ def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36812,7 +36671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36828,7 +36686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36903,7 +36760,6 @@ def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36918,7 +36774,7 @@ def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37061,7 +36917,6 @@ def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37076,7 +36931,7 @@ def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37128,7 +36983,6 @@ def delete_deployment_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37192,7 +37046,6 @@ def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37207,7 +37060,7 @@ def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37348,7 +37201,6 @@ def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37363,7 +37215,7 @@ def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37415,7 +37267,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37431,7 +37282,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37506,7 +37356,6 @@ def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37521,7 +37370,7 @@ def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37666,7 +37515,6 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37681,7 +37529,7 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37733,7 +37581,6 @@ def delete_domain_ownership_identifier_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37889,7 +37736,6 @@ def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37904,7 +37750,7 @@ def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37953,7 +37799,6 @@ def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37968,7 +37813,7 @@ def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37982,7 +37827,7 @@ def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37996,7 +37841,7 @@ def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -38018,10 +37863,10 @@ def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -38029,13 +37874,15 @@ def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38158,10 +38005,11 @@ def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -38225,7 +38073,6 @@ def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38242,7 +38089,7 @@ def get_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38293,7 +38140,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38309,7 +38155,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38379,7 +38224,6 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38394,7 +38238,7 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38445,7 +38289,6 @@ def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38462,7 +38305,7 @@ def get_instance_function_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38477,7 +38320,7 @@ def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -38491,7 +38334,7 @@ def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -38514,10 +38357,10 @@ def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -38525,11 +38368,15 @@ def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38659,10 +38506,11 @@ def begin_create_instance_function_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -38728,7 +38576,6 @@ def delete_instance_function_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38889,7 +38736,6 @@ def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38904,11 +38750,7 @@ def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38962,7 +38804,6 @@ def delete_function_secret_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39024,7 +38865,6 @@ def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39039,7 +38879,7 @@ def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39090,7 +38930,6 @@ def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39105,7 +38944,7 @@ def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39151,7 +38990,6 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39166,7 +39004,7 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39214,7 +39052,6 @@ def list_sync_status_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39273,7 +39110,6 @@ def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39434,7 +39270,6 @@ def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39449,11 +39284,7 @@ def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39507,7 +39338,6 @@ def delete_host_secret_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39570,7 +39400,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39586,7 +39415,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39661,7 +39489,6 @@ def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39676,7 +39503,7 @@ def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39821,7 +39648,6 @@ def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39836,7 +39662,7 @@ def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39888,7 +39714,6 @@ def delete_host_name_binding_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39953,7 +39778,6 @@ def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39968,7 +39792,7 @@ def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40118,7 +39942,6 @@ def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40133,7 +39956,7 @@ def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40187,7 +40010,6 @@ def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40348,7 +40170,6 @@ def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40363,7 +40184,7 @@ def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40411,7 +40232,6 @@ def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40426,7 +40246,7 @@ def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40475,7 +40295,6 @@ def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40490,7 +40309,7 @@ def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40542,7 +40361,6 @@ def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40557,7 +40375,7 @@ def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40701,7 +40519,6 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40716,7 +40533,7 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40768,7 +40585,6 @@ def delete_relay_service_connection_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40923,7 +40739,6 @@ def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40938,7 +40753,7 @@ def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40991,7 +40806,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41007,7 +40821,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41082,7 +40895,6 @@ def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41097,7 +40909,7 @@ def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41149,7 +40961,6 @@ def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41164,7 +40975,7 @@ def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41179,7 +40990,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.MSDeployStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -41193,7 +41004,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.MSDeployStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -41216,10 +41027,10 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -41227,13 +41038,15 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [201, 409]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41366,10 +41179,11 @@ def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=name-too- params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -41436,7 +41250,6 @@ def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41453,7 +41266,7 @@ def get_instance_ms_deploy_log_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41511,7 +41324,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41527,7 +41339,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41606,7 +41417,6 @@ def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41623,7 +41433,7 @@ def get_instance_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41681,7 +41491,6 @@ def delete_instance_process_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41748,9 +41557,9 @@ def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -41759,13 +41568,17 @@ def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41826,7 +41639,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41842,7 +41654,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41931,7 +41742,6 @@ def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41948,7 +41758,7 @@ def get_instance_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42007,7 +41817,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42023,7 +41832,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42095,7 +41903,6 @@ def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42110,7 +41917,7 @@ def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42162,7 +41969,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42178,7 +41984,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42249,7 +42054,6 @@ def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42264,7 +42068,7 @@ def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42314,7 +42118,6 @@ def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42329,7 +42132,7 @@ def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42378,7 +42181,6 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42393,7 +42195,7 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42442,7 +42244,6 @@ def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42505,7 +42306,6 @@ def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42522,7 +42322,7 @@ def list_network_features_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42574,7 +42374,6 @@ def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42589,11 +42388,7 @@ def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42657,7 +42452,6 @@ def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42672,7 +42466,7 @@ def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42688,7 +42482,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42701,7 +42495,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -42715,10 +42509,10 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -42726,15 +42520,15 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42795,10 +42589,11 @@ def begin_start_web_site_network_trace_operation_slot( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -42861,7 +42656,6 @@ def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42924,7 +42718,6 @@ def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42939,7 +42732,7 @@ def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42991,7 +42784,6 @@ def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43006,11 +42798,7 @@ def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43062,7 +42850,6 @@ def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43077,7 +42864,7 @@ def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43126,7 +42913,6 @@ def generate_new_site_publishing_password_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43194,7 +42980,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43210,7 +42995,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43282,7 +43066,6 @@ def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43297,7 +43080,7 @@ def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43346,7 +43129,6 @@ def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43361,7 +43143,7 @@ def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43413,7 +43195,6 @@ def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43428,7 +43209,7 @@ def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43571,7 +43352,6 @@ def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43586,7 +43366,7 @@ def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43638,7 +43418,6 @@ def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43792,7 +43571,6 @@ def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43807,7 +43585,7 @@ def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43857,7 +43635,6 @@ def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43872,7 +43649,7 @@ def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44008,7 +43785,6 @@ def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44023,7 +43799,7 @@ def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44076,7 +43852,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44092,7 +43867,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44166,7 +43940,6 @@ def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44181,7 +43954,7 @@ def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44196,7 +43969,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44210,7 +43983,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -44233,10 +44006,10 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44244,15 +44017,15 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44387,10 +44160,13 @@ def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -44414,7 +44190,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44427,7 +44203,7 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -44439,10 +44215,10 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44450,18 +44226,15 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44508,10 +44281,11 @@ def begin_delete_private_endpoint_connection_slot( # pylint: disable=name-too-l params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -44572,7 +44346,6 @@ def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44587,7 +44360,7 @@ def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44641,7 +44414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44657,7 +44429,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44732,7 +44503,6 @@ def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44749,7 +44519,7 @@ def get_process_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44803,7 +44573,6 @@ def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44866,9 +44635,9 @@ def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -44877,13 +44646,17 @@ def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44940,7 +44713,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44956,7 +44728,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45034,7 +44805,6 @@ def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45051,7 +44821,7 @@ def get_process_module_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45106,7 +44876,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45122,7 +44891,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45197,7 +44965,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45213,7 +44980,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45288,7 +45054,6 @@ def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45303,7 +45068,7 @@ def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45448,7 +45213,6 @@ def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45463,7 +45227,7 @@ def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45515,7 +45279,6 @@ def delete_public_certificate_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45664,9 +45427,9 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -45675,11 +45438,15 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45730,7 +45497,6 @@ def reset_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45805,7 +45571,6 @@ def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45823,14 +45588,14 @@ def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45844,7 +45609,7 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -45866,10 +45631,10 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45877,12 +45642,20 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob_slot( @@ -45985,7 +45758,7 @@ def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -45997,6 +45770,7 @@ def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -46018,14 +45792,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46039,7 +45813,7 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -46061,10 +45835,10 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46072,12 +45846,20 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app_slot( @@ -46180,7 +45962,7 @@ def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -46192,6 +45974,7 @@ def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -46213,14 +45996,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46234,7 +46017,7 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -46256,10 +46039,10 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46267,12 +46050,20 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot_slot( @@ -46378,7 +46169,7 @@ def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_slot_initial( # type: ignore + raw_result = self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -46390,6 +46181,7 @@ def begin_restore_snapshot_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -46456,7 +46248,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46472,7 +46263,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46547,7 +46337,6 @@ def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46564,7 +46353,7 @@ def get_site_extension_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46573,7 +46362,7 @@ def get_site_extension_slot( def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> Optional[_models.SiteExtensionInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46586,7 +46375,7 @@ def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[Optional[_models.SiteExtensionInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -46598,10 +46387,10 @@ def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46609,16 +46398,15 @@ def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 429]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46667,10 +46455,11 @@ def begin_install_site_extension_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -46737,7 +46526,6 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46883,7 +46671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46899,7 +46686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46929,14 +46715,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46950,7 +46736,7 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -46972,10 +46758,10 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46983,12 +46769,20 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot( @@ -47091,7 +46885,7 @@ def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_initial( # type: ignore + raw_result = self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -47103,6 +46897,7 @@ def begin_swap_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -47168,7 +46963,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47184,7 +46978,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47258,7 +47051,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47274,7 +47066,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47346,7 +47137,6 @@ def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47361,14 +47151,7 @@ def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47382,7 +47165,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47396,7 +47179,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -47418,10 +47201,10 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47429,18 +47212,15 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47565,10 +47345,11 @@ def begin_create_or_update_source_control_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -47635,7 +47416,6 @@ def delete_source_control_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47781,7 +47561,6 @@ def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47796,14 +47575,7 @@ def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47852,7 +47624,6 @@ def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47879,7 +47650,7 @@ def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47892,7 +47663,7 @@ def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -47906,10 +47677,10 @@ def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47917,15 +47688,15 @@ def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47986,10 +47757,11 @@ def begin_start_network_trace_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -48053,7 +47825,6 @@ def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48112,7 +47883,6 @@ def stop_network_trace_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48172,7 +47942,6 @@ def sync_repository_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48231,7 +48000,6 @@ def sync_function_triggers_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48294,7 +48062,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48310,7 +48077,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48385,7 +48151,6 @@ def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48402,7 +48167,7 @@ def get_triggered_web_job_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48454,7 +48219,6 @@ def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48520,7 +48284,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48536,7 +48299,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48614,7 +48376,6 @@ def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48631,7 +48392,7 @@ def get_triggered_web_job_history_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48683,7 +48444,6 @@ def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48752,7 +48512,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48768,7 +48527,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48840,7 +48598,6 @@ def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48855,7 +48612,7 @@ def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48907,7 +48664,6 @@ def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48922,7 +48678,7 @@ def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49073,7 +48829,6 @@ def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49088,7 +48843,7 @@ def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49140,7 +48895,6 @@ def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49302,7 +49056,6 @@ def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49317,7 +49070,7 @@ def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49373,7 +49126,6 @@ def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49390,7 +49142,7 @@ def get_vnet_connection_gateway_slot( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49546,7 +49298,6 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49561,7 +49312,7 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49717,7 +49468,6 @@ def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49732,7 +49482,7 @@ def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49784,7 +49534,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49800,7 +49549,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49875,7 +49623,6 @@ def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49890,7 +49637,7 @@ def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50012,7 +49759,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50028,7 +49774,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50058,13 +49803,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -50078,7 +49823,7 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -50099,10 +49844,10 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -50110,12 +49855,20 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot_with_production( @@ -50206,7 +49959,7 @@ def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_with_production_initial( # type: ignore + raw_result = self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -50217,6 +49970,7 @@ def begin_swap_slot_with_production( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -50277,7 +50031,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50293,7 +50046,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50364,7 +50116,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50380,7 +50131,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50446,7 +50196,6 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50461,14 +50210,7 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50481,7 +50223,7 @@ def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -50495,7 +50237,7 @@ def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -50516,10 +50258,10 @@ def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -50527,18 +50269,15 @@ def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50650,10 +50389,11 @@ def begin_create_or_update_source_control( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -50716,7 +50456,6 @@ def delete_source_control( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50849,7 +50588,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50864,14 +50602,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50916,7 +50647,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50942,7 +50672,7 @@ def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -50955,7 +50685,7 @@ def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -50968,10 +50698,10 @@ def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -50979,15 +50709,15 @@ def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51044,10 +50774,11 @@ def begin_start_network_trace( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -51107,7 +50838,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51163,7 +50893,6 @@ def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51219,7 +50948,6 @@ def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51275,7 +51003,6 @@ def sync_function_triggers( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51334,7 +51061,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51350,7 +51076,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51421,7 +51146,6 @@ def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51438,7 +51162,7 @@ def get_triggered_web_job( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51486,7 +51210,6 @@ def delete_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51548,7 +51271,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51564,7 +51286,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51638,7 +51359,6 @@ def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51655,7 +51375,7 @@ def get_triggered_web_job_history( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51703,7 +51423,6 @@ def run_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51768,7 +51487,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51784,7 +51502,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51850,7 +51567,6 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51865,7 +51581,7 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51913,7 +51629,6 @@ def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51928,7 +51643,7 @@ def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52066,7 +51781,6 @@ def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52081,7 +51795,7 @@ def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52129,7 +51843,6 @@ def delete_vnet_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52278,7 +51991,6 @@ def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52293,7 +52005,7 @@ def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52345,7 +52057,6 @@ def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52362,7 +52073,7 @@ def get_vnet_connection_gateway( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52505,7 +52216,6 @@ def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52520,7 +52230,7 @@ def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52663,7 +52373,6 @@ def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52678,7 +52387,7 @@ def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52724,7 +52433,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52740,7 +52448,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52809,7 +52516,6 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52824,7 +52530,7 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_web_site_management_client_operations.py index 94500aaaa40cb..a7ec300ab7c35 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_01/operations/_web_site_management_client_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -538,7 +537,6 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -553,7 +551,7 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -642,7 +640,6 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -657,7 +654,7 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -698,7 +695,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -714,7 +710,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -778,7 +773,6 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +787,7 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -901,7 +895,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -916,7 +909,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -966,7 +959,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -982,7 +974,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1060,7 +1051,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1075,7 +1065,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1115,7 +1105,6 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1130,7 +1119,7 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1196,7 +1185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1212,7 +1200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1332,7 +1319,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1348,7 +1334,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1413,7 +1398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1429,7 +1413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1491,7 +1474,6 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1506,7 +1488,7 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1605,7 +1587,6 @@ def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1620,7 +1601,7 @@ def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1733,7 +1714,6 @@ def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1853,7 +1833,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1868,7 +1847,7 @@ def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1981,7 +1960,6 @@ def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_metadata.json index d31437fc6da97..71378ea7679bc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_vendor.py index fd66631892ed1..abd2e5566a353 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from .._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class WebSiteManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_web_site_management_client.py index 040574cb7386e..cfa0f9e6db0b4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -213,7 +214,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/_vendor.py index 39f69956b8888..6e80ec49ed289 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/_web_site_management_client.py index 3410502b4ef97..d896c75f86e43 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -216,7 +217,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_app_service_certificate_orders_operations.py index 999c249d116a9..30038ebf32f7f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_certificate_orders_operations import ( build_create_or_update_certificate_request, build_create_or_update_request, @@ -119,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -254,7 +266,6 @@ async def validate_purchase_information( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +405,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +419,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +432,7 @@ async def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -438,7 +446,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -459,10 +467,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -470,15 +478,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -595,10 +603,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -658,7 +667,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +801,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -808,11 +815,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -862,7 +865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -878,7 +880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -949,7 +950,6 @@ async def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -964,7 +964,7 @@ async def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -978,7 +978,7 @@ async def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -992,7 +992,7 @@ async def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1014,10 +1014,10 @@ async def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1025,15 +1025,15 @@ async def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1157,10 +1157,11 @@ async def begin_create_or_update_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1223,7 +1224,6 @@ async def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1366,7 +1366,6 @@ async def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1381,11 +1380,7 @@ async def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1507,7 +1502,6 @@ async def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1640,7 +1634,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1696,7 +1689,6 @@ async def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1827,7 +1819,6 @@ async def resend_request_emails( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1958,7 +1949,6 @@ async def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1973,7 +1963,7 @@ async def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2018,7 +2008,6 @@ async def verify_domain_ownership( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2074,7 +2063,6 @@ async def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2089,7 +2077,7 @@ async def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2134,7 +2122,6 @@ async def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2149,7 +2136,7 @@ async def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_app_service_environments_operations.py index 9f6b50bc245b4..7be88393dbd57 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_app_service_environments_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_environments_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_change_vnet_request, @@ -143,7 +157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -159,7 +172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +241,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -245,7 +256,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -311,7 +321,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -326,7 +335,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -339,7 +348,7 @@ async def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -353,7 +362,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -374,10 +383,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -385,18 +394,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -513,10 +519,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -538,9 +545,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -553,7 +560,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -564,10 +571,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -575,12 +582,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -611,7 +626,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -621,6 +636,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -759,7 +775,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -774,14 +789,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -830,7 +838,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -846,7 +853,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -912,7 +918,6 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -927,7 +932,7 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -940,7 +945,7 @@ async def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -954,7 +959,7 @@ async def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -975,10 +980,10 @@ async def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -986,15 +991,15 @@ async def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1123,7 +1128,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1139,13 +1143,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1182,6 +1185,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -1247,7 +1251,6 @@ async def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1262,7 +1265,7 @@ async def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1384,7 +1387,6 @@ async def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1399,7 +1401,7 @@ async def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1444,7 +1446,6 @@ async def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1459,7 +1460,7 @@ async def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1507,7 +1508,6 @@ async def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1522,7 +1522,7 @@ async def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1572,7 +1572,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1588,7 +1587,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1660,7 +1658,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1676,7 +1673,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1744,7 +1740,6 @@ async def get_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1759,7 +1754,7 @@ async def get_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1772,7 +1767,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1786,7 +1781,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1807,10 +1802,10 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1818,15 +1813,15 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1940,10 +1935,11 @@ async def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2079,7 +2075,6 @@ async def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2094,11 +2089,7 @@ async def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2153,7 +2144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2169,7 +2159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2242,7 +2231,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2258,7 +2246,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2329,7 +2316,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2345,7 +2331,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2416,7 +2401,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2432,7 +2416,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2498,7 +2481,6 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2513,7 +2495,7 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2563,7 +2545,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2579,7 +2560,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2652,7 +2632,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2668,7 +2647,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2739,7 +2717,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2754,7 +2731,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2768,7 +2745,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2782,7 +2759,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2804,10 +2781,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2815,15 +2792,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2948,10 +2925,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2975,7 +2955,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2988,7 +2968,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -2999,10 +2979,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3010,18 +2990,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3065,10 +3042,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3126,7 +3104,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3141,7 +3118,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3186,7 +3163,6 @@ async def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3204,7 +3180,7 @@ async def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3217,7 +3193,7 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -3227,10 +3203,10 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3238,15 +3214,15 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3297,7 +3273,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3313,13 +3288,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3354,6 +3328,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3423,7 +3398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3439,7 +3413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3514,7 +3487,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3530,7 +3502,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3560,7 +3531,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3573,7 +3544,7 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -3583,10 +3554,10 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3594,15 +3565,15 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3653,7 +3624,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3669,13 +3639,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3710,6 +3679,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3785,7 +3755,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3801,7 +3770,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3873,7 +3841,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3889,7 +3856,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3960,7 +3926,6 @@ async def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3975,7 +3940,7 @@ async def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3989,7 +3954,7 @@ async def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4003,7 +3968,7 @@ async def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4025,10 +3990,10 @@ async def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4036,15 +4001,15 @@ async def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4167,10 +4132,11 @@ async def begin_create_or_update_worker_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4315,7 +4281,6 @@ async def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4330,11 +4295,7 @@ async def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4390,7 +4351,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4406,7 +4366,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4482,7 +4441,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4498,7 +4456,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4572,7 +4529,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4588,7 +4544,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4662,7 +4617,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4678,7 +4632,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_app_service_plans_operations.py index 73a11f856e308..62c8c83d37a33 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_app_service_plans_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_plans_operations import ( build_create_or_update_request, build_create_or_update_vnet_route_request, @@ -131,7 +145,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -147,7 +160,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -216,7 +228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -301,7 +311,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -316,7 +325,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +338,7 @@ async def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -343,7 +352,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -364,10 +373,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -375,15 +384,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -493,10 +502,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -556,7 +566,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -688,7 +697,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -703,11 +711,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +754,6 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -765,7 +768,7 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -816,7 +819,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -831,7 +833,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -882,7 +884,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -944,7 +945,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -959,7 +959,7 @@ async def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1013,7 +1013,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1029,7 +1028,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1097,7 +1095,6 @@ async def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1112,7 +1109,7 @@ async def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1161,7 +1158,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1173,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1251,7 +1246,6 @@ async def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1329,7 +1323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1345,7 +1338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1411,7 +1403,6 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1426,7 +1417,7 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1480,7 +1471,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1496,7 +1486,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1562,7 +1551,6 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1577,7 +1565,7 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1628,7 +1616,6 @@ async def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1643,7 +1630,7 @@ async def get_vnet_from_server_farm( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1694,7 +1681,6 @@ async def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1709,7 +1695,7 @@ async def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1849,7 +1835,6 @@ async def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1864,7 +1849,7 @@ async def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1912,7 +1897,6 @@ async def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1927,7 +1911,7 @@ async def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1981,7 +1965,6 @@ async def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1996,7 +1979,7 @@ async def get_route_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2143,7 +2126,6 @@ async def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2158,7 +2140,7 @@ async def create_or_update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2212,7 +2194,6 @@ async def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2370,7 +2351,6 @@ async def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2385,7 +2365,7 @@ async def update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2433,7 +2413,6 @@ async def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_certificate_orders_diagnostics_operations.py index 154bd7420872f..bf3a8fea5883f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_orders_diagnostics_operations import ( build_get_app_service_certificate_order_detector_response_request, build_list_app_service_certificate_order_detector_response_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -211,7 +207,6 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +221,7 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_certificate_registration_provider_operations.py index 6cff494003045..33805c164dbbf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_certificate_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_certificates_operations.py index 441dc8323826d..3ada5114d18da 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -105,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -187,7 +183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -203,7 +198,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -269,7 +263,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -284,7 +277,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -404,7 +397,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -419,7 +411,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +456,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +587,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +601,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_deleted_web_apps_operations.py index 4ca8f478fc475..e27ad29c36bfc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_deleted_web_apps_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_web_apps_operations import ( build_get_deleted_web_app_by_location_request, build_list_by_location_request, @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -179,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +257,6 @@ async def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +271,7 @@ async def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_diagnostics_operations.py index ac9725c5349fd..5df16fee76734 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._diagnostics_operations import ( build_execute_site_analysis_request, build_execute_site_analysis_slot_request, @@ -126,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +225,6 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +239,7 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,7 +288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -309,7 +303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +389,6 @@ async def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +403,7 @@ async def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -476,7 +467,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -547,7 +537,6 @@ async def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -562,7 +551,7 @@ async def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -630,7 +618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -704,7 +691,6 @@ async def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,7 +705,7 @@ async def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +773,6 @@ async def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +787,7 @@ async def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -854,7 +839,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -870,7 +854,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -944,7 +927,6 @@ async def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -959,7 +941,7 @@ async def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1027,7 +1009,6 @@ async def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1042,7 +1023,7 @@ async def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1094,7 +1075,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1110,7 +1090,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1201,7 +1180,6 @@ async def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1216,7 +1194,7 @@ async def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1268,7 +1246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1284,7 +1261,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1358,7 +1334,6 @@ async def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1373,7 +1348,7 @@ async def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1428,7 +1403,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1444,7 +1418,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1527,7 +1500,6 @@ async def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1542,7 +1514,7 @@ async def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1614,7 +1586,6 @@ async def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1629,7 +1600,7 @@ async def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1684,7 +1655,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1700,7 +1670,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1783,7 +1752,6 @@ async def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1798,7 +1766,7 @@ async def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1870,7 +1838,6 @@ async def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1885,7 +1852,7 @@ async def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_domain_registration_provider_operations.py index 149a7c76b6c08..e86ad82564005 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_domain_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_domains_operations.py index f1ce9d17fdd07..3d7be8340154f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_check_availability_request, build_create_or_update_ownership_identifier_request, @@ -162,7 +162,6 @@ async def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -177,7 +176,7 @@ async def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -217,7 +216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -233,7 +231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +290,6 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -308,7 +304,7 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -408,7 +404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -424,7 +419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -490,7 +484,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -506,7 +499,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -572,7 +564,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -587,7 +578,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -596,7 +587,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -610,7 +601,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,10 +622,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -642,15 +633,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,10 +747,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -824,7 +816,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -955,7 +946,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -970,11 +960,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1024,7 +1010,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1040,7 +1025,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1111,7 +1095,6 @@ async def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1126,7 +1109,7 @@ async def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1265,7 +1248,6 @@ async def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1280,7 +1262,7 @@ async def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1328,7 +1310,6 @@ async def delete_ownership_identifier( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1478,7 +1459,6 @@ async def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1493,7 +1473,7 @@ async def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1538,7 +1518,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_global_operations_operations.py index c809e8e635746..f1f268e0706f2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_global_operations_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._global_operations_operations import ( build_get_deleted_web_app_request, build_get_deleted_web_app_snapshots_request, @@ -94,7 +92,6 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +106,7 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -149,7 +146,6 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -164,7 +160,7 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -209,7 +205,6 @@ async def get_subscription_operation_with_async_response( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_kube_environments_operations.py index 893e2395eb3dc..63afe30e09cf8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_kube_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_kube_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._kube_environments_operations import ( build_create_or_update_request, build_delete_request, @@ -104,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -189,7 +187,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -205,7 +202,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -271,7 +267,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +281,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -299,7 +294,7 @@ async def _create_or_update_initial( name: str, kube_environment_envelope: Union[_models.KubeEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.KubeEnvironment: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -313,7 +308,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KubeEnvironment] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -334,10 +329,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -345,15 +340,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -466,10 +461,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -491,9 +487,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -506,7 +500,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -516,10 +510,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -527,12 +521,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -557,7 +559,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -566,6 +568,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -704,7 +707,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,11 +721,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_provider_operations.py index e4c592e6a9f46..5b56229d9481c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._provider_operations import ( build_get_available_stacks_on_prem_request, build_get_available_stacks_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -192,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -208,7 +203,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -280,7 +274,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -296,7 +289,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -367,7 +359,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -383,7 +374,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -449,7 +439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -465,7 +454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -533,7 +521,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -549,7 +536,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +606,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -636,7 +621,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_recommendations_operations.py index e750e795b30f1..94413ab0dcef2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_recommendations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommendations_operations import ( build_disable_all_for_hosting_environment_request, build_disable_all_for_web_app_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -198,7 +194,6 @@ async def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +246,6 @@ async def disable_recommendation_for_subscription( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -326,7 +320,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -342,7 +335,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -428,7 +420,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +435,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -515,7 +505,6 @@ async def disable_all_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +563,6 @@ async def reset_all_filters_for_hosting_environment( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +635,6 @@ async def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -662,7 +649,7 @@ async def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -713,7 +700,6 @@ async def disable_recommendation_for_hosting_environment( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -788,7 +774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -804,7 +789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -890,7 +874,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -906,7 +889,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +956,6 @@ async def disable_all_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1030,7 +1011,6 @@ async def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1103,7 +1083,6 @@ async def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1118,7 +1097,7 @@ async def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1145,6 @@ async def disable_recommendation_for_site( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_resource_health_metadata_operations.py index 529cf164b2583..39e58ba603540 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_resource_health_metadata_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._resource_health_metadata_operations import ( build_get_by_site_request, build_get_by_site_slot_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -277,7 +271,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -293,7 +286,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -359,7 +351,6 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +365,7 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -428,7 +419,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +434,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -516,7 +505,6 @@ async def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -531,7 +519,7 @@ async def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_static_sites_operations.py index 63a433a3cc995..6cfb09123638d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._static_sites_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_create_or_update_static_site_app_settings_request, @@ -221,7 +221,6 @@ async def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -236,7 +235,7 @@ async def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -278,7 +277,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -294,7 +292,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -364,7 +361,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -380,7 +376,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -448,7 +443,6 @@ async def get_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -463,7 +457,7 @@ async def get_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -476,7 +470,7 @@ async def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -490,7 +484,7 @@ async def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -511,10 +505,10 @@ async def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -522,15 +516,15 @@ async def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -646,10 +640,11 @@ async def begin_create_or_update_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -671,9 +666,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -686,7 +681,7 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -696,10 +691,10 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -707,12 +702,20 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site( @@ -739,7 +742,7 @@ async def begin_delete_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_initial( # type: ignore + raw_result = await self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -748,6 +751,7 @@ async def begin_delete_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -885,7 +889,6 @@ async def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -900,11 +903,7 @@ async def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -957,7 +956,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -973,7 +971,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1047,7 +1044,6 @@ async def delete_static_site_user( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1201,7 +1197,6 @@ async def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1216,7 +1211,7 @@ async def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1266,7 +1261,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1282,7 +1276,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1353,7 +1346,6 @@ async def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1368,16 +1360,16 @@ async def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1390,7 +1382,7 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -1401,10 +1393,10 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1412,12 +1404,20 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_build( @@ -1446,7 +1446,7 @@ async def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_build_initial( # type: ignore + raw_result = await self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -1456,6 +1456,7 @@ async def begin_delete_static_site_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1602,7 +1603,6 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1617,7 +1617,7 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1749,7 +1749,6 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1764,7 +1763,7 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1817,7 +1816,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1833,7 +1831,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1904,7 +1901,6 @@ async def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1919,7 +1915,7 @@ async def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1967,7 +1963,6 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1982,7 +1977,7 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2035,7 +2030,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2051,7 +2045,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2126,7 +2119,6 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2141,7 +2133,9 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2159,7 +2153,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2173,7 +2167,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2199,10 +2193,10 @@ async def _register_user_provided_function_app_with_static_site_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2210,15 +2204,15 @@ async def _register_user_provided_function_app_with_static_site_build_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2377,10 +2371,13 @@ async def begin_register_user_provided_function_app_with_static_site_build( # p params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2447,7 +2444,6 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2465,14 +2461,14 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2486,7 +2482,7 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2508,10 +2504,10 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2519,12 +2515,20 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -2629,7 +2633,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -2641,6 +2645,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2777,7 +2782,6 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2792,7 +2796,7 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2914,7 +2918,6 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2929,7 +2932,7 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3053,7 +3056,6 @@ async def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3068,7 +3070,7 @@ async def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3118,7 +3120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3134,7 +3135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3205,7 +3205,6 @@ async def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3220,7 +3219,7 @@ async def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3236,7 +3235,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3250,7 +3249,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3275,10 +3274,10 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3286,15 +3285,15 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3425,10 +3424,13 @@ async def begin_create_or_update_static_site_custom_domain( # pylint: disable=n params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3450,9 +3452,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3465,7 +3467,7 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -3476,10 +3478,10 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3487,12 +3489,20 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_custom_domain( @@ -3521,7 +3531,7 @@ async def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = await self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -3531,6 +3541,7 @@ async def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3552,7 +3563,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -3561,7 +3572,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3575,7 +3586,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3600,10 +3611,10 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3611,12 +3622,20 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -3724,7 +3743,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -3736,6 +3755,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3757,9 +3777,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _detach_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3772,7 +3792,7 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -3782,10 +3802,10 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3793,12 +3813,20 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_detach_static_site( @@ -3825,7 +3853,7 @@ async def begin_detach_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._detach_static_site_initial( # type: ignore + raw_result = await self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -3834,6 +3862,7 @@ async def begin_detach_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3898,7 +3927,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3914,7 +3942,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3982,7 +4009,6 @@ async def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3997,7 +4023,7 @@ async def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4042,7 +4068,6 @@ async def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4057,7 +4082,7 @@ async def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4102,7 +4127,6 @@ async def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4117,7 +4141,7 @@ async def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4162,7 +4186,6 @@ async def list_static_site_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4177,7 +4200,7 @@ async def list_static_site_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4227,7 +4250,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4243,7 +4265,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4314,7 +4335,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4329,7 +4349,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4343,7 +4363,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4357,7 +4377,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4379,10 +4399,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4390,15 +4410,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4523,10 +4543,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4550,7 +4573,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4563,7 +4586,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -4574,10 +4597,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4585,18 +4608,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4640,10 +4660,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4701,7 +4722,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4716,7 +4736,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4838,7 +4858,6 @@ async def reset_static_site_api_key( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4899,7 +4918,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4915,7 +4933,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4986,7 +5003,6 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5001,7 +5017,9 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5018,7 +5036,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5032,7 +5050,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5057,10 +5075,10 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5068,15 +5086,15 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5222,10 +5240,13 @@ async def begin_register_user_provided_function_app_with_static_site( # pylint: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5288,7 +5309,6 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5306,13 +5326,13 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5326,7 +5346,7 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5347,10 +5367,10 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5358,12 +5378,20 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -5459,7 +5487,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -5470,6 +5498,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_top_level_domains_operations.py index 87d9512c4a0d7..9a58df6cfe1e2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_level_domains_operations import ( build_get_request, build_list_agreements_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -178,7 +174,6 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_web_apps_operations.py index af6cb4f61086c..09a3baeb8d7da 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_web_apps_operations.py @@ -32,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -45,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_apps_operations import ( build_add_premier_add_on_request, build_add_premier_add_on_slot_request, @@ -503,7 +503,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -519,7 +518,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -592,7 +590,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -608,7 +605,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -677,7 +673,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -692,7 +687,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -701,7 +696,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode async def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -715,7 +710,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -736,10 +731,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -747,15 +742,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -867,10 +862,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -945,7 +941,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1085,7 +1080,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1100,11 +1094,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1152,7 +1142,6 @@ async def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1167,7 +1156,7 @@ async def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1287,7 +1276,6 @@ async def apply_slot_config_to_production( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1416,7 +1404,6 @@ async def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1431,7 +1418,7 @@ async def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1477,7 +1464,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1493,7 +1479,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1564,7 +1549,6 @@ async def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1579,7 +1563,7 @@ async def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1630,7 +1614,6 @@ async def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1783,7 +1766,6 @@ async def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1798,21 +1780,21 @@ async def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_initial( # pylint: disable=inconsistent-return-statements + async def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1826,7 +1808,7 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1848,10 +1830,10 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1859,12 +1841,20 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore( @@ -1964,7 +1954,7 @@ async def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_initial( # type: ignore + raw_result = await self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -1976,6 +1966,7 @@ async def begin_restore( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2040,7 +2031,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2056,7 +2046,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2124,7 +2113,6 @@ async def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2139,7 +2127,7 @@ async def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2263,7 +2251,6 @@ async def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2278,7 +2265,7 @@ async def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2323,7 +2310,6 @@ async def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2338,7 +2324,7 @@ async def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2462,7 +2448,6 @@ async def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2477,7 +2462,7 @@ async def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2526,7 +2511,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2542,7 +2526,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2685,7 +2668,6 @@ async def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2700,7 +2682,7 @@ async def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2745,7 +2727,6 @@ async def list_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2760,7 +2741,7 @@ async def list_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2880,7 +2861,6 @@ async def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2895,7 +2875,7 @@ async def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2938,7 +2918,6 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2953,7 +2932,7 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3073,7 +3052,6 @@ async def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3088,7 +3066,7 @@ async def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3133,7 +3111,6 @@ async def get_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3148,7 +3125,7 @@ async def get_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3270,7 +3247,6 @@ async def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3285,7 +3261,7 @@ async def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3330,7 +3306,6 @@ async def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3345,7 +3320,7 @@ async def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3461,7 +3436,6 @@ async def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3476,7 +3450,7 @@ async def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3521,7 +3495,6 @@ async def delete_backup_configuration( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3577,7 +3550,6 @@ async def get_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3592,7 +3564,7 @@ async def get_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3641,7 +3613,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3657,7 +3628,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3728,7 +3698,6 @@ async def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3743,7 +3712,7 @@ async def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3792,7 +3761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3808,7 +3776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3879,7 +3846,6 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3894,7 +3860,7 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4017,7 +3983,6 @@ async def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4032,7 +3997,7 @@ async def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4077,7 +4042,6 @@ async def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4092,7 +4056,7 @@ async def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4137,7 +4101,6 @@ async def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4152,7 +4115,7 @@ async def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4275,7 +4238,6 @@ async def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4290,7 +4252,7 @@ async def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4406,7 +4368,6 @@ async def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4421,7 +4382,7 @@ async def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4464,7 +4425,6 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4479,7 +4439,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4488,7 +4448,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any async def _list_publishing_credentials_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4501,7 +4461,7 @@ async def _list_publishing_credentials_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -4511,10 +4471,10 @@ async def _list_publishing_credentials_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4522,11 +4482,15 @@ async def _list_publishing_credentials_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4567,10 +4531,11 @@ async def begin_list_publishing_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4701,7 +4666,6 @@ async def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4716,7 +4680,7 @@ async def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4759,7 +4723,6 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4774,7 +4737,7 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4819,7 +4782,6 @@ async def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4834,7 +4796,7 @@ async def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4963,7 +4925,6 @@ async def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4978,7 +4939,7 @@ async def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5023,7 +4984,6 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5038,7 +4998,7 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5158,7 +5118,6 @@ async def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5173,7 +5132,7 @@ async def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5293,7 +5252,6 @@ async def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5308,7 +5266,7 @@ async def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5360,7 +5318,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5376,7 +5333,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5447,7 +5403,6 @@ async def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5462,7 +5417,7 @@ async def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5510,7 +5465,6 @@ async def recover_site_configuration_snapshot( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5566,9 +5520,9 @@ async def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5577,12 +5531,16 @@ async def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5627,9 +5585,9 @@ async def get_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5638,12 +5596,16 @@ async def get_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5692,7 +5654,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5708,7 +5669,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5782,7 +5742,6 @@ async def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5797,7 +5756,7 @@ async def get_continuous_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5845,7 +5804,6 @@ async def delete_continuous_web_job( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5907,7 +5865,6 @@ async def start_continuous_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5969,7 +5926,6 @@ async def stop_continuous_web_job( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6028,7 +5984,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6044,7 +5999,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6113,7 +6067,6 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6128,7 +6081,7 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6258,7 +6211,6 @@ async def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6273,7 +6225,7 @@ async def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6321,7 +6273,6 @@ async def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6381,7 +6332,6 @@ async def list_deployment_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6396,7 +6346,7 @@ async def list_deployment_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6520,7 +6470,6 @@ async def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6535,7 +6484,7 @@ async def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6583,7 +6532,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6599,7 +6547,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6670,7 +6617,6 @@ async def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6685,7 +6631,7 @@ async def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6817,7 +6763,6 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6832,7 +6777,7 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6880,7 +6825,6 @@ async def delete_domain_ownership_identifier( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7023,7 +6967,6 @@ async def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7038,7 +6981,7 @@ async def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7081,7 +7024,6 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7096,7 +7038,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7105,7 +7047,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar async def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7122,7 +7064,7 @@ async def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7143,10 +7085,10 @@ async def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7154,11 +7096,15 @@ async def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7264,10 +7210,11 @@ async def begin_create_ms_deploy_operation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7328,7 +7275,6 @@ async def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7343,7 +7289,7 @@ async def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7395,7 +7341,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7411,7 +7356,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7477,7 +7421,6 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7492,7 +7435,7 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7543,7 +7486,6 @@ async def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7558,7 +7500,7 @@ async def get_function( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7572,7 +7514,7 @@ async def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7586,7 +7528,7 @@ async def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7608,10 +7550,10 @@ async def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7619,11 +7561,15 @@ async def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7743,10 +7689,11 @@ async def begin_create_function( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7812,7 +7759,6 @@ async def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7963,7 +7909,6 @@ async def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7978,11 +7923,7 @@ async def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8036,7 +7977,6 @@ async def delete_function_secret( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8095,7 +8035,6 @@ async def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8110,7 +8049,7 @@ async def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8158,7 +8097,6 @@ async def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8173,7 +8111,7 @@ async def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8216,7 +8154,6 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8231,7 +8168,7 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8276,7 +8213,6 @@ async def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8332,7 +8268,6 @@ async def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8483,7 +8418,6 @@ async def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8498,11 +8432,7 @@ async def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8556,7 +8486,6 @@ async def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8616,7 +8545,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8632,7 +8560,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8703,7 +8630,6 @@ async def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8718,7 +8644,7 @@ async def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8850,7 +8776,6 @@ async def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8865,7 +8790,7 @@ async def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8913,7 +8838,6 @@ async def delete_host_name_binding( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8975,7 +8899,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8990,7 +8913,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9130,7 +9053,6 @@ async def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9145,7 +9067,7 @@ async def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9199,7 +9121,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9350,7 +9271,6 @@ async def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9365,7 +9285,7 @@ async def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9410,7 +9330,6 @@ async def list_hybrid_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9425,7 +9344,7 @@ async def list_hybrid_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9470,7 +9389,6 @@ async def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9485,7 +9403,7 @@ async def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9533,7 +9451,6 @@ async def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9548,7 +9465,7 @@ async def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9679,7 +9596,6 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9694,7 +9610,7 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9745,7 +9661,6 @@ async def delete_relay_service_connection( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9887,7 +9802,6 @@ async def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9902,7 +9816,7 @@ async def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9952,7 +9866,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9968,7 +9881,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10039,7 +9951,6 @@ async def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10054,7 +9965,7 @@ async def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10102,7 +10013,6 @@ async def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10117,7 +10027,7 @@ async def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10131,7 +10041,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10148,7 +10058,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10170,10 +10080,10 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10181,11 +10091,15 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10305,10 +10219,11 @@ async def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10374,7 +10289,6 @@ async def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10389,7 +10303,7 @@ async def get_instance_ms_deploy_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10446,7 +10360,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10462,7 +10375,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10540,7 +10452,6 @@ async def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10555,7 +10466,7 @@ async def get_instance_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10612,7 +10523,6 @@ async def delete_instance_process( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10678,9 +10588,9 @@ async def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10689,11 +10599,15 @@ async def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10754,7 +10668,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10770,7 +10683,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10851,7 +10763,6 @@ async def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10866,7 +10777,7 @@ async def get_instance_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10925,7 +10836,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10941,7 +10851,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11007,7 +10916,6 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11022,7 +10930,7 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11070,7 +10978,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11086,7 +10993,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11154,7 +11060,6 @@ async def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11169,7 +11074,7 @@ async def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11183,7 +11088,7 @@ async def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11197,7 +11102,7 @@ async def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11219,10 +11124,10 @@ async def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11230,11 +11135,15 @@ async def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11358,10 +11267,11 @@ async def begin_migrate_storage( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11389,7 +11299,7 @@ async def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11403,7 +11313,7 @@ async def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11424,10 +11334,10 @@ async def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11435,11 +11345,15 @@ async def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11550,10 +11464,11 @@ async def begin_migrate_my_sql( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11615,7 +11530,6 @@ async def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11630,7 +11544,7 @@ async def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11675,7 +11589,6 @@ async def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11690,7 +11603,7 @@ async def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11830,7 +11743,6 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11845,7 +11757,7 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11893,7 +11805,6 @@ async def delete_swift_virtual_network( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12044,7 +11955,6 @@ async def update_swift_virtual_network_connection_with_check( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12059,7 +11969,7 @@ async def update_swift_virtual_network_connection_with_check( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12110,7 +12020,6 @@ async def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12125,7 +12034,7 @@ async def list_network_features( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12173,7 +12082,6 @@ async def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12188,11 +12096,7 @@ async def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12252,7 +12156,6 @@ async def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12267,7 +12170,7 @@ async def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12282,7 +12185,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12295,7 +12198,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -12308,10 +12211,10 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -12319,15 +12222,15 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12385,10 +12288,11 @@ async def begin_start_web_site_network_trace_operation( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12448,7 +12352,6 @@ async def stop_web_site_network_trace( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12507,7 +12410,6 @@ async def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12522,7 +12424,7 @@ async def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12570,7 +12472,6 @@ async def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12585,11 +12486,7 @@ async def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12637,7 +12534,6 @@ async def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12652,7 +12548,7 @@ async def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12697,7 +12593,6 @@ async def generate_new_site_publishing_password( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12762,7 +12657,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -12778,7 +12672,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -12846,7 +12739,6 @@ async def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12861,7 +12753,7 @@ async def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12904,7 +12796,6 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12919,7 +12810,7 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12967,7 +12858,6 @@ async def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12982,7 +12872,7 @@ async def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13112,7 +13002,6 @@ async def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13127,7 +13016,7 @@ async def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13175,7 +13064,6 @@ async def delete_premier_add_on( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13316,7 +13204,6 @@ async def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13331,7 +13218,7 @@ async def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13376,7 +13263,6 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13391,7 +13277,7 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13513,7 +13399,6 @@ async def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13528,7 +13413,7 @@ async def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13578,7 +13463,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13594,7 +13478,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13665,7 +13548,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13680,7 +13562,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13694,7 +13576,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13708,7 +13590,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -13730,10 +13612,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13741,15 +13623,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13874,10 +13756,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -13901,7 +13786,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13914,7 +13799,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -13925,10 +13810,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13936,18 +13821,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13991,10 +13873,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14052,7 +13935,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14067,7 +13949,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14120,7 +14002,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14136,7 +14017,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14210,7 +14090,6 @@ async def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14225,7 +14104,7 @@ async def get_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14278,7 +14157,6 @@ async def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14340,9 +14218,9 @@ async def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14351,11 +14229,15 @@ async def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14412,7 +14294,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14428,7 +14309,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14505,7 +14385,6 @@ async def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14520,7 +14399,7 @@ async def get_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14575,7 +14454,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14591,7 +14469,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14663,7 +14540,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14679,7 +14555,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14750,7 +14625,6 @@ async def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14765,7 +14639,7 @@ async def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14897,7 +14771,6 @@ async def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14912,7 +14785,7 @@ async def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14960,7 +14833,6 @@ async def delete_public_certificate( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15096,9 +14968,9 @@ async def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15107,11 +14979,15 @@ async def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15158,7 +15034,6 @@ async def reset_production_slot_config( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15228,7 +15103,6 @@ async def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15246,9 +15120,9 @@ async def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15262,7 +15136,7 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15283,10 +15157,10 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15294,12 +15168,20 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob( @@ -15386,7 +15268,7 @@ async def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -15397,6 +15279,7 @@ async def begin_restore_from_backup_blob( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15418,13 +15301,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15438,7 +15321,7 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15459,10 +15342,10 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15470,12 +15353,20 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app( @@ -15566,7 +15457,7 @@ async def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -15577,6 +15468,7 @@ async def begin_restore_from_deleted_app( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15598,13 +15490,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15618,7 +15510,7 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15639,10 +15531,10 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15650,12 +15542,20 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot( @@ -15749,7 +15649,7 @@ async def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_initial( # type: ignore + raw_result = await self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -15760,6 +15660,7 @@ async def begin_restore_snapshot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15826,7 +15727,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15842,7 +15742,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15916,7 +15815,6 @@ async def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15931,7 +15829,7 @@ async def get_site_extension( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15940,7 +15838,7 @@ async def get_site_extension( async def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15957,7 +15855,7 @@ async def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -15968,10 +15866,10 @@ async def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15979,15 +15877,15 @@ async def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16033,10 +15931,11 @@ async def begin_install_site_extension( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16102,7 +16001,6 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16159,7 +16057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16175,7 +16072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16248,7 +16144,6 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16263,7 +16158,7 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16277,7 +16172,7 @@ async def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16291,7 +16186,7 @@ async def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16313,10 +16208,10 @@ async def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16324,15 +16219,15 @@ async def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16461,10 +16356,11 @@ async def begin_create_or_update_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16544,7 +16440,6 @@ async def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16697,7 +16592,6 @@ async def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16712,11 +16606,7 @@ async def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16768,7 +16658,6 @@ async def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16783,7 +16672,7 @@ async def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16916,7 +16805,6 @@ async def apply_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17062,7 +16950,6 @@ async def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17077,7 +16964,7 @@ async def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17129,7 +17016,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17145,7 +17031,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17220,7 +17105,6 @@ async def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17235,7 +17119,7 @@ async def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17290,7 +17174,6 @@ async def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17456,7 +17339,6 @@ async def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17471,14 +17353,14 @@ async def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -17486,7 +17368,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17500,7 +17382,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17523,10 +17405,10 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17534,12 +17416,20 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_slot( @@ -17651,7 +17541,7 @@ async def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_slot_initial( # type: ignore + raw_result = await self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -17664,6 +17554,7 @@ async def begin_restore_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -17731,7 +17622,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17747,7 +17637,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17818,7 +17707,6 @@ async def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17833,7 +17721,7 @@ async def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17967,7 +17855,6 @@ async def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17982,7 +17869,7 @@ async def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18030,7 +17917,6 @@ async def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18045,7 +17931,7 @@ async def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18179,7 +18065,6 @@ async def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18194,7 +18079,7 @@ async def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18247,7 +18132,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18263,7 +18147,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18419,7 +18302,6 @@ async def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18434,7 +18316,7 @@ async def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18483,7 +18365,6 @@ async def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18498,7 +18379,7 @@ async def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18631,7 +18512,6 @@ async def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18646,7 +18526,7 @@ async def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18695,7 +18575,6 @@ async def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18710,7 +18589,7 @@ async def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18843,7 +18722,6 @@ async def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18858,7 +18736,7 @@ async def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18907,7 +18785,6 @@ async def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18922,7 +18799,7 @@ async def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19057,7 +18934,6 @@ async def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19072,7 +18948,7 @@ async def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19121,7 +18997,6 @@ async def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19136,7 +19011,7 @@ async def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19269,7 +19144,6 @@ async def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19284,7 +19158,7 @@ async def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19333,7 +19207,6 @@ async def delete_backup_configuration_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19393,7 +19266,6 @@ async def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19408,7 +19280,7 @@ async def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19460,7 +19332,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19476,7 +19347,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19550,7 +19420,6 @@ async def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19565,7 +19434,7 @@ async def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19617,7 +19486,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19633,7 +19501,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19707,7 +19574,6 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19722,7 +19588,7 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19858,7 +19724,6 @@ async def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19873,7 +19738,7 @@ async def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19922,7 +19787,6 @@ async def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19937,7 +19801,7 @@ async def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19986,7 +19850,6 @@ async def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20001,7 +19864,7 @@ async def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20137,7 +20000,6 @@ async def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20152,7 +20014,7 @@ async def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20285,7 +20147,6 @@ async def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20300,7 +20161,7 @@ async def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20349,7 +20210,6 @@ async def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20364,7 +20224,7 @@ async def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20373,7 +20233,7 @@ async def list_metadata_slot( async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20386,7 +20246,7 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -20397,10 +20257,10 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20408,11 +20268,15 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20457,10 +20321,11 @@ async def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20608,7 +20473,6 @@ async def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20623,7 +20487,7 @@ async def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20672,7 +20536,6 @@ async def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20687,7 +20550,7 @@ async def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20738,7 +20601,6 @@ async def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20753,7 +20615,7 @@ async def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20886,7 +20748,6 @@ async def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20901,7 +20762,7 @@ async def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21034,7 +20895,6 @@ async def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21049,7 +20909,7 @@ async def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21105,7 +20965,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21121,7 +20980,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21196,7 +21054,6 @@ async def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21211,7 +21068,7 @@ async def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21263,7 +21120,6 @@ async def recover_site_configuration_snapshot_slot( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21323,9 +21179,9 @@ async def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21334,12 +21190,16 @@ async def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21388,9 +21248,9 @@ async def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21399,12 +21259,16 @@ async def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21457,7 +21321,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21473,7 +21336,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21551,7 +21413,6 @@ async def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21566,7 +21427,7 @@ async def get_continuous_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21618,7 +21479,6 @@ async def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21684,7 +21544,6 @@ async def start_continuous_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21750,7 +21609,6 @@ async def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21813,7 +21671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21829,7 +21686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21904,7 +21760,6 @@ async def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21919,7 +21774,7 @@ async def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22062,7 +21917,6 @@ async def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22077,7 +21931,7 @@ async def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22129,7 +21983,6 @@ async def delete_deployment_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22193,7 +22046,6 @@ async def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22208,7 +22060,7 @@ async def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22349,7 +22201,6 @@ async def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22364,7 +22215,7 @@ async def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22416,7 +22267,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22432,7 +22282,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22507,7 +22356,6 @@ async def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22522,7 +22370,7 @@ async def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22667,7 +22515,6 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22682,7 +22529,7 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22734,7 +22581,6 @@ async def delete_domain_ownership_identifier_slot( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22890,7 +22736,6 @@ async def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22905,7 +22750,7 @@ async def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22954,7 +22799,6 @@ async def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22969,7 +22813,7 @@ async def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22983,7 +22827,7 @@ async def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23000,7 +22844,7 @@ async def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23022,10 +22866,10 @@ async def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23033,11 +22877,15 @@ async def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23160,10 +23008,11 @@ async def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23230,7 +23079,6 @@ async def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23245,7 +23093,7 @@ async def get_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23300,7 +23148,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23316,7 +23163,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23388,7 +23234,6 @@ async def get_functions_admin_token_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23403,7 +23248,7 @@ async def get_functions_admin_token_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23457,7 +23302,6 @@ async def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23472,7 +23316,7 @@ async def get_instance_function_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23487,7 +23331,7 @@ async def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23501,7 +23345,7 @@ async def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23524,10 +23368,10 @@ async def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23535,11 +23379,15 @@ async def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23669,10 +23517,11 @@ async def begin_create_instance_function_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23741,7 +23590,6 @@ async def delete_instance_function_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23902,7 +23750,6 @@ async def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23917,11 +23764,7 @@ async def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23978,7 +23821,6 @@ async def delete_function_secret_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24040,7 +23882,6 @@ async def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24055,7 +23896,7 @@ async def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24106,7 +23947,6 @@ async def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24121,7 +23961,7 @@ async def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24169,7 +24009,6 @@ async def list_host_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24184,7 +24023,7 @@ async def list_host_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24232,7 +24071,6 @@ async def list_sync_status_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24291,7 +24129,6 @@ async def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24452,7 +24289,6 @@ async def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24467,11 +24303,7 @@ async def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24528,7 +24360,6 @@ async def delete_host_secret_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24592,7 +24423,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24608,7 +24438,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24683,7 +24512,6 @@ async def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24698,7 +24526,7 @@ async def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24843,7 +24671,6 @@ async def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24858,7 +24685,7 @@ async def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24910,7 +24737,6 @@ async def delete_host_name_binding_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24975,7 +24801,6 @@ async def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24990,7 +24815,7 @@ async def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25140,7 +24965,6 @@ async def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25155,7 +24979,7 @@ async def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25212,7 +25036,6 @@ async def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25373,7 +25196,6 @@ async def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25388,7 +25210,7 @@ async def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25436,7 +25258,6 @@ async def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25451,7 +25272,7 @@ async def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25500,7 +25321,6 @@ async def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25515,7 +25335,7 @@ async def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25567,7 +25387,6 @@ async def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25582,7 +25401,7 @@ async def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25726,7 +25545,6 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25741,7 +25559,7 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25796,7 +25614,6 @@ async def delete_relay_service_connection_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25951,7 +25768,6 @@ async def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25966,7 +25782,7 @@ async def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26020,7 +25836,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26036,7 +25851,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26111,7 +25925,6 @@ async def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26126,7 +25939,7 @@ async def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26178,7 +25991,6 @@ async def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26193,7 +26005,7 @@ async def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26208,7 +26020,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26225,7 +26037,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26248,10 +26060,10 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26259,11 +26071,15 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26396,10 +26212,11 @@ async def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=nam params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26469,7 +26286,6 @@ async def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26484,7 +26300,7 @@ async def get_instance_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26545,7 +26361,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26561,7 +26376,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26643,7 +26457,6 @@ async def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26658,7 +26471,7 @@ async def get_instance_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26719,7 +26532,6 @@ async def delete_instance_process_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26789,9 +26601,9 @@ async def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26800,11 +26612,15 @@ async def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26869,7 +26685,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26885,7 +26700,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26977,7 +26791,6 @@ async def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26992,7 +26805,7 @@ async def get_instance_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27055,7 +26868,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27071,7 +26883,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27143,7 +26954,6 @@ async def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27158,7 +26968,7 @@ async def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27210,7 +27020,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27226,7 +27035,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27297,7 +27105,6 @@ async def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27312,7 +27119,7 @@ async def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27362,7 +27169,6 @@ async def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27377,7 +27183,7 @@ async def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27426,7 +27232,6 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27441,7 +27246,7 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27594,7 +27399,6 @@ async def create_or_update_swift_virtual_network_connection_with_check_slot( # headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27609,7 +27413,7 @@ async def create_or_update_swift_virtual_network_connection_with_check_slot( # error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27661,7 +27465,6 @@ async def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27825,7 +27628,6 @@ async def update_swift_virtual_network_connection_with_check_slot( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27840,7 +27642,7 @@ async def update_swift_virtual_network_connection_with_check_slot( # pylint: di error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27895,7 +27697,6 @@ async def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27910,7 +27711,7 @@ async def list_network_features_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27962,7 +27763,6 @@ async def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27977,11 +27777,7 @@ async def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28045,7 +27841,6 @@ async def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28060,7 +27855,7 @@ async def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28076,7 +27871,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28089,7 +27884,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -28103,10 +27898,10 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28114,15 +27909,15 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28184,10 +27979,11 @@ async def begin_start_web_site_network_trace_operation_slot( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28250,7 +28046,6 @@ async def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28313,7 +28108,6 @@ async def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28328,7 +28122,7 @@ async def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28380,7 +28174,6 @@ async def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28395,11 +28188,7 @@ async def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28451,7 +28240,6 @@ async def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28466,7 +28254,7 @@ async def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28515,7 +28303,6 @@ async def generate_new_site_publishing_password_slot( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28584,7 +28371,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28600,7 +28386,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28672,7 +28457,6 @@ async def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28687,7 +28471,7 @@ async def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28736,7 +28520,6 @@ async def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28751,7 +28534,7 @@ async def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28803,7 +28586,6 @@ async def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28818,7 +28600,7 @@ async def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28961,7 +28743,6 @@ async def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28976,7 +28757,7 @@ async def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29028,7 +28809,6 @@ async def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29182,7 +28962,6 @@ async def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29197,7 +28976,7 @@ async def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29247,7 +29026,6 @@ async def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29262,7 +29040,7 @@ async def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29398,7 +29176,6 @@ async def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29413,7 +29190,7 @@ async def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29466,7 +29243,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29482,7 +29258,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29556,7 +29331,6 @@ async def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29571,7 +29345,7 @@ async def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29586,7 +29360,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29600,7 +29374,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29623,10 +29397,10 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29634,15 +29408,15 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29777,10 +29551,13 @@ async def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29804,7 +29581,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29817,7 +29594,7 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -29829,10 +29606,10 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29840,18 +29617,15 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29898,10 +29672,11 @@ async def begin_delete_private_endpoint_connection_slot( # pylint: disable=name params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29962,7 +29737,6 @@ async def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29977,7 +29751,7 @@ async def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30034,7 +29808,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30050,7 +29823,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30128,7 +29900,6 @@ async def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30143,7 +29914,7 @@ async def get_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30200,7 +29971,6 @@ async def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30266,9 +30036,9 @@ async def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30277,11 +30047,15 @@ async def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30342,7 +30116,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30358,7 +30131,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30439,7 +30211,6 @@ async def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30454,7 +30225,7 @@ async def get_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30513,7 +30284,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30529,7 +30299,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30605,7 +30374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30621,7 +30389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30696,7 +30463,6 @@ async def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30711,7 +30477,7 @@ async def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30856,7 +30622,6 @@ async def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30871,7 +30636,7 @@ async def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30923,7 +30688,6 @@ async def delete_public_certificate_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31072,9 +30836,9 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -31083,11 +30847,15 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31138,7 +30906,6 @@ async def reset_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31213,7 +30980,6 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31231,14 +30997,14 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31252,7 +31018,7 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31274,10 +31040,10 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31285,12 +31051,20 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob_slot( @@ -31393,7 +31167,7 @@ async def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -31405,6 +31179,7 @@ async def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31426,14 +31201,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31447,7 +31222,7 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31469,10 +31244,10 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31480,12 +31255,20 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app_slot( @@ -31588,7 +31371,7 @@ async def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -31600,6 +31383,7 @@ async def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31621,14 +31405,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31642,7 +31426,7 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31664,10 +31448,10 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31675,12 +31459,20 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot_slot( @@ -31786,7 +31578,7 @@ async def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_slot_initial( # type: ignore + raw_result = await self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -31798,6 +31590,7 @@ async def begin_restore_snapshot_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31868,7 +31661,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31884,7 +31676,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31962,7 +31753,6 @@ async def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31977,7 +31767,7 @@ async def get_site_extension_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31986,7 +31776,7 @@ async def get_site_extension_slot( async def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32003,7 +31793,7 @@ async def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -32015,10 +31805,10 @@ async def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32026,15 +31816,15 @@ async def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32084,10 +31874,11 @@ async def begin_install_site_extension_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32157,7 +31948,6 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32306,7 +32096,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32322,7 +32111,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32352,14 +32140,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32373,7 +32161,7 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32395,10 +32183,10 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32406,12 +32194,20 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot( @@ -32514,7 +32310,7 @@ async def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_initial( # type: ignore + raw_result = await self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -32526,6 +32322,7 @@ async def begin_swap_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32591,7 +32388,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32607,7 +32403,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32681,7 +32476,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32697,7 +32491,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32769,7 +32562,6 @@ async def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32784,14 +32576,7 @@ async def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32805,7 +32590,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32819,7 +32604,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32841,10 +32626,10 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32852,18 +32637,15 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32991,10 +32773,11 @@ async def begin_create_or_update_source_control_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33064,7 +32847,6 @@ async def delete_source_control_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33210,7 +32992,6 @@ async def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33225,14 +33006,7 @@ async def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33281,7 +33055,6 @@ async def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33308,7 +33081,7 @@ async def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33321,7 +33094,7 @@ async def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -33335,10 +33108,10 @@ async def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33346,15 +33119,15 @@ async def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33416,10 +33189,11 @@ async def begin_start_network_trace_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33483,7 +33257,6 @@ async def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33542,7 +33315,6 @@ async def stop_network_trace_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33602,7 +33374,6 @@ async def sync_repository_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33661,7 +33432,6 @@ async def sync_function_triggers_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33725,7 +33495,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33741,7 +33510,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33819,7 +33587,6 @@ async def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33834,7 +33601,7 @@ async def get_triggered_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33886,7 +33653,6 @@ async def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33956,7 +33722,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33972,7 +33737,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34053,7 +33817,6 @@ async def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34068,7 +33831,7 @@ async def get_triggered_web_job_history_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34123,7 +33886,6 @@ async def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34193,7 +33955,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34209,7 +33970,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34281,7 +34041,6 @@ async def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34296,7 +34055,7 @@ async def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34348,7 +34107,6 @@ async def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34363,7 +34121,7 @@ async def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34514,7 +34272,6 @@ async def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34529,7 +34286,7 @@ async def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34584,7 +34341,6 @@ async def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34746,7 +34502,6 @@ async def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34761,7 +34516,7 @@ async def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34820,7 +34575,6 @@ async def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34835,7 +34589,7 @@ async def get_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34991,7 +34745,6 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35006,7 +34759,7 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35162,7 +34915,6 @@ async def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35177,7 +34929,7 @@ async def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35229,7 +34981,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35245,7 +34996,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35320,7 +35070,6 @@ async def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35335,7 +35084,7 @@ async def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35460,7 +35209,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35476,7 +35224,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35506,13 +35253,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35526,7 +35273,7 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -35547,10 +35294,10 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35558,12 +35305,20 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot_with_production( @@ -35654,7 +35409,7 @@ async def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_with_production_initial( # type: ignore + raw_result = await self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -35665,6 +35420,7 @@ async def begin_swap_slot_with_production( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -35725,7 +35481,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35741,7 +35496,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35812,7 +35566,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35828,7 +35581,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35894,7 +35646,6 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35909,14 +35660,7 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35929,7 +35673,7 @@ async def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35943,7 +35687,7 @@ async def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -35964,10 +35708,10 @@ async def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35975,18 +35719,15 @@ async def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36101,10 +35842,11 @@ async def begin_create_or_update_source_control( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36170,7 +35912,6 @@ async def delete_source_control( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36303,7 +36044,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36318,14 +36058,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36370,7 +36103,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36396,7 +36128,7 @@ async def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36409,7 +36141,7 @@ async def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -36422,10 +36154,10 @@ async def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36433,15 +36165,15 @@ async def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36499,10 +36231,11 @@ async def begin_start_network_trace( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36562,7 +36295,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36618,7 +36350,6 @@ async def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36674,7 +36405,6 @@ async def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36730,7 +36460,6 @@ async def sync_function_triggers( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36790,7 +36519,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36806,7 +36534,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36880,7 +36607,6 @@ async def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36895,7 +36621,7 @@ async def get_triggered_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36943,7 +36669,6 @@ async def delete_triggered_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37009,7 +36734,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37025,7 +36749,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37102,7 +36825,6 @@ async def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37117,7 +36839,7 @@ async def get_triggered_web_job_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37168,7 +36890,6 @@ async def run_triggered_web_job( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37234,7 +36955,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37250,7 +36970,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37316,7 +37035,6 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37331,7 +37049,7 @@ async def list_vnet_connections(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37379,7 +37097,6 @@ async def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37394,7 +37111,7 @@ async def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37532,7 +37249,6 @@ async def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37547,7 +37263,7 @@ async def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37598,7 +37314,6 @@ async def delete_vnet_connection( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37747,7 +37462,6 @@ async def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37762,7 +37476,7 @@ async def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37817,7 +37531,6 @@ async def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37832,7 +37545,7 @@ async def get_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37975,7 +37688,6 @@ async def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37990,7 +37702,7 @@ async def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38133,7 +37845,6 @@ async def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38148,7 +37859,7 @@ async def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38194,7 +37905,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38210,7 +37920,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38281,7 +37990,6 @@ async def get_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38296,7 +38004,7 @@ async def get_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_web_site_management_client_operations.py index e4831a11202ba..dd7187e953217 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/aio/operations/_web_site_management_client_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_site_management_client_operations import ( build_check_name_availability_request, build_get_publishing_user_request, @@ -96,7 +94,6 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +108,7 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -200,7 +197,6 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,7 +253,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -273,7 +268,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -337,7 +331,6 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -352,7 +345,7 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +453,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -475,7 +467,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -526,7 +518,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -542,7 +533,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +610,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -635,7 +624,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -675,7 +664,6 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -690,7 +678,7 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -756,7 +744,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -772,7 +759,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -892,7 +878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -908,7 +893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +958,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -990,7 +973,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1052,7 +1034,6 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1067,7 +1048,7 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1147,6 @@ async def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1181,7 +1161,7 @@ async def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1294,7 +1274,6 @@ async def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1414,7 +1393,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1429,7 +1407,7 @@ async def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1542,7 +1520,6 @@ async def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_app_service_certificate_orders_operations.py index 5da906c1ceb73..145deaf9f4400 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -866,7 +867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -882,7 +882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1001,7 +1000,6 @@ def validate_purchase_information( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1075,7 +1072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1143,7 +1139,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1158,7 +1153,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1171,7 +1166,7 @@ def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1185,7 +1180,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1206,10 +1201,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1217,15 +1212,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1342,10 +1337,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1405,7 +1401,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1540,7 +1535,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1555,11 +1549,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1609,7 +1599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1625,7 +1614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1696,7 +1684,6 @@ def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1711,7 +1698,7 @@ def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1725,7 +1712,7 @@ def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1739,7 +1726,7 @@ def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1761,10 +1748,10 @@ def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1772,15 +1759,15 @@ def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1904,10 +1891,11 @@ def begin_create_or_update_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1970,7 +1958,6 @@ def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2113,7 +2100,6 @@ def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2128,11 +2114,7 @@ def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2254,7 +2236,6 @@ def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2387,7 +2368,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2443,7 +2423,6 @@ def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2574,7 +2553,6 @@ def resend_request_emails( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2705,7 +2683,6 @@ def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2720,7 +2697,7 @@ def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2765,7 +2742,6 @@ def verify_domain_ownership( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2821,7 +2797,6 @@ def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2836,7 +2811,7 @@ def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2881,7 +2856,6 @@ def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2896,7 +2870,7 @@ def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_app_service_environments_operations.py index f1290afb22ad1..62bfbbf554406 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1760,7 +1761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1776,7 +1776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1846,7 +1845,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1862,7 +1860,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1928,7 +1925,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1943,7 +1939,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1956,7 +1952,7 @@ def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1970,7 +1966,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1991,10 +1987,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2002,18 +1998,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2130,10 +2123,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2155,9 +2149,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2170,7 +2164,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -2181,10 +2175,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2192,12 +2186,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -2228,7 +2230,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -2238,6 +2240,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2376,7 +2379,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2391,14 +2393,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2444,7 +2439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2460,7 +2454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2526,7 +2519,6 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2541,7 +2533,7 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2554,7 +2546,7 @@ def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2568,7 +2560,7 @@ def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2589,10 +2581,10 @@ def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2600,15 +2592,15 @@ def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2737,7 +2729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2753,13 +2744,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2796,6 +2786,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2861,7 +2852,6 @@ def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2876,7 +2866,7 @@ def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2998,7 +2988,6 @@ def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3013,7 +3002,7 @@ def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3058,7 +3047,6 @@ def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3073,7 +3061,7 @@ def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3121,7 +3109,6 @@ def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3136,7 +3123,7 @@ def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3186,7 +3173,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3202,7 +3188,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3273,7 +3258,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3289,7 +3273,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3355,7 +3338,6 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3370,7 +3352,7 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3383,7 +3365,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3397,7 +3379,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3418,10 +3400,10 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3429,15 +3411,15 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3548,10 +3530,11 @@ def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3687,7 +3670,6 @@ def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3702,11 +3684,7 @@ def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3761,7 +3739,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3777,7 +3754,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3850,7 +3826,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3866,7 +3841,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3937,7 +3911,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3953,7 +3926,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4022,7 +3994,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4038,7 +4009,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4104,7 +4074,6 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4119,7 +4088,7 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4169,7 +4138,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4185,7 +4153,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4258,7 +4225,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4274,7 +4240,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4345,7 +4310,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4360,7 +4324,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4374,7 +4338,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4388,7 +4352,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4410,10 +4374,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4421,15 +4385,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4554,10 +4518,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4581,7 +4548,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4594,7 +4561,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -4605,10 +4572,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4616,18 +4583,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4671,10 +4635,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4732,7 +4697,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4747,7 +4711,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4792,7 +4756,6 @@ def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4810,7 +4773,7 @@ def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4823,7 +4786,7 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -4833,10 +4796,10 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4844,15 +4807,15 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4901,7 +4864,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4917,13 +4879,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4958,6 +4919,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5026,7 +4988,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5042,7 +5003,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5117,7 +5077,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5133,7 +5092,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5163,7 +5121,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5176,7 +5134,7 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -5186,10 +5144,10 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5197,15 +5155,15 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5254,7 +5212,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5270,13 +5227,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -5311,6 +5267,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5385,7 +5342,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5401,7 +5357,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5472,7 +5427,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5488,7 +5442,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5559,7 +5512,6 @@ def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5574,7 +5526,7 @@ def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5588,7 +5540,7 @@ def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5602,7 +5554,7 @@ def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5624,10 +5576,10 @@ def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5635,15 +5587,15 @@ def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5763,10 +5715,11 @@ def begin_create_or_update_worker_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5911,7 +5864,6 @@ def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5926,11 +5878,7 @@ def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5986,7 +5934,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6002,7 +5949,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6078,7 +6024,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6094,7 +6039,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6168,7 +6112,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6184,7 +6127,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6258,7 +6200,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6274,7 +6215,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_app_service_plans_operations.py index e8db997665424..967df5a105524 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1161,7 +1162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1243,7 +1242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1259,7 +1257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1328,7 +1325,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1343,7 +1339,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1356,7 +1352,7 @@ def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1370,7 +1366,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1391,10 +1387,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1402,15 +1398,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1520,10 +1516,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1583,7 +1580,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1715,7 +1711,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1730,11 +1725,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1777,7 +1768,6 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1792,7 +1782,7 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1843,7 +1833,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1858,7 +1847,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1909,7 +1898,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1971,7 +1959,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1986,7 +1973,7 @@ def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2040,7 +2027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2056,7 +2042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2124,7 +2109,6 @@ def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2139,7 +2123,7 @@ def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2187,7 +2171,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2203,7 +2186,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2277,7 +2259,6 @@ def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2355,7 +2336,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2371,7 +2351,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2437,7 +2416,6 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2452,7 +2430,7 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2505,7 +2483,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2521,7 +2498,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2587,7 +2563,6 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2602,7 +2577,7 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2653,7 +2628,6 @@ def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2668,7 +2642,7 @@ def get_vnet_from_server_farm( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2719,7 +2693,6 @@ def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2734,7 +2707,7 @@ def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2874,7 +2847,6 @@ def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2889,7 +2861,7 @@ def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2937,7 +2909,6 @@ def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2952,7 +2923,7 @@ def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3006,7 +2977,6 @@ def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3021,7 +2991,7 @@ def get_route_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3168,7 +3138,6 @@ def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3183,7 +3152,7 @@ def create_or_update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3237,7 +3206,6 @@ def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3395,7 +3363,6 @@ def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3410,7 +3377,7 @@ def update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3458,7 +3425,6 @@ def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_certificate_orders_diagnostics_operations.py index 009908fc43c7f..6c4bfa54ccf9c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -195,7 +194,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -211,7 +209,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -299,7 +296,6 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -314,7 +310,7 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_certificate_registration_provider_operations.py index cfbb6bc536342..d5ff064c8b5aa 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_certificate_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_certificates_operations.py index f4cabfb85372b..999cf430b85cd 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_certificates_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -312,7 +311,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +326,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -394,7 +391,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -410,7 +406,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -476,7 +471,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -491,7 +485,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -611,7 +605,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -626,7 +619,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -671,7 +664,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -803,7 +795,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -818,7 +809,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_deleted_web_apps_operations.py index 0d93281c1a246..059712b741b89 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_deleted_web_apps_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -176,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -192,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -342,7 +337,6 @@ def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +351,7 @@ def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_diagnostics_operations.py index 32b53f4ae18a9..abd5d46d9895a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1101,7 +1100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1117,7 +1115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1204,7 +1201,6 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1219,7 +1215,7 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1267,7 +1263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1283,7 +1278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1370,7 +1364,6 @@ def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1385,7 +1378,7 @@ def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1433,7 +1426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1449,7 +1441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1520,7 +1511,6 @@ def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1535,7 +1525,7 @@ def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1602,7 +1591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1676,7 +1664,6 @@ def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1678,7 @@ def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1759,7 +1746,6 @@ def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,7 +1760,7 @@ def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1825,7 +1811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1841,7 +1826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1915,7 +1899,6 @@ def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1930,7 +1913,7 @@ def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,7 +1981,6 @@ def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2013,7 +1995,7 @@ def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,7 +2046,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2080,7 +2061,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2171,7 +2151,6 @@ def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2186,7 +2165,7 @@ def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2237,7 +2216,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2253,7 +2231,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2327,7 +2304,6 @@ def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2342,7 +2318,7 @@ def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2396,7 +2372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2412,7 +2387,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2495,7 +2469,6 @@ def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2510,7 +2483,7 @@ def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2582,7 +2555,6 @@ def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2597,7 +2569,7 @@ def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2651,7 +2623,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2667,7 +2638,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2750,7 +2720,6 @@ def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2765,7 +2734,7 @@ def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinition", pipeline_response) + deserialized = self._deserialize("DetectorDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2837,7 +2806,6 @@ def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2852,7 +2820,7 @@ def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_domain_registration_provider_operations.py index 1956ca118af94..fad6ea7b1c67b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_domain_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_domains_operations.py index 06b0b7da0f9e2..51530c1cb9467 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -694,7 +695,6 @@ def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -709,7 +709,7 @@ def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -749,7 +749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -765,7 +764,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -825,7 +823,6 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -840,7 +837,7 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -937,7 +934,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -953,7 +949,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1019,7 +1014,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1035,7 +1029,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1101,7 +1094,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1116,7 +1108,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1125,7 +1117,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1139,7 +1131,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1160,10 +1152,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1171,15 +1163,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1282,10 +1274,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1350,7 +1343,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1481,7 +1473,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1496,11 +1487,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1550,7 +1537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1566,7 +1552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1637,7 +1622,6 @@ def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1652,7 +1636,7 @@ def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1791,7 +1775,6 @@ def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1806,7 +1789,7 @@ def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1854,7 +1837,6 @@ def delete_ownership_identifier( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2004,7 +1986,6 @@ def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2019,7 +2000,7 @@ def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,7 +2045,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_global_operations_operations.py index 1a26d7f6b4880..81d667e723c1f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_global_operations_operations.py @@ -18,15 +18,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -194,7 +192,7 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -234,7 +232,6 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -249,7 +246,7 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -294,7 +291,6 @@ def get_subscription_operation_with_async_response( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_kube_environments_operations.py index 9cec6232d2c86..9d1dabcb78d1a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_kube_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_kube_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -308,7 +309,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -324,7 +324,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -390,7 +389,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -406,7 +404,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -472,7 +469,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Kub headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +483,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Kub error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -500,7 +496,7 @@ def _create_or_update_initial( name: str, kube_environment_envelope: Union[_models.KubeEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.KubeEnvironment: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -514,7 +510,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KubeEnvironment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -535,10 +531,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -546,15 +542,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -667,10 +663,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -692,9 +689,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -707,7 +702,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -717,10 +712,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -728,12 +723,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -758,7 +761,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -767,6 +770,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -905,7 +909,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -920,11 +923,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_provider_operations.py index 9688847c6d278..8b6ea235237d0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -273,7 +272,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -289,7 +287,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -357,7 +354,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -373,7 +369,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -444,7 +439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -460,7 +454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -531,7 +524,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -547,7 +539,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -613,7 +604,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -629,7 +619,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -697,7 +686,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -713,7 +701,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -784,7 +771,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -800,7 +786,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_recommendations_operations.py index a090487d53ba1..bbfaf5a9a3244 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_recommendations_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -730,7 +729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -746,7 +744,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -806,7 +803,6 @@ def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -859,7 +855,6 @@ def disable_recommendation_for_subscription( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -933,7 +928,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -949,7 +943,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1034,7 +1027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1050,7 +1042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1121,7 +1112,6 @@ def disable_all_for_hosting_environment( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1180,7 +1170,6 @@ def reset_all_filters_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1253,7 +1242,6 @@ def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1268,7 +1256,7 @@ def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1319,7 +1307,6 @@ def disable_recommendation_for_hosting_environment( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1393,7 +1380,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1409,7 +1395,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1494,7 +1479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1510,7 +1494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1578,7 +1561,6 @@ def disable_all_for_web_app( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1634,7 +1616,6 @@ def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1688,6 @@ def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1722,7 +1702,7 @@ def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1770,7 +1750,6 @@ def disable_recommendation_for_site( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_resource_health_metadata_operations.py index 8dc695161bc8c..189dbe1561bf5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_resource_health_metadata_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -389,7 +386,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -405,7 +401,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -477,7 +472,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -493,7 +487,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -559,7 +552,6 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +566,7 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -627,7 +619,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -643,7 +634,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -715,7 +705,6 @@ def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -730,7 +719,7 @@ def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_static_sites_operations.py index cc698e8193cf0..7b3e50e892e6e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -2086,7 +2087,6 @@ def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2101,7 +2101,7 @@ def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2142,7 +2142,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2158,7 +2157,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2227,7 +2225,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2243,7 +2240,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2309,7 +2305,6 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2324,7 +2319,7 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2337,7 +2332,7 @@ def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2351,7 +2346,7 @@ def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2372,10 +2367,10 @@ def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2383,15 +2378,15 @@ def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2504,10 +2499,11 @@ def begin_create_or_update_static_site( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2529,9 +2525,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2544,7 +2538,7 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -2554,10 +2548,10 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2565,12 +2559,20 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -2595,7 +2597,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_initial( # type: ignore + raw_result = self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -2604,6 +2606,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2741,7 +2744,6 @@ def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2756,11 +2758,7 @@ def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2813,7 +2811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2829,7 +2826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2903,7 +2899,6 @@ def delete_static_site_user( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3057,7 +3052,6 @@ def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3072,7 +3066,7 @@ def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3122,7 +3116,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3138,7 +3131,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3209,7 +3201,6 @@ def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3224,16 +3215,16 @@ def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3246,7 +3237,7 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -3257,10 +3248,10 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3268,12 +3259,20 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_build( @@ -3302,7 +3301,7 @@ def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_build_initial( # type: ignore + raw_result = self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -3312,6 +3311,7 @@ def begin_delete_static_site_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3458,7 +3458,6 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3473,7 +3472,7 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3605,7 +3604,6 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3620,7 +3618,7 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3673,7 +3671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3689,7 +3686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3760,7 +3756,6 @@ def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3775,7 +3770,7 @@ def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3823,7 +3818,6 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3838,7 +3832,7 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3891,7 +3885,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3907,7 +3900,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3982,7 +3974,6 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3997,7 +3988,9 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4015,7 +4008,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4029,7 +4022,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4055,10 +4048,10 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4066,15 +4059,15 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4233,10 +4226,13 @@ def begin_register_user_provided_function_app_with_static_site_build( # pylint: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4303,7 +4299,6 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4321,14 +4316,14 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4342,7 +4337,7 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4364,10 +4359,10 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4375,12 +4370,20 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -4485,7 +4488,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -4497,6 +4500,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4633,7 +4637,6 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4648,7 +4651,7 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4770,7 +4773,6 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4785,7 +4787,7 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4909,7 +4911,6 @@ def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4924,7 +4925,7 @@ def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4974,7 +4975,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4990,7 +4990,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5061,7 +5060,6 @@ def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5076,7 +5074,7 @@ def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5092,7 +5090,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5106,7 +5104,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5131,10 +5129,10 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5142,15 +5140,15 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5281,10 +5279,13 @@ def begin_create_or_update_static_site_custom_domain( # pylint: disable=name-to params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5306,9 +5307,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5321,7 +5322,7 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -5332,10 +5333,10 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5343,12 +5344,20 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_custom_domain( @@ -5377,7 +5386,7 @@ def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -5387,6 +5396,7 @@ def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5408,7 +5418,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -5417,7 +5427,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5431,7 +5441,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5456,10 +5466,10 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5467,12 +5477,20 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -5580,7 +5598,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -5592,6 +5610,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5613,9 +5632,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _detach_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5628,7 +5645,7 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -5638,10 +5655,10 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5649,12 +5666,20 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -5679,7 +5704,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._detach_static_site_initial( # type: ignore + raw_result = self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -5688,6 +5713,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5752,7 +5778,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5768,7 +5793,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5836,7 +5860,6 @@ def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5851,7 +5874,7 @@ def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5896,7 +5919,6 @@ def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5911,7 +5933,7 @@ def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5956,7 +5978,6 @@ def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5971,7 +5992,7 @@ def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6014,7 +6035,6 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6029,7 +6049,7 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6079,7 +6099,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6095,7 +6114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6166,7 +6184,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6181,7 +6198,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6195,7 +6212,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6209,7 +6226,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6231,10 +6248,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6242,15 +6259,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6375,10 +6392,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6402,7 +6422,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6415,7 +6435,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -6426,10 +6446,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6437,18 +6457,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6492,10 +6509,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6553,7 +6571,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6568,7 +6585,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6690,7 +6707,6 @@ def reset_static_site_api_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6751,7 +6767,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6767,7 +6782,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6838,7 +6852,6 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6853,7 +6866,9 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6870,7 +6885,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6884,7 +6899,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6909,10 +6924,10 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6920,15 +6935,15 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7074,10 +7089,13 @@ def begin_register_user_provided_function_app_with_static_site( # pylint: disab params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7140,7 +7158,6 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7158,13 +7175,13 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7178,7 +7195,7 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7199,10 +7216,10 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7210,12 +7227,20 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -7311,7 +7336,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -7322,6 +7347,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_top_level_domains_operations.py index c37974f33c1b5..5628bca1a1095 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_top_level_domains_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_web_apps_operations.py index a4097c2b219e1..868fff82502a0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_web_apps_operations.py @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -15978,7 +15979,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15994,7 +15994,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16067,7 +16066,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16083,7 +16081,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16152,7 +16149,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16167,7 +16163,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16176,7 +16172,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16190,7 +16186,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16211,10 +16207,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16222,15 +16218,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16342,10 +16338,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16420,7 +16417,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16560,7 +16556,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16575,11 +16570,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16627,7 +16618,6 @@ def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16642,7 +16632,7 @@ def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16762,7 +16752,6 @@ def apply_slot_config_to_production( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16891,7 +16880,6 @@ def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16906,7 +16894,7 @@ def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16952,7 +16940,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16968,7 +16955,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17039,7 +17025,6 @@ def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17054,7 +17039,7 @@ def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17105,7 +17090,6 @@ def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17258,7 +17242,6 @@ def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17273,21 +17256,21 @@ def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_initial( # pylint: disable=inconsistent-return-statements + def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17301,7 +17284,7 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17323,10 +17306,10 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17334,12 +17317,20 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore( @@ -17439,7 +17430,7 @@ def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_initial( # type: ignore + raw_result = self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -17451,6 +17442,7 @@ def begin_restore( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -17515,7 +17507,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17531,7 +17522,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17599,7 +17589,6 @@ def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17614,7 +17603,7 @@ def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17738,7 +17727,6 @@ def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17753,7 +17741,7 @@ def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17798,7 +17786,6 @@ def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17813,7 +17800,7 @@ def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17937,7 +17924,6 @@ def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17952,7 +17938,7 @@ def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18000,7 +17986,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18016,7 +18001,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18159,7 +18143,6 @@ def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18174,7 +18157,7 @@ def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18217,7 +18200,6 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18232,7 +18214,7 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18352,7 +18334,6 @@ def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18367,7 +18348,7 @@ def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18410,7 +18391,6 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18425,7 +18405,7 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18545,7 +18525,6 @@ def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18560,7 +18539,7 @@ def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18603,7 +18582,6 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18618,7 +18596,7 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18740,7 +18718,6 @@ def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18755,7 +18732,7 @@ def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18800,7 +18777,6 @@ def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18815,7 +18791,7 @@ def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18931,7 +18907,6 @@ def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18946,7 +18921,7 @@ def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18991,7 +18966,6 @@ def delete_backup_configuration( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19045,7 +19019,6 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19060,7 +19033,7 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19108,7 +19081,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19124,7 +19096,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19195,7 +19166,6 @@ def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19210,7 +19180,7 @@ def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19258,7 +19228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19274,7 +19243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19345,7 +19313,6 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19360,7 +19327,7 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19483,7 +19450,6 @@ def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19498,7 +19464,7 @@ def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19543,7 +19509,6 @@ def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19558,7 +19523,7 @@ def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19603,7 +19568,6 @@ def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19618,7 +19582,7 @@ def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19741,7 +19705,6 @@ def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19756,7 +19719,7 @@ def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19872,7 +19835,6 @@ def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19887,7 +19849,7 @@ def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19930,7 +19892,6 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19945,14 +19906,16 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _list_publishing_credentials_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.User: + def _list_publishing_credentials_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19965,7 +19928,7 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -19975,10 +19938,10 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -19986,11 +19949,15 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20031,10 +19998,11 @@ def begin_list_publishing_credentials( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20165,7 +20133,6 @@ def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20180,7 +20147,7 @@ def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20223,7 +20190,6 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20238,7 +20204,7 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20283,7 +20249,6 @@ def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20298,7 +20263,7 @@ def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20427,7 +20392,6 @@ def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20442,7 +20406,7 @@ def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20487,7 +20451,6 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20502,7 +20465,7 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20622,7 +20585,6 @@ def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20637,7 +20599,7 @@ def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20757,7 +20719,6 @@ def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20772,7 +20733,7 @@ def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20824,7 +20785,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20840,7 +20800,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20911,7 +20870,6 @@ def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20926,7 +20884,7 @@ def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20974,7 +20932,6 @@ def recover_site_configuration_snapshot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21030,9 +20987,9 @@ def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21041,12 +20998,16 @@ def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21089,9 +21050,9 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21100,12 +21061,16 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21153,7 +21118,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21169,7 +21133,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21243,7 +21206,6 @@ def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21258,7 +21220,7 @@ def get_continuous_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21306,7 +21268,6 @@ def delete_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21368,7 +21329,6 @@ def start_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21430,7 +21390,6 @@ def stop_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21487,7 +21446,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21503,7 +21461,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21572,7 +21529,6 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21587,7 +21543,7 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21717,7 +21673,6 @@ def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21732,7 +21687,7 @@ def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21780,7 +21735,6 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21838,7 +21792,6 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21853,7 +21806,7 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21977,7 +21930,6 @@ def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21992,7 +21944,7 @@ def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22040,7 +21992,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22056,7 +22007,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22127,7 +22077,6 @@ def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22142,7 +22091,7 @@ def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22274,7 +22223,6 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22289,7 +22237,7 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22337,7 +22285,6 @@ def delete_domain_ownership_identifier( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22480,7 +22427,6 @@ def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22495,7 +22441,7 @@ def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22538,7 +22484,6 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22553,7 +22498,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22562,7 +22507,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22579,7 +22524,7 @@ def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -22600,10 +22545,10 @@ def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22611,11 +22556,15 @@ def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22721,10 +22670,11 @@ def begin_create_ms_deploy_operation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22785,7 +22735,6 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22800,7 +22749,7 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22851,7 +22800,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22867,7 +22815,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22933,7 +22880,6 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22948,7 +22894,7 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22999,7 +22945,6 @@ def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23014,7 +22959,7 @@ def get_function( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23028,7 +22973,7 @@ def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23042,7 +22987,7 @@ def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23064,10 +23009,10 @@ def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23075,11 +23020,15 @@ def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23199,10 +23148,11 @@ def begin_create_function( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23268,7 +23218,6 @@ def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23419,7 +23368,6 @@ def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23434,11 +23382,7 @@ def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23492,7 +23436,6 @@ def delete_function_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23551,7 +23494,6 @@ def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23566,7 +23508,7 @@ def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23614,7 +23556,6 @@ def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23629,7 +23570,7 @@ def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23672,7 +23613,6 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23687,7 +23627,7 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23732,7 +23672,6 @@ def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23788,7 +23727,6 @@ def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23939,7 +23877,6 @@ def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23954,11 +23891,7 @@ def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24012,7 +23945,6 @@ def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24071,7 +24003,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24087,7 +24018,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24158,7 +24088,6 @@ def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24173,7 +24102,7 @@ def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24305,7 +24234,6 @@ def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24320,7 +24248,7 @@ def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24368,7 +24296,6 @@ def delete_host_name_binding( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24430,7 +24357,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24445,7 +24371,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24585,7 +24511,6 @@ def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24600,7 +24525,7 @@ def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24654,7 +24579,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24805,7 +24729,6 @@ def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24820,7 +24743,7 @@ def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24863,7 +24786,6 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24878,7 +24800,7 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24923,7 +24845,6 @@ def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24938,7 +24859,7 @@ def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24986,7 +24907,6 @@ def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25001,7 +24921,7 @@ def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25132,7 +25052,6 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25147,7 +25066,7 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25198,7 +25117,6 @@ def delete_relay_service_connection( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25340,7 +25258,6 @@ def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25355,7 +25272,7 @@ def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25404,7 +25321,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25420,7 +25336,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25491,7 +25406,6 @@ def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25506,7 +25420,7 @@ def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25554,7 +25468,6 @@ def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25569,7 +25482,7 @@ def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25583,7 +25496,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25600,7 +25513,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25622,10 +25535,10 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25633,11 +25546,15 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25757,10 +25674,11 @@ def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25826,7 +25744,6 @@ def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25841,7 +25758,7 @@ def get_instance_ms_deploy_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25898,7 +25815,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25914,7 +25830,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25992,7 +25907,6 @@ def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26007,7 +25921,7 @@ def get_instance_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26064,7 +25978,6 @@ def delete_instance_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26130,9 +26043,9 @@ def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26141,11 +26054,15 @@ def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26205,7 +26122,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26221,7 +26137,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26302,7 +26217,6 @@ def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26317,7 +26231,7 @@ def get_instance_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26375,7 +26289,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26391,7 +26304,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26457,7 +26369,6 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26472,7 +26383,7 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26518,7 +26429,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26534,7 +26444,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26602,7 +26511,6 @@ def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26617,7 +26525,7 @@ def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26631,7 +26539,7 @@ def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26645,7 +26553,7 @@ def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26667,10 +26575,10 @@ def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26678,11 +26586,15 @@ def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26806,10 +26718,11 @@ def begin_migrate_storage( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26837,7 +26750,7 @@ def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26851,7 +26764,7 @@ def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26872,10 +26785,10 @@ def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26883,11 +26796,15 @@ def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26995,10 +26912,11 @@ def begin_migrate_my_sql( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27060,7 +26978,6 @@ def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27075,7 +26992,7 @@ def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27120,7 +27037,6 @@ def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27135,7 +27051,7 @@ def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27275,7 +27191,6 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27290,7 +27205,7 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27338,7 +27253,6 @@ def delete_swift_virtual_network( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27489,7 +27403,6 @@ def update_swift_virtual_network_connection_with_check( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27504,7 +27417,7 @@ def update_swift_virtual_network_connection_with_check( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27555,7 +27468,6 @@ def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27570,7 +27482,7 @@ def list_network_features( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27618,7 +27530,6 @@ def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27633,11 +27544,7 @@ def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27697,7 +27604,6 @@ def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27712,7 +27618,7 @@ def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27727,7 +27633,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27740,7 +27646,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -27753,10 +27659,10 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27764,15 +27670,15 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27829,10 +27735,11 @@ def begin_start_web_site_network_trace_operation( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27892,7 +27799,6 @@ def stop_web_site_network_trace( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27951,7 +27857,6 @@ def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27966,7 +27871,7 @@ def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28014,7 +27919,6 @@ def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28029,11 +27933,7 @@ def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28081,7 +27981,6 @@ def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28096,7 +27995,7 @@ def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28141,7 +28040,6 @@ def generate_new_site_publishing_password( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28205,7 +28103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28221,7 +28118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28289,7 +28185,6 @@ def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28304,7 +28199,7 @@ def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28347,7 +28242,6 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28362,7 +28256,7 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28410,7 +28304,6 @@ def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28425,7 +28318,7 @@ def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28555,7 +28448,6 @@ def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28570,7 +28462,7 @@ def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28618,7 +28510,6 @@ def delete_premier_add_on( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28759,7 +28650,6 @@ def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28774,7 +28664,7 @@ def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28819,7 +28709,6 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28834,7 +28723,7 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28956,7 +28845,6 @@ def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28971,7 +28859,7 @@ def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29021,7 +28909,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29037,7 +28924,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29108,7 +28994,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29123,7 +29008,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29137,7 +29022,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29151,7 +29036,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29173,10 +29058,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29184,15 +29069,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29317,10 +29202,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29344,7 +29232,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29357,7 +29245,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -29368,10 +29256,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29379,18 +29267,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29434,10 +29319,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29495,7 +29381,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29510,7 +29395,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29561,7 +29446,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29577,7 +29461,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29649,7 +29532,6 @@ def get_process(self, resource_group_name: str, name: str, process_id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29664,7 +29546,7 @@ def get_process(self, resource_group_name: str, name: str, process_id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29717,7 +29599,6 @@ def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29777,9 +29658,9 @@ def get_process_dump(self, resource_group_name: str, name: str, process_id: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29788,11 +29669,15 @@ def get_process_dump(self, resource_group_name: str, name: str, process_id: str, response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29848,7 +29733,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29864,7 +29748,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29941,7 +29824,6 @@ def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29956,7 +29838,7 @@ def get_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30010,7 +29892,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30026,7 +29907,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30097,7 +29977,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30113,7 +29992,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30184,7 +30062,6 @@ def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30199,7 +30076,7 @@ def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30331,7 +30208,6 @@ def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30346,7 +30222,7 @@ def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30394,7 +30270,6 @@ def delete_public_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30530,9 +30405,9 @@ def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30541,11 +30416,15 @@ def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30592,7 +30471,6 @@ def reset_production_slot_config( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30662,7 +30540,6 @@ def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30680,9 +30557,9 @@ def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30696,7 +30573,7 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30717,10 +30594,10 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30728,12 +30605,20 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob( @@ -30820,7 +30705,7 @@ def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_initial( # type: ignore + raw_result = self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -30831,6 +30716,7 @@ def begin_restore_from_backup_blob( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -30852,13 +30738,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30872,7 +30758,7 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30893,10 +30779,10 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30904,12 +30790,20 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app( @@ -31000,7 +30894,7 @@ def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_initial( # type: ignore + raw_result = self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -31011,6 +30905,7 @@ def begin_restore_from_deleted_app( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31032,13 +30927,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31052,7 +30947,7 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31073,10 +30968,10 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31084,12 +30979,20 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot( @@ -31183,7 +31086,7 @@ def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_initial( # type: ignore + raw_result = self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -31194,6 +31097,7 @@ def begin_restore_snapshot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31259,7 +31163,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31275,7 +31178,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31349,7 +31251,6 @@ def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31364,7 +31265,7 @@ def get_site_extension( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31373,7 +31274,7 @@ def get_site_extension( def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31390,7 +31291,7 @@ def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -31401,10 +31302,10 @@ def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31412,15 +31313,15 @@ def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31465,10 +31366,11 @@ def begin_install_site_extension( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31534,7 +31436,6 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31591,7 +31492,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31607,7 +31507,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31680,7 +31579,6 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31695,7 +31593,7 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31709,7 +31607,7 @@ def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31723,7 +31621,7 @@ def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31745,10 +31643,10 @@ def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31756,15 +31654,15 @@ def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31893,10 +31791,11 @@ def begin_create_or_update_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31976,7 +31875,6 @@ def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32129,7 +32027,6 @@ def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32144,11 +32041,7 @@ def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32200,7 +32093,6 @@ def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32215,7 +32107,7 @@ def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32348,7 +32240,6 @@ def apply_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32494,7 +32385,6 @@ def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32509,7 +32399,7 @@ def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32561,7 +32451,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32577,7 +32466,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32652,7 +32540,6 @@ def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32667,7 +32554,7 @@ def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32722,7 +32609,6 @@ def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32888,7 +32774,6 @@ def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32903,14 +32788,14 @@ def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -32918,7 +32803,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32932,7 +32817,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32955,10 +32840,10 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32966,12 +32851,20 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_slot( @@ -33083,7 +32976,7 @@ def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_slot_initial( # type: ignore + raw_result = self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -33096,6 +32989,7 @@ def begin_restore_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -33163,7 +33057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33179,7 +33072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33250,7 +33142,6 @@ def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33265,7 +33156,7 @@ def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33399,7 +33290,6 @@ def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33414,7 +33304,7 @@ def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33462,7 +33352,6 @@ def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33477,7 +33366,7 @@ def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33611,7 +33500,6 @@ def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33626,7 +33514,7 @@ def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33678,7 +33566,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33694,7 +33581,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33850,7 +33736,6 @@ def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33865,7 +33750,7 @@ def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33914,7 +33799,6 @@ def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33929,7 +33813,7 @@ def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34062,7 +33946,6 @@ def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34077,7 +33960,7 @@ def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34126,7 +34009,6 @@ def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34141,7 +34023,7 @@ def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34274,7 +34156,6 @@ def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34289,7 +34170,7 @@ def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34338,7 +34219,6 @@ def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34353,7 +34233,7 @@ def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34488,7 +34368,6 @@ def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34503,7 +34382,7 @@ def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34552,7 +34431,6 @@ def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34567,7 +34445,7 @@ def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34700,7 +34578,6 @@ def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34715,7 +34592,7 @@ def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34764,7 +34641,6 @@ def delete_backup_configuration_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34824,7 +34700,6 @@ def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34839,7 +34714,7 @@ def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34890,7 +34765,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34906,7 +34780,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34980,7 +34853,6 @@ def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34995,7 +34867,7 @@ def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35046,7 +34918,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35062,7 +34933,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35136,7 +35006,6 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35151,7 +35020,7 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35287,7 +35156,6 @@ def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35302,7 +35170,7 @@ def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35351,7 +35219,6 @@ def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35366,7 +35233,7 @@ def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35415,7 +35282,6 @@ def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35430,7 +35296,7 @@ def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35566,7 +35432,6 @@ def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35581,7 +35446,7 @@ def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35714,7 +35579,6 @@ def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35729,7 +35593,7 @@ def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35778,7 +35642,6 @@ def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35793,7 +35656,7 @@ def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35802,7 +35665,7 @@ def list_metadata_slot( def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35815,7 +35678,7 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -35826,10 +35689,10 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35837,11 +35700,15 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35886,10 +35753,11 @@ def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36037,7 +35905,6 @@ def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36052,7 +35919,7 @@ def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36101,7 +35968,6 @@ def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36116,7 +35982,7 @@ def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36167,7 +36033,6 @@ def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36182,7 +36047,7 @@ def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36315,7 +36180,6 @@ def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36330,7 +36194,7 @@ def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36463,7 +36327,6 @@ def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36478,7 +36341,7 @@ def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36534,7 +36397,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36550,7 +36412,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36625,7 +36486,6 @@ def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36640,7 +36500,7 @@ def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36692,7 +36552,6 @@ def recover_site_configuration_snapshot_slot( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36752,9 +36611,9 @@ def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -36763,12 +36622,16 @@ def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36817,9 +36680,9 @@ def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -36828,12 +36691,16 @@ def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36885,7 +36752,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36901,7 +36767,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36979,7 +36844,6 @@ def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36994,7 +36858,7 @@ def get_continuous_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37046,7 +36910,6 @@ def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37112,7 +36975,6 @@ def start_continuous_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37178,7 +37040,6 @@ def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37241,7 +37102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37257,7 +37117,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37332,7 +37191,6 @@ def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37347,7 +37205,7 @@ def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37490,7 +37348,6 @@ def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37505,7 +37362,7 @@ def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37557,7 +37414,6 @@ def delete_deployment_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37621,7 +37477,6 @@ def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37636,7 +37491,7 @@ def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37777,7 +37632,6 @@ def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37792,7 +37646,7 @@ def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37844,7 +37698,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37860,7 +37713,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37935,7 +37787,6 @@ def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37950,7 +37801,7 @@ def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38095,7 +37946,6 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38110,7 +37960,7 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38162,7 +38012,6 @@ def delete_domain_ownership_identifier_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38318,7 +38167,6 @@ def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38333,7 +38181,7 @@ def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38382,7 +38230,6 @@ def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38397,7 +38244,7 @@ def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38411,7 +38258,7 @@ def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -38428,7 +38275,7 @@ def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -38450,10 +38297,10 @@ def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -38461,11 +38308,15 @@ def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38588,10 +38439,11 @@ def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -38658,7 +38510,6 @@ def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38673,7 +38524,7 @@ def get_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38727,7 +38578,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38743,7 +38593,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38813,7 +38662,6 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38828,7 +38676,7 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38882,7 +38730,6 @@ def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38897,7 +38744,7 @@ def get_instance_function_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38912,7 +38759,7 @@ def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -38926,7 +38773,7 @@ def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -38949,10 +38796,10 @@ def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -38960,11 +38807,15 @@ def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39094,10 +38945,11 @@ def begin_create_instance_function_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -39166,7 +39018,6 @@ def delete_instance_function_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39327,7 +39178,6 @@ def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39342,11 +39192,7 @@ def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39403,7 +39249,6 @@ def delete_function_secret_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39465,7 +39310,6 @@ def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39480,7 +39324,7 @@ def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39531,7 +39375,6 @@ def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39546,7 +39389,7 @@ def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39592,7 +39435,6 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39607,7 +39449,7 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39655,7 +39497,6 @@ def list_sync_status_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39714,7 +39555,6 @@ def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39875,7 +39715,6 @@ def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39890,11 +39729,7 @@ def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39951,7 +39786,6 @@ def delete_host_secret_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40014,7 +39848,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40030,7 +39863,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40105,7 +39937,6 @@ def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40120,7 +39951,7 @@ def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40265,7 +40096,6 @@ def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40280,7 +40110,7 @@ def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40332,7 +40162,6 @@ def delete_host_name_binding_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40397,7 +40226,6 @@ def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40412,7 +40240,7 @@ def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40562,7 +40390,6 @@ def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40577,7 +40404,7 @@ def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40634,7 +40461,6 @@ def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40795,7 +40621,6 @@ def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40810,7 +40635,7 @@ def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40858,7 +40683,6 @@ def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40873,7 +40697,7 @@ def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40922,7 +40746,6 @@ def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40937,7 +40760,7 @@ def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40989,7 +40812,6 @@ def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41004,7 +40826,7 @@ def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41148,7 +40970,6 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41163,7 +40984,7 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41218,7 +41039,6 @@ def delete_relay_service_connection_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41373,7 +41193,6 @@ def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41388,7 +41207,7 @@ def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41441,7 +41260,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41457,7 +41275,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41532,7 +41349,6 @@ def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41547,7 +41363,7 @@ def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41599,7 +41415,6 @@ def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41614,7 +41429,7 @@ def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41629,7 +41444,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -41646,7 +41461,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -41669,10 +41484,10 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -41680,11 +41495,15 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41817,10 +41636,11 @@ def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=name-too- params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -41890,7 +41710,6 @@ def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41905,7 +41724,7 @@ def get_instance_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41966,7 +41785,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41982,7 +41800,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42064,7 +41881,6 @@ def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42079,7 +41895,7 @@ def get_instance_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42140,7 +41956,6 @@ def delete_instance_process_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42210,9 +42025,9 @@ def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -42221,11 +42036,15 @@ def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42289,7 +42108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42305,7 +42123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42397,7 +42214,6 @@ def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42412,7 +42228,7 @@ def get_instance_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42474,7 +42290,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42490,7 +42305,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42562,7 +42376,6 @@ def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42577,7 +42390,7 @@ def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42629,7 +42442,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42645,7 +42457,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42716,7 +42527,6 @@ def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42731,7 +42541,7 @@ def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42781,7 +42591,6 @@ def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42796,7 +42605,7 @@ def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42845,7 +42654,6 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42860,7 +42668,7 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43013,7 +42821,6 @@ def create_or_update_swift_virtual_network_connection_with_check_slot( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43028,7 +42835,7 @@ def create_or_update_swift_virtual_network_connection_with_check_slot( # pylint error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43080,7 +42887,6 @@ def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43244,7 +43050,6 @@ def update_swift_virtual_network_connection_with_check_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43259,7 +43064,7 @@ def update_swift_virtual_network_connection_with_check_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43314,7 +43119,6 @@ def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43329,7 +43133,7 @@ def list_network_features_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43381,7 +43185,6 @@ def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43396,11 +43199,7 @@ def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43464,7 +43263,6 @@ def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43479,7 +43277,7 @@ def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43495,7 +43293,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -43508,7 +43306,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -43522,10 +43320,10 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -43533,15 +43331,15 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43602,10 +43400,11 @@ def begin_start_web_site_network_trace_operation_slot( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -43668,7 +43467,6 @@ def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43731,7 +43529,6 @@ def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43746,7 +43543,7 @@ def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43798,7 +43595,6 @@ def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43813,11 +43609,7 @@ def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43869,7 +43661,6 @@ def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43884,7 +43675,7 @@ def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43933,7 +43724,6 @@ def generate_new_site_publishing_password_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44001,7 +43791,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44017,7 +43806,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44089,7 +43877,6 @@ def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44104,7 +43891,7 @@ def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44153,7 +43940,6 @@ def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44168,7 +43954,7 @@ def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44220,7 +44006,6 @@ def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44235,7 +44020,7 @@ def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44378,7 +44163,6 @@ def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44393,7 +44177,7 @@ def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44445,7 +44229,6 @@ def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44599,7 +44382,6 @@ def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44614,7 +44396,7 @@ def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44664,7 +44446,6 @@ def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44679,7 +44460,7 @@ def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44815,7 +44596,6 @@ def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44830,7 +44610,7 @@ def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44883,7 +44663,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44899,7 +44678,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44973,7 +44751,6 @@ def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44988,7 +44765,7 @@ def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45003,7 +44780,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45017,7 +44794,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -45040,10 +44817,10 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45051,15 +44828,15 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45194,10 +44971,13 @@ def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -45221,7 +45001,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45234,7 +45014,7 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -45246,10 +45026,10 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45257,18 +45037,15 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45315,10 +45092,11 @@ def begin_delete_private_endpoint_connection_slot( # pylint: disable=name-too-l params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -45379,7 +45157,6 @@ def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45394,7 +45171,7 @@ def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45451,7 +45228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45467,7 +45243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45545,7 +45320,6 @@ def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45560,7 +45334,7 @@ def get_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45617,7 +45391,6 @@ def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45683,9 +45456,9 @@ def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -45694,11 +45467,15 @@ def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45758,7 +45535,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45774,7 +45550,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45855,7 +45630,6 @@ def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45870,7 +45644,7 @@ def get_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45928,7 +45702,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45944,7 +45717,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46019,7 +45791,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46035,7 +45806,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46110,7 +45880,6 @@ def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46125,7 +45894,7 @@ def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46270,7 +46039,6 @@ def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46285,7 +46053,7 @@ def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46337,7 +46105,6 @@ def delete_public_certificate_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46486,9 +46253,9 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -46497,11 +46264,15 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46552,7 +46323,6 @@ def reset_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46627,7 +46397,6 @@ def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46645,14 +46414,14 @@ def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46666,7 +46435,7 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -46688,10 +46457,10 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46699,12 +46468,20 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob_slot( @@ -46807,7 +46584,7 @@ def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -46819,6 +46596,7 @@ def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -46840,14 +46618,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46861,7 +46639,7 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -46883,10 +46661,10 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46894,12 +46672,20 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app_slot( @@ -47002,7 +46788,7 @@ def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -47014,6 +46800,7 @@ def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -47035,14 +46822,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47056,7 +46843,7 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -47078,10 +46865,10 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47089,12 +46876,20 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot_slot( @@ -47200,7 +46995,7 @@ def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_slot_initial( # type: ignore + raw_result = self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -47212,6 +47007,7 @@ def begin_restore_snapshot_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -47281,7 +47077,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47297,7 +47092,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47375,7 +47169,6 @@ def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47390,7 +47183,7 @@ def get_site_extension_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47399,7 +47192,7 @@ def get_site_extension_slot( def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47416,7 +47209,7 @@ def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -47428,10 +47221,10 @@ def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47439,15 +47232,15 @@ def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47496,10 +47289,11 @@ def begin_install_site_extension_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -47569,7 +47363,6 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47715,7 +47508,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47731,7 +47523,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47761,14 +47552,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47782,7 +47573,7 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -47804,10 +47595,10 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47815,12 +47606,20 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot( @@ -47923,7 +47722,7 @@ def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_initial( # type: ignore + raw_result = self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -47935,6 +47734,7 @@ def begin_swap_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -48000,7 +47800,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48016,7 +47815,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48090,7 +47888,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48106,7 +47903,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48178,7 +47974,6 @@ def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48193,14 +47988,7 @@ def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48214,7 +48002,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48228,7 +48016,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48250,10 +48038,10 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48261,18 +48049,15 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48397,10 +48182,11 @@ def begin_create_or_update_source_control_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -48470,7 +48256,6 @@ def delete_source_control_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48616,7 +48401,6 @@ def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48631,14 +48415,7 @@ def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48687,7 +48464,6 @@ def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48714,7 +48490,7 @@ def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48727,7 +48503,7 @@ def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -48741,10 +48517,10 @@ def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48752,15 +48528,15 @@ def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48821,10 +48597,11 @@ def begin_start_network_trace_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -48888,7 +48665,6 @@ def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48947,7 +48723,6 @@ def stop_network_trace_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49007,7 +48782,6 @@ def sync_repository_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49066,7 +48840,6 @@ def sync_function_triggers_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49129,7 +48902,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49145,7 +48917,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49223,7 +48994,6 @@ def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49238,7 +49008,7 @@ def get_triggered_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49290,7 +49060,6 @@ def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49359,7 +49128,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49375,7 +49143,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49456,7 +49223,6 @@ def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49471,7 +49237,7 @@ def get_triggered_web_job_history_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49526,7 +49292,6 @@ def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49595,7 +49360,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49611,7 +49375,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49683,7 +49446,6 @@ def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49698,7 +49460,7 @@ def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49750,7 +49512,6 @@ def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49765,7 +49526,7 @@ def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49916,7 +49677,6 @@ def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49931,7 +49691,7 @@ def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49986,7 +49746,6 @@ def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50148,7 +49907,6 @@ def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50163,7 +49921,7 @@ def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50222,7 +49980,6 @@ def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50237,7 +49994,7 @@ def get_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50393,7 +50150,6 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50408,7 +50164,7 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50564,7 +50320,6 @@ def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50579,7 +50334,7 @@ def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50631,7 +50386,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50647,7 +50401,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50722,7 +50475,6 @@ def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50737,7 +50489,7 @@ def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50859,7 +50611,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50875,7 +50626,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50905,13 +50655,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -50925,7 +50675,7 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -50946,10 +50696,10 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -50957,12 +50707,20 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot_with_production( @@ -51053,7 +50811,7 @@ def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_with_production_initial( # type: ignore + raw_result = self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -51064,6 +50822,7 @@ def begin_swap_slot_with_production( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -51124,7 +50883,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51140,7 +50898,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51211,7 +50968,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51227,7 +50983,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51293,7 +51048,6 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51308,14 +51062,7 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51328,7 +51075,7 @@ def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -51342,7 +51089,7 @@ def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -51363,10 +51110,10 @@ def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -51374,18 +51121,15 @@ def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51497,10 +51241,11 @@ def begin_create_or_update_source_control( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -51566,7 +51311,6 @@ def delete_source_control( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51699,7 +51443,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51714,14 +51457,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51766,7 +51502,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51792,7 +51527,7 @@ def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -51805,7 +51540,7 @@ def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-15")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -51818,10 +51553,10 @@ def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -51829,15 +51564,15 @@ def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51894,10 +51629,11 @@ def begin_start_network_trace( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -51957,7 +51693,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52013,7 +51748,6 @@ def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52069,7 +51803,6 @@ def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52125,7 +51858,6 @@ def sync_function_triggers( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52184,7 +51916,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52200,7 +51931,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52274,7 +52004,6 @@ def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52289,7 +52018,7 @@ def get_triggered_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52337,7 +52066,6 @@ def delete_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52402,7 +52130,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52418,7 +52145,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52495,7 +52221,6 @@ def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52510,7 +52235,7 @@ def get_triggered_web_job_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52561,7 +52286,6 @@ def run_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52626,7 +52350,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52642,7 +52365,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52708,7 +52430,6 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52723,7 +52444,7 @@ def list_vnet_connections(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfo]", pipeline_response) + deserialized = self._deserialize("[VnetInfo]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52771,7 +52492,6 @@ def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52786,7 +52506,7 @@ def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52924,7 +52644,6 @@ def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52939,7 +52658,7 @@ def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52990,7 +52709,6 @@ def delete_vnet_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53139,7 +52857,6 @@ def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53154,7 +52871,7 @@ def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfo", pipeline_response) + deserialized = self._deserialize("VnetInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53209,7 +52926,6 @@ def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53224,7 +52940,7 @@ def get_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53367,7 +53083,6 @@ def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53382,7 +53097,7 @@ def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53525,7 +53240,6 @@ def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53540,7 +53254,7 @@ def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53586,7 +53300,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53602,7 +53315,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -53671,7 +53383,6 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53686,7 +53397,7 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_web_site_management_client_operations.py index ffeb9bfb93670..df0482221ec3b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_01_15/operations/_web_site_management_client_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -538,7 +537,6 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -553,7 +551,7 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -642,7 +640,6 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -657,7 +654,7 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -698,7 +695,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -714,7 +710,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -778,7 +773,6 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +787,7 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -901,7 +895,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -916,7 +909,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -966,7 +959,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -982,7 +974,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1060,7 +1051,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1075,7 +1065,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1115,7 +1105,6 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1130,7 +1119,7 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1196,7 +1185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1212,7 +1200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1332,7 +1319,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1348,7 +1334,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1413,7 +1398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1429,7 +1413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1491,7 +1474,6 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1506,7 +1488,7 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1605,7 +1587,6 @@ def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1620,7 +1601,7 @@ def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1733,7 +1714,6 @@ def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1853,7 +1833,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1868,7 +1847,7 @@ def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1981,7 +1960,6 @@ def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_metadata.json index 7114b337f739c..490ce26df608c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_vendor.py index fd66631892ed1..abd2e5566a353 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from .._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class WebSiteManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_web_site_management_client.py index 378a6fa4cd535..ea87331d3b735 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -226,7 +227,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/_vendor.py index 39f69956b8888..6e80ec49ed289 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/_web_site_management_client.py index abe04fe630cdc..dfe90ead01f45 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -229,7 +230,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_app_service_certificate_orders_operations.py index 8af3d741af492..804c7970abf62 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_certificate_orders_operations import ( build_create_or_update_certificate_request, build_create_or_update_request, @@ -119,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -254,7 +266,6 @@ async def validate_purchase_information( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +405,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +419,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +432,7 @@ async def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -438,7 +446,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -459,10 +467,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -470,15 +478,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -595,10 +603,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -658,7 +667,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +801,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -808,7 +815,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -858,7 +865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -874,7 +880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -945,7 +950,6 @@ async def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -960,7 +964,7 @@ async def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -974,7 +978,7 @@ async def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -988,7 +992,7 @@ async def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1010,10 +1014,10 @@ async def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1021,15 +1025,15 @@ async def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1153,10 +1157,11 @@ async def begin_create_or_update_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1219,7 +1224,6 @@ async def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1362,7 +1366,6 @@ async def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1377,7 +1380,7 @@ async def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1499,7 +1502,6 @@ async def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1632,7 +1634,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1688,7 +1689,6 @@ async def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1822,7 +1822,6 @@ async def resend_request_emails( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1971,7 +1970,6 @@ async def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1986,7 +1984,7 @@ async def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2031,7 +2029,6 @@ async def verify_domain_ownership( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2087,7 +2084,6 @@ async def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2102,7 +2098,7 @@ async def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2147,7 +2143,6 @@ async def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2162,7 +2157,7 @@ async def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_app_service_environments_operations.py index f197ad200e4bf..2460f9c7e12a1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_app_service_environments_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_environments_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_change_vnet_request, @@ -143,7 +157,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -159,7 +172,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +241,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -245,7 +256,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -311,7 +321,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -326,7 +335,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -339,7 +348,7 @@ async def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -353,7 +362,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -374,10 +383,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -385,18 +394,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -513,10 +519,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -538,9 +545,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -553,7 +560,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -564,10 +571,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -575,12 +582,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -611,7 +626,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -621,6 +636,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -759,7 +775,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -774,14 +789,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -830,7 +838,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -846,7 +853,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -912,7 +918,6 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -927,7 +932,7 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -940,7 +945,7 @@ async def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -954,7 +959,7 @@ async def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -975,10 +980,10 @@ async def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -986,15 +991,15 @@ async def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1123,7 +1128,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1139,13 +1143,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1182,6 +1185,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -1247,7 +1251,6 @@ async def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1262,7 +1265,7 @@ async def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1384,7 +1387,6 @@ async def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1399,7 +1401,7 @@ async def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1444,7 +1446,6 @@ async def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1459,7 +1460,7 @@ async def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1507,7 +1508,6 @@ async def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1522,7 +1522,7 @@ async def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1572,7 +1572,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1588,7 +1587,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1660,7 +1658,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1676,7 +1673,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1744,7 +1740,6 @@ async def get_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1759,7 +1754,7 @@ async def get_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1772,7 +1767,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1786,7 +1781,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1807,10 +1802,10 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1818,15 +1813,15 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1940,10 +1935,11 @@ async def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2079,7 +2075,6 @@ async def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2094,11 +2089,7 @@ async def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2153,7 +2144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2169,7 +2159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2242,7 +2231,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2258,7 +2246,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2329,7 +2316,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2345,7 +2331,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2416,7 +2401,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2432,7 +2416,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2498,7 +2481,6 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2513,7 +2495,7 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2563,7 +2545,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2579,7 +2560,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2652,7 +2632,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2668,7 +2647,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2739,7 +2717,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2754,7 +2731,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2768,7 +2745,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2782,7 +2759,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2804,10 +2781,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2815,15 +2792,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2948,10 +2925,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2975,7 +2955,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2988,7 +2968,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -2999,10 +2979,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3010,18 +2990,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3065,10 +3042,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3126,7 +3104,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3141,7 +3118,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3186,7 +3163,6 @@ async def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3204,7 +3180,7 @@ async def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3217,7 +3193,7 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -3227,10 +3203,10 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3238,15 +3214,15 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3297,7 +3273,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3313,13 +3288,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3354,6 +3328,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3423,7 +3398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3439,7 +3413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3514,7 +3487,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3530,7 +3502,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3560,7 +3531,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3573,7 +3544,7 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -3583,10 +3554,10 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3594,15 +3565,15 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3653,7 +3624,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3669,13 +3639,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3710,6 +3679,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3785,7 +3755,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3801,7 +3770,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3873,7 +3841,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3889,7 +3856,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3960,7 +3926,6 @@ async def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3975,7 +3940,7 @@ async def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3989,7 +3954,7 @@ async def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4003,7 +3968,7 @@ async def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4025,10 +3990,10 @@ async def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4036,15 +4001,15 @@ async def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4167,10 +4132,11 @@ async def begin_create_or_update_worker_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4315,7 +4281,6 @@ async def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4330,11 +4295,7 @@ async def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4390,7 +4351,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4406,7 +4366,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4482,7 +4441,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4498,7 +4456,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4572,7 +4529,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4588,7 +4544,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4662,7 +4617,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4678,7 +4632,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_app_service_plans_operations.py index bbf70e03aff5f..45290c5a02d14 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_app_service_plans_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_plans_operations import ( build_create_or_update_request, build_create_or_update_vnet_route_request, @@ -131,7 +145,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -147,7 +160,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -216,7 +228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -301,7 +311,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -316,7 +325,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +338,7 @@ async def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -343,7 +352,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -364,10 +373,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -375,15 +384,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -493,10 +502,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -556,7 +566,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -688,7 +697,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -703,11 +711,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +754,6 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -765,7 +768,7 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -816,7 +819,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -831,7 +833,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -882,7 +884,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -944,7 +945,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -959,7 +959,7 @@ async def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1013,7 +1013,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1029,7 +1028,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1097,7 +1095,6 @@ async def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1112,7 +1109,7 @@ async def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1161,7 +1158,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1173,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1251,7 +1246,6 @@ async def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1329,7 +1323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1345,7 +1338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1411,7 +1403,6 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1426,7 +1417,7 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1480,7 +1471,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1496,7 +1486,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1562,7 +1551,6 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1577,7 +1565,7 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1628,7 +1616,6 @@ async def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1643,7 +1630,7 @@ async def get_vnet_from_server_farm( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1694,7 +1681,6 @@ async def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1709,7 +1695,7 @@ async def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1849,7 +1835,6 @@ async def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1864,7 +1849,7 @@ async def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1912,7 +1897,6 @@ async def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1927,7 +1911,7 @@ async def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1981,7 +1965,6 @@ async def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1996,7 +1979,7 @@ async def get_route_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2143,7 +2126,6 @@ async def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2158,7 +2140,7 @@ async def create_or_update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2212,7 +2194,6 @@ async def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2370,7 +2351,6 @@ async def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2385,7 +2365,7 @@ async def update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2433,7 +2413,6 @@ async def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_certificate_orders_diagnostics_operations.py index 43b4a9264bd44..f5c9075893b76 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_orders_diagnostics_operations import ( build_get_app_service_certificate_order_detector_response_request, build_list_app_service_certificate_order_detector_response_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -211,7 +207,6 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +221,7 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_certificate_registration_provider_operations.py index 8eb6b381cd885..49ad7a2cb404f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_certificate_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_certificates_operations.py index af368b3afe984..cb1d9dd8d92d0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -105,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -187,7 +183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -203,7 +198,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -269,7 +263,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -284,7 +277,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -404,7 +397,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -419,7 +411,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +456,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +587,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +601,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_container_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_container_apps_operations.py index 3028d57ff0079..8c634cf0425c4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_container_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_container_apps_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_operations import ( build_create_or_update_request, build_delete_request, @@ -104,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -187,7 +185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -203,7 +200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -272,7 +268,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -287,7 +282,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -300,7 +295,7 @@ async def _create_or_update_initial( name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> _models.ContainerApp: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -314,7 +309,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -335,10 +330,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -346,15 +341,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -463,10 +458,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -488,9 +484,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -503,7 +497,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -513,10 +507,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -524,12 +518,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -554,7 +556,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -563,6 +565,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -617,7 +620,6 @@ async def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollect headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -632,7 +634,7 @@ async def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollect error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecretsCollection", pipeline_response) + deserialized = self._deserialize("SecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_container_apps_revisions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_container_apps_revisions_operations.py index dd3f9350a8ab5..5f21d96ced3c0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_container_apps_revisions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_container_apps_revisions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_revisions_operations import ( build_activate_revision_request, build_deactivate_revision_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -194,7 +190,6 @@ async def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +204,7 @@ async def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,7 +252,6 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -316,7 +310,6 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +368,6 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_deleted_web_apps_operations.py index a743ffbcd2aaa..a91257018242b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_deleted_web_apps_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_web_apps_operations import ( build_get_deleted_web_app_by_location_request, build_list_by_location_request, @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -179,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +257,6 @@ async def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +271,7 @@ async def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_diagnostics_operations.py index ec2cc1d3e4cfe..440c09139605d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._diagnostics_operations import ( build_execute_site_analysis_request, build_execute_site_analysis_slot_request, @@ -126,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +225,6 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +239,7 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,7 +288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -309,7 +303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +389,6 @@ async def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +403,7 @@ async def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -476,7 +467,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -547,7 +537,6 @@ async def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -562,7 +551,7 @@ async def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -630,7 +618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -704,7 +691,6 @@ async def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,7 +705,7 @@ async def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +773,6 @@ async def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +787,7 @@ async def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -855,7 +840,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -871,7 +855,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -945,7 +928,6 @@ async def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -960,7 +942,7 @@ async def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1028,7 +1010,6 @@ async def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1043,7 +1024,7 @@ async def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1095,7 +1076,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1111,7 +1091,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1202,7 +1181,6 @@ async def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1217,7 +1195,7 @@ async def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1269,7 +1247,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1285,7 +1262,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1359,7 +1335,6 @@ async def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1374,7 +1349,7 @@ async def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1429,7 +1404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1445,7 +1419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1528,7 +1501,6 @@ async def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1543,7 +1515,7 @@ async def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1615,7 +1587,6 @@ async def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1630,7 +1601,7 @@ async def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1686,7 +1657,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1702,7 +1672,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1785,7 +1754,6 @@ async def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1800,7 +1768,7 @@ async def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1872,7 +1840,6 @@ async def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1887,7 +1854,7 @@ async def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_domain_registration_provider_operations.py index 3ff31df0503ff..41a69d3fca4be 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_domain_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_domains_operations.py index a8438963ed839..5a0a45994aa9c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_check_availability_request, build_create_or_update_ownership_identifier_request, @@ -163,7 +163,6 @@ async def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +177,7 @@ async def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -218,7 +217,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -234,7 +232,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -294,7 +291,6 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -309,7 +305,7 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +405,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -425,7 +420,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -491,7 +485,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -507,7 +500,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -573,7 +565,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -588,7 +579,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -597,7 +588,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -611,7 +602,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -632,10 +623,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -643,15 +634,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -757,10 +748,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -825,7 +817,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -956,7 +947,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -971,11 +961,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1025,7 +1011,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1041,7 +1026,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1112,7 +1096,6 @@ async def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1127,7 +1110,7 @@ async def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1266,7 +1249,6 @@ async def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1281,7 +1263,7 @@ async def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1329,7 +1311,6 @@ async def delete_ownership_identifier( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1479,7 +1460,6 @@ async def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1494,7 +1474,7 @@ async def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1539,7 +1519,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1597,7 +1576,6 @@ async def transfer_out(self, resource_group_name: str, domain_name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1612,7 +1590,7 @@ async def transfer_out(self, resource_group_name: str, domain_name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_global_operations_operations.py index 8075ce3f3e478..62001b44a11c7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_global_operations_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._global_operations_operations import ( build_get_deleted_web_app_request, build_get_deleted_web_app_snapshots_request, @@ -94,7 +92,6 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +106,7 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -149,7 +146,6 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -164,7 +160,7 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -209,7 +205,6 @@ async def get_subscription_operation_with_async_response( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_kube_environments_operations.py index 8b217654a81f8..cd53dbafda379 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_kube_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_kube_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._kube_environments_operations import ( build_create_or_update_request, build_delete_request, @@ -104,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -189,7 +187,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -205,7 +202,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -271,7 +267,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +281,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -299,7 +294,7 @@ async def _create_or_update_initial( name: str, kube_environment_envelope: Union[_models.KubeEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.KubeEnvironment: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -313,7 +308,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KubeEnvironment] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -334,10 +329,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -345,15 +340,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -466,10 +461,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -491,9 +487,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -506,7 +500,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -516,10 +510,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -527,12 +521,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -557,7 +559,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -566,6 +568,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -704,7 +707,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,11 +721,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_provider_operations.py index 77bd2b2997164..e7cbb62681b99 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._provider_operations import ( build_get_available_stacks_on_prem_request, build_get_available_stacks_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -192,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -208,7 +203,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -280,7 +274,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -296,7 +289,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -367,7 +359,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -383,7 +374,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -449,7 +439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -465,7 +454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -533,7 +521,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -549,7 +536,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +606,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -636,7 +621,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_recommendations_operations.py index 06abf9416804a..2cc785b408b6b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_recommendations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommendations_operations import ( build_disable_all_for_hosting_environment_request, build_disable_all_for_web_app_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -198,7 +194,6 @@ async def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +246,6 @@ async def disable_recommendation_for_subscription( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -326,7 +320,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -342,7 +335,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -428,7 +420,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +435,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -515,7 +505,6 @@ async def disable_all_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +563,6 @@ async def reset_all_filters_for_hosting_environment( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +635,6 @@ async def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -662,7 +649,7 @@ async def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -713,7 +700,6 @@ async def disable_recommendation_for_hosting_environment( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -788,7 +774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -804,7 +789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -890,7 +874,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -906,7 +889,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -974,7 +956,6 @@ async def disable_all_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1030,7 +1011,6 @@ async def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1103,7 +1083,6 @@ async def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1118,7 +1097,7 @@ async def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1166,7 +1145,6 @@ async def disable_recommendation_for_site( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_resource_health_metadata_operations.py index 91e3de3f14ada..f97ce0c28300f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_resource_health_metadata_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._resource_health_metadata_operations import ( build_get_by_site_request, build_get_by_site_slot_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -277,7 +271,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -293,7 +286,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -359,7 +351,6 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +365,7 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -428,7 +419,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -444,7 +434,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -516,7 +505,6 @@ async def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -531,7 +519,7 @@ async def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_static_sites_operations.py index 1c64be2438bef..ce19168eda32f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._static_sites_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_create_or_update_static_site_app_settings_request, @@ -221,7 +221,6 @@ async def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -236,7 +235,7 @@ async def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -278,7 +277,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -294,7 +292,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -364,7 +361,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -380,7 +376,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -448,7 +443,6 @@ async def get_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -463,7 +457,7 @@ async def get_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -476,7 +470,7 @@ async def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -490,7 +484,7 @@ async def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -511,10 +505,10 @@ async def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -522,15 +516,15 @@ async def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -646,10 +640,11 @@ async def begin_create_or_update_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -671,9 +666,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -686,7 +681,7 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -696,10 +691,10 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -707,12 +702,20 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site( @@ -739,7 +742,7 @@ async def begin_delete_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_initial( # type: ignore + raw_result = await self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -748,6 +751,7 @@ async def begin_delete_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -885,7 +889,6 @@ async def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -900,11 +903,7 @@ async def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -957,7 +956,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -973,7 +971,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1047,7 +1044,6 @@ async def delete_static_site_user( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1201,7 +1197,6 @@ async def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1216,7 +1211,7 @@ async def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1266,7 +1261,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1282,7 +1276,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1353,7 +1346,6 @@ async def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1368,16 +1360,16 @@ async def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1390,7 +1382,7 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -1401,10 +1393,10 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1412,12 +1404,20 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_build( @@ -1446,7 +1446,7 @@ async def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_build_initial( # type: ignore + raw_result = await self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -1456,6 +1456,7 @@ async def begin_delete_static_site_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1602,7 +1603,6 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1617,7 +1617,7 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1749,7 +1749,6 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1764,7 +1763,7 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1817,7 +1816,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1833,7 +1831,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1904,7 +1901,6 @@ async def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1919,7 +1915,7 @@ async def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1967,7 +1963,6 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1982,7 +1977,7 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2035,7 +2030,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2051,7 +2045,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2126,7 +2119,6 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2141,7 +2133,9 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2159,7 +2153,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2173,7 +2167,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2199,10 +2193,10 @@ async def _register_user_provided_function_app_with_static_site_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2210,15 +2204,15 @@ async def _register_user_provided_function_app_with_static_site_build_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2377,10 +2371,13 @@ async def begin_register_user_provided_function_app_with_static_site_build( # p params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2447,7 +2444,6 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2465,14 +2461,14 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2486,7 +2482,7 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2508,10 +2504,10 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2519,12 +2515,20 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -2629,7 +2633,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -2641,6 +2645,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2777,7 +2782,6 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2792,7 +2796,7 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2914,7 +2918,6 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2929,7 +2932,7 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3053,7 +3056,6 @@ async def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3068,7 +3070,7 @@ async def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3118,7 +3120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3134,7 +3135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3205,7 +3205,6 @@ async def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3220,7 +3219,7 @@ async def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3236,7 +3235,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3250,7 +3249,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3275,10 +3274,10 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3286,15 +3285,15 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3425,10 +3424,13 @@ async def begin_create_or_update_static_site_custom_domain( # pylint: disable=n params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3450,9 +3452,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3465,7 +3467,7 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -3476,10 +3478,10 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3487,12 +3489,20 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_custom_domain( @@ -3521,7 +3531,7 @@ async def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = await self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -3531,6 +3541,7 @@ async def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3552,7 +3563,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -3561,7 +3572,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3575,7 +3586,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3600,10 +3611,10 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3611,12 +3622,20 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -3724,7 +3743,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -3736,6 +3755,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3757,9 +3777,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _detach_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3772,7 +3792,7 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -3782,10 +3802,10 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3793,12 +3813,20 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_detach_static_site( @@ -3825,7 +3853,7 @@ async def begin_detach_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._detach_static_site_initial( # type: ignore + raw_result = await self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -3834,6 +3862,7 @@ async def begin_detach_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3898,7 +3927,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3914,7 +3942,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3982,7 +4009,6 @@ async def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3997,7 +4023,7 @@ async def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4042,7 +4068,6 @@ async def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4057,7 +4082,7 @@ async def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4102,7 +4127,6 @@ async def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4117,7 +4141,7 @@ async def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4162,7 +4186,6 @@ async def list_static_site_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4177,7 +4200,7 @@ async def list_static_site_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4227,7 +4250,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4243,7 +4265,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4314,7 +4335,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4329,7 +4349,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4343,7 +4363,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4357,7 +4377,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4379,10 +4399,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4390,15 +4410,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4523,10 +4543,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4550,7 +4573,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4563,7 +4586,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -4574,10 +4597,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4585,18 +4608,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4640,10 +4660,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4701,7 +4722,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4716,7 +4736,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4838,7 +4858,6 @@ async def reset_static_site_api_key( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4899,7 +4918,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4915,7 +4933,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4986,7 +5003,6 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5001,7 +5017,9 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5018,7 +5036,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5032,7 +5050,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5057,10 +5075,10 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5068,15 +5086,15 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5222,10 +5240,13 @@ async def begin_register_user_provided_function_app_with_static_site( # pylint: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5288,7 +5309,6 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5306,13 +5326,13 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5326,7 +5346,7 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5347,10 +5367,10 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5358,12 +5378,20 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -5459,7 +5487,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -5470,6 +5498,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_top_level_domains_operations.py index 489711ab6e97c..5462cdb41bfbb 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_level_domains_operations import ( build_get_request, build_list_agreements_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -178,7 +174,6 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_web_apps_operations.py index e0ae145f4fd3b..70ee3de82e57b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_web_apps_operations.py @@ -32,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -45,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_apps_operations import ( build_add_premier_add_on_request, build_add_premier_add_on_slot_request, @@ -507,7 +507,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -523,7 +522,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -596,7 +594,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -612,7 +609,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -681,7 +677,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -696,7 +691,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -705,7 +700,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode async def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -719,7 +714,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -740,10 +735,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -751,15 +746,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -871,10 +866,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -949,7 +945,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1089,7 +1084,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1104,11 +1098,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1156,7 +1146,6 @@ async def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1171,7 +1160,7 @@ async def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1291,7 +1280,6 @@ async def apply_slot_config_to_production( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1420,7 +1408,6 @@ async def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1435,7 +1422,7 @@ async def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1481,7 +1468,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1497,7 +1483,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1568,7 +1553,6 @@ async def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1583,7 +1567,7 @@ async def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1634,7 +1618,6 @@ async def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1787,7 +1770,6 @@ async def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1802,21 +1784,21 @@ async def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_initial( # pylint: disable=inconsistent-return-statements + async def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1830,7 +1812,7 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1852,10 +1834,10 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1863,12 +1845,20 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore( @@ -1968,7 +1958,7 @@ async def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_initial( # type: ignore + raw_result = await self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -1980,6 +1970,7 @@ async def begin_restore( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2044,7 +2035,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2060,7 +2050,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2128,7 +2117,6 @@ async def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2143,7 +2131,7 @@ async def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2267,7 +2255,6 @@ async def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2282,7 +2269,7 @@ async def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2327,7 +2314,6 @@ async def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2342,7 +2328,7 @@ async def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2466,7 +2452,6 @@ async def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2481,7 +2466,7 @@ async def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2530,7 +2515,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2546,7 +2530,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2689,7 +2672,6 @@ async def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2704,7 +2686,7 @@ async def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2749,7 +2731,6 @@ async def list_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2764,7 +2745,7 @@ async def list_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2884,7 +2865,6 @@ async def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2899,7 +2879,7 @@ async def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2942,7 +2922,6 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2957,7 +2936,7 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3002,7 +2981,6 @@ async def get_auth_settings_v2_without_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3017,7 +2995,7 @@ async def get_auth_settings_v2_without_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3137,7 +3115,6 @@ async def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3152,7 +3129,7 @@ async def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3197,7 +3174,6 @@ async def get_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3212,7 +3188,7 @@ async def get_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3334,7 +3310,6 @@ async def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3349,7 +3324,7 @@ async def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3394,7 +3369,6 @@ async def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3409,7 +3383,7 @@ async def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3525,7 +3499,6 @@ async def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3540,7 +3513,7 @@ async def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3585,7 +3558,6 @@ async def delete_backup_configuration( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3641,7 +3613,6 @@ async def get_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3656,7 +3627,7 @@ async def get_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3705,7 +3676,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3721,7 +3691,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3792,7 +3761,6 @@ async def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3807,7 +3775,7 @@ async def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3856,7 +3824,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3872,7 +3839,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3943,7 +3909,6 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3958,7 +3923,7 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4081,7 +4046,6 @@ async def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4096,7 +4060,7 @@ async def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4141,7 +4105,6 @@ async def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4156,7 +4119,7 @@ async def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4201,7 +4164,6 @@ async def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4216,7 +4178,7 @@ async def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4339,7 +4301,6 @@ async def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4354,7 +4315,7 @@ async def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4470,7 +4431,6 @@ async def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4485,7 +4445,7 @@ async def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4528,7 +4488,6 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4543,7 +4502,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4552,7 +4511,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any async def _list_publishing_credentials_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4565,7 +4524,7 @@ async def _list_publishing_credentials_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -4575,10 +4534,10 @@ async def _list_publishing_credentials_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4586,11 +4545,15 @@ async def _list_publishing_credentials_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4631,10 +4594,11 @@ async def begin_list_publishing_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4765,7 +4729,6 @@ async def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4780,7 +4743,7 @@ async def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4823,7 +4786,6 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4838,7 +4800,7 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4883,7 +4845,6 @@ async def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4898,7 +4859,7 @@ async def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5027,7 +4988,6 @@ async def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5042,7 +5002,7 @@ async def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5087,7 +5047,6 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5102,7 +5061,7 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5222,7 +5181,6 @@ async def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5237,7 +5195,7 @@ async def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5357,7 +5315,6 @@ async def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5372,7 +5329,7 @@ async def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5424,7 +5381,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5440,7 +5396,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5511,7 +5466,6 @@ async def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5526,7 +5480,7 @@ async def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5574,7 +5528,6 @@ async def recover_site_configuration_snapshot( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5630,9 +5583,9 @@ async def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5641,12 +5594,16 @@ async def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5691,9 +5648,9 @@ async def get_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5702,12 +5659,16 @@ async def get_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5756,7 +5717,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5772,7 +5732,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5846,7 +5805,6 @@ async def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5861,7 +5819,7 @@ async def get_continuous_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5909,7 +5867,6 @@ async def delete_continuous_web_job( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5971,7 +5928,6 @@ async def start_continuous_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6033,7 +5989,6 @@ async def stop_continuous_web_job( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6092,7 +6047,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6108,7 +6062,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6177,7 +6130,6 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6192,7 +6144,7 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6322,7 +6274,6 @@ async def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6337,7 +6288,7 @@ async def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6385,7 +6336,6 @@ async def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6445,7 +6395,6 @@ async def list_deployment_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6460,7 +6409,7 @@ async def list_deployment_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6584,7 +6533,6 @@ async def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6599,7 +6547,7 @@ async def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6647,7 +6595,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6663,7 +6610,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6734,7 +6680,6 @@ async def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6749,7 +6694,7 @@ async def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6881,7 +6826,6 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6896,7 +6840,7 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6944,7 +6888,6 @@ async def delete_domain_ownership_identifier( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7087,7 +7030,6 @@ async def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7102,7 +7044,7 @@ async def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7145,7 +7087,6 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7160,7 +7101,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7169,7 +7110,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar async def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7186,7 +7127,7 @@ async def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7207,10 +7148,10 @@ async def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7218,11 +7159,15 @@ async def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7328,10 +7273,11 @@ async def begin_create_ms_deploy_operation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7392,7 +7338,6 @@ async def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7407,7 +7352,7 @@ async def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7450,7 +7395,6 @@ async def get_one_deploy_status(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7465,7 +7409,7 @@ async def get_one_deploy_status(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7508,7 +7452,6 @@ async def create_one_deploy_operation(self, resource_group_name: str, name: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7523,7 +7466,7 @@ async def create_one_deploy_operation(self, resource_group_name: str, name: str, error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7575,7 +7518,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7591,7 +7533,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7657,7 +7598,6 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7672,7 +7612,7 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7723,7 +7663,6 @@ async def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7738,7 +7677,7 @@ async def get_function( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7752,7 +7691,7 @@ async def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7766,7 +7705,7 @@ async def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7788,10 +7727,10 @@ async def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7799,11 +7738,15 @@ async def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7923,10 +7866,11 @@ async def begin_create_function( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7992,7 +7936,6 @@ async def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8143,7 +8086,6 @@ async def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8158,11 +8100,7 @@ async def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8216,7 +8154,6 @@ async def delete_function_secret( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8275,7 +8212,6 @@ async def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8290,7 +8226,7 @@ async def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8338,7 +8274,6 @@ async def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8353,7 +8288,7 @@ async def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8396,7 +8331,6 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8411,7 +8345,7 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8456,7 +8390,6 @@ async def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8512,7 +8445,6 @@ async def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8663,7 +8595,6 @@ async def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8678,11 +8609,7 @@ async def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8736,7 +8663,6 @@ async def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8796,7 +8722,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8812,7 +8737,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8883,7 +8807,6 @@ async def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8898,7 +8821,7 @@ async def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9030,7 +8953,6 @@ async def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9045,7 +8967,7 @@ async def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9093,7 +9015,6 @@ async def delete_host_name_binding( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9155,7 +9076,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9170,7 +9090,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9310,7 +9230,6 @@ async def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9325,7 +9244,7 @@ async def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9379,7 +9298,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9530,7 +9448,6 @@ async def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9545,7 +9462,7 @@ async def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9590,7 +9507,6 @@ async def list_hybrid_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9605,7 +9521,7 @@ async def list_hybrid_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9650,7 +9566,6 @@ async def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9665,7 +9580,7 @@ async def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9713,7 +9628,6 @@ async def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9728,7 +9642,7 @@ async def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9859,7 +9773,6 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9874,7 +9787,7 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9925,7 +9838,6 @@ async def delete_relay_service_connection( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10067,7 +9979,6 @@ async def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10082,7 +9993,7 @@ async def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10132,7 +10043,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10148,7 +10058,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10219,7 +10128,6 @@ async def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10234,7 +10142,7 @@ async def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10282,7 +10190,6 @@ async def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10297,7 +10204,7 @@ async def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10311,7 +10218,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10328,7 +10235,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10350,10 +10257,10 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10361,11 +10268,15 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10485,10 +10396,11 @@ async def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10554,7 +10466,6 @@ async def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10569,7 +10480,7 @@ async def get_instance_ms_deploy_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10626,7 +10537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10642,7 +10552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10720,7 +10629,6 @@ async def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10735,7 +10643,7 @@ async def get_instance_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10792,7 +10700,6 @@ async def delete_instance_process( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10858,9 +10765,9 @@ async def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10869,11 +10776,15 @@ async def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10934,7 +10845,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10950,7 +10860,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11031,7 +10940,6 @@ async def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11046,7 +10954,7 @@ async def get_instance_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11105,7 +11013,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11121,7 +11028,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11187,7 +11093,6 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11202,7 +11107,7 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11250,7 +11155,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11266,7 +11170,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11334,7 +11237,6 @@ async def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11349,7 +11251,7 @@ async def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11363,7 +11265,7 @@ async def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11377,7 +11279,7 @@ async def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11399,10 +11301,10 @@ async def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11410,11 +11312,15 @@ async def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11538,10 +11444,11 @@ async def begin_migrate_storage( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11569,7 +11476,7 @@ async def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11583,7 +11490,7 @@ async def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11604,10 +11511,10 @@ async def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11615,11 +11522,15 @@ async def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11730,10 +11641,11 @@ async def begin_migrate_my_sql( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11795,7 +11707,6 @@ async def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11810,7 +11721,7 @@ async def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11855,7 +11766,6 @@ async def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11870,7 +11780,7 @@ async def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12010,7 +11920,6 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12025,7 +11934,7 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12073,7 +11982,6 @@ async def delete_swift_virtual_network( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12224,7 +12132,6 @@ async def update_swift_virtual_network_connection_with_check( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12239,7 +12146,7 @@ async def update_swift_virtual_network_connection_with_check( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12290,7 +12197,6 @@ async def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12305,7 +12211,7 @@ async def list_network_features( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12353,7 +12259,6 @@ async def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12368,11 +12273,7 @@ async def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12432,7 +12333,6 @@ async def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12447,7 +12347,7 @@ async def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12462,7 +12362,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12475,7 +12375,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -12488,10 +12388,10 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -12499,15 +12399,15 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12565,10 +12465,11 @@ async def begin_start_web_site_network_trace_operation( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12628,7 +12529,6 @@ async def stop_web_site_network_trace( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12687,7 +12587,6 @@ async def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12702,7 +12601,7 @@ async def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12750,7 +12649,6 @@ async def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12765,11 +12663,7 @@ async def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12817,7 +12711,6 @@ async def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12832,7 +12725,7 @@ async def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12877,7 +12770,6 @@ async def generate_new_site_publishing_password( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12942,7 +12834,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -12958,7 +12849,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13026,7 +12916,6 @@ async def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13041,7 +12930,7 @@ async def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13084,7 +12973,6 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13099,7 +12987,7 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13147,7 +13035,6 @@ async def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13162,7 +13049,7 @@ async def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13292,7 +13179,6 @@ async def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13307,7 +13193,7 @@ async def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13355,7 +13241,6 @@ async def delete_premier_add_on( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13496,7 +13381,6 @@ async def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13511,7 +13395,7 @@ async def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13556,7 +13440,6 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13571,7 +13454,7 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13693,7 +13576,6 @@ async def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13708,7 +13590,7 @@ async def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13758,7 +13640,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13774,7 +13655,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13845,7 +13725,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13860,7 +13739,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13874,7 +13753,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13888,7 +13767,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -13910,10 +13789,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13921,15 +13800,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14054,10 +13933,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14081,7 +13963,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14094,7 +13976,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -14105,10 +13987,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14116,18 +13998,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14171,10 +14050,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14232,7 +14112,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14247,7 +14126,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14300,7 +14179,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14316,7 +14194,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14390,7 +14267,6 @@ async def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14405,7 +14281,7 @@ async def get_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14458,7 +14334,6 @@ async def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14520,9 +14395,9 @@ async def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14531,11 +14406,15 @@ async def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14592,7 +14471,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14608,7 +14486,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14685,7 +14562,6 @@ async def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14700,7 +14576,7 @@ async def get_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14755,7 +14631,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14771,7 +14646,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14843,7 +14717,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14859,7 +14732,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14930,7 +14802,6 @@ async def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14945,7 +14816,7 @@ async def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15077,7 +14948,6 @@ async def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15092,7 +14962,7 @@ async def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15140,7 +15010,6 @@ async def delete_public_certificate( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15276,9 +15145,9 @@ async def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15287,11 +15156,15 @@ async def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15338,7 +15211,6 @@ async def reset_production_slot_config( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15408,7 +15280,6 @@ async def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15426,9 +15297,9 @@ async def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15442,7 +15313,7 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15463,10 +15334,10 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15474,12 +15345,20 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob( @@ -15566,7 +15445,7 @@ async def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -15577,6 +15456,7 @@ async def begin_restore_from_backup_blob( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15598,13 +15478,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15618,7 +15498,7 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15639,10 +15519,10 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15650,12 +15530,20 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app( @@ -15746,7 +15634,7 @@ async def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -15757,6 +15645,7 @@ async def begin_restore_from_deleted_app( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15778,13 +15667,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15798,7 +15687,7 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15819,10 +15708,10 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15830,12 +15719,20 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot( @@ -15929,7 +15826,7 @@ async def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_initial( # type: ignore + raw_result = await self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -15940,6 +15837,7 @@ async def begin_restore_snapshot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16006,7 +15904,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16022,7 +15919,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16096,7 +15992,6 @@ async def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16111,7 +16006,7 @@ async def get_site_extension( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16120,7 +16015,7 @@ async def get_site_extension( async def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16137,7 +16032,7 @@ async def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -16148,10 +16043,10 @@ async def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16159,15 +16054,15 @@ async def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16213,10 +16108,11 @@ async def begin_install_site_extension( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16282,7 +16178,6 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16339,7 +16234,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16355,7 +16249,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16428,7 +16321,6 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16443,7 +16335,7 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16457,7 +16349,7 @@ async def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16471,7 +16363,7 @@ async def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16493,10 +16385,10 @@ async def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16504,15 +16396,15 @@ async def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16641,10 +16533,11 @@ async def begin_create_or_update_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16724,7 +16617,6 @@ async def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16877,7 +16769,6 @@ async def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16892,11 +16783,7 @@ async def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16948,7 +16835,6 @@ async def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16963,7 +16849,7 @@ async def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17096,7 +16982,6 @@ async def apply_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17242,7 +17127,6 @@ async def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17257,7 +17141,7 @@ async def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17309,7 +17193,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17325,7 +17208,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17400,7 +17282,6 @@ async def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17415,7 +17296,7 @@ async def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17470,7 +17351,6 @@ async def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17636,7 +17516,6 @@ async def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17651,14 +17530,14 @@ async def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -17666,7 +17545,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17680,7 +17559,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17703,10 +17582,10 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17714,12 +17593,20 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_slot( @@ -17831,7 +17718,7 @@ async def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_slot_initial( # type: ignore + raw_result = await self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -17844,6 +17731,7 @@ async def begin_restore_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -17911,7 +17799,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17927,7 +17814,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17998,7 +17884,6 @@ async def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18013,7 +17898,7 @@ async def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18147,7 +18032,6 @@ async def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18162,7 +18046,7 @@ async def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18210,7 +18094,6 @@ async def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18225,7 +18108,7 @@ async def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18359,7 +18242,6 @@ async def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18374,7 +18256,7 @@ async def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18427,7 +18309,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18443,7 +18324,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18599,7 +18479,6 @@ async def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18614,7 +18493,7 @@ async def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18663,7 +18542,6 @@ async def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18678,7 +18556,7 @@ async def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18811,7 +18689,6 @@ async def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18826,7 +18703,7 @@ async def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18875,7 +18752,6 @@ async def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18890,7 +18766,7 @@ async def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18939,7 +18815,6 @@ async def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18954,7 +18829,7 @@ async def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19087,7 +18962,6 @@ async def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19102,7 +18976,7 @@ async def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19151,7 +19025,6 @@ async def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19166,7 +19039,7 @@ async def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19301,7 +19174,6 @@ async def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19316,7 +19188,7 @@ async def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19365,7 +19237,6 @@ async def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19380,7 +19251,7 @@ async def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19513,7 +19384,6 @@ async def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19528,7 +19398,7 @@ async def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19577,7 +19447,6 @@ async def delete_backup_configuration_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19637,7 +19506,6 @@ async def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19652,7 +19520,7 @@ async def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19704,7 +19572,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19720,7 +19587,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19794,7 +19660,6 @@ async def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19809,7 +19674,7 @@ async def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19861,7 +19726,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19877,7 +19741,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19951,7 +19814,6 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19966,7 +19828,7 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20102,7 +19964,6 @@ async def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20117,7 +19978,7 @@ async def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20166,7 +20027,6 @@ async def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20181,7 +20041,7 @@ async def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20230,7 +20090,6 @@ async def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20245,7 +20104,7 @@ async def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20381,7 +20240,6 @@ async def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20396,7 +20254,7 @@ async def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20529,7 +20387,6 @@ async def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20544,7 +20401,7 @@ async def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20593,7 +20450,6 @@ async def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20608,7 +20464,7 @@ async def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20617,7 +20473,7 @@ async def list_metadata_slot( async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20630,7 +20486,7 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -20641,10 +20497,10 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20652,11 +20508,15 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20701,10 +20561,11 @@ async def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20852,7 +20713,6 @@ async def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20867,7 +20727,7 @@ async def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20916,7 +20776,6 @@ async def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20931,7 +20790,7 @@ async def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20982,7 +20841,6 @@ async def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20997,7 +20855,7 @@ async def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21130,7 +20988,6 @@ async def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21145,7 +21002,7 @@ async def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21278,7 +21135,6 @@ async def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21293,7 +21149,7 @@ async def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21349,7 +21205,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21365,7 +21220,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21440,7 +21294,6 @@ async def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21455,7 +21308,7 @@ async def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21507,7 +21360,6 @@ async def recover_site_configuration_snapshot_slot( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21567,9 +21419,9 @@ async def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21578,12 +21430,16 @@ async def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21632,9 +21488,9 @@ async def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21643,12 +21499,16 @@ async def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21701,7 +21561,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21717,7 +21576,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21795,7 +21653,6 @@ async def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21810,7 +21667,7 @@ async def get_continuous_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21862,7 +21719,6 @@ async def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21928,7 +21784,6 @@ async def start_continuous_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21994,7 +21849,6 @@ async def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22057,7 +21911,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22073,7 +21926,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22148,7 +22000,6 @@ async def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22163,7 +22014,7 @@ async def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22306,7 +22157,6 @@ async def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22321,7 +22171,7 @@ async def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22373,7 +22223,6 @@ async def delete_deployment_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22437,7 +22286,6 @@ async def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22452,7 +22300,7 @@ async def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22593,7 +22441,6 @@ async def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22608,7 +22455,7 @@ async def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22660,7 +22507,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22676,7 +22522,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22751,7 +22596,6 @@ async def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22766,7 +22610,7 @@ async def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22911,7 +22755,6 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22926,7 +22769,7 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22978,7 +22821,6 @@ async def delete_domain_ownership_identifier_slot( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23134,7 +22976,6 @@ async def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23149,7 +22990,7 @@ async def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23198,7 +23039,6 @@ async def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23213,7 +23053,7 @@ async def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23227,7 +23067,7 @@ async def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23244,7 +23084,7 @@ async def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23266,10 +23106,10 @@ async def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23277,11 +23117,15 @@ async def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23404,10 +23248,11 @@ async def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23474,7 +23319,6 @@ async def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23489,7 +23333,7 @@ async def get_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23544,7 +23388,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23560,7 +23403,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23632,7 +23474,6 @@ async def get_functions_admin_token_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23647,7 +23488,7 @@ async def get_functions_admin_token_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23701,7 +23542,6 @@ async def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23716,7 +23556,7 @@ async def get_instance_function_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23731,7 +23571,7 @@ async def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23745,7 +23585,7 @@ async def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23768,10 +23608,10 @@ async def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23779,11 +23619,15 @@ async def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23913,10 +23757,11 @@ async def begin_create_instance_function_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23985,7 +23830,6 @@ async def delete_instance_function_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24146,7 +23990,6 @@ async def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24161,11 +24004,7 @@ async def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24222,7 +24061,6 @@ async def delete_function_secret_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24284,7 +24122,6 @@ async def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24299,7 +24136,7 @@ async def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24350,7 +24187,6 @@ async def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24365,7 +24201,7 @@ async def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24413,7 +24249,6 @@ async def list_host_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24428,7 +24263,7 @@ async def list_host_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24476,7 +24311,6 @@ async def list_sync_status_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24535,7 +24369,6 @@ async def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24696,7 +24529,6 @@ async def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24711,11 +24543,7 @@ async def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24772,7 +24600,6 @@ async def delete_host_secret_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24836,7 +24663,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24852,7 +24678,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24927,7 +24752,6 @@ async def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24942,7 +24766,7 @@ async def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25087,7 +24911,6 @@ async def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25102,7 +24925,7 @@ async def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25154,7 +24977,6 @@ async def delete_host_name_binding_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25219,7 +25041,6 @@ async def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25234,7 +25055,7 @@ async def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25384,7 +25205,6 @@ async def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25399,7 +25219,7 @@ async def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25456,7 +25276,6 @@ async def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25617,7 +25436,6 @@ async def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25632,7 +25450,7 @@ async def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25680,7 +25498,6 @@ async def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25695,7 +25512,7 @@ async def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25744,7 +25561,6 @@ async def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25759,7 +25575,7 @@ async def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25811,7 +25627,6 @@ async def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25826,7 +25641,7 @@ async def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25970,7 +25785,6 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25985,7 +25799,7 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26040,7 +25854,6 @@ async def delete_relay_service_connection_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26195,7 +26008,6 @@ async def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26210,7 +26022,7 @@ async def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26264,7 +26076,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26280,7 +26091,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26355,7 +26165,6 @@ async def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26370,7 +26179,7 @@ async def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26422,7 +26231,6 @@ async def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26437,7 +26245,7 @@ async def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26452,7 +26260,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26469,7 +26277,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26492,10 +26300,10 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26503,11 +26311,15 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26640,10 +26452,11 @@ async def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=nam params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26713,7 +26526,6 @@ async def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26728,7 +26540,7 @@ async def get_instance_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26789,7 +26601,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26805,7 +26616,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26887,7 +26697,6 @@ async def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26902,7 +26711,7 @@ async def get_instance_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26963,7 +26772,6 @@ async def delete_instance_process_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27033,9 +26841,9 @@ async def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27044,11 +26852,15 @@ async def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27113,7 +26925,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27129,7 +26940,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27221,7 +27031,6 @@ async def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27236,7 +27045,7 @@ async def get_instance_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27299,7 +27108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27315,7 +27123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27387,7 +27194,6 @@ async def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27402,7 +27208,7 @@ async def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27454,7 +27260,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27470,7 +27275,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27541,7 +27345,6 @@ async def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27556,7 +27359,7 @@ async def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27606,7 +27409,6 @@ async def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27621,7 +27423,7 @@ async def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27670,7 +27472,6 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27685,7 +27486,7 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27838,7 +27639,6 @@ async def create_or_update_swift_virtual_network_connection_with_check_slot( # headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27853,7 +27653,7 @@ async def create_or_update_swift_virtual_network_connection_with_check_slot( # error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27905,7 +27705,6 @@ async def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28069,7 +27868,6 @@ async def update_swift_virtual_network_connection_with_check_slot( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28084,7 +27882,7 @@ async def update_swift_virtual_network_connection_with_check_slot( # pylint: di error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28139,7 +27937,6 @@ async def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28154,7 +27951,7 @@ async def list_network_features_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28206,7 +28003,6 @@ async def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28221,11 +28017,7 @@ async def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28289,7 +28081,6 @@ async def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28304,7 +28095,7 @@ async def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28320,7 +28111,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28333,7 +28124,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -28347,10 +28138,10 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28358,15 +28149,15 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28428,10 +28219,11 @@ async def begin_start_web_site_network_trace_operation_slot( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28494,7 +28286,6 @@ async def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28557,7 +28348,6 @@ async def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28572,7 +28362,7 @@ async def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28624,7 +28414,6 @@ async def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28639,11 +28428,7 @@ async def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28695,7 +28480,6 @@ async def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28710,7 +28494,7 @@ async def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28759,7 +28543,6 @@ async def generate_new_site_publishing_password_slot( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28828,7 +28611,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28844,7 +28626,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28916,7 +28697,6 @@ async def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28931,7 +28711,7 @@ async def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28980,7 +28760,6 @@ async def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28995,7 +28774,7 @@ async def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29047,7 +28826,6 @@ async def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29062,7 +28840,7 @@ async def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29205,7 +28983,6 @@ async def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29220,7 +28997,7 @@ async def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29272,7 +29049,6 @@ async def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29426,7 +29202,6 @@ async def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29441,7 +29216,7 @@ async def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29491,7 +29266,6 @@ async def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29506,7 +29280,7 @@ async def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29642,7 +29416,6 @@ async def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29657,7 +29430,7 @@ async def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29710,7 +29483,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29726,7 +29498,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29800,7 +29571,6 @@ async def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29815,7 +29585,7 @@ async def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29830,7 +29600,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29844,7 +29614,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29867,10 +29637,10 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29878,15 +29648,15 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30021,10 +29791,13 @@ async def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30048,7 +29821,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30061,7 +29834,7 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -30073,10 +29846,10 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30084,18 +29857,15 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30142,10 +29912,11 @@ async def begin_delete_private_endpoint_connection_slot( # pylint: disable=name params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30206,7 +29977,6 @@ async def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30221,7 +29991,7 @@ async def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30278,7 +30048,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30294,7 +30063,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30372,7 +30140,6 @@ async def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30387,7 +30154,7 @@ async def get_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30444,7 +30211,6 @@ async def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30510,9 +30276,9 @@ async def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30521,11 +30287,15 @@ async def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30586,7 +30356,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30602,7 +30371,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30683,7 +30451,6 @@ async def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30698,7 +30465,7 @@ async def get_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30757,7 +30524,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30773,7 +30539,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30849,7 +30614,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30865,7 +30629,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30940,7 +30703,6 @@ async def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30955,7 +30717,7 @@ async def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31100,7 +30862,6 @@ async def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31115,7 +30876,7 @@ async def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31167,7 +30928,6 @@ async def delete_public_certificate_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31316,9 +31076,9 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -31327,11 +31087,15 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31382,7 +31146,6 @@ async def reset_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31457,7 +31220,6 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31475,14 +31237,14 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31496,7 +31258,7 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31518,10 +31280,10 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31529,12 +31291,20 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob_slot( @@ -31637,7 +31407,7 @@ async def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -31649,6 +31419,7 @@ async def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31670,14 +31441,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31691,7 +31462,7 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31713,10 +31484,10 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31724,12 +31495,20 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app_slot( @@ -31832,7 +31611,7 @@ async def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -31844,6 +31623,7 @@ async def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31865,14 +31645,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31886,7 +31666,7 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31908,10 +31688,10 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31919,12 +31699,20 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot_slot( @@ -32030,7 +31818,7 @@ async def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_slot_initial( # type: ignore + raw_result = await self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -32042,6 +31830,7 @@ async def begin_restore_snapshot_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32112,7 +31901,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32128,7 +31916,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32206,7 +31993,6 @@ async def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32221,7 +32007,7 @@ async def get_site_extension_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32230,7 +32016,7 @@ async def get_site_extension_slot( async def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32247,7 +32033,7 @@ async def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -32259,10 +32045,10 @@ async def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32270,15 +32056,15 @@ async def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32328,10 +32114,11 @@ async def begin_install_site_extension_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32401,7 +32188,6 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32550,7 +32336,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32566,7 +32351,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32596,14 +32380,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32617,7 +32401,7 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32639,10 +32423,10 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32650,12 +32434,20 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot( @@ -32758,7 +32550,7 @@ async def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_initial( # type: ignore + raw_result = await self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -32770,6 +32562,7 @@ async def begin_swap_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32835,7 +32628,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32851,7 +32643,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32925,7 +32716,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32941,7 +32731,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33013,7 +32802,6 @@ async def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33028,14 +32816,7 @@ async def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33049,7 +32830,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33063,7 +32844,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33085,10 +32866,10 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33096,18 +32877,15 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33235,10 +33013,11 @@ async def begin_create_or_update_source_control_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33308,7 +33087,6 @@ async def delete_source_control_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33454,7 +33232,6 @@ async def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33469,14 +33246,7 @@ async def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33525,7 +33295,6 @@ async def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33552,7 +33321,7 @@ async def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33565,7 +33334,7 @@ async def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -33579,10 +33348,10 @@ async def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33590,15 +33359,15 @@ async def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33660,10 +33429,11 @@ async def begin_start_network_trace_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33727,7 +33497,6 @@ async def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33786,7 +33555,6 @@ async def stop_network_trace_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33846,7 +33614,6 @@ async def sync_repository_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33905,7 +33672,6 @@ async def sync_function_triggers_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33969,7 +33735,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33985,7 +33750,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34063,7 +33827,6 @@ async def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34078,7 +33841,7 @@ async def get_triggered_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34130,7 +33893,6 @@ async def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34200,7 +33962,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34216,7 +33977,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34297,7 +34057,6 @@ async def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34312,7 +34071,7 @@ async def get_triggered_web_job_history_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34367,7 +34126,6 @@ async def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34437,7 +34195,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34453,7 +34210,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34525,7 +34281,6 @@ async def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34540,7 +34295,7 @@ async def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34592,7 +34347,6 @@ async def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34607,7 +34361,7 @@ async def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34758,7 +34512,6 @@ async def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34773,7 +34526,7 @@ async def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34828,7 +34581,6 @@ async def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34990,7 +34742,6 @@ async def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35005,7 +34756,7 @@ async def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35064,7 +34815,6 @@ async def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35079,7 +34829,7 @@ async def get_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35235,7 +34985,6 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35250,7 +34999,7 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35406,7 +35155,6 @@ async def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35421,7 +35169,7 @@ async def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35473,7 +35221,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35489,7 +35236,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35564,7 +35310,6 @@ async def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35579,7 +35324,7 @@ async def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35704,7 +35449,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35720,7 +35464,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35750,13 +35493,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35770,7 +35513,7 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -35791,10 +35534,10 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -35802,12 +35545,20 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot_with_production( @@ -35898,7 +35649,7 @@ async def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_with_production_initial( # type: ignore + raw_result = await self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -35909,6 +35660,7 @@ async def begin_swap_slot_with_production( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -35969,7 +35721,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35985,7 +35736,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36056,7 +35806,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36072,7 +35821,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36138,7 +35886,6 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36153,14 +35900,7 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36173,7 +35913,7 @@ async def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36187,7 +35927,7 @@ async def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -36208,10 +35948,10 @@ async def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36219,18 +35959,15 @@ async def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36345,10 +36082,11 @@ async def begin_create_or_update_source_control( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36414,7 +36152,6 @@ async def delete_source_control( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36547,7 +36284,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36562,14 +36298,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36614,7 +36343,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36640,7 +36368,7 @@ async def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36653,7 +36381,7 @@ async def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -36666,10 +36394,10 @@ async def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36677,15 +36405,15 @@ async def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36743,10 +36471,11 @@ async def begin_start_network_trace( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36806,7 +36535,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36862,7 +36590,6 @@ async def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36918,7 +36645,6 @@ async def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36974,7 +36700,6 @@ async def sync_function_triggers( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37034,7 +36759,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37050,7 +36774,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37124,7 +36847,6 @@ async def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37139,7 +36861,7 @@ async def get_triggered_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37187,7 +36909,6 @@ async def delete_triggered_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37253,7 +36974,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37269,7 +36989,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37346,7 +37065,6 @@ async def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37361,7 +37079,7 @@ async def get_triggered_web_job_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37412,7 +37130,6 @@ async def run_triggered_web_job( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37478,7 +37195,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37494,7 +37210,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37562,7 +37277,6 @@ async def list_vnet_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37577,7 +37291,7 @@ async def list_vnet_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37625,7 +37339,6 @@ async def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37640,7 +37353,7 @@ async def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37778,7 +37491,6 @@ async def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37793,7 +37505,7 @@ async def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37844,7 +37556,6 @@ async def delete_vnet_connection( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37993,7 +37704,6 @@ async def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38008,7 +37718,7 @@ async def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38063,7 +37773,6 @@ async def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38078,7 +37787,7 @@ async def get_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38221,7 +37930,6 @@ async def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38236,7 +37944,7 @@ async def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38379,7 +38087,6 @@ async def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38394,7 +38101,7 @@ async def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38440,7 +38147,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38456,7 +38162,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38527,7 +38232,6 @@ async def get_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38542,7 +38246,7 @@ async def get_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_web_site_management_client_operations.py index 3c85d39b63a21..38096456b85c1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_web_site_management_client_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_site_management_client_operations import ( build_check_name_availability_request, build_get_publishing_user_request, @@ -97,7 +95,6 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +109,7 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -201,7 +198,6 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -216,7 +212,7 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -258,7 +254,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +269,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -338,7 +332,6 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -353,7 +346,7 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -461,7 +454,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -476,7 +468,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -527,7 +519,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -543,7 +534,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -621,7 +611,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -636,7 +625,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -679,7 +668,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -695,7 +683,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -758,7 +745,6 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -773,7 +759,7 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -839,7 +825,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -855,7 +840,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -975,7 +959,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -991,7 +974,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1057,7 +1039,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1073,7 +1054,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1135,7 +1115,6 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1150,7 +1129,7 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1249,7 +1228,6 @@ async def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1264,7 +1242,7 @@ async def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1377,7 +1355,6 @@ async def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1497,7 +1474,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1512,7 +1488,7 @@ async def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1625,7 +1601,6 @@ async def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_app_service_certificate_orders_operations.py index e81a36dda25cc..e17ba560e7fc9 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -866,7 +867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -882,7 +882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1001,7 +1000,6 @@ def validate_purchase_information( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1075,7 +1072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1143,7 +1139,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1158,7 +1153,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1171,7 +1166,7 @@ def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1185,7 +1180,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1206,10 +1201,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1217,15 +1212,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1342,10 +1337,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1405,7 +1401,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1540,7 +1535,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1555,7 +1549,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1605,7 +1599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1621,7 +1614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1692,7 +1684,6 @@ def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1698,7 @@ def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1721,7 +1712,7 @@ def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1735,7 +1726,7 @@ def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1757,10 +1748,10 @@ def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1768,15 +1759,15 @@ def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1900,10 +1891,11 @@ def begin_create_or_update_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1966,7 +1958,6 @@ def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2109,7 +2100,6 @@ def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2124,7 +2114,7 @@ def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2246,7 +2236,6 @@ def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2379,7 +2368,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2435,7 +2423,6 @@ def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2569,7 +2556,6 @@ def resend_request_emails( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2718,7 +2704,6 @@ def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2733,7 +2718,7 @@ def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2778,7 +2763,6 @@ def verify_domain_ownership( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2834,7 +2818,6 @@ def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2849,7 +2832,7 @@ def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2894,7 +2877,6 @@ def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2909,7 +2891,7 @@ def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_app_service_environments_operations.py index d86c54a1d8c05..8d3bae8842728 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1760,7 +1761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1776,7 +1776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1846,7 +1845,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1862,7 +1860,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1928,7 +1925,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1943,7 +1939,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1956,7 +1952,7 @@ def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1970,7 +1966,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1991,10 +1987,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2002,18 +1998,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2130,10 +2123,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2155,9 +2149,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2170,7 +2164,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -2181,10 +2175,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2192,12 +2186,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -2228,7 +2230,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -2238,6 +2240,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2376,7 +2379,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2391,14 +2393,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2444,7 +2439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2460,7 +2454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2526,7 +2519,6 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2541,7 +2533,7 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2554,7 +2546,7 @@ def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2568,7 +2560,7 @@ def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2589,10 +2581,10 @@ def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2600,15 +2592,15 @@ def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2737,7 +2729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2753,13 +2744,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2796,6 +2786,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -2861,7 +2852,6 @@ def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2876,7 +2866,7 @@ def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2998,7 +2988,6 @@ def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3013,7 +3002,7 @@ def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3058,7 +3047,6 @@ def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3073,7 +3061,7 @@ def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3121,7 +3109,6 @@ def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3136,7 +3123,7 @@ def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3186,7 +3173,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3202,7 +3188,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3273,7 +3258,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3289,7 +3273,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3355,7 +3338,6 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3370,7 +3352,7 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3383,7 +3365,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3397,7 +3379,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3418,10 +3400,10 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3429,15 +3411,15 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3548,10 +3530,11 @@ def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3687,7 +3670,6 @@ def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3702,11 +3684,7 @@ def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3761,7 +3739,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3777,7 +3754,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3850,7 +3826,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3866,7 +3841,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3937,7 +3911,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3953,7 +3926,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4022,7 +3994,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4038,7 +4009,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4104,7 +4074,6 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4119,7 +4088,7 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4169,7 +4138,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4185,7 +4153,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4258,7 +4225,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4274,7 +4240,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4345,7 +4310,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4360,7 +4324,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4374,7 +4338,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4388,7 +4352,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4410,10 +4374,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4421,15 +4385,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4554,10 +4518,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4581,7 +4548,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4594,7 +4561,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -4605,10 +4572,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4616,18 +4583,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4671,10 +4635,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4732,7 +4697,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4747,7 +4711,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4792,7 +4756,6 @@ def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4810,7 +4773,7 @@ def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4823,7 +4786,7 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -4833,10 +4796,10 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4844,15 +4807,15 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4901,7 +4864,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4917,13 +4879,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4958,6 +4919,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5026,7 +4988,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5042,7 +5003,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5117,7 +5077,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5133,7 +5092,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5163,7 +5121,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5176,7 +5134,7 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -5186,10 +5144,10 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5197,15 +5155,15 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5254,7 +5212,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5270,13 +5227,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -5311,6 +5267,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5385,7 +5342,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5401,7 +5357,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5472,7 +5427,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5488,7 +5442,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5559,7 +5512,6 @@ def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5574,7 +5526,7 @@ def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5588,7 +5540,7 @@ def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5602,7 +5554,7 @@ def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5624,10 +5576,10 @@ def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5635,15 +5587,15 @@ def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5763,10 +5715,11 @@ def begin_create_or_update_worker_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5911,7 +5864,6 @@ def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5926,11 +5878,7 @@ def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5986,7 +5934,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6002,7 +5949,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6078,7 +6024,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6094,7 +6039,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6168,7 +6112,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6184,7 +6127,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6258,7 +6200,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6274,7 +6215,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_app_service_plans_operations.py index 6170c9db993c3..ed5159c461372 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1161,7 +1162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1243,7 +1242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1259,7 +1257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1328,7 +1325,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1343,7 +1339,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1356,7 +1352,7 @@ def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1370,7 +1366,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1391,10 +1387,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1402,15 +1398,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1520,10 +1516,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1583,7 +1580,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1715,7 +1711,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1730,11 +1725,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1777,7 +1768,6 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1792,7 +1782,7 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1843,7 +1833,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1858,7 +1847,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1909,7 +1898,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1971,7 +1959,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1986,7 +1973,7 @@ def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2040,7 +2027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2056,7 +2042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2124,7 +2109,6 @@ def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2139,7 +2123,7 @@ def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2187,7 +2171,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2203,7 +2186,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2277,7 +2259,6 @@ def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2355,7 +2336,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2371,7 +2351,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2437,7 +2416,6 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2452,7 +2430,7 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2505,7 +2483,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2521,7 +2498,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2587,7 +2563,6 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2602,7 +2577,7 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2653,7 +2628,6 @@ def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2668,7 +2642,7 @@ def get_vnet_from_server_farm( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2719,7 +2693,6 @@ def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2734,7 +2707,7 @@ def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2874,7 +2847,6 @@ def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2889,7 +2861,7 @@ def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2937,7 +2909,6 @@ def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2952,7 +2923,7 @@ def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3006,7 +2977,6 @@ def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3021,7 +2991,7 @@ def get_route_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3168,7 +3138,6 @@ def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3183,7 +3152,7 @@ def create_or_update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3237,7 +3206,6 @@ def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3395,7 +3363,6 @@ def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3410,7 +3377,7 @@ def update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3458,7 +3425,6 @@ def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificate_orders_diagnostics_operations.py index 38c57a7296cbe..148511274f195 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -195,7 +194,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -211,7 +209,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -299,7 +296,6 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -314,7 +310,7 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificate_registration_provider_operations.py index 6177981f2bb06..51a11aea02ae2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificate_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificates_operations.py index 0204017563353..78629b83cf2c9 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_certificates_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -312,7 +311,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +326,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -394,7 +391,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -410,7 +406,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -476,7 +471,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -491,7 +485,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -611,7 +605,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -626,7 +619,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -671,7 +664,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -803,7 +795,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -818,7 +809,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_container_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_container_apps_operations.py index 3d5b2b2a52e3d..6dccd7406a338 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_container_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_container_apps_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -296,7 +297,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -312,7 +312,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -378,7 +377,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +392,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -463,7 +460,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Con headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -478,7 +474,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Con error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -491,7 +487,7 @@ def _create_or_update_initial( name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> _models.ContainerApp: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -505,7 +501,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -526,10 +522,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -537,15 +533,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -654,10 +650,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -679,9 +676,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -694,7 +689,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -704,10 +699,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -715,12 +710,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -745,7 +748,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -754,6 +757,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -808,7 +812,6 @@ def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollection: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -823,7 +826,7 @@ def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollection: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecretsCollection", pipeline_response) + deserialized = self._deserialize("SecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_container_apps_revisions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_container_apps_revisions_operations.py index 4c3d61f4ca374..ed821d4be2ee8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_container_apps_revisions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_container_apps_revisions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -296,7 +295,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -312,7 +310,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -383,7 +380,6 @@ def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -398,7 +394,7 @@ def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -446,7 +442,6 @@ def activate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -505,7 +500,6 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -564,7 +558,6 @@ def restart_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_deleted_web_apps_operations.py index c93aa918a3bdd..53a90faee3233 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_deleted_web_apps_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -176,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -192,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -342,7 +337,6 @@ def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +351,7 @@ def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_diagnostics_operations.py index 8855a0e0219be..ad28ec582682e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1101,7 +1100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1117,7 +1115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1204,7 +1201,6 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1219,7 +1215,7 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1267,7 +1263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1283,7 +1278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1370,7 +1364,6 @@ def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1385,7 +1378,7 @@ def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1433,7 +1426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1449,7 +1441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1520,7 +1511,6 @@ def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1535,7 +1525,7 @@ def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1602,7 +1591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1676,7 +1664,6 @@ def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1678,7 @@ def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1759,7 +1746,6 @@ def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,7 +1760,7 @@ def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1827,7 +1813,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1843,7 +1828,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1917,7 +1901,6 @@ def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1932,7 +1915,7 @@ def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2000,7 +1983,6 @@ def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2015,7 +1997,7 @@ def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2066,7 +2048,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2082,7 +2063,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2173,7 +2153,6 @@ def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2188,7 +2167,7 @@ def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2239,7 +2218,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2255,7 +2233,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2329,7 +2306,6 @@ def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2344,7 +2320,7 @@ def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2398,7 +2374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2414,7 +2389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2497,7 +2471,6 @@ def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2512,7 +2485,7 @@ def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2584,7 +2557,6 @@ def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2599,7 +2571,7 @@ def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2655,7 +2627,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2671,7 +2642,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2754,7 +2724,6 @@ def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2769,7 +2738,7 @@ def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2841,7 +2810,6 @@ def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2856,7 +2824,7 @@ def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_domain_registration_provider_operations.py index ef8bd9e867140..d9ddf9ed2c178 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_domain_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_domains_operations.py index a75411084e9cf..04b32565a43bf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -732,7 +733,6 @@ def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +747,7 @@ def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +787,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -803,7 +802,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -863,7 +861,6 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -878,7 +875,7 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -975,7 +972,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -991,7 +987,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1057,7 +1052,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1073,7 +1067,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1139,7 +1132,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1154,7 +1146,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1163,7 +1155,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1177,7 +1169,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1198,10 +1190,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1209,15 +1201,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1320,10 +1312,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1388,7 +1381,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1519,7 +1511,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1534,11 +1525,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1588,7 +1575,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1604,7 +1590,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1675,7 +1660,6 @@ def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1690,7 +1674,7 @@ def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1829,7 +1813,6 @@ def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1844,7 +1827,7 @@ def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1892,7 +1875,6 @@ def delete_ownership_identifier( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2042,7 +2024,6 @@ def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2057,7 +2038,7 @@ def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2102,7 +2083,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2160,7 +2140,6 @@ def transfer_out(self, resource_group_name: str, domain_name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2175,7 +2154,7 @@ def transfer_out(self, resource_group_name: str, domain_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_global_operations_operations.py index edaf3912b05bd..0fd942501a765 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_global_operations_operations.py @@ -18,15 +18,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -194,7 +192,7 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -234,7 +232,6 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -249,7 +246,7 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -294,7 +291,6 @@ def get_subscription_operation_with_async_response( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_kube_environments_operations.py index 4fe30e1250e08..01c898af22ae2 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_kube_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_kube_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -308,7 +309,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -324,7 +324,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -390,7 +389,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -406,7 +404,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -472,7 +469,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Kub headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +483,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Kub error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -500,7 +496,7 @@ def _create_or_update_initial( name: str, kube_environment_envelope: Union[_models.KubeEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.KubeEnvironment: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -514,7 +510,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KubeEnvironment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -535,10 +531,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -546,15 +542,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -667,10 +663,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -692,9 +689,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -707,7 +702,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -717,10 +712,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -728,12 +723,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -758,7 +761,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -767,6 +770,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -905,7 +909,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -920,11 +923,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_provider_operations.py index cd4c8fc8c2069..0d4e293a5462f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -276,7 +275,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -292,7 +290,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -360,7 +357,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -376,7 +372,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -447,7 +442,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -463,7 +457,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -534,7 +527,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -550,7 +542,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -616,7 +607,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -632,7 +622,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -700,7 +689,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -716,7 +704,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -787,7 +774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -803,7 +789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_recommendations_operations.py index f23d589e7c108..49e53be914458 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_recommendations_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -730,7 +729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -746,7 +744,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -806,7 +803,6 @@ def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -859,7 +855,6 @@ def disable_recommendation_for_subscription( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -933,7 +928,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -949,7 +943,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1034,7 +1027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1050,7 +1042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1121,7 +1112,6 @@ def disable_all_for_hosting_environment( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1180,7 +1170,6 @@ def reset_all_filters_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1253,7 +1242,6 @@ def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1268,7 +1256,7 @@ def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1319,7 +1307,6 @@ def disable_recommendation_for_hosting_environment( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1393,7 +1380,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1409,7 +1395,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1494,7 +1479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1510,7 +1494,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1578,7 +1561,6 @@ def disable_all_for_web_app( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1634,7 +1616,6 @@ def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1688,6 @@ def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1722,7 +1702,7 @@ def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1770,7 +1750,6 @@ def disable_recommendation_for_site( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_resource_health_metadata_operations.py index a7e9077523991..b6ca672d0f9a7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_resource_health_metadata_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -389,7 +386,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -405,7 +401,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -477,7 +472,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -493,7 +487,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -559,7 +552,6 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -574,7 +566,7 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -627,7 +619,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -643,7 +634,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -715,7 +705,6 @@ def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -730,7 +719,7 @@ def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_static_sites_operations.py index dfa4776662fd4..6ef806d35ac7b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -2086,7 +2087,6 @@ def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2101,7 +2101,7 @@ def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2142,7 +2142,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2158,7 +2157,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2227,7 +2225,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2243,7 +2240,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2309,7 +2305,6 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2324,7 +2319,7 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2337,7 +2332,7 @@ def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2351,7 +2346,7 @@ def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2372,10 +2367,10 @@ def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2383,15 +2378,15 @@ def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2504,10 +2499,11 @@ def begin_create_or_update_static_site( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2529,9 +2525,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2544,7 +2538,7 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -2554,10 +2548,10 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2565,12 +2559,20 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -2595,7 +2597,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_initial( # type: ignore + raw_result = self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -2604,6 +2606,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2741,7 +2744,6 @@ def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2756,11 +2758,7 @@ def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2813,7 +2811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2829,7 +2826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2903,7 +2899,6 @@ def delete_static_site_user( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3057,7 +3052,6 @@ def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3072,7 +3066,7 @@ def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3122,7 +3116,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3138,7 +3131,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3209,7 +3201,6 @@ def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3224,16 +3215,16 @@ def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3246,7 +3237,7 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -3257,10 +3248,10 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3268,12 +3259,20 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_build( @@ -3302,7 +3301,7 @@ def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_build_initial( # type: ignore + raw_result = self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -3312,6 +3311,7 @@ def begin_delete_static_site_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3458,7 +3458,6 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3473,7 +3472,7 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3605,7 +3604,6 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3620,7 +3618,7 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3673,7 +3671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3689,7 +3686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3760,7 +3756,6 @@ def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3775,7 +3770,7 @@ def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3823,7 +3818,6 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3838,7 +3832,7 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3891,7 +3885,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3907,7 +3900,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3982,7 +3974,6 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3997,7 +3988,9 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4015,7 +4008,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4029,7 +4022,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4055,10 +4048,10 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4066,15 +4059,15 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4233,10 +4226,13 @@ def begin_register_user_provided_function_app_with_static_site_build( # pylint: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4303,7 +4299,6 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4321,14 +4316,14 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4342,7 +4337,7 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4364,10 +4359,10 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4375,12 +4370,20 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -4485,7 +4488,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -4497,6 +4500,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4633,7 +4637,6 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4648,7 +4651,7 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4770,7 +4773,6 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4785,7 +4787,7 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4909,7 +4911,6 @@ def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4924,7 +4925,7 @@ def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4974,7 +4975,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4990,7 +4990,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5061,7 +5060,6 @@ def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5076,7 +5074,7 @@ def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5092,7 +5090,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5106,7 +5104,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5131,10 +5129,10 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5142,15 +5140,15 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5281,10 +5279,13 @@ def begin_create_or_update_static_site_custom_domain( # pylint: disable=name-to params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5306,9 +5307,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5321,7 +5322,7 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -5332,10 +5333,10 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5343,12 +5344,20 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_custom_domain( @@ -5377,7 +5386,7 @@ def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -5387,6 +5396,7 @@ def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5408,7 +5418,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -5417,7 +5427,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5431,7 +5441,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5456,10 +5466,10 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5467,12 +5477,20 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -5580,7 +5598,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -5592,6 +5610,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5613,9 +5632,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _detach_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5628,7 +5645,7 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -5638,10 +5655,10 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5649,12 +5666,20 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -5679,7 +5704,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._detach_static_site_initial( # type: ignore + raw_result = self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -5688,6 +5713,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5752,7 +5778,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5768,7 +5793,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5836,7 +5860,6 @@ def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5851,7 +5874,7 @@ def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5896,7 +5919,6 @@ def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5911,7 +5933,7 @@ def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5956,7 +5978,6 @@ def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5971,7 +5992,7 @@ def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6014,7 +6035,6 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6029,7 +6049,7 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6079,7 +6099,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6095,7 +6114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6166,7 +6184,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6181,7 +6198,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6195,7 +6212,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6209,7 +6226,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6231,10 +6248,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6242,15 +6259,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6375,10 +6392,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6402,7 +6422,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6415,7 +6435,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -6426,10 +6446,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6437,18 +6457,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6492,10 +6509,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6553,7 +6571,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6568,7 +6585,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6690,7 +6707,6 @@ def reset_static_site_api_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6751,7 +6767,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6767,7 +6782,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6838,7 +6852,6 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6853,7 +6866,9 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6870,7 +6885,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6884,7 +6899,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6909,10 +6924,10 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6920,15 +6935,15 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7074,10 +7089,13 @@ def begin_register_user_provided_function_app_with_static_site( # pylint: disab params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7140,7 +7158,6 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7158,13 +7175,13 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7178,7 +7195,7 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7199,10 +7216,10 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7210,12 +7227,20 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -7311,7 +7336,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -7322,6 +7347,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_top_level_domains_operations.py index d363ea587d612..6114b9e60caeb 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_top_level_domains_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_web_apps_operations.py index ec37ef7b88f2e..137245eb6ea3e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_web_apps_operations.py @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -16131,7 +16132,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16147,7 +16147,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16220,7 +16219,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16236,7 +16234,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16305,7 +16302,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16320,7 +16316,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16329,7 +16325,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16343,7 +16339,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16364,10 +16360,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16375,15 +16371,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16495,10 +16491,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16573,7 +16570,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16713,7 +16709,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16728,11 +16723,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16780,7 +16771,6 @@ def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16795,7 +16785,7 @@ def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16915,7 +16905,6 @@ def apply_slot_config_to_production( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17044,7 +17033,6 @@ def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17059,7 +17047,7 @@ def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17105,7 +17093,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17121,7 +17108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17192,7 +17178,6 @@ def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17207,7 +17192,7 @@ def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17258,7 +17243,6 @@ def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17411,7 +17395,6 @@ def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17426,21 +17409,21 @@ def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_initial( # pylint: disable=inconsistent-return-statements + def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17454,7 +17437,7 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17476,10 +17459,10 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17487,12 +17470,20 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore( @@ -17592,7 +17583,7 @@ def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_initial( # type: ignore + raw_result = self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -17604,6 +17595,7 @@ def begin_restore( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -17668,7 +17660,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17684,7 +17675,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17752,7 +17742,6 @@ def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17767,7 +17756,7 @@ def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17891,7 +17880,6 @@ def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17906,7 +17894,7 @@ def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17951,7 +17939,6 @@ def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17966,7 +17953,7 @@ def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18090,7 +18077,6 @@ def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18105,7 +18091,7 @@ def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18153,7 +18139,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18169,7 +18154,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18312,7 +18296,6 @@ def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18327,7 +18310,7 @@ def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18370,7 +18353,6 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18385,7 +18367,7 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18505,7 +18487,6 @@ def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18520,7 +18501,7 @@ def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18563,7 +18544,6 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18578,7 +18558,7 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18623,7 +18603,6 @@ def get_auth_settings_v2_without_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18638,7 +18617,7 @@ def get_auth_settings_v2_without_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18758,7 +18737,6 @@ def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18773,7 +18751,7 @@ def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18816,7 +18794,6 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18831,7 +18808,7 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18953,7 +18930,6 @@ def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18968,7 +18944,7 @@ def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19013,7 +18989,6 @@ def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19028,7 +19003,7 @@ def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19144,7 +19119,6 @@ def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19159,7 +19133,7 @@ def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19204,7 +19178,6 @@ def delete_backup_configuration( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19258,7 +19231,6 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19273,7 +19245,7 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19321,7 +19293,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19337,7 +19308,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19408,7 +19378,6 @@ def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19423,7 +19392,7 @@ def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19471,7 +19440,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19487,7 +19455,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19558,7 +19525,6 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19573,7 +19539,7 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19696,7 +19662,6 @@ def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19711,7 +19676,7 @@ def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19756,7 +19721,6 @@ def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19771,7 +19735,7 @@ def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19816,7 +19780,6 @@ def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19831,7 +19794,7 @@ def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19954,7 +19917,6 @@ def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19969,7 +19931,7 @@ def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20085,7 +20047,6 @@ def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20100,7 +20061,7 @@ def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20143,7 +20104,6 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20158,14 +20118,16 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _list_publishing_credentials_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.User: + def _list_publishing_credentials_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20178,7 +20140,7 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -20188,10 +20150,10 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20199,11 +20161,15 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20244,10 +20210,11 @@ def begin_list_publishing_credentials( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20378,7 +20345,6 @@ def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20393,7 +20359,7 @@ def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20436,7 +20402,6 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20451,7 +20416,7 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20496,7 +20461,6 @@ def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20511,7 +20475,7 @@ def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20640,7 +20604,6 @@ def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20655,7 +20618,7 @@ def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20700,7 +20663,6 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20715,7 +20677,7 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20835,7 +20797,6 @@ def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20850,7 +20811,7 @@ def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20970,7 +20931,6 @@ def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20985,7 +20945,7 @@ def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21037,7 +20997,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21053,7 +21012,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21124,7 +21082,6 @@ def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21139,7 +21096,7 @@ def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21187,7 +21144,6 @@ def recover_site_configuration_snapshot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21243,9 +21199,9 @@ def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21254,12 +21210,16 @@ def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21302,9 +21262,9 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21313,12 +21273,16 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21366,7 +21330,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21382,7 +21345,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21456,7 +21418,6 @@ def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21471,7 +21432,7 @@ def get_continuous_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21519,7 +21480,6 @@ def delete_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21581,7 +21541,6 @@ def start_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21643,7 +21602,6 @@ def stop_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21700,7 +21658,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21716,7 +21673,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21785,7 +21741,6 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21800,7 +21755,7 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21930,7 +21885,6 @@ def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21945,7 +21899,7 @@ def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21993,7 +21947,6 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22051,7 +22004,6 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22066,7 +22018,7 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22190,7 +22142,6 @@ def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22205,7 +22156,7 @@ def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22253,7 +22204,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22269,7 +22219,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22340,7 +22289,6 @@ def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22355,7 +22303,7 @@ def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22487,7 +22435,6 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22502,7 +22449,7 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22550,7 +22497,6 @@ def delete_domain_ownership_identifier( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22693,7 +22639,6 @@ def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22708,7 +22653,7 @@ def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22751,7 +22696,6 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22766,7 +22710,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22775,7 +22719,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22792,7 +22736,7 @@ def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -22813,10 +22757,10 @@ def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22824,11 +22768,15 @@ def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22934,10 +22882,11 @@ def begin_create_ms_deploy_operation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22998,7 +22947,6 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23013,7 +22961,7 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23056,7 +23004,6 @@ def get_one_deploy_status(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23071,7 +23018,7 @@ def get_one_deploy_status(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23114,7 +23061,6 @@ def create_one_deploy_operation(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23129,7 +23075,7 @@ def create_one_deploy_operation(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23180,7 +23126,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23196,7 +23141,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23262,7 +23206,6 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23277,7 +23220,7 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23328,7 +23271,6 @@ def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23343,7 +23285,7 @@ def get_function( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23357,7 +23299,7 @@ def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23371,7 +23313,7 @@ def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23393,10 +23335,10 @@ def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23404,11 +23346,15 @@ def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23528,10 +23474,11 @@ def begin_create_function( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23597,7 +23544,6 @@ def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23748,7 +23694,6 @@ def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23763,11 +23708,7 @@ def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23821,7 +23762,6 @@ def delete_function_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23880,7 +23820,6 @@ def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23895,7 +23834,7 @@ def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23943,7 +23882,6 @@ def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23958,7 +23896,7 @@ def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24001,7 +23939,6 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24016,7 +23953,7 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24061,7 +23998,6 @@ def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24117,7 +24053,6 @@ def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24268,7 +24203,6 @@ def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24283,11 +24217,7 @@ def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24341,7 +24271,6 @@ def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24400,7 +24329,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24416,7 +24344,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24487,7 +24414,6 @@ def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24502,7 +24428,7 @@ def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24634,7 +24560,6 @@ def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24649,7 +24574,7 @@ def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24697,7 +24622,6 @@ def delete_host_name_binding( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24759,7 +24683,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24774,7 +24697,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24914,7 +24837,6 @@ def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24929,7 +24851,7 @@ def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24983,7 +24905,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25134,7 +25055,6 @@ def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25149,7 +25069,7 @@ def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25192,7 +25112,6 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25207,7 +25126,7 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25252,7 +25171,6 @@ def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25267,7 +25185,7 @@ def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25315,7 +25233,6 @@ def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25330,7 +25247,7 @@ def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25461,7 +25378,6 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25476,7 +25392,7 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25527,7 +25443,6 @@ def delete_relay_service_connection( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25669,7 +25584,6 @@ def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25684,7 +25598,7 @@ def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25733,7 +25647,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25749,7 +25662,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25820,7 +25732,6 @@ def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25835,7 +25746,7 @@ def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25883,7 +25794,6 @@ def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25898,7 +25808,7 @@ def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25912,7 +25822,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25929,7 +25839,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -25951,10 +25861,10 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -25962,11 +25872,15 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26086,10 +26000,11 @@ def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26155,7 +26070,6 @@ def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26170,7 +26084,7 @@ def get_instance_ms_deploy_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26227,7 +26141,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26243,7 +26156,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26321,7 +26233,6 @@ def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26336,7 +26247,7 @@ def get_instance_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26393,7 +26304,6 @@ def delete_instance_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26459,9 +26369,9 @@ def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26470,11 +26380,15 @@ def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26534,7 +26448,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26550,7 +26463,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26631,7 +26543,6 @@ def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26646,7 +26557,7 @@ def get_instance_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26704,7 +26615,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26720,7 +26630,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26786,7 +26695,6 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26801,7 +26709,7 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26847,7 +26755,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26863,7 +26770,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26931,7 +26837,6 @@ def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26946,7 +26851,7 @@ def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26960,7 +26865,7 @@ def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26974,7 +26879,7 @@ def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26996,10 +26901,10 @@ def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27007,11 +26912,15 @@ def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27135,10 +27044,11 @@ def begin_migrate_storage( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27166,7 +27076,7 @@ def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27180,7 +27090,7 @@ def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -27201,10 +27111,10 @@ def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27212,11 +27122,15 @@ def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27324,10 +27238,11 @@ def begin_migrate_my_sql( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27389,7 +27304,6 @@ def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27404,7 +27318,7 @@ def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27449,7 +27363,6 @@ def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27464,7 +27377,7 @@ def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27604,7 +27517,6 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27619,7 +27531,7 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27667,7 +27579,6 @@ def delete_swift_virtual_network( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27818,7 +27729,6 @@ def update_swift_virtual_network_connection_with_check( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27833,7 +27743,7 @@ def update_swift_virtual_network_connection_with_check( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27884,7 +27794,6 @@ def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27899,7 +27808,7 @@ def list_network_features( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27947,7 +27856,6 @@ def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27962,11 +27870,7 @@ def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28026,7 +27930,6 @@ def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28041,7 +27944,7 @@ def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28056,7 +27959,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28069,7 +27972,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -28082,10 +27985,10 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28093,15 +27996,15 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28158,10 +28061,11 @@ def begin_start_web_site_network_trace_operation( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28221,7 +28125,6 @@ def stop_web_site_network_trace( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28280,7 +28183,6 @@ def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28295,7 +28197,7 @@ def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28343,7 +28245,6 @@ def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28358,11 +28259,7 @@ def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28410,7 +28307,6 @@ def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28425,7 +28321,7 @@ def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28470,7 +28366,6 @@ def generate_new_site_publishing_password( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28534,7 +28429,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28550,7 +28444,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28618,7 +28511,6 @@ def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28633,7 +28525,7 @@ def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28676,7 +28568,6 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28691,7 +28582,7 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28739,7 +28630,6 @@ def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28754,7 +28644,7 @@ def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28884,7 +28774,6 @@ def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28899,7 +28788,7 @@ def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28947,7 +28836,6 @@ def delete_premier_add_on( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29088,7 +28976,6 @@ def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29103,7 +28990,7 @@ def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29148,7 +29035,6 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29163,7 +29049,7 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29285,7 +29171,6 @@ def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29300,7 +29185,7 @@ def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29350,7 +29235,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29366,7 +29250,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29437,7 +29320,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29452,7 +29334,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29466,7 +29348,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29480,7 +29362,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -29502,10 +29384,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29513,15 +29395,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29646,10 +29528,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29673,7 +29558,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29686,7 +29571,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -29697,10 +29582,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29708,18 +29593,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29763,10 +29645,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29824,7 +29707,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29839,7 +29721,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29890,7 +29772,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29906,7 +29787,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29978,7 +29858,6 @@ def get_process(self, resource_group_name: str, name: str, process_id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29993,7 +29872,7 @@ def get_process(self, resource_group_name: str, name: str, process_id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30046,7 +29925,6 @@ def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30106,9 +29984,9 @@ def get_process_dump(self, resource_group_name: str, name: str, process_id: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30117,11 +29995,15 @@ def get_process_dump(self, resource_group_name: str, name: str, process_id: str, response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30177,7 +30059,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30193,7 +30074,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30270,7 +30150,6 @@ def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30285,7 +30164,7 @@ def get_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30339,7 +30218,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30355,7 +30233,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30426,7 +30303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30442,7 +30318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30513,7 +30388,6 @@ def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30528,7 +30402,7 @@ def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30660,7 +30534,6 @@ def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30675,7 +30548,7 @@ def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30723,7 +30596,6 @@ def delete_public_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30859,9 +30731,9 @@ def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30870,11 +30742,15 @@ def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30921,7 +30797,6 @@ def reset_production_slot_config( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30991,7 +30866,6 @@ def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31009,9 +30883,9 @@ def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31025,7 +30899,7 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31046,10 +30920,10 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31057,12 +30931,20 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob( @@ -31149,7 +31031,7 @@ def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_initial( # type: ignore + raw_result = self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -31160,6 +31042,7 @@ def begin_restore_from_backup_blob( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31181,13 +31064,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31201,7 +31084,7 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31222,10 +31105,10 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31233,12 +31116,20 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app( @@ -31329,7 +31220,7 @@ def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_initial( # type: ignore + raw_result = self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -31340,6 +31231,7 @@ def begin_restore_from_deleted_app( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31361,13 +31253,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31381,7 +31273,7 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31402,10 +31294,10 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31413,12 +31305,20 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot( @@ -31512,7 +31412,7 @@ def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_initial( # type: ignore + raw_result = self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -31523,6 +31423,7 @@ def begin_restore_snapshot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31588,7 +31489,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31604,7 +31504,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31678,7 +31577,6 @@ def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31693,7 +31591,7 @@ def get_site_extension( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31702,7 +31600,7 @@ def get_site_extension( def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31719,7 +31617,7 @@ def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -31730,10 +31628,10 @@ def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31741,15 +31639,15 @@ def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31794,10 +31692,11 @@ def begin_install_site_extension( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31863,7 +31762,6 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31920,7 +31818,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31936,7 +31833,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32009,7 +31905,6 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32024,7 +31919,7 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32038,7 +31933,7 @@ def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32052,7 +31947,7 @@ def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32074,10 +31969,10 @@ def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32085,15 +31980,15 @@ def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32222,10 +32117,11 @@ def begin_create_or_update_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32305,7 +32201,6 @@ def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32458,7 +32353,6 @@ def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32473,11 +32367,7 @@ def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32529,7 +32419,6 @@ def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32544,7 +32433,7 @@ def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32677,7 +32566,6 @@ def apply_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32823,7 +32711,6 @@ def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32838,7 +32725,7 @@ def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32890,7 +32777,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32906,7 +32792,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32981,7 +32866,6 @@ def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32996,7 +32880,7 @@ def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33051,7 +32935,6 @@ def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33217,7 +33100,6 @@ def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33232,14 +33114,14 @@ def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -33247,7 +33129,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33261,7 +33143,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33284,10 +33166,10 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33295,12 +33177,20 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_slot( @@ -33412,7 +33302,7 @@ def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_slot_initial( # type: ignore + raw_result = self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -33425,6 +33315,7 @@ def begin_restore_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -33492,7 +33383,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33508,7 +33398,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33579,7 +33468,6 @@ def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33594,7 +33482,7 @@ def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33728,7 +33616,6 @@ def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33743,7 +33630,7 @@ def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33791,7 +33678,6 @@ def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33806,7 +33692,7 @@ def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33940,7 +33826,6 @@ def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33955,7 +33840,7 @@ def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34007,7 +33892,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34023,7 +33907,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34179,7 +34062,6 @@ def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34194,7 +34076,7 @@ def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34243,7 +34125,6 @@ def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34258,7 +34139,7 @@ def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34391,7 +34272,6 @@ def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34406,7 +34286,7 @@ def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34455,7 +34335,6 @@ def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34470,7 +34349,7 @@ def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34519,7 +34398,6 @@ def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34534,7 +34412,7 @@ def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34667,7 +34545,6 @@ def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34682,7 +34559,7 @@ def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34731,7 +34608,6 @@ def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34746,7 +34622,7 @@ def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34881,7 +34757,6 @@ def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34896,7 +34771,7 @@ def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34945,7 +34820,6 @@ def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34960,7 +34834,7 @@ def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35093,7 +34967,6 @@ def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35108,7 +34981,7 @@ def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35157,7 +35030,6 @@ def delete_backup_configuration_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35217,7 +35089,6 @@ def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35232,7 +35103,7 @@ def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35283,7 +35154,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35299,7 +35169,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35373,7 +35242,6 @@ def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35388,7 +35256,7 @@ def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35439,7 +35307,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35455,7 +35322,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35529,7 +35395,6 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35544,7 +35409,7 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35680,7 +35545,6 @@ def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35695,7 +35559,7 @@ def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35744,7 +35608,6 @@ def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35759,7 +35622,7 @@ def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35808,7 +35671,6 @@ def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35823,7 +35685,7 @@ def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35959,7 +35821,6 @@ def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35974,7 +35835,7 @@ def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36107,7 +35968,6 @@ def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36122,7 +35982,7 @@ def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36171,7 +36031,6 @@ def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36186,7 +36045,7 @@ def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36195,7 +36054,7 @@ def list_metadata_slot( def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36208,7 +36067,7 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -36219,10 +36078,10 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36230,11 +36089,15 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36279,10 +36142,11 @@ def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36430,7 +36294,6 @@ def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36445,7 +36308,7 @@ def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36494,7 +36357,6 @@ def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36509,7 +36371,7 @@ def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36560,7 +36422,6 @@ def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36575,7 +36436,7 @@ def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36708,7 +36569,6 @@ def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36723,7 +36583,7 @@ def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36856,7 +36716,6 @@ def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36871,7 +36730,7 @@ def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36927,7 +36786,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36943,7 +36801,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37018,7 +36875,6 @@ def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37033,7 +36889,7 @@ def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37085,7 +36941,6 @@ def recover_site_configuration_snapshot_slot( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37145,9 +37000,9 @@ def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -37156,12 +37011,16 @@ def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37210,9 +37069,9 @@ def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -37221,12 +37080,16 @@ def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37278,7 +37141,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37294,7 +37156,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37372,7 +37233,6 @@ def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37387,7 +37247,7 @@ def get_continuous_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37439,7 +37299,6 @@ def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37505,7 +37364,6 @@ def start_continuous_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37571,7 +37429,6 @@ def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37634,7 +37491,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37650,7 +37506,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37725,7 +37580,6 @@ def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37740,7 +37594,7 @@ def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37883,7 +37737,6 @@ def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37898,7 +37751,7 @@ def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37950,7 +37803,6 @@ def delete_deployment_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38014,7 +37866,6 @@ def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38029,7 +37880,7 @@ def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38170,7 +38021,6 @@ def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38185,7 +38035,7 @@ def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38237,7 +38087,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38253,7 +38102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38328,7 +38176,6 @@ def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38343,7 +38190,7 @@ def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38488,7 +38335,6 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38503,7 +38349,7 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38555,7 +38401,6 @@ def delete_domain_ownership_identifier_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38711,7 +38556,6 @@ def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38726,7 +38570,7 @@ def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38775,7 +38619,6 @@ def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38790,7 +38633,7 @@ def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38804,7 +38647,7 @@ def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -38821,7 +38664,7 @@ def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -38843,10 +38686,10 @@ def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -38854,11 +38697,15 @@ def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38981,10 +38828,11 @@ def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -39051,7 +38899,6 @@ def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39066,7 +38913,7 @@ def get_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39120,7 +38967,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39136,7 +38982,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39206,7 +39051,6 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39221,7 +39065,7 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39275,7 +39119,6 @@ def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39290,7 +39133,7 @@ def get_instance_function_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39305,7 +39148,7 @@ def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -39319,7 +39162,7 @@ def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -39342,10 +39185,10 @@ def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -39353,11 +39196,15 @@ def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39487,10 +39334,11 @@ def begin_create_instance_function_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -39559,7 +39407,6 @@ def delete_instance_function_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39720,7 +39567,6 @@ def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39735,11 +39581,7 @@ def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39796,7 +39638,6 @@ def delete_function_secret_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39858,7 +39699,6 @@ def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39873,7 +39713,7 @@ def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39924,7 +39764,6 @@ def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39939,7 +39778,7 @@ def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39985,7 +39824,6 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40000,7 +39838,7 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40048,7 +39886,6 @@ def list_sync_status_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40107,7 +39944,6 @@ def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40268,7 +40104,6 @@ def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40283,11 +40118,7 @@ def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40344,7 +40175,6 @@ def delete_host_secret_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40407,7 +40237,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40423,7 +40252,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40498,7 +40326,6 @@ def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40513,7 +40340,7 @@ def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40658,7 +40485,6 @@ def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40673,7 +40499,7 @@ def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40725,7 +40551,6 @@ def delete_host_name_binding_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40790,7 +40615,6 @@ def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40805,7 +40629,7 @@ def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40955,7 +40779,6 @@ def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40970,7 +40793,7 @@ def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41027,7 +40850,6 @@ def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41188,7 +41010,6 @@ def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41203,7 +41024,7 @@ def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41251,7 +41072,6 @@ def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41266,7 +41086,7 @@ def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41315,7 +41135,6 @@ def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41330,7 +41149,7 @@ def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41382,7 +41201,6 @@ def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41397,7 +41215,7 @@ def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41541,7 +41359,6 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41556,7 +41373,7 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41611,7 +41428,6 @@ def delete_relay_service_connection_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41766,7 +41582,6 @@ def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41781,7 +41596,7 @@ def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41834,7 +41649,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41850,7 +41664,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41925,7 +41738,6 @@ def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41940,7 +41752,7 @@ def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41992,7 +41804,6 @@ def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42007,7 +41818,7 @@ def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42022,7 +41833,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42039,7 +41850,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -42062,10 +41873,10 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -42073,11 +41884,15 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42210,10 +42025,11 @@ def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=name-too- params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -42283,7 +42099,6 @@ def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42298,7 +42113,7 @@ def get_instance_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42359,7 +42174,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42375,7 +42189,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42457,7 +42270,6 @@ def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42472,7 +42284,7 @@ def get_instance_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42533,7 +42345,6 @@ def delete_instance_process_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42603,9 +42414,9 @@ def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -42614,11 +42425,15 @@ def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42682,7 +42497,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42698,7 +42512,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42790,7 +42603,6 @@ def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42805,7 +42617,7 @@ def get_instance_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42867,7 +42679,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42883,7 +42694,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42955,7 +42765,6 @@ def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42970,7 +42779,7 @@ def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43022,7 +42831,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43038,7 +42846,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43109,7 +42916,6 @@ def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43124,7 +42930,7 @@ def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43174,7 +42980,6 @@ def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43189,7 +42994,7 @@ def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43238,7 +43043,6 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43253,7 +43057,7 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43406,7 +43210,6 @@ def create_or_update_swift_virtual_network_connection_with_check_slot( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43421,7 +43224,7 @@ def create_or_update_swift_virtual_network_connection_with_check_slot( # pylint error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43473,7 +43276,6 @@ def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43637,7 +43439,6 @@ def update_swift_virtual_network_connection_with_check_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43652,7 +43453,7 @@ def update_swift_virtual_network_connection_with_check_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43707,7 +43508,6 @@ def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43722,7 +43522,7 @@ def list_network_features_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43774,7 +43574,6 @@ def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43789,11 +43588,7 @@ def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43857,7 +43652,6 @@ def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43872,7 +43666,7 @@ def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43888,7 +43682,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -43901,7 +43695,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -43915,10 +43709,10 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -43926,15 +43720,15 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43995,10 +43789,11 @@ def begin_start_web_site_network_trace_operation_slot( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -44061,7 +43856,6 @@ def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44124,7 +43918,6 @@ def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44139,7 +43932,7 @@ def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44191,7 +43984,6 @@ def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44206,11 +43998,7 @@ def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44262,7 +44050,6 @@ def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44277,7 +44064,7 @@ def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44326,7 +44113,6 @@ def generate_new_site_publishing_password_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44394,7 +44180,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44410,7 +44195,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44482,7 +44266,6 @@ def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44497,7 +44280,7 @@ def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44546,7 +44329,6 @@ def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44561,7 +44343,7 @@ def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44613,7 +44395,6 @@ def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44628,7 +44409,7 @@ def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44771,7 +44552,6 @@ def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44786,7 +44566,7 @@ def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44838,7 +44618,6 @@ def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44992,7 +44771,6 @@ def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45007,7 +44785,7 @@ def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45057,7 +44835,6 @@ def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45072,7 +44849,7 @@ def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45208,7 +44985,6 @@ def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45223,7 +44999,7 @@ def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45276,7 +45052,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45292,7 +45067,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45366,7 +45140,6 @@ def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45381,7 +45154,7 @@ def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45396,7 +45169,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45410,7 +45183,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -45433,10 +45206,10 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45444,15 +45217,15 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45587,10 +45360,13 @@ def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -45614,7 +45390,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45627,7 +45403,7 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -45639,10 +45415,10 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45650,18 +45426,15 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45708,10 +45481,11 @@ def begin_delete_private_endpoint_connection_slot( # pylint: disable=name-too-l params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -45772,7 +45546,6 @@ def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45787,7 +45560,7 @@ def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45844,7 +45617,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45860,7 +45632,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45938,7 +45709,6 @@ def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45953,7 +45723,7 @@ def get_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46010,7 +45780,6 @@ def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46076,9 +45845,9 @@ def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -46087,11 +45856,15 @@ def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46151,7 +45924,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46167,7 +45939,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46248,7 +46019,6 @@ def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46263,7 +46033,7 @@ def get_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46321,7 +46091,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46337,7 +46106,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46412,7 +46180,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46428,7 +46195,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46503,7 +46269,6 @@ def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46518,7 +46283,7 @@ def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46663,7 +46428,6 @@ def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46678,7 +46442,7 @@ def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46730,7 +46494,6 @@ def delete_public_certificate_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46879,9 +46642,9 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -46890,11 +46653,15 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46945,7 +46712,6 @@ def reset_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47020,7 +46786,6 @@ def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47038,14 +46803,14 @@ def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47059,7 +46824,7 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -47081,10 +46846,10 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47092,12 +46857,20 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob_slot( @@ -47200,7 +46973,7 @@ def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -47212,6 +46985,7 @@ def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -47233,14 +47007,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47254,7 +47028,7 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -47276,10 +47050,10 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47287,12 +47061,20 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app_slot( @@ -47395,7 +47177,7 @@ def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -47407,6 +47189,7 @@ def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -47428,14 +47211,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47449,7 +47232,7 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -47471,10 +47254,10 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47482,12 +47265,20 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot_slot( @@ -47593,7 +47384,7 @@ def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_slot_initial( # type: ignore + raw_result = self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -47605,6 +47396,7 @@ def begin_restore_snapshot_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -47674,7 +47466,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47690,7 +47481,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47768,7 +47558,6 @@ def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47783,7 +47572,7 @@ def get_site_extension_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47792,7 +47581,7 @@ def get_site_extension_slot( def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47809,7 +47598,7 @@ def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -47821,10 +47610,10 @@ def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47832,15 +47621,15 @@ def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47889,10 +47678,11 @@ def begin_install_site_extension_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -47962,7 +47752,6 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48108,7 +47897,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48124,7 +47912,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48154,14 +47941,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48175,7 +47962,7 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48197,10 +47984,10 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48208,12 +47995,20 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot( @@ -48316,7 +48111,7 @@ def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_initial( # type: ignore + raw_result = self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -48328,6 +48123,7 @@ def begin_swap_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -48393,7 +48189,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48409,7 +48204,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48483,7 +48277,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48499,7 +48292,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48571,7 +48363,6 @@ def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48586,14 +48377,7 @@ def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48607,7 +48391,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48621,7 +48405,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48643,10 +48427,10 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48654,18 +48438,15 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48790,10 +48571,11 @@ def begin_create_or_update_source_control_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -48863,7 +48645,6 @@ def delete_source_control_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49009,7 +48790,6 @@ def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49024,14 +48804,7 @@ def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49080,7 +48853,6 @@ def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49107,7 +48879,7 @@ def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -49120,7 +48892,7 @@ def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -49134,10 +48906,10 @@ def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -49145,15 +48917,15 @@ def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49214,10 +48986,11 @@ def begin_start_network_trace_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -49281,7 +49054,6 @@ def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49340,7 +49112,6 @@ def stop_network_trace_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49400,7 +49171,6 @@ def sync_repository_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49459,7 +49229,6 @@ def sync_function_triggers_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49522,7 +49291,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49538,7 +49306,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49616,7 +49383,6 @@ def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49631,7 +49397,7 @@ def get_triggered_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49683,7 +49449,6 @@ def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49752,7 +49517,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49768,7 +49532,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49849,7 +49612,6 @@ def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49864,7 +49626,7 @@ def get_triggered_web_job_history_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49919,7 +49681,6 @@ def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49988,7 +49749,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50004,7 +49764,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50076,7 +49835,6 @@ def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50091,7 +49849,7 @@ def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50143,7 +49901,6 @@ def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50158,7 +49915,7 @@ def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50309,7 +50066,6 @@ def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50324,7 +50080,7 @@ def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50379,7 +50135,6 @@ def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50541,7 +50296,6 @@ def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50556,7 +50310,7 @@ def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50615,7 +50369,6 @@ def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50630,7 +50383,7 @@ def get_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50786,7 +50539,6 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50801,7 +50553,7 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50957,7 +50709,6 @@ def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50972,7 +50723,7 @@ def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51024,7 +50775,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51040,7 +50790,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51115,7 +50864,6 @@ def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51130,7 +50878,7 @@ def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51252,7 +51000,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51268,7 +51015,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51298,13 +51044,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -51318,7 +51064,7 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -51339,10 +51085,10 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -51350,12 +51096,20 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot_with_production( @@ -51446,7 +51200,7 @@ def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_with_production_initial( # type: ignore + raw_result = self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -51457,6 +51211,7 @@ def begin_swap_slot_with_production( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -51517,7 +51272,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51533,7 +51287,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51604,7 +51357,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51620,7 +51372,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51686,7 +51437,6 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51701,14 +51451,7 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51721,7 +51464,7 @@ def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -51735,7 +51478,7 @@ def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -51756,10 +51499,10 @@ def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -51767,18 +51510,15 @@ def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51890,10 +51630,11 @@ def begin_create_or_update_source_control( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -51959,7 +51700,6 @@ def delete_source_control( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52092,7 +51832,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52107,14 +51846,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52159,7 +51891,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52185,7 +51916,7 @@ def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -52198,7 +51929,7 @@ def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -52211,10 +51942,10 @@ def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -52222,15 +51953,15 @@ def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52287,10 +52018,11 @@ def begin_start_network_trace( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -52350,7 +52082,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52406,7 +52137,6 @@ def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52462,7 +52192,6 @@ def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52518,7 +52247,6 @@ def sync_function_triggers( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52577,7 +52305,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52593,7 +52320,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52667,7 +52393,6 @@ def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52682,7 +52407,7 @@ def get_triggered_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52730,7 +52455,6 @@ def delete_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52795,7 +52519,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52811,7 +52534,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52888,7 +52610,6 @@ def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52903,7 +52624,7 @@ def get_triggered_web_job_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52954,7 +52675,6 @@ def run_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53019,7 +52739,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53035,7 +52754,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -53103,7 +52821,6 @@ def list_vnet_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53118,7 +52835,7 @@ def list_vnet_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53166,7 +52883,6 @@ def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53181,7 +52897,7 @@ def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53319,7 +53035,6 @@ def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53334,7 +53049,7 @@ def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53385,7 +53100,6 @@ def delete_vnet_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53534,7 +53248,6 @@ def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53549,7 +53262,7 @@ def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53604,7 +53317,6 @@ def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53619,7 +53331,7 @@ def get_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53762,7 +53474,6 @@ def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53777,7 +53488,7 @@ def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53920,7 +53631,6 @@ def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53935,7 +53645,7 @@ def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53981,7 +53691,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53997,7 +53706,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -54066,7 +53774,6 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54081,7 +53788,7 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_web_site_management_client_operations.py index ac938f3adbfe4..25ea1e6e54563 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/operations/_web_site_management_client_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -564,7 +563,6 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -579,7 +577,7 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -668,7 +666,6 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -683,7 +680,7 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -724,7 +721,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -740,7 +736,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -804,7 +799,6 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -819,7 +813,7 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -927,7 +921,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -942,7 +935,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -992,7 +985,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1008,7 +1000,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1086,7 +1077,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1101,7 +1091,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1143,7 +1133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1159,7 +1148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1222,7 +1210,6 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1237,7 +1224,7 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1303,7 +1290,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1319,7 +1305,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1439,7 +1424,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1455,7 +1439,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1520,7 +1503,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1536,7 +1518,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1598,7 +1579,6 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1613,7 +1593,7 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1712,7 +1692,6 @@ def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1727,7 +1706,7 @@ def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1840,7 +1819,6 @@ def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1960,7 +1938,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1975,7 +1952,7 @@ def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2088,7 +2065,6 @@ def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_metadata.json index 4ccc26ebe717a..36b4a2c1502a5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_vendor.py index fd66631892ed1..abd2e5566a353 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from .._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class WebSiteManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_web_site_management_client.py index 948a2f9f4c82e..76e0b55859402 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -287,7 +288,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/_vendor.py index 39f69956b8888..6e80ec49ed289 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/_web_site_management_client.py index bde90ea03f5ae..f46142182541b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -292,7 +293,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_app_service_certificate_orders_operations.py index 3c9427f9f1ca3..308a4d084c083 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_certificate_orders_operations import ( build_create_or_update_certificate_request, build_create_or_update_request, @@ -119,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -254,7 +266,6 @@ async def validate_purchase_information( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +405,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +419,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +432,7 @@ async def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -438,7 +446,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -459,10 +467,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -470,15 +478,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -595,10 +603,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -658,7 +667,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +801,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -808,7 +815,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -858,7 +865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -874,7 +880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -945,7 +950,6 @@ async def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -960,7 +964,7 @@ async def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -974,7 +978,7 @@ async def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -988,7 +992,7 @@ async def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1010,10 +1014,10 @@ async def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1021,15 +1025,15 @@ async def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1153,10 +1157,11 @@ async def begin_create_or_update_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1219,7 +1224,6 @@ async def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1362,7 +1366,6 @@ async def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1377,7 +1380,7 @@ async def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1499,7 +1502,6 @@ async def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1632,7 +1634,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1688,7 +1689,6 @@ async def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1822,7 +1822,6 @@ async def resend_request_emails( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1971,7 +1970,6 @@ async def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1986,7 +1984,7 @@ async def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2031,7 +2029,6 @@ async def verify_domain_ownership( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2087,7 +2084,6 @@ async def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2102,7 +2098,7 @@ async def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2147,7 +2143,6 @@ async def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2162,7 +2157,7 @@ async def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_app_service_environments_operations.py index e47f31a5abf39..71acfd4cd87e0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_app_service_environments_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_environments_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_change_vnet_request, @@ -148,7 +162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -164,7 +177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -234,7 +246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -250,7 +261,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -316,7 +326,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -331,7 +340,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -344,7 +353,7 @@ async def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -358,7 +367,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -379,10 +388,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -390,21 +399,19 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -521,10 +528,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -546,9 +554,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -561,7 +569,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -572,10 +580,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -583,12 +591,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -619,7 +635,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -629,6 +645,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -767,7 +784,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -782,14 +798,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -838,7 +847,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -854,7 +862,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -920,7 +927,6 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -935,7 +941,7 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -948,7 +954,7 @@ async def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -962,7 +968,7 @@ async def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -983,10 +989,10 @@ async def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -994,15 +1000,15 @@ async def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1131,7 +1137,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1147,13 +1152,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1190,6 +1194,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -1255,7 +1260,6 @@ async def get_ase_custom_dns_suffix_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1270,7 +1274,7 @@ async def get_ase_custom_dns_suffix_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response) + deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1392,7 +1396,6 @@ async def update_ase_custom_dns_suffix_configuration( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1407,7 +1410,7 @@ async def update_ase_custom_dns_suffix_configuration( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response) + deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1452,7 +1455,6 @@ async def delete_ase_custom_dns_suffix_configuration( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1467,11 +1469,7 @@ async def delete_ase_custom_dns_suffix_configuration( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1516,7 +1514,6 @@ async def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1531,7 +1528,7 @@ async def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1653,7 +1650,6 @@ async def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1668,7 +1664,7 @@ async def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1713,7 +1709,6 @@ async def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1728,7 +1723,7 @@ async def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1776,7 +1771,6 @@ async def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1791,7 +1785,7 @@ async def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1842,7 +1836,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1858,7 +1851,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1930,7 +1922,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1946,7 +1937,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2014,7 +2004,6 @@ async def get_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2029,7 +2018,7 @@ async def get_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2042,7 +2031,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2056,7 +2045,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2077,10 +2066,10 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2088,15 +2077,15 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2210,10 +2199,11 @@ async def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2349,7 +2339,6 @@ async def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2364,11 +2353,7 @@ async def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2423,7 +2408,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2439,7 +2423,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2512,7 +2495,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2528,7 +2510,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2599,7 +2580,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2615,7 +2595,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2683,7 +2662,6 @@ async def test_upgrade_available_notification( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2701,9 +2679,7 @@ async def test_upgrade_available_notification( # pylint: disable=inconsistent-r if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _upgrade_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _upgrade_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2716,7 +2692,7 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_upgrade_request( resource_group_name=resource_group_name, @@ -2726,10 +2702,10 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2737,12 +2713,20 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -2767,7 +2751,7 @@ async def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._upgrade_initial( # type: ignore + raw_result = await self._upgrade_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -2776,6 +2760,7 @@ async def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2838,7 +2823,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2854,7 +2838,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2920,7 +2903,6 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2935,7 +2917,7 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2986,7 +2968,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3002,7 +2983,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3075,7 +3055,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3091,7 +3070,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3162,7 +3140,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3177,7 +3154,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3191,7 +3168,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3205,7 +3182,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3227,10 +3204,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3238,15 +3215,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3371,10 +3348,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3398,7 +3378,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3411,7 +3391,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -3422,10 +3402,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3433,18 +3413,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3488,10 +3465,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3549,7 +3527,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3564,7 +3541,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3609,7 +3586,6 @@ async def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3627,7 +3603,7 @@ async def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3640,7 +3616,7 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -3650,10 +3626,10 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3661,15 +3637,15 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3720,7 +3696,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3736,13 +3711,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3777,6 +3751,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3846,7 +3821,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3862,7 +3836,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3937,7 +3910,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3953,7 +3925,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3983,7 +3954,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3996,7 +3967,7 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -4006,10 +3977,10 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4017,15 +3988,15 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4076,7 +4047,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4092,13 +4062,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4133,6 +4102,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -4208,7 +4178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4224,7 +4193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4296,7 +4264,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4312,7 +4279,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4383,7 +4349,6 @@ async def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4398,7 +4363,7 @@ async def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4412,7 +4377,7 @@ async def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4426,7 +4391,7 @@ async def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4448,10 +4413,10 @@ async def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4459,15 +4424,15 @@ async def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4590,10 +4555,11 @@ async def begin_create_or_update_worker_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4738,7 +4704,6 @@ async def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4753,11 +4718,7 @@ async def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4814,7 +4775,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4830,7 +4790,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4906,7 +4865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4922,7 +4880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4996,7 +4953,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5012,7 +4968,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5086,7 +5041,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5102,7 +5056,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_app_service_plans_operations.py index 092306132567d..12457e227466c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_app_service_plans_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_plans_operations import ( build_create_or_update_request, build_create_or_update_vnet_route_request, @@ -131,7 +145,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -147,7 +160,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -216,7 +228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -301,7 +311,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -316,7 +325,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +338,7 @@ async def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -343,7 +352,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -364,10 +373,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -375,15 +384,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -493,10 +502,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -556,7 +566,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -688,7 +697,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -703,11 +711,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +754,6 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -765,7 +768,7 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -816,7 +819,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -831,7 +833,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -882,7 +884,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -944,7 +945,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -959,7 +959,7 @@ async def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1013,7 +1013,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1029,7 +1028,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1097,7 +1095,6 @@ async def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1112,7 +1109,7 @@ async def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1161,7 +1158,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1173,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1251,7 +1246,6 @@ async def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1329,7 +1323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1345,7 +1338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1411,7 +1403,6 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1426,7 +1417,7 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1480,7 +1471,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1496,7 +1486,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1562,7 +1551,6 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1577,7 +1565,7 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1628,7 +1616,6 @@ async def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1643,7 +1630,7 @@ async def get_vnet_from_server_farm( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1694,7 +1681,6 @@ async def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1709,7 +1695,7 @@ async def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1849,7 +1835,6 @@ async def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1864,7 +1849,7 @@ async def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1913,7 +1898,6 @@ async def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1928,7 +1912,7 @@ async def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1982,7 +1966,6 @@ async def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1997,7 +1980,7 @@ async def get_route_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2144,7 +2127,6 @@ async def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2159,7 +2141,7 @@ async def create_or_update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2213,7 +2195,6 @@ async def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2371,7 +2352,6 @@ async def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2386,7 +2366,7 @@ async def update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2434,7 +2414,6 @@ async def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_certificate_orders_diagnostics_operations.py index 0ec8d78164d7f..d585fff199dd0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_orders_diagnostics_operations import ( build_get_app_service_certificate_order_detector_response_request, build_list_app_service_certificate_order_detector_response_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -212,7 +208,6 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -227,7 +222,7 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_certificate_registration_provider_operations.py index 0255a6ea30635..92e7ad862cc68 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_certificate_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_certificates_operations.py index f97e39cca87f4..e3057a7795298 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -105,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -187,7 +183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -203,7 +198,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -269,7 +263,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -284,7 +277,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -404,7 +397,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -419,7 +411,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +456,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +587,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +601,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_container_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_container_apps_operations.py index a5ab1c4788af4..577aca4b5a8c3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_container_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_container_apps_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_operations import ( build_create_or_update_request, build_delete_request, @@ -104,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -187,7 +185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -203,7 +200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -272,7 +268,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -287,7 +282,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -300,7 +295,7 @@ async def _create_or_update_initial( name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> _models.ContainerApp: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -314,7 +309,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -335,10 +330,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -346,15 +341,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -463,10 +458,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -488,9 +484,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -503,7 +497,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -513,10 +507,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -524,12 +518,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -554,7 +556,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -563,6 +565,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -617,7 +620,6 @@ async def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollect headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -632,7 +634,7 @@ async def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollect error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecretsCollection", pipeline_response) + deserialized = self._deserialize("SecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_container_apps_revisions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_container_apps_revisions_operations.py index d98946daed582..b1310f75b1c61 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_container_apps_revisions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_container_apps_revisions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_revisions_operations import ( build_activate_revision_request, build_deactivate_revision_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -194,7 +190,6 @@ async def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +204,7 @@ async def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,7 +252,6 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -316,7 +310,6 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +368,6 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_deleted_web_apps_operations.py index 175bc98bbcfd0..667ed34ad36a5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_deleted_web_apps_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_web_apps_operations import ( build_get_deleted_web_app_by_location_request, build_list_by_location_request, @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -179,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +257,6 @@ async def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +271,7 @@ async def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_diagnostics_operations.py index 5b40feba246b2..73e5af58f53d6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._diagnostics_operations import ( build_execute_site_analysis_request, build_execute_site_analysis_slot_request, @@ -126,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +225,6 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +239,7 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,7 +288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -309,7 +303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +389,6 @@ async def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +403,7 @@ async def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -476,7 +467,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -547,7 +537,6 @@ async def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -562,7 +551,7 @@ async def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -630,7 +618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -704,7 +691,6 @@ async def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,7 +705,7 @@ async def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +773,6 @@ async def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +787,7 @@ async def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -855,7 +840,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -871,7 +855,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -945,7 +928,6 @@ async def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -960,7 +942,7 @@ async def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1028,7 +1010,6 @@ async def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1043,7 +1024,7 @@ async def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1095,7 +1076,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1111,7 +1091,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1202,7 +1181,6 @@ async def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1217,7 +1195,7 @@ async def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1269,7 +1247,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1285,7 +1262,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1359,7 +1335,6 @@ async def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1374,7 +1349,7 @@ async def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1429,7 +1404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1445,7 +1419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1528,7 +1501,6 @@ async def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1543,7 +1515,7 @@ async def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1615,7 +1587,6 @@ async def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1630,7 +1601,7 @@ async def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1686,7 +1657,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1702,7 +1672,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1785,7 +1754,6 @@ async def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1800,7 +1768,7 @@ async def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1872,7 +1840,6 @@ async def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1887,7 +1854,7 @@ async def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_domain_registration_provider_operations.py index 2d800674c27cb..580a158d39b80 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_domain_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_domains_operations.py index 912cf4814c48d..2c179eedb1aca 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_check_availability_request, build_create_or_update_ownership_identifier_request, @@ -163,7 +163,6 @@ async def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +177,7 @@ async def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -218,7 +217,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -234,7 +232,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -294,7 +291,6 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -309,7 +305,7 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +405,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -425,7 +420,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -491,7 +485,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -507,7 +500,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -573,7 +565,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -588,7 +579,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -597,7 +588,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -611,7 +602,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -632,10 +623,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -643,15 +634,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -757,10 +748,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -825,7 +817,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -956,7 +947,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -971,11 +961,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1025,7 +1011,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1041,7 +1026,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1112,7 +1096,6 @@ async def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1127,7 +1110,7 @@ async def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1266,7 +1249,6 @@ async def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1281,7 +1263,7 @@ async def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1329,7 +1311,6 @@ async def delete_ownership_identifier( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1479,7 +1460,6 @@ async def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1494,7 +1474,7 @@ async def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1539,7 +1519,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1597,7 +1576,6 @@ async def transfer_out(self, resource_group_name: str, domain_name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1612,7 +1590,7 @@ async def transfer_out(self, resource_group_name: str, domain_name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_global_operations_operations.py index 93a5f371e8e6c..e6d72e56bd75b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_global_operations_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._global_operations_operations import ( build_get_deleted_web_app_request, build_get_deleted_web_app_snapshots_request, @@ -94,7 +92,6 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +106,7 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -149,7 +146,6 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -164,7 +160,7 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -209,7 +205,6 @@ async def get_subscription_operation_with_async_response( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_kube_environments_operations.py index 41ce41c0ca39e..bc5525e1ea996 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_kube_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_kube_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._kube_environments_operations import ( build_create_or_update_request, build_delete_request, @@ -104,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -189,7 +187,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -205,7 +202,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -271,7 +267,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +281,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -299,7 +294,7 @@ async def _create_or_update_initial( name: str, kube_environment_envelope: Union[_models.KubeEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.KubeEnvironment: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -313,7 +308,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KubeEnvironment] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -334,10 +329,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -345,15 +340,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -466,10 +461,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -491,9 +487,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -506,7 +500,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -516,10 +510,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -527,12 +521,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -557,7 +559,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -566,6 +568,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -704,7 +707,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,11 +721,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_provider_operations.py index 637392c76c6d1..524b71e7acce1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._provider_operations import ( build_get_available_stacks_on_prem_request, build_get_available_stacks_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -192,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -208,7 +203,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -280,7 +274,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -296,7 +289,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -367,7 +359,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -383,7 +374,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -449,7 +439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -465,7 +454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -533,7 +521,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -549,7 +536,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +606,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -636,7 +621,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_recommendations_operations.py index ba805226fb09a..7c6294cd752a4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_recommendations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommendations_operations import ( build_disable_all_for_hosting_environment_request, build_disable_all_for_web_app_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -198,7 +194,6 @@ async def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -252,7 +247,6 @@ async def disable_recommendation_for_subscription( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -327,7 +321,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -343,7 +336,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -429,7 +421,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -445,7 +436,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -516,7 +506,6 @@ async def disable_all_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -575,7 +564,6 @@ async def reset_all_filters_for_hosting_environment( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -648,7 +636,6 @@ async def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -663,7 +650,7 @@ async def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -714,7 +701,6 @@ async def disable_recommendation_for_hosting_environment( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -789,7 +775,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -805,7 +790,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -891,7 +875,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -907,7 +890,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -975,7 +957,6 @@ async def disable_all_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1031,7 +1012,6 @@ async def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1104,7 +1084,6 @@ async def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1119,7 +1098,7 @@ async def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1167,7 +1146,6 @@ async def disable_recommendation_for_site( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_resource_health_metadata_operations.py index a443173b8b87a..d6642b730a09d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_resource_health_metadata_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._resource_health_metadata_operations import ( build_get_by_site_request, build_get_by_site_slot_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -189,7 +185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -205,7 +200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -279,7 +273,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -295,7 +288,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -361,7 +353,6 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +367,7 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -431,7 +422,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -447,7 +437,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -519,7 +508,6 @@ async def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -534,7 +522,7 @@ async def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_static_sites_operations.py index 1edb9b37c3d8e..1fd63f7b6669f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._static_sites_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_create_or_update_basic_auth_request, @@ -248,7 +248,6 @@ async def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -263,7 +262,7 @@ async def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -305,7 +304,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -321,7 +319,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -391,7 +388,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -407,7 +403,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -475,7 +470,6 @@ async def get_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -490,7 +484,7 @@ async def get_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -503,7 +497,7 @@ async def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -517,7 +511,7 @@ async def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -538,10 +532,10 @@ async def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -549,15 +543,15 @@ async def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -676,10 +670,11 @@ async def begin_create_or_update_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -701,9 +696,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -716,7 +711,7 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -726,10 +721,10 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -737,12 +732,20 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site( @@ -769,7 +772,7 @@ async def begin_delete_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_initial( # type: ignore + raw_result = await self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -778,6 +781,7 @@ async def begin_delete_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -918,7 +922,6 @@ async def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -933,11 +936,7 @@ async def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -990,7 +989,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1006,7 +1004,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1080,7 +1077,6 @@ async def delete_static_site_user( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1234,7 +1230,6 @@ async def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1249,7 +1244,7 @@ async def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1299,7 +1294,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1315,7 +1309,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1386,7 +1379,6 @@ async def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1401,16 +1393,16 @@ async def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1423,7 +1415,7 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -1434,10 +1426,10 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1445,12 +1437,20 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_build( @@ -1479,7 +1479,7 @@ async def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_build_initial( # type: ignore + raw_result = await self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -1489,6 +1489,7 @@ async def begin_delete_static_site_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1635,7 +1636,6 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1650,7 +1650,7 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1782,7 +1782,6 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1797,7 +1796,7 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1849,7 +1848,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1865,7 +1863,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1939,7 +1936,6 @@ async def get_build_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1954,7 +1950,7 @@ async def get_build_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2098,7 +2094,6 @@ async def create_or_update_build_database_connection( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2113,7 +2108,7 @@ async def create_or_update_build_database_connection( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2164,7 +2159,6 @@ async def delete_build_database_connection( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2320,7 +2314,6 @@ async def update_build_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2335,7 +2328,7 @@ async def update_build_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2386,7 +2379,6 @@ async def get_build_database_connection_with_details( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2401,7 +2393,7 @@ async def get_build_database_connection_with_details( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2454,7 +2446,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2470,7 +2461,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2541,7 +2531,6 @@ async def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2556,7 +2545,7 @@ async def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2604,7 +2593,6 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2619,7 +2607,7 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2671,7 +2659,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2687,7 +2674,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2764,7 +2750,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2780,7 +2765,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2856,7 +2840,6 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2871,7 +2854,9 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2889,7 +2874,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2903,7 +2888,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2929,10 +2914,10 @@ async def _register_user_provided_function_app_with_static_site_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2940,15 +2925,15 @@ async def _register_user_provided_function_app_with_static_site_build_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3107,10 +3092,13 @@ async def begin_register_user_provided_function_app_with_static_site_build( # p params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3177,7 +3165,6 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3195,14 +3182,14 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3216,7 +3203,7 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3238,10 +3225,10 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3249,12 +3236,20 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -3359,7 +3354,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -3371,6 +3366,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3507,7 +3503,6 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3522,7 +3517,7 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3572,7 +3567,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3588,7 +3582,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3659,7 +3652,6 @@ async def get_basic_auth( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3674,7 +3666,7 @@ async def get_basic_auth( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3806,7 +3798,6 @@ async def create_or_update_basic_auth( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3821,7 +3812,7 @@ async def create_or_update_basic_auth( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3943,7 +3934,6 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3958,7 +3948,7 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4082,7 +4072,6 @@ async def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4097,7 +4086,7 @@ async def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4147,7 +4136,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4163,7 +4151,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4234,7 +4221,6 @@ async def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4249,7 +4235,7 @@ async def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4265,7 +4251,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4279,7 +4265,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4304,10 +4290,10 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4315,15 +4301,15 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4457,10 +4443,13 @@ async def begin_create_or_update_static_site_custom_domain( # pylint: disable=n params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4482,9 +4471,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4497,7 +4486,7 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -4508,10 +4497,10 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4519,12 +4508,20 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_custom_domain( @@ -4553,7 +4550,7 @@ async def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = await self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -4563,6 +4560,7 @@ async def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4584,7 +4582,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -4593,7 +4591,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4607,7 +4605,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4632,10 +4630,10 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4643,12 +4641,20 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -4756,7 +4762,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -4768,6 +4774,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4831,7 +4838,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4847,7 +4853,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4918,7 +4923,6 @@ async def get_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4933,7 +4937,7 @@ async def get_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5067,7 +5071,6 @@ async def create_or_update_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5082,7 +5085,7 @@ async def create_or_update_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5130,7 +5133,6 @@ async def delete_database_connection( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5276,7 +5278,6 @@ async def update_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5291,7 +5292,7 @@ async def update_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5339,7 +5340,6 @@ async def get_database_connection_with_details( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5354,16 +5354,16 @@ async def get_database_connection_with_details( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _detach_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5376,7 +5376,7 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -5386,10 +5386,10 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5397,12 +5397,20 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_detach_static_site( @@ -5429,7 +5437,7 @@ async def begin_detach_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._detach_static_site_initial( # type: ignore + raw_result = await self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -5438,6 +5446,7 @@ async def begin_detach_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5502,7 +5511,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5518,7 +5526,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5586,7 +5593,6 @@ async def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5601,7 +5607,7 @@ async def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5646,7 +5652,6 @@ async def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5661,7 +5666,7 @@ async def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5706,7 +5711,6 @@ async def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5721,7 +5725,7 @@ async def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5766,7 +5770,6 @@ async def list_static_site_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5781,7 +5784,7 @@ async def list_static_site_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5831,7 +5834,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5847,7 +5849,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5918,7 +5919,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5933,7 +5933,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5947,7 +5947,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5961,7 +5961,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5983,10 +5983,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5994,15 +5994,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6127,10 +6127,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6154,7 +6157,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6167,7 +6170,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -6178,10 +6181,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6189,18 +6192,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6244,10 +6244,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6305,7 +6306,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6320,7 +6320,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6442,7 +6442,6 @@ async def reset_static_site_api_key( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6502,7 +6501,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6518,7 +6516,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6592,7 +6589,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6608,7 +6604,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6680,7 +6675,6 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6695,7 +6689,9 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6712,7 +6708,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6726,7 +6722,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6751,10 +6747,10 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6762,15 +6758,15 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6916,10 +6912,13 @@ async def begin_register_user_provided_function_app_with_static_site( # pylint: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6982,7 +6981,6 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7000,13 +6998,13 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7020,7 +7018,7 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7041,10 +7039,10 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7052,12 +7050,20 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -7153,7 +7159,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -7164,6 +7170,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7185,14 +7192,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_backend_initial( # pylint: disable=inconsistent-return-statements + async def _validate_backend_initial( self, resource_group_name: str, name: str, linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7206,7 +7213,7 @@ async def _validate_backend_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7228,10 +7235,10 @@ async def _validate_backend_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7239,12 +7246,20 @@ async def _validate_backend_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_backend( @@ -7348,7 +7363,7 @@ async def begin_validate_backend( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_backend_initial( # type: ignore + raw_result = await self._validate_backend_initial( resource_group_name=resource_group_name, name=name, linked_backend_name=linked_backend_name, @@ -7360,6 +7375,7 @@ async def begin_validate_backend( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7381,7 +7397,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return-statements + async def _validate_backend_for_build_initial( self, resource_group_name: str, name: str, @@ -7389,7 +7405,7 @@ async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-r linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7403,7 +7419,7 @@ async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-r api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7426,10 +7442,10 @@ async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7437,12 +7453,20 @@ async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_backend_for_build( @@ -7555,7 +7579,7 @@ async def begin_validate_backend_for_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_backend_for_build_initial( # type: ignore + raw_result = await self._validate_backend_for_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -7568,6 +7592,7 @@ async def begin_validate_backend_for_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7632,7 +7657,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7648,7 +7672,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7724,7 +7747,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7740,7 +7762,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7811,7 +7832,6 @@ async def get_linked_backend( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7826,7 +7846,7 @@ async def get_linked_backend( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7840,7 +7860,7 @@ async def _link_backend_initial( linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteLinkedBackendARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7854,7 +7874,7 @@ async def _link_backend_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteLinkedBackendARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7876,10 +7896,10 @@ async def _link_backend_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7887,11 +7907,15 @@ async def _link_backend_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8018,10 +8042,11 @@ async def begin_link_backend( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8093,7 +8118,6 @@ async def unlink_backend( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8155,7 +8179,6 @@ async def get_linked_backend_for_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8170,7 +8193,7 @@ async def get_linked_backend_for_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8185,7 +8208,7 @@ async def _link_backend_to_build_initial( linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteLinkedBackendARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8199,7 +8222,7 @@ async def _link_backend_to_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteLinkedBackendARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -8222,10 +8245,10 @@ async def _link_backend_to_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8233,11 +8256,15 @@ async def _link_backend_to_build_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8374,10 +8401,11 @@ async def begin_link_backend_to_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8453,7 +8481,6 @@ async def unlink_backend_from_build( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_top_level_domains_operations.py index 7201164b14e3d..f570f6e95972a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_level_domains_operations import ( build_get_request, build_list_agreements_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -178,7 +174,6 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_web_apps_operations.py index f782ad507a25a..d5bbae429f5e7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_web_apps_operations.py @@ -32,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -45,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_apps_operations import ( build_add_premier_add_on_request, build_add_premier_add_on_slot_request, @@ -519,7 +519,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -535,7 +534,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -608,7 +606,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -624,7 +621,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -693,7 +689,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -708,7 +703,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -717,7 +712,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode async def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -731,7 +726,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -752,10 +747,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -763,15 +758,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -883,10 +878,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -961,7 +957,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1101,7 +1096,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1116,11 +1110,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1168,7 +1158,6 @@ async def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1183,7 +1172,7 @@ async def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1303,7 +1292,6 @@ async def apply_slot_config_to_production( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1432,7 +1420,6 @@ async def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1447,7 +1434,7 @@ async def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1493,7 +1480,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1509,7 +1495,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1580,7 +1565,6 @@ async def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1595,7 +1579,7 @@ async def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1646,7 +1630,6 @@ async def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1799,7 +1782,6 @@ async def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1814,21 +1796,21 @@ async def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_initial( # pylint: disable=inconsistent-return-statements + async def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1842,7 +1824,7 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1864,10 +1846,10 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1875,12 +1857,20 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore( @@ -1980,7 +1970,7 @@ async def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_initial( # type: ignore + raw_result = await self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -1992,6 +1982,7 @@ async def begin_restore( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2057,7 +2048,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2073,7 +2063,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2141,7 +2130,6 @@ async def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2156,7 +2144,7 @@ async def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2280,7 +2268,6 @@ async def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2295,7 +2282,7 @@ async def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2340,7 +2327,6 @@ async def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2355,7 +2341,7 @@ async def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2479,7 +2465,6 @@ async def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2494,7 +2479,7 @@ async def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2543,7 +2528,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2559,7 +2543,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2702,7 +2685,6 @@ async def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2717,7 +2699,7 @@ async def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2762,7 +2744,6 @@ async def list_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2777,7 +2758,7 @@ async def list_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2897,7 +2878,6 @@ async def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2912,7 +2892,7 @@ async def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2955,7 +2935,6 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2970,7 +2949,7 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3015,7 +2994,6 @@ async def get_auth_settings_v2_without_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3030,7 +3008,7 @@ async def get_auth_settings_v2_without_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3153,7 +3131,6 @@ async def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3168,7 +3145,7 @@ async def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3213,7 +3190,6 @@ async def get_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3228,7 +3204,7 @@ async def get_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3350,7 +3326,6 @@ async def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3365,7 +3340,7 @@ async def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3410,7 +3385,6 @@ async def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3425,7 +3399,7 @@ async def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3541,7 +3515,6 @@ async def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3556,7 +3529,7 @@ async def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3601,7 +3574,6 @@ async def delete_backup_configuration( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3657,7 +3629,6 @@ async def get_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3672,7 +3643,7 @@ async def get_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3721,7 +3692,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3737,7 +3707,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3808,7 +3777,6 @@ async def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3823,7 +3791,7 @@ async def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3872,7 +3840,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3888,7 +3855,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3959,7 +3925,6 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3974,7 +3939,7 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4097,7 +4062,6 @@ async def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4112,7 +4076,7 @@ async def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4157,7 +4121,6 @@ async def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4172,7 +4135,7 @@ async def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4217,7 +4180,6 @@ async def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4232,7 +4194,7 @@ async def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4355,7 +4317,6 @@ async def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4370,7 +4331,7 @@ async def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4486,7 +4447,6 @@ async def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4501,7 +4461,7 @@ async def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4544,7 +4504,6 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4559,7 +4518,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4568,7 +4527,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any async def _list_publishing_credentials_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4581,7 +4540,7 @@ async def _list_publishing_credentials_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -4591,10 +4550,10 @@ async def _list_publishing_credentials_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4602,11 +4561,15 @@ async def _list_publishing_credentials_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4647,10 +4610,11 @@ async def begin_list_publishing_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4781,7 +4745,6 @@ async def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4796,7 +4759,7 @@ async def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4839,7 +4802,6 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4854,7 +4816,7 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4900,7 +4862,6 @@ async def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4915,7 +4876,7 @@ async def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5044,7 +5005,6 @@ async def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5059,7 +5019,7 @@ async def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5104,7 +5064,6 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5119,7 +5078,7 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5239,7 +5198,6 @@ async def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5254,7 +5212,7 @@ async def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5374,7 +5332,6 @@ async def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5389,7 +5346,7 @@ async def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5441,7 +5398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5457,7 +5413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5528,7 +5483,6 @@ async def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5543,7 +5497,7 @@ async def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5591,7 +5545,6 @@ async def recover_site_configuration_snapshot( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5647,9 +5600,9 @@ async def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5658,12 +5611,16 @@ async def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5708,9 +5665,9 @@ async def get_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5719,12 +5676,16 @@ async def get_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5773,7 +5734,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5789,7 +5749,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5863,7 +5822,6 @@ async def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5878,7 +5836,7 @@ async def get_continuous_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5926,7 +5884,6 @@ async def delete_continuous_web_job( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5988,7 +5945,6 @@ async def start_continuous_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6050,7 +6006,6 @@ async def stop_continuous_web_job( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6110,7 +6065,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6126,7 +6080,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6158,7 +6111,7 @@ async def get_next(next_link=None): async def _get_production_site_deployment_status_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, deployment_status_id: str, **kwargs: Any - ) -> _models.CsmDeploymentStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6171,7 +6124,7 @@ async def _get_production_site_deployment_status_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.CsmDeploymentStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_get_production_site_deployment_status_request( resource_group_name=resource_group_name, @@ -6182,10 +6135,10 @@ async def _get_production_site_deployment_status_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6193,15 +6146,15 @@ async def _get_production_site_deployment_status_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6247,10 +6200,11 @@ async def begin_get_production_site_deployment_status( # pylint: disable=name-t params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6313,7 +6267,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6329,7 +6282,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6398,7 +6350,6 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6413,7 +6364,7 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6543,7 +6494,6 @@ async def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6558,7 +6508,7 @@ async def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6606,7 +6556,6 @@ async def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6666,7 +6615,6 @@ async def list_deployment_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6681,7 +6629,7 @@ async def list_deployment_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6805,7 +6753,6 @@ async def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6820,7 +6767,7 @@ async def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6868,7 +6815,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6884,7 +6830,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6955,7 +6900,6 @@ async def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6970,7 +6914,7 @@ async def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7105,7 +7049,6 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7120,7 +7063,7 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7168,7 +7111,6 @@ async def delete_domain_ownership_identifier( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7314,7 +7256,6 @@ async def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7329,7 +7270,7 @@ async def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7372,7 +7313,6 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7387,7 +7327,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7396,7 +7336,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar async def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7413,7 +7353,7 @@ async def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7434,10 +7374,10 @@ async def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7445,11 +7385,15 @@ async def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7555,10 +7499,11 @@ async def begin_create_ms_deploy_operation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7619,7 +7564,6 @@ async def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7634,7 +7578,7 @@ async def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7678,7 +7622,6 @@ async def get_one_deploy_status(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7693,7 +7636,7 @@ async def get_one_deploy_status(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7736,7 +7679,6 @@ async def create_one_deploy_operation(self, resource_group_name: str, name: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7751,7 +7693,7 @@ async def create_one_deploy_operation(self, resource_group_name: str, name: str, error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7803,7 +7745,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7819,7 +7760,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7885,7 +7825,6 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7900,7 +7839,7 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7951,7 +7890,6 @@ async def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7966,7 +7904,7 @@ async def get_function( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7980,7 +7918,7 @@ async def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7994,7 +7932,7 @@ async def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -8016,10 +7954,10 @@ async def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8027,11 +7965,15 @@ async def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8151,10 +8093,11 @@ async def begin_create_function( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8220,7 +8163,6 @@ async def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8371,7 +8313,6 @@ async def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8386,11 +8327,7 @@ async def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8444,7 +8381,6 @@ async def delete_function_secret( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8503,7 +8439,6 @@ async def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8518,7 +8453,7 @@ async def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8566,7 +8501,6 @@ async def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8581,7 +8515,7 @@ async def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8624,7 +8558,6 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8639,7 +8572,7 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8684,7 +8617,6 @@ async def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8740,7 +8672,6 @@ async def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8891,7 +8822,6 @@ async def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8906,11 +8836,7 @@ async def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8964,7 +8890,6 @@ async def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9024,7 +8949,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9040,7 +8964,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9111,7 +9034,6 @@ async def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9126,7 +9048,7 @@ async def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9258,7 +9180,6 @@ async def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9273,7 +9194,7 @@ async def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9321,7 +9242,6 @@ async def delete_host_name_binding( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9383,7 +9303,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9398,7 +9317,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9538,7 +9457,6 @@ async def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9553,7 +9471,7 @@ async def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9607,7 +9525,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9758,7 +9675,6 @@ async def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9773,7 +9689,7 @@ async def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9818,7 +9734,6 @@ async def list_hybrid_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9833,7 +9748,7 @@ async def list_hybrid_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9879,7 +9794,6 @@ async def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9894,7 +9808,7 @@ async def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9942,7 +9856,6 @@ async def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9957,7 +9870,7 @@ async def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10091,7 +10004,6 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10106,7 +10018,7 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10157,7 +10069,6 @@ async def delete_relay_service_connection( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10302,7 +10213,6 @@ async def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10317,7 +10227,7 @@ async def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10367,7 +10277,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10383,7 +10292,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10454,7 +10362,6 @@ async def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10469,7 +10376,7 @@ async def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10517,7 +10424,6 @@ async def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10532,7 +10438,7 @@ async def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10546,7 +10452,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10563,7 +10469,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10585,10 +10491,10 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10596,11 +10502,15 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10720,10 +10630,11 @@ async def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10789,7 +10700,6 @@ async def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10804,7 +10714,7 @@ async def get_instance_ms_deploy_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10861,7 +10771,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10877,7 +10786,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10956,7 +10864,6 @@ async def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10971,7 +10878,7 @@ async def get_instance_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11028,7 +10935,6 @@ async def delete_instance_process( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11095,9 +11001,9 @@ async def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11106,11 +11012,15 @@ async def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11171,7 +11081,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11187,7 +11096,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11269,7 +11177,6 @@ async def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11284,7 +11191,7 @@ async def get_instance_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11344,7 +11251,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11360,7 +11266,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11426,7 +11331,6 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11441,7 +11345,7 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11489,7 +11393,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11505,7 +11408,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11573,7 +11475,6 @@ async def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11588,7 +11489,7 @@ async def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11602,7 +11503,7 @@ async def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11616,7 +11517,7 @@ async def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11638,10 +11539,10 @@ async def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11649,11 +11550,15 @@ async def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11777,10 +11682,11 @@ async def begin_migrate_storage( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11808,7 +11714,7 @@ async def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11822,7 +11728,7 @@ async def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11843,10 +11749,10 @@ async def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11854,11 +11760,15 @@ async def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11969,10 +11879,11 @@ async def begin_migrate_my_sql( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12034,7 +11945,6 @@ async def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12049,7 +11959,7 @@ async def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12094,7 +12004,6 @@ async def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12109,7 +12018,7 @@ async def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12249,7 +12158,6 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12264,7 +12172,7 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12312,7 +12220,6 @@ async def delete_swift_virtual_network( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12463,7 +12370,6 @@ async def update_swift_virtual_network_connection_with_check( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12478,7 +12384,7 @@ async def update_swift_virtual_network_connection_with_check( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12529,7 +12435,6 @@ async def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12544,7 +12449,7 @@ async def list_network_features( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12593,7 +12498,6 @@ async def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12608,11 +12512,7 @@ async def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12672,7 +12572,6 @@ async def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12687,7 +12586,7 @@ async def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12702,7 +12601,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12715,7 +12614,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -12728,10 +12627,10 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -12739,15 +12638,15 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12805,10 +12704,11 @@ async def begin_start_web_site_network_trace_operation( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12868,7 +12768,6 @@ async def stop_web_site_network_trace( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12928,7 +12827,6 @@ async def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12943,7 +12841,7 @@ async def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12992,7 +12890,6 @@ async def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13007,11 +12904,7 @@ async def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13060,7 +12953,6 @@ async def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13075,7 +12967,7 @@ async def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13121,7 +13013,6 @@ async def generate_new_site_publishing_password( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13186,7 +13077,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13202,7 +13092,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13270,7 +13159,6 @@ async def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13285,7 +13173,7 @@ async def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13328,7 +13216,6 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13343,7 +13230,7 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13391,7 +13278,6 @@ async def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13406,7 +13292,7 @@ async def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13536,7 +13422,6 @@ async def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13551,7 +13436,7 @@ async def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13599,7 +13484,6 @@ async def delete_premier_add_on( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13740,7 +13624,6 @@ async def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13755,7 +13638,7 @@ async def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13800,7 +13683,6 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13815,7 +13697,7 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13937,7 +13819,6 @@ async def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13952,7 +13833,7 @@ async def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14002,7 +13883,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14018,7 +13898,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14089,7 +13968,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14104,7 +13982,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14118,7 +13996,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14132,7 +14010,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14154,10 +14032,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14165,15 +14043,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14298,10 +14176,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14325,7 +14206,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14338,7 +14219,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -14349,10 +14230,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14360,18 +14241,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14415,10 +14293,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14476,7 +14355,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14491,7 +14369,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14544,7 +14422,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14560,7 +14437,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14635,7 +14511,6 @@ async def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14650,7 +14525,7 @@ async def get_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14703,7 +14578,6 @@ async def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14766,9 +14640,9 @@ async def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14777,11 +14651,15 @@ async def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14838,7 +14716,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14854,7 +14731,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14932,7 +14808,6 @@ async def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14947,7 +14822,7 @@ async def get_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15003,7 +14878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15019,7 +14893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15091,7 +14964,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15107,7 +14979,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15178,7 +15049,6 @@ async def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15193,7 +15063,7 @@ async def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15325,7 +15195,6 @@ async def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15340,7 +15209,7 @@ async def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15388,7 +15257,6 @@ async def delete_public_certificate( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15524,9 +15392,9 @@ async def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15535,11 +15403,15 @@ async def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15586,7 +15458,6 @@ async def reset_production_slot_config( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15656,7 +15527,6 @@ async def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15674,9 +15544,9 @@ async def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15690,7 +15560,7 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15711,10 +15581,10 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15722,12 +15592,20 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob( @@ -15814,7 +15692,7 @@ async def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -15825,6 +15703,7 @@ async def begin_restore_from_backup_blob( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15846,13 +15725,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15866,7 +15745,7 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15887,10 +15766,10 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15898,12 +15777,20 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app( @@ -15994,7 +15881,7 @@ async def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -16005,6 +15892,7 @@ async def begin_restore_from_deleted_app( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16026,13 +15914,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16046,7 +15934,7 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16067,10 +15955,10 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16078,12 +15966,20 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot( @@ -16177,7 +16073,7 @@ async def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_initial( # type: ignore + raw_result = await self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -16188,6 +16084,7 @@ async def begin_restore_snapshot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16254,7 +16151,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16270,7 +16166,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16344,7 +16239,6 @@ async def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16359,7 +16253,7 @@ async def get_site_extension( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16368,7 +16262,7 @@ async def get_site_extension( async def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16385,7 +16279,7 @@ async def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -16396,10 +16290,10 @@ async def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16407,15 +16301,15 @@ async def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16461,10 +16355,11 @@ async def begin_install_site_extension( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16530,7 +16425,6 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16587,7 +16481,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16603,7 +16496,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16676,7 +16568,6 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16691,7 +16582,7 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16705,7 +16596,7 @@ async def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16719,7 +16610,7 @@ async def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16741,10 +16632,10 @@ async def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16752,15 +16643,15 @@ async def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16889,10 +16780,11 @@ async def begin_create_or_update_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16972,7 +16864,6 @@ async def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17125,7 +17016,6 @@ async def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17140,11 +17030,7 @@ async def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17196,7 +17082,6 @@ async def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17211,7 +17096,7 @@ async def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17344,7 +17229,6 @@ async def apply_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17490,7 +17374,6 @@ async def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17505,7 +17388,7 @@ async def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17557,7 +17440,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17573,7 +17455,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17648,7 +17529,6 @@ async def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17663,7 +17543,7 @@ async def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17718,7 +17598,6 @@ async def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17884,7 +17763,6 @@ async def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17899,14 +17777,14 @@ async def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -17914,7 +17792,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17928,7 +17806,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17951,10 +17829,10 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17962,12 +17840,20 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_slot( @@ -18079,7 +17965,7 @@ async def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_slot_initial( # type: ignore + raw_result = await self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -18092,6 +17978,7 @@ async def begin_restore_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -18160,7 +18047,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18176,7 +18062,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18247,7 +18132,6 @@ async def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18262,7 +18146,7 @@ async def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18396,7 +18280,6 @@ async def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18411,7 +18294,7 @@ async def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18459,7 +18342,6 @@ async def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18474,7 +18356,7 @@ async def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18608,7 +18490,6 @@ async def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18623,7 +18504,7 @@ async def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18676,7 +18557,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18692,7 +18572,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18848,7 +18727,6 @@ async def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18863,7 +18741,7 @@ async def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18912,7 +18790,6 @@ async def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18927,7 +18804,7 @@ async def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19060,7 +18937,6 @@ async def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19075,7 +18951,7 @@ async def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19124,7 +19000,6 @@ async def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19139,7 +19014,7 @@ async def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19188,7 +19063,6 @@ async def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19203,7 +19077,7 @@ async def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19339,7 +19213,6 @@ async def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19354,7 +19227,7 @@ async def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19403,7 +19276,6 @@ async def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19418,7 +19290,7 @@ async def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19553,7 +19425,6 @@ async def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19568,7 +19439,7 @@ async def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19617,7 +19488,6 @@ async def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19632,7 +19502,7 @@ async def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19765,7 +19635,6 @@ async def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19780,7 +19649,7 @@ async def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19829,7 +19698,6 @@ async def delete_backup_configuration_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19889,7 +19757,6 @@ async def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19904,7 +19771,7 @@ async def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19956,7 +19823,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19972,7 +19838,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20046,7 +19911,6 @@ async def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20061,7 +19925,7 @@ async def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20113,7 +19977,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20129,7 +19992,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20203,7 +20065,6 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20218,7 +20079,7 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20354,7 +20215,6 @@ async def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20369,7 +20229,7 @@ async def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20418,7 +20278,6 @@ async def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20433,7 +20292,7 @@ async def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20482,7 +20341,6 @@ async def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20497,7 +20355,7 @@ async def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20633,7 +20491,6 @@ async def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20648,7 +20505,7 @@ async def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20781,7 +20638,6 @@ async def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20796,7 +20652,7 @@ async def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20845,7 +20701,6 @@ async def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20860,7 +20715,7 @@ async def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20869,7 +20724,7 @@ async def list_metadata_slot( async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20882,7 +20737,7 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -20893,10 +20748,10 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20904,11 +20759,15 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20953,10 +20812,11 @@ async def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21104,7 +20964,6 @@ async def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21119,7 +20978,7 @@ async def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21168,7 +21027,6 @@ async def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21183,7 +21041,7 @@ async def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21234,7 +21092,6 @@ async def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21249,7 +21106,7 @@ async def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21382,7 +21239,6 @@ async def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21397,7 +21253,7 @@ async def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21530,7 +21386,6 @@ async def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21545,7 +21400,7 @@ async def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21601,7 +21456,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21617,7 +21471,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21692,7 +21545,6 @@ async def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21707,7 +21559,7 @@ async def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21759,7 +21611,6 @@ async def recover_site_configuration_snapshot_slot( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21819,9 +21670,9 @@ async def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21830,12 +21681,16 @@ async def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21884,9 +21739,9 @@ async def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21895,12 +21750,16 @@ async def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21953,7 +21812,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21969,7 +21827,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22047,7 +21904,6 @@ async def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22062,7 +21918,7 @@ async def get_continuous_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22114,7 +21970,6 @@ async def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22180,7 +22035,6 @@ async def start_continuous_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22246,7 +22100,6 @@ async def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22310,7 +22163,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22326,7 +22178,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22358,7 +22209,7 @@ async def get_next(next_link=None): async def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, deployment_status_id: str, **kwargs: Any - ) -> _models.CsmDeploymentStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22371,7 +22222,7 @@ async def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.CsmDeploymentStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_get_slot_site_deployment_status_slot_request( resource_group_name=resource_group_name, @@ -22383,10 +22234,10 @@ async def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22394,15 +22245,15 @@ async def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22452,10 +22303,11 @@ async def begin_get_slot_site_deployment_status_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22522,7 +22374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22538,7 +22389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22613,7 +22463,6 @@ async def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22628,7 +22477,7 @@ async def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22771,7 +22620,6 @@ async def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22786,7 +22634,7 @@ async def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22838,7 +22686,6 @@ async def delete_deployment_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22902,7 +22749,6 @@ async def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22917,7 +22763,7 @@ async def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23058,7 +22904,6 @@ async def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23073,7 +22918,7 @@ async def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23125,7 +22970,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23141,7 +22985,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23216,7 +23059,6 @@ async def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23231,7 +23073,7 @@ async def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23379,7 +23221,6 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23394,7 +23235,7 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23446,7 +23287,6 @@ async def delete_domain_ownership_identifier_slot( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23605,7 +23445,6 @@ async def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23620,7 +23459,7 @@ async def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23669,7 +23508,6 @@ async def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23684,7 +23522,7 @@ async def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23698,7 +23536,7 @@ async def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23715,7 +23553,7 @@ async def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23737,10 +23575,10 @@ async def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23748,11 +23586,15 @@ async def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23875,10 +23717,11 @@ async def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23945,7 +23788,6 @@ async def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23960,7 +23802,7 @@ async def get_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24015,7 +23857,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24031,7 +23872,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24103,7 +23943,6 @@ async def get_functions_admin_token_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24118,7 +23957,7 @@ async def get_functions_admin_token_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24172,7 +24011,6 @@ async def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24187,7 +24025,7 @@ async def get_instance_function_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24202,7 +24040,7 @@ async def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24216,7 +24054,7 @@ async def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24239,10 +24077,10 @@ async def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24250,11 +24088,15 @@ async def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24384,10 +24226,11 @@ async def begin_create_instance_function_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24456,7 +24299,6 @@ async def delete_instance_function_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24617,7 +24459,6 @@ async def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24632,11 +24473,7 @@ async def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24693,7 +24530,6 @@ async def delete_function_secret_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24755,7 +24591,6 @@ async def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24770,7 +24605,7 @@ async def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24821,7 +24656,6 @@ async def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24836,7 +24670,7 @@ async def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24884,7 +24718,6 @@ async def list_host_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24899,7 +24732,7 @@ async def list_host_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24947,7 +24780,6 @@ async def list_sync_status_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25006,7 +24838,6 @@ async def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25167,7 +24998,6 @@ async def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25182,11 +25012,7 @@ async def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25243,7 +25069,6 @@ async def delete_host_secret_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25307,7 +25132,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25323,7 +25147,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25398,7 +25221,6 @@ async def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25413,7 +25235,7 @@ async def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25558,7 +25380,6 @@ async def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25573,7 +25394,7 @@ async def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25625,7 +25446,6 @@ async def delete_host_name_binding_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25690,7 +25510,6 @@ async def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25705,7 +25524,7 @@ async def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25855,7 +25674,6 @@ async def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25870,7 +25688,7 @@ async def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25927,7 +25745,6 @@ async def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26088,7 +25905,6 @@ async def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26103,7 +25919,7 @@ async def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26151,7 +25967,6 @@ async def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26166,7 +25981,7 @@ async def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26216,7 +26031,6 @@ async def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26231,7 +26045,7 @@ async def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26283,7 +26097,6 @@ async def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26298,7 +26111,7 @@ async def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26445,7 +26258,6 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26460,7 +26272,7 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26515,7 +26327,6 @@ async def delete_relay_service_connection_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26673,7 +26484,6 @@ async def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26688,7 +26498,7 @@ async def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26742,7 +26552,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26758,7 +26567,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26833,7 +26641,6 @@ async def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26848,7 +26655,7 @@ async def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26900,7 +26707,6 @@ async def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26915,7 +26721,7 @@ async def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26930,7 +26736,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26947,7 +26753,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26970,10 +26776,10 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26981,11 +26787,15 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27118,10 +26928,11 @@ async def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=nam params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27191,7 +27002,6 @@ async def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27206,7 +27016,7 @@ async def get_instance_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27267,7 +27077,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27283,7 +27092,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27366,7 +27174,6 @@ async def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27381,7 +27188,7 @@ async def get_instance_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27442,7 +27249,6 @@ async def delete_instance_process_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27513,9 +27319,9 @@ async def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27524,11 +27330,15 @@ async def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27593,7 +27403,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27609,7 +27418,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27702,7 +27510,6 @@ async def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27717,7 +27524,7 @@ async def get_instance_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27781,7 +27588,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27797,7 +27603,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27869,7 +27674,6 @@ async def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27884,7 +27688,7 @@ async def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27936,7 +27740,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27952,7 +27755,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28023,7 +27825,6 @@ async def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28038,7 +27839,7 @@ async def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28088,7 +27889,6 @@ async def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28103,7 +27903,7 @@ async def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28152,7 +27952,6 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28167,7 +27966,7 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28320,7 +28119,6 @@ async def create_or_update_swift_virtual_network_connection_with_check_slot( # headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28335,7 +28133,7 @@ async def create_or_update_swift_virtual_network_connection_with_check_slot( # error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28387,7 +28185,6 @@ async def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28551,7 +28348,6 @@ async def update_swift_virtual_network_connection_with_check_slot( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28566,7 +28362,7 @@ async def update_swift_virtual_network_connection_with_check_slot( # pylint: di error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28621,7 +28417,6 @@ async def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28636,7 +28431,7 @@ async def list_network_features_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28689,7 +28484,6 @@ async def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28704,11 +28498,7 @@ async def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28772,7 +28562,6 @@ async def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28787,7 +28576,7 @@ async def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28803,7 +28592,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28816,7 +28605,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -28830,10 +28619,10 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28841,15 +28630,15 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28911,10 +28700,11 @@ async def begin_start_web_site_network_trace_operation_slot( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28977,7 +28767,6 @@ async def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29041,7 +28830,6 @@ async def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29056,7 +28844,7 @@ async def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29109,7 +28897,6 @@ async def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29124,11 +28911,7 @@ async def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29181,7 +28964,6 @@ async def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29196,7 +28978,7 @@ async def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29246,7 +29028,6 @@ async def generate_new_site_publishing_password_slot( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29315,7 +29096,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29331,7 +29111,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29403,7 +29182,6 @@ async def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29418,7 +29196,7 @@ async def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29467,7 +29245,6 @@ async def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29482,7 +29259,7 @@ async def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29534,7 +29311,6 @@ async def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29549,7 +29325,7 @@ async def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29692,7 +29468,6 @@ async def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29707,7 +29482,7 @@ async def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29759,7 +29534,6 @@ async def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29913,7 +29687,6 @@ async def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29928,7 +29701,7 @@ async def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29978,7 +29751,6 @@ async def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29993,7 +29765,7 @@ async def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30129,7 +29901,6 @@ async def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30144,7 +29915,7 @@ async def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30197,7 +29968,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30213,7 +29983,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30287,7 +30056,6 @@ async def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30302,7 +30070,7 @@ async def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30317,7 +30085,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30331,7 +30099,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30354,10 +30122,10 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30365,15 +30133,15 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30508,10 +30276,13 @@ async def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30535,7 +30306,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30548,7 +30319,7 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -30560,10 +30331,10 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30571,18 +30342,15 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30629,10 +30397,11 @@ async def begin_delete_private_endpoint_connection_slot( # pylint: disable=name params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30693,7 +30462,6 @@ async def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30708,7 +30476,7 @@ async def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30765,7 +30533,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30781,7 +30548,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30860,7 +30626,6 @@ async def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30875,7 +30640,7 @@ async def get_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30932,7 +30697,6 @@ async def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30999,9 +30763,9 @@ async def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -31010,11 +30774,15 @@ async def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31075,7 +30843,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31091,7 +30858,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31173,7 +30939,6 @@ async def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31188,7 +30953,7 @@ async def get_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31248,7 +31013,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31264,7 +31028,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31340,7 +31103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31356,7 +31118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31431,7 +31192,6 @@ async def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31446,7 +31206,7 @@ async def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31591,7 +31351,6 @@ async def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31606,7 +31365,7 @@ async def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31658,7 +31417,6 @@ async def delete_public_certificate_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31807,9 +31565,9 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -31818,11 +31576,15 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31873,7 +31635,6 @@ async def reset_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31948,7 +31709,6 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31966,14 +31726,14 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31987,7 +31747,7 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32009,10 +31769,10 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32020,12 +31780,20 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob_slot( @@ -32128,7 +31896,7 @@ async def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -32140,6 +31908,7 @@ async def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32161,14 +31930,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32182,7 +31951,7 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32204,10 +31973,10 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32215,12 +31984,20 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app_slot( @@ -32323,7 +32100,7 @@ async def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -32335,6 +32112,7 @@ async def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32356,14 +32134,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32377,7 +32155,7 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32399,10 +32177,10 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32410,12 +32188,20 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot_slot( @@ -32521,7 +32307,7 @@ async def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_slot_initial( # type: ignore + raw_result = await self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -32533,6 +32319,7 @@ async def begin_restore_snapshot_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32603,7 +32390,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32619,7 +32405,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32697,7 +32482,6 @@ async def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32712,7 +32496,7 @@ async def get_site_extension_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32721,7 +32505,7 @@ async def get_site_extension_slot( async def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32738,7 +32522,7 @@ async def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -32750,10 +32534,10 @@ async def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32761,15 +32545,15 @@ async def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32819,10 +32603,11 @@ async def begin_install_site_extension_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32892,7 +32677,6 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33041,7 +32825,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33057,7 +32840,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33087,14 +32869,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33108,7 +32890,7 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33130,10 +32912,10 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33141,12 +32923,20 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot( @@ -33249,7 +33039,7 @@ async def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_initial( # type: ignore + raw_result = await self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -33261,6 +33051,7 @@ async def begin_swap_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -33326,7 +33117,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33342,7 +33132,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33416,7 +33205,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33432,7 +33220,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33504,7 +33291,6 @@ async def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33519,14 +33305,7 @@ async def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33540,7 +33319,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33554,7 +33333,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33576,10 +33355,10 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33587,18 +33366,15 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33726,10 +33502,11 @@ async def begin_create_or_update_source_control_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33799,7 +33576,6 @@ async def delete_source_control_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33945,7 +33721,6 @@ async def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33960,14 +33735,7 @@ async def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34016,7 +33784,6 @@ async def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34043,7 +33810,7 @@ async def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34056,7 +33823,7 @@ async def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -34070,10 +33837,10 @@ async def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34081,15 +33848,15 @@ async def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34151,10 +33918,11 @@ async def begin_start_network_trace_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -34218,7 +33986,6 @@ async def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34277,7 +34044,6 @@ async def stop_network_trace_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34337,7 +34103,6 @@ async def sync_repository_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34396,7 +34161,6 @@ async def sync_function_triggers_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34460,7 +34224,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34476,7 +34239,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34554,7 +34316,6 @@ async def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34569,7 +34330,7 @@ async def get_triggered_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34621,7 +34382,6 @@ async def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34691,7 +34451,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34707,7 +34466,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34789,7 +34547,6 @@ async def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34804,7 +34561,7 @@ async def get_triggered_web_job_history_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34859,7 +34616,6 @@ async def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34929,7 +34685,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34945,7 +34700,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35017,7 +34771,6 @@ async def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35032,7 +34785,7 @@ async def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35084,7 +34837,6 @@ async def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35099,7 +34851,7 @@ async def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35250,7 +35002,6 @@ async def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35265,7 +35016,7 @@ async def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35321,7 +35072,6 @@ async def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35483,7 +35233,6 @@ async def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35498,7 +35247,7 @@ async def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35557,7 +35306,6 @@ async def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35572,7 +35320,7 @@ async def get_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35728,7 +35476,6 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35743,7 +35490,7 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35899,7 +35646,6 @@ async def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35914,7 +35660,7 @@ async def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35966,7 +35712,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35982,7 +35727,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36057,7 +35801,6 @@ async def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36072,7 +35815,7 @@ async def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36197,7 +35940,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36213,7 +35955,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36243,13 +35984,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36263,7 +36004,7 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -36284,10 +36025,10 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36295,12 +36036,20 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot_with_production( @@ -36391,7 +36140,7 @@ async def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_with_production_initial( # type: ignore + raw_result = await self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -36402,6 +36151,7 @@ async def begin_swap_slot_with_production( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -36462,7 +36212,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36478,7 +36227,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36549,7 +36297,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36565,7 +36312,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36631,7 +36377,6 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36646,14 +36391,7 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36666,7 +36404,7 @@ async def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36680,7 +36418,7 @@ async def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -36701,10 +36439,10 @@ async def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36712,18 +36450,15 @@ async def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36838,10 +36573,11 @@ async def begin_create_or_update_source_control( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36907,7 +36643,6 @@ async def delete_source_control( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37040,7 +36775,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37055,14 +36789,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37107,7 +36834,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37133,7 +36859,7 @@ async def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37146,7 +36872,7 @@ async def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -37159,10 +36885,10 @@ async def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -37170,15 +36896,15 @@ async def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37236,10 +36962,11 @@ async def begin_start_network_trace( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -37299,7 +37026,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37355,7 +37081,6 @@ async def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37411,7 +37136,6 @@ async def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37467,7 +37191,6 @@ async def sync_function_triggers( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37527,7 +37250,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37543,7 +37265,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37617,7 +37338,6 @@ async def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37632,7 +37352,7 @@ async def get_triggered_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37680,7 +37400,6 @@ async def delete_triggered_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37746,7 +37465,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37762,7 +37480,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37840,7 +37557,6 @@ async def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37855,7 +37571,7 @@ async def get_triggered_web_job_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37906,7 +37622,6 @@ async def run_triggered_web_job( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37972,7 +37687,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37988,7 +37702,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38056,7 +37769,6 @@ async def list_vnet_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38071,7 +37783,7 @@ async def list_vnet_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38119,7 +37831,6 @@ async def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38134,7 +37845,7 @@ async def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38272,7 +37983,6 @@ async def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38287,7 +37997,7 @@ async def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38339,7 +38049,6 @@ async def delete_vnet_connection( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38488,7 +38197,6 @@ async def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38503,7 +38211,7 @@ async def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38558,7 +38266,6 @@ async def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38573,7 +38280,7 @@ async def get_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38716,7 +38423,6 @@ async def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38731,7 +38437,7 @@ async def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38874,7 +38580,6 @@ async def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38889,7 +38594,7 @@ async def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38935,7 +38640,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38951,7 +38655,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39022,7 +38725,6 @@ async def get_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39037,7 +38739,7 @@ async def get_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39162,7 +38864,6 @@ async def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39308,7 +39009,6 @@ async def deploy_workflow_artifacts_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39371,7 +39071,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39387,7 +39086,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39464,7 +39162,6 @@ async def get_instance_workflow_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39479,7 +39176,7 @@ async def get_instance_workflow_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39527,7 +39224,6 @@ async def list_workflows_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39542,7 +39238,7 @@ async def list_workflows_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39591,7 +39287,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39607,7 +39302,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39681,7 +39375,6 @@ async def get_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39696,7 +39389,7 @@ async def get_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39741,7 +39434,6 @@ async def list_workflows_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39756,7 +39448,7 @@ async def list_workflows_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_web_site_management_client_operations.py index 6e42a9347922d..45ee9ec8a941d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_web_site_management_client_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_site_management_client_operations import ( build_check_name_availability_request, build_get_publishing_user_request, @@ -97,7 +95,6 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +109,7 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -201,7 +198,6 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -216,7 +212,7 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -258,7 +254,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +269,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -338,7 +332,6 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -353,7 +346,7 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -461,7 +454,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -476,7 +468,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -527,7 +519,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -543,7 +534,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -621,7 +611,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -636,7 +625,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -684,7 +673,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -700,7 +688,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -763,7 +750,6 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -778,7 +764,7 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -844,7 +830,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -860,7 +845,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -980,7 +964,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -996,7 +979,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1062,7 +1044,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1078,7 +1059,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1140,7 +1120,6 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1155,7 +1134,7 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1254,7 +1233,6 @@ async def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1269,7 +1247,7 @@ async def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1382,7 +1360,6 @@ async def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1502,7 +1479,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1517,7 +1493,7 @@ async def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1630,7 +1606,6 @@ async def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_action_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_action_repetitions_operations.py index 18a4da03f68e6..7ee862232d59d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_action_repetitions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_action_repetitions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_run_action_repetitions_operations import ( build_get_request, build_list_expression_traces_request, @@ -114,7 +112,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -130,7 +127,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -215,7 +211,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -230,7 +225,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response) + deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -312,7 +306,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_action_repetitions_request_histories_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_action_repetitions_request_histories_operations.py index 398ecd0e93a65..481201a58c791 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_action_repetitions_request_histories_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_action_repetitions_request_histories_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_run_action_repetitions_request_histories_operations import ( build_get_request, build_list_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -227,7 +223,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +237,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RequestHistory", pipeline_response) + deserialized = self._deserialize("RequestHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_action_scope_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_action_scope_repetitions_operations.py index 4f4b06c92e381..3ac8d33b45036 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_action_scope_repetitions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_action_scope_repetitions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_run_action_scope_repetitions_operations import build_get_request, build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -110,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -211,7 +207,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +221,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response) + deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_actions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_actions_operations.py index 061aa1861698d..a6d6a7f77682a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_actions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_run_actions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_run_actions_operations import ( build_get_request, build_list_expression_traces_request, @@ -124,7 +122,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -140,7 +137,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -215,7 +211,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -230,7 +225,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunAction", pipeline_response) + deserialized = self._deserialize("WorkflowRunAction", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -286,7 +281,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -302,7 +296,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_runs_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_runs_operations.py index 7a097db7fc73b..22d73cc8f738a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_runs_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_runs_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_runs_operations import build_cancel_request, build_get_request, build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -115,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -131,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -203,7 +199,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -218,7 +213,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRun", pipeline_response) + deserialized = self._deserialize("WorkflowRun", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -267,7 +262,6 @@ async def cancel( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_trigger_histories_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_trigger_histories_operations.py index ddca085bc4e79..8682ec2b5f44a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_trigger_histories_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_trigger_histories_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_trigger_histories_operations import ( build_get_request, build_list_request, @@ -127,7 +127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -143,7 +142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -225,7 +223,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -240,14 +237,14 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTriggerHistory", pipeline_response) + deserialized = self._deserialize("WorkflowTriggerHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _resubmit_initial( # pylint: disable=inconsistent-return-statements + async def _resubmit_initial( self, resource_group_name: str, name: str, @@ -255,7 +252,7 @@ async def _resubmit_initial( # pylint: disable=inconsistent-return-statements trigger_name: str, history_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -268,7 +265,7 @@ async def _resubmit_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resubmit_request( resource_group_name=resource_group_name, @@ -281,10 +278,10 @@ async def _resubmit_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -292,12 +289,20 @@ async def _resubmit_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_resubmit( @@ -335,7 +340,7 @@ async def begin_resubmit( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._resubmit_initial( # type: ignore + raw_result = await self._resubmit_initial( resource_group_name=resource_group_name, name=name, workflow_name=workflow_name, @@ -347,6 +352,7 @@ async def begin_resubmit( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_triggers_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_triggers_operations.py index a90a680ab9f55..9fd7a0de57495 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_triggers_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_triggers_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_triggers_operations import ( build_get_request, build_get_schema_json_request, @@ -123,7 +123,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +138,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -211,7 +209,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +223,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTrigger", pipeline_response) + deserialized = self._deserialize("WorkflowTrigger", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -275,7 +272,6 @@ async def list_callback_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -290,16 +286,16 @@ async def list_callback_url( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTriggerCallbackUrl", pipeline_response) + deserialized = self._deserialize("WorkflowTriggerCallbackUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _run_initial( # pylint: disable=inconsistent-return-statements + async def _run_initial( self, resource_group_name: str, name: str, workflow_name: str, trigger_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -312,7 +308,7 @@ async def _run_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_run_request( resource_group_name=resource_group_name, @@ -324,10 +320,10 @@ async def _run_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -335,12 +331,20 @@ async def _run_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_run( @@ -369,7 +373,7 @@ async def begin_run( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._run_initial( # type: ignore + raw_result = await self._run_initial( resource_group_name=resource_group_name, name=name, workflow_name=workflow_name, @@ -380,6 +384,7 @@ async def begin_run( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -443,7 +448,6 @@ async def get_schema_json( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -458,7 +462,7 @@ async def get_schema_json( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JsonSchema", pipeline_response) + deserialized = self._deserialize("JsonSchema", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_versions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_versions_operations.py index e68e69c24ab21..de11547e0e6c4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_versions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflow_versions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_versions_operations import build_get_request, build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -106,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -122,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -194,7 +190,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +204,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowVersion", pipeline_response) + deserialized = self._deserialize("WorkflowVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflows_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflows_operations.py index 0eb5c0f351073..55269cbb82504 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflows_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/aio/operations/_workflows_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflows_operations import build_regenerate_access_key_request, build_validate_request from .._vendor import WebSiteManagementClientMixinABC @@ -175,7 +173,6 @@ async def regenerate_access_key( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -309,7 +306,6 @@ async def validate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/models/_models_py3.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/models/_models_py3.py index ff87e5d929cc4..eb01e19451f12 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/models/_models_py3.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/models/_models_py3.py @@ -29134,7 +29134,7 @@ class WorkflowParameter(_serialization.Model): """The workflow parameters. :ivar type: The type. Known values are: "NotSpecified", "String", "SecureString", "Int", - "Float", "Bool", "Array", "Object", and "SecureObject". + "Float", "Bool", "Array", "Object", "SecureObject", and "Int". :vartype type: str or ~azure.mgmt.web.v2022_09_01.models.ParameterType :ivar value: The value. :vartype value: JSON @@ -29162,7 +29162,7 @@ def __init__( ) -> None: """ :keyword type: The type. Known values are: "NotSpecified", "String", "SecureString", "Int", - "Float", "Bool", "Array", "Object", and "SecureObject". + "Float", "Bool", "Array", "Object", "SecureObject", and "Int". :paramtype type: str or ~azure.mgmt.web.v2022_09_01.models.ParameterType :keyword value: The value. :paramtype value: JSON @@ -29184,7 +29184,7 @@ class WorkflowOutputParameter(WorkflowParameter): Variables are only populated by the server, and will be ignored when sending a request. :ivar type: The type. Known values are: "NotSpecified", "String", "SecureString", "Int", - "Float", "Bool", "Array", "Object", and "SecureObject". + "Float", "Bool", "Array", "Object", "SecureObject", and "Int". :vartype type: str or ~azure.mgmt.web.v2022_09_01.models.ParameterType :ivar value: The value. :vartype value: JSON @@ -29219,7 +29219,7 @@ def __init__( ) -> None: """ :keyword type: The type. Known values are: "NotSpecified", "String", "SecureString", "Int", - "Float", "Bool", "Array", "Object", and "SecureObject". + "Float", "Bool", "Array", "Object", "SecureObject", and "Int". :paramtype type: str or ~azure.mgmt.web.v2022_09_01.models.ParameterType :keyword value: The value. :paramtype value: JSON diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/models/_web_site_management_client_enums.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/models/_web_site_management_client_enums.py index c100b8683d260..94718be2b49eb 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/models/_web_site_management_client_enums.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/models/_web_site_management_client_enums.py @@ -658,12 +658,13 @@ class ParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NOT_SPECIFIED = "NotSpecified" STRING = "String" SECURE_STRING = "SecureString" - INT_ENUM = "Int" + INT = "Int" FLOAT = "Float" BOOL = "Bool" ARRAY = "Array" OBJECT = "Object" SECURE_OBJECT = "SecureObject" + INT_ENUM = "Int" class ProviderOsTypeSelected(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_app_service_certificate_orders_operations.py index fdd913ecd671e..c4ebfba021465 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -866,7 +867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -882,7 +882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1001,7 +1000,6 @@ def validate_purchase_information( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1075,7 +1072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1143,7 +1139,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1158,7 +1153,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1171,7 +1166,7 @@ def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1185,7 +1180,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1206,10 +1201,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1217,15 +1212,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1342,10 +1337,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1405,7 +1401,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1540,7 +1535,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1555,7 +1549,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1605,7 +1599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1621,7 +1614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1692,7 +1684,6 @@ def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1698,7 @@ def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1721,7 +1712,7 @@ def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1735,7 +1726,7 @@ def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1757,10 +1748,10 @@ def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1768,15 +1759,15 @@ def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1900,10 +1891,11 @@ def begin_create_or_update_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1966,7 +1958,6 @@ def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2109,7 +2100,6 @@ def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2124,7 +2114,7 @@ def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2246,7 +2236,6 @@ def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2379,7 +2368,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2435,7 +2423,6 @@ def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2569,7 +2556,6 @@ def resend_request_emails( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2718,7 +2704,6 @@ def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2733,7 +2718,7 @@ def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2778,7 +2763,6 @@ def verify_domain_ownership( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2834,7 +2818,6 @@ def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2849,7 +2832,7 @@ def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2894,7 +2877,6 @@ def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2909,7 +2891,7 @@ def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_app_service_environments_operations.py index 2233ad8b68c73..2ef74ac9b1f17 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1951,7 +1952,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1967,7 +1967,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2037,7 +2036,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2053,7 +2051,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2119,7 +2116,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2134,7 +2130,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2147,7 +2143,7 @@ def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2161,7 +2157,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2182,10 +2178,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2193,21 +2189,19 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2324,10 +2318,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2349,9 +2344,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2364,7 +2359,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -2375,10 +2370,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2386,12 +2381,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -2422,7 +2425,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -2432,6 +2435,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2570,7 +2574,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2585,14 +2588,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2638,7 +2634,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2654,7 +2649,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2720,7 +2714,6 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2735,7 +2728,7 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2748,7 +2741,7 @@ def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2762,7 +2755,7 @@ def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2783,10 +2776,10 @@ def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2794,15 +2787,15 @@ def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2931,7 +2924,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2947,13 +2939,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2990,6 +2981,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3055,7 +3047,6 @@ def get_ase_custom_dns_suffix_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3070,7 +3061,7 @@ def get_ase_custom_dns_suffix_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response) + deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3192,7 +3183,6 @@ def update_ase_custom_dns_suffix_configuration( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3207,7 +3197,7 @@ def update_ase_custom_dns_suffix_configuration( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response) + deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3252,7 +3242,6 @@ def delete_ase_custom_dns_suffix_configuration( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3267,11 +3256,7 @@ def delete_ase_custom_dns_suffix_configuration( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3316,7 +3301,6 @@ def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3331,7 +3315,7 @@ def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3453,7 +3437,6 @@ def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3468,7 +3451,7 @@ def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3513,7 +3496,6 @@ def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3528,7 +3510,7 @@ def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3576,7 +3558,6 @@ def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3591,7 +3572,7 @@ def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3642,7 +3623,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3658,7 +3638,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3729,7 +3708,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3745,7 +3723,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3811,7 +3788,6 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3826,7 +3802,7 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3839,7 +3815,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3853,7 +3829,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3874,10 +3850,10 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3885,15 +3861,15 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4004,10 +3980,11 @@ def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4143,7 +4120,6 @@ def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4158,11 +4134,7 @@ def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4217,7 +4189,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4233,7 +4204,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4306,7 +4276,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4322,7 +4291,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4393,7 +4361,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4409,7 +4376,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4477,7 +4443,6 @@ def test_upgrade_available_notification( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4495,9 +4460,7 @@ def test_upgrade_available_notification( # pylint: disable=inconsistent-return- if cls: return cls(pipeline_response, None, {}) # type: ignore - def _upgrade_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _upgrade_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4510,7 +4473,7 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_upgrade_request( resource_group_name=resource_group_name, @@ -4520,10 +4483,10 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4531,12 +4494,20 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -4561,7 +4532,7 @@ def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any) -> L lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._upgrade_initial( # type: ignore + raw_result = self._upgrade_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -4570,6 +4541,7 @@ def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any) -> L params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4630,7 +4602,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4646,7 +4617,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4712,7 +4682,6 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4727,7 +4696,7 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4778,7 +4747,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4794,7 +4762,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4867,7 +4834,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4883,7 +4849,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4954,7 +4919,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4969,7 +4933,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4983,7 +4947,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4997,7 +4961,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5019,10 +4983,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5030,15 +4994,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5163,10 +5127,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5190,7 +5157,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5203,7 +5170,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -5214,10 +5181,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5225,18 +5192,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5280,10 +5244,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5341,7 +5306,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5356,7 +5320,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5401,7 +5365,6 @@ def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5419,7 +5382,7 @@ def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5432,7 +5395,7 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -5442,10 +5405,10 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5453,15 +5416,15 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5510,7 +5473,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5526,13 +5488,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -5567,6 +5528,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5635,7 +5597,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5651,7 +5612,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5726,7 +5686,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5742,7 +5701,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5772,7 +5730,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5785,7 +5743,7 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -5795,10 +5753,10 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5806,15 +5764,15 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5863,7 +5821,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5879,13 +5836,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -5920,6 +5876,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5994,7 +5951,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6010,7 +5966,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6081,7 +6036,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6097,7 +6051,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6168,7 +6121,6 @@ def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6183,7 +6135,7 @@ def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6197,7 +6149,7 @@ def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6211,7 +6163,7 @@ def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6233,10 +6185,10 @@ def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6244,15 +6196,15 @@ def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6372,10 +6324,11 @@ def begin_create_or_update_worker_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6520,7 +6473,6 @@ def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6535,11 +6487,7 @@ def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6596,7 +6544,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6612,7 +6559,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6688,7 +6634,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6704,7 +6649,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6778,7 +6722,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6794,7 +6737,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6868,7 +6810,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6884,7 +6825,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_app_service_plans_operations.py index 7eb3d2f7f9e89..f7c2c03a2d9f3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1161,7 +1162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1243,7 +1242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1259,7 +1257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1328,7 +1325,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1343,7 +1339,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1356,7 +1352,7 @@ def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1370,7 +1366,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1391,10 +1387,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1402,15 +1398,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1520,10 +1516,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1583,7 +1580,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1715,7 +1711,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1730,11 +1725,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1777,7 +1768,6 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1792,7 +1782,7 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1843,7 +1833,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1858,7 +1847,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1909,7 +1898,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1971,7 +1959,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1986,7 +1973,7 @@ def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2040,7 +2027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2056,7 +2042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2124,7 +2109,6 @@ def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2139,7 +2123,7 @@ def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2187,7 +2171,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2203,7 +2186,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2277,7 +2259,6 @@ def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2355,7 +2336,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2371,7 +2351,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2437,7 +2416,6 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2452,7 +2430,7 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2505,7 +2483,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2521,7 +2498,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2587,7 +2563,6 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2602,7 +2577,7 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2653,7 +2628,6 @@ def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2668,7 +2642,7 @@ def get_vnet_from_server_farm( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2719,7 +2693,6 @@ def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2734,7 +2707,7 @@ def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2874,7 +2847,6 @@ def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2889,7 +2861,7 @@ def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2938,7 +2910,6 @@ def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2953,7 +2924,7 @@ def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3007,7 +2978,6 @@ def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3022,7 +2992,7 @@ def get_route_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3169,7 +3139,6 @@ def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3184,7 +3153,7 @@ def create_or_update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3238,7 +3207,6 @@ def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3396,7 +3364,6 @@ def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3411,7 +3378,7 @@ def update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3459,7 +3426,6 @@ def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_certificate_orders_diagnostics_operations.py index cb165b3ad184c..dfd1de08c0364 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -195,7 +194,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -211,7 +209,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -300,7 +297,6 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +311,7 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_certificate_registration_provider_operations.py index 8e994b1569633..d28812175cab6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_certificate_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_certificates_operations.py index 719db1e2e2712..5b372ce5ad944 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_certificates_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -312,7 +311,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +326,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -394,7 +391,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -410,7 +406,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -476,7 +471,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -491,7 +485,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -611,7 +605,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -626,7 +619,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -671,7 +664,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -803,7 +795,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -818,7 +809,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_container_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_container_apps_operations.py index c056cdf1c16b9..19ee5080dfc06 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_container_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_container_apps_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -296,7 +297,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -312,7 +312,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -378,7 +377,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +392,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -463,7 +460,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Con headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -478,7 +474,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Con error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -491,7 +487,7 @@ def _create_or_update_initial( name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> _models.ContainerApp: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -505,7 +501,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -526,10 +522,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -537,15 +533,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -654,10 +650,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -679,9 +676,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -694,7 +689,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -704,10 +699,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -715,12 +710,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -745,7 +748,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -754,6 +757,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -808,7 +812,6 @@ def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollection: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -823,7 +826,7 @@ def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollection: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecretsCollection", pipeline_response) + deserialized = self._deserialize("SecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_container_apps_revisions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_container_apps_revisions_operations.py index 162885982c678..ebc081d99db39 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_container_apps_revisions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_container_apps_revisions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -296,7 +295,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -312,7 +310,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -383,7 +380,6 @@ def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -398,7 +394,7 @@ def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -446,7 +442,6 @@ def activate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -505,7 +500,6 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -564,7 +558,6 @@ def restart_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_deleted_web_apps_operations.py index d89d671fea9ac..39b238ff8c5bf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_deleted_web_apps_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -176,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -192,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -342,7 +337,6 @@ def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +351,7 @@ def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_diagnostics_operations.py index 4afb9beac6ffb..e437cefe67399 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1101,7 +1100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1117,7 +1115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1204,7 +1201,6 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1219,7 +1215,7 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1267,7 +1263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1283,7 +1278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1370,7 +1364,6 @@ def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1385,7 +1378,7 @@ def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1433,7 +1426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1449,7 +1441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1520,7 +1511,6 @@ def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1535,7 +1525,7 @@ def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1602,7 +1591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1676,7 +1664,6 @@ def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1678,7 @@ def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1759,7 +1746,6 @@ def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,7 +1760,7 @@ def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1827,7 +1813,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1843,7 +1828,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1917,7 +1901,6 @@ def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1932,7 +1915,7 @@ def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2000,7 +1983,6 @@ def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2015,7 +1997,7 @@ def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2066,7 +2048,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2082,7 +2063,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2173,7 +2153,6 @@ def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2188,7 +2167,7 @@ def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2239,7 +2218,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2255,7 +2233,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2329,7 +2306,6 @@ def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2344,7 +2320,7 @@ def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2398,7 +2374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2414,7 +2389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2497,7 +2471,6 @@ def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2512,7 +2485,7 @@ def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2584,7 +2557,6 @@ def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2599,7 +2571,7 @@ def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2655,7 +2627,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2671,7 +2642,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2754,7 +2724,6 @@ def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2769,7 +2738,7 @@ def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2841,7 +2810,6 @@ def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2856,7 +2824,7 @@ def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_domain_registration_provider_operations.py index 051b900c7ad2f..62662db9dd53e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_domain_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_domains_operations.py index 3da5745532a59..18d2a8d0a65ef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -732,7 +733,6 @@ def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +747,7 @@ def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +787,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -803,7 +802,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -863,7 +861,6 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -878,7 +875,7 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -975,7 +972,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -991,7 +987,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1057,7 +1052,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1073,7 +1067,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1139,7 +1132,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1154,7 +1146,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1163,7 +1155,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1177,7 +1169,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1198,10 +1190,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1209,15 +1201,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1320,10 +1312,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1388,7 +1381,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1519,7 +1511,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1534,11 +1525,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1588,7 +1575,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1604,7 +1590,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1675,7 +1660,6 @@ def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1690,7 +1674,7 @@ def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1829,7 +1813,6 @@ def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1844,7 +1827,7 @@ def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1892,7 +1875,6 @@ def delete_ownership_identifier( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2042,7 +2024,6 @@ def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2057,7 +2038,7 @@ def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2102,7 +2083,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2160,7 +2140,6 @@ def transfer_out(self, resource_group_name: str, domain_name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2175,7 +2154,7 @@ def transfer_out(self, resource_group_name: str, domain_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_global_operations_operations.py index bfa465f45623d..b853bbd186059 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_global_operations_operations.py @@ -18,15 +18,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -194,7 +192,7 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -234,7 +232,6 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -249,7 +246,7 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -294,7 +291,6 @@ def get_subscription_operation_with_async_response( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_kube_environments_operations.py index c214183221951..05dc349655239 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_kube_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_kube_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -308,7 +309,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -324,7 +324,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -390,7 +389,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -406,7 +404,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -472,7 +469,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Kub headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +483,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Kub error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -500,7 +496,7 @@ def _create_or_update_initial( name: str, kube_environment_envelope: Union[_models.KubeEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.KubeEnvironment: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -514,7 +510,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KubeEnvironment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -535,10 +531,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -546,15 +542,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -667,10 +663,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -692,9 +689,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -707,7 +702,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -717,10 +712,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -728,12 +723,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -758,7 +761,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -767,6 +770,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -905,7 +909,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -920,11 +923,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_provider_operations.py index 3229e55be2649..480271a51d37a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -276,7 +275,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -292,7 +290,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -360,7 +357,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -376,7 +372,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -447,7 +442,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -463,7 +457,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -534,7 +527,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -550,7 +542,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -616,7 +607,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -632,7 +622,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -700,7 +689,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -716,7 +704,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -787,7 +774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -803,7 +789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_recommendations_operations.py index 363eb9dc84190..68950207204de 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_recommendations_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -730,7 +729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -746,7 +744,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -806,7 +803,6 @@ def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -860,7 +856,6 @@ def disable_recommendation_for_subscription( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -934,7 +929,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -950,7 +944,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1035,7 +1028,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1051,7 +1043,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1122,7 +1113,6 @@ def disable_all_for_hosting_environment( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1181,7 +1171,6 @@ def reset_all_filters_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1254,7 +1243,6 @@ def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1269,7 +1257,7 @@ def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1320,7 +1308,6 @@ def disable_recommendation_for_hosting_environment( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1394,7 +1381,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1410,7 +1396,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1495,7 +1480,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1511,7 +1495,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1579,7 +1562,6 @@ def disable_all_for_web_app( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1635,7 +1617,6 @@ def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1708,7 +1689,6 @@ def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1723,7 +1703,7 @@ def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1771,7 +1751,6 @@ def disable_recommendation_for_site( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_resource_health_metadata_operations.py index 898b9e5ddf67f..bffeeaa07ae8b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_resource_health_metadata_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -390,7 +387,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -406,7 +402,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -479,7 +474,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -495,7 +489,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -561,7 +554,6 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -576,7 +568,7 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -630,7 +622,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -646,7 +637,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -718,7 +708,6 @@ def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -733,7 +722,7 @@ def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_static_sites_operations.py index 786885822cec3..193ad2e688ed7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -3256,7 +3257,6 @@ def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3271,7 +3271,7 @@ def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3312,7 +3312,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3328,7 +3327,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3397,7 +3395,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3413,7 +3410,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3479,7 +3475,6 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3494,7 +3489,7 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3507,7 +3502,7 @@ def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3521,7 +3516,7 @@ def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3542,10 +3537,10 @@ def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3553,15 +3548,15 @@ def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3677,10 +3672,11 @@ def begin_create_or_update_static_site( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3702,9 +3698,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3717,7 +3711,7 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -3727,10 +3721,10 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3738,12 +3732,20 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -3768,7 +3770,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_initial( # type: ignore + raw_result = self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -3777,6 +3779,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3917,7 +3920,6 @@ def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3932,11 +3934,7 @@ def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3989,7 +3987,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4005,7 +4002,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4079,7 +4075,6 @@ def delete_static_site_user( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4233,7 +4228,6 @@ def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4248,7 +4242,7 @@ def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4298,7 +4292,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4314,7 +4307,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4385,7 +4377,6 @@ def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4400,16 +4391,16 @@ def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4422,7 +4413,7 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -4433,10 +4424,10 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4444,12 +4435,20 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_build( @@ -4478,7 +4477,7 @@ def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_build_initial( # type: ignore + raw_result = self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -4488,6 +4487,7 @@ def begin_delete_static_site_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4634,7 +4634,6 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4649,7 +4648,7 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4781,7 +4780,6 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4796,7 +4794,7 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4847,7 +4845,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4863,7 +4860,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4937,7 +4933,6 @@ def get_build_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4952,7 +4947,7 @@ def get_build_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5096,7 +5091,6 @@ def create_or_update_build_database_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5111,7 +5105,7 @@ def create_or_update_build_database_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5162,7 +5156,6 @@ def delete_build_database_connection( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5318,7 +5311,6 @@ def update_build_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5333,7 +5325,7 @@ def update_build_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5384,7 +5376,6 @@ def get_build_database_connection_with_details( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5399,7 +5390,7 @@ def get_build_database_connection_with_details( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5452,7 +5443,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5468,7 +5458,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5539,7 +5528,6 @@ def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5554,7 +5542,7 @@ def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5602,7 +5590,6 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5617,7 +5604,7 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5668,7 +5655,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5684,7 +5670,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5761,7 +5746,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5777,7 +5761,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5853,7 +5836,6 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5868,7 +5850,9 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5886,7 +5870,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5900,7 +5884,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5926,10 +5910,10 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5937,15 +5921,15 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6104,10 +6088,13 @@ def begin_register_user_provided_function_app_with_static_site_build( # pylint: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6174,7 +6161,6 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6192,14 +6178,14 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6213,7 +6199,7 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6235,10 +6221,10 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6246,12 +6232,20 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -6356,7 +6350,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -6368,6 +6362,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -6504,7 +6499,6 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6519,7 +6513,7 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6569,7 +6563,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6585,7 +6578,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6656,7 +6648,6 @@ def get_basic_auth( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6671,7 +6662,7 @@ def get_basic_auth( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6803,7 +6794,6 @@ def create_or_update_basic_auth( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6818,7 +6808,7 @@ def create_or_update_basic_auth( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6940,7 +6930,6 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6955,7 +6944,7 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7079,7 +7068,6 @@ def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7094,7 +7082,7 @@ def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7144,7 +7132,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7160,7 +7147,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7231,7 +7217,6 @@ def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7246,7 +7231,7 @@ def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7262,7 +7247,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7276,7 +7261,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7301,10 +7286,10 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7312,15 +7297,15 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7454,10 +7439,13 @@ def begin_create_or_update_static_site_custom_domain( # pylint: disable=name-to params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7479,9 +7467,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7494,7 +7482,7 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -7505,10 +7493,10 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7516,12 +7504,20 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_custom_domain( @@ -7550,7 +7546,7 @@ def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -7560,6 +7556,7 @@ def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7581,7 +7578,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -7590,7 +7587,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7604,7 +7601,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7629,10 +7626,10 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7640,12 +7637,20 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -7753,7 +7758,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -7765,6 +7770,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7827,7 +7833,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7843,7 +7848,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7914,7 +7918,6 @@ def get_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7929,7 +7932,7 @@ def get_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8063,7 +8066,6 @@ def create_or_update_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8078,7 +8080,7 @@ def create_or_update_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8126,7 +8128,6 @@ def delete_database_connection( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8272,7 +8273,6 @@ def update_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8287,7 +8287,7 @@ def update_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8335,7 +8335,6 @@ def get_database_connection_with_details( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8350,16 +8349,14 @@ def get_database_connection_with_details( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _detach_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8372,7 +8369,7 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -8382,10 +8379,10 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8393,12 +8390,20 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -8423,7 +8428,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._detach_static_site_initial( # type: ignore + raw_result = self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -8432,6 +8437,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -8496,7 +8502,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8512,7 +8517,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8580,7 +8584,6 @@ def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8595,7 +8598,7 @@ def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8640,7 +8643,6 @@ def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8655,7 +8657,7 @@ def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8700,7 +8702,6 @@ def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8715,7 +8716,7 @@ def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8758,7 +8759,6 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8773,7 +8773,7 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8823,7 +8823,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8839,7 +8838,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8910,7 +8908,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8925,7 +8922,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8939,7 +8936,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8953,7 +8950,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -8975,10 +8972,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8986,15 +8983,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9119,10 +9116,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9146,7 +9146,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9159,7 +9159,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -9170,10 +9170,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9181,18 +9181,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9236,10 +9233,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9297,7 +9295,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9312,7 +9309,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9434,7 +9431,6 @@ def reset_static_site_api_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9493,7 +9489,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9509,7 +9504,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9583,7 +9577,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9599,7 +9592,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9671,7 +9663,6 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9686,7 +9677,9 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9703,7 +9696,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9717,7 +9710,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -9742,10 +9735,10 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9753,15 +9746,15 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9907,10 +9900,13 @@ def begin_register_user_provided_function_app_with_static_site( # pylint: disab params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9973,7 +9969,6 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9991,13 +9986,13 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10011,7 +10006,7 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10032,10 +10027,10 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10043,12 +10038,20 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -10144,7 +10147,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -10155,6 +10158,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -10176,14 +10180,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_backend_initial( # pylint: disable=inconsistent-return-statements + def _validate_backend_initial( self, resource_group_name: str, name: str, linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10197,7 +10201,7 @@ def _validate_backend_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10219,10 +10223,10 @@ def _validate_backend_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10230,12 +10234,20 @@ def _validate_backend_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_backend( @@ -10339,7 +10351,7 @@ def begin_validate_backend( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_backend_initial( # type: ignore + raw_result = self._validate_backend_initial( resource_group_name=resource_group_name, name=name, linked_backend_name=linked_backend_name, @@ -10351,6 +10363,7 @@ def begin_validate_backend( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -10372,7 +10385,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return-statements + def _validate_backend_for_build_initial( self, resource_group_name: str, name: str, @@ -10380,7 +10393,7 @@ def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return- linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10394,7 +10407,7 @@ def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10417,10 +10430,10 @@ def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10428,12 +10441,20 @@ def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_backend_for_build( @@ -10546,7 +10567,7 @@ def begin_validate_backend_for_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_backend_for_build_initial( # type: ignore + raw_result = self._validate_backend_for_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -10559,6 +10580,7 @@ def begin_validate_backend_for_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -10623,7 +10645,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10639,7 +10660,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10715,7 +10735,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10731,7 +10750,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10802,7 +10820,6 @@ def get_linked_backend( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10817,7 +10834,7 @@ def get_linked_backend( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10831,7 +10848,7 @@ def _link_backend_initial( linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteLinkedBackendARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10845,7 +10862,7 @@ def _link_backend_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteLinkedBackendARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10867,10 +10884,10 @@ def _link_backend_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10878,11 +10895,15 @@ def _link_backend_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11009,10 +11030,11 @@ def begin_link_backend( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11084,7 +11106,6 @@ def unlink_backend( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11146,7 +11167,6 @@ def get_linked_backend_for_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11161,7 +11181,7 @@ def get_linked_backend_for_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11176,7 +11196,7 @@ def _link_backend_to_build_initial( linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteLinkedBackendARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11190,7 +11210,7 @@ def _link_backend_to_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteLinkedBackendARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11213,10 +11233,10 @@ def _link_backend_to_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11224,11 +11244,15 @@ def _link_backend_to_build_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11365,10 +11389,11 @@ def begin_link_backend_to_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11444,7 +11469,6 @@ def unlink_backend_from_build( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_top_level_domains_operations.py index de6b6d1b6747f..2ce9d0215f9d5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_top_level_domains_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_web_apps_operations.py index 4928e4dec6660..925625fb6b7f6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_web_apps_operations.py @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -16607,7 +16608,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16623,7 +16623,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16696,7 +16695,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16712,7 +16710,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16781,7 +16778,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16796,7 +16792,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16805,7 +16801,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16819,7 +16815,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16840,10 +16836,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16851,15 +16847,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16971,10 +16967,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -17049,7 +17046,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17189,7 +17185,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17204,11 +17199,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17256,7 +17247,6 @@ def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17271,7 +17261,7 @@ def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17391,7 +17381,6 @@ def apply_slot_config_to_production( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17520,7 +17509,6 @@ def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17535,7 +17523,7 @@ def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17581,7 +17569,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17597,7 +17584,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17668,7 +17654,6 @@ def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17683,7 +17668,7 @@ def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17734,7 +17719,6 @@ def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17887,7 +17871,6 @@ def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17902,21 +17885,21 @@ def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_initial( # pylint: disable=inconsistent-return-statements + def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17930,7 +17913,7 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17952,10 +17935,10 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17963,12 +17946,20 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore( @@ -18068,7 +18059,7 @@ def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_initial( # type: ignore + raw_result = self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -18080,6 +18071,7 @@ def begin_restore( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -18145,7 +18137,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18161,7 +18152,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18229,7 +18219,6 @@ def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18244,7 +18233,7 @@ def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18368,7 +18357,6 @@ def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18383,7 +18371,7 @@ def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18428,7 +18416,6 @@ def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18443,7 +18430,7 @@ def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18567,7 +18554,6 @@ def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18582,7 +18568,7 @@ def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18630,7 +18616,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18646,7 +18631,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18789,7 +18773,6 @@ def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18804,7 +18787,7 @@ def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18847,7 +18830,6 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18862,7 +18844,7 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18982,7 +18964,6 @@ def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18997,7 +18978,7 @@ def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19040,7 +19021,6 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19055,7 +19035,7 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19100,7 +19080,6 @@ def get_auth_settings_v2_without_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19115,7 +19094,7 @@ def get_auth_settings_v2_without_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19238,7 +19217,6 @@ def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19253,7 +19231,7 @@ def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19296,7 +19274,6 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19311,7 +19288,7 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19433,7 +19410,6 @@ def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19448,7 +19424,7 @@ def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19493,7 +19469,6 @@ def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19508,7 +19483,7 @@ def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19624,7 +19599,6 @@ def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19639,7 +19613,7 @@ def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19684,7 +19658,6 @@ def delete_backup_configuration( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19738,7 +19711,6 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19753,7 +19725,7 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19801,7 +19773,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19817,7 +19788,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19888,7 +19858,6 @@ def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19903,7 +19872,7 @@ def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19951,7 +19920,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19967,7 +19935,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20038,7 +20005,6 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20053,7 +20019,7 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20176,7 +20142,6 @@ def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20191,7 +20156,7 @@ def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20236,7 +20201,6 @@ def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20251,7 +20215,7 @@ def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20296,7 +20260,6 @@ def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20311,7 +20274,7 @@ def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20434,7 +20397,6 @@ def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20449,7 +20411,7 @@ def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20565,7 +20527,6 @@ def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20580,7 +20541,7 @@ def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20623,7 +20584,6 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20638,14 +20598,16 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _list_publishing_credentials_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.User: + def _list_publishing_credentials_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20658,7 +20620,7 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -20668,10 +20630,10 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20679,11 +20641,15 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20724,10 +20690,11 @@ def begin_list_publishing_credentials( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20858,7 +20825,6 @@ def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20873,7 +20839,7 @@ def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20916,7 +20882,6 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20931,7 +20896,7 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20977,7 +20942,6 @@ def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20992,7 +20956,7 @@ def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21121,7 +21085,6 @@ def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21136,7 +21099,7 @@ def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21181,7 +21144,6 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21196,7 +21158,7 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21316,7 +21278,6 @@ def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21331,7 +21292,7 @@ def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21451,7 +21412,6 @@ def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21466,7 +21426,7 @@ def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21518,7 +21478,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21534,7 +21493,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21605,7 +21563,6 @@ def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21620,7 +21577,7 @@ def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21668,7 +21625,6 @@ def recover_site_configuration_snapshot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21724,9 +21680,9 @@ def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21735,12 +21691,16 @@ def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21783,9 +21743,9 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21794,12 +21754,16 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21847,7 +21811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21863,7 +21826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21937,7 +21899,6 @@ def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21952,7 +21913,7 @@ def get_continuous_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22000,7 +21961,6 @@ def delete_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22062,7 +22022,6 @@ def start_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22124,7 +22083,6 @@ def stop_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22183,7 +22141,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22199,7 +22156,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22231,7 +22187,7 @@ def get_next(next_link=None): def _get_production_site_deployment_status_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, deployment_status_id: str, **kwargs: Any - ) -> _models.CsmDeploymentStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22244,7 +22200,7 @@ def _get_production_site_deployment_status_initial( # pylint: disable=name-too- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.CsmDeploymentStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_get_production_site_deployment_status_request( resource_group_name=resource_group_name, @@ -22255,10 +22211,10 @@ def _get_production_site_deployment_status_initial( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22266,15 +22222,15 @@ def _get_production_site_deployment_status_initial( # pylint: disable=name-too- response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22319,10 +22275,11 @@ def begin_get_production_site_deployment_status( # pylint: disable=name-too-lon params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22383,7 +22340,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22399,7 +22355,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22468,7 +22423,6 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22483,7 +22437,7 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22613,7 +22567,6 @@ def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22628,7 +22581,7 @@ def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22676,7 +22629,6 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22734,7 +22686,6 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22749,7 +22700,7 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22873,7 +22824,6 @@ def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22888,7 +22838,7 @@ def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22936,7 +22886,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22952,7 +22901,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23023,7 +22971,6 @@ def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23038,7 +22985,7 @@ def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23173,7 +23120,6 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23188,7 +23134,7 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23236,7 +23182,6 @@ def delete_domain_ownership_identifier( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23382,7 +23327,6 @@ def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23397,7 +23341,7 @@ def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23440,7 +23384,6 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23455,7 +23398,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23464,7 +23407,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23481,7 +23424,7 @@ def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23502,10 +23445,10 @@ def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23513,11 +23456,15 @@ def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23623,10 +23570,11 @@ def begin_create_ms_deploy_operation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23687,7 +23635,6 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23702,7 +23649,7 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23746,7 +23693,6 @@ def get_one_deploy_status(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23761,7 +23707,7 @@ def get_one_deploy_status(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23804,7 +23750,6 @@ def create_one_deploy_operation(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23819,7 +23764,7 @@ def create_one_deploy_operation(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23870,7 +23815,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23886,7 +23830,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23952,7 +23895,6 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23967,7 +23909,7 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24018,7 +23960,6 @@ def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24033,7 +23974,7 @@ def get_function( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24047,7 +23988,7 @@ def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24061,7 +24002,7 @@ def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24083,10 +24024,10 @@ def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24094,11 +24035,15 @@ def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24218,10 +24163,11 @@ def begin_create_function( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24287,7 +24233,6 @@ def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24438,7 +24383,6 @@ def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24453,11 +24397,7 @@ def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24511,7 +24451,6 @@ def delete_function_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24570,7 +24509,6 @@ def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24585,7 +24523,7 @@ def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24633,7 +24571,6 @@ def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24648,7 +24585,7 @@ def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24691,7 +24628,6 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24706,7 +24642,7 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24751,7 +24687,6 @@ def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24807,7 +24742,6 @@ def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24958,7 +24892,6 @@ def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24973,11 +24906,7 @@ def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25031,7 +24960,6 @@ def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25090,7 +25018,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25106,7 +25033,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25177,7 +25103,6 @@ def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25192,7 +25117,7 @@ def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25324,7 +25249,6 @@ def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25339,7 +25263,7 @@ def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25387,7 +25311,6 @@ def delete_host_name_binding( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25449,7 +25372,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25464,7 +25386,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25604,7 +25526,6 @@ def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25619,7 +25540,7 @@ def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25673,7 +25594,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25824,7 +25744,6 @@ def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25839,7 +25758,7 @@ def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25882,7 +25801,6 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25897,7 +25815,7 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25943,7 +25861,6 @@ def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25958,7 +25875,7 @@ def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26006,7 +25923,6 @@ def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26021,7 +25937,7 @@ def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26155,7 +26071,6 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26170,7 +26085,7 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26221,7 +26136,6 @@ def delete_relay_service_connection( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26366,7 +26280,6 @@ def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26381,7 +26294,7 @@ def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26430,7 +26343,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26446,7 +26358,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26517,7 +26428,6 @@ def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26532,7 +26442,7 @@ def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26580,7 +26490,6 @@ def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26595,7 +26504,7 @@ def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26609,7 +26518,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26626,7 +26535,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26648,10 +26557,10 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26659,11 +26568,15 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26783,10 +26696,11 @@ def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26852,7 +26766,6 @@ def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26867,7 +26780,7 @@ def get_instance_ms_deploy_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26924,7 +26837,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26940,7 +26852,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27019,7 +26930,6 @@ def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27034,7 +26944,7 @@ def get_instance_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27091,7 +27001,6 @@ def delete_instance_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27158,9 +27067,9 @@ def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27169,11 +27078,15 @@ def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27233,7 +27146,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27249,7 +27161,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27331,7 +27242,6 @@ def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27346,7 +27256,7 @@ def get_instance_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27405,7 +27315,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27421,7 +27330,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27487,7 +27395,6 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27502,7 +27409,7 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27548,7 +27455,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27564,7 +27470,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27632,7 +27537,6 @@ def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27647,7 +27551,7 @@ def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27661,7 +27565,7 @@ def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27675,7 +27579,7 @@ def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -27697,10 +27601,10 @@ def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27708,11 +27612,15 @@ def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27836,10 +27744,11 @@ def begin_migrate_storage( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27867,7 +27776,7 @@ def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27881,7 +27790,7 @@ def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -27902,10 +27811,10 @@ def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27913,11 +27822,15 @@ def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28025,10 +27938,11 @@ def begin_migrate_my_sql( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28090,7 +28004,6 @@ def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28105,7 +28018,7 @@ def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28150,7 +28063,6 @@ def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28165,7 +28077,7 @@ def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28305,7 +28217,6 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28320,7 +28231,7 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28368,7 +28279,6 @@ def delete_swift_virtual_network( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28519,7 +28429,6 @@ def update_swift_virtual_network_connection_with_check( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28534,7 +28443,7 @@ def update_swift_virtual_network_connection_with_check( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28585,7 +28494,6 @@ def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28600,7 +28508,7 @@ def list_network_features( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28649,7 +28557,6 @@ def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28664,11 +28571,7 @@ def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28728,7 +28631,6 @@ def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28743,7 +28645,7 @@ def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28758,7 +28660,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28771,7 +28673,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -28784,10 +28686,10 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28795,15 +28697,15 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28860,10 +28762,11 @@ def begin_start_web_site_network_trace_operation( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28923,7 +28826,6 @@ def stop_web_site_network_trace( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28983,7 +28885,6 @@ def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28998,7 +28899,7 @@ def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29047,7 +28948,6 @@ def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29062,11 +28962,7 @@ def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29115,7 +29011,6 @@ def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29130,7 +29025,7 @@ def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29176,7 +29071,6 @@ def generate_new_site_publishing_password( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29240,7 +29134,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29256,7 +29149,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29324,7 +29216,6 @@ def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29339,7 +29230,7 @@ def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29382,7 +29273,6 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29397,7 +29287,7 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29445,7 +29335,6 @@ def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29460,7 +29349,7 @@ def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29590,7 +29479,6 @@ def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29605,7 +29493,7 @@ def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29653,7 +29541,6 @@ def delete_premier_add_on( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29794,7 +29681,6 @@ def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29809,7 +29695,7 @@ def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29854,7 +29740,6 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29869,7 +29754,7 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29991,7 +29876,6 @@ def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30006,7 +29890,7 @@ def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30056,7 +29940,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30072,7 +29955,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30143,7 +30025,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30158,7 +30039,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30172,7 +30053,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30186,7 +30067,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30208,10 +30089,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30219,15 +30100,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30352,10 +30233,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30379,7 +30263,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30392,7 +30276,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -30403,10 +30287,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30414,18 +30298,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30469,10 +30350,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30530,7 +30412,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30545,7 +30426,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30596,7 +30477,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30612,7 +30492,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30685,7 +30564,6 @@ def get_process(self, resource_group_name: str, name: str, process_id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30700,7 +30578,7 @@ def get_process(self, resource_group_name: str, name: str, process_id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30753,7 +30631,6 @@ def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30814,9 +30691,9 @@ def get_process_dump(self, resource_group_name: str, name: str, process_id: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30825,11 +30702,15 @@ def get_process_dump(self, resource_group_name: str, name: str, process_id: str, response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30885,7 +30766,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30901,7 +30781,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30979,7 +30858,6 @@ def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30994,7 +30872,7 @@ def get_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31049,7 +30927,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31065,7 +30942,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31136,7 +31012,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31152,7 +31027,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31223,7 +31097,6 @@ def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31238,7 +31111,7 @@ def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31370,7 +31243,6 @@ def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31385,7 +31257,7 @@ def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31433,7 +31305,6 @@ def delete_public_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31569,9 +31440,9 @@ def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -31580,11 +31451,15 @@ def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31631,7 +31506,6 @@ def reset_production_slot_config( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31701,7 +31575,6 @@ def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31719,9 +31592,9 @@ def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31735,7 +31608,7 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31756,10 +31629,10 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31767,12 +31640,20 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob( @@ -31859,7 +31740,7 @@ def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_initial( # type: ignore + raw_result = self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -31870,6 +31751,7 @@ def begin_restore_from_backup_blob( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31891,13 +31773,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31911,7 +31793,7 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31932,10 +31814,10 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31943,12 +31825,20 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app( @@ -32039,7 +31929,7 @@ def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_initial( # type: ignore + raw_result = self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -32050,6 +31940,7 @@ def begin_restore_from_deleted_app( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32071,13 +31962,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32091,7 +31982,7 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32112,10 +32003,10 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32123,12 +32014,20 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot( @@ -32222,7 +32121,7 @@ def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_initial( # type: ignore + raw_result = self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -32233,6 +32132,7 @@ def begin_restore_snapshot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32298,7 +32198,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32314,7 +32213,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32388,7 +32286,6 @@ def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32403,7 +32300,7 @@ def get_site_extension( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32412,7 +32309,7 @@ def get_site_extension( def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32429,7 +32326,7 @@ def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -32440,10 +32337,10 @@ def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32451,15 +32348,15 @@ def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32504,10 +32401,11 @@ def begin_install_site_extension( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32573,7 +32471,6 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32630,7 +32527,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32646,7 +32542,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32719,7 +32614,6 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32734,7 +32628,7 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32748,7 +32642,7 @@ def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32762,7 +32656,7 @@ def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32784,10 +32678,10 @@ def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32795,15 +32689,15 @@ def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32932,10 +32826,11 @@ def begin_create_or_update_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33015,7 +32910,6 @@ def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33168,7 +33062,6 @@ def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33183,11 +33076,7 @@ def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33239,7 +33128,6 @@ def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33254,7 +33142,7 @@ def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33387,7 +33275,6 @@ def apply_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33533,7 +33420,6 @@ def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33548,7 +33434,7 @@ def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33600,7 +33486,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33616,7 +33501,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33691,7 +33575,6 @@ def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33706,7 +33589,7 @@ def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33761,7 +33644,6 @@ def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33927,7 +33809,6 @@ def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33942,14 +33823,14 @@ def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -33957,7 +33838,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33971,7 +33852,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33994,10 +33875,10 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34005,12 +33886,20 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_slot( @@ -34122,7 +34011,7 @@ def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_slot_initial( # type: ignore + raw_result = self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -34135,6 +34024,7 @@ def begin_restore_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -34203,7 +34093,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34219,7 +34108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34290,7 +34178,6 @@ def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34305,7 +34192,7 @@ def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34439,7 +34326,6 @@ def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34454,7 +34340,7 @@ def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34502,7 +34388,6 @@ def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34517,7 +34402,7 @@ def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34651,7 +34536,6 @@ def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34666,7 +34550,7 @@ def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34718,7 +34602,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34734,7 +34617,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34890,7 +34772,6 @@ def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34905,7 +34786,7 @@ def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34954,7 +34835,6 @@ def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34969,7 +34849,7 @@ def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35102,7 +34982,6 @@ def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35117,7 +34996,7 @@ def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35166,7 +35045,6 @@ def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35181,7 +35059,7 @@ def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35230,7 +35108,6 @@ def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35245,7 +35122,7 @@ def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35381,7 +35258,6 @@ def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35396,7 +35272,7 @@ def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35445,7 +35321,6 @@ def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35460,7 +35335,7 @@ def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35595,7 +35470,6 @@ def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35610,7 +35484,7 @@ def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35659,7 +35533,6 @@ def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35674,7 +35547,7 @@ def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35807,7 +35680,6 @@ def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35822,7 +35694,7 @@ def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35871,7 +35743,6 @@ def delete_backup_configuration_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35931,7 +35802,6 @@ def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35946,7 +35816,7 @@ def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35997,7 +35867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36013,7 +35882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36087,7 +35955,6 @@ def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36102,7 +35969,7 @@ def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36153,7 +36020,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36169,7 +36035,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36243,7 +36108,6 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36258,7 +36122,7 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36394,7 +36258,6 @@ def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36409,7 +36272,7 @@ def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36458,7 +36321,6 @@ def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36473,7 +36335,7 @@ def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36522,7 +36384,6 @@ def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36537,7 +36398,7 @@ def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36673,7 +36534,6 @@ def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36688,7 +36548,7 @@ def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36821,7 +36681,6 @@ def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36836,7 +36695,7 @@ def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36885,7 +36744,6 @@ def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36900,7 +36758,7 @@ def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36909,7 +36767,7 @@ def list_metadata_slot( def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36922,7 +36780,7 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -36933,10 +36791,10 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36944,11 +36802,15 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36993,10 +36855,11 @@ def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -37144,7 +37007,6 @@ def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37159,7 +37021,7 @@ def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37208,7 +37070,6 @@ def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37223,7 +37084,7 @@ def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37274,7 +37135,6 @@ def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37289,7 +37149,7 @@ def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37422,7 +37282,6 @@ def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37437,7 +37296,7 @@ def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37570,7 +37429,6 @@ def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37585,7 +37443,7 @@ def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37641,7 +37499,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37657,7 +37514,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37732,7 +37588,6 @@ def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37747,7 +37602,7 @@ def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37799,7 +37654,6 @@ def recover_site_configuration_snapshot_slot( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37859,9 +37713,9 @@ def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -37870,12 +37724,16 @@ def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37924,9 +37782,9 @@ def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -37935,12 +37793,16 @@ def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37992,7 +37854,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38008,7 +37869,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38086,7 +37946,6 @@ def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38101,7 +37960,7 @@ def get_continuous_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38153,7 +38012,6 @@ def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38219,7 +38077,6 @@ def start_continuous_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38285,7 +38142,6 @@ def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38348,7 +38204,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38364,7 +38219,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38396,7 +38250,7 @@ def get_next(next_link=None): def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, deployment_status_id: str, **kwargs: Any - ) -> _models.CsmDeploymentStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -38409,7 +38263,7 @@ def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-l _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.CsmDeploymentStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_get_slot_site_deployment_status_slot_request( resource_group_name=resource_group_name, @@ -38421,10 +38275,10 @@ def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -38432,15 +38286,15 @@ def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38489,10 +38343,11 @@ def begin_get_slot_site_deployment_status_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -38559,7 +38414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38575,7 +38429,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38650,7 +38503,6 @@ def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38665,7 +38517,7 @@ def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38808,7 +38660,6 @@ def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38823,7 +38674,7 @@ def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38875,7 +38726,6 @@ def delete_deployment_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38939,7 +38789,6 @@ def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38954,7 +38803,7 @@ def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39095,7 +38944,6 @@ def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39110,7 +38958,7 @@ def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39162,7 +39010,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39178,7 +39025,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39253,7 +39099,6 @@ def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39268,7 +39113,7 @@ def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39416,7 +39261,6 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39431,7 +39275,7 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39483,7 +39327,6 @@ def delete_domain_ownership_identifier_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39642,7 +39485,6 @@ def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39657,7 +39499,7 @@ def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39706,7 +39548,6 @@ def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39721,7 +39562,7 @@ def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39735,7 +39576,7 @@ def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -39752,7 +39593,7 @@ def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -39774,10 +39615,10 @@ def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -39785,11 +39626,15 @@ def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39912,10 +39757,11 @@ def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -39982,7 +39828,6 @@ def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39997,7 +39842,7 @@ def get_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40051,7 +39896,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40067,7 +39911,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40137,7 +39980,6 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40152,7 +39994,7 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40206,7 +40048,6 @@ def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40221,7 +40062,7 @@ def get_instance_function_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40236,7 +40077,7 @@ def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -40250,7 +40091,7 @@ def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -40273,10 +40114,10 @@ def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -40284,11 +40125,15 @@ def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40418,10 +40263,11 @@ def begin_create_instance_function_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -40490,7 +40336,6 @@ def delete_instance_function_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40651,7 +40496,6 @@ def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40666,11 +40510,7 @@ def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40727,7 +40567,6 @@ def delete_function_secret_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40789,7 +40628,6 @@ def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40804,7 +40642,7 @@ def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40855,7 +40693,6 @@ def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40870,7 +40707,7 @@ def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40916,7 +40753,6 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40931,7 +40767,7 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40979,7 +40815,6 @@ def list_sync_status_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41038,7 +40873,6 @@ def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41199,7 +41033,6 @@ def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41214,11 +41047,7 @@ def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41275,7 +41104,6 @@ def delete_host_secret_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41338,7 +41166,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41354,7 +41181,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41429,7 +41255,6 @@ def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41444,7 +41269,7 @@ def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41589,7 +41414,6 @@ def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41604,7 +41428,7 @@ def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41656,7 +41480,6 @@ def delete_host_name_binding_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41721,7 +41544,6 @@ def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41736,7 +41558,7 @@ def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41886,7 +41708,6 @@ def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41901,7 +41722,7 @@ def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41958,7 +41779,6 @@ def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42119,7 +41939,6 @@ def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42134,7 +41953,7 @@ def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42182,7 +42001,6 @@ def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42197,7 +42015,7 @@ def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42247,7 +42065,6 @@ def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42262,7 +42079,7 @@ def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42314,7 +42131,6 @@ def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42329,7 +42145,7 @@ def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42476,7 +42292,6 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42491,7 +42306,7 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42546,7 +42361,6 @@ def delete_relay_service_connection_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42704,7 +42518,6 @@ def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42719,7 +42532,7 @@ def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42772,7 +42585,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42788,7 +42600,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42863,7 +42674,6 @@ def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42878,7 +42688,7 @@ def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42930,7 +42740,6 @@ def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42945,7 +42754,7 @@ def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42960,7 +42769,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42977,7 +42786,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -43000,10 +42809,10 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -43011,11 +42820,15 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43148,10 +42961,11 @@ def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=name-too- params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -43221,7 +43035,6 @@ def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43236,7 +43049,7 @@ def get_instance_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43297,7 +43110,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43313,7 +43125,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43396,7 +43207,6 @@ def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43411,7 +43221,7 @@ def get_instance_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43472,7 +43282,6 @@ def delete_instance_process_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43543,9 +43352,9 @@ def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -43554,11 +43363,15 @@ def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43622,7 +43435,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43638,7 +43450,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43731,7 +43542,6 @@ def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43746,7 +43556,7 @@ def get_instance_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43809,7 +43619,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43825,7 +43634,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43897,7 +43705,6 @@ def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43912,7 +43719,7 @@ def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43964,7 +43771,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43980,7 +43786,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44051,7 +43856,6 @@ def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44066,7 +43870,7 @@ def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44116,7 +43920,6 @@ def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44131,7 +43934,7 @@ def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44180,7 +43983,6 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44195,7 +43997,7 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44348,7 +44150,6 @@ def create_or_update_swift_virtual_network_connection_with_check_slot( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44363,7 +44164,7 @@ def create_or_update_swift_virtual_network_connection_with_check_slot( # pylint error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44415,7 +44216,6 @@ def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44579,7 +44379,6 @@ def update_swift_virtual_network_connection_with_check_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44594,7 +44393,7 @@ def update_swift_virtual_network_connection_with_check_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44649,7 +44448,6 @@ def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44664,7 +44462,7 @@ def list_network_features_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44717,7 +44515,6 @@ def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44732,11 +44529,7 @@ def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44800,7 +44593,6 @@ def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44815,7 +44607,7 @@ def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44831,7 +44623,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44844,7 +44636,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -44858,10 +44650,10 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44869,15 +44661,15 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44938,10 +44730,11 @@ def begin_start_web_site_network_trace_operation_slot( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -45004,7 +44797,6 @@ def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45068,7 +44860,6 @@ def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45083,7 +44874,7 @@ def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45136,7 +44927,6 @@ def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45151,11 +44941,7 @@ def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45208,7 +44994,6 @@ def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45223,7 +45008,7 @@ def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45273,7 +45058,6 @@ def generate_new_site_publishing_password_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45341,7 +45125,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45357,7 +45140,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45429,7 +45211,6 @@ def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45444,7 +45225,7 @@ def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45493,7 +45274,6 @@ def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45508,7 +45288,7 @@ def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45560,7 +45340,6 @@ def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45575,7 +45354,7 @@ def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45718,7 +45497,6 @@ def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45733,7 +45511,7 @@ def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45785,7 +45563,6 @@ def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45939,7 +45716,6 @@ def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45954,7 +45730,7 @@ def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46004,7 +45780,6 @@ def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46019,7 +45794,7 @@ def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46155,7 +45930,6 @@ def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46170,7 +45944,7 @@ def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46223,7 +45997,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46239,7 +46012,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46313,7 +46085,6 @@ def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46328,7 +46099,7 @@ def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46343,7 +46114,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46357,7 +46128,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -46380,10 +46151,10 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46391,15 +46162,15 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46534,10 +46305,13 @@ def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -46561,7 +46335,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46574,7 +46348,7 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -46586,10 +46360,10 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46597,18 +46371,15 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46655,10 +46426,11 @@ def begin_delete_private_endpoint_connection_slot( # pylint: disable=name-too-l params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -46719,7 +46491,6 @@ def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46734,7 +46505,7 @@ def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46791,7 +46562,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46807,7 +46577,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46886,7 +46655,6 @@ def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46901,7 +46669,7 @@ def get_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46958,7 +46726,6 @@ def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47025,9 +46792,9 @@ def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -47036,11 +46803,15 @@ def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47100,7 +46871,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47116,7 +46886,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47198,7 +46967,6 @@ def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47213,7 +46981,7 @@ def get_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47272,7 +47040,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47288,7 +47055,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47363,7 +47129,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47379,7 +47144,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47454,7 +47218,6 @@ def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47469,7 +47232,7 @@ def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47614,7 +47377,6 @@ def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47629,7 +47391,7 @@ def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47681,7 +47443,6 @@ def delete_public_certificate_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47830,9 +47591,9 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -47841,11 +47602,15 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47896,7 +47661,6 @@ def reset_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47971,7 +47735,6 @@ def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47989,14 +47752,14 @@ def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48010,7 +47773,7 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48032,10 +47795,10 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48043,12 +47806,20 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob_slot( @@ -48151,7 +47922,7 @@ def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -48163,6 +47934,7 @@ def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -48184,14 +47956,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48205,7 +47977,7 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48227,10 +47999,10 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48238,12 +48010,20 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app_slot( @@ -48346,7 +48126,7 @@ def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -48358,6 +48138,7 @@ def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -48379,14 +48160,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48400,7 +48181,7 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48422,10 +48203,10 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48433,12 +48214,20 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot_slot( @@ -48544,7 +48333,7 @@ def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_slot_initial( # type: ignore + raw_result = self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -48556,6 +48345,7 @@ def begin_restore_snapshot_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -48625,7 +48415,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48641,7 +48430,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48719,7 +48507,6 @@ def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48734,7 +48521,7 @@ def get_site_extension_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48743,7 +48530,7 @@ def get_site_extension_slot( def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48760,7 +48547,7 @@ def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -48772,10 +48559,10 @@ def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48783,15 +48570,15 @@ def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48840,10 +48627,11 @@ def begin_install_site_extension_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -48913,7 +48701,6 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49059,7 +48846,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49075,7 +48861,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49105,14 +48890,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -49126,7 +48911,7 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -49148,10 +48933,10 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -49159,12 +48944,20 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot( @@ -49267,7 +49060,7 @@ def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_initial( # type: ignore + raw_result = self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -49279,6 +49072,7 @@ def begin_swap_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -49344,7 +49138,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49360,7 +49153,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49434,7 +49226,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49450,7 +49241,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49522,7 +49312,6 @@ def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49537,14 +49326,7 @@ def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49558,7 +49340,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -49572,7 +49354,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -49594,10 +49376,10 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -49605,18 +49387,15 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49741,10 +49520,11 @@ def begin_create_or_update_source_control_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -49814,7 +49594,6 @@ def delete_source_control_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49960,7 +49739,6 @@ def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49975,14 +49753,7 @@ def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50031,7 +49802,6 @@ def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50058,7 +49828,7 @@ def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -50071,7 +49841,7 @@ def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -50085,10 +49855,10 @@ def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -50096,15 +49866,15 @@ def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50165,10 +49935,11 @@ def begin_start_network_trace_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -50232,7 +50003,6 @@ def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50291,7 +50061,6 @@ def stop_network_trace_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50351,7 +50120,6 @@ def sync_repository_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50410,7 +50178,6 @@ def sync_function_triggers_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50473,7 +50240,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50489,7 +50255,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50567,7 +50332,6 @@ def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50582,7 +50346,7 @@ def get_triggered_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50634,7 +50398,6 @@ def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50703,7 +50466,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50719,7 +50481,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50801,7 +50562,6 @@ def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50816,7 +50576,7 @@ def get_triggered_web_job_history_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50871,7 +50631,6 @@ def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50940,7 +50699,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50956,7 +50714,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51028,7 +50785,6 @@ def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51043,7 +50799,7 @@ def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51095,7 +50851,6 @@ def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51110,7 +50865,7 @@ def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51261,7 +51016,6 @@ def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51276,7 +51030,7 @@ def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51332,7 +51086,6 @@ def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51494,7 +51247,6 @@ def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51509,7 +51261,7 @@ def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51568,7 +51320,6 @@ def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51583,7 +51334,7 @@ def get_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51739,7 +51490,6 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51754,7 +51504,7 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51910,7 +51660,6 @@ def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51925,7 +51674,7 @@ def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51977,7 +51726,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51993,7 +51741,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52068,7 +51815,6 @@ def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52083,7 +51829,7 @@ def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52205,7 +51951,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52221,7 +51966,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52251,13 +51995,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -52271,7 +52015,7 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -52292,10 +52036,10 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -52303,12 +52047,20 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot_with_production( @@ -52399,7 +52151,7 @@ def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_with_production_initial( # type: ignore + raw_result = self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -52410,6 +52162,7 @@ def begin_swap_slot_with_production( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -52470,7 +52223,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52486,7 +52238,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52557,7 +52308,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52573,7 +52323,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52639,7 +52388,6 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52654,14 +52402,7 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52674,7 +52415,7 @@ def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -52688,7 +52429,7 @@ def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -52709,10 +52450,10 @@ def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -52720,18 +52461,15 @@ def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52843,10 +52581,11 @@ def begin_create_or_update_source_control( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -52912,7 +52651,6 @@ def delete_source_control( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53045,7 +52783,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53060,14 +52797,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53112,7 +52842,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53138,7 +52867,7 @@ def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -53151,7 +52880,7 @@ def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -53164,10 +52893,10 @@ def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -53175,15 +52904,15 @@ def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53240,10 +52969,11 @@ def begin_start_network_trace( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -53303,7 +53033,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53359,7 +53088,6 @@ def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53415,7 +53143,6 @@ def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53471,7 +53198,6 @@ def sync_function_triggers( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53530,7 +53256,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53546,7 +53271,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -53620,7 +53344,6 @@ def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53635,7 +53358,7 @@ def get_triggered_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53683,7 +53406,6 @@ def delete_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53748,7 +53470,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53764,7 +53485,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -53842,7 +53562,6 @@ def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53857,7 +53576,7 @@ def get_triggered_web_job_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53908,7 +53627,6 @@ def run_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53973,7 +53691,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53989,7 +53706,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -54057,7 +53773,6 @@ def list_vnet_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54072,7 +53787,7 @@ def list_vnet_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54120,7 +53835,6 @@ def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54135,7 +53849,7 @@ def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54273,7 +53987,6 @@ def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54288,7 +54001,7 @@ def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54340,7 +54053,6 @@ def delete_vnet_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54489,7 +54201,6 @@ def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54504,7 +54215,7 @@ def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54559,7 +54270,6 @@ def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54574,7 +54284,7 @@ def get_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54717,7 +54427,6 @@ def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54732,7 +54441,7 @@ def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54875,7 +54584,6 @@ def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54890,7 +54598,7 @@ def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54936,7 +54644,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -54952,7 +54659,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -55021,7 +54727,6 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55036,7 +54741,7 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55161,7 +54866,6 @@ def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55307,7 +55011,6 @@ def deploy_workflow_artifacts_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55369,7 +55072,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -55385,7 +55087,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -55462,7 +55163,6 @@ def get_instance_workflow_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55477,7 +55177,7 @@ def get_instance_workflow_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55525,7 +55225,6 @@ def list_workflows_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55540,7 +55239,7 @@ def list_workflows_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55588,7 +55287,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -55604,7 +55302,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -55678,7 +55375,6 @@ def get_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55693,7 +55389,7 @@ def get_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55738,7 +55434,6 @@ def list_workflows_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55753,7 +55448,7 @@ def list_workflows_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_web_site_management_client_operations.py index a8077da713883..0f0fc2b6de7cd 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_web_site_management_client_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -566,7 +565,6 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -581,7 +579,7 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -670,7 +668,6 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -685,7 +682,7 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -726,7 +723,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -742,7 +738,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -806,7 +801,6 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -821,7 +815,7 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -929,7 +923,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -944,7 +937,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -994,7 +987,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1010,7 +1002,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1088,7 +1079,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1103,7 +1093,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1150,7 +1140,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1166,7 +1155,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1229,7 +1217,6 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1244,7 +1231,7 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1310,7 +1297,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1326,7 +1312,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1446,7 +1431,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1462,7 +1446,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1527,7 +1510,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1543,7 +1525,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1605,7 +1586,6 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1620,7 +1600,7 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1719,7 +1699,6 @@ def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1734,7 +1713,7 @@ def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1847,7 +1826,6 @@ def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1967,7 +1945,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1982,7 +1959,7 @@ def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2095,7 +2072,6 @@ def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_action_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_action_repetitions_operations.py index 3fa1f3aec81b7..6f58a2b105329 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_action_repetitions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_action_repetitions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -256,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -272,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -357,7 +354,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -372,7 +368,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response) + deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -437,7 +433,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -453,7 +448,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_action_repetitions_request_histories_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_action_repetitions_request_histories_operations.py index 4f94351bde450..10d18aecdaffb 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_action_repetitions_request_histories_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_action_repetitions_request_histories_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -219,7 +218,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -235,7 +233,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -324,7 +321,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,7 +335,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RequestHistory", pipeline_response) + deserialized = self._deserialize("RequestHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_action_scope_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_action_scope_repetitions_operations.py index 7d0f081b106e2..430d6db9ac825 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_action_scope_repetitions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_action_scope_repetitions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -207,7 +206,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -223,7 +221,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -308,7 +305,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -323,7 +319,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response) + deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_actions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_actions_operations.py index b91c3e4c30315..37eb6a657b57f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_actions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_run_actions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -266,7 +265,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -282,7 +280,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -357,7 +354,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -372,7 +368,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunAction", pipeline_response) + deserialized = self._deserialize("WorkflowRunAction", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -427,7 +423,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -443,7 +438,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_runs_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_runs_operations.py index e8f2d757313af..bf989b739f1c4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_runs_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_runs_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -246,7 +245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -262,7 +260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -334,7 +331,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -349,7 +345,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRun", pipeline_response) + deserialized = self._deserialize("WorkflowRun", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -398,7 +394,6 @@ def cancel( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_trigger_histories_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_trigger_histories_operations.py index 82d172efb28bb..795d6dfc18d1a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_trigger_histories_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_trigger_histories_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -269,7 +270,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -285,7 +285,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -367,7 +366,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -382,14 +380,14 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTriggerHistory", pipeline_response) + deserialized = self._deserialize("WorkflowTriggerHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _resubmit_initial( # pylint: disable=inconsistent-return-statements + def _resubmit_initial( self, resource_group_name: str, name: str, @@ -397,7 +395,7 @@ def _resubmit_initial( # pylint: disable=inconsistent-return-statements trigger_name: str, history_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -410,7 +408,7 @@ def _resubmit_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resubmit_request( resource_group_name=resource_group_name, @@ -423,10 +421,10 @@ def _resubmit_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -434,12 +432,20 @@ def _resubmit_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_resubmit( @@ -477,7 +483,7 @@ def begin_resubmit( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._resubmit_initial( # type: ignore + raw_result = self._resubmit_initial( resource_group_name=resource_group_name, name=name, workflow_name=workflow_name, @@ -489,6 +495,7 @@ def begin_resubmit( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_triggers_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_triggers_operations.py index 62e71bd214306..7da68220f4a99 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_triggers_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_triggers_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -327,7 +328,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -343,7 +343,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -415,7 +414,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -430,7 +428,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTrigger", pipeline_response) + deserialized = self._deserialize("WorkflowTrigger", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -479,7 +477,6 @@ def list_callback_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -494,16 +491,16 @@ def list_callback_url( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTriggerCallbackUrl", pipeline_response) + deserialized = self._deserialize("WorkflowTriggerCallbackUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _run_initial( # pylint: disable=inconsistent-return-statements + def _run_initial( self, resource_group_name: str, name: str, workflow_name: str, trigger_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -516,7 +513,7 @@ def _run_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_run_request( resource_group_name=resource_group_name, @@ -528,10 +525,10 @@ def _run_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -539,12 +536,20 @@ def _run_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_run( @@ -573,7 +578,7 @@ def begin_run( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._run_initial( # type: ignore + raw_result = self._run_initial( resource_group_name=resource_group_name, name=name, workflow_name=workflow_name, @@ -584,6 +589,7 @@ def begin_run( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -647,7 +653,6 @@ def get_schema_json( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -662,7 +667,7 @@ def get_schema_json( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JsonSchema", pipeline_response) + deserialized = self._deserialize("JsonSchema", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_versions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_versions_operations.py index ccc2d420a1c68..9ca3af33397c7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_versions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflow_versions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -193,7 +192,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -209,7 +207,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -281,7 +278,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -296,7 +292,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowVersion", pipeline_response) + deserialized = self._deserialize("WorkflowVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflows_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflows_operations.py index b6364119bb24e..9f52046250613 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflows_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_09_01/operations/_workflows_operations.py @@ -19,15 +19,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -261,7 +260,6 @@ def regenerate_access_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -395,7 +393,6 @@ def validate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_metadata.json index 2da3ee214fa7f..6bf0d65f273e8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_vendor.py index fd66631892ed1..abd2e5566a353 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from .._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class WebSiteManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_web_site_management_client.py index e68f46a7006b1..9446a3b25d0cd 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -294,7 +295,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/_vendor.py index 39f69956b8888..6e80ec49ed289 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/_web_site_management_client.py index 6c7c3830d4e4a..791fd2a4b3c2d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -299,7 +300,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_app_service_certificate_orders_operations.py index 7f41d9788c3fb..f155fbec72b80 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_certificate_orders_operations import ( build_create_or_update_certificate_request, build_create_or_update_request, @@ -119,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -254,7 +266,6 @@ async def validate_purchase_information( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +405,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +419,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +432,7 @@ async def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -438,7 +446,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -459,10 +467,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -470,15 +478,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -595,10 +603,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -658,7 +667,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +801,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -808,7 +815,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -858,7 +865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -874,7 +880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -945,7 +950,6 @@ async def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -960,7 +964,7 @@ async def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -974,7 +978,7 @@ async def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -988,7 +992,7 @@ async def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1010,10 +1014,10 @@ async def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1021,15 +1025,15 @@ async def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1153,10 +1157,11 @@ async def begin_create_or_update_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1219,7 +1224,6 @@ async def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1362,7 +1366,6 @@ async def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1377,7 +1380,7 @@ async def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1499,7 +1502,6 @@ async def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1632,7 +1634,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1688,7 +1689,6 @@ async def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1822,7 +1822,6 @@ async def resend_request_emails( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1971,7 +1970,6 @@ async def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1986,7 +1984,7 @@ async def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2031,7 +2029,6 @@ async def verify_domain_ownership( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2087,7 +2084,6 @@ async def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2102,7 +2098,7 @@ async def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2147,7 +2143,6 @@ async def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2162,7 +2157,7 @@ async def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_app_service_environments_operations.py index e2aa0f054daba..2e1035d46a155 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_app_service_environments_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_environments_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_change_vnet_request, @@ -148,7 +162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -164,7 +177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -234,7 +246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -250,7 +261,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -316,7 +326,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -331,7 +340,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -344,7 +353,7 @@ async def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -358,7 +367,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -379,10 +388,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -390,21 +399,19 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -521,10 +528,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -546,9 +554,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -561,7 +569,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -572,10 +580,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -583,12 +591,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -619,7 +635,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -629,6 +645,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -767,7 +784,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -782,14 +798,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -838,7 +847,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -854,7 +862,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -920,7 +927,6 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -935,7 +941,7 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -948,7 +954,7 @@ async def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -962,7 +968,7 @@ async def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -983,10 +989,10 @@ async def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -994,15 +1000,15 @@ async def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1131,7 +1137,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1147,13 +1152,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1190,6 +1194,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -1255,7 +1260,6 @@ async def get_ase_custom_dns_suffix_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1270,7 +1274,7 @@ async def get_ase_custom_dns_suffix_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response) + deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1392,7 +1396,6 @@ async def update_ase_custom_dns_suffix_configuration( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1407,7 +1410,7 @@ async def update_ase_custom_dns_suffix_configuration( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response) + deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1452,7 +1455,6 @@ async def delete_ase_custom_dns_suffix_configuration( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1467,11 +1469,7 @@ async def delete_ase_custom_dns_suffix_configuration( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1516,7 +1514,6 @@ async def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1531,7 +1528,7 @@ async def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1653,7 +1650,6 @@ async def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1668,7 +1664,7 @@ async def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1713,7 +1709,6 @@ async def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1728,7 +1723,7 @@ async def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1776,7 +1771,6 @@ async def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1791,7 +1785,7 @@ async def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1842,7 +1836,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1858,7 +1851,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1930,7 +1922,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1946,7 +1937,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2014,7 +2004,6 @@ async def get_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2029,7 +2018,7 @@ async def get_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2042,7 +2031,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2056,7 +2045,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2077,10 +2066,10 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2088,15 +2077,15 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2210,10 +2199,11 @@ async def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2349,7 +2339,6 @@ async def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2364,11 +2353,7 @@ async def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2423,7 +2408,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2439,7 +2423,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2512,7 +2495,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2528,7 +2510,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2599,7 +2580,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2615,7 +2595,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2683,7 +2662,6 @@ async def test_upgrade_available_notification( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2701,9 +2679,7 @@ async def test_upgrade_available_notification( # pylint: disable=inconsistent-r if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _upgrade_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _upgrade_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2716,7 +2692,7 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_upgrade_request( resource_group_name=resource_group_name, @@ -2726,10 +2702,10 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2737,12 +2713,20 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -2767,7 +2751,7 @@ async def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._upgrade_initial( # type: ignore + raw_result = await self._upgrade_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -2776,6 +2760,7 @@ async def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2838,7 +2823,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2854,7 +2838,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2920,7 +2903,6 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2935,7 +2917,7 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2986,7 +2968,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3002,7 +2983,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3075,7 +3055,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3091,7 +3070,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3162,7 +3140,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3177,7 +3154,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3191,7 +3168,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3205,7 +3182,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3227,10 +3204,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3238,15 +3215,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3371,10 +3348,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3398,7 +3378,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3411,7 +3391,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -3422,10 +3402,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3433,18 +3413,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3488,10 +3465,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3549,7 +3527,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3564,7 +3541,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3609,7 +3586,6 @@ async def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3627,7 +3603,7 @@ async def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3640,7 +3616,7 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -3650,10 +3626,10 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3661,15 +3637,15 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3720,7 +3696,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3736,13 +3711,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3777,6 +3751,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3846,7 +3821,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3862,7 +3836,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3937,7 +3910,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3953,7 +3925,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3983,7 +3954,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3996,7 +3967,7 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -4006,10 +3977,10 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4017,15 +3988,15 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4076,7 +4047,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4092,13 +4062,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4133,6 +4102,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -4208,7 +4178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4224,7 +4193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4296,7 +4264,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4312,7 +4279,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4383,7 +4349,6 @@ async def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4398,7 +4363,7 @@ async def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4412,7 +4377,7 @@ async def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4426,7 +4391,7 @@ async def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4448,10 +4413,10 @@ async def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4459,15 +4424,15 @@ async def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4590,10 +4555,11 @@ async def begin_create_or_update_worker_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4738,7 +4704,6 @@ async def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4753,11 +4718,7 @@ async def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4814,7 +4775,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4830,7 +4790,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4906,7 +4865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4922,7 +4880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4996,7 +4953,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5012,7 +4968,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5086,7 +5041,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5102,7 +5056,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_app_service_plans_operations.py index e7e97ba0afe6c..ac8e2bd509864 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_app_service_plans_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_plans_operations import ( build_create_or_update_request, build_create_or_update_vnet_route_request, @@ -131,7 +145,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -147,7 +160,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -216,7 +228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -301,7 +311,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -316,7 +325,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +338,7 @@ async def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -343,7 +352,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -364,10 +373,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -375,15 +384,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -493,10 +502,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -556,7 +566,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -688,7 +697,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -703,11 +711,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +754,6 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -765,7 +768,7 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -816,7 +819,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -831,7 +833,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -882,7 +884,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -944,7 +945,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -959,7 +959,7 @@ async def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1013,7 +1013,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1029,7 +1028,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1097,7 +1095,6 @@ async def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1112,7 +1109,7 @@ async def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1161,7 +1158,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1173,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1251,7 +1246,6 @@ async def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1329,7 +1323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1345,7 +1338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1411,7 +1403,6 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1426,7 +1417,7 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1480,7 +1471,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1496,7 +1486,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1562,7 +1551,6 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1577,7 +1565,7 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1628,7 +1616,6 @@ async def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1643,7 +1630,7 @@ async def get_vnet_from_server_farm( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1694,7 +1681,6 @@ async def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1709,7 +1695,7 @@ async def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1849,7 +1835,6 @@ async def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1864,7 +1849,7 @@ async def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1913,7 +1898,6 @@ async def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1928,7 +1912,7 @@ async def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1982,7 +1966,6 @@ async def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1997,7 +1980,7 @@ async def get_route_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2144,7 +2127,6 @@ async def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2159,7 +2141,7 @@ async def create_or_update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2213,7 +2195,6 @@ async def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2371,7 +2352,6 @@ async def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2386,7 +2366,7 @@ async def update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2434,7 +2414,6 @@ async def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_certificate_orders_diagnostics_operations.py index 4df6109e7080d..df33db1bab4f0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_orders_diagnostics_operations import ( build_get_app_service_certificate_order_detector_response_request, build_list_app_service_certificate_order_detector_response_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -212,7 +208,6 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -227,7 +222,7 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_certificate_registration_provider_operations.py index 59dad731fbe35..c4e09665567f7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_certificate_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_certificates_operations.py index 91c01e2d55954..3b491794769ea 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -105,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -187,7 +183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -203,7 +198,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -269,7 +263,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -284,7 +277,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -404,7 +397,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -419,7 +411,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +456,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +587,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +601,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_container_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_container_apps_operations.py index e01d5510ba78a..e0cb08bf281af 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_container_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_container_apps_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_operations import ( build_create_or_update_request, build_delete_request, @@ -104,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -187,7 +185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -203,7 +200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -272,7 +268,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -287,7 +282,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -300,7 +295,7 @@ async def _create_or_update_initial( name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> _models.ContainerApp: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -314,7 +309,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -335,10 +330,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -346,15 +341,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -463,10 +458,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -488,9 +484,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -503,7 +497,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -513,10 +507,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -524,12 +518,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -554,7 +556,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -563,6 +565,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -617,7 +620,6 @@ async def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollect headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -632,7 +634,7 @@ async def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollect error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecretsCollection", pipeline_response) + deserialized = self._deserialize("SecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_container_apps_revisions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_container_apps_revisions_operations.py index 7b754fc7a970c..3aebc40118c87 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_container_apps_revisions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_container_apps_revisions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_revisions_operations import ( build_activate_revision_request, build_deactivate_revision_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -194,7 +190,6 @@ async def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +204,7 @@ async def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,7 +252,6 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -316,7 +310,6 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +368,6 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_deleted_web_apps_operations.py index 349199e55accf..3ec77d6d82066 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_deleted_web_apps_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_web_apps_operations import ( build_get_deleted_web_app_by_location_request, build_list_by_location_request, @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -179,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +257,6 @@ async def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +271,7 @@ async def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_diagnostics_operations.py index 1c34d8c6da3da..b454fc47518c4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._diagnostics_operations import ( build_execute_site_analysis_request, build_execute_site_analysis_slot_request, @@ -126,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +225,6 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +239,7 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,7 +288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -309,7 +303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +389,6 @@ async def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +403,7 @@ async def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -476,7 +467,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -547,7 +537,6 @@ async def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -562,7 +551,7 @@ async def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -630,7 +618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -704,7 +691,6 @@ async def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,7 +705,7 @@ async def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +773,6 @@ async def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +787,7 @@ async def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -855,7 +840,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -871,7 +855,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -945,7 +928,6 @@ async def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -960,7 +942,7 @@ async def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1028,7 +1010,6 @@ async def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1043,7 +1024,7 @@ async def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1095,7 +1076,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1111,7 +1091,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1202,7 +1181,6 @@ async def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1217,7 +1195,7 @@ async def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1269,7 +1247,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1285,7 +1262,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1359,7 +1335,6 @@ async def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1374,7 +1349,7 @@ async def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1429,7 +1404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1445,7 +1419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1528,7 +1501,6 @@ async def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1543,7 +1515,7 @@ async def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1615,7 +1587,6 @@ async def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1630,7 +1601,7 @@ async def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1686,7 +1657,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1702,7 +1672,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1785,7 +1754,6 @@ async def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1800,7 +1768,7 @@ async def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1872,7 +1840,6 @@ async def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1887,7 +1854,7 @@ async def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_domain_registration_provider_operations.py index 7a857a34d33c9..54759d174d197 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_domain_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_domains_operations.py index 79d448184617b..7695f19e00c07 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_check_availability_request, build_create_or_update_ownership_identifier_request, @@ -163,7 +163,6 @@ async def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +177,7 @@ async def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -218,7 +217,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -234,7 +232,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -294,7 +291,6 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -309,7 +305,7 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +405,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -425,7 +420,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -491,7 +485,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -507,7 +500,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -573,7 +565,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -588,7 +579,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -597,7 +588,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -611,7 +602,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -632,10 +623,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -643,15 +634,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -757,10 +748,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -825,7 +817,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -956,7 +947,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -971,11 +961,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1025,7 +1011,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1041,7 +1026,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1112,7 +1096,6 @@ async def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1127,7 +1110,7 @@ async def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1266,7 +1249,6 @@ async def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1281,7 +1263,7 @@ async def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1329,7 +1311,6 @@ async def delete_ownership_identifier( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1479,7 +1460,6 @@ async def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1494,7 +1474,7 @@ async def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1539,7 +1519,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1597,7 +1576,6 @@ async def transfer_out(self, resource_group_name: str, domain_name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1612,7 +1590,7 @@ async def transfer_out(self, resource_group_name: str, domain_name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_get_usages_in_location_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_get_usages_in_location_operations.py index 5d5fbf09aa3af..bad2856a91911 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_get_usages_in_location_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_get_usages_in_location_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._get_usages_in_location_operations import build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_global_operations_operations.py index c0c2ff4460a57..ca44e2d787af6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_global_operations_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._global_operations_operations import ( build_get_deleted_web_app_request, build_get_deleted_web_app_snapshots_request, @@ -94,7 +92,6 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +106,7 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -149,7 +146,6 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -164,7 +160,7 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -209,7 +205,6 @@ async def get_subscription_operation_with_async_response( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_kube_environments_operations.py index b1e6d3f27dcf0..2960b591d1173 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_kube_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_kube_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._kube_environments_operations import ( build_create_or_update_request, build_delete_request, @@ -104,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -189,7 +187,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -205,7 +202,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -271,7 +267,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +281,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -299,7 +294,7 @@ async def _create_or_update_initial( name: str, kube_environment_envelope: Union[_models.KubeEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.KubeEnvironment: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -313,7 +308,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KubeEnvironment] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -334,10 +329,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -345,15 +340,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -466,10 +461,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -491,9 +487,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -506,7 +500,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -516,10 +510,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -527,12 +521,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -557,7 +559,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -566,6 +568,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -704,7 +707,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,11 +721,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_provider_operations.py index cbc6f20475075..3481b6ec70152 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._provider_operations import ( build_get_available_stacks_on_prem_request, build_get_available_stacks_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -192,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -208,7 +203,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -280,7 +274,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -296,7 +289,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -367,7 +359,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -383,7 +374,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -449,7 +439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -465,7 +454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -533,7 +521,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -549,7 +536,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +606,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -636,7 +621,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_recommendations_operations.py index 74aae48d723e7..6d9dfbf4d319e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_recommendations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommendations_operations import ( build_disable_all_for_hosting_environment_request, build_disable_all_for_web_app_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -198,7 +194,6 @@ async def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -252,7 +247,6 @@ async def disable_recommendation_for_subscription( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -327,7 +321,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -343,7 +336,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -429,7 +421,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -445,7 +436,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -516,7 +506,6 @@ async def disable_all_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -575,7 +564,6 @@ async def reset_all_filters_for_hosting_environment( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -648,7 +636,6 @@ async def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -663,7 +650,7 @@ async def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -714,7 +701,6 @@ async def disable_recommendation_for_hosting_environment( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -789,7 +775,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -805,7 +790,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -891,7 +875,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -907,7 +890,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -975,7 +957,6 @@ async def disable_all_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1031,7 +1012,6 @@ async def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1104,7 +1084,6 @@ async def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1119,7 +1098,7 @@ async def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1167,7 +1146,6 @@ async def disable_recommendation_for_site( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_resource_health_metadata_operations.py index c8fa4e3d7c3e1..ba6d289a5e669 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_resource_health_metadata_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._resource_health_metadata_operations import ( build_get_by_site_request, build_get_by_site_slot_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -189,7 +185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -205,7 +200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -279,7 +273,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -295,7 +288,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -361,7 +353,6 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +367,7 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -431,7 +422,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -447,7 +437,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -519,7 +508,6 @@ async def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -534,7 +522,7 @@ async def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_static_sites_operations.py index c113dddfa4b30..0037aa7aa7ff6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._static_sites_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_create_or_update_basic_auth_request, @@ -248,7 +248,6 @@ async def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -263,7 +262,7 @@ async def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -305,7 +304,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -321,7 +319,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -391,7 +388,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -407,7 +403,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -475,7 +470,6 @@ async def get_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -490,7 +484,7 @@ async def get_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -503,7 +497,7 @@ async def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -517,7 +511,7 @@ async def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -538,10 +532,10 @@ async def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -549,15 +543,15 @@ async def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -676,10 +670,11 @@ async def begin_create_or_update_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -701,9 +696,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -716,7 +711,7 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -726,10 +721,10 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -737,12 +732,20 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site( @@ -769,7 +772,7 @@ async def begin_delete_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_initial( # type: ignore + raw_result = await self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -778,6 +781,7 @@ async def begin_delete_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -918,7 +922,6 @@ async def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -933,11 +936,7 @@ async def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -990,7 +989,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1006,7 +1004,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1080,7 +1077,6 @@ async def delete_static_site_user( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1234,7 +1230,6 @@ async def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1249,7 +1244,7 @@ async def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1299,7 +1294,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1315,7 +1309,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1386,7 +1379,6 @@ async def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1401,16 +1393,16 @@ async def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1423,7 +1415,7 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -1434,10 +1426,10 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1445,12 +1437,20 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_build( @@ -1479,7 +1479,7 @@ async def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_build_initial( # type: ignore + raw_result = await self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -1489,6 +1489,7 @@ async def begin_delete_static_site_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1635,7 +1636,6 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1650,7 +1650,7 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1782,7 +1782,6 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1797,7 +1796,7 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1849,7 +1848,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1865,7 +1863,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1939,7 +1936,6 @@ async def get_build_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1954,7 +1950,7 @@ async def get_build_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2098,7 +2094,6 @@ async def create_or_update_build_database_connection( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2113,7 +2108,7 @@ async def create_or_update_build_database_connection( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2164,7 +2159,6 @@ async def delete_build_database_connection( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2320,7 +2314,6 @@ async def update_build_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2335,7 +2328,7 @@ async def update_build_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2386,7 +2379,6 @@ async def get_build_database_connection_with_details( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2401,7 +2393,7 @@ async def get_build_database_connection_with_details( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2454,7 +2446,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2470,7 +2461,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2541,7 +2531,6 @@ async def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2556,7 +2545,7 @@ async def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2604,7 +2593,6 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2619,7 +2607,7 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2671,7 +2659,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2687,7 +2674,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2764,7 +2750,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2780,7 +2765,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2856,7 +2840,6 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2871,7 +2854,9 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2889,7 +2874,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2903,7 +2888,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2929,10 +2914,10 @@ async def _register_user_provided_function_app_with_static_site_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2940,15 +2925,15 @@ async def _register_user_provided_function_app_with_static_site_build_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3107,10 +3092,13 @@ async def begin_register_user_provided_function_app_with_static_site_build( # p params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3177,7 +3165,6 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3195,14 +3182,14 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3216,7 +3203,7 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3238,10 +3225,10 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3249,12 +3236,20 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -3359,7 +3354,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -3371,6 +3366,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3507,7 +3503,6 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3522,7 +3517,7 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3572,7 +3567,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3588,7 +3582,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3659,7 +3652,6 @@ async def get_basic_auth( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3674,7 +3666,7 @@ async def get_basic_auth( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3806,7 +3798,6 @@ async def create_or_update_basic_auth( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3821,7 +3812,7 @@ async def create_or_update_basic_auth( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3943,7 +3934,6 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3958,7 +3948,7 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4082,7 +4072,6 @@ async def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4097,7 +4086,7 @@ async def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4147,7 +4136,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4163,7 +4151,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4234,7 +4221,6 @@ async def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4249,7 +4235,7 @@ async def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4265,7 +4251,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4279,7 +4265,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4304,10 +4290,10 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4315,15 +4301,15 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4457,10 +4443,13 @@ async def begin_create_or_update_static_site_custom_domain( # pylint: disable=n params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4482,9 +4471,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4497,7 +4486,7 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -4508,10 +4497,10 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4519,12 +4508,20 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_custom_domain( @@ -4553,7 +4550,7 @@ async def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = await self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -4563,6 +4560,7 @@ async def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4584,7 +4582,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -4593,7 +4591,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4607,7 +4605,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4632,10 +4630,10 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4643,12 +4641,20 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -4756,7 +4762,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -4768,6 +4774,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4831,7 +4838,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4847,7 +4853,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4918,7 +4923,6 @@ async def get_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4933,7 +4937,7 @@ async def get_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5067,7 +5071,6 @@ async def create_or_update_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5082,7 +5085,7 @@ async def create_or_update_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5130,7 +5133,6 @@ async def delete_database_connection( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5276,7 +5278,6 @@ async def update_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5291,7 +5292,7 @@ async def update_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5339,7 +5340,6 @@ async def get_database_connection_with_details( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5354,16 +5354,16 @@ async def get_database_connection_with_details( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _detach_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5376,7 +5376,7 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -5386,10 +5386,10 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5397,12 +5397,20 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_detach_static_site( @@ -5429,7 +5437,7 @@ async def begin_detach_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._detach_static_site_initial( # type: ignore + raw_result = await self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -5438,6 +5446,7 @@ async def begin_detach_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5502,7 +5511,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5518,7 +5526,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5586,7 +5593,6 @@ async def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5601,7 +5607,7 @@ async def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5646,7 +5652,6 @@ async def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5661,7 +5666,7 @@ async def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5706,7 +5711,6 @@ async def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5721,7 +5725,7 @@ async def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5766,7 +5770,6 @@ async def list_static_site_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5781,7 +5784,7 @@ async def list_static_site_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5831,7 +5834,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5847,7 +5849,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5918,7 +5919,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5933,7 +5933,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5947,7 +5947,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5961,7 +5961,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5983,10 +5983,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5994,15 +5994,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6127,10 +6127,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6154,7 +6157,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6167,7 +6170,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -6178,10 +6181,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6189,18 +6192,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6244,10 +6244,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6305,7 +6306,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6320,7 +6320,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6442,7 +6442,6 @@ async def reset_static_site_api_key( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6502,7 +6501,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6518,7 +6516,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6592,7 +6589,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6608,7 +6604,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6680,7 +6675,6 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6695,7 +6689,9 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6712,7 +6708,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6726,7 +6722,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6751,10 +6747,10 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6762,15 +6758,15 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6916,10 +6912,13 @@ async def begin_register_user_provided_function_app_with_static_site( # pylint: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6982,7 +6981,6 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7000,13 +6998,13 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7020,7 +7018,7 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7041,10 +7039,10 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7052,12 +7050,20 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -7153,7 +7159,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -7164,6 +7170,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7185,14 +7192,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_backend_initial( # pylint: disable=inconsistent-return-statements + async def _validate_backend_initial( self, resource_group_name: str, name: str, linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7206,7 +7213,7 @@ async def _validate_backend_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7228,10 +7235,10 @@ async def _validate_backend_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7239,12 +7246,20 @@ async def _validate_backend_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_backend( @@ -7348,7 +7363,7 @@ async def begin_validate_backend( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_backend_initial( # type: ignore + raw_result = await self._validate_backend_initial( resource_group_name=resource_group_name, name=name, linked_backend_name=linked_backend_name, @@ -7360,6 +7375,7 @@ async def begin_validate_backend( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7381,7 +7397,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return-statements + async def _validate_backend_for_build_initial( self, resource_group_name: str, name: str, @@ -7389,7 +7405,7 @@ async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-r linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7403,7 +7419,7 @@ async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-r api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7426,10 +7442,10 @@ async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7437,12 +7453,20 @@ async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_backend_for_build( @@ -7555,7 +7579,7 @@ async def begin_validate_backend_for_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_backend_for_build_initial( # type: ignore + raw_result = await self._validate_backend_for_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -7568,6 +7592,7 @@ async def begin_validate_backend_for_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7632,7 +7657,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7648,7 +7672,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7724,7 +7747,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7740,7 +7762,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7811,7 +7832,6 @@ async def get_linked_backend( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7826,7 +7846,7 @@ async def get_linked_backend( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7840,7 +7860,7 @@ async def _link_backend_initial( linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteLinkedBackendARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7854,7 +7874,7 @@ async def _link_backend_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteLinkedBackendARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7876,10 +7896,10 @@ async def _link_backend_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7887,11 +7907,15 @@ async def _link_backend_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8018,10 +8042,11 @@ async def begin_link_backend( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8093,7 +8118,6 @@ async def unlink_backend( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8155,7 +8179,6 @@ async def get_linked_backend_for_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8170,7 +8193,7 @@ async def get_linked_backend_for_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8185,7 +8208,7 @@ async def _link_backend_to_build_initial( linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteLinkedBackendARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8199,7 +8222,7 @@ async def _link_backend_to_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteLinkedBackendARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -8222,10 +8245,10 @@ async def _link_backend_to_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8233,11 +8256,15 @@ async def _link_backend_to_build_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8374,10 +8401,11 @@ async def begin_link_backend_to_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8453,7 +8481,6 @@ async def unlink_backend_from_build( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_top_level_domains_operations.py index 1d9d497c5320f..7b234cfba0bd4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_level_domains_operations import ( build_get_request, build_list_agreements_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -178,7 +174,6 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_web_apps_operations.py index e585eccca55ce..00b54f7322eb5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_web_apps_operations.py @@ -32,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -45,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_apps_operations import ( build_add_premier_add_on_request, build_add_premier_add_on_slot_request, @@ -519,7 +519,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -535,7 +534,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -608,7 +606,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -624,7 +621,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -693,7 +689,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -708,7 +703,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -717,7 +712,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode async def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -731,7 +726,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -752,10 +747,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -763,15 +758,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -883,10 +878,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -961,7 +957,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1101,7 +1096,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1116,11 +1110,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1168,7 +1158,6 @@ async def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1183,7 +1172,7 @@ async def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1303,7 +1292,6 @@ async def apply_slot_config_to_production( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1432,7 +1420,6 @@ async def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1447,7 +1434,7 @@ async def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1493,7 +1480,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1509,7 +1495,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1580,7 +1565,6 @@ async def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1595,7 +1579,7 @@ async def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1646,7 +1630,6 @@ async def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1799,7 +1782,6 @@ async def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1814,21 +1796,21 @@ async def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_initial( # pylint: disable=inconsistent-return-statements + async def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1842,7 +1824,7 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1864,10 +1846,10 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1875,12 +1857,20 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore( @@ -1980,7 +1970,7 @@ async def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_initial( # type: ignore + raw_result = await self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -1992,6 +1982,7 @@ async def begin_restore( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2057,7 +2048,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2073,7 +2063,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2141,7 +2130,6 @@ async def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2156,7 +2144,7 @@ async def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2280,7 +2268,6 @@ async def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2295,7 +2282,7 @@ async def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2340,7 +2327,6 @@ async def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2355,7 +2341,7 @@ async def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2479,7 +2465,6 @@ async def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2494,7 +2479,7 @@ async def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2543,7 +2528,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2559,7 +2543,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2702,7 +2685,6 @@ async def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2717,7 +2699,7 @@ async def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2762,7 +2744,6 @@ async def list_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2777,7 +2758,7 @@ async def list_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2897,7 +2878,6 @@ async def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2912,7 +2892,7 @@ async def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2955,7 +2935,6 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2970,7 +2949,7 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3015,7 +2994,6 @@ async def get_auth_settings_v2_without_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3030,7 +3008,7 @@ async def get_auth_settings_v2_without_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3153,7 +3131,6 @@ async def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3168,7 +3145,7 @@ async def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3213,7 +3190,6 @@ async def get_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3228,7 +3204,7 @@ async def get_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3350,7 +3326,6 @@ async def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3365,7 +3340,7 @@ async def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3410,7 +3385,6 @@ async def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3425,7 +3399,7 @@ async def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3541,7 +3515,6 @@ async def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3556,7 +3529,7 @@ async def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3601,7 +3574,6 @@ async def delete_backup_configuration( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3657,7 +3629,6 @@ async def get_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3672,7 +3643,7 @@ async def get_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3721,7 +3692,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3737,7 +3707,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3808,7 +3777,6 @@ async def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3823,7 +3791,7 @@ async def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3872,7 +3840,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3888,7 +3855,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3959,7 +3925,6 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3974,7 +3939,7 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4097,7 +4062,6 @@ async def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4112,7 +4076,7 @@ async def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4157,7 +4121,6 @@ async def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4172,7 +4135,7 @@ async def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4217,7 +4180,6 @@ async def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4232,7 +4194,7 @@ async def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4355,7 +4317,6 @@ async def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4370,7 +4331,7 @@ async def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4486,7 +4447,6 @@ async def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4501,7 +4461,7 @@ async def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4544,7 +4504,6 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4559,7 +4518,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4568,7 +4527,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any async def _list_publishing_credentials_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4581,7 +4540,7 @@ async def _list_publishing_credentials_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -4591,10 +4550,10 @@ async def _list_publishing_credentials_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4602,11 +4561,15 @@ async def _list_publishing_credentials_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4647,10 +4610,11 @@ async def begin_list_publishing_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4781,7 +4745,6 @@ async def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4796,7 +4759,7 @@ async def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4839,7 +4802,6 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4854,7 +4816,7 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4900,7 +4862,6 @@ async def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4915,7 +4876,7 @@ async def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5044,7 +5005,6 @@ async def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5059,7 +5019,7 @@ async def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5104,7 +5064,6 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5119,7 +5078,7 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5239,7 +5198,6 @@ async def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5254,7 +5212,7 @@ async def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5374,7 +5332,6 @@ async def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5389,7 +5346,7 @@ async def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5441,7 +5398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5457,7 +5413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5528,7 +5483,6 @@ async def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5543,7 +5497,7 @@ async def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5591,7 +5545,6 @@ async def recover_site_configuration_snapshot( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5647,9 +5600,9 @@ async def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5658,12 +5611,16 @@ async def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5708,9 +5665,9 @@ async def get_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5719,12 +5676,16 @@ async def get_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5773,7 +5734,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5789,7 +5749,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5863,7 +5822,6 @@ async def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5878,7 +5836,7 @@ async def get_continuous_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5926,7 +5884,6 @@ async def delete_continuous_web_job( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5988,7 +5945,6 @@ async def start_continuous_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6050,7 +6006,6 @@ async def stop_continuous_web_job( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6110,7 +6065,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6126,7 +6080,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6158,7 +6111,7 @@ async def get_next(next_link=None): async def _get_production_site_deployment_status_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, deployment_status_id: str, **kwargs: Any - ) -> _models.CsmDeploymentStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6171,7 +6124,7 @@ async def _get_production_site_deployment_status_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.CsmDeploymentStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_get_production_site_deployment_status_request( resource_group_name=resource_group_name, @@ -6182,10 +6135,10 @@ async def _get_production_site_deployment_status_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6193,15 +6146,15 @@ async def _get_production_site_deployment_status_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6247,10 +6200,11 @@ async def begin_get_production_site_deployment_status( # pylint: disable=name-t params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6313,7 +6267,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6329,7 +6282,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6398,7 +6350,6 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6413,7 +6364,7 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6543,7 +6494,6 @@ async def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6558,7 +6508,7 @@ async def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6606,7 +6556,6 @@ async def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6666,7 +6615,6 @@ async def list_deployment_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6681,7 +6629,7 @@ async def list_deployment_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6805,7 +6753,6 @@ async def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6820,7 +6767,7 @@ async def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6868,7 +6815,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6884,7 +6830,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6955,7 +6900,6 @@ async def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6970,7 +6914,7 @@ async def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7105,7 +7049,6 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7120,7 +7063,7 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7168,7 +7111,6 @@ async def delete_domain_ownership_identifier( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7314,7 +7256,6 @@ async def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7329,7 +7270,7 @@ async def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7372,7 +7313,6 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7387,7 +7327,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7396,7 +7336,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar async def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7413,7 +7353,7 @@ async def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7434,10 +7374,10 @@ async def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7445,11 +7385,15 @@ async def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7555,10 +7499,11 @@ async def begin_create_ms_deploy_operation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7619,7 +7564,6 @@ async def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7634,7 +7578,7 @@ async def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7678,7 +7622,6 @@ async def get_one_deploy_status(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7693,7 +7636,7 @@ async def get_one_deploy_status(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7736,7 +7679,6 @@ async def create_one_deploy_operation(self, resource_group_name: str, name: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7751,7 +7693,7 @@ async def create_one_deploy_operation(self, resource_group_name: str, name: str, error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7803,7 +7745,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7819,7 +7760,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7885,7 +7825,6 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7900,7 +7839,7 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7951,7 +7890,6 @@ async def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7966,7 +7904,7 @@ async def get_function( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7980,7 +7918,7 @@ async def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7994,7 +7932,7 @@ async def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -8016,10 +7954,10 @@ async def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8027,11 +7965,15 @@ async def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8151,10 +8093,11 @@ async def begin_create_function( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8220,7 +8163,6 @@ async def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8371,7 +8313,6 @@ async def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8386,11 +8327,7 @@ async def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8444,7 +8381,6 @@ async def delete_function_secret( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8503,7 +8439,6 @@ async def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8518,7 +8453,7 @@ async def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8566,7 +8501,6 @@ async def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8581,7 +8515,7 @@ async def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8624,7 +8558,6 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8639,7 +8572,7 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8684,7 +8617,6 @@ async def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8740,7 +8672,6 @@ async def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8891,7 +8822,6 @@ async def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8906,11 +8836,7 @@ async def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8964,7 +8890,6 @@ async def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9024,7 +8949,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9040,7 +8964,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9111,7 +9034,6 @@ async def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9126,7 +9048,7 @@ async def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9258,7 +9180,6 @@ async def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9273,7 +9194,7 @@ async def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9321,7 +9242,6 @@ async def delete_host_name_binding( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9383,7 +9303,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9398,7 +9317,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9538,7 +9457,6 @@ async def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9553,7 +9471,7 @@ async def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9607,7 +9525,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9758,7 +9675,6 @@ async def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9773,7 +9689,7 @@ async def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9818,7 +9734,6 @@ async def list_hybrid_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9833,7 +9748,7 @@ async def list_hybrid_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9879,7 +9794,6 @@ async def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9894,7 +9808,7 @@ async def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9942,7 +9856,6 @@ async def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9957,7 +9870,7 @@ async def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10091,7 +10004,6 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10106,7 +10018,7 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10157,7 +10069,6 @@ async def delete_relay_service_connection( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10302,7 +10213,6 @@ async def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10317,7 +10227,7 @@ async def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10367,7 +10277,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10383,7 +10292,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10454,7 +10362,6 @@ async def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10469,7 +10376,7 @@ async def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10517,7 +10424,6 @@ async def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10532,7 +10438,7 @@ async def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10546,7 +10452,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10563,7 +10469,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10585,10 +10491,10 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10596,11 +10502,15 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10720,10 +10630,11 @@ async def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10789,7 +10700,6 @@ async def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10804,7 +10714,7 @@ async def get_instance_ms_deploy_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10861,7 +10771,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10877,7 +10786,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10956,7 +10864,6 @@ async def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10971,7 +10878,7 @@ async def get_instance_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11028,7 +10935,6 @@ async def delete_instance_process( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11095,9 +11001,9 @@ async def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11106,11 +11012,15 @@ async def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11171,7 +11081,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11187,7 +11096,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11269,7 +11177,6 @@ async def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11284,7 +11191,7 @@ async def get_instance_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11344,7 +11251,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11360,7 +11266,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11426,7 +11331,6 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11441,7 +11345,7 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11489,7 +11393,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11505,7 +11408,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11573,7 +11475,6 @@ async def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11588,7 +11489,7 @@ async def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11602,7 +11503,7 @@ async def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11616,7 +11517,7 @@ async def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11638,10 +11539,10 @@ async def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11649,11 +11550,15 @@ async def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11777,10 +11682,11 @@ async def begin_migrate_storage( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11808,7 +11714,7 @@ async def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11822,7 +11728,7 @@ async def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11843,10 +11749,10 @@ async def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11854,11 +11760,15 @@ async def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11969,10 +11879,11 @@ async def begin_migrate_my_sql( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12034,7 +11945,6 @@ async def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12049,7 +11959,7 @@ async def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12094,7 +12004,6 @@ async def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12109,7 +12018,7 @@ async def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12249,7 +12158,6 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12264,7 +12172,7 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12312,7 +12220,6 @@ async def delete_swift_virtual_network( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12463,7 +12370,6 @@ async def update_swift_virtual_network_connection_with_check( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12478,7 +12384,7 @@ async def update_swift_virtual_network_connection_with_check( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12529,7 +12435,6 @@ async def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12544,7 +12449,7 @@ async def list_network_features( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12593,7 +12498,6 @@ async def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12608,11 +12512,7 @@ async def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12672,7 +12572,6 @@ async def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12687,7 +12586,7 @@ async def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12702,7 +12601,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12715,7 +12614,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -12728,10 +12627,10 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -12739,15 +12638,15 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12805,10 +12704,11 @@ async def begin_start_web_site_network_trace_operation( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12868,7 +12768,6 @@ async def stop_web_site_network_trace( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12928,7 +12827,6 @@ async def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12943,7 +12841,7 @@ async def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12992,7 +12890,6 @@ async def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13007,11 +12904,7 @@ async def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13060,7 +12953,6 @@ async def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13075,7 +12967,7 @@ async def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13121,7 +13013,6 @@ async def generate_new_site_publishing_password( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13186,7 +13077,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13202,7 +13092,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13270,7 +13159,6 @@ async def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13285,7 +13173,7 @@ async def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13328,7 +13216,6 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13343,7 +13230,7 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13391,7 +13278,6 @@ async def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13406,7 +13292,7 @@ async def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13536,7 +13422,6 @@ async def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13551,7 +13436,7 @@ async def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13599,7 +13484,6 @@ async def delete_premier_add_on( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13740,7 +13624,6 @@ async def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13755,7 +13638,7 @@ async def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13800,7 +13683,6 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13815,7 +13697,7 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13937,7 +13819,6 @@ async def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13952,7 +13833,7 @@ async def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14002,7 +13883,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14018,7 +13898,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14089,7 +13968,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14104,7 +13982,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14118,7 +13996,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14132,7 +14010,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14154,10 +14032,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14165,15 +14043,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14298,10 +14176,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14325,7 +14206,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14338,7 +14219,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -14349,10 +14230,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14360,18 +14241,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14415,10 +14293,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14476,7 +14355,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14491,7 +14369,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14544,7 +14422,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14560,7 +14437,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14635,7 +14511,6 @@ async def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14650,7 +14525,7 @@ async def get_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14703,7 +14578,6 @@ async def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14766,9 +14640,9 @@ async def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14777,11 +14651,15 @@ async def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14838,7 +14716,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14854,7 +14731,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14932,7 +14808,6 @@ async def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14947,7 +14822,7 @@ async def get_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15003,7 +14878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15019,7 +14893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15091,7 +14964,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15107,7 +14979,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15178,7 +15049,6 @@ async def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15193,7 +15063,7 @@ async def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15325,7 +15195,6 @@ async def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15340,7 +15209,7 @@ async def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15388,7 +15257,6 @@ async def delete_public_certificate( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15524,9 +15392,9 @@ async def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15535,11 +15403,15 @@ async def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15586,7 +15458,6 @@ async def reset_production_slot_config( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15656,7 +15527,6 @@ async def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15674,9 +15544,9 @@ async def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15690,7 +15560,7 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15711,10 +15581,10 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15722,12 +15592,20 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob( @@ -15814,7 +15692,7 @@ async def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -15825,6 +15703,7 @@ async def begin_restore_from_backup_blob( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15846,13 +15725,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15866,7 +15745,7 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15887,10 +15766,10 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15898,12 +15777,20 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app( @@ -15994,7 +15881,7 @@ async def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -16005,6 +15892,7 @@ async def begin_restore_from_deleted_app( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16026,13 +15914,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16046,7 +15934,7 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16067,10 +15955,10 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16078,12 +15966,20 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot( @@ -16177,7 +16073,7 @@ async def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_initial( # type: ignore + raw_result = await self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -16188,6 +16084,7 @@ async def begin_restore_snapshot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16254,7 +16151,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16270,7 +16166,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16344,7 +16239,6 @@ async def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16359,7 +16253,7 @@ async def get_site_extension( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16368,7 +16262,7 @@ async def get_site_extension( async def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16385,7 +16279,7 @@ async def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -16396,10 +16290,10 @@ async def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16407,15 +16301,15 @@ async def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16461,10 +16355,11 @@ async def begin_install_site_extension( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16530,7 +16425,6 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16587,7 +16481,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16603,7 +16496,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16676,7 +16568,6 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16691,7 +16582,7 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16705,7 +16596,7 @@ async def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16719,7 +16610,7 @@ async def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16741,10 +16632,10 @@ async def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16752,15 +16643,15 @@ async def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16889,10 +16780,11 @@ async def begin_create_or_update_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16972,7 +16864,6 @@ async def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17125,7 +17016,6 @@ async def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17140,11 +17030,7 @@ async def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17196,7 +17082,6 @@ async def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17211,7 +17096,7 @@ async def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17344,7 +17229,6 @@ async def apply_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17490,7 +17374,6 @@ async def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17505,7 +17388,7 @@ async def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17557,7 +17440,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17573,7 +17455,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17648,7 +17529,6 @@ async def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17663,7 +17543,7 @@ async def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17718,7 +17598,6 @@ async def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17884,7 +17763,6 @@ async def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17899,14 +17777,14 @@ async def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -17914,7 +17792,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17928,7 +17806,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17951,10 +17829,10 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17962,12 +17840,20 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_slot( @@ -18079,7 +17965,7 @@ async def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_slot_initial( # type: ignore + raw_result = await self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -18092,6 +17978,7 @@ async def begin_restore_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -18160,7 +18047,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18176,7 +18062,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18247,7 +18132,6 @@ async def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18262,7 +18146,7 @@ async def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18396,7 +18280,6 @@ async def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18411,7 +18294,7 @@ async def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18459,7 +18342,6 @@ async def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18474,7 +18356,7 @@ async def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18608,7 +18490,6 @@ async def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18623,7 +18504,7 @@ async def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18676,7 +18557,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18692,7 +18572,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18848,7 +18727,6 @@ async def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18863,7 +18741,7 @@ async def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18912,7 +18790,6 @@ async def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18927,7 +18804,7 @@ async def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19060,7 +18937,6 @@ async def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19075,7 +18951,7 @@ async def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19124,7 +19000,6 @@ async def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19139,7 +19014,7 @@ async def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19188,7 +19063,6 @@ async def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19203,7 +19077,7 @@ async def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19339,7 +19213,6 @@ async def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19354,7 +19227,7 @@ async def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19403,7 +19276,6 @@ async def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19418,7 +19290,7 @@ async def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19553,7 +19425,6 @@ async def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19568,7 +19439,7 @@ async def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19617,7 +19488,6 @@ async def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19632,7 +19502,7 @@ async def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19765,7 +19635,6 @@ async def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19780,7 +19649,7 @@ async def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19829,7 +19698,6 @@ async def delete_backup_configuration_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19889,7 +19757,6 @@ async def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19904,7 +19771,7 @@ async def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19956,7 +19823,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19972,7 +19838,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20046,7 +19911,6 @@ async def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20061,7 +19925,7 @@ async def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20113,7 +19977,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20129,7 +19992,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20203,7 +20065,6 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20218,7 +20079,7 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20354,7 +20215,6 @@ async def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20369,7 +20229,7 @@ async def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20418,7 +20278,6 @@ async def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20433,7 +20292,7 @@ async def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20482,7 +20341,6 @@ async def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20497,7 +20355,7 @@ async def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20633,7 +20491,6 @@ async def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20648,7 +20505,7 @@ async def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20781,7 +20638,6 @@ async def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20796,7 +20652,7 @@ async def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20845,7 +20701,6 @@ async def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20860,7 +20715,7 @@ async def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20869,7 +20724,7 @@ async def list_metadata_slot( async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20882,7 +20737,7 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -20893,10 +20748,10 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20904,11 +20759,15 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20953,10 +20812,11 @@ async def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21104,7 +20964,6 @@ async def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21119,7 +20978,7 @@ async def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21168,7 +21027,6 @@ async def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21183,7 +21041,7 @@ async def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21234,7 +21092,6 @@ async def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21249,7 +21106,7 @@ async def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21382,7 +21239,6 @@ async def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21397,7 +21253,7 @@ async def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21530,7 +21386,6 @@ async def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21545,7 +21400,7 @@ async def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21601,7 +21456,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21617,7 +21471,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21692,7 +21545,6 @@ async def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21707,7 +21559,7 @@ async def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21759,7 +21611,6 @@ async def recover_site_configuration_snapshot_slot( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21819,9 +21670,9 @@ async def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21830,12 +21681,16 @@ async def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21884,9 +21739,9 @@ async def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21895,12 +21750,16 @@ async def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21953,7 +21812,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21969,7 +21827,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22047,7 +21904,6 @@ async def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22062,7 +21918,7 @@ async def get_continuous_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22114,7 +21970,6 @@ async def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22180,7 +22035,6 @@ async def start_continuous_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22246,7 +22100,6 @@ async def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22310,7 +22163,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22326,7 +22178,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22358,7 +22209,7 @@ async def get_next(next_link=None): async def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, deployment_status_id: str, **kwargs: Any - ) -> _models.CsmDeploymentStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22371,7 +22222,7 @@ async def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.CsmDeploymentStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_get_slot_site_deployment_status_slot_request( resource_group_name=resource_group_name, @@ -22383,10 +22234,10 @@ async def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22394,15 +22245,15 @@ async def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22452,10 +22303,11 @@ async def begin_get_slot_site_deployment_status_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22522,7 +22374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22538,7 +22389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22613,7 +22463,6 @@ async def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22628,7 +22477,7 @@ async def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22771,7 +22620,6 @@ async def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22786,7 +22634,7 @@ async def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22838,7 +22686,6 @@ async def delete_deployment_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22902,7 +22749,6 @@ async def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22917,7 +22763,7 @@ async def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23058,7 +22904,6 @@ async def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23073,7 +22918,7 @@ async def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23125,7 +22970,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23141,7 +22985,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23216,7 +23059,6 @@ async def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23231,7 +23073,7 @@ async def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23379,7 +23221,6 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23394,7 +23235,7 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23446,7 +23287,6 @@ async def delete_domain_ownership_identifier_slot( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23605,7 +23445,6 @@ async def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23620,7 +23459,7 @@ async def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23669,7 +23508,6 @@ async def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23684,7 +23522,7 @@ async def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23698,7 +23536,7 @@ async def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23715,7 +23553,7 @@ async def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23737,10 +23575,10 @@ async def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23748,11 +23586,15 @@ async def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23875,10 +23717,11 @@ async def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23945,7 +23788,6 @@ async def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23960,7 +23802,7 @@ async def get_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24015,7 +23857,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24031,7 +23872,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24103,7 +23943,6 @@ async def get_functions_admin_token_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24118,7 +23957,7 @@ async def get_functions_admin_token_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24172,7 +24011,6 @@ async def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24187,7 +24025,7 @@ async def get_instance_function_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24202,7 +24040,7 @@ async def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24216,7 +24054,7 @@ async def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24239,10 +24077,10 @@ async def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24250,11 +24088,15 @@ async def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24384,10 +24226,11 @@ async def begin_create_instance_function_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24456,7 +24299,6 @@ async def delete_instance_function_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24617,7 +24459,6 @@ async def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24632,11 +24473,7 @@ async def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24693,7 +24530,6 @@ async def delete_function_secret_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24755,7 +24591,6 @@ async def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24770,7 +24605,7 @@ async def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24821,7 +24656,6 @@ async def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24836,7 +24670,7 @@ async def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24884,7 +24718,6 @@ async def list_host_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24899,7 +24732,7 @@ async def list_host_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24947,7 +24780,6 @@ async def list_sync_status_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25006,7 +24838,6 @@ async def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25167,7 +24998,6 @@ async def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25182,11 +25012,7 @@ async def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25243,7 +25069,6 @@ async def delete_host_secret_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25307,7 +25132,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25323,7 +25147,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25398,7 +25221,6 @@ async def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25413,7 +25235,7 @@ async def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25558,7 +25380,6 @@ async def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25573,7 +25394,7 @@ async def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25625,7 +25446,6 @@ async def delete_host_name_binding_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25690,7 +25510,6 @@ async def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25705,7 +25524,7 @@ async def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25855,7 +25674,6 @@ async def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25870,7 +25688,7 @@ async def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25927,7 +25745,6 @@ async def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26088,7 +25905,6 @@ async def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26103,7 +25919,7 @@ async def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26151,7 +25967,6 @@ async def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26166,7 +25981,7 @@ async def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26216,7 +26031,6 @@ async def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26231,7 +26045,7 @@ async def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26283,7 +26097,6 @@ async def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26298,7 +26111,7 @@ async def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26445,7 +26258,6 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26460,7 +26272,7 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26515,7 +26327,6 @@ async def delete_relay_service_connection_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26673,7 +26484,6 @@ async def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26688,7 +26498,7 @@ async def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26742,7 +26552,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26758,7 +26567,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26833,7 +26641,6 @@ async def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26848,7 +26655,7 @@ async def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26900,7 +26707,6 @@ async def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26915,7 +26721,7 @@ async def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26930,7 +26736,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26947,7 +26753,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26970,10 +26776,10 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26981,11 +26787,15 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27118,10 +26928,11 @@ async def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=nam params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27191,7 +27002,6 @@ async def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27206,7 +27016,7 @@ async def get_instance_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27267,7 +27077,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27283,7 +27092,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27366,7 +27174,6 @@ async def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27381,7 +27188,7 @@ async def get_instance_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27442,7 +27249,6 @@ async def delete_instance_process_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27513,9 +27319,9 @@ async def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27524,11 +27330,15 @@ async def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27593,7 +27403,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27609,7 +27418,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27702,7 +27510,6 @@ async def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27717,7 +27524,7 @@ async def get_instance_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27781,7 +27588,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27797,7 +27603,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27869,7 +27674,6 @@ async def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27884,7 +27688,7 @@ async def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27936,7 +27740,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27952,7 +27755,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28023,7 +27825,6 @@ async def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28038,7 +27839,7 @@ async def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28088,7 +27889,6 @@ async def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28103,7 +27903,7 @@ async def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28152,7 +27952,6 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28167,7 +27966,7 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28320,7 +28119,6 @@ async def create_or_update_swift_virtual_network_connection_with_check_slot( # headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28335,7 +28133,7 @@ async def create_or_update_swift_virtual_network_connection_with_check_slot( # error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28387,7 +28185,6 @@ async def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28551,7 +28348,6 @@ async def update_swift_virtual_network_connection_with_check_slot( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28566,7 +28362,7 @@ async def update_swift_virtual_network_connection_with_check_slot( # pylint: di error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28621,7 +28417,6 @@ async def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28636,7 +28431,7 @@ async def list_network_features_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28689,7 +28484,6 @@ async def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28704,11 +28498,7 @@ async def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28772,7 +28562,6 @@ async def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28787,7 +28576,7 @@ async def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28803,7 +28592,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28816,7 +28605,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -28830,10 +28619,10 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28841,15 +28630,15 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28911,10 +28700,11 @@ async def begin_start_web_site_network_trace_operation_slot( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28977,7 +28767,6 @@ async def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29041,7 +28830,6 @@ async def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29056,7 +28844,7 @@ async def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29109,7 +28897,6 @@ async def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29124,11 +28911,7 @@ async def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29181,7 +28964,6 @@ async def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29196,7 +28978,7 @@ async def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29246,7 +29028,6 @@ async def generate_new_site_publishing_password_slot( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29315,7 +29096,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29331,7 +29111,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29403,7 +29182,6 @@ async def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29418,7 +29196,7 @@ async def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29467,7 +29245,6 @@ async def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29482,7 +29259,7 @@ async def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29534,7 +29311,6 @@ async def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29549,7 +29325,7 @@ async def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29692,7 +29468,6 @@ async def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29707,7 +29482,7 @@ async def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29759,7 +29534,6 @@ async def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29913,7 +29687,6 @@ async def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29928,7 +29701,7 @@ async def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29978,7 +29751,6 @@ async def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29993,7 +29765,7 @@ async def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30129,7 +29901,6 @@ async def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30144,7 +29915,7 @@ async def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30197,7 +29968,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30213,7 +29983,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30287,7 +30056,6 @@ async def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30302,7 +30070,7 @@ async def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30317,7 +30085,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30331,7 +30099,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30354,10 +30122,10 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30365,15 +30133,15 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30508,10 +30276,13 @@ async def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30535,7 +30306,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30548,7 +30319,7 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -30560,10 +30331,10 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30571,18 +30342,15 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30629,10 +30397,11 @@ async def begin_delete_private_endpoint_connection_slot( # pylint: disable=name params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30693,7 +30462,6 @@ async def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30708,7 +30476,7 @@ async def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30765,7 +30533,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30781,7 +30548,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30860,7 +30626,6 @@ async def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30875,7 +30640,7 @@ async def get_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30932,7 +30697,6 @@ async def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30999,9 +30763,9 @@ async def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -31010,11 +30774,15 @@ async def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31075,7 +30843,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31091,7 +30858,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31173,7 +30939,6 @@ async def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31188,7 +30953,7 @@ async def get_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31248,7 +31013,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31264,7 +31028,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31340,7 +31103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31356,7 +31118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31431,7 +31192,6 @@ async def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31446,7 +31206,7 @@ async def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31591,7 +31351,6 @@ async def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31606,7 +31365,7 @@ async def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31658,7 +31417,6 @@ async def delete_public_certificate_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31807,9 +31565,9 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -31818,11 +31576,15 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31873,7 +31635,6 @@ async def reset_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31948,7 +31709,6 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31966,14 +31726,14 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31987,7 +31747,7 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32009,10 +31769,10 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32020,12 +31780,20 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob_slot( @@ -32128,7 +31896,7 @@ async def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -32140,6 +31908,7 @@ async def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32161,14 +31930,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32182,7 +31951,7 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32204,10 +31973,10 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32215,12 +31984,20 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app_slot( @@ -32323,7 +32100,7 @@ async def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -32335,6 +32112,7 @@ async def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32356,14 +32134,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32377,7 +32155,7 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32399,10 +32177,10 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32410,12 +32188,20 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot_slot( @@ -32521,7 +32307,7 @@ async def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_slot_initial( # type: ignore + raw_result = await self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -32533,6 +32319,7 @@ async def begin_restore_snapshot_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32603,7 +32390,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32619,7 +32405,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32697,7 +32482,6 @@ async def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32712,7 +32496,7 @@ async def get_site_extension_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32721,7 +32505,7 @@ async def get_site_extension_slot( async def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32738,7 +32522,7 @@ async def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -32750,10 +32534,10 @@ async def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32761,15 +32545,15 @@ async def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32819,10 +32603,11 @@ async def begin_install_site_extension_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32892,7 +32677,6 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33041,7 +32825,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33057,7 +32840,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33087,14 +32869,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33108,7 +32890,7 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33130,10 +32912,10 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33141,12 +32923,20 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot( @@ -33249,7 +33039,7 @@ async def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_initial( # type: ignore + raw_result = await self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -33261,6 +33051,7 @@ async def begin_swap_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -33326,7 +33117,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33342,7 +33132,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33416,7 +33205,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33432,7 +33220,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33504,7 +33291,6 @@ async def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33519,14 +33305,7 @@ async def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33540,7 +33319,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33554,7 +33333,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33576,10 +33355,10 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33587,18 +33366,15 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33726,10 +33502,11 @@ async def begin_create_or_update_source_control_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33799,7 +33576,6 @@ async def delete_source_control_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33945,7 +33721,6 @@ async def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33960,14 +33735,7 @@ async def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34016,7 +33784,6 @@ async def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34043,7 +33810,7 @@ async def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34056,7 +33823,7 @@ async def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -34070,10 +33837,10 @@ async def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34081,15 +33848,15 @@ async def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34151,10 +33918,11 @@ async def begin_start_network_trace_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -34218,7 +33986,6 @@ async def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34277,7 +34044,6 @@ async def stop_network_trace_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34337,7 +34103,6 @@ async def sync_repository_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34396,7 +34161,6 @@ async def sync_function_triggers_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34460,7 +34224,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34476,7 +34239,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34554,7 +34316,6 @@ async def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34569,7 +34330,7 @@ async def get_triggered_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34621,7 +34382,6 @@ async def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34691,7 +34451,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34707,7 +34466,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34789,7 +34547,6 @@ async def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34804,7 +34561,7 @@ async def get_triggered_web_job_history_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34859,7 +34616,6 @@ async def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34929,7 +34685,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34945,7 +34700,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35017,7 +34771,6 @@ async def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35032,7 +34785,7 @@ async def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35084,7 +34837,6 @@ async def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35099,7 +34851,7 @@ async def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35250,7 +35002,6 @@ async def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35265,7 +35016,7 @@ async def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35321,7 +35072,6 @@ async def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35483,7 +35233,6 @@ async def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35498,7 +35247,7 @@ async def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35557,7 +35306,6 @@ async def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35572,7 +35320,7 @@ async def get_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35728,7 +35476,6 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35743,7 +35490,7 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35899,7 +35646,6 @@ async def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35914,7 +35660,7 @@ async def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35966,7 +35712,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35982,7 +35727,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36057,7 +35801,6 @@ async def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36072,7 +35815,7 @@ async def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36197,7 +35940,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36213,7 +35955,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36243,13 +35984,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36263,7 +36004,7 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -36284,10 +36025,10 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36295,12 +36036,20 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot_with_production( @@ -36391,7 +36140,7 @@ async def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_with_production_initial( # type: ignore + raw_result = await self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -36402,6 +36151,7 @@ async def begin_swap_slot_with_production( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -36462,7 +36212,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36478,7 +36227,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36549,7 +36297,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36565,7 +36312,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36631,7 +36377,6 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36646,14 +36391,7 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36666,7 +36404,7 @@ async def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36680,7 +36418,7 @@ async def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -36701,10 +36439,10 @@ async def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36712,18 +36450,15 @@ async def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36838,10 +36573,11 @@ async def begin_create_or_update_source_control( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -36907,7 +36643,6 @@ async def delete_source_control( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37040,7 +36775,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37055,14 +36789,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37107,7 +36834,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37133,7 +36859,7 @@ async def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37146,7 +36872,7 @@ async def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -37159,10 +36885,10 @@ async def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -37170,15 +36896,15 @@ async def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37236,10 +36962,11 @@ async def begin_start_network_trace( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -37299,7 +37026,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37355,7 +37081,6 @@ async def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37411,7 +37136,6 @@ async def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37467,7 +37191,6 @@ async def sync_function_triggers( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37527,7 +37250,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37543,7 +37265,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37617,7 +37338,6 @@ async def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37632,7 +37352,7 @@ async def get_triggered_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37680,7 +37400,6 @@ async def delete_triggered_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37746,7 +37465,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37762,7 +37480,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37840,7 +37557,6 @@ async def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37855,7 +37571,7 @@ async def get_triggered_web_job_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37906,7 +37622,6 @@ async def run_triggered_web_job( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37972,7 +37687,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37988,7 +37702,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38056,7 +37769,6 @@ async def list_vnet_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38071,7 +37783,7 @@ async def list_vnet_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38119,7 +37831,6 @@ async def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38134,7 +37845,7 @@ async def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38272,7 +37983,6 @@ async def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38287,7 +37997,7 @@ async def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38339,7 +38049,6 @@ async def delete_vnet_connection( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38488,7 +38197,6 @@ async def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38503,7 +38211,7 @@ async def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38558,7 +38266,6 @@ async def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38573,7 +38280,7 @@ async def get_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38716,7 +38423,6 @@ async def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38731,7 +38437,7 @@ async def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38874,7 +38580,6 @@ async def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38889,7 +38594,7 @@ async def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38935,7 +38640,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38951,7 +38655,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39022,7 +38725,6 @@ async def get_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39037,7 +38739,7 @@ async def get_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39162,7 +38864,6 @@ async def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39308,7 +39009,6 @@ async def deploy_workflow_artifacts_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39371,7 +39071,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39387,7 +39086,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39464,7 +39162,6 @@ async def get_instance_workflow_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39479,7 +39176,7 @@ async def get_instance_workflow_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39527,7 +39224,6 @@ async def list_workflows_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39542,7 +39238,7 @@ async def list_workflows_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39591,7 +39287,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39607,7 +39302,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39681,7 +39375,6 @@ async def get_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39696,7 +39389,7 @@ async def get_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39741,7 +39434,6 @@ async def list_workflows_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39756,7 +39448,7 @@ async def list_workflows_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_web_site_management_client_operations.py index 79435220177a6..eac8c12d326a6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_web_site_management_client_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_site_management_client_operations import ( build_check_name_availability_request, build_get_publishing_user_request, @@ -98,7 +96,6 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +110,7 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -202,7 +199,6 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -217,7 +213,7 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -259,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -275,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -339,7 +333,6 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +347,7 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -462,7 +455,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -477,7 +469,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -528,7 +520,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -544,7 +535,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -634,7 +624,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -649,7 +638,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -697,7 +686,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -713,7 +701,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -776,7 +763,6 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -791,7 +777,7 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -833,7 +819,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -849,7 +834,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -938,7 +922,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -954,7 +937,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1074,7 +1056,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1090,7 +1071,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1156,7 +1136,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1172,7 +1151,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1234,7 +1212,6 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1249,7 +1226,7 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1348,7 +1325,6 @@ async def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1363,7 +1339,7 @@ async def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1476,7 +1452,6 @@ async def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1596,7 +1571,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1611,7 +1585,7 @@ async def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1724,7 +1698,6 @@ async def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_action_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_action_repetitions_operations.py index 32d3580b0043b..8994cc7a22bbf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_action_repetitions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_action_repetitions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_run_action_repetitions_operations import ( build_get_request, build_list_expression_traces_request, @@ -114,7 +112,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -130,7 +127,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -215,7 +211,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -230,7 +225,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response) + deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -312,7 +306,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_action_repetitions_request_histories_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_action_repetitions_request_histories_operations.py index 660597edc46c5..b0cda1b969162 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_action_repetitions_request_histories_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_action_repetitions_request_histories_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_run_action_repetitions_request_histories_operations import ( build_get_request, build_list_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -227,7 +223,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +237,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RequestHistory", pipeline_response) + deserialized = self._deserialize("RequestHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_action_scope_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_action_scope_repetitions_operations.py index 135f7c4f7d7c4..53cae1fb4ce41 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_action_scope_repetitions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_action_scope_repetitions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_run_action_scope_repetitions_operations import build_get_request, build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -110,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -211,7 +207,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +221,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response) + deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_actions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_actions_operations.py index 1bd580a200c9a..55419dd0ada4f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_actions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_run_actions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_run_actions_operations import ( build_get_request, build_list_expression_traces_request, @@ -124,7 +122,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -140,7 +137,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -215,7 +211,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -230,7 +225,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunAction", pipeline_response) + deserialized = self._deserialize("WorkflowRunAction", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -286,7 +281,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -302,7 +296,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_runs_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_runs_operations.py index 294360c522cce..d260ce0995809 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_runs_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_runs_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_runs_operations import build_cancel_request, build_get_request, build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -115,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -131,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -203,7 +199,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -218,7 +213,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRun", pipeline_response) + deserialized = self._deserialize("WorkflowRun", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -267,7 +262,6 @@ async def cancel( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_trigger_histories_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_trigger_histories_operations.py index 463d84690bd4d..e8a4f342b33b7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_trigger_histories_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_trigger_histories_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_trigger_histories_operations import ( build_get_request, build_list_request, @@ -127,7 +127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -143,7 +142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -225,7 +223,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -240,14 +237,14 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTriggerHistory", pipeline_response) + deserialized = self._deserialize("WorkflowTriggerHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _resubmit_initial( # pylint: disable=inconsistent-return-statements + async def _resubmit_initial( self, resource_group_name: str, name: str, @@ -255,7 +252,7 @@ async def _resubmit_initial( # pylint: disable=inconsistent-return-statements trigger_name: str, history_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -268,7 +265,7 @@ async def _resubmit_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resubmit_request( resource_group_name=resource_group_name, @@ -281,10 +278,10 @@ async def _resubmit_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -292,12 +289,20 @@ async def _resubmit_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_resubmit( @@ -335,7 +340,7 @@ async def begin_resubmit( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._resubmit_initial( # type: ignore + raw_result = await self._resubmit_initial( resource_group_name=resource_group_name, name=name, workflow_name=workflow_name, @@ -347,6 +352,7 @@ async def begin_resubmit( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_triggers_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_triggers_operations.py index a1a923e2eb5d1..f9812873b53b4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_triggers_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_triggers_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_triggers_operations import ( build_get_request, build_get_schema_json_request, @@ -123,7 +123,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +138,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -211,7 +209,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +223,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTrigger", pipeline_response) + deserialized = self._deserialize("WorkflowTrigger", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -275,7 +272,6 @@ async def list_callback_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -290,16 +286,16 @@ async def list_callback_url( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTriggerCallbackUrl", pipeline_response) + deserialized = self._deserialize("WorkflowTriggerCallbackUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _run_initial( # pylint: disable=inconsistent-return-statements + async def _run_initial( self, resource_group_name: str, name: str, workflow_name: str, trigger_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -312,7 +308,7 @@ async def _run_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_run_request( resource_group_name=resource_group_name, @@ -324,10 +320,10 @@ async def _run_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -335,12 +331,20 @@ async def _run_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_run( @@ -369,7 +373,7 @@ async def begin_run( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._run_initial( # type: ignore + raw_result = await self._run_initial( resource_group_name=resource_group_name, name=name, workflow_name=workflow_name, @@ -380,6 +384,7 @@ async def begin_run( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -443,7 +448,6 @@ async def get_schema_json( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -458,7 +462,7 @@ async def get_schema_json( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JsonSchema", pipeline_response) + deserialized = self._deserialize("JsonSchema", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_versions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_versions_operations.py index ee1da08da6158..33a2efdb5f2fb 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_versions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflow_versions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_versions_operations import build_get_request, build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -106,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -122,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -194,7 +190,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +204,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowVersion", pipeline_response) + deserialized = self._deserialize("WorkflowVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflows_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflows_operations.py index d27379595cc14..3e682ec082f59 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflows_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/aio/operations/_workflows_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflows_operations import build_regenerate_access_key_request, build_validate_request from .._vendor import WebSiteManagementClientMixinABC @@ -175,7 +173,6 @@ async def regenerate_access_key( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -309,7 +306,6 @@ async def validate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/models/_models_py3.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/models/_models_py3.py index 2d60e3945485d..45bcb133bd3df 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/models/_models_py3.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/models/_models_py3.py @@ -29432,7 +29432,7 @@ class WorkflowParameter(_serialization.Model): """The workflow parameters. :ivar type: The type. Known values are: "NotSpecified", "String", "SecureString", "Int", - "Float", "Bool", "Array", "Object", and "SecureObject". + "Float", "Bool", "Array", "Object", "SecureObject", and "Int". :vartype type: str or ~azure.mgmt.web.v2023_01_01.models.ParameterType :ivar value: The value. :vartype value: JSON @@ -29460,7 +29460,7 @@ def __init__( ) -> None: """ :keyword type: The type. Known values are: "NotSpecified", "String", "SecureString", "Int", - "Float", "Bool", "Array", "Object", and "SecureObject". + "Float", "Bool", "Array", "Object", "SecureObject", and "Int". :paramtype type: str or ~azure.mgmt.web.v2023_01_01.models.ParameterType :keyword value: The value. :paramtype value: JSON @@ -29482,7 +29482,7 @@ class WorkflowOutputParameter(WorkflowParameter): Variables are only populated by the server, and will be ignored when sending a request. :ivar type: The type. Known values are: "NotSpecified", "String", "SecureString", "Int", - "Float", "Bool", "Array", "Object", and "SecureObject". + "Float", "Bool", "Array", "Object", "SecureObject", and "Int". :vartype type: str or ~azure.mgmt.web.v2023_01_01.models.ParameterType :ivar value: The value. :vartype value: JSON @@ -29517,7 +29517,7 @@ def __init__( ) -> None: """ :keyword type: The type. Known values are: "NotSpecified", "String", "SecureString", "Int", - "Float", "Bool", "Array", "Object", and "SecureObject". + "Float", "Bool", "Array", "Object", "SecureObject", and "Int". :paramtype type: str or ~azure.mgmt.web.v2023_01_01.models.ParameterType :keyword value: The value. :paramtype value: JSON diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/models/_web_site_management_client_enums.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/models/_web_site_management_client_enums.py index 20b2dd4a3efde..ae1fe1f046491 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/models/_web_site_management_client_enums.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/models/_web_site_management_client_enums.py @@ -669,12 +669,13 @@ class ParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NOT_SPECIFIED = "NotSpecified" STRING = "String" SECURE_STRING = "SecureString" - INT_ENUM = "Int" + INT = "Int" FLOAT = "Float" BOOL = "Bool" ARRAY = "Array" OBJECT = "Object" SECURE_OBJECT = "SecureObject" + INT_ENUM = "Int" class ProviderOsTypeSelected(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_app_service_certificate_orders_operations.py index 4fb9e9ffa5ae5..d79373cca96f5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -866,7 +867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -882,7 +882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1001,7 +1000,6 @@ def validate_purchase_information( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1075,7 +1072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1143,7 +1139,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1158,7 +1153,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1171,7 +1166,7 @@ def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1185,7 +1180,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1206,10 +1201,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1217,15 +1212,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1342,10 +1337,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1405,7 +1401,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1540,7 +1535,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1555,7 +1549,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1605,7 +1599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1621,7 +1614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1692,7 +1684,6 @@ def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1698,7 @@ def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1721,7 +1712,7 @@ def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1735,7 +1726,7 @@ def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1757,10 +1748,10 @@ def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1768,15 +1759,15 @@ def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1900,10 +1891,11 @@ def begin_create_or_update_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1966,7 +1958,6 @@ def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2109,7 +2100,6 @@ def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2124,7 +2114,7 @@ def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2246,7 +2236,6 @@ def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2379,7 +2368,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2435,7 +2423,6 @@ def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2569,7 +2556,6 @@ def resend_request_emails( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2718,7 +2704,6 @@ def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2733,7 +2718,7 @@ def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2778,7 +2763,6 @@ def verify_domain_ownership( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2834,7 +2818,6 @@ def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2849,7 +2832,7 @@ def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2894,7 +2877,6 @@ def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2909,7 +2891,7 @@ def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_app_service_environments_operations.py index 1f014013d15db..7f7dfa8769031 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1951,7 +1952,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1967,7 +1967,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2037,7 +2036,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2053,7 +2051,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2119,7 +2116,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2134,7 +2130,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2147,7 +2143,7 @@ def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2161,7 +2157,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2182,10 +2178,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2193,21 +2189,19 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2324,10 +2318,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2349,9 +2344,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2364,7 +2359,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -2375,10 +2370,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2386,12 +2381,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -2422,7 +2425,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -2432,6 +2435,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2570,7 +2574,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2585,14 +2588,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2638,7 +2634,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2654,7 +2649,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2720,7 +2714,6 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2735,7 +2728,7 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2748,7 +2741,7 @@ def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2762,7 +2755,7 @@ def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2783,10 +2776,10 @@ def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2794,15 +2787,15 @@ def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2931,7 +2924,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2947,13 +2939,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2990,6 +2981,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3055,7 +3047,6 @@ def get_ase_custom_dns_suffix_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3070,7 +3061,7 @@ def get_ase_custom_dns_suffix_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response) + deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3192,7 +3183,6 @@ def update_ase_custom_dns_suffix_configuration( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3207,7 +3197,7 @@ def update_ase_custom_dns_suffix_configuration( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response) + deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3252,7 +3242,6 @@ def delete_ase_custom_dns_suffix_configuration( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3267,11 +3256,7 @@ def delete_ase_custom_dns_suffix_configuration( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3316,7 +3301,6 @@ def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3331,7 +3315,7 @@ def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3453,7 +3437,6 @@ def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3468,7 +3451,7 @@ def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3513,7 +3496,6 @@ def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3528,7 +3510,7 @@ def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3576,7 +3558,6 @@ def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3591,7 +3572,7 @@ def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3642,7 +3623,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3658,7 +3638,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3729,7 +3708,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3745,7 +3723,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3811,7 +3788,6 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3826,7 +3802,7 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3839,7 +3815,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3853,7 +3829,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3874,10 +3850,10 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3885,15 +3861,15 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4004,10 +3980,11 @@ def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4143,7 +4120,6 @@ def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4158,11 +4134,7 @@ def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4217,7 +4189,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4233,7 +4204,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4306,7 +4276,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4322,7 +4291,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4393,7 +4361,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4409,7 +4376,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4477,7 +4443,6 @@ def test_upgrade_available_notification( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4495,9 +4460,7 @@ def test_upgrade_available_notification( # pylint: disable=inconsistent-return- if cls: return cls(pipeline_response, None, {}) # type: ignore - def _upgrade_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _upgrade_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4510,7 +4473,7 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_upgrade_request( resource_group_name=resource_group_name, @@ -4520,10 +4483,10 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4531,12 +4494,20 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -4561,7 +4532,7 @@ def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any) -> L lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._upgrade_initial( # type: ignore + raw_result = self._upgrade_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -4570,6 +4541,7 @@ def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any) -> L params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4630,7 +4602,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4646,7 +4617,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4712,7 +4682,6 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4727,7 +4696,7 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4778,7 +4747,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4794,7 +4762,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4867,7 +4834,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4883,7 +4849,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4954,7 +4919,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4969,7 +4933,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4983,7 +4947,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4997,7 +4961,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5019,10 +4983,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5030,15 +4994,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5163,10 +5127,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5190,7 +5157,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5203,7 +5170,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -5214,10 +5181,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5225,18 +5192,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5280,10 +5244,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5341,7 +5306,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5356,7 +5320,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5401,7 +5365,6 @@ def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5419,7 +5382,7 @@ def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5432,7 +5395,7 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -5442,10 +5405,10 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5453,15 +5416,15 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5510,7 +5473,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5526,13 +5488,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -5567,6 +5528,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5635,7 +5597,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5651,7 +5612,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5726,7 +5686,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5742,7 +5701,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5772,7 +5730,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5785,7 +5743,7 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -5795,10 +5753,10 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5806,15 +5764,15 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5863,7 +5821,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5879,13 +5836,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -5920,6 +5876,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5994,7 +5951,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6010,7 +5966,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6081,7 +6036,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6097,7 +6051,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6168,7 +6121,6 @@ def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6183,7 +6135,7 @@ def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6197,7 +6149,7 @@ def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6211,7 +6163,7 @@ def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6233,10 +6185,10 @@ def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6244,15 +6196,15 @@ def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6372,10 +6324,11 @@ def begin_create_or_update_worker_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6520,7 +6473,6 @@ def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6535,11 +6487,7 @@ def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6596,7 +6544,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6612,7 +6559,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6688,7 +6634,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6704,7 +6649,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6778,7 +6722,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6794,7 +6737,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6868,7 +6810,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6884,7 +6825,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_app_service_plans_operations.py index 612386edfcb51..ba9ec6784573e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1161,7 +1162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1243,7 +1242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1259,7 +1257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1328,7 +1325,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1343,7 +1339,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1356,7 +1352,7 @@ def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1370,7 +1366,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1391,10 +1387,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1402,15 +1398,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1520,10 +1516,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1583,7 +1580,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1715,7 +1711,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1730,11 +1725,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1777,7 +1768,6 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1792,7 +1782,7 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1843,7 +1833,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1858,7 +1847,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1909,7 +1898,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1971,7 +1959,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1986,7 +1973,7 @@ def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2040,7 +2027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2056,7 +2042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2124,7 +2109,6 @@ def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2139,7 +2123,7 @@ def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2187,7 +2171,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2203,7 +2186,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2277,7 +2259,6 @@ def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2355,7 +2336,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2371,7 +2351,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2437,7 +2416,6 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2452,7 +2430,7 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2505,7 +2483,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2521,7 +2498,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2587,7 +2563,6 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2602,7 +2577,7 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2653,7 +2628,6 @@ def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2668,7 +2642,7 @@ def get_vnet_from_server_farm( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2719,7 +2693,6 @@ def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2734,7 +2707,7 @@ def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2874,7 +2847,6 @@ def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2889,7 +2861,7 @@ def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2938,7 +2910,6 @@ def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2953,7 +2924,7 @@ def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3007,7 +2978,6 @@ def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3022,7 +2992,7 @@ def get_route_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3169,7 +3139,6 @@ def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3184,7 +3153,7 @@ def create_or_update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3238,7 +3207,6 @@ def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3396,7 +3364,6 @@ def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3411,7 +3378,7 @@ def update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3459,7 +3426,6 @@ def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_certificate_orders_diagnostics_operations.py index e16efd669dc2f..cf0aaee789ca6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -195,7 +194,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -211,7 +209,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -300,7 +297,6 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +311,7 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_certificate_registration_provider_operations.py index 04a3250ab3ec9..a36c45ffce793 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_certificate_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_certificates_operations.py index a641d24bdf069..baa5be18dae54 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_certificates_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -312,7 +311,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +326,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -394,7 +391,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -410,7 +406,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -476,7 +471,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -491,7 +485,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -611,7 +605,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -626,7 +619,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -671,7 +664,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -803,7 +795,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -818,7 +809,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_container_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_container_apps_operations.py index 4172ff3c11633..c34384855c3d1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_container_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_container_apps_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -296,7 +297,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -312,7 +312,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -378,7 +377,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +392,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -463,7 +460,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Con headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -478,7 +474,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Con error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -491,7 +487,7 @@ def _create_or_update_initial( name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> _models.ContainerApp: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -505,7 +501,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -526,10 +522,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -537,15 +533,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -654,10 +650,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -679,9 +676,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -694,7 +689,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -704,10 +699,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -715,12 +710,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -745,7 +748,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -754,6 +757,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -808,7 +812,6 @@ def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollection: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -823,7 +826,7 @@ def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollection: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecretsCollection", pipeline_response) + deserialized = self._deserialize("SecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_container_apps_revisions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_container_apps_revisions_operations.py index f39874118913b..9f53443089aae 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_container_apps_revisions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_container_apps_revisions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -296,7 +295,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -312,7 +310,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -383,7 +380,6 @@ def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -398,7 +394,7 @@ def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -446,7 +442,6 @@ def activate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -505,7 +500,6 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -564,7 +558,6 @@ def restart_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_deleted_web_apps_operations.py index 805c053e90faf..f545740cde253 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_deleted_web_apps_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -176,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -192,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -342,7 +337,6 @@ def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +351,7 @@ def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_diagnostics_operations.py index 1e1a7b27d841a..9c2efe83f787b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1101,7 +1100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1117,7 +1115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1204,7 +1201,6 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1219,7 +1215,7 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1267,7 +1263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1283,7 +1278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1370,7 +1364,6 @@ def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1385,7 +1378,7 @@ def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1433,7 +1426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1449,7 +1441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1520,7 +1511,6 @@ def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1535,7 +1525,7 @@ def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1602,7 +1591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1676,7 +1664,6 @@ def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1678,7 @@ def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1759,7 +1746,6 @@ def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,7 +1760,7 @@ def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1827,7 +1813,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1843,7 +1828,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1917,7 +1901,6 @@ def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1932,7 +1915,7 @@ def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2000,7 +1983,6 @@ def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2015,7 +1997,7 @@ def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2066,7 +2048,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2082,7 +2063,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2173,7 +2153,6 @@ def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2188,7 +2167,7 @@ def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2239,7 +2218,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2255,7 +2233,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2329,7 +2306,6 @@ def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2344,7 +2320,7 @@ def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2398,7 +2374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2414,7 +2389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2497,7 +2471,6 @@ def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2512,7 +2485,7 @@ def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2584,7 +2557,6 @@ def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2599,7 +2571,7 @@ def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2655,7 +2627,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2671,7 +2642,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2754,7 +2724,6 @@ def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2769,7 +2738,7 @@ def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2841,7 +2810,6 @@ def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2856,7 +2824,7 @@ def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_domain_registration_provider_operations.py index 29e3eee17bae3..652375ad5c4b8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_domain_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_domains_operations.py index b7d6a88e0e5c2..cca1c014c971d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -732,7 +733,6 @@ def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +747,7 @@ def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +787,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -803,7 +802,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -863,7 +861,6 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -878,7 +875,7 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -975,7 +972,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -991,7 +987,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1057,7 +1052,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1073,7 +1067,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1139,7 +1132,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1154,7 +1146,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1163,7 +1155,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1177,7 +1169,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1198,10 +1190,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1209,15 +1201,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1320,10 +1312,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1388,7 +1381,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1519,7 +1511,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1534,11 +1525,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1588,7 +1575,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1604,7 +1590,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1675,7 +1660,6 @@ def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1690,7 +1674,7 @@ def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1829,7 +1813,6 @@ def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1844,7 +1827,7 @@ def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1892,7 +1875,6 @@ def delete_ownership_identifier( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2042,7 +2024,6 @@ def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2057,7 +2038,7 @@ def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2102,7 +2083,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2160,7 +2140,6 @@ def transfer_out(self, resource_group_name: str, domain_name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2175,7 +2154,7 @@ def transfer_out(self, resource_group_name: str, domain_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_get_usages_in_location_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_get_usages_in_location_operations.py index df56acc456831..39f61e82436b1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_get_usages_in_location_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_get_usages_in_location_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -125,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -141,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_global_operations_operations.py index c5620b654bca7..c1d0c94dfd63d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_global_operations_operations.py @@ -18,15 +18,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -194,7 +192,7 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -234,7 +232,6 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -249,7 +246,7 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -294,7 +291,6 @@ def get_subscription_operation_with_async_response( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_kube_environments_operations.py index 0f7f011477e12..3e6ea28114778 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_kube_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_kube_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -308,7 +309,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -324,7 +324,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -390,7 +389,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -406,7 +404,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -472,7 +469,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Kub headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +483,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Kub error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -500,7 +496,7 @@ def _create_or_update_initial( name: str, kube_environment_envelope: Union[_models.KubeEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.KubeEnvironment: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -514,7 +510,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KubeEnvironment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -535,10 +531,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -546,15 +542,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -667,10 +663,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -692,9 +689,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -707,7 +702,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -717,10 +712,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -728,12 +723,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -758,7 +761,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -767,6 +770,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -905,7 +909,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -920,11 +923,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_provider_operations.py index 3da9f8a6d53a0..99003438979eb 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -276,7 +275,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -292,7 +290,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -360,7 +357,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -376,7 +372,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -447,7 +442,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -463,7 +457,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -534,7 +527,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -550,7 +542,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -616,7 +607,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -632,7 +622,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -700,7 +689,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -716,7 +704,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -787,7 +774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -803,7 +789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_recommendations_operations.py index 4a0547006cd1b..e0b5e7f1678be 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_recommendations_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -730,7 +729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -746,7 +744,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -806,7 +803,6 @@ def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -860,7 +856,6 @@ def disable_recommendation_for_subscription( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -934,7 +929,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -950,7 +944,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1035,7 +1028,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1051,7 +1043,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1122,7 +1113,6 @@ def disable_all_for_hosting_environment( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1181,7 +1171,6 @@ def reset_all_filters_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1254,7 +1243,6 @@ def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1269,7 +1257,7 @@ def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1320,7 +1308,6 @@ def disable_recommendation_for_hosting_environment( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1394,7 +1381,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1410,7 +1396,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1495,7 +1480,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1511,7 +1495,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1579,7 +1562,6 @@ def disable_all_for_web_app( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1635,7 +1617,6 @@ def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1708,7 +1689,6 @@ def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1723,7 +1703,7 @@ def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1771,7 +1751,6 @@ def disable_recommendation_for_site( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_resource_health_metadata_operations.py index fb060b5c62a69..5aa567d18b8db 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_resource_health_metadata_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -390,7 +387,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -406,7 +402,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -479,7 +474,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -495,7 +489,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -561,7 +554,6 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -576,7 +568,7 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -630,7 +622,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -646,7 +637,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -718,7 +708,6 @@ def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -733,7 +722,7 @@ def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_static_sites_operations.py index 63de61180f415..be4f126fe8fa5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -3256,7 +3257,6 @@ def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3271,7 +3271,7 @@ def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3312,7 +3312,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3328,7 +3327,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3397,7 +3395,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3413,7 +3410,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3479,7 +3475,6 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3494,7 +3489,7 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3507,7 +3502,7 @@ def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3521,7 +3516,7 @@ def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3542,10 +3537,10 @@ def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3553,15 +3548,15 @@ def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3677,10 +3672,11 @@ def begin_create_or_update_static_site( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3702,9 +3698,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3717,7 +3711,7 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -3727,10 +3721,10 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3738,12 +3732,20 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -3768,7 +3770,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_initial( # type: ignore + raw_result = self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -3777,6 +3779,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3917,7 +3920,6 @@ def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3932,11 +3934,7 @@ def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3989,7 +3987,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4005,7 +4002,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4079,7 +4075,6 @@ def delete_static_site_user( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4233,7 +4228,6 @@ def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4248,7 +4242,7 @@ def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4298,7 +4292,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4314,7 +4307,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4385,7 +4377,6 @@ def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4400,16 +4391,16 @@ def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4422,7 +4413,7 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -4433,10 +4424,10 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4444,12 +4435,20 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_build( @@ -4478,7 +4477,7 @@ def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_build_initial( # type: ignore + raw_result = self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -4488,6 +4487,7 @@ def begin_delete_static_site_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4634,7 +4634,6 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4649,7 +4648,7 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4781,7 +4780,6 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4796,7 +4794,7 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4847,7 +4845,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4863,7 +4860,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4937,7 +4933,6 @@ def get_build_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4952,7 +4947,7 @@ def get_build_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5096,7 +5091,6 @@ def create_or_update_build_database_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5111,7 +5105,7 @@ def create_or_update_build_database_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5162,7 +5156,6 @@ def delete_build_database_connection( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5318,7 +5311,6 @@ def update_build_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5333,7 +5325,7 @@ def update_build_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5384,7 +5376,6 @@ def get_build_database_connection_with_details( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5399,7 +5390,7 @@ def get_build_database_connection_with_details( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5452,7 +5443,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5468,7 +5458,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5539,7 +5528,6 @@ def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5554,7 +5542,7 @@ def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5602,7 +5590,6 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5617,7 +5604,7 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5668,7 +5655,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5684,7 +5670,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5761,7 +5746,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5777,7 +5761,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5853,7 +5836,6 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5868,7 +5850,9 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5886,7 +5870,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5900,7 +5884,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5926,10 +5910,10 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5937,15 +5921,15 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6104,10 +6088,13 @@ def begin_register_user_provided_function_app_with_static_site_build( # pylint: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6174,7 +6161,6 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6192,14 +6178,14 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6213,7 +6199,7 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6235,10 +6221,10 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6246,12 +6232,20 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -6356,7 +6350,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -6368,6 +6362,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -6504,7 +6499,6 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6519,7 +6513,7 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6569,7 +6563,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6585,7 +6578,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6656,7 +6648,6 @@ def get_basic_auth( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6671,7 +6662,7 @@ def get_basic_auth( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6803,7 +6794,6 @@ def create_or_update_basic_auth( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6818,7 +6808,7 @@ def create_or_update_basic_auth( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6940,7 +6930,6 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6955,7 +6944,7 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7079,7 +7068,6 @@ def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7094,7 +7082,7 @@ def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7144,7 +7132,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7160,7 +7147,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7231,7 +7217,6 @@ def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7246,7 +7231,7 @@ def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7262,7 +7247,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7276,7 +7261,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7301,10 +7286,10 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7312,15 +7297,15 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7454,10 +7439,13 @@ def begin_create_or_update_static_site_custom_domain( # pylint: disable=name-to params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7479,9 +7467,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7494,7 +7482,7 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -7505,10 +7493,10 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7516,12 +7504,20 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_custom_domain( @@ -7550,7 +7546,7 @@ def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -7560,6 +7556,7 @@ def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7581,7 +7578,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -7590,7 +7587,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7604,7 +7601,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7629,10 +7626,10 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7640,12 +7637,20 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -7753,7 +7758,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -7765,6 +7770,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7827,7 +7833,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7843,7 +7848,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7914,7 +7918,6 @@ def get_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7929,7 +7932,7 @@ def get_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8063,7 +8066,6 @@ def create_or_update_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8078,7 +8080,7 @@ def create_or_update_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8126,7 +8128,6 @@ def delete_database_connection( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8272,7 +8273,6 @@ def update_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8287,7 +8287,7 @@ def update_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8335,7 +8335,6 @@ def get_database_connection_with_details( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8350,16 +8349,14 @@ def get_database_connection_with_details( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _detach_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8372,7 +8369,7 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -8382,10 +8379,10 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8393,12 +8390,20 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -8423,7 +8428,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._detach_static_site_initial( # type: ignore + raw_result = self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -8432,6 +8437,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -8496,7 +8502,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8512,7 +8517,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8580,7 +8584,6 @@ def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8595,7 +8598,7 @@ def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8640,7 +8643,6 @@ def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8655,7 +8657,7 @@ def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8700,7 +8702,6 @@ def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8715,7 +8716,7 @@ def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8758,7 +8759,6 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8773,7 +8773,7 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8823,7 +8823,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8839,7 +8838,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8910,7 +8908,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8925,7 +8922,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8939,7 +8936,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8953,7 +8950,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -8975,10 +8972,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8986,15 +8983,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9119,10 +9116,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9146,7 +9146,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9159,7 +9159,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -9170,10 +9170,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9181,18 +9181,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9236,10 +9233,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9297,7 +9295,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9312,7 +9309,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9434,7 +9431,6 @@ def reset_static_site_api_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9493,7 +9489,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9509,7 +9504,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9583,7 +9577,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9599,7 +9592,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9671,7 +9663,6 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9686,7 +9677,9 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9703,7 +9696,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9717,7 +9710,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -9742,10 +9735,10 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9753,15 +9746,15 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9907,10 +9900,13 @@ def begin_register_user_provided_function_app_with_static_site( # pylint: disab params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9973,7 +9969,6 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9991,13 +9986,13 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10011,7 +10006,7 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10032,10 +10027,10 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10043,12 +10038,20 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -10144,7 +10147,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -10155,6 +10158,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -10176,14 +10180,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_backend_initial( # pylint: disable=inconsistent-return-statements + def _validate_backend_initial( self, resource_group_name: str, name: str, linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10197,7 +10201,7 @@ def _validate_backend_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10219,10 +10223,10 @@ def _validate_backend_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10230,12 +10234,20 @@ def _validate_backend_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_backend( @@ -10339,7 +10351,7 @@ def begin_validate_backend( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_backend_initial( # type: ignore + raw_result = self._validate_backend_initial( resource_group_name=resource_group_name, name=name, linked_backend_name=linked_backend_name, @@ -10351,6 +10363,7 @@ def begin_validate_backend( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -10372,7 +10385,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return-statements + def _validate_backend_for_build_initial( self, resource_group_name: str, name: str, @@ -10380,7 +10393,7 @@ def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return- linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10394,7 +10407,7 @@ def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10417,10 +10430,10 @@ def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10428,12 +10441,20 @@ def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_backend_for_build( @@ -10546,7 +10567,7 @@ def begin_validate_backend_for_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_backend_for_build_initial( # type: ignore + raw_result = self._validate_backend_for_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -10559,6 +10580,7 @@ def begin_validate_backend_for_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -10623,7 +10645,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10639,7 +10660,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10715,7 +10735,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10731,7 +10750,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10802,7 +10820,6 @@ def get_linked_backend( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10817,7 +10834,7 @@ def get_linked_backend( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10831,7 +10848,7 @@ def _link_backend_initial( linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteLinkedBackendARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10845,7 +10862,7 @@ def _link_backend_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteLinkedBackendARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10867,10 +10884,10 @@ def _link_backend_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10878,11 +10895,15 @@ def _link_backend_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11009,10 +11030,11 @@ def begin_link_backend( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11084,7 +11106,6 @@ def unlink_backend( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11146,7 +11167,6 @@ def get_linked_backend_for_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11161,7 +11181,7 @@ def get_linked_backend_for_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11176,7 +11196,7 @@ def _link_backend_to_build_initial( linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteLinkedBackendARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11190,7 +11210,7 @@ def _link_backend_to_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteLinkedBackendARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11213,10 +11233,10 @@ def _link_backend_to_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11224,11 +11244,15 @@ def _link_backend_to_build_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11365,10 +11389,11 @@ def begin_link_backend_to_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11444,7 +11469,6 @@ def unlink_backend_from_build( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_top_level_domains_operations.py index ac43ced692389..0d9a43f905f52 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_top_level_domains_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_web_apps_operations.py index 8e3ffca519a11..18564e7340563 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_web_apps_operations.py @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -16607,7 +16608,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16623,7 +16623,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16696,7 +16695,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16712,7 +16710,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16781,7 +16778,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16796,7 +16792,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16805,7 +16801,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16819,7 +16815,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16840,10 +16836,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16851,15 +16847,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16971,10 +16967,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -17049,7 +17046,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17189,7 +17185,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17204,11 +17199,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17256,7 +17247,6 @@ def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17271,7 +17261,7 @@ def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17391,7 +17381,6 @@ def apply_slot_config_to_production( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17520,7 +17509,6 @@ def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17535,7 +17523,7 @@ def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17581,7 +17569,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17597,7 +17584,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17668,7 +17654,6 @@ def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17683,7 +17668,7 @@ def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17734,7 +17719,6 @@ def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17887,7 +17871,6 @@ def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17902,21 +17885,21 @@ def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_initial( # pylint: disable=inconsistent-return-statements + def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17930,7 +17913,7 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17952,10 +17935,10 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17963,12 +17946,20 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore( @@ -18068,7 +18059,7 @@ def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_initial( # type: ignore + raw_result = self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -18080,6 +18071,7 @@ def begin_restore( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -18145,7 +18137,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18161,7 +18152,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18229,7 +18219,6 @@ def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18244,7 +18233,7 @@ def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18368,7 +18357,6 @@ def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18383,7 +18371,7 @@ def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18428,7 +18416,6 @@ def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18443,7 +18430,7 @@ def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18567,7 +18554,6 @@ def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18582,7 +18568,7 @@ def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18630,7 +18616,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18646,7 +18631,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18789,7 +18773,6 @@ def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18804,7 +18787,7 @@ def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18847,7 +18830,6 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18862,7 +18844,7 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18982,7 +18964,6 @@ def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18997,7 +18978,7 @@ def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19040,7 +19021,6 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19055,7 +19035,7 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19100,7 +19080,6 @@ def get_auth_settings_v2_without_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19115,7 +19094,7 @@ def get_auth_settings_v2_without_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19238,7 +19217,6 @@ def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19253,7 +19231,7 @@ def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19296,7 +19274,6 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19311,7 +19288,7 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19433,7 +19410,6 @@ def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19448,7 +19424,7 @@ def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19493,7 +19469,6 @@ def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19508,7 +19483,7 @@ def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19624,7 +19599,6 @@ def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19639,7 +19613,7 @@ def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19684,7 +19658,6 @@ def delete_backup_configuration( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19738,7 +19711,6 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19753,7 +19725,7 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19801,7 +19773,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19817,7 +19788,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19888,7 +19858,6 @@ def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19903,7 +19872,7 @@ def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19951,7 +19920,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19967,7 +19935,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20038,7 +20005,6 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20053,7 +20019,7 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20176,7 +20142,6 @@ def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20191,7 +20156,7 @@ def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20236,7 +20201,6 @@ def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20251,7 +20215,7 @@ def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20296,7 +20260,6 @@ def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20311,7 +20274,7 @@ def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20434,7 +20397,6 @@ def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20449,7 +20411,7 @@ def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20565,7 +20527,6 @@ def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20580,7 +20541,7 @@ def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20623,7 +20584,6 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20638,14 +20598,16 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _list_publishing_credentials_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.User: + def _list_publishing_credentials_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20658,7 +20620,7 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -20668,10 +20630,10 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -20679,11 +20641,15 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20724,10 +20690,11 @@ def begin_list_publishing_credentials( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20858,7 +20825,6 @@ def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20873,7 +20839,7 @@ def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20916,7 +20882,6 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20931,7 +20896,7 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20977,7 +20942,6 @@ def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20992,7 +20956,7 @@ def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21121,7 +21085,6 @@ def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21136,7 +21099,7 @@ def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21181,7 +21144,6 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21196,7 +21158,7 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21316,7 +21278,6 @@ def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21331,7 +21292,7 @@ def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21451,7 +21412,6 @@ def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21466,7 +21426,7 @@ def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21518,7 +21478,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21534,7 +21493,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21605,7 +21563,6 @@ def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21620,7 +21577,7 @@ def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21668,7 +21625,6 @@ def recover_site_configuration_snapshot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21724,9 +21680,9 @@ def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21735,12 +21691,16 @@ def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21783,9 +21743,9 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21794,12 +21754,16 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21847,7 +21811,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21863,7 +21826,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21937,7 +21899,6 @@ def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21952,7 +21913,7 @@ def get_continuous_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22000,7 +21961,6 @@ def delete_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22062,7 +22022,6 @@ def start_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22124,7 +22083,6 @@ def stop_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22183,7 +22141,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22199,7 +22156,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22231,7 +22187,7 @@ def get_next(next_link=None): def _get_production_site_deployment_status_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, deployment_status_id: str, **kwargs: Any - ) -> _models.CsmDeploymentStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22244,7 +22200,7 @@ def _get_production_site_deployment_status_initial( # pylint: disable=name-too- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.CsmDeploymentStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_get_production_site_deployment_status_request( resource_group_name=resource_group_name, @@ -22255,10 +22211,10 @@ def _get_production_site_deployment_status_initial( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22266,15 +22222,15 @@ def _get_production_site_deployment_status_initial( # pylint: disable=name-too- response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22319,10 +22275,11 @@ def begin_get_production_site_deployment_status( # pylint: disable=name-too-lon params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22383,7 +22340,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22399,7 +22355,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22468,7 +22423,6 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22483,7 +22437,7 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22613,7 +22567,6 @@ def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22628,7 +22581,7 @@ def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22676,7 +22629,6 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22734,7 +22686,6 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22749,7 +22700,7 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22873,7 +22824,6 @@ def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22888,7 +22838,7 @@ def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22936,7 +22886,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22952,7 +22901,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23023,7 +22971,6 @@ def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23038,7 +22985,7 @@ def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23173,7 +23120,6 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23188,7 +23134,7 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23236,7 +23182,6 @@ def delete_domain_ownership_identifier( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23382,7 +23327,6 @@ def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23397,7 +23341,7 @@ def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23440,7 +23384,6 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23455,7 +23398,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23464,7 +23407,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23481,7 +23424,7 @@ def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23502,10 +23445,10 @@ def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23513,11 +23456,15 @@ def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23623,10 +23570,11 @@ def begin_create_ms_deploy_operation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23687,7 +23635,6 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23702,7 +23649,7 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23746,7 +23693,6 @@ def get_one_deploy_status(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23761,7 +23707,7 @@ def get_one_deploy_status(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23804,7 +23750,6 @@ def create_one_deploy_operation(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23819,7 +23764,7 @@ def create_one_deploy_operation(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23870,7 +23815,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23886,7 +23830,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23952,7 +23895,6 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23967,7 +23909,7 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24018,7 +23960,6 @@ def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24033,7 +23974,7 @@ def get_function( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24047,7 +23988,7 @@ def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24061,7 +24002,7 @@ def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24083,10 +24024,10 @@ def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24094,11 +24035,15 @@ def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24218,10 +24163,11 @@ def begin_create_function( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24287,7 +24233,6 @@ def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24438,7 +24383,6 @@ def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24453,11 +24397,7 @@ def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24511,7 +24451,6 @@ def delete_function_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24570,7 +24509,6 @@ def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24585,7 +24523,7 @@ def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24633,7 +24571,6 @@ def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24648,7 +24585,7 @@ def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24691,7 +24628,6 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24706,7 +24642,7 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24751,7 +24687,6 @@ def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24807,7 +24742,6 @@ def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24958,7 +24892,6 @@ def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24973,11 +24906,7 @@ def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25031,7 +24960,6 @@ def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25090,7 +25018,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25106,7 +25033,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25177,7 +25103,6 @@ def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25192,7 +25117,7 @@ def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25324,7 +25249,6 @@ def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25339,7 +25263,7 @@ def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25387,7 +25311,6 @@ def delete_host_name_binding( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25449,7 +25372,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25464,7 +25386,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25604,7 +25526,6 @@ def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25619,7 +25540,7 @@ def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25673,7 +25594,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25824,7 +25744,6 @@ def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25839,7 +25758,7 @@ def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25882,7 +25801,6 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25897,7 +25815,7 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25943,7 +25861,6 @@ def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25958,7 +25875,7 @@ def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26006,7 +25923,6 @@ def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26021,7 +25937,7 @@ def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26155,7 +26071,6 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26170,7 +26085,7 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26221,7 +26136,6 @@ def delete_relay_service_connection( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26366,7 +26280,6 @@ def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26381,7 +26294,7 @@ def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26430,7 +26343,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26446,7 +26358,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26517,7 +26428,6 @@ def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26532,7 +26442,7 @@ def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26580,7 +26490,6 @@ def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26595,7 +26504,7 @@ def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26609,7 +26518,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26626,7 +26535,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26648,10 +26557,10 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26659,11 +26568,15 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26783,10 +26696,11 @@ def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26852,7 +26766,6 @@ def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26867,7 +26780,7 @@ def get_instance_ms_deploy_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26924,7 +26837,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26940,7 +26852,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27019,7 +26930,6 @@ def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27034,7 +26944,7 @@ def get_instance_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27091,7 +27001,6 @@ def delete_instance_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27158,9 +27067,9 @@ def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27169,11 +27078,15 @@ def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27233,7 +27146,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27249,7 +27161,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27331,7 +27242,6 @@ def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27346,7 +27256,7 @@ def get_instance_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27405,7 +27315,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27421,7 +27330,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27487,7 +27395,6 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27502,7 +27409,7 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27548,7 +27455,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27564,7 +27470,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27632,7 +27537,6 @@ def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27647,7 +27551,7 @@ def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27661,7 +27565,7 @@ def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27675,7 +27579,7 @@ def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -27697,10 +27601,10 @@ def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27708,11 +27612,15 @@ def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27836,10 +27744,11 @@ def begin_migrate_storage( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27867,7 +27776,7 @@ def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27881,7 +27790,7 @@ def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -27902,10 +27811,10 @@ def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27913,11 +27822,15 @@ def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28025,10 +27938,11 @@ def begin_migrate_my_sql( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28090,7 +28004,6 @@ def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28105,7 +28018,7 @@ def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28150,7 +28063,6 @@ def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28165,7 +28077,7 @@ def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28305,7 +28217,6 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28320,7 +28231,7 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28368,7 +28279,6 @@ def delete_swift_virtual_network( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28519,7 +28429,6 @@ def update_swift_virtual_network_connection_with_check( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28534,7 +28443,7 @@ def update_swift_virtual_network_connection_with_check( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28585,7 +28494,6 @@ def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28600,7 +28508,7 @@ def list_network_features( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28649,7 +28557,6 @@ def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28664,11 +28571,7 @@ def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28728,7 +28631,6 @@ def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28743,7 +28645,7 @@ def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28758,7 +28660,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28771,7 +28673,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -28784,10 +28686,10 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28795,15 +28697,15 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28860,10 +28762,11 @@ def begin_start_web_site_network_trace_operation( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28923,7 +28826,6 @@ def stop_web_site_network_trace( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28983,7 +28885,6 @@ def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28998,7 +28899,7 @@ def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29047,7 +28948,6 @@ def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29062,11 +28962,7 @@ def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29115,7 +29011,6 @@ def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29130,7 +29025,7 @@ def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29176,7 +29071,6 @@ def generate_new_site_publishing_password( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29240,7 +29134,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29256,7 +29149,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29324,7 +29216,6 @@ def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29339,7 +29230,7 @@ def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29382,7 +29273,6 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29397,7 +29287,7 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29445,7 +29335,6 @@ def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29460,7 +29349,7 @@ def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29590,7 +29479,6 @@ def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29605,7 +29493,7 @@ def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29653,7 +29541,6 @@ def delete_premier_add_on( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29794,7 +29681,6 @@ def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29809,7 +29695,7 @@ def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29854,7 +29740,6 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29869,7 +29754,7 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29991,7 +29876,6 @@ def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30006,7 +29890,7 @@ def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30056,7 +29940,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30072,7 +29955,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30143,7 +30025,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30158,7 +30039,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30172,7 +30053,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30186,7 +30067,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30208,10 +30089,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30219,15 +30100,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30352,10 +30233,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30379,7 +30263,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30392,7 +30276,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -30403,10 +30287,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30414,18 +30298,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30469,10 +30350,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30530,7 +30412,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30545,7 +30426,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30596,7 +30477,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30612,7 +30492,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30685,7 +30564,6 @@ def get_process(self, resource_group_name: str, name: str, process_id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30700,7 +30578,7 @@ def get_process(self, resource_group_name: str, name: str, process_id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30753,7 +30631,6 @@ def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30814,9 +30691,9 @@ def get_process_dump(self, resource_group_name: str, name: str, process_id: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30825,11 +30702,15 @@ def get_process_dump(self, resource_group_name: str, name: str, process_id: str, response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30885,7 +30766,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30901,7 +30781,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30979,7 +30858,6 @@ def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30994,7 +30872,7 @@ def get_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31049,7 +30927,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31065,7 +30942,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31136,7 +31012,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31152,7 +31027,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31223,7 +31097,6 @@ def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31238,7 +31111,7 @@ def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31370,7 +31243,6 @@ def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31385,7 +31257,7 @@ def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31433,7 +31305,6 @@ def delete_public_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31569,9 +31440,9 @@ def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -31580,11 +31451,15 @@ def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31631,7 +31506,6 @@ def reset_production_slot_config( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31701,7 +31575,6 @@ def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31719,9 +31592,9 @@ def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31735,7 +31608,7 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31756,10 +31629,10 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31767,12 +31640,20 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob( @@ -31859,7 +31740,7 @@ def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_initial( # type: ignore + raw_result = self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -31870,6 +31751,7 @@ def begin_restore_from_backup_blob( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -31891,13 +31773,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31911,7 +31793,7 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -31932,10 +31814,10 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -31943,12 +31825,20 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app( @@ -32039,7 +31929,7 @@ def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_initial( # type: ignore + raw_result = self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -32050,6 +31940,7 @@ def begin_restore_from_deleted_app( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32071,13 +31962,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32091,7 +31982,7 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32112,10 +32003,10 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32123,12 +32014,20 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot( @@ -32222,7 +32121,7 @@ def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_initial( # type: ignore + raw_result = self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -32233,6 +32132,7 @@ def begin_restore_snapshot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32298,7 +32198,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32314,7 +32213,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32388,7 +32286,6 @@ def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32403,7 +32300,7 @@ def get_site_extension( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32412,7 +32309,7 @@ def get_site_extension( def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32429,7 +32326,7 @@ def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -32440,10 +32337,10 @@ def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32451,15 +32348,15 @@ def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32504,10 +32401,11 @@ def begin_install_site_extension( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -32573,7 +32471,6 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32630,7 +32527,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32646,7 +32542,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32719,7 +32614,6 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32734,7 +32628,7 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32748,7 +32642,7 @@ def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32762,7 +32656,7 @@ def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32784,10 +32678,10 @@ def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32795,15 +32689,15 @@ def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32932,10 +32826,11 @@ def begin_create_or_update_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33015,7 +32910,6 @@ def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33168,7 +33062,6 @@ def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33183,11 +33076,7 @@ def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33239,7 +33128,6 @@ def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33254,7 +33142,7 @@ def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33387,7 +33275,6 @@ def apply_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33533,7 +33420,6 @@ def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33548,7 +33434,7 @@ def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33600,7 +33486,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33616,7 +33501,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33691,7 +33575,6 @@ def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33706,7 +33589,7 @@ def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33761,7 +33644,6 @@ def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33927,7 +33809,6 @@ def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33942,14 +33823,14 @@ def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -33957,7 +33838,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33971,7 +33852,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33994,10 +33875,10 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34005,12 +33886,20 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_slot( @@ -34122,7 +34011,7 @@ def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_slot_initial( # type: ignore + raw_result = self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -34135,6 +34024,7 @@ def begin_restore_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -34203,7 +34093,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34219,7 +34108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34290,7 +34178,6 @@ def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34305,7 +34192,7 @@ def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34439,7 +34326,6 @@ def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34454,7 +34340,7 @@ def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34502,7 +34388,6 @@ def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34517,7 +34402,7 @@ def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34651,7 +34536,6 @@ def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34666,7 +34550,7 @@ def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34718,7 +34602,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34734,7 +34617,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34890,7 +34772,6 @@ def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34905,7 +34786,7 @@ def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34954,7 +34835,6 @@ def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34969,7 +34849,7 @@ def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35102,7 +34982,6 @@ def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35117,7 +34996,7 @@ def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35166,7 +35045,6 @@ def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35181,7 +35059,7 @@ def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35230,7 +35108,6 @@ def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35245,7 +35122,7 @@ def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35381,7 +35258,6 @@ def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35396,7 +35272,7 @@ def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35445,7 +35321,6 @@ def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35460,7 +35335,7 @@ def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35595,7 +35470,6 @@ def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35610,7 +35484,7 @@ def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35659,7 +35533,6 @@ def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35674,7 +35547,7 @@ def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35807,7 +35680,6 @@ def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35822,7 +35694,7 @@ def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35871,7 +35743,6 @@ def delete_backup_configuration_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35931,7 +35802,6 @@ def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35946,7 +35816,7 @@ def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35997,7 +35867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36013,7 +35882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36087,7 +35955,6 @@ def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36102,7 +35969,7 @@ def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36153,7 +36020,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36169,7 +36035,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36243,7 +36108,6 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36258,7 +36122,7 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36394,7 +36258,6 @@ def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36409,7 +36272,7 @@ def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36458,7 +36321,6 @@ def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36473,7 +36335,7 @@ def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36522,7 +36384,6 @@ def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36537,7 +36398,7 @@ def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36673,7 +36534,6 @@ def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36688,7 +36548,7 @@ def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36821,7 +36681,6 @@ def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36836,7 +36695,7 @@ def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36885,7 +36744,6 @@ def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36900,7 +36758,7 @@ def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36909,7 +36767,7 @@ def list_metadata_slot( def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36922,7 +36780,7 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -36933,10 +36791,10 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -36944,11 +36802,15 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36993,10 +36855,11 @@ def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -37144,7 +37007,6 @@ def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37159,7 +37021,7 @@ def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37208,7 +37070,6 @@ def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37223,7 +37084,7 @@ def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37274,7 +37135,6 @@ def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37289,7 +37149,7 @@ def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37422,7 +37282,6 @@ def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37437,7 +37296,7 @@ def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37570,7 +37429,6 @@ def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37585,7 +37443,7 @@ def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37641,7 +37499,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37657,7 +37514,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37732,7 +37588,6 @@ def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37747,7 +37602,7 @@ def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37799,7 +37654,6 @@ def recover_site_configuration_snapshot_slot( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37859,9 +37713,9 @@ def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -37870,12 +37724,16 @@ def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37924,9 +37782,9 @@ def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -37935,12 +37793,16 @@ def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37992,7 +37854,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38008,7 +37869,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38086,7 +37946,6 @@ def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38101,7 +37960,7 @@ def get_continuous_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38153,7 +38012,6 @@ def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38219,7 +38077,6 @@ def start_continuous_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38285,7 +38142,6 @@ def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38348,7 +38204,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38364,7 +38219,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38396,7 +38250,7 @@ def get_next(next_link=None): def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, deployment_status_id: str, **kwargs: Any - ) -> _models.CsmDeploymentStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -38409,7 +38263,7 @@ def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-l _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.CsmDeploymentStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_get_slot_site_deployment_status_slot_request( resource_group_name=resource_group_name, @@ -38421,10 +38275,10 @@ def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -38432,15 +38286,15 @@ def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38489,10 +38343,11 @@ def begin_get_slot_site_deployment_status_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -38559,7 +38414,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38575,7 +38429,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38650,7 +38503,6 @@ def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38665,7 +38517,7 @@ def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38808,7 +38660,6 @@ def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38823,7 +38674,7 @@ def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38875,7 +38726,6 @@ def delete_deployment_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38939,7 +38789,6 @@ def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38954,7 +38803,7 @@ def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39095,7 +38944,6 @@ def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39110,7 +38958,7 @@ def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39162,7 +39010,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39178,7 +39025,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39253,7 +39099,6 @@ def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39268,7 +39113,7 @@ def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39416,7 +39261,6 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39431,7 +39275,7 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39483,7 +39327,6 @@ def delete_domain_ownership_identifier_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39642,7 +39485,6 @@ def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39657,7 +39499,7 @@ def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39706,7 +39548,6 @@ def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39721,7 +39562,7 @@ def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39735,7 +39576,7 @@ def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -39752,7 +39593,7 @@ def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -39774,10 +39615,10 @@ def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -39785,11 +39626,15 @@ def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39912,10 +39757,11 @@ def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -39982,7 +39828,6 @@ def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39997,7 +39842,7 @@ def get_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40051,7 +39896,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40067,7 +39911,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40137,7 +39980,6 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40152,7 +39994,7 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40206,7 +40048,6 @@ def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40221,7 +40062,7 @@ def get_instance_function_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40236,7 +40077,7 @@ def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -40250,7 +40091,7 @@ def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -40273,10 +40114,10 @@ def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -40284,11 +40125,15 @@ def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40418,10 +40263,11 @@ def begin_create_instance_function_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -40490,7 +40336,6 @@ def delete_instance_function_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40651,7 +40496,6 @@ def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40666,11 +40510,7 @@ def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40727,7 +40567,6 @@ def delete_function_secret_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40789,7 +40628,6 @@ def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40804,7 +40642,7 @@ def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40855,7 +40693,6 @@ def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40870,7 +40707,7 @@ def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40916,7 +40753,6 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40931,7 +40767,7 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40979,7 +40815,6 @@ def list_sync_status_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41038,7 +40873,6 @@ def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41199,7 +41033,6 @@ def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41214,11 +41047,7 @@ def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41275,7 +41104,6 @@ def delete_host_secret_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41338,7 +41166,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -41354,7 +41181,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -41429,7 +41255,6 @@ def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41444,7 +41269,7 @@ def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41589,7 +41414,6 @@ def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41604,7 +41428,7 @@ def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41656,7 +41480,6 @@ def delete_host_name_binding_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41721,7 +41544,6 @@ def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41736,7 +41558,7 @@ def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41886,7 +41708,6 @@ def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41901,7 +41722,7 @@ def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41958,7 +41779,6 @@ def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42119,7 +41939,6 @@ def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42134,7 +41953,7 @@ def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42182,7 +42001,6 @@ def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42197,7 +42015,7 @@ def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42247,7 +42065,6 @@ def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42262,7 +42079,7 @@ def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42314,7 +42131,6 @@ def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42329,7 +42145,7 @@ def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42476,7 +42292,6 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42491,7 +42306,7 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42546,7 +42361,6 @@ def delete_relay_service_connection_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42704,7 +42518,6 @@ def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42719,7 +42532,7 @@ def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42772,7 +42585,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42788,7 +42600,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42863,7 +42674,6 @@ def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42878,7 +42688,7 @@ def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42930,7 +42740,6 @@ def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42945,7 +42754,7 @@ def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42960,7 +42769,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -42977,7 +42786,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -43000,10 +42809,10 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -43011,11 +42820,15 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43148,10 +42961,11 @@ def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=name-too- params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -43221,7 +43035,6 @@ def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43236,7 +43049,7 @@ def get_instance_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43297,7 +43110,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43313,7 +43125,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43396,7 +43207,6 @@ def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43411,7 +43221,7 @@ def get_instance_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43472,7 +43282,6 @@ def delete_instance_process_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43543,9 +43352,9 @@ def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -43554,11 +43363,15 @@ def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43622,7 +43435,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43638,7 +43450,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43731,7 +43542,6 @@ def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43746,7 +43556,7 @@ def get_instance_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43809,7 +43619,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43825,7 +43634,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43897,7 +43705,6 @@ def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43912,7 +43719,7 @@ def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43964,7 +43771,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43980,7 +43786,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44051,7 +43856,6 @@ def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44066,7 +43870,7 @@ def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44116,7 +43920,6 @@ def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44131,7 +43934,7 @@ def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44180,7 +43983,6 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44195,7 +43997,7 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44348,7 +44150,6 @@ def create_or_update_swift_virtual_network_connection_with_check_slot( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44363,7 +44164,7 @@ def create_or_update_swift_virtual_network_connection_with_check_slot( # pylint error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44415,7 +44216,6 @@ def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44579,7 +44379,6 @@ def update_swift_virtual_network_connection_with_check_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44594,7 +44393,7 @@ def update_swift_virtual_network_connection_with_check_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44649,7 +44448,6 @@ def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44664,7 +44462,7 @@ def list_network_features_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44717,7 +44515,6 @@ def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44732,11 +44529,7 @@ def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44800,7 +44593,6 @@ def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44815,7 +44607,7 @@ def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44831,7 +44623,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -44844,7 +44636,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -44858,10 +44650,10 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -44869,15 +44661,15 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44938,10 +44730,11 @@ def begin_start_web_site_network_trace_operation_slot( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -45004,7 +44797,6 @@ def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45068,7 +44860,6 @@ def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45083,7 +44874,7 @@ def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45136,7 +44927,6 @@ def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45151,11 +44941,7 @@ def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45208,7 +44994,6 @@ def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45223,7 +45008,7 @@ def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45273,7 +45058,6 @@ def generate_new_site_publishing_password_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45341,7 +45125,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -45357,7 +45140,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -45429,7 +45211,6 @@ def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45444,7 +45225,7 @@ def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45493,7 +45274,6 @@ def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45508,7 +45288,7 @@ def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45560,7 +45340,6 @@ def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45575,7 +45354,7 @@ def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45718,7 +45497,6 @@ def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45733,7 +45511,7 @@ def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45785,7 +45563,6 @@ def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45939,7 +45716,6 @@ def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45954,7 +45730,7 @@ def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46004,7 +45780,6 @@ def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46019,7 +45794,7 @@ def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46155,7 +45930,6 @@ def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46170,7 +45944,7 @@ def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46223,7 +45997,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46239,7 +46012,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46313,7 +46085,6 @@ def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46328,7 +46099,7 @@ def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46343,7 +46114,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46357,7 +46128,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -46380,10 +46151,10 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46391,15 +46162,15 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46534,10 +46305,13 @@ def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -46561,7 +46335,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -46574,7 +46348,7 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -46586,10 +46360,10 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -46597,18 +46371,15 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46655,10 +46426,11 @@ def begin_delete_private_endpoint_connection_slot( # pylint: disable=name-too-l params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -46719,7 +46491,6 @@ def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46734,7 +46505,7 @@ def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46791,7 +46562,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46807,7 +46577,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46886,7 +46655,6 @@ def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46901,7 +46669,7 @@ def get_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46958,7 +46726,6 @@ def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47025,9 +46792,9 @@ def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -47036,11 +46803,15 @@ def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47100,7 +46871,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47116,7 +46886,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47198,7 +46967,6 @@ def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47213,7 +46981,7 @@ def get_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47272,7 +47040,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47288,7 +47055,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47363,7 +47129,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47379,7 +47144,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47454,7 +47218,6 @@ def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47469,7 +47232,7 @@ def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47614,7 +47377,6 @@ def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47629,7 +47391,7 @@ def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47681,7 +47443,6 @@ def delete_public_certificate_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47830,9 +47591,9 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -47841,11 +47602,15 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47896,7 +47661,6 @@ def reset_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47971,7 +47735,6 @@ def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47989,14 +47752,14 @@ def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48010,7 +47773,7 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48032,10 +47795,10 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48043,12 +47806,20 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob_slot( @@ -48151,7 +47922,7 @@ def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -48163,6 +47934,7 @@ def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -48184,14 +47956,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48205,7 +47977,7 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48227,10 +47999,10 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48238,12 +48010,20 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app_slot( @@ -48346,7 +48126,7 @@ def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -48358,6 +48138,7 @@ def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -48379,14 +48160,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48400,7 +48181,7 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48422,10 +48203,10 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48433,12 +48214,20 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot_slot( @@ -48544,7 +48333,7 @@ def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_slot_initial( # type: ignore + raw_result = self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -48556,6 +48345,7 @@ def begin_restore_snapshot_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -48625,7 +48415,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48641,7 +48430,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48719,7 +48507,6 @@ def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48734,7 +48521,7 @@ def get_site_extension_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48743,7 +48530,7 @@ def get_site_extension_slot( def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48760,7 +48547,7 @@ def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -48772,10 +48559,10 @@ def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48783,15 +48570,15 @@ def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48840,10 +48627,11 @@ def begin_install_site_extension_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -48913,7 +48701,6 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49059,7 +48846,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49075,7 +48861,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49105,14 +48890,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -49126,7 +48911,7 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -49148,10 +48933,10 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -49159,12 +48944,20 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot( @@ -49267,7 +49060,7 @@ def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_initial( # type: ignore + raw_result = self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -49279,6 +49072,7 @@ def begin_swap_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -49344,7 +49138,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49360,7 +49153,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49434,7 +49226,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49450,7 +49241,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49522,7 +49312,6 @@ def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49537,14 +49326,7 @@ def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49558,7 +49340,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -49572,7 +49354,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -49594,10 +49376,10 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -49605,18 +49387,15 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49741,10 +49520,11 @@ def begin_create_or_update_source_control_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -49814,7 +49594,6 @@ def delete_source_control_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49960,7 +49739,6 @@ def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49975,14 +49753,7 @@ def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50031,7 +49802,6 @@ def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50058,7 +49828,7 @@ def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -50071,7 +49841,7 @@ def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -50085,10 +49855,10 @@ def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -50096,15 +49866,15 @@ def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50165,10 +49935,11 @@ def begin_start_network_trace_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -50232,7 +50003,6 @@ def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50291,7 +50061,6 @@ def stop_network_trace_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50351,7 +50120,6 @@ def sync_repository_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50410,7 +50178,6 @@ def sync_function_triggers_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50473,7 +50240,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50489,7 +50255,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50567,7 +50332,6 @@ def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50582,7 +50346,7 @@ def get_triggered_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50634,7 +50398,6 @@ def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50703,7 +50466,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50719,7 +50481,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50801,7 +50562,6 @@ def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50816,7 +50576,7 @@ def get_triggered_web_job_history_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50871,7 +50631,6 @@ def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50940,7 +50699,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50956,7 +50714,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51028,7 +50785,6 @@ def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51043,7 +50799,7 @@ def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51095,7 +50851,6 @@ def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51110,7 +50865,7 @@ def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51261,7 +51016,6 @@ def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51276,7 +51030,7 @@ def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51332,7 +51086,6 @@ def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51494,7 +51247,6 @@ def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51509,7 +51261,7 @@ def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51568,7 +51320,6 @@ def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51583,7 +51334,7 @@ def get_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51739,7 +51490,6 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51754,7 +51504,7 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51910,7 +51660,6 @@ def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51925,7 +51674,7 @@ def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51977,7 +51726,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51993,7 +51741,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52068,7 +51815,6 @@ def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52083,7 +51829,7 @@ def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52205,7 +51951,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52221,7 +51966,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52251,13 +51995,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -52271,7 +52015,7 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -52292,10 +52036,10 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -52303,12 +52047,20 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot_with_production( @@ -52399,7 +52151,7 @@ def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_with_production_initial( # type: ignore + raw_result = self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -52410,6 +52162,7 @@ def begin_swap_slot_with_production( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -52470,7 +52223,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52486,7 +52238,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52557,7 +52308,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52573,7 +52323,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52639,7 +52388,6 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52654,14 +52402,7 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52674,7 +52415,7 @@ def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -52688,7 +52429,7 @@ def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -52709,10 +52450,10 @@ def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -52720,18 +52461,15 @@ def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52843,10 +52581,11 @@ def begin_create_or_update_source_control( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -52912,7 +52651,6 @@ def delete_source_control( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53045,7 +52783,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53060,14 +52797,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53112,7 +52842,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53138,7 +52867,7 @@ def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -53151,7 +52880,7 @@ def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -53164,10 +52893,10 @@ def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -53175,15 +52904,15 @@ def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53240,10 +52969,11 @@ def begin_start_network_trace( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -53303,7 +53033,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53359,7 +53088,6 @@ def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53415,7 +53143,6 @@ def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53471,7 +53198,6 @@ def sync_function_triggers( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53530,7 +53256,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53546,7 +53271,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -53620,7 +53344,6 @@ def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53635,7 +53358,7 @@ def get_triggered_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53683,7 +53406,6 @@ def delete_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53748,7 +53470,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53764,7 +53485,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -53842,7 +53562,6 @@ def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53857,7 +53576,7 @@ def get_triggered_web_job_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53908,7 +53627,6 @@ def run_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53973,7 +53691,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53989,7 +53706,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -54057,7 +53773,6 @@ def list_vnet_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54072,7 +53787,7 @@ def list_vnet_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54120,7 +53835,6 @@ def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54135,7 +53849,7 @@ def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54273,7 +53987,6 @@ def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54288,7 +54001,7 @@ def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54340,7 +54053,6 @@ def delete_vnet_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54489,7 +54201,6 @@ def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54504,7 +54215,7 @@ def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54559,7 +54270,6 @@ def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54574,7 +54284,7 @@ def get_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54717,7 +54427,6 @@ def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54732,7 +54441,7 @@ def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54875,7 +54584,6 @@ def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54890,7 +54598,7 @@ def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54936,7 +54644,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -54952,7 +54659,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -55021,7 +54727,6 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55036,7 +54741,7 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55161,7 +54866,6 @@ def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55307,7 +55011,6 @@ def deploy_workflow_artifacts_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55369,7 +55072,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -55385,7 +55087,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -55462,7 +55163,6 @@ def get_instance_workflow_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55477,7 +55177,7 @@ def get_instance_workflow_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55525,7 +55225,6 @@ def list_workflows_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55540,7 +55239,7 @@ def list_workflows_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55588,7 +55287,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -55604,7 +55302,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -55678,7 +55375,6 @@ def get_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55693,7 +55389,7 @@ def get_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55738,7 +55434,6 @@ def list_workflows_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55753,7 +55448,7 @@ def list_workflows_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_web_site_management_client_operations.py index bc235535da16a..94407eedc49ec 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_web_site_management_client_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -590,7 +589,6 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -605,7 +603,7 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -694,7 +692,6 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -709,7 +706,7 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +747,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -766,7 +762,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -830,7 +825,6 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -845,7 +839,7 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -953,7 +947,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -968,7 +961,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1018,7 +1011,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1034,7 +1026,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1124,7 +1115,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1139,7 +1129,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1186,7 +1176,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1202,7 +1191,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1265,7 +1253,6 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1280,7 +1267,7 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1322,7 +1309,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1338,7 +1324,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1427,7 +1412,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1443,7 +1427,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1563,7 +1546,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1579,7 +1561,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1644,7 +1625,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1660,7 +1640,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1722,7 +1701,6 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1737,7 +1715,7 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1836,7 +1814,6 @@ def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1851,7 +1828,7 @@ def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1964,7 +1941,6 @@ def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2084,7 +2060,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2099,7 +2074,7 @@ def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2212,7 +2187,6 @@ def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_action_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_action_repetitions_operations.py index 7655a35826016..1b519486221f8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_action_repetitions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_action_repetitions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -256,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -272,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -357,7 +354,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -372,7 +368,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response) + deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -437,7 +433,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -453,7 +448,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_action_repetitions_request_histories_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_action_repetitions_request_histories_operations.py index 161563cad1c55..8cfdf9ff25bc5 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_action_repetitions_request_histories_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_action_repetitions_request_histories_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -219,7 +218,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -235,7 +233,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -324,7 +321,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,7 +335,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RequestHistory", pipeline_response) + deserialized = self._deserialize("RequestHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_action_scope_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_action_scope_repetitions_operations.py index bc826ef28c2be..6d01dcc21f54d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_action_scope_repetitions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_action_scope_repetitions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -207,7 +206,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -223,7 +221,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -308,7 +305,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -323,7 +319,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response) + deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_actions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_actions_operations.py index 8a1acb6fdd1e5..700b76e51c685 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_actions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_run_actions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -266,7 +265,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -282,7 +280,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -357,7 +354,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -372,7 +368,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunAction", pipeline_response) + deserialized = self._deserialize("WorkflowRunAction", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -427,7 +423,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -443,7 +438,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_runs_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_runs_operations.py index 664c07d3aed7f..52de8bbd75a5d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_runs_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_runs_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -246,7 +245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -262,7 +260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -334,7 +331,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -349,7 +345,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRun", pipeline_response) + deserialized = self._deserialize("WorkflowRun", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -398,7 +394,6 @@ def cancel( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_trigger_histories_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_trigger_histories_operations.py index 31f8db310bd42..0c69e2a1b777f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_trigger_histories_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_trigger_histories_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -269,7 +270,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -285,7 +285,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -367,7 +366,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -382,14 +380,14 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTriggerHistory", pipeline_response) + deserialized = self._deserialize("WorkflowTriggerHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _resubmit_initial( # pylint: disable=inconsistent-return-statements + def _resubmit_initial( self, resource_group_name: str, name: str, @@ -397,7 +395,7 @@ def _resubmit_initial( # pylint: disable=inconsistent-return-statements trigger_name: str, history_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -410,7 +408,7 @@ def _resubmit_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resubmit_request( resource_group_name=resource_group_name, @@ -423,10 +421,10 @@ def _resubmit_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -434,12 +432,20 @@ def _resubmit_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_resubmit( @@ -477,7 +483,7 @@ def begin_resubmit( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._resubmit_initial( # type: ignore + raw_result = self._resubmit_initial( resource_group_name=resource_group_name, name=name, workflow_name=workflow_name, @@ -489,6 +495,7 @@ def begin_resubmit( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_triggers_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_triggers_operations.py index dff7464e41f98..cbf03dfb0202f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_triggers_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_triggers_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -327,7 +328,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -343,7 +343,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -415,7 +414,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -430,7 +428,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTrigger", pipeline_response) + deserialized = self._deserialize("WorkflowTrigger", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -479,7 +477,6 @@ def list_callback_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -494,16 +491,16 @@ def list_callback_url( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTriggerCallbackUrl", pipeline_response) + deserialized = self._deserialize("WorkflowTriggerCallbackUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _run_initial( # pylint: disable=inconsistent-return-statements + def _run_initial( self, resource_group_name: str, name: str, workflow_name: str, trigger_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -516,7 +513,7 @@ def _run_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_run_request( resource_group_name=resource_group_name, @@ -528,10 +525,10 @@ def _run_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -539,12 +536,20 @@ def _run_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_run( @@ -573,7 +578,7 @@ def begin_run( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._run_initial( # type: ignore + raw_result = self._run_initial( resource_group_name=resource_group_name, name=name, workflow_name=workflow_name, @@ -584,6 +589,7 @@ def begin_run( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -647,7 +653,6 @@ def get_schema_json( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -662,7 +667,7 @@ def get_schema_json( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JsonSchema", pipeline_response) + deserialized = self._deserialize("JsonSchema", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_versions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_versions_operations.py index 1612b39824470..2b24a75ab9d93 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_versions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflow_versions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -193,7 +192,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -209,7 +207,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -281,7 +278,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -296,7 +292,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowVersion", pipeline_response) + deserialized = self._deserialize("WorkflowVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflows_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflows_operations.py index f4959dd12512b..a1b6a3a1c3369 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflows_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_01_01/operations/_workflows_operations.py @@ -19,15 +19,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -261,7 +260,6 @@ def regenerate_access_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -395,7 +393,6 @@ def validate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_metadata.json b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_metadata.json index 945ac5e5d72d7..470c4e86cc1e3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_metadata.json +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"WebSiteManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"WebSiteManagementClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_vendor.py index fd66631892ed1..abd2e5566a353 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from .._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class WebSiteManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_version.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_version.py index 52c54f56f7cb6..433bf07f9dbef 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_version.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.3.0" +VERSION = "7.3.1" diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_web_site_management_client.py index 3361a0b7eb780..adb3d3ad13dc6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -294,7 +295,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "WebSiteManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/_vendor.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/_vendor.py index 39f69956b8888..6e80ec49ed289 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/_vendor.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import WebSiteManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/_web_site_management_client.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/_web_site_management_client.py index 5b3f0ae1d149f..79e2c28dc993a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/_web_site_management_client.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/_web_site_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -299,7 +300,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebSiteManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_app_service_certificate_orders_operations.py index b3506139139e7..ff636c92c0b18 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_certificate_orders_operations import ( build_create_or_update_certificate_request, build_create_or_update_request, @@ -119,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -254,7 +266,6 @@ async def validate_purchase_information( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +405,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +419,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +432,7 @@ async def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -438,7 +446,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -459,10 +467,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -470,15 +478,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -595,10 +603,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -658,7 +667,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +801,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -808,7 +815,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -858,7 +865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -874,7 +880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -945,7 +950,6 @@ async def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -960,7 +964,7 @@ async def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -974,7 +978,7 @@ async def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -988,7 +992,7 @@ async def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1010,10 +1014,10 @@ async def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1021,15 +1025,15 @@ async def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1153,10 +1157,11 @@ async def begin_create_or_update_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1219,7 +1224,6 @@ async def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1362,7 +1366,6 @@ async def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1377,7 +1380,7 @@ async def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1499,7 +1502,6 @@ async def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1632,7 +1634,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1688,7 +1689,6 @@ async def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1822,7 +1822,6 @@ async def resend_request_emails( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1971,7 +1970,6 @@ async def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1986,7 +1984,7 @@ async def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2031,7 +2029,6 @@ async def verify_domain_ownership( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2087,7 +2084,6 @@ async def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2102,7 +2098,7 @@ async def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2147,7 +2143,6 @@ async def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2162,7 +2157,7 @@ async def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_app_service_environments_operations.py index 8c0c97bc653f3..06ac70348432d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_app_service_environments_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_environments_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_change_vnet_request, @@ -148,7 +162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -164,7 +177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -234,7 +246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -250,7 +261,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -316,7 +326,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -331,7 +340,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -344,7 +353,7 @@ async def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -358,7 +367,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -379,10 +388,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -390,21 +399,19 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -521,10 +528,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -546,9 +554,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -561,7 +569,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -572,10 +580,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -583,12 +591,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -619,7 +635,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -629,6 +645,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -767,7 +784,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -782,14 +798,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -838,7 +847,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -854,7 +862,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -920,7 +927,6 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -935,7 +941,7 @@ async def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -948,7 +954,7 @@ async def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -962,7 +968,7 @@ async def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -983,10 +989,10 @@ async def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -994,15 +1000,15 @@ async def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1131,7 +1137,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1147,13 +1152,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1190,6 +1194,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -1255,7 +1260,6 @@ async def get_ase_custom_dns_suffix_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1270,7 +1274,7 @@ async def get_ase_custom_dns_suffix_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response) + deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1392,7 +1396,6 @@ async def update_ase_custom_dns_suffix_configuration( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1407,7 +1410,7 @@ async def update_ase_custom_dns_suffix_configuration( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response) + deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1452,7 +1455,6 @@ async def delete_ase_custom_dns_suffix_configuration( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1467,11 +1469,7 @@ async def delete_ase_custom_dns_suffix_configuration( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1516,7 +1514,6 @@ async def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1531,7 +1528,7 @@ async def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1653,7 +1650,6 @@ async def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1668,7 +1664,7 @@ async def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1713,7 +1709,6 @@ async def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1728,7 +1723,7 @@ async def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1776,7 +1771,6 @@ async def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1791,7 +1785,7 @@ async def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1842,7 +1836,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1858,7 +1851,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1930,7 +1922,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1946,7 +1937,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2014,7 +2004,6 @@ async def get_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2029,7 +2018,7 @@ async def get_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2042,7 +2031,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2056,7 +2045,7 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2077,10 +2066,10 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2088,15 +2077,15 @@ async def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2210,10 +2199,11 @@ async def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2349,7 +2339,6 @@ async def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2364,11 +2353,7 @@ async def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2423,7 +2408,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2439,7 +2423,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2512,7 +2495,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2528,7 +2510,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2599,7 +2580,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2615,7 +2595,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2683,7 +2662,6 @@ async def test_upgrade_available_notification( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2701,9 +2679,7 @@ async def test_upgrade_available_notification( # pylint: disable=inconsistent-r if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _upgrade_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _upgrade_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2716,7 +2692,7 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_upgrade_request( resource_group_name=resource_group_name, @@ -2726,10 +2702,10 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2737,12 +2713,20 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -2767,7 +2751,7 @@ async def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._upgrade_initial( # type: ignore + raw_result = await self._upgrade_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -2776,6 +2760,7 @@ async def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2838,7 +2823,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2854,7 +2838,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2920,7 +2903,6 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2935,7 +2917,7 @@ async def list_operations(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2986,7 +2968,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3002,7 +2983,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3075,7 +3055,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3091,7 +3070,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3162,7 +3140,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3177,7 +3154,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3191,7 +3168,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3205,7 +3182,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3227,10 +3204,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3238,15 +3215,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3371,10 +3348,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3398,7 +3378,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3411,7 +3391,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -3422,10 +3402,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3433,18 +3413,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3488,10 +3465,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3549,7 +3527,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3564,7 +3541,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3609,7 +3586,6 @@ async def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3627,7 +3603,7 @@ async def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3640,7 +3616,7 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -3650,10 +3626,10 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3661,15 +3637,15 @@ async def _resume_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3720,7 +3696,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3736,13 +3711,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3777,6 +3751,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3846,7 +3821,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3862,7 +3836,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3937,7 +3910,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3953,7 +3925,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3983,7 +3954,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3996,7 +3967,7 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -4006,10 +3977,10 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4017,15 +3988,15 @@ async def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4076,7 +4047,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4092,13 +4062,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4133,6 +4102,7 @@ async def get_next(next_link=None): params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -4208,7 +4178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4224,7 +4193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4296,7 +4264,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4312,7 +4279,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4383,7 +4349,6 @@ async def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4398,7 +4363,7 @@ async def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4412,7 +4377,7 @@ async def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4426,7 +4391,7 @@ async def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4448,10 +4413,10 @@ async def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4459,15 +4424,15 @@ async def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4590,10 +4555,11 @@ async def begin_create_or_update_worker_pool( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4738,7 +4704,6 @@ async def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4753,11 +4718,7 @@ async def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4814,7 +4775,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4830,7 +4790,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4906,7 +4865,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4922,7 +4880,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4996,7 +4953,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5012,7 +4968,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5086,7 +5041,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5102,7 +5056,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_app_service_plans_operations.py index 7aa7c597fa18a..b3f02d9a5150f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_app_service_plans_operations.py @@ -8,7 +8,21 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._app_service_plans_operations import ( build_create_or_update_request, build_create_or_update_vnet_route_request, @@ -131,7 +145,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -147,7 +160,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -216,7 +228,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +243,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -301,7 +311,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -316,7 +325,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +338,7 @@ async def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -343,7 +352,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -364,10 +373,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -375,15 +384,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -493,10 +502,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -556,7 +566,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -688,7 +697,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -703,11 +711,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +754,6 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -765,7 +768,7 @@ async def list_capabilities(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -816,7 +819,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -831,7 +833,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -882,7 +884,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -944,7 +945,6 @@ async def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -959,7 +959,7 @@ async def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1013,7 +1013,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1029,7 +1028,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1097,7 +1095,6 @@ async def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1112,7 +1109,7 @@ async def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1161,7 +1158,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1173,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1251,7 +1246,6 @@ async def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1329,7 +1323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1345,7 +1338,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1411,7 +1403,6 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1426,7 +1417,7 @@ async def get_server_farm_skus(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1480,7 +1471,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1496,7 +1486,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1562,7 +1551,6 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1577,7 +1565,7 @@ async def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1628,7 +1616,6 @@ async def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1643,7 +1630,7 @@ async def get_vnet_from_server_farm( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1694,7 +1681,6 @@ async def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1709,7 +1695,7 @@ async def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1849,7 +1835,6 @@ async def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1864,7 +1849,7 @@ async def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1913,7 +1898,6 @@ async def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1928,7 +1912,7 @@ async def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1982,7 +1966,6 @@ async def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1997,7 +1980,7 @@ async def get_route_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2144,7 +2127,6 @@ async def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2159,7 +2141,7 @@ async def create_or_update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2213,7 +2195,6 @@ async def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2371,7 +2352,6 @@ async def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2386,7 +2366,7 @@ async def update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2434,7 +2414,6 @@ async def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_certificate_orders_diagnostics_operations.py index ef4255e99acd1..478b7bc19985b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_orders_diagnostics_operations import ( build_get_app_service_certificate_order_detector_response_request, build_list_app_service_certificate_order_detector_response_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -212,7 +208,6 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -227,7 +222,7 @@ async def get_app_service_certificate_order_detector_response( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_certificate_registration_provider_operations.py index 026825d1eaccb..274182a41ca1f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_certificate_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_certificates_operations.py index 28a5d7de82a69..d8433e8dea878 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_certificates_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -105,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -187,7 +183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -203,7 +198,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -269,7 +263,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -284,7 +277,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -404,7 +397,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -419,7 +411,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +456,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +587,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +601,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_container_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_container_apps_operations.py index 0114f8dc341f0..a217a79ce4a9b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_container_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_container_apps_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_operations import ( build_create_or_update_request, build_delete_request, @@ -104,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -187,7 +185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -203,7 +200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -272,7 +268,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -287,7 +282,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -300,7 +295,7 @@ async def _create_or_update_initial( name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> _models.ContainerApp: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -314,7 +309,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -335,10 +330,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -346,15 +341,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -463,10 +458,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -488,9 +484,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -503,7 +497,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -513,10 +507,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -524,12 +518,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -554,7 +556,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -563,6 +565,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -617,7 +620,6 @@ async def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollect headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -632,7 +634,7 @@ async def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollect error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecretsCollection", pipeline_response) + deserialized = self._deserialize("SecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_container_apps_revisions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_container_apps_revisions_operations.py index 254c77e15f28f..f2905065e6fc1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_container_apps_revisions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_container_apps_revisions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._container_apps_revisions_operations import ( build_activate_revision_request, build_deactivate_revision_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -194,7 +190,6 @@ async def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +204,7 @@ async def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,7 +252,6 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -316,7 +310,6 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +368,6 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_deleted_web_apps_operations.py index 3ccee9dff23ff..216f26ce35ef7 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_deleted_web_apps_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_web_apps_operations import ( build_get_deleted_web_app_by_location_request, build_list_by_location_request, @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -179,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +257,6 @@ async def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +271,7 @@ async def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_diagnostics_operations.py index 96171121aadb8..0e8986501bc8c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_diagnostics_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._diagnostics_operations import ( build_execute_site_analysis_request, build_execute_site_analysis_slot_request, @@ -126,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -229,7 +225,6 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +239,7 @@ async def get_hosting_environment_detector_response( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,7 +288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -309,7 +303,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -396,7 +389,6 @@ async def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +403,7 @@ async def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +452,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -476,7 +467,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -547,7 +537,6 @@ async def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -562,7 +551,7 @@ async def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +603,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -630,7 +618,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -704,7 +691,6 @@ async def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,7 +705,7 @@ async def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +773,6 @@ async def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +787,7 @@ async def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -855,7 +840,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -871,7 +855,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -945,7 +928,6 @@ async def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -960,7 +942,7 @@ async def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1028,7 +1010,6 @@ async def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1043,7 +1024,7 @@ async def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1095,7 +1076,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1111,7 +1091,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1202,7 +1181,6 @@ async def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1217,7 +1195,7 @@ async def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1269,7 +1247,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1285,7 +1262,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1359,7 +1335,6 @@ async def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1374,7 +1349,7 @@ async def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1429,7 +1404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1445,7 +1419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1528,7 +1501,6 @@ async def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1543,7 +1515,7 @@ async def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1615,7 +1587,6 @@ async def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1630,7 +1601,7 @@ async def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1686,7 +1657,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1702,7 +1672,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1785,7 +1754,6 @@ async def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1800,7 +1768,7 @@ async def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1872,7 +1840,6 @@ async def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1887,7 +1854,7 @@ async def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_domain_registration_provider_operations.py index 39915c35d3250..c981a036d931e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_domain_registration_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._domain_registration_provider_operations import build_list_operations_request from .._vendor import WebSiteManagementClientMixinABC @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_domains_operations.py index 934e3d59e1f90..cffce42613c34 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._domains_operations import ( build_check_availability_request, build_create_or_update_ownership_identifier_request, @@ -163,7 +163,6 @@ async def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +177,7 @@ async def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -218,7 +217,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -234,7 +232,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -294,7 +291,6 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -309,7 +305,7 @@ async def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainC error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +405,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -425,7 +420,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -491,7 +485,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -507,7 +500,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -573,7 +565,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -588,7 +579,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -597,7 +588,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) - async def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -611,7 +602,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -632,10 +623,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -643,15 +634,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -757,10 +748,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -825,7 +817,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -956,7 +947,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -971,11 +961,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1025,7 +1011,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1041,7 +1026,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1112,7 +1096,6 @@ async def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1127,7 +1110,7 @@ async def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1266,7 +1249,6 @@ async def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1281,7 +1263,7 @@ async def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1329,7 +1311,6 @@ async def delete_ownership_identifier( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1479,7 +1460,6 @@ async def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1494,7 +1474,7 @@ async def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1539,7 +1519,6 @@ async def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1597,7 +1576,6 @@ async def transfer_out(self, resource_group_name: str, domain_name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1612,7 +1590,7 @@ async def transfer_out(self, resource_group_name: str, domain_name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_get_usages_in_location_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_get_usages_in_location_operations.py index df2c5e93ba231..e8cfc9be44d02 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_get_usages_in_location_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_get_usages_in_location_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._get_usages_in_location_operations import build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_global_operations_operations.py index 4bc9b92e22922..70837d46229ca 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_global_operations_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._global_operations_operations import ( build_get_deleted_web_app_request, build_get_deleted_web_app_snapshots_request, @@ -94,7 +92,6 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +106,7 @@ async def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -149,7 +146,6 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -164,7 +160,7 @@ async def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -209,7 +205,6 @@ async def get_subscription_operation_with_async_response( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_kube_environments_operations.py index 2c5971216b44c..f2f64869943e3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_kube_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_kube_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._kube_environments_operations import ( build_create_or_update_request, build_delete_request, @@ -104,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -189,7 +187,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -205,7 +202,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -271,7 +267,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +281,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -299,7 +294,7 @@ async def _create_or_update_initial( name: str, kube_environment_envelope: Union[_models.KubeEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.KubeEnvironment: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -313,7 +308,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KubeEnvironment] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -334,10 +329,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -345,15 +340,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -466,10 +461,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -491,9 +487,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -506,7 +500,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -516,10 +510,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -527,12 +521,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -557,7 +559,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -566,6 +568,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -704,7 +707,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,11 +721,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_provider_operations.py index d6648a4434597..270e0e319dea4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_provider_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._provider_operations import ( build_get_available_stacks_on_prem_request, build_get_available_stacks_request, @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -192,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -208,7 +203,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -280,7 +274,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -296,7 +289,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -367,7 +359,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -383,7 +374,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -449,7 +439,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -465,7 +454,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -533,7 +521,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -549,7 +536,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -620,7 +606,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -636,7 +621,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_recommendations_operations.py index a9017911f5db7..ac95138e8af8d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_recommendations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommendations_operations import ( build_disable_all_for_hosting_environment_request, build_disable_all_for_web_app_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -198,7 +194,6 @@ async def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -252,7 +247,6 @@ async def disable_recommendation_for_subscription( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -327,7 +321,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -343,7 +336,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -429,7 +421,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -445,7 +436,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -516,7 +506,6 @@ async def disable_all_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -575,7 +564,6 @@ async def reset_all_filters_for_hosting_environment( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -648,7 +636,6 @@ async def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -663,7 +650,7 @@ async def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -714,7 +701,6 @@ async def disable_recommendation_for_hosting_environment( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -789,7 +775,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -805,7 +790,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -891,7 +875,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -907,7 +890,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -975,7 +957,6 @@ async def disable_all_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1031,7 +1012,6 @@ async def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1104,7 +1084,6 @@ async def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1119,7 +1098,7 @@ async def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1167,7 +1146,6 @@ async def disable_recommendation_for_site( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_resource_health_metadata_operations.py index 5c6785dd233bd..0528356d63274 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_resource_health_metadata_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._resource_health_metadata_operations import ( build_get_by_site_request, build_get_by_site_slot_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -189,7 +185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -205,7 +200,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -279,7 +273,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -295,7 +288,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -361,7 +353,6 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +367,7 @@ async def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -431,7 +422,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -447,7 +437,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -519,7 +508,6 @@ async def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -534,7 +522,7 @@ async def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_static_sites_operations.py index d8a3ccfc586a4..ba0ab2933d7b4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._static_sites_operations import ( build_approve_or_reject_private_endpoint_connection_request, build_create_or_update_basic_auth_request, @@ -248,7 +248,6 @@ async def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -263,7 +262,7 @@ async def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -305,7 +304,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -321,7 +319,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -391,7 +388,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -407,7 +403,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -475,7 +470,6 @@ async def get_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -490,7 +484,7 @@ async def get_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -503,7 +497,7 @@ async def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -517,7 +511,7 @@ async def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -538,10 +532,10 @@ async def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -549,15 +543,15 @@ async def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -676,10 +670,11 @@ async def begin_create_or_update_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -701,9 +696,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -716,7 +711,7 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -726,10 +721,10 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -737,12 +732,20 @@ async def _delete_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site( @@ -769,7 +772,7 @@ async def begin_delete_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_initial( # type: ignore + raw_result = await self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -778,6 +781,7 @@ async def begin_delete_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -918,7 +922,6 @@ async def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -933,11 +936,7 @@ async def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -990,7 +989,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1006,7 +1004,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1080,7 +1077,6 @@ async def delete_static_site_user( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1234,7 +1230,6 @@ async def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1249,7 +1244,7 @@ async def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1299,7 +1294,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1315,7 +1309,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1386,7 +1379,6 @@ async def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1401,16 +1393,16 @@ async def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + async def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1423,7 +1415,7 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -1434,10 +1426,10 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1445,12 +1437,20 @@ async def _delete_static_site_build_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_build( @@ -1479,7 +1479,7 @@ async def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_build_initial( # type: ignore + raw_result = await self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -1489,6 +1489,7 @@ async def begin_delete_static_site_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1635,7 +1636,6 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1650,7 +1650,7 @@ async def create_or_update_static_site_build_app_settings( # pylint: disable=na error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1782,7 +1782,6 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1797,7 +1796,7 @@ async def create_or_update_static_site_build_function_app_settings( # pylint: d error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1849,7 +1848,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1865,7 +1863,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1939,7 +1936,6 @@ async def get_build_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1954,7 +1950,7 @@ async def get_build_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2098,7 +2094,6 @@ async def create_or_update_build_database_connection( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2113,7 +2108,7 @@ async def create_or_update_build_database_connection( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2164,7 +2159,6 @@ async def delete_build_database_connection( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2320,7 +2314,6 @@ async def update_build_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2335,7 +2328,7 @@ async def update_build_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2386,7 +2379,6 @@ async def get_build_database_connection_with_details( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2401,7 +2393,7 @@ async def get_build_database_connection_with_details( # pylint: disable=name-to error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2454,7 +2446,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2470,7 +2461,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2541,7 +2531,6 @@ async def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2556,7 +2545,7 @@ async def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2604,7 +2593,6 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2619,7 +2607,7 @@ async def list_static_site_build_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2671,7 +2659,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2687,7 +2674,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2764,7 +2750,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2780,7 +2765,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2856,7 +2840,6 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2871,7 +2854,9 @@ async def get_user_provided_function_app_for_static_site_build( # pylint: disab error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2889,7 +2874,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2903,7 +2888,7 @@ async def _register_user_provided_function_app_with_static_site_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2929,10 +2914,10 @@ async def _register_user_provided_function_app_with_static_site_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2940,15 +2925,15 @@ async def _register_user_provided_function_app_with_static_site_build_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3107,10 +3092,13 @@ async def begin_register_user_provided_function_app_with_static_site_build( # p params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3177,7 +3165,6 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3195,14 +3182,14 @@ async def detach_user_provided_function_app_from_static_site_build( # pylint: d if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3216,7 +3203,7 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3238,10 +3225,10 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3249,12 +3236,20 @@ async def _create_zip_deployment_for_static_site_build_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -3359,7 +3354,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -3371,6 +3366,7 @@ async def begin_create_zip_deployment_for_static_site_build( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3507,7 +3503,6 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3522,7 +3517,7 @@ async def create_or_update_static_site_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3572,7 +3567,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3588,7 +3582,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3659,7 +3652,6 @@ async def get_basic_auth( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3674,7 +3666,7 @@ async def get_basic_auth( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3806,7 +3798,6 @@ async def create_or_update_basic_auth( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3821,7 +3812,7 @@ async def create_or_update_basic_auth( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3943,7 +3934,6 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3958,7 +3948,7 @@ async def create_or_update_static_site_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4082,7 +4072,6 @@ async def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4097,7 +4086,7 @@ async def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4147,7 +4136,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4163,7 +4151,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4234,7 +4221,6 @@ async def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4249,7 +4235,7 @@ async def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4265,7 +4251,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4279,7 +4265,7 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4304,10 +4290,10 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4315,15 +4301,15 @@ async def _create_or_update_static_site_custom_domain_initial( # pylint: disabl response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4457,10 +4443,13 @@ async def begin_create_or_update_static_site_custom_domain( # pylint: disable=n params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4482,9 +4471,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4497,7 +4486,7 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -4508,10 +4497,10 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4519,12 +4508,20 @@ async def _delete_static_site_custom_domain_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_static_site_custom_domain( @@ -4553,7 +4550,7 @@ async def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = await self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -4563,6 +4560,7 @@ async def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4584,7 +4582,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -4593,7 +4591,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4607,7 +4605,7 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -4632,10 +4630,10 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4643,12 +4641,20 @@ async def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -4756,7 +4762,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = await self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -4768,6 +4774,7 @@ async def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4831,7 +4838,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4847,7 +4853,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4918,7 +4923,6 @@ async def get_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4933,7 +4937,7 @@ async def get_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5067,7 +5071,6 @@ async def create_or_update_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5082,7 +5085,7 @@ async def create_or_update_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5130,7 +5133,6 @@ async def delete_database_connection( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5276,7 +5278,6 @@ async def update_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5291,7 +5292,7 @@ async def update_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5339,7 +5340,6 @@ async def get_database_connection_with_details( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5354,16 +5354,16 @@ async def get_database_connection_with_details( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements + async def _detach_static_site_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5376,7 +5376,7 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -5386,10 +5386,10 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5397,12 +5397,20 @@ async def _detach_static_site_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_detach_static_site( @@ -5429,7 +5437,7 @@ async def begin_detach_static_site( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._detach_static_site_initial( # type: ignore + raw_result = await self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -5438,6 +5446,7 @@ async def begin_detach_static_site( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -5502,7 +5511,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5518,7 +5526,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5586,7 +5593,6 @@ async def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5601,7 +5607,7 @@ async def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5646,7 +5652,6 @@ async def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5661,7 +5666,7 @@ async def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5706,7 +5711,6 @@ async def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5721,7 +5725,7 @@ async def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5766,7 +5770,6 @@ async def list_static_site_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5781,7 +5784,7 @@ async def list_static_site_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5831,7 +5834,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5847,7 +5849,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5918,7 +5919,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5933,7 +5933,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5947,7 +5947,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5961,7 +5961,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5983,10 +5983,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5994,15 +5994,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6127,10 +6127,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6154,7 +6157,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6167,7 +6170,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -6178,10 +6181,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6189,18 +6192,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6244,10 +6244,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6305,7 +6306,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6320,7 +6320,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6442,7 +6442,6 @@ async def reset_static_site_api_key( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6502,7 +6501,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6518,7 +6516,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6592,7 +6589,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6608,7 +6604,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6680,7 +6675,6 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6695,7 +6689,9 @@ async def get_user_provided_function_app_for_static_site( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6712,7 +6708,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6726,7 +6722,7 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6751,10 +6747,10 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6762,15 +6758,15 @@ async def _register_user_provided_function_app_with_static_site_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6916,10 +6912,13 @@ async def begin_register_user_provided_function_app_with_static_site( # pylint: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6982,7 +6981,6 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7000,13 +6998,13 @@ async def detach_user_provided_function_app_from_static_site( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7020,7 +7018,7 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7041,10 +7039,10 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7052,12 +7050,20 @@ async def _create_zip_deployment_for_static_site_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -7153,7 +7159,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = await self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -7164,6 +7170,7 @@ async def begin_create_zip_deployment_for_static_site( # pylint: disable=name-t params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7185,14 +7192,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_backend_initial( # pylint: disable=inconsistent-return-statements + async def _validate_backend_initial( self, resource_group_name: str, name: str, linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7206,7 +7213,7 @@ async def _validate_backend_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7228,10 +7235,10 @@ async def _validate_backend_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7239,12 +7246,20 @@ async def _validate_backend_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_backend( @@ -7348,7 +7363,7 @@ async def begin_validate_backend( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_backend_initial( # type: ignore + raw_result = await self._validate_backend_initial( resource_group_name=resource_group_name, name=name, linked_backend_name=linked_backend_name, @@ -7360,6 +7375,7 @@ async def begin_validate_backend( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7381,7 +7397,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return-statements + async def _validate_backend_for_build_initial( self, resource_group_name: str, name: str, @@ -7389,7 +7405,7 @@ async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-r linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7403,7 +7419,7 @@ async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-r api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7426,10 +7442,10 @@ async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7437,12 +7453,20 @@ async def _validate_backend_for_build_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_validate_backend_for_build( @@ -7555,7 +7579,7 @@ async def begin_validate_backend_for_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._validate_backend_for_build_initial( # type: ignore + raw_result = await self._validate_backend_for_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -7568,6 +7592,7 @@ async def begin_validate_backend_for_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7632,7 +7657,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7648,7 +7672,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7724,7 +7747,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7740,7 +7762,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7811,7 +7832,6 @@ async def get_linked_backend( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7826,7 +7846,7 @@ async def get_linked_backend( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7840,7 +7860,7 @@ async def _link_backend_initial( linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteLinkedBackendARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7854,7 +7874,7 @@ async def _link_backend_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteLinkedBackendARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7876,10 +7896,10 @@ async def _link_backend_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7887,11 +7907,15 @@ async def _link_backend_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8018,10 +8042,11 @@ async def begin_link_backend( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8093,7 +8118,6 @@ async def unlink_backend( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8155,7 +8179,6 @@ async def get_linked_backend_for_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8170,7 +8193,7 @@ async def get_linked_backend_for_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8185,7 +8208,7 @@ async def _link_backend_to_build_initial( linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteLinkedBackendARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8199,7 +8222,7 @@ async def _link_backend_to_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteLinkedBackendARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -8222,10 +8245,10 @@ async def _link_backend_to_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8233,11 +8256,15 @@ async def _link_backend_to_build_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8374,10 +8401,11 @@ async def begin_link_backend_to_build( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8453,7 +8481,6 @@ async def unlink_backend_from_build( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_top_level_domains_operations.py index 2b5f565f5fa1c..327fbf494b681 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_top_level_domains_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_level_domains_operations import ( build_get_request, build_list_agreements_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -178,7 +174,6 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +311,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_web_apps_operations.py index 310b382d62944..2632659ceb80f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_web_apps_operations.py @@ -32,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -45,7 +46,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_apps_operations import ( build_add_premier_add_on_request, build_add_premier_add_on_slot_request, @@ -527,7 +527,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -543,7 +542,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -616,7 +614,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -632,7 +629,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -701,7 +697,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -716,7 +711,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -725,7 +720,7 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode async def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -739,7 +734,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -760,10 +755,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -771,15 +766,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -891,10 +886,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -969,7 +965,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1109,7 +1104,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1124,11 +1118,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1176,7 +1166,6 @@ async def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1191,7 +1180,7 @@ async def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1311,7 +1300,6 @@ async def apply_slot_config_to_production( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1440,7 +1428,6 @@ async def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1455,7 +1442,7 @@ async def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1501,7 +1488,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1517,7 +1503,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1588,7 +1573,6 @@ async def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1603,7 +1587,7 @@ async def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1654,7 +1638,6 @@ async def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1807,7 +1790,6 @@ async def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1822,21 +1804,21 @@ async def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_initial( # pylint: disable=inconsistent-return-statements + async def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1850,7 +1832,7 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1872,10 +1854,10 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1883,12 +1865,20 @@ async def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore( @@ -1988,7 +1978,7 @@ async def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_initial( # type: ignore + raw_result = await self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -2000,6 +1990,7 @@ async def begin_restore( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2065,7 +2056,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2081,7 +2071,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2149,7 +2138,6 @@ async def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2164,7 +2152,7 @@ async def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2288,7 +2276,6 @@ async def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2303,7 +2290,7 @@ async def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2348,7 +2335,6 @@ async def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2363,7 +2349,7 @@ async def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2487,7 +2473,6 @@ async def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2502,7 +2487,7 @@ async def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2551,7 +2536,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2567,7 +2551,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2710,7 +2693,6 @@ async def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2725,7 +2707,7 @@ async def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2770,7 +2752,6 @@ async def list_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2785,7 +2766,7 @@ async def list_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2905,7 +2886,6 @@ async def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2920,7 +2900,7 @@ async def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2963,7 +2943,6 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2978,7 +2957,7 @@ async def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3023,7 +3002,6 @@ async def get_auth_settings_v2_without_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3038,7 +3016,7 @@ async def get_auth_settings_v2_without_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3161,7 +3139,6 @@ async def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3176,7 +3153,7 @@ async def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3221,7 +3198,6 @@ async def get_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3236,7 +3212,7 @@ async def get_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3358,7 +3334,6 @@ async def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3373,7 +3348,7 @@ async def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3418,7 +3393,6 @@ async def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3433,7 +3407,7 @@ async def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3549,7 +3523,6 @@ async def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3564,7 +3537,7 @@ async def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3609,7 +3582,6 @@ async def delete_backup_configuration( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3665,7 +3637,6 @@ async def get_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3680,7 +3651,7 @@ async def get_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3729,7 +3700,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3745,7 +3715,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3816,7 +3785,6 @@ async def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3831,7 +3799,7 @@ async def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3880,7 +3848,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3896,7 +3863,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3967,7 +3933,6 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3982,7 +3947,7 @@ async def get_site_connection_string_key_vault_reference( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4105,7 +4070,6 @@ async def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4120,7 +4084,7 @@ async def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4165,7 +4129,6 @@ async def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4180,7 +4143,7 @@ async def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4225,7 +4188,6 @@ async def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4240,7 +4202,7 @@ async def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4363,7 +4325,6 @@ async def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4378,7 +4339,7 @@ async def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4494,7 +4455,6 @@ async def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4509,7 +4469,7 @@ async def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4552,7 +4512,6 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4567,7 +4526,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4576,7 +4535,7 @@ async def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any async def _list_publishing_credentials_initial( self, resource_group_name: str, name: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4589,7 +4548,7 @@ async def _list_publishing_credentials_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -4599,10 +4558,10 @@ async def _list_publishing_credentials_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4610,11 +4569,15 @@ async def _list_publishing_credentials_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4655,10 +4618,11 @@ async def begin_list_publishing_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4789,7 +4753,6 @@ async def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4804,7 +4767,7 @@ async def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4847,7 +4810,6 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4862,7 +4824,7 @@ async def list_site_push_settings(self, resource_group_name: str, name: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4908,7 +4870,6 @@ async def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4923,7 +4884,7 @@ async def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5052,7 +5013,6 @@ async def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5067,7 +5027,7 @@ async def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5112,7 +5072,6 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5127,7 +5086,7 @@ async def get_configuration(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5247,7 +5206,6 @@ async def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5262,7 +5220,7 @@ async def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5382,7 +5340,6 @@ async def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5397,7 +5354,7 @@ async def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5449,7 +5406,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5465,7 +5421,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5536,7 +5491,6 @@ async def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5551,7 +5505,7 @@ async def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5599,7 +5553,6 @@ async def recover_site_configuration_snapshot( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5655,9 +5608,9 @@ async def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5666,12 +5619,16 @@ async def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5716,9 +5673,9 @@ async def get_container_logs_zip( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5727,12 +5684,16 @@ async def get_container_logs_zip( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5781,7 +5742,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5797,7 +5757,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5871,7 +5830,6 @@ async def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5886,7 +5844,7 @@ async def get_continuous_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5934,7 +5892,6 @@ async def delete_continuous_web_job( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5996,7 +5953,6 @@ async def start_continuous_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6058,7 +6014,6 @@ async def stop_continuous_web_job( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6118,7 +6073,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6134,7 +6088,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6166,7 +6119,7 @@ async def get_next(next_link=None): async def _get_production_site_deployment_status_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, deployment_status_id: str, **kwargs: Any - ) -> _models.CsmDeploymentStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6179,7 +6132,7 @@ async def _get_production_site_deployment_status_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CsmDeploymentStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_get_production_site_deployment_status_request( resource_group_name=resource_group_name, @@ -6190,10 +6143,10 @@ async def _get_production_site_deployment_status_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6201,15 +6154,15 @@ async def _get_production_site_deployment_status_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6255,10 +6208,11 @@ async def begin_get_production_site_deployment_status( # pylint: disable=name-t params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6321,7 +6275,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6337,7 +6290,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6406,7 +6358,6 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6421,7 +6372,7 @@ async def get_deployment(self, resource_group_name: str, name: str, id: str, **k error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6551,7 +6502,6 @@ async def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6566,7 +6516,7 @@ async def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6614,7 +6564,6 @@ async def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6674,7 +6623,6 @@ async def list_deployment_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6689,7 +6637,7 @@ async def list_deployment_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6813,7 +6761,6 @@ async def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6828,7 +6775,7 @@ async def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6876,7 +6823,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6892,7 +6838,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6963,7 +6908,6 @@ async def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6978,7 +6922,7 @@ async def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7113,7 +7057,6 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7128,7 +7071,7 @@ async def create_or_update_domain_ownership_identifier( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7176,7 +7119,6 @@ async def delete_domain_ownership_identifier( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7322,7 +7264,6 @@ async def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7337,7 +7278,7 @@ async def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7380,7 +7321,6 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7395,7 +7335,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7404,7 +7344,7 @@ async def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwar async def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7421,7 +7361,7 @@ async def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7442,10 +7382,10 @@ async def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7453,11 +7393,15 @@ async def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7563,10 +7507,11 @@ async def begin_create_ms_deploy_operation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7627,7 +7572,6 @@ async def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7642,7 +7586,7 @@ async def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7686,7 +7630,6 @@ async def get_one_deploy_status(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7701,7 +7644,7 @@ async def get_one_deploy_status(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7744,7 +7687,6 @@ async def create_one_deploy_operation(self, resource_group_name: str, name: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7759,7 +7701,7 @@ async def create_one_deploy_operation(self, resource_group_name: str, name: str, error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7811,7 +7753,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7827,7 +7768,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7893,7 +7833,6 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7908,7 +7847,7 @@ async def get_functions_admin_token(self, resource_group_name: str, name: str, * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7959,7 +7898,6 @@ async def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7974,7 +7912,7 @@ async def get_function( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7988,7 +7926,7 @@ async def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8002,7 +7940,7 @@ async def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -8024,10 +7962,10 @@ async def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8035,11 +7973,15 @@ async def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8159,10 +8101,11 @@ async def begin_create_function( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8228,7 +8171,6 @@ async def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8379,7 +8321,6 @@ async def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8394,11 +8335,7 @@ async def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8452,7 +8389,6 @@ async def delete_function_secret( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8511,7 +8447,6 @@ async def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8526,7 +8461,7 @@ async def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8574,7 +8509,6 @@ async def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8589,7 +8523,7 @@ async def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8632,7 +8566,6 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8647,7 +8580,7 @@ async def list_host_keys(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8692,7 +8625,6 @@ async def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8748,7 +8680,6 @@ async def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8899,7 +8830,6 @@ async def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8914,11 +8844,7 @@ async def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8972,7 +8898,6 @@ async def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9032,7 +8957,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9048,7 +8972,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9119,7 +9042,6 @@ async def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9134,7 +9056,7 @@ async def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9266,7 +9188,6 @@ async def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9281,7 +9202,7 @@ async def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9329,7 +9250,6 @@ async def delete_host_name_binding( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9391,7 +9311,6 @@ async def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9406,7 +9325,7 @@ async def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9546,7 +9465,6 @@ async def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9561,7 +9479,7 @@ async def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9615,7 +9533,6 @@ async def delete_hybrid_connection( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9766,7 +9683,6 @@ async def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9781,7 +9697,7 @@ async def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9826,7 +9742,6 @@ async def list_hybrid_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9841,7 +9756,7 @@ async def list_hybrid_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9887,7 +9802,6 @@ async def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9902,7 +9816,7 @@ async def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9950,7 +9864,6 @@ async def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9965,7 +9878,7 @@ async def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10099,7 +10012,6 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10114,7 +10026,7 @@ async def create_or_update_relay_service_connection( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10165,7 +10077,6 @@ async def delete_relay_service_connection( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10310,7 +10221,6 @@ async def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10325,7 +10235,7 @@ async def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10375,7 +10285,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10391,7 +10300,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10462,7 +10370,6 @@ async def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10477,7 +10384,7 @@ async def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10525,7 +10432,6 @@ async def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10540,7 +10446,7 @@ async def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10554,7 +10460,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10571,7 +10477,7 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10593,10 +10499,10 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10604,11 +10510,15 @@ async def _create_instance_ms_deploy_operation_initial( # pylint: disable=name- response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10728,10 +10638,11 @@ async def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10797,7 +10708,6 @@ async def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10812,7 +10722,7 @@ async def get_instance_ms_deploy_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10869,7 +10779,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10885,7 +10794,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10964,7 +10872,6 @@ async def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10979,7 +10886,7 @@ async def get_instance_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11036,7 +10943,6 @@ async def delete_instance_process( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11103,9 +11009,9 @@ async def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11114,11 +11020,15 @@ async def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11179,7 +11089,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11195,7 +11104,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11277,7 +11185,6 @@ async def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11292,7 +11199,7 @@ async def get_instance_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11352,7 +11259,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11368,7 +11274,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11434,7 +11339,6 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11449,7 +11353,7 @@ async def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11497,7 +11401,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -11513,7 +11416,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -11581,7 +11483,6 @@ async def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11596,7 +11497,7 @@ async def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11610,7 +11511,7 @@ async def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11624,7 +11525,7 @@ async def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11646,10 +11547,10 @@ async def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11657,11 +11558,15 @@ async def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11785,10 +11690,11 @@ async def begin_migrate_storage( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11816,7 +11722,7 @@ async def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11830,7 +11736,7 @@ async def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11851,10 +11757,10 @@ async def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11862,11 +11768,15 @@ async def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11977,10 +11887,11 @@ async def begin_migrate_my_sql( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12042,7 +11953,6 @@ async def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12057,7 +11967,7 @@ async def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12102,7 +12012,6 @@ async def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12117,7 +12026,7 @@ async def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12257,7 +12166,6 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12272,7 +12180,7 @@ async def create_or_update_swift_virtual_network_connection_with_check( # pylin error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12320,7 +12228,6 @@ async def delete_swift_virtual_network( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12471,7 +12378,6 @@ async def update_swift_virtual_network_connection_with_check( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12486,7 +12392,7 @@ async def update_swift_virtual_network_connection_with_check( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12537,7 +12443,6 @@ async def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12552,7 +12457,7 @@ async def list_network_features( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12601,7 +12506,6 @@ async def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12616,11 +12520,7 @@ async def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12680,7 +12580,6 @@ async def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12695,7 +12594,7 @@ async def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12710,7 +12609,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12723,7 +12622,7 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -12736,10 +12635,10 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -12747,15 +12646,15 @@ async def _start_web_site_network_trace_operation_initial( # pylint: disable=na response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12813,10 +12712,11 @@ async def begin_start_web_site_network_trace_operation( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12876,7 +12776,6 @@ async def stop_web_site_network_trace( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12936,7 +12835,6 @@ async def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -12951,7 +12849,7 @@ async def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13000,7 +12898,6 @@ async def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13015,11 +12912,7 @@ async def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13068,7 +12961,6 @@ async def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13083,7 +12975,7 @@ async def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13129,7 +13021,6 @@ async def generate_new_site_publishing_password( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13194,7 +13085,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -13210,7 +13100,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -13278,7 +13167,6 @@ async def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13293,7 +13181,7 @@ async def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13336,7 +13224,6 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13351,7 +13238,7 @@ async def list_premier_add_ons(self, resource_group_name: str, name: str, **kwar error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13399,7 +13286,6 @@ async def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13414,7 +13300,7 @@ async def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13544,7 +13430,6 @@ async def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13559,7 +13444,7 @@ async def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13607,7 +13492,6 @@ async def delete_premier_add_on( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13748,7 +13632,6 @@ async def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13763,7 +13646,7 @@ async def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13808,7 +13691,6 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13823,7 +13705,7 @@ async def get_private_access(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13945,7 +13827,6 @@ async def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -13960,7 +13841,7 @@ async def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14010,7 +13891,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14026,7 +13906,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14097,7 +13976,6 @@ async def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14112,7 +13990,7 @@ async def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14126,7 +14004,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14140,7 +14018,7 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14162,10 +14040,10 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14173,15 +14051,15 @@ async def _approve_or_reject_private_endpoint_connection_initial( # pylint: dis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14306,10 +14184,13 @@ async def begin_approve_or_reject_private_endpoint_connection( # pylint: disabl params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14333,7 +14214,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14346,7 +14227,7 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -14357,10 +14238,10 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14368,18 +14249,15 @@ async def _delete_private_endpoint_connection_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14423,10 +14301,11 @@ async def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14484,7 +14363,6 @@ async def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14499,7 +14377,7 @@ async def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14552,7 +14430,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14568,7 +14445,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14643,7 +14519,6 @@ async def get_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14658,7 +14533,7 @@ async def get_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14711,7 +14586,6 @@ async def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14774,9 +14648,9 @@ async def get_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14785,11 +14659,15 @@ async def get_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14846,7 +14724,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -14862,7 +14739,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -14940,7 +14816,6 @@ async def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -14955,7 +14830,7 @@ async def get_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15011,7 +14886,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15027,7 +14901,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15099,7 +14972,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -15115,7 +14987,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -15186,7 +15057,6 @@ async def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15201,7 +15071,7 @@ async def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15333,7 +15203,6 @@ async def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15348,7 +15217,7 @@ async def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15396,7 +15265,6 @@ async def delete_public_certificate( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15532,9 +15400,9 @@ async def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15543,11 +15411,15 @@ async def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15594,7 +15466,6 @@ async def reset_production_slot_config( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15664,7 +15535,6 @@ async def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -15682,9 +15552,9 @@ async def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15698,7 +15568,7 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15719,10 +15589,10 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15730,12 +15600,20 @@ async def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob( @@ -15822,7 +15700,7 @@ async def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -15833,6 +15711,7 @@ async def begin_restore_from_backup_blob( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -15854,13 +15733,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15874,7 +15753,7 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15895,10 +15774,10 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15906,12 +15785,20 @@ async def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-ret response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app( @@ -16002,7 +15889,7 @@ async def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -16013,6 +15900,7 @@ async def begin_restore_from_deleted_app( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16034,13 +15922,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16054,7 +15942,7 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -16075,10 +15963,10 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16086,12 +15974,20 @@ async def _restore_snapshot_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot( @@ -16185,7 +16081,7 @@ async def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_initial( # type: ignore + raw_result = await self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -16196,6 +16092,7 @@ async def begin_restore_snapshot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -16259,7 +16156,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16275,7 +16171,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16346,7 +16241,6 @@ async def get_site_container( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16361,7 +16255,7 @@ async def get_site_container( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteContainer", pipeline_response) + deserialized = self._deserialize("SiteContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16490,7 +16384,6 @@ async def create_or_update_site_container( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16505,11 +16398,7 @@ async def create_or_update_site_container( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteContainer", pipeline_response) + deserialized = self._deserialize("SiteContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16557,7 +16446,6 @@ async def delete_site_container( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16620,7 +16508,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16636,7 +16523,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -16710,7 +16596,6 @@ async def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16725,7 +16610,7 @@ async def get_site_extension( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16734,7 +16619,7 @@ async def get_site_extension( async def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16751,7 +16636,7 @@ async def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -16762,10 +16647,10 @@ async def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16773,15 +16658,15 @@ async def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16827,10 +16712,11 @@ async def begin_install_site_extension( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16896,7 +16782,6 @@ async def delete_site_extension( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -16953,7 +16838,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16969,7 +16853,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17042,7 +16925,6 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17057,7 +16939,7 @@ async def get_slot(self, resource_group_name: str, name: str, slot: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17071,7 +16953,7 @@ async def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17085,7 +16967,7 @@ async def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17107,10 +16989,10 @@ async def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17118,15 +17000,15 @@ async def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17255,10 +17137,11 @@ async def begin_create_or_update_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -17338,7 +17221,6 @@ async def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17491,7 +17373,6 @@ async def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17506,11 +17387,7 @@ async def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17562,7 +17439,6 @@ async def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17577,7 +17453,7 @@ async def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17710,7 +17586,6 @@ async def apply_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17856,7 +17731,6 @@ async def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17871,7 +17745,7 @@ async def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17923,7 +17797,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17939,7 +17812,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18014,7 +17886,6 @@ async def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18029,7 +17900,7 @@ async def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18084,7 +17955,6 @@ async def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18250,7 +18120,6 @@ async def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18265,14 +18134,14 @@ async def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -18280,7 +18149,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18294,7 +18163,7 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -18317,10 +18186,10 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -18328,12 +18197,20 @@ async def _restore_slot_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_slot( @@ -18445,7 +18322,7 @@ async def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_slot_initial( # type: ignore + raw_result = await self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -18458,6 +18335,7 @@ async def begin_restore_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -18526,7 +18404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18542,7 +18419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18613,7 +18489,6 @@ async def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18628,7 +18503,7 @@ async def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18762,7 +18637,6 @@ async def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18777,7 +18651,7 @@ async def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18825,7 +18699,6 @@ async def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18840,7 +18713,7 @@ async def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18974,7 +18847,6 @@ async def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18989,7 +18861,7 @@ async def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19042,7 +18914,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -19058,7 +18929,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19214,7 +19084,6 @@ async def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19229,7 +19098,7 @@ async def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19278,7 +19147,6 @@ async def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19293,7 +19161,7 @@ async def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19426,7 +19294,6 @@ async def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19441,7 +19308,7 @@ async def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19490,7 +19357,6 @@ async def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19505,7 +19371,7 @@ async def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19554,7 +19420,6 @@ async def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19569,7 +19434,7 @@ async def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19705,7 +19570,6 @@ async def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19720,7 +19584,7 @@ async def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19769,7 +19633,6 @@ async def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19784,7 +19647,7 @@ async def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19919,7 +19782,6 @@ async def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19934,7 +19796,7 @@ async def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19983,7 +19845,6 @@ async def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19998,7 +19859,7 @@ async def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20131,7 +19992,6 @@ async def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20146,7 +20006,7 @@ async def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20195,7 +20055,6 @@ async def delete_backup_configuration_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20255,7 +20114,6 @@ async def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20270,7 +20128,7 @@ async def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20322,7 +20180,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20338,7 +20195,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20412,7 +20268,6 @@ async def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20427,7 +20282,7 @@ async def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20479,7 +20334,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20495,7 +20349,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20569,7 +20422,6 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20584,7 +20436,7 @@ async def get_site_connection_string_key_vault_reference_slot( # pylint: disabl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20720,7 +20572,6 @@ async def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20735,7 +20586,7 @@ async def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20784,7 +20635,6 @@ async def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20799,7 +20649,7 @@ async def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20848,7 +20698,6 @@ async def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20863,7 +20712,7 @@ async def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20999,7 +20848,6 @@ async def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21014,7 +20862,7 @@ async def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21147,7 +20995,6 @@ async def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21162,7 +21009,7 @@ async def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21211,7 +21058,6 @@ async def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21226,7 +21072,7 @@ async def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21235,7 +21081,7 @@ async def list_metadata_slot( async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21248,7 +21094,7 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -21259,10 +21105,10 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21270,11 +21116,15 @@ async def _list_publishing_credentials_slot_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21319,10 +21169,11 @@ async def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21470,7 +21321,6 @@ async def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21485,7 +21335,7 @@ async def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21534,7 +21384,6 @@ async def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21549,7 +21398,7 @@ async def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21600,7 +21449,6 @@ async def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21615,7 +21463,7 @@ async def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21748,7 +21596,6 @@ async def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21763,7 +21610,7 @@ async def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21896,7 +21743,6 @@ async def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21911,7 +21757,7 @@ async def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21967,7 +21813,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21983,7 +21828,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22058,7 +21902,6 @@ async def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22073,7 +21916,7 @@ async def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22125,7 +21968,6 @@ async def recover_site_configuration_snapshot_slot( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22185,9 +22027,9 @@ async def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22196,12 +22038,16 @@ async def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22250,9 +22096,9 @@ async def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22261,12 +22107,16 @@ async def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22319,7 +22169,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22335,7 +22184,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22413,7 +22261,6 @@ async def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22428,7 +22275,7 @@ async def get_continuous_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22480,7 +22327,6 @@ async def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22546,7 +22392,6 @@ async def start_continuous_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22612,7 +22457,6 @@ async def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22676,7 +22520,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22692,7 +22535,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22724,7 +22566,7 @@ async def get_next(next_link=None): async def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, deployment_status_id: str, **kwargs: Any - ) -> _models.CsmDeploymentStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22737,7 +22579,7 @@ async def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CsmDeploymentStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_get_slot_site_deployment_status_slot_request( resource_group_name=resource_group_name, @@ -22749,10 +22591,10 @@ async def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22760,15 +22602,15 @@ async def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22818,10 +22660,11 @@ async def begin_get_slot_site_deployment_status_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22888,7 +22731,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22904,7 +22746,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22979,7 +22820,6 @@ async def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22994,7 +22834,7 @@ async def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23137,7 +22977,6 @@ async def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23152,7 +22991,7 @@ async def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23204,7 +23043,6 @@ async def delete_deployment_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23268,7 +23106,6 @@ async def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23283,7 +23120,7 @@ async def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23424,7 +23261,6 @@ async def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23439,7 +23275,7 @@ async def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23491,7 +23327,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23507,7 +23342,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23582,7 +23416,6 @@ async def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23597,7 +23430,7 @@ async def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23745,7 +23578,6 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23760,7 +23592,7 @@ async def create_or_update_domain_ownership_identifier_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23812,7 +23644,6 @@ async def delete_domain_ownership_identifier_slot( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23971,7 +23802,6 @@ async def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23986,7 +23816,7 @@ async def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24035,7 +23865,6 @@ async def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24050,7 +23879,7 @@ async def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24064,7 +23893,7 @@ async def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24081,7 +23910,7 @@ async def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24103,10 +23932,10 @@ async def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24114,11 +23943,15 @@ async def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24241,10 +24074,11 @@ async def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24311,7 +24145,6 @@ async def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24326,7 +24159,7 @@ async def get_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24381,7 +24214,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24397,7 +24229,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24469,7 +24300,6 @@ async def get_functions_admin_token_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24484,7 +24314,7 @@ async def get_functions_admin_token_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24538,7 +24368,6 @@ async def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24553,7 +24382,7 @@ async def get_instance_function_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24568,7 +24397,7 @@ async def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24582,7 +24411,7 @@ async def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24605,10 +24434,10 @@ async def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24616,11 +24445,15 @@ async def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24750,10 +24583,11 @@ async def begin_create_instance_function_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24822,7 +24656,6 @@ async def delete_instance_function_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24983,7 +24816,6 @@ async def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24998,11 +24830,7 @@ async def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25059,7 +24887,6 @@ async def delete_function_secret_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25121,7 +24948,6 @@ async def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25136,7 +24962,7 @@ async def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25187,7 +25013,6 @@ async def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25202,7 +25027,7 @@ async def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25250,7 +25075,6 @@ async def list_host_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25265,7 +25089,7 @@ async def list_host_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25313,7 +25137,6 @@ async def list_sync_status_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25372,7 +25195,6 @@ async def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25533,7 +25355,6 @@ async def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25548,11 +25369,7 @@ async def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25609,7 +25426,6 @@ async def delete_host_secret_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25673,7 +25489,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25689,7 +25504,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25764,7 +25578,6 @@ async def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25779,7 +25592,7 @@ async def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25924,7 +25737,6 @@ async def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25939,7 +25751,7 @@ async def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25991,7 +25803,6 @@ async def delete_host_name_binding_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26056,7 +25867,6 @@ async def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26071,7 +25881,7 @@ async def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26221,7 +26031,6 @@ async def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26236,7 +26045,7 @@ async def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26293,7 +26102,6 @@ async def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26454,7 +26262,6 @@ async def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26469,7 +26276,7 @@ async def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26517,7 +26324,6 @@ async def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26532,7 +26338,7 @@ async def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26582,7 +26388,6 @@ async def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26597,7 +26402,7 @@ async def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26649,7 +26454,6 @@ async def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26664,7 +26468,7 @@ async def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26811,7 +26615,6 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26826,7 +26629,7 @@ async def create_or_update_relay_service_connection_slot( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26881,7 +26684,6 @@ async def delete_relay_service_connection_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27039,7 +26841,6 @@ async def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27054,7 +26855,7 @@ async def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27108,7 +26909,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27124,7 +26924,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27199,7 +26998,6 @@ async def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27214,7 +27012,7 @@ async def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27266,7 +27064,6 @@ async def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27281,7 +27078,7 @@ async def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27296,7 +27093,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27313,7 +27110,7 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -27336,10 +27133,10 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -27347,11 +27144,15 @@ async def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable= response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27484,10 +27285,11 @@ async def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=nam params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27557,7 +27359,6 @@ async def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27572,7 +27373,7 @@ async def get_instance_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27633,7 +27434,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27649,7 +27449,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27732,7 +27531,6 @@ async def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27747,7 +27545,7 @@ async def get_instance_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27808,7 +27606,6 @@ async def delete_instance_process_slot( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27879,9 +27676,9 @@ async def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27890,11 +27687,15 @@ async def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27959,7 +27760,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27975,7 +27775,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28068,7 +27867,6 @@ async def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28083,7 +27881,7 @@ async def get_instance_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28147,7 +27945,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28163,7 +27960,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28235,7 +28031,6 @@ async def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28250,7 +28045,7 @@ async def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28302,7 +28097,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -28318,7 +28112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -28389,7 +28182,6 @@ async def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28404,7 +28196,7 @@ async def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28454,7 +28246,6 @@ async def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28469,7 +28260,7 @@ async def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28518,7 +28309,6 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28533,7 +28323,7 @@ async def get_swift_virtual_network_connection_slot( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28686,7 +28476,6 @@ async def create_or_update_swift_virtual_network_connection_with_check_slot( # headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28701,7 +28490,7 @@ async def create_or_update_swift_virtual_network_connection_with_check_slot( # error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28753,7 +28542,6 @@ async def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28917,7 +28705,6 @@ async def update_swift_virtual_network_connection_with_check_slot( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28932,7 +28719,7 @@ async def update_swift_virtual_network_connection_with_check_slot( # pylint: di error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28987,7 +28774,6 @@ async def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29002,7 +28788,7 @@ async def list_network_features_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29055,7 +28841,6 @@ async def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29070,11 +28855,7 @@ async def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29138,7 +28919,6 @@ async def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29153,7 +28933,7 @@ async def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29169,7 +28949,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29182,7 +28962,7 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -29196,10 +28976,10 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29207,15 +28987,15 @@ async def _start_web_site_network_trace_operation_slot_initial( # pylint: disab response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29277,10 +29057,11 @@ async def begin_start_web_site_network_trace_operation_slot( # pylint: disable= params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29343,7 +29124,6 @@ async def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29407,7 +29187,6 @@ async def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29422,7 +29201,7 @@ async def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29475,7 +29254,6 @@ async def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29490,11 +29268,7 @@ async def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29547,7 +29321,6 @@ async def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29562,7 +29335,7 @@ async def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29612,7 +29385,6 @@ async def generate_new_site_publishing_password_slot( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29681,7 +29453,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29697,7 +29468,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29769,7 +29539,6 @@ async def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29784,7 +29553,7 @@ async def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29833,7 +29602,6 @@ async def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29848,7 +29616,7 @@ async def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29900,7 +29668,6 @@ async def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29915,7 +29682,7 @@ async def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30058,7 +29825,6 @@ async def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30073,7 +29839,7 @@ async def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30125,7 +29891,6 @@ async def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30279,7 +30044,6 @@ async def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30294,7 +30058,7 @@ async def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30344,7 +30108,6 @@ async def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30359,7 +30122,7 @@ async def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30495,7 +30258,6 @@ async def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30510,7 +30272,7 @@ async def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30563,7 +30325,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30579,7 +30340,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30653,7 +30413,6 @@ async def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30668,7 +30427,7 @@ async def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30683,7 +30442,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30697,7 +30456,7 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30720,10 +30479,10 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30731,15 +30490,15 @@ async def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30874,10 +30633,13 @@ async def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: d params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30901,7 +30663,7 @@ def get_long_running_output(pipeline_response): async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30914,7 +30676,7 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -30926,10 +30688,10 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30937,18 +30699,15 @@ async def _delete_private_endpoint_connection_slot_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30995,10 +30754,11 @@ async def begin_delete_private_endpoint_connection_slot( # pylint: disable=name params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31059,7 +30819,6 @@ async def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31074,7 +30833,7 @@ async def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31131,7 +30890,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31147,7 +30905,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31226,7 +30983,6 @@ async def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31241,7 +30997,7 @@ async def get_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31298,7 +31054,6 @@ async def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31365,9 +31120,9 @@ async def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -31376,11 +31131,15 @@ async def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31441,7 +31200,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31457,7 +31215,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31539,7 +31296,6 @@ async def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31554,7 +31310,7 @@ async def get_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31614,7 +31370,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31630,7 +31385,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31706,7 +31460,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31722,7 +31475,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31797,7 +31549,6 @@ async def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31812,7 +31563,7 @@ async def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31957,7 +31708,6 @@ async def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31972,7 +31722,7 @@ async def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32024,7 +31774,6 @@ async def delete_public_certificate_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32173,9 +31922,9 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -32184,11 +31933,15 @@ async def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32239,7 +31992,6 @@ async def reset_slot_configuration_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32314,7 +32066,6 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32332,14 +32083,14 @@ async def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32353,7 +32104,7 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32375,10 +32126,10 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32386,12 +32137,20 @@ async def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_backup_blob_slot( @@ -32494,7 +32253,7 @@ async def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = await self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -32506,6 +32265,7 @@ async def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32527,14 +32287,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32548,7 +32308,7 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32570,10 +32330,10 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32581,12 +32341,20 @@ async def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsisten response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_from_deleted_app_slot( @@ -32689,7 +32457,7 @@ async def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = await self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -32701,6 +32469,7 @@ async def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32722,14 +32491,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + async def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32743,7 +32512,7 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32765,10 +32534,10 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32776,12 +32545,20 @@ async def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_snapshot_slot( @@ -32887,7 +32664,7 @@ async def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_snapshot_slot_initial( # type: ignore + raw_result = await self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -32899,6 +32676,7 @@ async def begin_restore_snapshot_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32966,7 +32744,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32982,7 +32759,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33057,7 +32833,6 @@ async def get_site_container_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33072,7 +32847,7 @@ async def get_site_container_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteContainer", pipeline_response) + deserialized = self._deserialize("SiteContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33214,7 +32989,6 @@ async def create_or_update_site_container_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33229,11 +33003,7 @@ async def create_or_update_site_container_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteContainer", pipeline_response) + deserialized = self._deserialize("SiteContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33285,7 +33055,6 @@ async def delete_site_container_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33352,7 +33121,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33368,7 +33136,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33446,7 +33213,6 @@ async def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33461,7 +33227,7 @@ async def get_site_extension_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33470,7 +33236,7 @@ async def get_site_extension_slot( async def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33487,7 +33253,7 @@ async def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -33499,10 +33265,10 @@ async def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33510,15 +33276,15 @@ async def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33568,10 +33334,11 @@ async def begin_install_site_extension_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33641,7 +33408,6 @@ async def delete_site_extension_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33790,7 +33556,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33806,7 +33571,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33836,14 +33600,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33857,7 +33621,7 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33879,10 +33643,10 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33890,12 +33654,20 @@ async def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot( @@ -33998,7 +33770,7 @@ async def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_initial( # type: ignore + raw_result = await self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -34010,6 +33782,7 @@ async def begin_swap_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -34075,7 +33848,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34091,7 +33863,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34165,7 +33936,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34181,7 +33951,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34253,7 +34022,6 @@ async def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34268,14 +34036,7 @@ async def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34289,7 +34050,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34303,7 +34064,7 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -34325,10 +34086,10 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34336,18 +34097,15 @@ async def _create_or_update_source_control_slot_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34475,10 +34233,11 @@ async def begin_create_or_update_source_control_slot( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -34548,7 +34307,6 @@ async def delete_source_control_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34694,7 +34452,6 @@ async def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34709,14 +34466,7 @@ async def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34765,7 +34515,6 @@ async def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34792,7 +34541,7 @@ async def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34805,7 +34554,7 @@ async def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -34819,10 +34568,10 @@ async def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34830,15 +34579,15 @@ async def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34900,10 +34649,11 @@ async def begin_start_network_trace_slot( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -34967,7 +34717,6 @@ async def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35026,7 +34775,6 @@ async def stop_network_trace_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35086,7 +34834,6 @@ async def sync_repository_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35145,7 +34892,6 @@ async def sync_function_triggers_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35209,7 +34955,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35225,7 +34970,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35303,7 +35047,6 @@ async def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35318,7 +35061,7 @@ async def get_triggered_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35370,7 +35113,6 @@ async def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35440,7 +35182,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35456,7 +35197,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35538,7 +35278,6 @@ async def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35553,7 +35292,7 @@ async def get_triggered_web_job_history_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35608,7 +35347,6 @@ async def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35678,7 +35416,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35694,7 +35431,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35766,7 +35502,6 @@ async def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35781,7 +35516,7 @@ async def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35833,7 +35568,6 @@ async def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35848,7 +35582,7 @@ async def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35999,7 +35733,6 @@ async def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36014,7 +35747,7 @@ async def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36070,7 +35803,6 @@ async def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36232,7 +35964,6 @@ async def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36247,7 +35978,7 @@ async def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36306,7 +36037,6 @@ async def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36321,7 +36051,7 @@ async def get_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36477,7 +36207,6 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36492,7 +36221,7 @@ async def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36648,7 +36377,6 @@ async def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36663,7 +36391,7 @@ async def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36715,7 +36443,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36731,7 +36458,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36806,7 +36532,6 @@ async def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36821,7 +36546,7 @@ async def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36946,7 +36671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36962,7 +36686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36992,13 +36715,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + async def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37012,7 +36735,7 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -37033,10 +36756,10 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -37044,12 +36767,20 @@ async def _swap_slot_with_production_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_swap_slot_with_production( @@ -37140,7 +36871,7 @@ async def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._swap_slot_with_production_initial( # type: ignore + raw_result = await self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -37151,6 +36882,7 @@ async def begin_swap_slot_with_production( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -37211,7 +36943,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37227,7 +36958,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37298,7 +37028,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -37314,7 +37043,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -37380,7 +37108,6 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37395,14 +37122,7 @@ async def get_source_control(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37415,7 +37135,7 @@ async def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37429,7 +37149,7 @@ async def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -37450,10 +37170,10 @@ async def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -37461,18 +37181,15 @@ async def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37587,10 +37304,11 @@ async def begin_create_or_update_source_control( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -37656,7 +37374,6 @@ async def delete_source_control( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37789,7 +37506,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37804,14 +37520,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37856,7 +37565,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37882,7 +37590,7 @@ async def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37895,7 +37603,7 @@ async def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -37908,10 +37616,10 @@ async def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -37919,15 +37627,15 @@ async def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37985,10 +37693,11 @@ async def begin_start_network_trace( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -38048,7 +37757,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38104,7 +37812,6 @@ async def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38160,7 +37867,6 @@ async def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38216,7 +37922,6 @@ async def sync_function_triggers( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38276,7 +37981,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38292,7 +37996,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38366,7 +38069,6 @@ async def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38381,7 +38083,7 @@ async def get_triggered_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38429,7 +38131,6 @@ async def delete_triggered_web_job( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38495,7 +38196,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38511,7 +38211,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38589,7 +38288,6 @@ async def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38604,7 +38302,7 @@ async def get_triggered_web_job_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38655,7 +38353,6 @@ async def run_triggered_web_job( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38721,7 +38418,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38737,7 +38433,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38805,7 +38500,6 @@ async def list_vnet_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38820,7 +38514,7 @@ async def list_vnet_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38868,7 +38562,6 @@ async def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38883,7 +38576,7 @@ async def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39021,7 +38714,6 @@ async def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39036,7 +38728,7 @@ async def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39088,7 +38780,6 @@ async def delete_vnet_connection( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39237,7 +38928,6 @@ async def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39252,7 +38942,7 @@ async def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39307,7 +38997,6 @@ async def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39322,7 +39011,7 @@ async def get_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39465,7 +39154,6 @@ async def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39480,7 +39168,7 @@ async def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39623,7 +39311,6 @@ async def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39638,7 +39325,7 @@ async def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39684,7 +39371,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39700,7 +39386,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39771,7 +39456,6 @@ async def get_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39786,7 +39470,7 @@ async def get_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39911,7 +39595,6 @@ async def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40057,7 +39740,6 @@ async def deploy_workflow_artifacts_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40120,7 +39802,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40136,7 +39817,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40213,7 +39893,6 @@ async def get_instance_workflow_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40228,7 +39907,7 @@ async def get_instance_workflow_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40276,7 +39955,6 @@ async def list_workflows_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40291,7 +39969,7 @@ async def list_workflows_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40340,7 +40018,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40356,7 +40033,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40430,7 +40106,6 @@ async def get_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40445,7 +40120,7 @@ async def get_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40490,7 +40165,6 @@ async def list_workflows_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40505,7 +40179,7 @@ async def list_workflows_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_web_site_management_client_operations.py index a50fe21b28988..1e742a3f146fc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_web_site_management_client_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._web_site_management_client_operations import ( build_check_name_availability_request, build_get_publishing_user_request, @@ -98,7 +96,6 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +110,7 @@ async def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -202,7 +199,6 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -217,7 +213,7 @@ async def update_publishing_user(self, user_details: Union[_models.User, IO[byte error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -259,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -275,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -339,7 +333,6 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +347,7 @@ async def get_source_control(self, source_control_type: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -462,7 +455,6 @@ async def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -477,7 +469,7 @@ async def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -528,7 +520,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -544,7 +535,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -634,7 +624,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -649,7 +638,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -697,7 +686,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -713,7 +701,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -776,7 +763,6 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -791,7 +777,7 @@ async def get_subscription_deployment_locations(self, **kwargs: Any) -> _models. error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -833,7 +819,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -849,7 +834,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -939,7 +923,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -955,7 +938,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1075,7 +1057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1091,7 +1072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1157,7 +1137,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1173,7 +1152,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1235,7 +1213,6 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1250,7 +1227,7 @@ async def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1349,7 +1326,6 @@ async def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1364,7 +1340,7 @@ async def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1477,7 +1453,6 @@ async def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1597,7 +1572,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1612,7 +1586,7 @@ async def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1725,7 +1699,6 @@ async def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_action_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_action_repetitions_operations.py index 09f51e62d5d6c..1731ac72c1d3c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_action_repetitions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_action_repetitions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_run_action_repetitions_operations import ( build_get_request, build_list_expression_traces_request, @@ -114,7 +112,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -130,7 +127,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -215,7 +211,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -230,7 +225,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response) + deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -312,7 +306,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_action_repetitions_request_histories_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_action_repetitions_request_histories_operations.py index b41162496e64e..594eccaf8cea0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_action_repetitions_request_histories_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_action_repetitions_request_histories_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_run_action_repetitions_request_histories_operations import ( build_get_request, build_list_request, @@ -122,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -138,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -227,7 +223,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +237,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RequestHistory", pipeline_response) + deserialized = self._deserialize("RequestHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_action_scope_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_action_scope_repetitions_operations.py index 8a794d6f72994..217c30c5e3bee 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_action_scope_repetitions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_action_scope_repetitions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_run_action_scope_repetitions_operations import build_get_request, build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -110,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -211,7 +207,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +221,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response) + deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_actions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_actions_operations.py index 38cf8bdbc6012..244773dd1044a 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_actions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_run_actions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_run_actions_operations import ( build_get_request, build_list_expression_traces_request, @@ -124,7 +122,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -140,7 +137,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -215,7 +211,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -230,7 +225,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunAction", pipeline_response) + deserialized = self._deserialize("WorkflowRunAction", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -286,7 +281,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -302,7 +296,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_runs_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_runs_operations.py index 731c38cafafae..cee444fcd1916 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_runs_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_runs_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_runs_operations import build_cancel_request, build_get_request, build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -115,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -131,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -203,7 +199,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -218,7 +213,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRun", pipeline_response) + deserialized = self._deserialize("WorkflowRun", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -267,7 +262,6 @@ async def cancel( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_trigger_histories_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_trigger_histories_operations.py index 55cc2da8fab4e..2553b59965d8b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_trigger_histories_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_trigger_histories_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_trigger_histories_operations import ( build_get_request, build_list_request, @@ -127,7 +127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -143,7 +142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -225,7 +223,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -240,14 +237,14 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTriggerHistory", pipeline_response) + deserialized = self._deserialize("WorkflowTriggerHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _resubmit_initial( # pylint: disable=inconsistent-return-statements + async def _resubmit_initial( self, resource_group_name: str, name: str, @@ -255,7 +252,7 @@ async def _resubmit_initial( # pylint: disable=inconsistent-return-statements trigger_name: str, history_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -268,7 +265,7 @@ async def _resubmit_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resubmit_request( resource_group_name=resource_group_name, @@ -281,10 +278,10 @@ async def _resubmit_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -292,12 +289,20 @@ async def _resubmit_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_resubmit( @@ -335,7 +340,7 @@ async def begin_resubmit( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._resubmit_initial( # type: ignore + raw_result = await self._resubmit_initial( resource_group_name=resource_group_name, name=name, workflow_name=workflow_name, @@ -347,6 +352,7 @@ async def begin_resubmit( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_triggers_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_triggers_operations.py index 12ffdea6b4ca5..e0c6dc9199ff8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_triggers_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_triggers_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_triggers_operations import ( build_get_request, build_get_schema_json_request, @@ -123,7 +123,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +138,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -211,7 +209,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +223,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTrigger", pipeline_response) + deserialized = self._deserialize("WorkflowTrigger", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -275,7 +272,6 @@ async def list_callback_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -290,16 +286,16 @@ async def list_callback_url( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTriggerCallbackUrl", pipeline_response) + deserialized = self._deserialize("WorkflowTriggerCallbackUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _run_initial( # pylint: disable=inconsistent-return-statements + async def _run_initial( self, resource_group_name: str, name: str, workflow_name: str, trigger_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -312,7 +308,7 @@ async def _run_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_run_request( resource_group_name=resource_group_name, @@ -324,10 +320,10 @@ async def _run_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -335,12 +331,20 @@ async def _run_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_run( @@ -369,7 +373,7 @@ async def begin_run( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._run_initial( # type: ignore + raw_result = await self._run_initial( resource_group_name=resource_group_name, name=name, workflow_name=workflow_name, @@ -380,6 +384,7 @@ async def begin_run( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -443,7 +448,6 @@ async def get_schema_json( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -458,7 +462,7 @@ async def get_schema_json( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JsonSchema", pipeline_response) + deserialized = self._deserialize("JsonSchema", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_versions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_versions_operations.py index 727945878f8ea..05f9721e4ff04 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_versions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflow_versions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflow_versions_operations import build_get_request, build_list_request from .._vendor import WebSiteManagementClientMixinABC @@ -106,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -122,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -194,7 +190,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +204,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowVersion", pipeline_response) + deserialized = self._deserialize("WorkflowVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflows_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflows_operations.py index 0eb11795fd02f..bc387e7ffd27e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflows_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/aio/operations/_workflows_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._workflows_operations import build_regenerate_access_key_request, build_validate_request from .._vendor import WebSiteManagementClientMixinABC @@ -175,7 +173,6 @@ async def regenerate_access_key( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -309,7 +306,6 @@ async def validate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/models/_models_py3.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/models/_models_py3.py index d7e02be7492a4..6db4e1175592e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/models/_models_py3.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/models/_models_py3.py @@ -11340,15 +11340,15 @@ class FunctionsAlwaysReadyConfig(_serialization.Model): :vartype name: str :ivar instance_count: Sets the number of 'Always Ready' instances for a given function group or a specific function. For additional information see https://aka.ms/flexconsumption/alwaysready. - :vartype instance_count: float + :vartype instance_count: int """ _attribute_map = { "name": {"key": "name", "type": "str"}, - "instance_count": {"key": "instanceCount", "type": "float"}, + "instance_count": {"key": "instanceCount", "type": "int"}, } - def __init__(self, *, name: Optional[str] = None, instance_count: Optional[float] = None, **kwargs: Any) -> None: + def __init__(self, *, name: Optional[str] = None, instance_count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword name: Either a function group or a function name is required. For additional information see https://aka.ms/flexconsumption/alwaysready. @@ -11356,7 +11356,7 @@ def __init__(self, *, name: Optional[str] = None, instance_count: Optional[float :keyword instance_count: Sets the number of 'Always Ready' instances for a given function group or a specific function. For additional information see https://aka.ms/flexconsumption/alwaysready. - :paramtype instance_count: float + :paramtype instance_count: int """ super().__init__(**kwargs) self.name = name @@ -11547,18 +11547,18 @@ class FunctionsScaleAndConcurrency(_serialization.Model): :ivar always_ready: 'Always Ready' configuration for the function app. :vartype always_ready: list[~azure.mgmt.web.v2023_12_01.models.FunctionsAlwaysReadyConfig] :ivar maximum_instance_count: The maximum number of instances for the function app. - :vartype maximum_instance_count: float + :vartype maximum_instance_count: int :ivar instance_memory_mb: Set the amount of memory allocated to each instance of the function app in MB. CPU and network bandwidth are allocated proportionally. - :vartype instance_memory_mb: float + :vartype instance_memory_mb: int :ivar triggers: Scale and concurrency settings for the function app triggers. :vartype triggers: ~azure.mgmt.web.v2023_12_01.models.FunctionsScaleAndConcurrencyTriggers """ _attribute_map = { "always_ready": {"key": "alwaysReady", "type": "[FunctionsAlwaysReadyConfig]"}, - "maximum_instance_count": {"key": "maximumInstanceCount", "type": "float"}, - "instance_memory_mb": {"key": "instanceMemoryMB", "type": "float"}, + "maximum_instance_count": {"key": "maximumInstanceCount", "type": "int"}, + "instance_memory_mb": {"key": "instanceMemoryMB", "type": "int"}, "triggers": {"key": "triggers", "type": "FunctionsScaleAndConcurrencyTriggers"}, } @@ -11566,8 +11566,8 @@ def __init__( self, *, always_ready: Optional[List["_models.FunctionsAlwaysReadyConfig"]] = None, - maximum_instance_count: Optional[float] = None, - instance_memory_mb: Optional[float] = None, + maximum_instance_count: Optional[int] = None, + instance_memory_mb: Optional[int] = None, triggers: Optional["_models.FunctionsScaleAndConcurrencyTriggers"] = None, **kwargs: Any ) -> None: @@ -11575,10 +11575,10 @@ def __init__( :keyword always_ready: 'Always Ready' configuration for the function app. :paramtype always_ready: list[~azure.mgmt.web.v2023_12_01.models.FunctionsAlwaysReadyConfig] :keyword maximum_instance_count: The maximum number of instances for the function app. - :paramtype maximum_instance_count: float + :paramtype maximum_instance_count: int :keyword instance_memory_mb: Set the amount of memory allocated to each instance of the function app in MB. CPU and network bandwidth are allocated proportionally. - :paramtype instance_memory_mb: float + :paramtype instance_memory_mb: int :keyword triggers: Scale and concurrency settings for the function app triggers. :paramtype triggers: ~azure.mgmt.web.v2023_12_01.models.FunctionsScaleAndConcurrencyTriggers """ @@ -11616,18 +11616,18 @@ class FunctionsScaleAndConcurrencyTriggersHttp(_serialization.Model): :ivar per_instance_concurrency: The maximum number of concurrent HTTP trigger invocations per instance. - :vartype per_instance_concurrency: float + :vartype per_instance_concurrency: int """ _attribute_map = { - "per_instance_concurrency": {"key": "perInstanceConcurrency", "type": "float"}, + "per_instance_concurrency": {"key": "perInstanceConcurrency", "type": "int"}, } - def __init__(self, *, per_instance_concurrency: Optional[float] = None, **kwargs: Any) -> None: + def __init__(self, *, per_instance_concurrency: Optional[int] = None, **kwargs: Any) -> None: """ :keyword per_instance_concurrency: The maximum number of concurrent HTTP trigger invocations per instance. - :paramtype per_instance_concurrency: float + :paramtype per_instance_concurrency: int """ super().__init__(**kwargs) self.per_instance_concurrency = per_instance_concurrency @@ -30096,7 +30096,7 @@ class WorkflowParameter(_serialization.Model): """The workflow parameters. :ivar type: The type. Known values are: "NotSpecified", "String", "SecureString", "Int", - "Float", "Bool", "Array", "Object", and "SecureObject". + "Float", "Bool", "Array", "Object", "SecureObject", and "Int". :vartype type: str or ~azure.mgmt.web.v2023_12_01.models.ParameterType :ivar value: The value. :vartype value: JSON @@ -30124,7 +30124,7 @@ def __init__( ) -> None: """ :keyword type: The type. Known values are: "NotSpecified", "String", "SecureString", "Int", - "Float", "Bool", "Array", "Object", and "SecureObject". + "Float", "Bool", "Array", "Object", "SecureObject", and "Int". :paramtype type: str or ~azure.mgmt.web.v2023_12_01.models.ParameterType :keyword value: The value. :paramtype value: JSON @@ -30146,7 +30146,7 @@ class WorkflowOutputParameter(WorkflowParameter): Variables are only populated by the server, and will be ignored when sending a request. :ivar type: The type. Known values are: "NotSpecified", "String", "SecureString", "Int", - "Float", "Bool", "Array", "Object", and "SecureObject". + "Float", "Bool", "Array", "Object", "SecureObject", and "Int". :vartype type: str or ~azure.mgmt.web.v2023_12_01.models.ParameterType :ivar value: The value. :vartype value: JSON @@ -30181,7 +30181,7 @@ def __init__( ) -> None: """ :keyword type: The type. Known values are: "NotSpecified", "String", "SecureString", "Int", - "Float", "Bool", "Array", "Object", and "SecureObject". + "Float", "Bool", "Array", "Object", "SecureObject", and "Int". :paramtype type: str or ~azure.mgmt.web.v2023_12_01.models.ParameterType :keyword value: The value. :paramtype value: JSON diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/models/_web_site_management_client_enums.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/models/_web_site_management_client_enums.py index fbf349ffeb326..7b7c189044d47 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/models/_web_site_management_client_enums.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/models/_web_site_management_client_enums.py @@ -702,12 +702,13 @@ class ParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NOT_SPECIFIED = "NotSpecified" STRING = "String" SECURE_STRING = "SecureString" - INT_ENUM = "Int" + INT = "Int" FLOAT = "Float" BOOL = "Bool" ARRAY = "Array" OBJECT = "Object" SECURE_OBJECT = "SecureObject" + INT_ENUM = "Int" class ProviderOsTypeSelected(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_app_service_certificate_orders_operations.py index 915e0631e5b1d..72e016e0b2879 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_app_service_certificate_orders_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_app_service_certificate_orders_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -866,7 +867,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -882,7 +882,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1001,7 +1000,6 @@ def validate_purchase_information( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1075,7 +1072,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1143,7 +1139,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1158,7 +1153,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1171,7 +1166,7 @@ def _create_or_update_initial( certificate_order_name: str, certificate_distinguished_name: Union[_models.AppServiceCertificateOrder, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateOrder: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1185,7 +1180,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateOrder] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1206,10 +1201,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1217,15 +1212,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1342,10 +1337,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1405,7 +1401,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1540,7 +1535,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1555,7 +1549,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateOrder", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1605,7 +1599,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1621,7 +1614,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1692,7 +1684,6 @@ def get_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1707,7 +1698,7 @@ def get_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1721,7 +1712,7 @@ def _create_or_update_certificate_initial( name: str, key_vault_certificate: Union[_models.AppServiceCertificateResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceCertificateResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1735,7 +1726,7 @@ def _create_or_update_certificate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceCertificateResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1757,10 +1748,10 @@ def _create_or_update_certificate_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1768,15 +1759,15 @@ def _create_or_update_certificate_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1900,10 +1891,11 @@ def begin_create_or_update_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1966,7 +1958,6 @@ def delete_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2109,7 +2100,6 @@ def update_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2124,7 +2114,7 @@ def update_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response) + deserialized = self._deserialize("AppServiceCertificateResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2246,7 +2236,6 @@ def reissue( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2379,7 +2368,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2435,7 +2423,6 @@ def resend_email( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2569,7 +2556,6 @@ def resend_request_emails( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2718,7 +2704,6 @@ def retrieve_site_seal( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2733,7 +2718,7 @@ def retrieve_site_seal( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteSeal", pipeline_response) + deserialized = self._deserialize("SiteSeal", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2778,7 +2763,6 @@ def verify_domain_ownership( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2834,7 +2818,6 @@ def retrieve_certificate_actions( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2849,7 +2832,7 @@ def retrieve_certificate_actions( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response) + deserialized = self._deserialize("[CertificateOrderAction]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2894,7 +2877,6 @@ def retrieve_certificate_email_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2909,7 +2891,7 @@ def retrieve_certificate_email_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[CertificateEmail]", pipeline_response) + deserialized = self._deserialize("[CertificateEmail]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_app_service_environments_operations.py index 2c1cb90507130..5d8846c5373a3 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_app_service_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_app_service_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1951,7 +1952,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1967,7 +1967,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2037,7 +2036,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2053,7 +2051,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2119,7 +2116,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2134,7 +2130,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2147,7 +2143,7 @@ def _create_or_update_initial( name: str, hosting_environment_envelope: Union[_models.AppServiceEnvironmentResource, IO[bytes]], **kwargs: Any - ) -> _models.AppServiceEnvironmentResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2161,7 +2157,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServiceEnvironmentResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2182,10 +2178,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2193,21 +2189,19 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2324,10 +2318,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2349,9 +2344,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2364,7 +2359,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -2375,10 +2370,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2386,12 +2381,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -2422,7 +2425,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, force_delete=force_delete, @@ -2432,6 +2435,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2570,7 +2574,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2585,14 +2588,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response) + deserialized = self._deserialize("AppServiceEnvironmentResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2638,7 +2634,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2654,7 +2649,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2720,7 +2714,6 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2735,7 +2728,7 @@ def get_vip_info(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddressResponse", pipeline_response) + deserialized = self._deserialize("AddressResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2748,7 +2741,7 @@ def _change_vnet_initial( name: str, vnet_info: Union[_models.VirtualNetworkProfile, IO[bytes]], **kwargs: Any - ) -> _models.WebAppCollection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2762,7 +2755,7 @@ def _change_vnet_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2783,10 +2776,10 @@ def _change_vnet_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2794,15 +2787,15 @@ def _change_vnet_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2931,7 +2924,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2947,13 +2939,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2990,6 +2981,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3055,7 +3047,6 @@ def get_ase_custom_dns_suffix_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3070,7 +3061,7 @@ def get_ase_custom_dns_suffix_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response) + deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3192,7 +3183,6 @@ def update_ase_custom_dns_suffix_configuration( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3207,7 +3197,7 @@ def update_ase_custom_dns_suffix_configuration( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response) + deserialized = self._deserialize("CustomDnsSuffixConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3252,7 +3242,6 @@ def delete_ase_custom_dns_suffix_configuration( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3267,11 +3256,7 @@ def delete_ase_custom_dns_suffix_configuration( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3316,7 +3301,6 @@ def get_ase_v3_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3331,7 +3315,7 @@ def get_ase_v3_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3453,7 +3437,6 @@ def update_ase_networking_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3468,7 +3451,7 @@ def update_ase_networking_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response) + deserialized = self._deserialize("AseV3NetworkingConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3513,7 +3496,6 @@ def list_diagnostics( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3528,7 +3510,7 @@ def list_diagnostics( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response) + deserialized = self._deserialize("[HostingEnvironmentDiagnostics]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3576,7 +3558,6 @@ def get_diagnostics_item( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3591,7 +3572,7 @@ def get_diagnostics_item( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response) + deserialized = self._deserialize("HostingEnvironmentDiagnostics", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3642,7 +3623,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3658,7 +3638,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3729,7 +3708,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3745,7 +3723,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3811,7 +3788,6 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3826,7 +3802,7 @@ def get_multi_role_pool(self, resource_group_name: str, name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3839,7 +3815,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long name: str, multi_role_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3853,7 +3829,7 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3874,10 +3850,10 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3885,15 +3861,15 @@ def _create_or_update_multi_role_pool_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4004,10 +3980,11 @@ def begin_create_or_update_multi_role_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4143,7 +4120,6 @@ def update_multi_role_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4158,11 +4134,7 @@ def update_multi_role_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4217,7 +4189,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4233,7 +4204,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4306,7 +4276,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4322,7 +4291,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4393,7 +4361,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4409,7 +4376,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4477,7 +4443,6 @@ def test_upgrade_available_notification( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4495,9 +4460,7 @@ def test_upgrade_available_notification( # pylint: disable=inconsistent-return- if cls: return cls(pipeline_response, None, {}) # type: ignore - def _upgrade_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _upgrade_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4510,7 +4473,7 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_upgrade_request( resource_group_name=resource_group_name, @@ -4520,10 +4483,10 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4531,12 +4494,20 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -4561,7 +4532,7 @@ def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any) -> L lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._upgrade_initial( # type: ignore + raw_result = self._upgrade_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -4570,6 +4541,7 @@ def begin_upgrade(self, resource_group_name: str, name: str, **kwargs: Any) -> L params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4630,7 +4602,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4646,7 +4617,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4712,7 +4682,6 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4727,7 +4696,7 @@ def list_operations(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Operation]", pipeline_response) + deserialized = self._deserialize("[Operation]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4778,7 +4747,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4794,7 +4762,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4867,7 +4834,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4883,7 +4849,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4954,7 +4919,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4969,7 +4933,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4983,7 +4947,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4997,7 +4961,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5019,10 +4983,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5030,15 +4994,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5163,10 +5127,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5190,7 +5157,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5203,7 +5170,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -5214,10 +5181,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5225,18 +5192,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5280,10 +5244,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5341,7 +5306,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5356,7 +5320,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5401,7 +5365,6 @@ def reboot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5419,7 +5382,7 @@ def reboot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5432,7 +5395,7 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resume_request( resource_group_name=resource_group_name, @@ -5442,10 +5405,10 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5453,15 +5416,15 @@ def _resume_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5510,7 +5473,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5526,13 +5488,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -5567,6 +5528,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5635,7 +5597,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5651,7 +5612,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5726,7 +5686,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5742,7 +5701,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5772,7 +5730,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.WebAppCollection: + def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5785,7 +5743,7 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.WebAppCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_suspend_request( resource_group_name=resource_group_name, @@ -5795,10 +5753,10 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5806,15 +5764,15 @@ def _suspend_initial(self, resource_group_name: str, name: str, **kwargs: Any) - response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WebAppCollection", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5863,7 +5821,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5879,13 +5836,12 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("WebAppCollection", pipeline_response) + deserialized = self._deserialize("WebAppCollection", pipeline_response.http_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -5920,6 +5876,7 @@ def get_next(next_link=None): params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -5994,7 +5951,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6010,7 +5966,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6081,7 +6036,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6097,7 +6051,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6168,7 +6121,6 @@ def get_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6183,7 +6135,7 @@ def get_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6197,7 +6149,7 @@ def _create_or_update_worker_pool_initial( worker_pool_name: str, worker_pool_envelope: Union[_models.WorkerPoolResource, IO[bytes]], **kwargs: Any - ) -> _models.WorkerPoolResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6211,7 +6163,7 @@ def _create_or_update_worker_pool_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkerPoolResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6233,10 +6185,10 @@ def _create_or_update_worker_pool_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6244,15 +6196,15 @@ def _create_or_update_worker_pool_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6372,10 +6324,11 @@ def begin_create_or_update_worker_pool( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6520,7 +6473,6 @@ def update_worker_pool( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6535,11 +6487,7 @@ def update_worker_pool( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("WorkerPoolResource", pipeline_response) + deserialized = self._deserialize("WorkerPoolResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6596,7 +6544,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6612,7 +6559,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6688,7 +6634,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6704,7 +6649,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6778,7 +6722,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6794,7 +6737,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6868,7 +6810,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6884,7 +6825,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_app_service_plans_operations.py index c8be308e0bb38..4f2e2e705eeb6 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_app_service_plans_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_app_service_plans_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1161,7 +1162,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1177,7 +1177,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1243,7 +1242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1259,7 +1257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1328,7 +1325,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1343,7 +1339,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.App error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1356,7 +1352,7 @@ def _create_or_update_initial( name: str, app_service_plan: Union[_models.AppServicePlan, IO[bytes]], **kwargs: Any - ) -> _models.AppServicePlan: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1370,7 +1366,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AppServicePlan] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1391,10 +1387,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1402,15 +1398,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1520,10 +1516,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1583,7 +1580,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1715,7 +1711,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1730,11 +1725,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AppServicePlan", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AppServicePlan", pipeline_response) + deserialized = self._deserialize("AppServicePlan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1777,7 +1768,6 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1792,7 +1782,7 @@ def list_capabilities(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Capability]", pipeline_response) + deserialized = self._deserialize("[Capability]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1843,7 +1833,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1858,7 +1847,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1909,7 +1898,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1971,7 +1959,6 @@ def list_hybrid_connection_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1986,7 +1973,7 @@ def list_hybrid_connection_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionKey", pipeline_response) + deserialized = self._deserialize("HybridConnectionKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2040,7 +2027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2056,7 +2042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2124,7 +2109,6 @@ def get_hybrid_connection_plan_limit( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2139,7 +2123,7 @@ def get_hybrid_connection_plan_limit( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnectionLimits", pipeline_response) + deserialized = self._deserialize("HybridConnectionLimits", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2187,7 +2171,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2203,7 +2186,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2277,7 +2259,6 @@ def restart_web_apps( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2355,7 +2336,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2371,7 +2351,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2437,7 +2416,6 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2452,7 +2430,7 @@ def get_server_farm_skus(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2505,7 +2483,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2521,7 +2498,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2587,7 +2563,6 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2602,7 +2577,7 @@ def list_vnets(self, resource_group_name: str, name: str, **kwargs: Any) -> List error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2653,7 +2628,6 @@ def get_vnet_from_server_farm( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2668,7 +2642,7 @@ def get_vnet_from_server_farm( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2719,7 +2693,6 @@ def get_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2734,7 +2707,7 @@ def get_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2874,7 +2847,6 @@ def update_vnet_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2889,7 +2861,7 @@ def update_vnet_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2938,7 +2910,6 @@ def list_routes_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2953,7 +2924,7 @@ def list_routes_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3007,7 +2978,6 @@ def get_route_for_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3022,7 +2992,7 @@ def get_route_for_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetRoute]", pipeline_response) + deserialized = self._deserialize("[VnetRoute]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3169,7 +3139,6 @@ def create_or_update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3184,7 +3153,7 @@ def create_or_update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3238,7 +3207,6 @@ def delete_vnet_route( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3396,7 +3364,6 @@ def update_vnet_route( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3411,7 +3378,7 @@ def update_vnet_route( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetRoute", pipeline_response) + deserialized = self._deserialize("VnetRoute", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3459,7 +3426,6 @@ def reboot_worker( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_certificate_orders_diagnostics_operations.py index 1d6ce060526ee..9e9af157f1c55 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_certificate_orders_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_certificate_orders_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -195,7 +194,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -211,7 +209,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -300,7 +297,6 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +311,7 @@ def get_app_service_certificate_order_detector_response( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_certificate_registration_provider_operations.py index 78e17daef2437..b6d4ea890b7e8 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_certificate_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_certificate_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_certificates_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_certificates_operations.py index 34021f5bf58a3..fe70b2e7cdb5d 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_certificates_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_certificates_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -312,7 +311,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -328,7 +326,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -394,7 +391,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -410,7 +406,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -476,7 +471,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -491,7 +485,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Cer error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -611,7 +605,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -626,7 +619,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -671,7 +664,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -803,7 +795,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -818,7 +809,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response) + deserialized = self._deserialize("Certificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_container_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_container_apps_operations.py index d4cc81f405767..1b3a341d23dec 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_container_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_container_apps_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -296,7 +297,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -312,7 +312,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -378,7 +377,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +392,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -463,7 +460,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Con headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -478,7 +474,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Con error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -491,7 +487,7 @@ def _create_or_update_initial( name: str, container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any - ) -> _models.ContainerApp: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -505,7 +501,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -526,10 +522,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -537,15 +533,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ContainerApp", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -654,10 +650,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ContainerApp", pipeline_response) + deserialized = self._deserialize("ContainerApp", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -679,9 +676,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -694,7 +689,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -704,10 +699,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -715,12 +710,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -745,7 +748,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -754,6 +757,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -808,7 +812,6 @@ def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollection: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -823,7 +826,7 @@ def list_secrets(self, name: str, **kwargs: Any) -> _models.SecretsCollection: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecretsCollection", pipeline_response) + deserialized = self._deserialize("SecretsCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_container_apps_revisions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_container_apps_revisions_operations.py index 7e3a4c6ed48fa..8069c0c566c37 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_container_apps_revisions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_container_apps_revisions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -296,7 +295,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -312,7 +310,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -383,7 +380,6 @@ def get_revision( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -398,7 +394,7 @@ def get_revision( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Revision", pipeline_response) + deserialized = self._deserialize("Revision", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -446,7 +442,6 @@ def activate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -505,7 +500,6 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -564,7 +558,6 @@ def restart_revision( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_deleted_web_apps_operations.py index 69e737e8f1389..3cd7fce53523e 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_deleted_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_deleted_web_apps_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -176,7 +175,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -192,7 +190,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -274,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -342,7 +337,6 @@ def get_deleted_web_app_by_location( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +351,7 @@ def get_deleted_web_app_by_location( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_diagnostics_operations.py index d4cd615f5232f..012f906dda5ee 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_diagnostics_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_diagnostics_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -1101,7 +1100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1117,7 +1115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1204,7 +1201,6 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1219,7 +1215,7 @@ def get_hosting_environment_detector_response( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1267,7 +1263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1283,7 +1278,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1370,7 +1364,6 @@ def get_site_detector_response( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1385,7 +1378,7 @@ def get_site_detector_response( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1433,7 +1426,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1449,7 +1441,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1520,7 +1511,6 @@ def get_site_diagnostic_category( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1535,7 +1525,7 @@ def get_site_diagnostic_category( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1602,7 +1591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1676,7 +1664,6 @@ def get_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1678,7 @@ def get_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1759,7 +1746,6 @@ def execute_site_analysis( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1774,7 +1760,7 @@ def execute_site_analysis( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1827,7 +1813,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1843,7 +1828,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1917,7 +1901,6 @@ def get_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1932,7 +1915,7 @@ def get_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2000,7 +1983,6 @@ def execute_site_detector( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2015,7 +1997,7 @@ def execute_site_detector( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2066,7 +2048,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2082,7 +2063,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2173,7 +2153,6 @@ def get_site_detector_response_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2188,7 +2167,7 @@ def get_site_detector_response_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorResponse", pipeline_response) + deserialized = self._deserialize("DetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2239,7 +2218,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2255,7 +2233,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2329,7 +2306,6 @@ def get_site_diagnostic_category_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2344,7 +2320,7 @@ def get_site_diagnostic_category_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticCategory", pipeline_response) + deserialized = self._deserialize("DiagnosticCategory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2398,7 +2374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2414,7 +2389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2497,7 +2471,6 @@ def get_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2512,7 +2485,7 @@ def get_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AnalysisDefinition", pipeline_response) + deserialized = self._deserialize("AnalysisDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2584,7 +2557,6 @@ def execute_site_analysis_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2599,7 +2571,7 @@ def execute_site_analysis_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response) + deserialized = self._deserialize("DiagnosticAnalysis", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2655,7 +2627,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2671,7 +2642,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2754,7 +2724,6 @@ def get_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2769,7 +2738,7 @@ def get_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response) + deserialized = self._deserialize("DetectorDefinitionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2841,7 +2810,6 @@ def execute_site_detector_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2856,7 +2824,7 @@ def execute_site_detector_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response) + deserialized = self._deserialize("DiagnosticDetectorResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_domain_registration_provider_operations.py index 1588f4f8ec90e..3b28d11ce4676 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_domain_registration_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_domain_registration_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -116,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_domains_operations.py index 2ce6b921a064f..dd2f437a4aa68 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_domains_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -732,7 +733,6 @@ def check_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +747,7 @@ def check_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("DomainAvailabilityCheckResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -787,7 +787,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -803,7 +802,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -863,7 +861,6 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -878,7 +875,7 @@ def get_control_center_sso_request(self, **kwargs: Any) -> _models.DomainControl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response) + deserialized = self._deserialize("DomainControlCenterSsoRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -975,7 +972,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -991,7 +987,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1057,7 +1052,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1073,7 +1067,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1139,7 +1132,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1154,7 +1146,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1163,7 +1155,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod def _create_or_update_initial( self, resource_group_name: str, domain_name: str, domain: Union[_models.Domain, IO[bytes]], **kwargs: Any - ) -> _models.Domain: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1177,7 +1169,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Domain] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1198,10 +1190,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1209,15 +1201,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1320,10 +1312,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1388,7 +1381,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1519,7 +1511,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1534,11 +1525,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Domain", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1588,7 +1575,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1604,7 +1590,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1675,7 +1660,6 @@ def get_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1690,7 +1674,7 @@ def get_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1829,7 +1813,6 @@ def create_or_update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1844,7 +1827,7 @@ def create_or_update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1892,7 +1875,6 @@ def delete_ownership_identifier( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2042,7 +2024,6 @@ def update_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2057,7 +2038,7 @@ def update_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response) + deserialized = self._deserialize("DomainOwnershipIdentifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2102,7 +2083,6 @@ def renew( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2160,7 +2140,6 @@ def transfer_out(self, resource_group_name: str, domain_name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2175,7 +2154,7 @@ def transfer_out(self, resource_group_name: str, domain_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Domain", pipeline_response) + deserialized = self._deserialize("Domain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_get_usages_in_location_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_get_usages_in_location_operations.py index b7e1e2eaf873d..787e85b352546 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_get_usages_in_location_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_get_usages_in_location_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -125,7 +124,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -141,7 +139,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_global_operations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_global_operations_operations.py index dc1d79542d77a..386a7c768b3e4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_global_operations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_global_operations_operations.py @@ -18,15 +18,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -194,7 +192,7 @@ def get_deleted_web_app(self, deleted_site_id: str, **kwargs: Any) -> _models.De error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedSite", pipeline_response) + deserialized = self._deserialize("DeletedSite", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -234,7 +232,6 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -249,7 +246,7 @@ def get_deleted_web_app_snapshots(self, deleted_site_id: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[Snapshot]", pipeline_response) + deserialized = self._deserialize("[Snapshot]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -294,7 +291,6 @@ def get_subscription_operation_with_async_response( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_kube_environments_operations.py index 4a62a8cc29ae4..32093d8ac57a1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_kube_environments_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_kube_environments_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -308,7 +309,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -324,7 +324,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -390,7 +389,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -406,7 +404,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -472,7 +469,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Kub headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +483,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Kub error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -500,7 +496,7 @@ def _create_or_update_initial( name: str, kube_environment_envelope: Union[_models.KubeEnvironment, IO[bytes]], **kwargs: Any - ) -> _models.KubeEnvironment: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -514,7 +510,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KubeEnvironment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -535,10 +531,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -546,15 +542,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -667,10 +663,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -692,9 +689,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -707,7 +702,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -717,10 +712,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -728,12 +723,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -758,7 +761,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -767,6 +770,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -905,7 +909,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -920,11 +923,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KubeEnvironment", pipeline_response) + deserialized = self._deserialize("KubeEnvironment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_provider_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_provider_operations.py index fd56958c54aab..ee4f3b069837f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_provider_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_provider_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -276,7 +275,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -292,7 +290,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -360,7 +357,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -376,7 +372,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -447,7 +442,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -463,7 +457,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -534,7 +527,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -550,7 +542,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -616,7 +607,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -632,7 +622,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -700,7 +689,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -716,7 +704,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -787,7 +774,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -803,7 +789,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_recommendations_operations.py index 2390ed20fdf19..1ae0d6f8de541 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_recommendations_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_recommendations_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -730,7 +729,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -746,7 +744,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -806,7 +803,6 @@ def reset_all_filters(self, **kwargs: Any) -> None: # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -860,7 +856,6 @@ def disable_recommendation_for_subscription( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -934,7 +929,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -950,7 +944,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1035,7 +1028,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1051,7 +1043,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1122,7 +1113,6 @@ def disable_all_for_hosting_environment( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1181,7 +1171,6 @@ def reset_all_filters_for_hosting_environment( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1254,7 +1243,6 @@ def get_rule_details_by_hosting_environment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1269,7 +1257,7 @@ def get_rule_details_by_hosting_environment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1320,7 +1308,6 @@ def disable_recommendation_for_hosting_environment( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1394,7 +1381,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1410,7 +1396,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1495,7 +1480,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1511,7 +1495,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1579,7 +1562,6 @@ def disable_all_for_web_app( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1635,7 +1617,6 @@ def reset_all_filters_for_web_app( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1708,7 +1689,6 @@ def get_rule_details_by_web_app( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1723,7 +1703,7 @@ def get_rule_details_by_web_app( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationRule", pipeline_response) + deserialized = self._deserialize("RecommendationRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1771,7 +1751,6 @@ def disable_recommendation_for_site( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_resource_health_metadata_operations.py index 85f7f78cac90c..0570bd935b240 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_resource_health_metadata_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_resource_health_metadata_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -390,7 +387,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -406,7 +402,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -479,7 +474,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -495,7 +489,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -561,7 +554,6 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -576,7 +568,7 @@ def get_by_site(self, resource_group_name: str, name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -630,7 +622,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -646,7 +637,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -718,7 +708,6 @@ def get_by_site_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -733,7 +722,7 @@ def get_by_site_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response) + deserialized = self._deserialize("ResourceHealthMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_static_sites_operations.py index 8122b2f901511..3d59203caab9b 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_static_sites_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_static_sites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -3256,7 +3257,6 @@ def preview_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3271,7 +3271,7 @@ def preview_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response) + deserialized = self._deserialize("StaticSitesWorkflowPreview", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3312,7 +3312,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3328,7 +3327,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3397,7 +3395,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3413,7 +3410,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3479,7 +3475,6 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3494,7 +3489,7 @@ def get_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3507,7 +3502,7 @@ def _create_or_update_static_site_initial( name: str, static_site_envelope: Union[_models.StaticSiteARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3521,7 +3516,7 @@ def _create_or_update_static_site_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3542,10 +3537,10 @@ def _create_or_update_static_site_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3553,15 +3548,15 @@ def _create_or_update_static_site_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3677,10 +3672,11 @@ def begin_create_or_update_static_site( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3702,9 +3698,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _delete_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3717,7 +3711,7 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_request( resource_group_name=resource_group_name, @@ -3727,10 +3721,10 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3738,12 +3732,20 @@ def _delete_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -3768,7 +3770,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_initial( # type: ignore + raw_result = self._delete_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -3777,6 +3779,7 @@ def begin_delete_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3917,7 +3920,6 @@ def update_static_site( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3932,11 +3934,7 @@ def update_static_site( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3989,7 +3987,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4005,7 +4002,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4079,7 +4075,6 @@ def delete_static_site_user( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4233,7 +4228,6 @@ def update_static_site_user( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4248,7 +4242,7 @@ def update_static_site_user( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4298,7 +4292,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4314,7 +4307,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4385,7 +4377,6 @@ def get_static_site_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4400,16 +4391,16 @@ def get_static_site_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBuildARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-statements + def _delete_static_site_build_initial( self, resource_group_name: str, name: str, environment_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4422,7 +4413,7 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_build_request( resource_group_name=resource_group_name, @@ -4433,10 +4424,10 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4444,12 +4435,20 @@ def _delete_static_site_build_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_build( @@ -4478,7 +4477,7 @@ def begin_delete_static_site_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_build_initial( # type: ignore + raw_result = self._delete_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -4488,6 +4487,7 @@ def begin_delete_static_site_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4634,7 +4634,6 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4649,7 +4648,7 @@ def create_or_update_static_site_build_app_settings( # pylint: disable=name-too error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4781,7 +4780,6 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4796,7 +4794,7 @@ def create_or_update_static_site_build_function_app_settings( # pylint: disable error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4847,7 +4845,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -4863,7 +4860,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -4937,7 +4933,6 @@ def get_build_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -4952,7 +4947,7 @@ def get_build_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5096,7 +5091,6 @@ def create_or_update_build_database_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5111,7 +5105,7 @@ def create_or_update_build_database_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5162,7 +5156,6 @@ def delete_build_database_connection( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5318,7 +5311,6 @@ def update_build_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5333,7 +5325,7 @@ def update_build_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5384,7 +5376,6 @@ def get_build_database_connection_with_details( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5399,7 +5390,7 @@ def get_build_database_connection_with_details( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5452,7 +5443,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5468,7 +5458,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5539,7 +5528,6 @@ def list_static_site_build_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5554,7 +5542,7 @@ def list_static_site_build_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5602,7 +5590,6 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5617,7 +5604,7 @@ def list_static_site_build_function_app_settings( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5668,7 +5655,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5684,7 +5670,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5761,7 +5746,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -5777,7 +5761,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -5853,7 +5836,6 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -5868,7 +5850,9 @@ def get_user_provided_function_app_for_static_site_build( # pylint: disable=nam error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5886,7 +5870,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5900,7 +5884,7 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -5926,10 +5910,10 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5937,15 +5921,15 @@ def _register_user_provided_function_app_with_static_site_build_initial( # pyli response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6104,10 +6088,13 @@ def begin_register_user_provided_function_app_with_static_site_build( # pylint: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6174,7 +6161,6 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6192,14 +6178,14 @@ def detach_user_provided_function_app_from_static_site_build( # pylint: disable if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, environment_name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6213,7 +6199,7 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6235,10 +6221,10 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6246,12 +6232,20 @@ def _create_zip_deployment_for_static_site_build_initial( # pylint: disable=inc response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-too-long @@ -6356,7 +6350,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_build_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -6368,6 +6362,7 @@ def begin_create_zip_deployment_for_static_site_build( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -6504,7 +6499,6 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6519,7 +6513,7 @@ def create_or_update_static_site_app_settings( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6569,7 +6563,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -6585,7 +6578,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -6656,7 +6648,6 @@ def get_basic_auth( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6671,7 +6662,7 @@ def get_basic_auth( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6803,7 +6794,6 @@ def create_or_update_basic_auth( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6818,7 +6808,7 @@ def create_or_update_basic_auth( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteBasicAuthPropertiesARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6940,7 +6930,6 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -6955,7 +6944,7 @@ def create_or_update_static_site_function_app_settings( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7079,7 +7068,6 @@ def create_user_roles_invitation_link( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7094,7 +7082,7 @@ def create_user_roles_invitation_link( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response) + deserialized = self._deserialize("StaticSiteUserInvitationResponseResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7144,7 +7132,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7160,7 +7147,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7231,7 +7217,6 @@ def get_static_site_custom_domain( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7246,7 +7231,7 @@ def get_static_site_custom_domain( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7262,7 +7247,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> _models.StaticSiteCustomDomainOverviewARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7276,7 +7261,7 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteCustomDomainOverviewARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7301,10 +7286,10 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7312,15 +7297,15 @@ def _create_or_update_static_site_custom_domain_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7454,10 +7439,13 @@ def begin_create_or_update_static_site_custom_domain( # pylint: disable=name-to params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteCustomDomainOverviewARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteCustomDomainOverviewARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7479,9 +7467,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _delete_static_site_custom_domain_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, domain_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7494,7 +7482,7 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_static_site_custom_domain_request( resource_group_name=resource_group_name, @@ -7505,10 +7493,10 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7516,12 +7504,20 @@ def _delete_static_site_custom_domain_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_static_site_custom_domain( @@ -7550,7 +7546,7 @@ def begin_delete_static_site_custom_domain( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_static_site_custom_domain_initial( # type: ignore + raw_result = self._delete_static_site_custom_domain_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -7560,6 +7556,7 @@ def begin_delete_static_site_custom_domain( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7581,7 +7578,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, @@ -7590,7 +7587,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa _models.StaticSiteCustomDomainRequestPropertiesARMResource, IO[bytes] ], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7604,7 +7601,7 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -7629,10 +7626,10 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7640,12 +7637,20 @@ def _validate_custom_domain_can_be_added_to_static_site_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable=name-too-long @@ -7753,7 +7758,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( # type: ignore + raw_result = self._validate_custom_domain_can_be_added_to_static_site_initial( resource_group_name=resource_group_name, name=name, domain_name=domain_name, @@ -7765,6 +7770,7 @@ def begin_validate_custom_domain_can_be_added_to_static_site( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -7827,7 +7833,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -7843,7 +7848,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -7914,7 +7918,6 @@ def get_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -7929,7 +7932,7 @@ def get_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8063,7 +8066,6 @@ def create_or_update_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8078,7 +8080,7 @@ def create_or_update_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8126,7 +8128,6 @@ def delete_database_connection( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8272,7 +8273,6 @@ def update_database_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8287,7 +8287,7 @@ def update_database_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8335,7 +8335,6 @@ def get_database_connection_with_details( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8350,16 +8349,14 @@ def get_database_connection_with_details( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatabaseConnection", pipeline_response) + deserialized = self._deserialize("DatabaseConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _detach_static_site_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, **kwargs: Any - ) -> None: + def _detach_static_site_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8372,7 +8369,7 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_detach_static_site_request( resource_group_name=resource_group_name, @@ -8382,10 +8379,10 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8393,12 +8390,20 @@ def _detach_static_site_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -8423,7 +8428,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._detach_static_site_initial( # type: ignore + raw_result = self._detach_static_site_initial( resource_group_name=resource_group_name, name=name, api_version=api_version, @@ -8432,6 +8437,7 @@ def begin_detach_static_site(self, resource_group_name: str, name: str, **kwargs params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -8496,7 +8502,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8512,7 +8517,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8580,7 +8584,6 @@ def list_static_site_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8595,7 +8598,7 @@ def list_static_site_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8640,7 +8643,6 @@ def list_static_site_configured_roles( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8655,7 +8657,7 @@ def list_static_site_configured_roles( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringList", pipeline_response) + deserialized = self._deserialize("StringList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8700,7 +8702,6 @@ def list_static_site_function_app_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8715,7 +8716,7 @@ def list_static_site_function_app_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8758,7 +8759,6 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8773,7 +8773,7 @@ def list_static_site_secrets(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8823,7 +8823,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -8839,7 +8838,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -8910,7 +8908,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -8925,7 +8922,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8939,7 +8936,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8953,7 +8950,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -8975,10 +8972,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8986,15 +8983,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9119,10 +9116,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9146,7 +9146,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9159,7 +9159,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -9170,10 +9170,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9181,18 +9181,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9236,10 +9233,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9297,7 +9295,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9312,7 +9309,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9434,7 +9431,6 @@ def reset_static_site_api_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9493,7 +9489,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9509,7 +9504,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9583,7 +9577,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -9599,7 +9592,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -9671,7 +9663,6 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9686,7 +9677,9 @@ def get_user_provided_function_app_for_static_site( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9703,7 +9696,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di ], is_forced: Optional[bool] = None, **kwargs: Any - ) -> _models.StaticSiteUserProvidedFunctionAppARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9717,7 +9710,7 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteUserProvidedFunctionAppARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -9742,10 +9735,10 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9753,15 +9746,15 @@ def _register_user_provided_function_app_with_static_site_initial( # pylint: di response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9907,10 +9900,13 @@ def begin_register_user_provided_function_app_with_static_site( # pylint: disab params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteUserProvidedFunctionAppARMResource", pipeline_response) + deserialized = self._deserialize( + "StaticSiteUserProvidedFunctionAppARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9973,7 +9969,6 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -9991,13 +9986,13 @@ def detach_user_provided_function_app_from_static_site( # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) # type: ignore - def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_zip_deployment_for_static_site_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, static_site_zip_deployment_envelope: Union[_models.StaticSiteZipDeploymentARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10011,7 +10006,7 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10032,10 +10027,10 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10043,12 +10038,20 @@ def _create_zip_deployment_for_static_site_initial( # pylint: disable=inconsist response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-long @@ -10144,7 +10147,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_zip_deployment_for_static_site_initial( # type: ignore + raw_result = self._create_zip_deployment_for_static_site_initial( resource_group_name=resource_group_name, name=name, static_site_zip_deployment_envelope=static_site_zip_deployment_envelope, @@ -10155,6 +10158,7 @@ def begin_create_zip_deployment_for_static_site( # pylint: disable=name-too-lon params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -10176,14 +10180,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_backend_initial( # pylint: disable=inconsistent-return-statements + def _validate_backend_initial( self, resource_group_name: str, name: str, linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10197,7 +10201,7 @@ def _validate_backend_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10219,10 +10223,10 @@ def _validate_backend_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10230,12 +10234,20 @@ def _validate_backend_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_backend( @@ -10339,7 +10351,7 @@ def begin_validate_backend( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_backend_initial( # type: ignore + raw_result = self._validate_backend_initial( resource_group_name=resource_group_name, name=name, linked_backend_name=linked_backend_name, @@ -10351,6 +10363,7 @@ def begin_validate_backend( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -10372,7 +10385,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return-statements + def _validate_backend_for_build_initial( self, resource_group_name: str, name: str, @@ -10380,7 +10393,7 @@ def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return- linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10394,7 +10407,7 @@ def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10417,10 +10430,10 @@ def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10428,12 +10441,20 @@ def _validate_backend_for_build_initial( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_validate_backend_for_build( @@ -10546,7 +10567,7 @@ def begin_validate_backend_for_build( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._validate_backend_for_build_initial( # type: ignore + raw_result = self._validate_backend_for_build_initial( resource_group_name=resource_group_name, name=name, environment_name=environment_name, @@ -10559,6 +10580,7 @@ def begin_validate_backend_for_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -10623,7 +10645,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10639,7 +10660,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10715,7 +10735,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -10731,7 +10750,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -10802,7 +10820,6 @@ def get_linked_backend( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -10817,7 +10834,7 @@ def get_linked_backend( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10831,7 +10848,7 @@ def _link_backend_initial( linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteLinkedBackendARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10845,7 +10862,7 @@ def _link_backend_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteLinkedBackendARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -10867,10 +10884,10 @@ def _link_backend_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10878,11 +10895,15 @@ def _link_backend_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11009,10 +11030,11 @@ def begin_link_backend( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11084,7 +11106,6 @@ def unlink_backend( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11146,7 +11167,6 @@ def get_linked_backend_for_build( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -11161,7 +11181,7 @@ def get_linked_backend_for_build( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11176,7 +11196,7 @@ def _link_backend_to_build_initial( linked_backend_name: str, static_site_linked_backend_envelope: Union[_models.StaticSiteLinkedBackendARMResource, IO[bytes]], **kwargs: Any - ) -> _models.StaticSiteLinkedBackendARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11190,7 +11210,7 @@ def _link_backend_to_build_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StaticSiteLinkedBackendARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -11213,10 +11233,10 @@ def _link_backend_to_build_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11224,11 +11244,15 @@ def _link_backend_to_build_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11365,10 +11389,11 @@ def begin_link_backend_to_build( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response) + deserialized = self._deserialize("StaticSiteLinkedBackendARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11444,7 +11469,6 @@ def unlink_backend_from_build( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_top_level_domains_operations.py index 1f40cc38ec496..0d2451882059f 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_top_level_domains_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_top_level_domains_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -179,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -195,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -258,7 +255,6 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get(self, name: str, **kwargs: Any) -> _models.TopLevelDomain: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopLevelDomain", pipeline_response) + deserialized = self._deserialize("TopLevelDomain", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +374,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -394,7 +389,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_web_apps_operations.py index 8f0f345a93d6c..8f3dcb01801a4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_web_apps_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_web_apps_operations.py @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -16939,7 +16940,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -16955,7 +16955,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17028,7 +17027,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17044,7 +17042,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -17113,7 +17110,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17128,7 +17124,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17137,7 +17133,7 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Sit def _create_or_update_initial( self, resource_group_name: str, name: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17151,7 +17147,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -17172,10 +17168,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -17183,15 +17179,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17303,10 +17299,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -17381,7 +17378,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17521,7 +17517,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17536,11 +17531,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17588,7 +17579,6 @@ def analyze_custom_hostname( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17603,7 +17593,7 @@ def analyze_custom_hostname( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17723,7 +17713,6 @@ def apply_slot_config_to_production( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17852,7 +17841,6 @@ def backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -17867,7 +17855,7 @@ def backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17913,7 +17901,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -17929,7 +17916,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18000,7 +17986,6 @@ def get_backup_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18015,7 +18000,7 @@ def get_backup_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18066,7 +18051,6 @@ def delete_backup( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18219,7 +18203,6 @@ def list_backup_status_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18234,21 +18217,21 @@ def list_backup_status_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_initial( # pylint: disable=inconsistent-return-statements + def _restore_initial( self, resource_group_name: str, name: str, backup_id: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18262,7 +18245,7 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -18284,10 +18267,10 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -18295,12 +18278,20 @@ def _restore_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore( @@ -18400,7 +18391,7 @@ def begin_restore( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_initial( # type: ignore + raw_result = self._restore_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -18412,6 +18403,7 @@ def begin_restore( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -18477,7 +18469,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18493,7 +18484,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -18561,7 +18551,6 @@ def get_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18576,7 +18565,7 @@ def get_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18700,7 +18689,6 @@ def update_ftp_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18715,7 +18703,7 @@ def update_ftp_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18760,7 +18748,6 @@ def get_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18775,7 +18762,7 @@ def get_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18899,7 +18886,6 @@ def update_scm_allowed( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -18914,7 +18900,7 @@ def update_scm_allowed( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18962,7 +18948,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -18978,7 +18963,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -19121,7 +19105,6 @@ def update_application_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19136,7 +19119,7 @@ def update_application_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19179,7 +19162,6 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19194,7 +19176,7 @@ def list_application_settings(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19314,7 +19296,6 @@ def update_auth_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19329,7 +19310,7 @@ def update_auth_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19372,7 +19353,6 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19387,7 +19367,7 @@ def get_auth_settings(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19432,7 +19412,6 @@ def get_auth_settings_v2_without_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19447,7 +19426,7 @@ def get_auth_settings_v2_without_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19570,7 +19549,6 @@ def update_auth_settings_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19585,7 +19563,7 @@ def update_auth_settings_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19628,7 +19606,6 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19643,7 +19620,7 @@ def get_auth_settings_v2(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19765,7 +19742,6 @@ def update_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19780,7 +19756,7 @@ def update_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19825,7 +19801,6 @@ def list_azure_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19840,7 +19815,7 @@ def list_azure_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19956,7 +19931,6 @@ def update_backup_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -19971,7 +19945,7 @@ def update_backup_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20016,7 +19990,6 @@ def delete_backup_configuration( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20070,7 +20043,6 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20085,7 +20057,7 @@ def get_backup_configuration(self, resource_group_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20133,7 +20105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20149,7 +20120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20220,7 +20190,6 @@ def get_app_setting_key_vault_reference( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20235,7 +20204,7 @@ def get_app_setting_key_vault_reference( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20283,7 +20252,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -20299,7 +20267,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -20370,7 +20337,6 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20385,7 +20351,7 @@ def get_site_connection_string_key_vault_reference( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20508,7 +20474,6 @@ def update_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20523,7 +20488,7 @@ def update_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20568,7 +20533,6 @@ def list_connection_strings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20583,7 +20547,7 @@ def list_connection_strings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20628,7 +20592,6 @@ def get_diagnostic_logs_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20643,7 +20606,7 @@ def get_diagnostic_logs_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20766,7 +20729,6 @@ def update_diagnostic_logs_config( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20781,7 +20743,7 @@ def update_diagnostic_logs_config( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20897,7 +20859,6 @@ def update_metadata( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20912,7 +20873,7 @@ def update_metadata( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20955,7 +20916,6 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -20970,14 +20930,16 @@ def list_metadata(self, resource_group_name: str, name: str, **kwargs: Any) -> _ error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _list_publishing_credentials_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.User: + def _list_publishing_credentials_initial( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20990,7 +20952,7 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_request( resource_group_name=resource_group_name, @@ -21000,10 +20962,10 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -21011,11 +20973,15 @@ def _list_publishing_credentials_initial(self, resource_group_name: str, name: s response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21056,10 +21022,11 @@ def begin_list_publishing_credentials( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21190,7 +21157,6 @@ def update_site_push_settings( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21205,7 +21171,7 @@ def update_site_push_settings( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21248,7 +21214,6 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21263,7 +21228,7 @@ def list_site_push_settings(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21309,7 +21274,6 @@ def list_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21324,7 +21288,7 @@ def list_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21453,7 +21417,6 @@ def update_slot_configuration_names( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21468,7 +21431,7 @@ def update_slot_configuration_names( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response) + deserialized = self._deserialize("SlotConfigNamesResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21513,7 +21476,6 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21528,7 +21490,7 @@ def get_configuration(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21648,7 +21610,6 @@ def create_or_update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21663,7 +21624,7 @@ def create_or_update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21783,7 +21744,6 @@ def update_configuration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21798,7 +21758,7 @@ def update_configuration( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21850,7 +21810,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -21866,7 +21825,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -21937,7 +21895,6 @@ def get_configuration_snapshot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -21952,7 +21909,7 @@ def get_configuration_snapshot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22000,7 +21957,6 @@ def recover_site_configuration_snapshot( # pylint: disable=inconsistent-return- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22056,9 +22012,9 @@ def get_web_site_container_logs( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22067,12 +22023,16 @@ def get_web_site_container_logs( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22115,9 +22075,9 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22126,12 +22086,16 @@ def get_container_logs_zip(self, resource_group_name: str, name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22179,7 +22143,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22195,7 +22158,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22269,7 +22231,6 @@ def get_continuous_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22284,7 +22245,7 @@ def get_continuous_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22332,7 +22293,6 @@ def delete_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22394,7 +22354,6 @@ def start_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22456,7 +22415,6 @@ def stop_continuous_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22515,7 +22473,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22531,7 +22488,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22563,7 +22519,7 @@ def get_next(next_link=None): def _get_production_site_deployment_status_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, deployment_status_id: str, **kwargs: Any - ) -> _models.CsmDeploymentStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22576,7 +22532,7 @@ def _get_production_site_deployment_status_initial( # pylint: disable=name-too- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CsmDeploymentStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_get_production_site_deployment_status_request( resource_group_name=resource_group_name, @@ -22587,10 +22543,10 @@ def _get_production_site_deployment_status_initial( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -22598,15 +22554,15 @@ def _get_production_site_deployment_status_initial( # pylint: disable=name-too- response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22651,10 +22607,11 @@ def begin_get_production_site_deployment_status( # pylint: disable=name-too-lon params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22715,7 +22672,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -22731,7 +22687,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -22800,7 +22755,6 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22815,7 +22769,7 @@ def get_deployment(self, resource_group_name: str, name: str, id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22945,7 +22899,6 @@ def create_deployment( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -22960,7 +22913,7 @@ def create_deployment( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23008,7 +22961,6 @@ def delete_deployment( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23066,7 +23018,6 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23081,7 +23032,7 @@ def list_deployment_log(self, resource_group_name: str, name: str, id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23205,7 +23156,6 @@ def discover_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23220,7 +23170,7 @@ def discover_backup( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23268,7 +23218,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -23284,7 +23233,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -23355,7 +23303,6 @@ def get_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23370,7 +23317,7 @@ def get_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23505,7 +23452,6 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23520,7 +23466,7 @@ def create_or_update_domain_ownership_identifier( # pylint: disable=name-too-lo error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23568,7 +23514,6 @@ def delete_domain_ownership_identifier( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23714,7 +23659,6 @@ def update_domain_ownership_identifier( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23729,7 +23673,7 @@ def update_domain_ownership_identifier( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23772,7 +23716,6 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -23787,7 +23730,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23796,7 +23739,7 @@ def get_ms_deploy_status(self, resource_group_name: str, name: str, **kwargs: An def _create_ms_deploy_operation_initial( self, resource_group_name: str, name: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23813,7 +23756,7 @@ def _create_ms_deploy_operation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -23834,10 +23777,10 @@ def _create_ms_deploy_operation_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -23845,11 +23788,15 @@ def _create_ms_deploy_operation_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23955,10 +23902,11 @@ def begin_create_ms_deploy_operation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24019,7 +23967,6 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24034,7 +23981,7 @@ def get_ms_deploy_log(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24078,7 +24025,6 @@ def get_one_deploy_status(self, resource_group_name: str, name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24093,7 +24039,7 @@ def get_one_deploy_status(self, resource_group_name: str, name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24136,7 +24082,6 @@ def create_one_deploy_operation(self, resource_group_name: str, name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24151,7 +24096,7 @@ def create_one_deploy_operation(self, resource_group_name: str, name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24202,7 +24147,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -24218,7 +24162,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -24284,7 +24227,6 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24299,7 +24241,7 @@ def get_functions_admin_token(self, resource_group_name: str, name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24350,7 +24292,6 @@ def get_function( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24365,7 +24306,7 @@ def get_function( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24379,7 +24320,7 @@ def _create_function_initial( function_name: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24393,7 +24334,7 @@ def _create_function_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24415,10 +24356,10 @@ def _create_function_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -24426,11 +24367,15 @@ def _create_function_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24550,10 +24495,11 @@ def begin_create_function( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24619,7 +24565,6 @@ def delete_function( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24770,7 +24715,6 @@ def create_or_update_function_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24785,11 +24729,7 @@ def create_or_update_function_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24843,7 +24783,6 @@ def delete_function_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24902,7 +24841,6 @@ def list_function_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24917,7 +24855,7 @@ def list_function_keys( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24965,7 +24903,6 @@ def list_function_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -24980,7 +24917,7 @@ def list_function_secrets( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25023,7 +24960,6 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25038,7 +24974,7 @@ def list_host_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25083,7 +25019,6 @@ def list_sync_status( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25139,7 +25074,6 @@ def sync_functions( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25290,7 +25224,6 @@ def create_or_update_host_secret( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25305,11 +25238,7 @@ def create_or_update_host_secret( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25363,7 +25292,6 @@ def delete_host_secret( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25422,7 +25350,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -25438,7 +25365,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -25509,7 +25435,6 @@ def get_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25524,7 +25449,7 @@ def get_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25656,7 +25581,6 @@ def create_or_update_host_name_binding( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25671,7 +25595,7 @@ def create_or_update_host_name_binding( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25719,7 +25643,6 @@ def delete_host_name_binding( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25781,7 +25704,6 @@ def get_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25796,7 +25718,7 @@ def get_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25936,7 +25858,6 @@ def create_or_update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -25951,7 +25872,7 @@ def create_or_update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26005,7 +25926,6 @@ def delete_hybrid_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26156,7 +26076,6 @@ def update_hybrid_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26171,7 +26090,7 @@ def update_hybrid_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26214,7 +26133,6 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26229,7 +26147,7 @@ def list_hybrid_connections(self, resource_group_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26275,7 +26193,6 @@ def list_relay_service_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26290,7 +26207,7 @@ def list_relay_service_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26338,7 +26255,6 @@ def get_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26353,7 +26269,7 @@ def get_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26487,7 +26403,6 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26502,7 +26417,7 @@ def create_or_update_relay_service_connection( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26553,7 +26468,6 @@ def delete_relay_service_connection( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26698,7 +26612,6 @@ def update_relay_service_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26713,7 +26626,7 @@ def update_relay_service_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26762,7 +26675,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -26778,7 +26690,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -26849,7 +26760,6 @@ def get_instance_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26864,7 +26774,7 @@ def get_instance_info( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26912,7 +26822,6 @@ def get_instance_ms_deploy_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -26927,7 +26836,7 @@ def get_instance_ms_deploy_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26941,7 +26850,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26958,7 +26867,7 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -26980,10 +26889,10 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -26991,11 +26900,15 @@ def _create_instance_ms_deploy_operation_initial( # pylint: disable=name-too-lo response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27115,10 +27028,11 @@ def begin_create_instance_ms_deploy_operation( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27184,7 +27098,6 @@ def get_instance_ms_deploy_log( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27199,7 +27112,7 @@ def get_instance_ms_deploy_log( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27256,7 +27169,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27272,7 +27184,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27351,7 +27262,6 @@ def get_instance_process( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27366,7 +27276,7 @@ def get_instance_process( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27423,7 +27333,6 @@ def delete_instance_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27490,9 +27399,9 @@ def get_instance_process_dump( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27501,11 +27410,15 @@ def get_instance_process_dump( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27565,7 +27478,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27581,7 +27493,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27663,7 +27574,6 @@ def get_instance_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27678,7 +27588,7 @@ def get_instance_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27737,7 +27647,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27753,7 +27662,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27819,7 +27727,6 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27834,7 +27741,7 @@ def is_cloneable(self, resource_group_name: str, name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27880,7 +27787,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -27896,7 +27802,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -27964,7 +27869,6 @@ def list_sync_function_triggers( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -27979,7 +27883,7 @@ def list_sync_function_triggers( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27993,7 +27897,7 @@ def _migrate_storage_initial( name: str, migration_options: Union[_models.StorageMigrationOptions, IO[bytes]], **kwargs: Any - ) -> _models.StorageMigrationResponse: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28007,7 +27911,7 @@ def _migrate_storage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageMigrationResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28029,10 +27933,10 @@ def _migrate_storage_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28040,11 +27944,15 @@ def _migrate_storage_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28168,10 +28076,11 @@ def begin_migrate_storage( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageMigrationResponse", pipeline_response) + deserialized = self._deserialize("StorageMigrationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28199,7 +28108,7 @@ def _migrate_my_sql_initial( name: str, migration_request_envelope: Union[_models.MigrateMySqlRequest, IO[bytes]], **kwargs: Any - ) -> _models.Operation: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28213,7 +28122,7 @@ def _migrate_my_sql_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -28234,10 +28143,10 @@ def _migrate_my_sql_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -28245,11 +28154,15 @@ def _migrate_my_sql_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28357,10 +28270,11 @@ def begin_migrate_my_sql( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Operation", pipeline_response) + deserialized = self._deserialize("Operation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28422,7 +28336,6 @@ def get_migrate_my_sql_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28437,7 +28350,7 @@ def get_migrate_my_sql_status( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28482,7 +28395,6 @@ def get_swift_virtual_network_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28497,7 +28409,7 @@ def get_swift_virtual_network_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28637,7 +28549,6 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28652,7 +28563,7 @@ def create_or_update_swift_virtual_network_connection_with_check( # pylint: dis error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28700,7 +28611,6 @@ def delete_swift_virtual_network( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28851,7 +28761,6 @@ def update_swift_virtual_network_connection_with_check( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28866,7 +28775,7 @@ def update_swift_virtual_network_connection_with_check( # pylint: disable=name- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28917,7 +28826,6 @@ def list_network_features( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28932,7 +28840,7 @@ def list_network_features( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28981,7 +28889,6 @@ def get_network_trace_operation( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -28996,11 +28903,7 @@ def get_network_trace_operation( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29060,7 +28963,6 @@ def start_web_site_network_trace( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29075,7 +28977,7 @@ def start_web_site_network_trace( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29090,7 +28992,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29103,7 +29005,7 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_request( resource_group_name=resource_group_name, @@ -29116,10 +29018,10 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -29127,15 +29029,15 @@ def _start_web_site_network_trace_operation_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29192,10 +29094,11 @@ def begin_start_web_site_network_trace_operation( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29255,7 +29158,6 @@ def stop_web_site_network_trace( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29315,7 +29217,6 @@ def get_network_traces( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29330,7 +29231,7 @@ def get_network_traces( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29379,7 +29280,6 @@ def get_network_trace_operation_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29394,11 +29294,7 @@ def get_network_trace_operation_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29447,7 +29343,6 @@ def get_network_traces_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29462,7 +29357,7 @@ def get_network_traces_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29508,7 +29403,6 @@ def generate_new_site_publishing_password( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29572,7 +29466,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -29588,7 +29481,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -29656,7 +29548,6 @@ def get_site_php_error_log_flag( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29671,7 +29562,7 @@ def get_site_php_error_log_flag( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29714,7 +29605,6 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29729,7 +29619,7 @@ def list_premier_add_ons(self, resource_group_name: str, name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29777,7 +29667,6 @@ def get_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29792,7 +29681,7 @@ def get_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29922,7 +29811,6 @@ def add_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -29937,7 +29825,7 @@ def add_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29985,7 +29873,6 @@ def delete_premier_add_on( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30126,7 +30013,6 @@ def update_premier_add_on( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30141,7 +30027,7 @@ def update_premier_add_on( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30186,7 +30072,6 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30201,7 +30086,7 @@ def get_private_access(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30323,7 +30208,6 @@ def put_private_access_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30338,7 +30222,7 @@ def put_private_access_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30388,7 +30272,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30404,7 +30287,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -30475,7 +30357,6 @@ def get_private_endpoint_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30490,7 +30371,7 @@ def get_private_endpoint_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30504,7 +30385,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n private_endpoint_connection_name: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30518,7 +30399,7 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -30540,10 +30421,10 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30551,15 +30432,15 @@ def _approve_or_reject_private_endpoint_connection_initial( # pylint: disable=n response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30684,10 +30565,13 @@ def begin_approve_or_reject_private_endpoint_connection( # pylint: disable=name params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30711,7 +30595,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30724,7 +30608,7 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_request( resource_group_name=resource_group_name, @@ -30735,10 +30619,10 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -30746,18 +30630,15 @@ def _delete_private_endpoint_connection_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30801,10 +30682,11 @@ def begin_delete_private_endpoint_connection( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -30862,7 +30744,6 @@ def get_private_link_resources( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -30877,7 +30758,7 @@ def get_private_link_resources( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30928,7 +30809,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -30944,7 +30824,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31017,7 +30896,6 @@ def get_process(self, resource_group_name: str, name: str, process_id: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31032,7 +30910,7 @@ def get_process(self, resource_group_name: str, name: str, process_id: str, **kw error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31085,7 +30963,6 @@ def delete_process( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31146,9 +31023,9 @@ def get_process_dump(self, resource_group_name: str, name: str, process_id: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -31157,11 +31034,15 @@ def get_process_dump(self, resource_group_name: str, name: str, process_id: str, response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31217,7 +31098,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31233,7 +31113,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31311,7 +31190,6 @@ def get_process_module( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31326,7 +31204,7 @@ def get_process_module( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31381,7 +31259,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31397,7 +31274,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31468,7 +31344,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -31484,7 +31359,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -31555,7 +31429,6 @@ def get_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31570,7 +31443,7 @@ def get_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31702,7 +31575,6 @@ def create_or_update_public_certificate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31717,7 +31589,7 @@ def create_or_update_public_certificate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31765,7 +31637,6 @@ def delete_public_certificate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -31901,9 +31772,9 @@ def list_publishing_profile_xml_with_secrets( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -31912,11 +31783,15 @@ def list_publishing_profile_xml_with_secrets( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31963,7 +31838,6 @@ def reset_production_slot_config( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32033,7 +31907,6 @@ def restart( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32051,9 +31924,9 @@ def restart( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_initial( self, resource_group_name: str, name: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32067,7 +31940,7 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32088,10 +31961,10 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32099,12 +31972,20 @@ def _restore_from_backup_blob_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob( @@ -32191,7 +32072,7 @@ def begin_restore_from_backup_blob( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_initial( # type: ignore + raw_result = self._restore_from_backup_blob_initial( resource_group_name=resource_group_name, name=name, request=request, @@ -32202,6 +32083,7 @@ def begin_restore_from_backup_blob( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32223,13 +32105,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32243,7 +32125,7 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32264,10 +32146,10 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32275,12 +32157,20 @@ def _restore_from_deleted_app_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app( @@ -32371,7 +32261,7 @@ def begin_restore_from_deleted_app( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_initial( # type: ignore + raw_result = self._restore_from_deleted_app_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -32382,6 +32272,7 @@ def begin_restore_from_deleted_app( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32403,13 +32294,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_initial( self, resource_group_name: str, name: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32423,7 +32314,7 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -32444,10 +32335,10 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -32455,12 +32346,20 @@ def _restore_snapshot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot( @@ -32554,7 +32453,7 @@ def begin_restore_snapshot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_initial( # type: ignore + raw_result = self._restore_snapshot_initial( resource_group_name=resource_group_name, name=name, restore_request=restore_request, @@ -32565,6 +32464,7 @@ def begin_restore_snapshot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -32627,7 +32527,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -32643,7 +32542,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -32714,7 +32612,6 @@ def get_site_container( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32729,7 +32626,7 @@ def get_site_container( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteContainer", pipeline_response) + deserialized = self._deserialize("SiteContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32858,7 +32755,6 @@ def create_or_update_site_container( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32873,11 +32769,7 @@ def create_or_update_site_container( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteContainer", pipeline_response) + deserialized = self._deserialize("SiteContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -32925,7 +32817,6 @@ def delete_site_container( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -32987,7 +32878,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33003,7 +32893,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33077,7 +32966,6 @@ def get_site_extension( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33092,7 +32980,7 @@ def get_site_extension( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33101,7 +32989,7 @@ def get_site_extension( def _install_site_extension_initial( self, resource_group_name: str, name: str, site_extension_id: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33118,7 +33006,7 @@ def _install_site_extension_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_request( resource_group_name=resource_group_name, @@ -33129,10 +33017,10 @@ def _install_site_extension_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33140,15 +33028,15 @@ def _install_site_extension_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33193,10 +33081,11 @@ def begin_install_site_extension( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33262,7 +33151,6 @@ def delete_site_extension( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33319,7 +33207,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -33335,7 +33222,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -33408,7 +33294,6 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33423,7 +33308,7 @@ def get_slot(self, resource_group_name: str, name: str, slot: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33437,7 +33322,7 @@ def _create_or_update_slot_initial( slot: str, site_envelope: Union[_models.Site, IO[bytes]], **kwargs: Any - ) -> _models.Site: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33451,7 +33336,7 @@ def _create_or_update_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Site] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -33473,10 +33358,10 @@ def _create_or_update_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -33484,15 +33369,15 @@ def _create_or_update_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33621,10 +33506,11 @@ def begin_create_or_update_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -33704,7 +33590,6 @@ def delete_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33857,7 +33742,6 @@ def update_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33872,11 +33756,7 @@ def update_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Site", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("Site", pipeline_response) + deserialized = self._deserialize("Site", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -33928,7 +33808,6 @@ def analyze_custom_hostname_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -33943,7 +33822,7 @@ def analyze_custom_hostname_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) + deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34076,7 +33955,6 @@ def apply_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34222,7 +34100,6 @@ def backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34237,7 +34114,7 @@ def backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34289,7 +34166,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34305,7 +34181,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34380,7 +34255,6 @@ def get_backup_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34395,7 +34269,7 @@ def get_backup_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -34450,7 +34324,6 @@ def delete_backup_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34616,7 +34489,6 @@ def list_backup_status_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34631,14 +34503,14 @@ def list_backup_status_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupItem", pipeline_response) + deserialized = self._deserialize("BackupItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restore_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_slot_initial( self, resource_group_name: str, name: str, @@ -34646,7 +34518,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -34660,7 +34532,7 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -34683,10 +34555,10 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -34694,12 +34566,20 @@ def _restore_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_slot( @@ -34811,7 +34691,7 @@ def begin_restore_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_slot_initial( # type: ignore + raw_result = self._restore_slot_initial( resource_group_name=resource_group_name, name=name, backup_id=backup_id, @@ -34824,6 +34704,7 @@ def begin_restore_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -34892,7 +34773,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -34908,7 +34788,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -34979,7 +34858,6 @@ def get_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -34994,7 +34872,7 @@ def get_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35128,7 +35006,6 @@ def update_ftp_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35143,7 +35020,7 @@ def update_ftp_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35191,7 +35068,6 @@ def get_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35206,7 +35082,7 @@ def get_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35340,7 +35216,6 @@ def update_scm_allowed_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35355,7 +35230,7 @@ def update_scm_allowed_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response) + deserialized = self._deserialize("CsmPublishingCredentialsPoliciesEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35407,7 +35282,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -35423,7 +35297,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -35579,7 +35452,6 @@ def update_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35594,7 +35466,7 @@ def update_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35643,7 +35515,6 @@ def list_application_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35658,7 +35529,7 @@ def list_application_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35791,7 +35662,6 @@ def update_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35806,7 +35676,7 @@ def update_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35855,7 +35725,6 @@ def get_auth_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35870,7 +35739,7 @@ def get_auth_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettings", pipeline_response) + deserialized = self._deserialize("SiteAuthSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -35919,7 +35788,6 @@ def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -35934,7 +35802,7 @@ def get_auth_settings_v2_without_secrets_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36070,7 +35938,6 @@ def update_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36085,7 +35952,7 @@ def update_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36134,7 +36001,6 @@ def get_auth_settings_v2_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36149,7 +36015,7 @@ def get_auth_settings_v2_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response) + deserialized = self._deserialize("SiteAuthSettingsV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36284,7 +36150,6 @@ def update_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36299,7 +36164,7 @@ def update_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36348,7 +36213,6 @@ def list_azure_storage_accounts_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36363,7 +36227,7 @@ def list_azure_storage_accounts_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response) + deserialized = self._deserialize("AzureStoragePropertyDictionaryResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36496,7 +36360,6 @@ def update_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36511,7 +36374,7 @@ def update_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36560,7 +36423,6 @@ def delete_backup_configuration_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36620,7 +36482,6 @@ def get_backup_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36635,7 +36496,7 @@ def get_backup_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupRequest", pipeline_response) + deserialized = self._deserialize("BackupRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36686,7 +36547,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36702,7 +36562,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36776,7 +36635,6 @@ def get_app_setting_key_vault_reference_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36791,7 +36649,7 @@ def get_app_setting_key_vault_reference_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -36842,7 +36700,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -36858,7 +36715,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -36932,7 +36788,6 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -36947,7 +36802,7 @@ def get_site_connection_string_key_vault_reference_slot( # pylint: disable=name error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiKVReference", pipeline_response) + deserialized = self._deserialize("ApiKVReference", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37083,7 +36938,6 @@ def update_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37098,7 +36952,7 @@ def update_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37147,7 +37001,6 @@ def list_connection_strings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37162,7 +37015,7 @@ def list_connection_strings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response) + deserialized = self._deserialize("ConnectionStringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37211,7 +37064,6 @@ def get_diagnostic_logs_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37226,7 +37078,7 @@ def get_diagnostic_logs_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37362,7 +37214,6 @@ def update_diagnostic_logs_config_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37377,7 +37228,7 @@ def update_diagnostic_logs_config_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteLogsConfig", pipeline_response) + deserialized = self._deserialize("SiteLogsConfig", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37510,7 +37361,6 @@ def update_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37525,7 +37375,7 @@ def update_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37574,7 +37424,6 @@ def list_metadata_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37589,7 +37438,7 @@ def list_metadata_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37598,7 +37447,7 @@ def list_metadata_slot( def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, **kwargs: Any - ) -> _models.User: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37611,7 +37460,7 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.User] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_list_publishing_credentials_slot_request( resource_group_name=resource_group_name, @@ -37622,10 +37471,10 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -37633,11 +37482,15 @@ def _list_publishing_credentials_slot_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37682,10 +37535,11 @@ def begin_list_publishing_credentials_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -37833,7 +37687,6 @@ def update_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37848,7 +37701,7 @@ def update_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37897,7 +37750,6 @@ def list_site_push_settings_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37912,7 +37764,7 @@ def list_site_push_settings_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PushSettings", pipeline_response) + deserialized = self._deserialize("PushSettings", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37963,7 +37815,6 @@ def get_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -37978,7 +37829,7 @@ def get_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38111,7 +37962,6 @@ def create_or_update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38126,7 +37976,7 @@ def create_or_update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38259,7 +38109,6 @@ def update_configuration_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38274,7 +38123,7 @@ def update_configuration_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38330,7 +38179,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38346,7 +38194,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38421,7 +38268,6 @@ def get_configuration_snapshot_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38436,7 +38282,7 @@ def get_configuration_snapshot_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteConfigResource", pipeline_response) + deserialized = self._deserialize("SiteConfigResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38488,7 +38334,6 @@ def recover_site_configuration_snapshot_slot( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38548,9 +38393,9 @@ def get_web_site_container_logs_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -38559,12 +38404,16 @@ def get_web_site_container_logs_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38613,9 +38462,9 @@ def get_container_logs_zip_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -38624,12 +38473,16 @@ def get_container_logs_zip_slot( response = pipeline_response.http_response if response.status_code not in [200, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38681,7 +38534,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -38697,7 +38549,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -38775,7 +38626,6 @@ def get_continuous_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38790,7 +38640,7 @@ def get_continuous_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ContinuousWebJob", pipeline_response) + deserialized = self._deserialize("ContinuousWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -38842,7 +38692,6 @@ def delete_continuous_web_job_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38908,7 +38757,6 @@ def start_continuous_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -38974,7 +38822,6 @@ def stop_continuous_web_job_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39037,7 +38884,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39053,7 +38899,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39085,7 +38930,7 @@ def get_next(next_link=None): def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, slot: str, deployment_status_id: str, **kwargs: Any - ) -> _models.CsmDeploymentStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -39098,7 +38943,7 @@ def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-l _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.CsmDeploymentStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_get_slot_site_deployment_status_slot_request( resource_group_name=resource_group_name, @@ -39110,10 +38955,10 @@ def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -39121,15 +38966,15 @@ def _get_slot_site_deployment_status_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39178,10 +39023,11 @@ def begin_get_slot_site_deployment_status_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response) + deserialized = self._deserialize("CsmDeploymentStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -39248,7 +39094,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39264,7 +39109,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39339,7 +39183,6 @@ def get_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39354,7 +39197,7 @@ def get_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39497,7 +39340,6 @@ def create_deployment_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39512,7 +39354,7 @@ def create_deployment_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39564,7 +39406,6 @@ def delete_deployment_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39628,7 +39469,6 @@ def list_deployment_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39643,7 +39483,7 @@ def list_deployment_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Deployment", pipeline_response) + deserialized = self._deserialize("Deployment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39784,7 +39624,6 @@ def discover_backup_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39799,7 +39638,7 @@ def discover_backup_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreRequest", pipeline_response) + deserialized = self._deserialize("RestoreRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -39851,7 +39690,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -39867,7 +39705,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -39942,7 +39779,6 @@ def get_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -39957,7 +39793,7 @@ def get_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40105,7 +39941,6 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40120,7 +39955,7 @@ def create_or_update_domain_ownership_identifier_slot( # pylint: disable=name-t error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40172,7 +40007,6 @@ def delete_domain_ownership_identifier_slot( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40331,7 +40165,6 @@ def update_domain_ownership_identifier_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40346,7 +40179,7 @@ def update_domain_ownership_identifier_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Identifier", pipeline_response) + deserialized = self._deserialize("Identifier", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40395,7 +40228,6 @@ def get_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40410,7 +40242,7 @@ def get_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40424,7 +40256,7 @@ def _create_ms_deploy_operation_slot_initial( slot: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -40441,7 +40273,7 @@ def _create_ms_deploy_operation_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -40463,10 +40295,10 @@ def _create_ms_deploy_operation_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -40474,11 +40306,15 @@ def _create_ms_deploy_operation_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40601,10 +40437,11 @@ def begin_create_ms_deploy_operation_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -40671,7 +40508,6 @@ def get_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40686,7 +40522,7 @@ def get_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40740,7 +40576,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -40756,7 +40591,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -40826,7 +40660,6 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40841,7 +40674,7 @@ def get_functions_admin_token_slot(self, resource_group_name: str, name: str, sl error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40895,7 +40728,6 @@ def get_instance_function_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -40910,7 +40742,7 @@ def get_instance_function_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -40925,7 +40757,7 @@ def _create_instance_function_slot_initial( slot: str, function_envelope: Union[_models.FunctionEnvelope, IO[bytes]], **kwargs: Any - ) -> _models.FunctionEnvelope: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -40939,7 +40771,7 @@ def _create_instance_function_slot_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FunctionEnvelope] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -40962,10 +40794,10 @@ def _create_instance_function_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -40973,11 +40805,15 @@ def _create_instance_function_slot_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41107,10 +40943,11 @@ def begin_create_instance_function_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FunctionEnvelope", pipeline_response) + deserialized = self._deserialize("FunctionEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -41179,7 +41016,6 @@ def delete_instance_function_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41340,7 +41176,6 @@ def create_or_update_function_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41355,11 +41190,7 @@ def create_or_update_function_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41416,7 +41247,6 @@ def delete_function_secret_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41478,7 +41308,6 @@ def list_function_keys_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41493,7 +41322,7 @@ def list_function_keys_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StringDictionary", pipeline_response) + deserialized = self._deserialize("StringDictionary", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41544,7 +41373,6 @@ def list_function_secrets_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41559,7 +41387,7 @@ def list_function_secrets_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41605,7 +41433,6 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41620,7 +41447,7 @@ def list_host_keys_slot(self, resource_group_name: str, name: str, slot: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostKeys", pipeline_response) + deserialized = self._deserialize("HostKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41668,7 +41495,6 @@ def list_sync_status_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41727,7 +41553,6 @@ def sync_functions_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41888,7 +41713,6 @@ def create_or_update_host_secret_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -41903,11 +41727,7 @@ def create_or_update_host_secret_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("KeyInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("KeyInfo", pipeline_response) + deserialized = self._deserialize("KeyInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -41964,7 +41784,6 @@ def delete_host_secret_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42027,7 +41846,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -42043,7 +41861,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -42118,7 +41935,6 @@ def get_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42133,7 +41949,7 @@ def get_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42278,7 +42094,6 @@ def create_or_update_host_name_binding_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42293,7 +42108,7 @@ def create_or_update_host_name_binding_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HostNameBinding", pipeline_response) + deserialized = self._deserialize("HostNameBinding", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42345,7 +42160,6 @@ def delete_host_name_binding_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42410,7 +42224,6 @@ def get_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42425,7 +42238,7 @@ def get_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42575,7 +42388,6 @@ def create_or_update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42590,7 +42402,7 @@ def create_or_update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42647,7 +42459,6 @@ def delete_hybrid_connection_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42808,7 +42619,6 @@ def update_hybrid_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42823,7 +42633,7 @@ def update_hybrid_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42871,7 +42681,6 @@ def list_hybrid_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42886,7 +42695,7 @@ def list_hybrid_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridConnection", pipeline_response) + deserialized = self._deserialize("HybridConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -42936,7 +42745,6 @@ def list_relay_service_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -42951,7 +42759,7 @@ def list_relay_service_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43003,7 +42811,6 @@ def get_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43018,7 +42825,7 @@ def get_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43165,7 +42972,6 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43180,7 +42986,7 @@ def create_or_update_relay_service_connection_slot( # pylint: disable=name-too- error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43235,7 +43041,6 @@ def delete_relay_service_connection_slot( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43393,7 +43198,6 @@ def update_relay_service_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43408,7 +43212,7 @@ def update_relay_service_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response) + deserialized = self._deserialize("RelayServiceConnectionEntity", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43461,7 +43265,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -43477,7 +43280,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -43552,7 +43354,6 @@ def get_instance_info_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43567,7 +43368,7 @@ def get_instance_info_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response) + deserialized = self._deserialize("WebSiteInstanceStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43619,7 +43420,6 @@ def get_instance_ms_deploy_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43634,7 +43434,7 @@ def get_instance_ms_deploy_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43649,7 +43449,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t instance_id: str, ms_deploy: Union[_models.MSDeploy, IO[bytes]], **kwargs: Any - ) -> _models.MSDeployStatus: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -43666,7 +43466,7 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MSDeployStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -43689,10 +43489,10 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -43700,11 +43500,15 @@ def _create_instance_ms_deploy_operation_slot_initial( # pylint: disable=name-t response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43837,10 +43641,11 @@ def begin_create_instance_ms_deploy_operation_slot( # pylint: disable=name-too- params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MSDeployStatus", pipeline_response) + deserialized = self._deserialize("MSDeployStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -43910,7 +43715,6 @@ def get_instance_ms_deploy_log_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -43925,7 +43729,7 @@ def get_instance_ms_deploy_log_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MSDeployLog", pipeline_response) + deserialized = self._deserialize("MSDeployLog", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -43986,7 +43790,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44002,7 +43805,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44085,7 +43887,6 @@ def get_instance_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44100,7 +43901,7 @@ def get_instance_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44161,7 +43962,6 @@ def delete_instance_process_slot( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44232,9 +44032,9 @@ def get_instance_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -44243,11 +44043,15 @@ def get_instance_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44311,7 +44115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44327,7 +44130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44420,7 +44222,6 @@ def get_instance_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44435,7 +44236,7 @@ def get_instance_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44498,7 +44299,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44514,7 +44314,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44586,7 +44385,6 @@ def is_cloneable_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44601,7 +44399,7 @@ def is_cloneable_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteCloneability", pipeline_response) + deserialized = self._deserialize("SiteCloneability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44653,7 +44451,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -44669,7 +44466,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -44740,7 +44536,6 @@ def list_sync_function_triggers_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44755,7 +44550,7 @@ def list_sync_function_triggers_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FunctionSecrets", pipeline_response) + deserialized = self._deserialize("FunctionSecrets", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44805,7 +44600,6 @@ def get_migrate_my_sql_status_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44820,7 +44614,7 @@ def get_migrate_my_sql_status_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response) + deserialized = self._deserialize("MigrateMySqlStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -44869,7 +44663,6 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -44884,7 +44677,7 @@ def get_swift_virtual_network_connection_slot( # pylint: disable=name-too-long error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45037,7 +44830,6 @@ def create_or_update_swift_virtual_network_connection_with_check_slot( # pylint headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45052,7 +44844,7 @@ def create_or_update_swift_virtual_network_connection_with_check_slot( # pylint error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45104,7 +44896,6 @@ def delete_swift_virtual_network_slot( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45268,7 +45059,6 @@ def update_swift_virtual_network_connection_with_check_slot( # pylint: disable= headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45283,7 +45073,7 @@ def update_swift_virtual_network_connection_with_check_slot( # pylint: disable= error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response) + deserialized = self._deserialize("SwiftVirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45338,7 +45128,6 @@ def list_network_features_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45353,7 +45142,7 @@ def list_network_features_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkFeatures", pipeline_response) + deserialized = self._deserialize("NetworkFeatures", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45406,7 +45195,6 @@ def get_network_trace_operation_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45421,11 +45209,7 @@ def get_network_trace_operation_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45489,7 +45273,6 @@ def start_web_site_network_trace_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45504,7 +45287,7 @@ def start_web_site_network_trace_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45520,7 +45303,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -45533,7 +45316,7 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_web_site_network_trace_operation_slot_request( resource_group_name=resource_group_name, @@ -45547,10 +45330,10 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -45558,15 +45341,15 @@ def _start_web_site_network_trace_operation_slot_initial( # pylint: disable=nam response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45627,10 +45410,11 @@ def begin_start_web_site_network_trace_operation_slot( # pylint: disable=name-t params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -45693,7 +45477,6 @@ def stop_web_site_network_trace_slot( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45757,7 +45540,6 @@ def get_network_traces_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45772,7 +45554,7 @@ def get_network_traces_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45825,7 +45607,6 @@ def get_network_trace_operation_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45840,11 +45621,7 @@ def get_network_trace_operation_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45897,7 +45674,6 @@ def get_network_traces_slot_v2( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -45912,7 +45688,7 @@ def get_network_traces_slot_v2( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -45962,7 +45738,6 @@ def generate_new_site_publishing_password_slot( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46030,7 +45805,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46046,7 +45820,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -46118,7 +45891,6 @@ def get_site_php_error_log_flag_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46133,7 +45905,7 @@ def get_site_php_error_log_flag_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response) + deserialized = self._deserialize("SitePhpErrorLogFlag", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46182,7 +45954,6 @@ def list_premier_add_ons_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46197,7 +45968,7 @@ def list_premier_add_ons_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46249,7 +46020,6 @@ def get_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46264,7 +46034,7 @@ def get_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46407,7 +46177,6 @@ def add_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46422,7 +46191,7 @@ def add_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46474,7 +46243,6 @@ def delete_premier_add_on_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46628,7 +46396,6 @@ def update_premier_add_on_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46643,7 +46410,7 @@ def update_premier_add_on_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PremierAddOn", pipeline_response) + deserialized = self._deserialize("PremierAddOn", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46693,7 +46460,6 @@ def get_private_access_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46708,7 +46474,7 @@ def get_private_access_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46844,7 +46610,6 @@ def put_private_access_vnet_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -46859,7 +46624,7 @@ def put_private_access_vnet_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateAccess", pipeline_response) + deserialized = self._deserialize("PrivateAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -46912,7 +46677,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -46928,7 +46692,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47002,7 +46765,6 @@ def get_private_endpoint_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47017,7 +46779,7 @@ def get_private_endpoint_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47032,7 +46794,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa slot: str, private_endpoint_wrapper: Union[_models.RemotePrivateEndpointConnectionARMResource, IO[bytes]], **kwargs: Any - ) -> _models.RemotePrivateEndpointConnectionARMResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47046,7 +46808,7 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RemotePrivateEndpointConnectionARMResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -47069,10 +46831,10 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47080,15 +46842,15 @@ def _approve_or_reject_private_endpoint_connection_slot_initial( # pylint: disa response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47223,10 +46985,13 @@ def begin_approve_or_reject_private_endpoint_connection_slot( # pylint: disable params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RemotePrivateEndpointConnectionARMResource", pipeline_response) + deserialized = self._deserialize( + "RemotePrivateEndpointConnectionARMResource", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -47250,7 +47015,7 @@ def get_long_running_output(pipeline_response): def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-too-long self, resource_group_name: str, name: str, private_endpoint_connection_name: str, slot: str, **kwargs: Any - ) -> JSON: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -47263,7 +47028,7 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_private_endpoint_connection_slot_request( resource_group_name=resource_group_name, @@ -47275,10 +47040,10 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -47286,18 +47051,15 @@ def _delete_private_endpoint_connection_slot_initial( # pylint: disable=name-to response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("object", pipeline_response) - - if response.status_code == 204: - deserialized = self._deserialize("object", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47344,10 +47106,11 @@ def begin_delete_private_endpoint_connection_slot( # pylint: disable=name-too-l params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("object", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -47408,7 +47171,6 @@ def get_private_link_resources_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47423,7 +47185,7 @@ def get_private_link_resources_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47480,7 +47242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47496,7 +47257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47575,7 +47335,6 @@ def get_process_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47590,7 +47349,7 @@ def get_process_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessInfo", pipeline_response) + deserialized = self._deserialize("ProcessInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47647,7 +47406,6 @@ def delete_process_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47714,9 +47472,9 @@ def get_process_dump_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -47725,11 +47483,15 @@ def get_process_dump_slot( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47789,7 +47551,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47805,7 +47566,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -47887,7 +47647,6 @@ def get_process_module_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -47902,7 +47661,7 @@ def get_process_module_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProcessModuleInfo", pipeline_response) + deserialized = self._deserialize("ProcessModuleInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -47961,7 +47720,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -47977,7 +47735,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48052,7 +47809,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -48068,7 +47824,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -48143,7 +47898,6 @@ def get_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48158,7 +47912,7 @@ def get_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48303,7 +48057,6 @@ def create_or_update_public_certificate_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48318,7 +48071,7 @@ def create_or_update_public_certificate_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PublicCertificate", pipeline_response) + deserialized = self._deserialize("PublicCertificate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48370,7 +48123,6 @@ def delete_public_certificate_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48519,9 +48271,9 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -48530,11 +48282,15 @@ def list_publishing_profile_xml_with_secrets_slot( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -48585,7 +48341,6 @@ def reset_slot_configuration_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48660,7 +48415,6 @@ def restart_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -48678,14 +48432,14 @@ def restart_slot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_backup_blob_slot_initial( self, resource_group_name: str, name: str, slot: str, request: Union[_models.RestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48699,7 +48453,7 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48721,10 +48475,10 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48732,12 +48486,20 @@ def _restore_from_backup_blob_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_backup_blob_slot( @@ -48840,7 +48602,7 @@ def begin_restore_from_backup_blob_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_backup_blob_slot_initial( # type: ignore + raw_result = self._restore_from_backup_blob_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -48852,6 +48614,7 @@ def begin_restore_from_backup_blob_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -48873,14 +48636,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_from_deleted_app_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.DeletedAppRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -48894,7 +48657,7 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -48916,10 +48679,10 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -48927,12 +48690,20 @@ def _restore_from_deleted_app_slot_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_from_deleted_app_slot( @@ -49035,7 +48806,7 @@ def begin_restore_from_deleted_app_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_from_deleted_app_slot_initial( # type: ignore + raw_result = self._restore_from_deleted_app_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -49047,6 +48818,7 @@ def begin_restore_from_deleted_app_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -49068,14 +48840,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-statements + def _restore_snapshot_slot_initial( self, resource_group_name: str, name: str, slot: str, restore_request: Union[_models.SnapshotRestoreRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -49089,7 +48861,7 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -49111,10 +48883,10 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -49122,12 +48894,20 @@ def _restore_snapshot_slot_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_snapshot_slot( @@ -49233,7 +49013,7 @@ def begin_restore_snapshot_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_snapshot_slot_initial( # type: ignore + raw_result = self._restore_snapshot_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -49245,6 +49025,7 @@ def begin_restore_snapshot_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -49311,7 +49092,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49327,7 +49107,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49402,7 +49181,6 @@ def get_site_container_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49417,7 +49195,7 @@ def get_site_container_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteContainer", pipeline_response) + deserialized = self._deserialize("SiteContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49559,7 +49337,6 @@ def create_or_update_site_container_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49574,11 +49351,7 @@ def create_or_update_site_container_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteContainer", pipeline_response) + deserialized = self._deserialize("SiteContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49630,7 +49403,6 @@ def delete_site_container_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49696,7 +49468,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -49712,7 +49483,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -49790,7 +49560,6 @@ def get_site_extension_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -49805,7 +49574,7 @@ def get_site_extension_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49814,7 +49583,7 @@ def get_site_extension_slot( def _install_site_extension_slot_initial( self, resource_group_name: str, name: str, site_extension_id: str, slot: str, **kwargs: Any - ) -> _models.SiteExtensionInfo: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -49831,7 +49600,7 @@ def _install_site_extension_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[_models.SiteExtensionInfo] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_install_site_extension_slot_request( resource_group_name=resource_group_name, @@ -49843,10 +49612,10 @@ def _install_site_extension_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -49854,15 +49623,15 @@ def _install_site_extension_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -49911,10 +49680,11 @@ def begin_install_site_extension_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteExtensionInfo", pipeline_response) + deserialized = self._deserialize("SiteExtensionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -49984,7 +49754,6 @@ def delete_site_extension_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50130,7 +49899,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50146,7 +49914,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50176,14 +49943,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_initial( self, resource_group_name: str, name: str, slot: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -50197,7 +49964,7 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -50219,10 +49986,10 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -50230,12 +49997,20 @@ def _swap_slot_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot( @@ -50338,7 +50113,7 @@ def begin_swap_slot( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_initial( # type: ignore + raw_result = self._swap_slot_initial( resource_group_name=resource_group_name, name=name, slot=slot, @@ -50350,6 +50125,7 @@ def begin_swap_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -50415,7 +50191,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50431,7 +50206,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50505,7 +50279,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -50521,7 +50294,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -50593,7 +50365,6 @@ def get_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -50608,14 +50379,7 @@ def get_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50629,7 +50393,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l slot: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -50643,7 +50407,7 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -50665,10 +50429,10 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -50676,18 +50440,15 @@ def _create_or_update_source_control_slot_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -50812,10 +50573,11 @@ def begin_create_or_update_source_control_slot( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -50885,7 +50647,6 @@ def delete_source_control_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51031,7 +50792,6 @@ def update_source_control_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51046,14 +50806,7 @@ def update_source_control_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51102,7 +50855,6 @@ def start_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51129,7 +50881,7 @@ def _start_network_trace_slot_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -51142,7 +50894,7 @@ def _start_network_trace_slot_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_slot_request( resource_group_name=resource_group_name, @@ -51156,10 +50908,10 @@ def _start_network_trace_slot_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -51167,15 +50919,15 @@ def _start_network_trace_slot_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51236,10 +50988,11 @@ def begin_start_network_trace_slot( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -51303,7 +51056,6 @@ def stop_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51362,7 +51114,6 @@ def stop_network_trace_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51422,7 +51173,6 @@ def sync_repository_slot( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51481,7 +51231,6 @@ def sync_function_triggers_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51544,7 +51293,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51560,7 +51308,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51638,7 +51385,6 @@ def get_triggered_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51653,7 +51399,7 @@ def get_triggered_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51705,7 +51451,6 @@ def delete_triggered_web_job_slot( # pylint: disable=inconsistent-return-statem headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51774,7 +51519,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -51790,7 +51534,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -51872,7 +51615,6 @@ def get_triggered_web_job_history_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -51887,7 +51629,7 @@ def get_triggered_web_job_history_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -51942,7 +51684,6 @@ def run_triggered_web_job_slot( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52011,7 +51752,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -52027,7 +51767,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -52099,7 +51838,6 @@ def list_vnet_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52114,7 +51852,7 @@ def list_vnet_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52166,7 +51904,6 @@ def get_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52181,7 +51918,7 @@ def get_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52332,7 +52069,6 @@ def create_or_update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52347,7 +52083,7 @@ def create_or_update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52403,7 +52139,6 @@ def delete_vnet_connection_slot( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52565,7 +52300,6 @@ def update_vnet_connection_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52580,7 +52314,7 @@ def update_vnet_connection_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52639,7 +52373,6 @@ def get_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52654,7 +52387,7 @@ def get_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52810,7 +52543,6 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52825,7 +52557,7 @@ def create_or_update_vnet_connection_gateway_slot( # pylint: disable=name-too-l error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -52981,7 +52713,6 @@ def update_vnet_connection_gateway_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -52996,7 +52727,7 @@ def update_vnet_connection_gateway_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53048,7 +52779,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53064,7 +52794,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -53139,7 +52868,6 @@ def get_web_job_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53154,7 +52882,7 @@ def get_web_job_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53276,7 +53004,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53292,7 +53019,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -53322,13 +53048,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-statements + def _swap_slot_with_production_initial( self, resource_group_name: str, name: str, slot_swap_entity: Union[_models.CsmSlotEntity, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -53342,7 +53068,7 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -53363,10 +53089,10 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -53374,12 +53100,20 @@ def _swap_slot_with_production_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_swap_slot_with_production( @@ -53470,7 +53204,7 @@ def begin_swap_slot_with_production( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._swap_slot_with_production_initial( # type: ignore + raw_result = self._swap_slot_with_production_initial( resource_group_name=resource_group_name, name=name, slot_swap_entity=slot_swap_entity, @@ -53481,6 +53215,7 @@ def begin_swap_slot_with_production( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -53541,7 +53276,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53557,7 +53291,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -53628,7 +53361,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -53644,7 +53376,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -53710,7 +53441,6 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -53725,14 +53455,7 @@ def get_source_control(self, resource_group_name: str, name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53745,7 +53468,7 @@ def _create_or_update_source_control_initial( name: str, site_source_control: Union[_models.SiteSourceControl, IO[bytes]], **kwargs: Any - ) -> _models.SiteSourceControl: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -53759,7 +53482,7 @@ def _create_or_update_source_control_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SiteSourceControl] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -53780,10 +53503,10 @@ def _create_or_update_source_control_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -53791,18 +53514,15 @@ def _create_or_update_source_control_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -53914,10 +53634,11 @@ def begin_create_or_update_source_control( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -53983,7 +53704,6 @@ def delete_source_control( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54116,7 +53836,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54131,14 +53850,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SiteSourceControl", pipeline_response) + deserialized = self._deserialize("SiteSourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54183,7 +53895,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54209,7 +53920,7 @@ def _start_network_trace_initial( max_frame_length: Optional[int] = None, sas_url: Optional[str] = None, **kwargs: Any - ) -> List[_models.NetworkTrace]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -54222,7 +53933,7 @@ def _start_network_trace_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[List[_models.NetworkTrace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_network_trace_request( resource_group_name=resource_group_name, @@ -54235,10 +53946,10 @@ def _start_network_trace_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -54246,15 +53957,15 @@ def _start_network_trace_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54311,10 +54022,11 @@ def begin_start_network_trace( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("[NetworkTrace]", pipeline_response) + deserialized = self._deserialize("[NetworkTrace]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -54374,7 +54086,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54430,7 +54141,6 @@ def stop_network_trace( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54486,7 +54196,6 @@ def sync_repository( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54542,7 +54251,6 @@ def sync_function_triggers( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54601,7 +54309,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -54617,7 +54324,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -54691,7 +54397,6 @@ def get_triggered_web_job( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54706,7 +54411,7 @@ def get_triggered_web_job( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredWebJob", pipeline_response) + deserialized = self._deserialize("TriggeredWebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54754,7 +54459,6 @@ def delete_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54819,7 +54523,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -54835,7 +54538,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -54913,7 +54615,6 @@ def get_triggered_web_job_history( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -54928,7 +54629,7 @@ def get_triggered_web_job_history( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggeredJobHistory", pipeline_response) + deserialized = self._deserialize("TriggeredJobHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -54979,7 +54680,6 @@ def run_triggered_web_job( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55044,7 +54744,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -55060,7 +54759,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -55128,7 +54826,6 @@ def list_vnet_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55143,7 +54840,7 @@ def list_vnet_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VnetInfoResource]", pipeline_response) + deserialized = self._deserialize("[VnetInfoResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55191,7 +54888,6 @@ def get_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55206,7 +54902,7 @@ def get_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55344,7 +55040,6 @@ def create_or_update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55359,7 +55054,7 @@ def create_or_update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55411,7 +55106,6 @@ def delete_vnet_connection( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55560,7 +55254,6 @@ def update_vnet_connection( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55575,7 +55268,7 @@ def update_vnet_connection( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetInfoResource", pipeline_response) + deserialized = self._deserialize("VnetInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55630,7 +55323,6 @@ def get_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55645,7 +55337,7 @@ def get_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55788,7 +55480,6 @@ def create_or_update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55803,7 +55494,7 @@ def create_or_update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -55946,7 +55637,6 @@ def update_vnet_connection_gateway( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -55961,7 +55651,7 @@ def update_vnet_connection_gateway( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetGateway", pipeline_response) + deserialized = self._deserialize("VnetGateway", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -56007,7 +55697,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -56023,7 +55712,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -56092,7 +55780,6 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -56107,7 +55794,7 @@ def get_web_job(self, resource_group_name: str, name: str, web_job_name: str, ** error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebJob", pipeline_response) + deserialized = self._deserialize("WebJob", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -56232,7 +55919,6 @@ def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -56378,7 +56064,6 @@ def deploy_workflow_artifacts_slot( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -56440,7 +56125,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -56456,7 +56140,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -56533,7 +56216,6 @@ def get_instance_workflow_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -56548,7 +56230,7 @@ def get_instance_workflow_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -56596,7 +56278,6 @@ def list_workflows_connections_slot( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -56611,7 +56292,7 @@ def list_workflows_connections_slot( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -56659,7 +56340,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -56675,7 +56355,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -56749,7 +56428,6 @@ def get_workflow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -56764,7 +56442,7 @@ def get_workflow( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -56809,7 +56487,6 @@ def list_workflows_connections( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -56824,7 +56501,7 @@ def list_workflows_connections( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowEnvelope", pipeline_response) + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_web_site_management_client_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_web_site_management_client_operations.py index 0f9236939bb90..d9e600aa249bf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_web_site_management_client_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_web_site_management_client_operations.py @@ -21,15 +21,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -590,7 +589,6 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -605,7 +603,7 @@ def get_publishing_user(self, **kwargs: Any) -> _models.User: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -694,7 +692,6 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -709,7 +706,7 @@ def update_publishing_user(self, user_details: Union[_models.User, IO[bytes]], * error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("User", pipeline_response) + deserialized = self._deserialize("User", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +747,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -766,7 +762,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -830,7 +825,6 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -845,7 +839,7 @@ def get_source_control(self, source_control_type: str, **kwargs: Any) -> _models error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -953,7 +947,6 @@ def update_source_control( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -968,7 +961,7 @@ def update_source_control( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SourceControl", pipeline_response) + deserialized = self._deserialize("SourceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1018,7 +1011,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1034,7 +1026,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1124,7 +1115,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1139,7 +1129,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceNameAvailability", pipeline_response) + deserialized = self._deserialize("ResourceNameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1186,7 +1176,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1202,7 +1191,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1265,7 +1253,6 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1280,7 +1267,7 @@ def get_subscription_deployment_locations(self, **kwargs: Any) -> _models.Deploy error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLocations", pipeline_response) + deserialized = self._deserialize("DeploymentLocations", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1322,7 +1309,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1338,7 +1324,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1428,7 +1413,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1444,7 +1428,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1564,7 +1547,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1580,7 +1562,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1645,7 +1626,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1661,7 +1641,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1723,7 +1702,6 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1738,7 +1716,7 @@ def list_skus(self, **kwargs: Any) -> _models.SkuInfos: error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SkuInfos", pipeline_response) + deserialized = self._deserialize("SkuInfos", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1837,7 +1815,6 @@ def verify_hosting_environment_vnet( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1852,7 +1829,7 @@ def verify_hosting_environment_vnet( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response) + deserialized = self._deserialize("VnetValidationFailureDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1965,7 +1942,6 @@ def move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2085,7 +2061,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2100,7 +2075,7 @@ def validate( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateResponse", pipeline_response) + deserialized = self._deserialize("ValidateResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2213,7 +2188,6 @@ def validate_move( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_action_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_action_repetitions_operations.py index b37c91b4f534c..b36da223992b4 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_action_repetitions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_action_repetitions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -256,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -272,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -357,7 +354,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -372,7 +368,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response) + deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -437,7 +433,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -453,7 +448,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_action_repetitions_request_histories_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_action_repetitions_request_histories_operations.py index 6a2fdeceb8ca8..6f141975062fc 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_action_repetitions_request_histories_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_action_repetitions_request_histories_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -219,7 +218,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -235,7 +233,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -324,7 +321,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,7 +335,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RequestHistory", pipeline_response) + deserialized = self._deserialize("RequestHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_action_scope_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_action_scope_repetitions_operations.py index fab89b7920566..1f6d260b091b0 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_action_scope_repetitions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_action_scope_repetitions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -207,7 +206,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -223,7 +221,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -308,7 +305,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -323,7 +319,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response) + deserialized = self._deserialize("WorkflowRunActionRepetitionDefinition", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_actions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_actions_operations.py index 04cdacb753288..7ef6fde748812 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_actions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_run_actions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -266,7 +265,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -282,7 +280,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -357,7 +354,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -372,7 +368,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRunAction", pipeline_response) + deserialized = self._deserialize("WorkflowRunAction", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -427,7 +423,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -443,7 +438,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_runs_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_runs_operations.py index 1730150985bd0..8310a8c3f7224 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_runs_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_runs_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -246,7 +245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -262,7 +260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -334,7 +331,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -349,7 +345,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowRun", pipeline_response) + deserialized = self._deserialize("WorkflowRun", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -398,7 +394,6 @@ def cancel( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_trigger_histories_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_trigger_histories_operations.py index a652372eae912..97584c97de21c 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_trigger_histories_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_trigger_histories_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -269,7 +270,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -285,7 +285,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -367,7 +366,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -382,14 +380,14 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTriggerHistory", pipeline_response) + deserialized = self._deserialize("WorkflowTriggerHistory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _resubmit_initial( # pylint: disable=inconsistent-return-statements + def _resubmit_initial( self, resource_group_name: str, name: str, @@ -397,7 +395,7 @@ def _resubmit_initial( # pylint: disable=inconsistent-return-statements trigger_name: str, history_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -410,7 +408,7 @@ def _resubmit_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resubmit_request( resource_group_name=resource_group_name, @@ -423,10 +421,10 @@ def _resubmit_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -434,12 +432,20 @@ def _resubmit_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_resubmit( @@ -477,7 +483,7 @@ def begin_resubmit( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._resubmit_initial( # type: ignore + raw_result = self._resubmit_initial( resource_group_name=resource_group_name, name=name, workflow_name=workflow_name, @@ -489,6 +495,7 @@ def begin_resubmit( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_triggers_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_triggers_operations.py index 6f1d10e2ac8f0..8b6f50c7d01b9 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_triggers_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_triggers_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -327,7 +328,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -343,7 +343,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -415,7 +414,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -430,7 +428,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTrigger", pipeline_response) + deserialized = self._deserialize("WorkflowTrigger", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -479,7 +477,6 @@ def list_callback_url( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -494,16 +491,16 @@ def list_callback_url( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowTriggerCallbackUrl", pipeline_response) + deserialized = self._deserialize("WorkflowTriggerCallbackUrl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _run_initial( # pylint: disable=inconsistent-return-statements + def _run_initial( self, resource_group_name: str, name: str, workflow_name: str, trigger_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -516,7 +513,7 @@ def _run_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_run_request( resource_group_name=resource_group_name, @@ -528,10 +525,10 @@ def _run_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -539,12 +536,20 @@ def _run_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_run( @@ -573,7 +578,7 @@ def begin_run( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._run_initial( # type: ignore + raw_result = self._run_initial( resource_group_name=resource_group_name, name=name, workflow_name=workflow_name, @@ -584,6 +589,7 @@ def begin_run( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -647,7 +653,6 @@ def get_schema_json( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -662,7 +667,7 @@ def get_schema_json( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JsonSchema", pipeline_response) + deserialized = self._deserialize("JsonSchema", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_versions_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_versions_operations.py index 3aa87ba17568f..b6eccf274aeb1 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_versions_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflow_versions_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -193,7 +192,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -209,7 +207,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -281,7 +278,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -296,7 +292,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkflowVersion", pipeline_response) + deserialized = self._deserialize("WorkflowVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflows_operations.py b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflows_operations.py index 3f4339c29c804..7c686782fd6cf 100644 --- a/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflows_operations.py +++ b/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2023_12_01/operations/_workflows_operations.py @@ -19,15 +19,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import WebSiteManagementClientMixinABC, _convert_request +from .._vendor import WebSiteManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -261,7 +260,6 @@ def regenerate_access_key( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -395,7 +393,6 @@ def validate( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/appservice/azure-mgmt-web/dev_requirements.txt b/sdk/appservice/azure-mgmt-web/dev_requirements.txt index f6457a93d5e82..fa6811a93df07 100644 --- a/sdk/appservice/azure-mgmt-web/dev_requirements.txt +++ b/sdk/appservice/azure-mgmt-web/dev_requirements.txt @@ -1 +1,3 @@ --e ../../../tools/azure-sdk-tools \ No newline at end of file +-e ../../../tools/azure-sdk-tools +-e ../../resources/azure-mgmt-resource +aiohttp \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/app_service_environments_create_or_update_multi_role_pool.py b/sdk/appservice/azure-mgmt-web/generated_samples/app_service_environments_create_or_update_multi_role_pool.py index 27c13f87dab32..f3fc7b4367680 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/app_service_environments_create_or_update_multi_role_pool.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/app_service_environments_create_or_update_multi_role_pool.py @@ -11,7 +11,6 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.web import WebSiteManagementClient - """ # PREREQUISITES pip install azure-identity @@ -24,22 +23,21 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ - - def main(): client = WebSiteManagementClient( credential=DefaultAzureCredential(), subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.app_service_environments.begin_create_or_update_multi_role_pool( - resource_group_name="test-rg", - name="test-ase", - multi_role_pool_envelope={"properties": {"workerCount": 3, "workerSize": "Medium"}}, - ).result() + response = client.app_service_environments.update_multi_role_pool( + resource_group_name='test-rg', + name='test-ase', + multi_role_pool_envelope={'properties': {'workerCount': 3, 'workerSize': 'Medium'}}, + ) print(response) - # x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-12-01/examples/AppServiceEnvironments_CreateOrUpdateMultiRolePool.json if __name__ == "__main__": main() += "__main__": + main() diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/app_service_environments_create_or_update_worker_pool.py b/sdk/appservice/azure-mgmt-web/generated_samples/app_service_environments_create_or_update_worker_pool.py index 3253aef9afd55..421e58a0e8c9c 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/app_service_environments_create_or_update_worker_pool.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/app_service_environments_create_or_update_worker_pool.py @@ -11,7 +11,6 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.web import WebSiteManagementClient - """ # PREREQUISITES pip install azure-identity @@ -24,23 +23,22 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ - - def main(): client = WebSiteManagementClient( credential=DefaultAzureCredential(), subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.app_service_environments.begin_create_or_update_worker_pool( - resource_group_name="test-rg", - name="test-ase", - worker_pool_name="0", - worker_pool_envelope={"properties": {"workerCount": 3, "workerSize": "Small"}}, - ).result() + response = client.app_service_environments.update_worker_pool( + resource_group_name='test-rg', + name='test-ase', + worker_pool_name='0', + worker_pool_envelope={'properties': {'workerCount': 3, 'workerSize': 'Small'}}, + ) print(response) - # x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-12-01/examples/AppServiceEnvironments_CreateOrUpdateWorkerPool.json if __name__ == "__main__": main() += "__main__": + main() diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/approve_reject_site_private_endpoint_connection.py b/sdk/appservice/azure-mgmt-web/generated_samples/approve_reject_site_private_endpoint_connection.py index d76168884bea4..70e288c0b49ee 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/approve_reject_site_private_endpoint_connection.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/approve_reject_site_private_endpoint_connection.py @@ -32,7 +32,7 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.static_sites.begin_approve_or_reject_private_endpoint_connection( + response = client.web_apps.begin_approve_or_reject_private_endpoint_connection( resource_group_name="rg", name="testSite", private_endpoint_connection_name="connection", @@ -52,3 +52,4 @@ def main(): # x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-12-01/examples/ApproveRejectSitePrivateEndpointConnection.json if __name__ == "__main__": main() +n() diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/delete_site_private_endpoint_connection.py b/sdk/appservice/azure-mgmt-web/generated_samples/delete_site_private_endpoint_connection.py index ef65c7ce048da..5df770967c25c 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/delete_site_private_endpoint_connection.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/delete_site_private_endpoint_connection.py @@ -30,7 +30,7 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.static_sites.begin_delete_private_endpoint_connection( + response = client.web_apps.begin_delete_private_endpoint_connection( resource_group_name="rg", name="testSite", private_endpoint_connection_name="connection", @@ -41,3 +41,4 @@ def main(): # x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-12-01/examples/DeleteSitePrivateEndpointConnection.json if __name__ == "__main__": main() +n() diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_analysis.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_analysis.py index 3502c74681f2f..3c30dd382e823 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_analysis.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_analysis.py @@ -30,11 +30,12 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.execute_site_analysis( + response = client.diagnostics.execute_site_analysis_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", diagnostic_category="availability", analysis_name="apprestartanalyses", + slot="Production", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_analysis_slot.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_analysis_slot.py index ae00fefb97e2c..3d13740f80967 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_analysis_slot.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_analysis_slot.py @@ -30,11 +30,12 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.execute_site_analysis( + response = client.diagnostics.execute_site_analysis_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", diagnostic_category="availability", analysis_name="apprestartanalyses", + slot="staging", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_detector.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_detector.py index cd1a803a6a792..a9dc19880315f 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_detector.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_detector.py @@ -30,11 +30,12 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.execute_site_detector( + response = client.diagnostics.execute_site_detector_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", detector_name="sitecrashes", diagnostic_category="availability", + slot="Production", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_detector_slot.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_detector_slot.py index 2a8da97e28740..af7ea3991108c 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_detector_slot.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_execute_site_detector_slot.py @@ -30,11 +30,12 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.execute_site_detector( + response = client.diagnostics.execute_site_detector_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", detector_name="sitecrashes", diagnostic_category="availability", + slot="staging", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_analysis.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_analysis.py index af32463617311..975fde6dce30a 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_analysis.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_analysis.py @@ -30,11 +30,12 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.get_site_analysis( + response = client.diagnostics.get_site_analysis_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", diagnostic_category="availability", analysis_name="appanalysis", + slot="Production", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_analysis_slot.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_analysis_slot.py index f0f5e1344c132..68015ce8a904c 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_analysis_slot.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_analysis_slot.py @@ -30,11 +30,12 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.get_site_analysis( + response = client.diagnostics.get_site_analysis_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", diagnostic_category="availability", analysis_name="appanalysis", + slot="staging", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector.py index fdfbf43b1afe0..efcf1a093489a 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector.py @@ -30,11 +30,12 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.get_site_detector( + response = client.diagnostics.get_site_detector_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", diagnostic_category="availability", detector_name="sitecrashes", + slot="Production", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector_response.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector_response.py index 3c1fe83cd6f54..6028d8029f01b 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector_response.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector_response.py @@ -30,10 +30,11 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.get_site_detector_response( + response = client.diagnostics.get_site_detector_response_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", detector_name="runtimeavailability", + slot="staging", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector_response_slot.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector_response_slot.py index 2d46b2db28697..f4f69016a0439 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector_response_slot.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector_response_slot.py @@ -30,10 +30,11 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.get_site_detector_response( + response = client.diagnostics.get_site_detector_response_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", detector_name="runtimeavailability", + slot="staging", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector_slot.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector_slot.py index 347ba591c7776..489f61cc8c7cb 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector_slot.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_detector_slot.py @@ -30,11 +30,12 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.get_site_detector( + response = client.diagnostics.get_site_detector_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", diagnostic_category="availability", detector_name="sitecrashes", + slot="staging", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_diagnostic_category.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_diagnostic_category.py index 3c8b15c68242c..21576a87ff596 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_diagnostic_category.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_diagnostic_category.py @@ -30,10 +30,11 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.get_site_diagnostic_category( + response = client.diagnostics.get_site_diagnostic_category_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", diagnostic_category="availability", + slot="Production", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_diagnostic_category_slot.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_diagnostic_category_slot.py index 996ec65aaa089..f89dfdde5e344 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_diagnostic_category_slot.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_get_site_diagnostic_category_slot.py @@ -30,10 +30,11 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.get_site_diagnostic_category( + response = client.diagnostics.get_site_diagnostic_category_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", diagnostic_category="availability", + slot="staging", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_analyses.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_analyses.py index 25408e8f8dfd7..d154041d154b9 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_analyses.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_analyses.py @@ -30,10 +30,11 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.list_site_analyses( + response = client.diagnostics.list_site_analyses_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", diagnostic_category="availability", + slot="Production", ) for item in response: print(item) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_analyses_slot.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_analyses_slot.py index 08a8a86e66763..7ce1ba2f67dbd 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_analyses_slot.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_analyses_slot.py @@ -30,10 +30,11 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.list_site_analyses( + response = client.diagnostics.list_site_analyses_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", diagnostic_category="availability", + slot="staging", ) for item in response: print(item) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detector_responses.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detector_responses.py index 25b2e08ed8b49..175130ff43e32 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detector_responses.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detector_responses.py @@ -30,9 +30,10 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.list_site_detector_responses( + response = client.diagnostics.list_site_detector_responses_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", + slot="staging", ) for item in response: print(item) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detector_responses_slot.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detector_responses_slot.py index 7e8b3da9a94e1..1a06a6bef3c1c 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detector_responses_slot.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detector_responses_slot.py @@ -30,9 +30,10 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.list_site_detector_responses( + response = client.diagnostics.list_site_detector_responses_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", + slot="staging", ) for item in response: print(item) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detectors.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detectors.py index cadc19912ea0d..ec9fef1e850e0 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detectors.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detectors.py @@ -30,10 +30,11 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.list_site_detectors( + response = client.diagnostics.list_site_detectors_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", diagnostic_category="availability", + slot="Production", ) for item in response: print(item) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detectors_slot.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detectors_slot.py index ce90d35feb808..81179d3f1dacb 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detectors_slot.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_detectors_slot.py @@ -30,10 +30,11 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.list_site_detectors( + response = client.diagnostics.list_site_detectors_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", diagnostic_category="availability", + slot="staging", ) for item in response: print(item) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_diagnostic_categories.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_diagnostic_categories.py index d3d6dbbe6d5f6..9ed955263381b 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_diagnostic_categories.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_diagnostic_categories.py @@ -30,9 +30,10 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.list_site_diagnostic_categories( + response = client.diagnostics.list_site_diagnostic_categories_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", + slot="Production", ) for item in response: print(item) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_diagnostic_categories_slot.py b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_diagnostic_categories_slot.py index 339e57444190c..94ca1b413eb1e 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_diagnostic_categories_slot.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/diagnostics_list_site_diagnostic_categories_slot.py @@ -30,9 +30,10 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.diagnostics.list_site_diagnostic_categories( + response = client.diagnostics.list_site_diagnostic_categories_slot( resource_group_name="Sample-WestUSResourceGroup", site_name="SampleApp", + slot="staging", ) for item in response: print(item) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/get_publishing_credentials_policy.py b/sdk/appservice/azure-mgmt-web/generated_samples/get_publishing_credentials_policy.py index c325cbad8fa92..9d470c2ff35a8 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/get_publishing_credentials_policy.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/get_publishing_credentials_policy.py @@ -30,7 +30,7 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.web_apps.get_ftp_allowed( + response = client.web_apps.get_scm_allowed( resource_group_name="rg", name="testSite", ) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/get_publishing_credentials_policy_slot.py b/sdk/appservice/azure-mgmt-web/generated_samples/get_publishing_credentials_policy_slot.py index f474aff6df43d..8f9b94cfd8470 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/get_publishing_credentials_policy_slot.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/get_publishing_credentials_policy_slot.py @@ -30,7 +30,7 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.web_apps.get_ftp_allowed_slot( + response = client.web_apps.get_scm_allowed_slot( resource_group_name="rg", name="testSite", slot="stage", diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/get_resource_health_metadata_by_site.py b/sdk/appservice/azure-mgmt-web/generated_samples/get_resource_health_metadata_by_site.py index 2d2d549a29fab..56dde6f7f97e3 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/get_resource_health_metadata_by_site.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/get_resource_health_metadata_by_site.py @@ -30,9 +30,10 @@ def main(): subscription_id="4adb32ad-8327-4cbb-b775-b84b4465bb38", ) - response = client.resource_health_metadata.get_by_site( + response = client.resource_health_metadata.get_by_site_slot( resource_group_name="Default-Web-NorthCentralUS", name="newsiteinnewASE-NCUS", + slot="Production", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/get_site_instance_info.py b/sdk/appservice/azure-mgmt-web/generated_samples/get_site_instance_info.py index 6bdd9cf90abfe..8c3c3f5a0e513 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/get_site_instance_info.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/get_site_instance_info.py @@ -30,10 +30,11 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.web_apps.get_instance_info( + response = client.web_apps.get_instance_info_slot( resource_group_name="testrg123", name="tests346", instance_id="134987120", + slot="staging", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/get_site_private_endpoint_connection.py b/sdk/appservice/azure-mgmt-web/generated_samples/get_site_private_endpoint_connection.py index c25f3aadbf3f5..7d7aa3b4659f4 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/get_site_private_endpoint_connection.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/get_site_private_endpoint_connection.py @@ -30,7 +30,7 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.static_sites.get_private_endpoint_connection( + response = client.web_apps.get_private_endpoint_connection( resource_group_name="rg", name="testSite", private_endpoint_connection_name="connection", @@ -41,3 +41,4 @@ def main(): # x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-12-01/examples/GetSitePrivateEndpointConnection.json if __name__ == "__main__": main() +n() diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/get_site_private_link_resources.py b/sdk/appservice/azure-mgmt-web/generated_samples/get_site_private_link_resources.py index 14e53412c8efb..70e216bf6af2b 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/get_site_private_link_resources.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/get_site_private_link_resources.py @@ -30,7 +30,7 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.static_sites.get_private_link_resources( + response = client.web_apps.get_private_link_resources( resource_group_name="rg", name="testSite", ) @@ -40,3 +40,4 @@ def main(): # x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-12-01/examples/GetSitePrivateLinkResources.json if __name__ == "__main__": main() +n() diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/get_web_site_network_trace_operation.py b/sdk/appservice/azure-mgmt-web/generated_samples/get_web_site_network_trace_operation.py index f91cef185c192..59c92d27328e7 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/get_web_site_network_trace_operation.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/get_web_site_network_trace_operation.py @@ -30,10 +30,11 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.web_apps.get_network_trace_operation( + response = client.web_apps.get_network_trace_operation_slot_v2( resource_group_name="testrg123", name="SampleApp", operation_id="c291433b-53ad-4c49-8cae-0a293eae1c6d", + slot="Production", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/get_web_site_network_traces.py b/sdk/appservice/azure-mgmt-web/generated_samples/get_web_site_network_traces.py index 41d0768827f7a..a643876ab8424 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/get_web_site_network_traces.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/get_web_site_network_traces.py @@ -30,10 +30,11 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.web_apps.get_network_traces( + response = client.web_apps.get_network_traces_slot_v2( resource_group_name="testrg123", name="SampleApp", operation_id="c291433b-53ad-4c49-8cae-0a293eae1c6d", + slot="Production", ) print(response) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/get_workflow.py b/sdk/appservice/azure-mgmt-web/generated_samples/get_workflow.py index 7d9d065056a32..39a131cd0aeb9 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/get_workflow.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/get_workflow.py @@ -30,10 +30,9 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.web_apps.get_instance_workflow_slot( + response = client.web_apps.get_workflow( resource_group_name="testrg123", name="testsite2", - slot="staging", workflow_name="stateful1", ) print(response) @@ -42,3 +41,5 @@ def main(): # x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-12-01/examples/GetWorkflow.json if __name__ == "__main__": main() +if __name__ == "__main__": + main() diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/list_operations.py b/sdk/appservice/azure-mgmt-web/generated_samples/list_operations.py index 25bfb3cafebf5..e59fd80c71196 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/list_operations.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/list_operations.py @@ -9,7 +9,6 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.web import WebSiteManagementClient - """ # PREREQUISITES pip install azure-identity @@ -22,19 +21,20 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ - - def main(): client = WebSiteManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) - response = client.certificate_registration_provider.list_operations() + response = client.provider.list_operations( + ) for item in response: print(item) - -# x-ms-original-file: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2023-12-01/examples/ListOperations.json +# x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-12-01/examples/ListOperations.json if __name__ == "__main__": main() +__name__ == "__main__": + main() + main() diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/list_resource_health_metadata_by_site.py b/sdk/appservice/azure-mgmt-web/generated_samples/list_resource_health_metadata_by_site.py index 7e505dbd2b491..7fef023ea6b71 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/list_resource_health_metadata_by_site.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/list_resource_health_metadata_by_site.py @@ -30,9 +30,10 @@ def main(): subscription_id="4adb32ad-8327-4cbb-b775-b84b4465bb38", ) - response = client.resource_health_metadata.list_by_site( + response = client.resource_health_metadata.list_by_site_slot( resource_group_name="Default-Web-NorthCentralUS", name="newsiteinnewASE-NCUS", + slot="Production", ) for item in response: print(item) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/list_slot_backups.py b/sdk/appservice/azure-mgmt-web/generated_samples/list_slot_backups.py index c4a74257be496..4f00424e4b464 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/list_slot_backups.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/list_slot_backups.py @@ -30,9 +30,10 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.web_apps.list_site_backups( + response = client.web_apps.list_site_backups_slot( resource_group_name="testrg123", name="tests346", + slot="staging", ) for item in response: print(item) diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/list_workflows.py b/sdk/appservice/azure-mgmt-web/generated_samples/list_workflows.py index fa999af77e428..28434d606bf30 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/list_workflows.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/list_workflows.py @@ -30,10 +30,9 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.web_apps.list_instance_workflows_slot( + response = client.web_apps.list_workflows( resource_group_name="testrg123", name="testsite2", - slot="staging", ) for item in response: print(item) @@ -42,3 +41,5 @@ def main(): # x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-12-01/examples/ListWorkflows.json if __name__ == "__main__": main() +if __name__ == "__main__": + main() diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/list_workflows_configuration_connections.py b/sdk/appservice/azure-mgmt-web/generated_samples/list_workflows_configuration_connections.py index dfb3933204490..dbc076333f703 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/list_workflows_configuration_connections.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/list_workflows_configuration_connections.py @@ -9,7 +9,6 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.web import WebSiteManagementClient - """ # PREREQUISITES pip install azure-identity @@ -22,22 +21,20 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ - - def main(): client = WebSiteManagementClient( credential=DefaultAzureCredential(), subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.web_apps.list_workflows_connections_slot( - resource_group_name="testrg123", - name="testsite2", - slot="staging", + response = client.web_apps.list_workflows_connections( + resource_group_name='testrg123', + name='testsite2', ) print(response) - # x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-12-01/examples/ListWorkflowsConfigurationConnections.json if __name__ == "__main__": main() +__ == "__main__": + main() diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/start_web_site_network_trace_operation.py b/sdk/appservice/azure-mgmt-web/generated_samples/start_web_site_network_trace_operation.py index f160f1323cd55..b8b2f2cb70ce5 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/start_web_site_network_trace_operation.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/start_web_site_network_trace_operation.py @@ -9,7 +9,6 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.web import WebSiteManagementClient - """ # PREREQUISITES pip install azure-identity @@ -22,21 +21,22 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ - - def main(): client = WebSiteManagementClient( credential=DefaultAzureCredential(), subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.web_apps.begin_start_web_site_network_trace_operation( - resource_group_name="testrg123", - name="SampleApp", + response = client.web_apps.begin_start_network_trace( + resource_group_name='testrg123', + name='SampleApp', ).result() print(response) - # x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-12-01/examples/StartWebSiteNetworkTraceOperation.json if __name__ == "__main__": main() +ame__ == "__main__": + main() +ain__": + main() diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/stop_web_site_network_trace.py b/sdk/appservice/azure-mgmt-web/generated_samples/stop_web_site_network_trace.py index 80dd3fc14cbb2..cb752ece4ceb0 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/stop_web_site_network_trace.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/stop_web_site_network_trace.py @@ -9,7 +9,6 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.web import WebSiteManagementClient - """ # PREREQUISITES pip install azure-identity @@ -22,20 +21,20 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ - - def main(): client = WebSiteManagementClient( credential=DefaultAzureCredential(), subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - client.web_apps.stop_web_site_network_trace( - resource_group_name="testrg123", - name="SampleApp", + client.web_apps.stop_network_trace( + resource_group_name='testrg123', + name='SampleApp', ) - # x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-12-01/examples/StopWebSiteNetworkTrace.json if __name__ == "__main__": main() +ame__ == "__main__": + main() + main() diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/update_publishing_credentials_policy.py b/sdk/appservice/azure-mgmt-web/generated_samples/update_publishing_credentials_policy.py index 6d443d4ccc810..4be024c84d2bd 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/update_publishing_credentials_policy.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/update_publishing_credentials_policy.py @@ -32,7 +32,7 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.web_apps.update_ftp_allowed( + response = client.web_apps.update_scm_allowed( resource_group_name="rg", name="testSite", csm_publishing_access_policies_entity={"properties": {"allow": True}}, diff --git a/sdk/appservice/azure-mgmt-web/generated_samples/update_publishing_credentials_policy_slot.py b/sdk/appservice/azure-mgmt-web/generated_samples/update_publishing_credentials_policy_slot.py index e40ead1978601..46ef03bae41b1 100644 --- a/sdk/appservice/azure-mgmt-web/generated_samples/update_publishing_credentials_policy_slot.py +++ b/sdk/appservice/azure-mgmt-web/generated_samples/update_publishing_credentials_policy_slot.py @@ -32,7 +32,7 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.web_apps.update_ftp_allowed_slot( + response = client.web_apps.update_scm_allowed_slot( resource_group_name="rg", name="testSite", slot="stage", diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/conftest.py b/sdk/appservice/azure-mgmt-web/generated_tests/conftest.py new file mode 100644 index 0000000000000..5bf74943ea0c0 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# 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. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + websitemanagement_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + websitemanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + websitemanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + websitemanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=websitemanagement_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=websitemanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=websitemanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=websitemanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management.py new file mode 100644 index 0000000000000..d2552e9d62820 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management.py @@ -0,0 +1,303 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagement(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_publishing_user(self, resource_group): + response = self.client.get_publishing_user( + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_publishing_user(self, resource_group): + response = self.client.update_publishing_user( + user_details={ + "id": "str", + "kind": "str", + "name": "str", + "publishingPassword": "str", + "publishingPasswordHash": "str", + "publishingPasswordHashSalt": "str", + "publishingUserName": "str", + "scmUri": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_source_controls(self, resource_group): + response = self.client.list_source_controls( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_source_control(self, resource_group): + response = self.client.get_source_control( + source_control_type="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_source_control(self, resource_group): + response = self.client.update_source_control( + source_control_type="str", + request_message={ + "expirationTime": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "name": "str", + "refreshToken": "str", + "token": "str", + "tokenSecret": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_billing_meters(self, resource_group): + response = self.client.list_billing_meters( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_name_availability(self, resource_group): + response = self.client.check_name_availability( + name="str", + type="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_custom_host_name_sites(self, resource_group): + response = self.client.list_custom_host_name_sites( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_subscription_deployment_locations(self, resource_group): + response = self.client.get_subscription_deployment_locations( + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_ase_regions(self, resource_group): + response = self.client.list_ase_regions( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_geo_regions(self, resource_group): + response = self.client.list_geo_regions( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_identifiers_assigned_to_host_name(self, resource_group): + response = self.client.list_site_identifiers_assigned_to_host_name( + name_identifier={"name": "str"}, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_premier_add_on_offers(self, resource_group): + response = self.client.list_premier_add_on_offers( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_skus(self, resource_group): + response = self.client.list_skus( + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_verify_hosting_environment_vnet(self, resource_group): + response = self.client.verify_hosting_environment_vnet( + parameters={ + "id": "str", + "kind": "str", + "name": "str", + "subnetResourceId": "str", + "type": "str", + "vnetName": "str", + "vnetResourceGroup": "str", + "vnetSubnetName": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_move(self, resource_group): + response = self.client.move( + resource_group_name=resource_group.name, + move_resource_envelope={"resources": ["str"], "targetResourceGroup": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_validate(self, resource_group): + response = self.client.validate( + resource_group_name=resource_group.name, + validate_request={ + "location": "str", + "name": "str", + "type": "str", + "appServiceEnvironment": { + "virtualNetwork": {"id": "str", "name": "str", "subnet": "str", "type": "str"}, + "clusterSettings": [{"name": "str", "value": "str"}], + "customDnsSuffixConfiguration": { + "certificateUrl": "str", + "dnsSuffix": "str", + "id": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "name": "str", + "provisioningDetails": "str", + "provisioningState": "str", + "type": "str", + }, + "dedicatedHostCount": 0, + "dnsSuffix": "str", + "frontEndScaleFactor": 0, + "hasLinuxWorkers": bool, + "internalLoadBalancingMode": "str", + "ipsslAddressCount": 0, + "maximumNumberOfMachines": 0, + "multiRoleCount": 0, + "multiSize": "str", + "networkingConfiguration": { + "allowNewPrivateEndpointConnections": bool, + "externalInboundIpAddresses": ["str"], + "ftpEnabled": bool, + "id": "str", + "inboundIpAddressOverride": "str", + "internalInboundIpAddresses": ["str"], + "kind": "str", + "linuxOutboundIpAddresses": ["str"], + "name": "str", + "remoteDebugEnabled": bool, + "type": "str", + "windowsOutboundIpAddresses": ["str"], + }, + "provisioningState": "str", + "status": "str", + "suspended": bool, + "upgradeAvailability": "str", + "upgradePreference": "None", + "userWhitelistedIpRanges": ["str"], + "zoneRedundant": bool, + }, + "capacity": 0, + "containerImagePlatform": "str", + "containerImageRepository": "str", + "containerImageTag": "str", + "containerRegistryBaseUrl": "str", + "containerRegistryPassword": "str", + "containerRegistryUsername": "str", + "hostingEnvironment": "str", + "isSpot": bool, + "isXenon": bool, + "needLinuxWorkers": bool, + "serverFarmId": "str", + "skuName": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_validate_move(self, resource_group): + response = self.client.validate_move( + resource_group_name=resource_group.name, + move_resource_envelope={"resources": ["str"], "targetResourceGroup": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_certificate_orders_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_certificate_orders_operations.py new file mode 100644 index 0000000000000..feda2625eea5c --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_certificate_orders_operations.py @@ -0,0 +1,471 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementAppServiceCertificateOrdersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.app_service_certificate_orders.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_validate_purchase_information(self, resource_group): + response = self.client.app_service_certificate_orders.validate_purchase_information( + app_service_certificate_order={ + "location": "str", + "appServiceCertificateNotRenewableReasons": ["str"], + "autoRenew": True, + "certificates": {"str": {"keyVaultId": "str", "keyVaultSecretName": "str", "provisioningState": "str"}}, + "contact": {"email": "str", "nameFirst": "str", "nameLast": "str", "phone": "str"}, + "csr": "str", + "distinguishedName": "str", + "domainVerificationToken": "str", + "expirationTime": "2020-02-20 00:00:00", + "id": "str", + "intermediate": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "isPrivateKeyExternal": bool, + "keySize": 2048, + "kind": "str", + "lastCertificateIssuanceTime": "2020-02-20 00:00:00", + "name": "str", + "nextAutoRenewalTimeStamp": "2020-02-20 00:00:00", + "productType": "str", + "provisioningState": "str", + "root": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "serialNumber": "str", + "signedCertificate": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "status": "str", + "tags": {"str": "str"}, + "type": "str", + "validityInYears": 1, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.app_service_certificate_orders.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.app_service_certificate_orders.get( + resource_group_name=resource_group.name, + certificate_order_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.app_service_certificate_orders.begin_create_or_update( + resource_group_name=resource_group.name, + certificate_order_name="str", + certificate_distinguished_name={ + "location": "str", + "appServiceCertificateNotRenewableReasons": ["str"], + "autoRenew": True, + "certificates": {"str": {"keyVaultId": "str", "keyVaultSecretName": "str", "provisioningState": "str"}}, + "contact": {"email": "str", "nameFirst": "str", "nameLast": "str", "phone": "str"}, + "csr": "str", + "distinguishedName": "str", + "domainVerificationToken": "str", + "expirationTime": "2020-02-20 00:00:00", + "id": "str", + "intermediate": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "isPrivateKeyExternal": bool, + "keySize": 2048, + "kind": "str", + "lastCertificateIssuanceTime": "2020-02-20 00:00:00", + "name": "str", + "nextAutoRenewalTimeStamp": "2020-02-20 00:00:00", + "productType": "str", + "provisioningState": "str", + "root": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "serialNumber": "str", + "signedCertificate": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "status": "str", + "tags": {"str": "str"}, + "type": "str", + "validityInYears": 1, + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.app_service_certificate_orders.delete( + resource_group_name=resource_group.name, + certificate_order_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.app_service_certificate_orders.update( + resource_group_name=resource_group.name, + certificate_order_name="str", + certificate_distinguished_name={ + "appServiceCertificateNotRenewableReasons": ["str"], + "autoRenew": True, + "certificates": {"str": {"keyVaultId": "str", "keyVaultSecretName": "str", "provisioningState": "str"}}, + "contact": {"email": "str", "nameFirst": "str", "nameLast": "str", "phone": "str"}, + "csr": "str", + "distinguishedName": "str", + "domainVerificationToken": "str", + "expirationTime": "2020-02-20 00:00:00", + "id": "str", + "intermediate": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "isPrivateKeyExternal": bool, + "keySize": 2048, + "kind": "str", + "lastCertificateIssuanceTime": "2020-02-20 00:00:00", + "name": "str", + "nextAutoRenewalTimeStamp": "2020-02-20 00:00:00", + "productType": "str", + "provisioningState": "str", + "root": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "serialNumber": "str", + "signedCertificate": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "status": "str", + "type": "str", + "validityInYears": 1, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_certificates(self, resource_group): + response = self.client.app_service_certificate_orders.list_certificates( + resource_group_name=resource_group.name, + certificate_order_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_certificate(self, resource_group): + response = self.client.app_service_certificate_orders.get_certificate( + resource_group_name=resource_group.name, + certificate_order_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update_certificate(self, resource_group): + response = self.client.app_service_certificate_orders.begin_create_or_update_certificate( + resource_group_name=resource_group.name, + certificate_order_name="str", + name="str", + key_vault_certificate={ + "location": "str", + "id": "str", + "keyVaultId": "str", + "keyVaultSecretName": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_certificate(self, resource_group): + response = self.client.app_service_certificate_orders.delete_certificate( + resource_group_name=resource_group.name, + certificate_order_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_certificate(self, resource_group): + response = self.client.app_service_certificate_orders.update_certificate( + resource_group_name=resource_group.name, + certificate_order_name="str", + name="str", + key_vault_certificate={ + "id": "str", + "keyVaultId": "str", + "keyVaultSecretName": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_reissue(self, resource_group): + response = self.client.app_service_certificate_orders.reissue( + resource_group_name=resource_group.name, + certificate_order_name="str", + reissue_certificate_order_request={ + "csr": "str", + "delayExistingRevokeInHours": 0, + "id": "str", + "isPrivateKeyExternal": bool, + "keySize": 0, + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_renew(self, resource_group): + response = self.client.app_service_certificate_orders.renew( + resource_group_name=resource_group.name, + certificate_order_name="str", + renew_certificate_order_request={ + "csr": "str", + "id": "str", + "isPrivateKeyExternal": bool, + "keySize": 0, + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resend_email(self, resource_group): + response = self.client.app_service_certificate_orders.resend_email( + resource_group_name=resource_group.name, + certificate_order_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resend_request_emails(self, resource_group): + response = self.client.app_service_certificate_orders.resend_request_emails( + resource_group_name=resource_group.name, + certificate_order_name="str", + name_identifier={"name": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_retrieve_site_seal(self, resource_group): + response = self.client.app_service_certificate_orders.retrieve_site_seal( + resource_group_name=resource_group.name, + certificate_order_name="str", + site_seal_request={"lightTheme": bool, "locale": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_verify_domain_ownership(self, resource_group): + response = self.client.app_service_certificate_orders.verify_domain_ownership( + resource_group_name=resource_group.name, + certificate_order_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_retrieve_certificate_actions(self, resource_group): + response = self.client.app_service_certificate_orders.retrieve_certificate_actions( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_retrieve_certificate_email_history(self, resource_group): + response = self.client.app_service_certificate_orders.retrieve_certificate_email_history( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_certificate_orders_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_certificate_orders_operations_async.py new file mode 100644 index 0000000000000..3d1fd182e4c90 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_certificate_orders_operations_async.py @@ -0,0 +1,478 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementAppServiceCertificateOrdersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.app_service_certificate_orders.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_validate_purchase_information(self, resource_group): + response = await self.client.app_service_certificate_orders.validate_purchase_information( + app_service_certificate_order={ + "location": "str", + "appServiceCertificateNotRenewableReasons": ["str"], + "autoRenew": True, + "certificates": {"str": {"keyVaultId": "str", "keyVaultSecretName": "str", "provisioningState": "str"}}, + "contact": {"email": "str", "nameFirst": "str", "nameLast": "str", "phone": "str"}, + "csr": "str", + "distinguishedName": "str", + "domainVerificationToken": "str", + "expirationTime": "2020-02-20 00:00:00", + "id": "str", + "intermediate": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "isPrivateKeyExternal": bool, + "keySize": 2048, + "kind": "str", + "lastCertificateIssuanceTime": "2020-02-20 00:00:00", + "name": "str", + "nextAutoRenewalTimeStamp": "2020-02-20 00:00:00", + "productType": "str", + "provisioningState": "str", + "root": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "serialNumber": "str", + "signedCertificate": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "status": "str", + "tags": {"str": "str"}, + "type": "str", + "validityInYears": 1, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.app_service_certificate_orders.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.app_service_certificate_orders.get( + resource_group_name=resource_group.name, + certificate_order_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.app_service_certificate_orders.begin_create_or_update( + resource_group_name=resource_group.name, + certificate_order_name="str", + certificate_distinguished_name={ + "location": "str", + "appServiceCertificateNotRenewableReasons": ["str"], + "autoRenew": True, + "certificates": { + "str": {"keyVaultId": "str", "keyVaultSecretName": "str", "provisioningState": "str"} + }, + "contact": {"email": "str", "nameFirst": "str", "nameLast": "str", "phone": "str"}, + "csr": "str", + "distinguishedName": "str", + "domainVerificationToken": "str", + "expirationTime": "2020-02-20 00:00:00", + "id": "str", + "intermediate": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "isPrivateKeyExternal": bool, + "keySize": 2048, + "kind": "str", + "lastCertificateIssuanceTime": "2020-02-20 00:00:00", + "name": "str", + "nextAutoRenewalTimeStamp": "2020-02-20 00:00:00", + "productType": "str", + "provisioningState": "str", + "root": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "serialNumber": "str", + "signedCertificate": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "status": "str", + "tags": {"str": "str"}, + "type": "str", + "validityInYears": 1, + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.app_service_certificate_orders.delete( + resource_group_name=resource_group.name, + certificate_order_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.app_service_certificate_orders.update( + resource_group_name=resource_group.name, + certificate_order_name="str", + certificate_distinguished_name={ + "appServiceCertificateNotRenewableReasons": ["str"], + "autoRenew": True, + "certificates": {"str": {"keyVaultId": "str", "keyVaultSecretName": "str", "provisioningState": "str"}}, + "contact": {"email": "str", "nameFirst": "str", "nameLast": "str", "phone": "str"}, + "csr": "str", + "distinguishedName": "str", + "domainVerificationToken": "str", + "expirationTime": "2020-02-20 00:00:00", + "id": "str", + "intermediate": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "isPrivateKeyExternal": bool, + "keySize": 2048, + "kind": "str", + "lastCertificateIssuanceTime": "2020-02-20 00:00:00", + "name": "str", + "nextAutoRenewalTimeStamp": "2020-02-20 00:00:00", + "productType": "str", + "provisioningState": "str", + "root": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "serialNumber": "str", + "signedCertificate": { + "issuer": "str", + "notAfter": "2020-02-20 00:00:00", + "notBefore": "2020-02-20 00:00:00", + "rawData": "str", + "serialNumber": "str", + "signatureAlgorithm": "str", + "subject": "str", + "thumbprint": "str", + "version": 0, + }, + "status": "str", + "type": "str", + "validityInYears": 1, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_certificates(self, resource_group): + response = self.client.app_service_certificate_orders.list_certificates( + resource_group_name=resource_group.name, + certificate_order_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_certificate(self, resource_group): + response = await self.client.app_service_certificate_orders.get_certificate( + resource_group_name=resource_group.name, + certificate_order_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update_certificate(self, resource_group): + response = await ( + await self.client.app_service_certificate_orders.begin_create_or_update_certificate( + resource_group_name=resource_group.name, + certificate_order_name="str", + name="str", + key_vault_certificate={ + "location": "str", + "id": "str", + "keyVaultId": "str", + "keyVaultSecretName": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_certificate(self, resource_group): + response = await self.client.app_service_certificate_orders.delete_certificate( + resource_group_name=resource_group.name, + certificate_order_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_certificate(self, resource_group): + response = await self.client.app_service_certificate_orders.update_certificate( + resource_group_name=resource_group.name, + certificate_order_name="str", + name="str", + key_vault_certificate={ + "id": "str", + "keyVaultId": "str", + "keyVaultSecretName": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_reissue(self, resource_group): + response = await self.client.app_service_certificate_orders.reissue( + resource_group_name=resource_group.name, + certificate_order_name="str", + reissue_certificate_order_request={ + "csr": "str", + "delayExistingRevokeInHours": 0, + "id": "str", + "isPrivateKeyExternal": bool, + "keySize": 0, + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_renew(self, resource_group): + response = await self.client.app_service_certificate_orders.renew( + resource_group_name=resource_group.name, + certificate_order_name="str", + renew_certificate_order_request={ + "csr": "str", + "id": "str", + "isPrivateKeyExternal": bool, + "keySize": 0, + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resend_email(self, resource_group): + response = await self.client.app_service_certificate_orders.resend_email( + resource_group_name=resource_group.name, + certificate_order_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resend_request_emails(self, resource_group): + response = await self.client.app_service_certificate_orders.resend_request_emails( + resource_group_name=resource_group.name, + certificate_order_name="str", + name_identifier={"name": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_retrieve_site_seal(self, resource_group): + response = await self.client.app_service_certificate_orders.retrieve_site_seal( + resource_group_name=resource_group.name, + certificate_order_name="str", + site_seal_request={"lightTheme": bool, "locale": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_verify_domain_ownership(self, resource_group): + response = await self.client.app_service_certificate_orders.verify_domain_ownership( + resource_group_name=resource_group.name, + certificate_order_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_retrieve_certificate_actions(self, resource_group): + response = await self.client.app_service_certificate_orders.retrieve_certificate_actions( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_retrieve_certificate_email_history(self, resource_group): + response = await self.client.app_service_certificate_orders.retrieve_certificate_email_history( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_environments_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_environments_operations.py new file mode 100644 index 0000000000000..b498b6029c8a4 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_environments_operations.py @@ -0,0 +1,825 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementAppServiceEnvironmentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.app_service_environments.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.app_service_environments.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.app_service_environments.get( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.app_service_environments.begin_create_or_update( + resource_group_name=resource_group.name, + name="str", + hosting_environment_envelope={ + "location": "str", + "clusterSettings": [{"name": "str", "value": "str"}], + "customDnsSuffixConfiguration": { + "certificateUrl": "str", + "dnsSuffix": "str", + "id": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "name": "str", + "provisioningDetails": "str", + "provisioningState": "str", + "type": "str", + }, + "dedicatedHostCount": 0, + "dnsSuffix": "str", + "frontEndScaleFactor": 0, + "hasLinuxWorkers": bool, + "id": "str", + "internalLoadBalancingMode": "str", + "ipsslAddressCount": 0, + "kind": "str", + "maximumNumberOfMachines": 0, + "multiRoleCount": 0, + "multiSize": "str", + "name": "str", + "networkingConfiguration": { + "allowNewPrivateEndpointConnections": bool, + "externalInboundIpAddresses": ["str"], + "ftpEnabled": bool, + "id": "str", + "inboundIpAddressOverride": "str", + "internalInboundIpAddresses": ["str"], + "kind": "str", + "linuxOutboundIpAddresses": ["str"], + "name": "str", + "remoteDebugEnabled": bool, + "type": "str", + "windowsOutboundIpAddresses": ["str"], + }, + "provisioningState": "str", + "status": "str", + "suspended": bool, + "tags": {"str": "str"}, + "type": "str", + "upgradeAvailability": "str", + "upgradePreference": "None", + "userWhitelistedIpRanges": ["str"], + "virtualNetwork": {"id": "str", "name": "str", "subnet": "str", "type": "str"}, + "zoneRedundant": bool, + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.app_service_environments.begin_delete( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.app_service_environments.update( + resource_group_name=resource_group.name, + name="str", + hosting_environment_envelope={ + "clusterSettings": [{"name": "str", "value": "str"}], + "customDnsSuffixConfiguration": { + "certificateUrl": "str", + "dnsSuffix": "str", + "id": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "name": "str", + "provisioningDetails": "str", + "provisioningState": "str", + "type": "str", + }, + "dedicatedHostCount": 0, + "dnsSuffix": "str", + "frontEndScaleFactor": 0, + "hasLinuxWorkers": bool, + "id": "str", + "internalLoadBalancingMode": "str", + "ipsslAddressCount": 0, + "kind": "str", + "maximumNumberOfMachines": 0, + "multiRoleCount": 0, + "multiSize": "str", + "name": "str", + "networkingConfiguration": { + "allowNewPrivateEndpointConnections": bool, + "externalInboundIpAddresses": ["str"], + "ftpEnabled": bool, + "id": "str", + "inboundIpAddressOverride": "str", + "internalInboundIpAddresses": ["str"], + "kind": "str", + "linuxOutboundIpAddresses": ["str"], + "name": "str", + "remoteDebugEnabled": bool, + "type": "str", + "windowsOutboundIpAddresses": ["str"], + }, + "provisioningState": "str", + "status": "str", + "suspended": bool, + "type": "str", + "upgradeAvailability": "str", + "upgradePreference": "None", + "userWhitelistedIpRanges": ["str"], + "virtualNetwork": {"id": "str", "name": "str", "subnet": "str", "type": "str"}, + "zoneRedundant": bool, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_capacities(self, resource_group): + response = self.client.app_service_environments.list_capacities( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_vip_info(self, resource_group): + response = self.client.app_service_environments.get_vip_info( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_change_vnet(self, resource_group): + response = self.client.app_service_environments.begin_change_vnet( + resource_group_name=resource_group.name, + name="str", + vnet_info={"id": "str", "name": "str", "subnet": "str", "type": "str"}, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_ase_custom_dns_suffix_configuration(self, resource_group): + response = self.client.app_service_environments.get_ase_custom_dns_suffix_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_ase_custom_dns_suffix_configuration(self, resource_group): + response = self.client.app_service_environments.update_ase_custom_dns_suffix_configuration( + resource_group_name=resource_group.name, + name="str", + custom_dns_suffix_configuration={ + "certificateUrl": "str", + "dnsSuffix": "str", + "id": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "name": "str", + "provisioningDetails": "str", + "provisioningState": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_ase_custom_dns_suffix_configuration(self, resource_group): + response = self.client.app_service_environments.delete_ase_custom_dns_suffix_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_ase_v3_networking_configuration(self, resource_group): + response = self.client.app_service_environments.get_ase_v3_networking_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_ase_networking_configuration(self, resource_group): + response = self.client.app_service_environments.update_ase_networking_configuration( + resource_group_name=resource_group.name, + name="str", + ase_networking_configuration={ + "allowNewPrivateEndpointConnections": bool, + "externalInboundIpAddresses": ["str"], + "ftpEnabled": bool, + "id": "str", + "inboundIpAddressOverride": "str", + "internalInboundIpAddresses": ["str"], + "kind": "str", + "linuxOutboundIpAddresses": ["str"], + "name": "str", + "remoteDebugEnabled": bool, + "type": "str", + "windowsOutboundIpAddresses": ["str"], + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_diagnostics(self, resource_group): + response = self.client.app_service_environments.list_diagnostics( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_diagnostics_item(self, resource_group): + response = self.client.app_service_environments.get_diagnostics_item( + resource_group_name=resource_group.name, + name="str", + diagnostics_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_inbound_network_dependencies_endpoints(self, resource_group): + response = self.client.app_service_environments.get_inbound_network_dependencies_endpoints( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_multi_role_pools(self, resource_group): + response = self.client.app_service_environments.list_multi_role_pools( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_multi_role_pool(self, resource_group): + response = self.client.app_service_environments.get_multi_role_pool( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update_multi_role_pool(self, resource_group): + response = self.client.app_service_environments.begin_create_or_update_multi_role_pool( + resource_group_name=resource_group.name, + name="str", + multi_role_pool_envelope={ + "computeMode": "str", + "id": "str", + "instanceNames": ["str"], + "kind": "str", + "name": "str", + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": {"default": 0, "elasticMaximum": 0, "maximum": 0, "minimum": 0, "scaleType": "str"}, + "tier": "str", + }, + "type": "str", + "workerCount": 0, + "workerSize": "str", + "workerSizeId": 0, + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_multi_role_pool(self, resource_group): + response = self.client.app_service_environments.update_multi_role_pool( + resource_group_name=resource_group.name, + name="str", + multi_role_pool_envelope={ + "computeMode": "str", + "id": "str", + "instanceNames": ["str"], + "kind": "str", + "name": "str", + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": {"default": 0, "elasticMaximum": 0, "maximum": 0, "minimum": 0, "scaleType": "str"}, + "tier": "str", + }, + "type": "str", + "workerCount": 0, + "workerSize": "str", + "workerSizeId": 0, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_multi_role_pool_instance_metric_definitions(self, resource_group): + response = self.client.app_service_environments.list_multi_role_pool_instance_metric_definitions( + resource_group_name=resource_group.name, + name="str", + instance="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_multi_role_metric_definitions(self, resource_group): + response = self.client.app_service_environments.list_multi_role_metric_definitions( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_multi_role_pool_skus(self, resource_group): + response = self.client.app_service_environments.list_multi_role_pool_skus( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_test_upgrade_available_notification(self, resource_group): + response = self.client.app_service_environments.test_upgrade_available_notification( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_upgrade(self, resource_group): + response = self.client.app_service_environments.begin_upgrade( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_multi_role_usages(self, resource_group): + response = self.client.app_service_environments.list_multi_role_usages( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_operations(self, resource_group): + response = self.client.app_service_environments.list_operations( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_outbound_network_dependencies_endpoints(self, resource_group): + response = self.client.app_service_environments.get_outbound_network_dependencies_endpoints( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_endpoint_connection_list(self, resource_group): + response = self.client.app_service_environments.get_private_endpoint_connection_list( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_endpoint_connection(self, resource_group): + response = self.client.app_service_environments.get_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_approve_or_reject_private_endpoint_connection(self, resource_group): + response = self.client.app_service_environments.begin_approve_or_reject_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + private_endpoint_wrapper={ + "id": "str", + "ipAddresses": ["str"], + "kind": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_private_endpoint_connection(self, resource_group): + response = self.client.app_service_environments.begin_delete_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_link_resources(self, resource_group): + response = self.client.app_service_environments.get_private_link_resources( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_reboot(self, resource_group): + response = self.client.app_service_environments.reboot( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_resume(self, resource_group): + response = self.client.app_service_environments.begin_resume( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_app_service_plans(self, resource_group): + response = self.client.app_service_environments.list_app_service_plans( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_web_apps(self, resource_group): + response = self.client.app_service_environments.list_web_apps( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_suspend(self, resource_group): + response = self.client.app_service_environments.begin_suspend( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_usages(self, resource_group): + response = self.client.app_service_environments.list_usages( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_worker_pools(self, resource_group): + response = self.client.app_service_environments.list_worker_pools( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_worker_pool(self, resource_group): + response = self.client.app_service_environments.get_worker_pool( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update_worker_pool(self, resource_group): + response = self.client.app_service_environments.begin_create_or_update_worker_pool( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + worker_pool_envelope={ + "computeMode": "str", + "id": "str", + "instanceNames": ["str"], + "kind": "str", + "name": "str", + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": {"default": 0, "elasticMaximum": 0, "maximum": 0, "minimum": 0, "scaleType": "str"}, + "tier": "str", + }, + "type": "str", + "workerCount": 0, + "workerSize": "str", + "workerSizeId": 0, + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_worker_pool(self, resource_group): + response = self.client.app_service_environments.update_worker_pool( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + worker_pool_envelope={ + "computeMode": "str", + "id": "str", + "instanceNames": ["str"], + "kind": "str", + "name": "str", + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": {"default": 0, "elasticMaximum": 0, "maximum": 0, "minimum": 0, "scaleType": "str"}, + "tier": "str", + }, + "type": "str", + "workerCount": 0, + "workerSize": "str", + "workerSizeId": 0, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_worker_pool_instance_metric_definitions(self, resource_group): + response = self.client.app_service_environments.list_worker_pool_instance_metric_definitions( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + instance="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_web_worker_metric_definitions(self, resource_group): + response = self.client.app_service_environments.list_web_worker_metric_definitions( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_worker_pool_skus(self, resource_group): + response = self.client.app_service_environments.list_worker_pool_skus( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_web_worker_usages(self, resource_group): + response = self.client.app_service_environments.list_web_worker_usages( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_environments_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_environments_operations_async.py new file mode 100644 index 0000000000000..f97390a198998 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_environments_operations_async.py @@ -0,0 +1,862 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementAppServiceEnvironmentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.app_service_environments.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.app_service_environments.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.app_service_environments.get( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.app_service_environments.begin_create_or_update( + resource_group_name=resource_group.name, + name="str", + hosting_environment_envelope={ + "location": "str", + "clusterSettings": [{"name": "str", "value": "str"}], + "customDnsSuffixConfiguration": { + "certificateUrl": "str", + "dnsSuffix": "str", + "id": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "name": "str", + "provisioningDetails": "str", + "provisioningState": "str", + "type": "str", + }, + "dedicatedHostCount": 0, + "dnsSuffix": "str", + "frontEndScaleFactor": 0, + "hasLinuxWorkers": bool, + "id": "str", + "internalLoadBalancingMode": "str", + "ipsslAddressCount": 0, + "kind": "str", + "maximumNumberOfMachines": 0, + "multiRoleCount": 0, + "multiSize": "str", + "name": "str", + "networkingConfiguration": { + "allowNewPrivateEndpointConnections": bool, + "externalInboundIpAddresses": ["str"], + "ftpEnabled": bool, + "id": "str", + "inboundIpAddressOverride": "str", + "internalInboundIpAddresses": ["str"], + "kind": "str", + "linuxOutboundIpAddresses": ["str"], + "name": "str", + "remoteDebugEnabled": bool, + "type": "str", + "windowsOutboundIpAddresses": ["str"], + }, + "provisioningState": "str", + "status": "str", + "suspended": bool, + "tags": {"str": "str"}, + "type": "str", + "upgradeAvailability": "str", + "upgradePreference": "None", + "userWhitelistedIpRanges": ["str"], + "virtualNetwork": {"id": "str", "name": "str", "subnet": "str", "type": "str"}, + "zoneRedundant": bool, + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.app_service_environments.begin_delete( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.app_service_environments.update( + resource_group_name=resource_group.name, + name="str", + hosting_environment_envelope={ + "clusterSettings": [{"name": "str", "value": "str"}], + "customDnsSuffixConfiguration": { + "certificateUrl": "str", + "dnsSuffix": "str", + "id": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "name": "str", + "provisioningDetails": "str", + "provisioningState": "str", + "type": "str", + }, + "dedicatedHostCount": 0, + "dnsSuffix": "str", + "frontEndScaleFactor": 0, + "hasLinuxWorkers": bool, + "id": "str", + "internalLoadBalancingMode": "str", + "ipsslAddressCount": 0, + "kind": "str", + "maximumNumberOfMachines": 0, + "multiRoleCount": 0, + "multiSize": "str", + "name": "str", + "networkingConfiguration": { + "allowNewPrivateEndpointConnections": bool, + "externalInboundIpAddresses": ["str"], + "ftpEnabled": bool, + "id": "str", + "inboundIpAddressOverride": "str", + "internalInboundIpAddresses": ["str"], + "kind": "str", + "linuxOutboundIpAddresses": ["str"], + "name": "str", + "remoteDebugEnabled": bool, + "type": "str", + "windowsOutboundIpAddresses": ["str"], + }, + "provisioningState": "str", + "status": "str", + "suspended": bool, + "type": "str", + "upgradeAvailability": "str", + "upgradePreference": "None", + "userWhitelistedIpRanges": ["str"], + "virtualNetwork": {"id": "str", "name": "str", "subnet": "str", "type": "str"}, + "zoneRedundant": bool, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_capacities(self, resource_group): + response = self.client.app_service_environments.list_capacities( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_vip_info(self, resource_group): + response = await self.client.app_service_environments.get_vip_info( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_change_vnet(self, resource_group): + response = await ( + await self.client.app_service_environments.begin_change_vnet( + resource_group_name=resource_group.name, + name="str", + vnet_info={"id": "str", "name": "str", "subnet": "str", "type": "str"}, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_ase_custom_dns_suffix_configuration(self, resource_group): + response = await self.client.app_service_environments.get_ase_custom_dns_suffix_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_ase_custom_dns_suffix_configuration(self, resource_group): + response = await self.client.app_service_environments.update_ase_custom_dns_suffix_configuration( + resource_group_name=resource_group.name, + name="str", + custom_dns_suffix_configuration={ + "certificateUrl": "str", + "dnsSuffix": "str", + "id": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "name": "str", + "provisioningDetails": "str", + "provisioningState": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_ase_custom_dns_suffix_configuration(self, resource_group): + response = await self.client.app_service_environments.delete_ase_custom_dns_suffix_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_ase_v3_networking_configuration(self, resource_group): + response = await self.client.app_service_environments.get_ase_v3_networking_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_ase_networking_configuration(self, resource_group): + response = await self.client.app_service_environments.update_ase_networking_configuration( + resource_group_name=resource_group.name, + name="str", + ase_networking_configuration={ + "allowNewPrivateEndpointConnections": bool, + "externalInboundIpAddresses": ["str"], + "ftpEnabled": bool, + "id": "str", + "inboundIpAddressOverride": "str", + "internalInboundIpAddresses": ["str"], + "kind": "str", + "linuxOutboundIpAddresses": ["str"], + "name": "str", + "remoteDebugEnabled": bool, + "type": "str", + "windowsOutboundIpAddresses": ["str"], + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_diagnostics(self, resource_group): + response = await self.client.app_service_environments.list_diagnostics( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_diagnostics_item(self, resource_group): + response = await self.client.app_service_environments.get_diagnostics_item( + resource_group_name=resource_group.name, + name="str", + diagnostics_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_inbound_network_dependencies_endpoints(self, resource_group): + response = self.client.app_service_environments.get_inbound_network_dependencies_endpoints( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_multi_role_pools(self, resource_group): + response = self.client.app_service_environments.list_multi_role_pools( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_multi_role_pool(self, resource_group): + response = await self.client.app_service_environments.get_multi_role_pool( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update_multi_role_pool(self, resource_group): + response = await ( + await self.client.app_service_environments.begin_create_or_update_multi_role_pool( + resource_group_name=resource_group.name, + name="str", + multi_role_pool_envelope={ + "computeMode": "str", + "id": "str", + "instanceNames": ["str"], + "kind": "str", + "name": "str", + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": { + "default": 0, + "elasticMaximum": 0, + "maximum": 0, + "minimum": 0, + "scaleType": "str", + }, + "tier": "str", + }, + "type": "str", + "workerCount": 0, + "workerSize": "str", + "workerSizeId": 0, + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_multi_role_pool(self, resource_group): + response = await self.client.app_service_environments.update_multi_role_pool( + resource_group_name=resource_group.name, + name="str", + multi_role_pool_envelope={ + "computeMode": "str", + "id": "str", + "instanceNames": ["str"], + "kind": "str", + "name": "str", + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": {"default": 0, "elasticMaximum": 0, "maximum": 0, "minimum": 0, "scaleType": "str"}, + "tier": "str", + }, + "type": "str", + "workerCount": 0, + "workerSize": "str", + "workerSizeId": 0, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_multi_role_pool_instance_metric_definitions(self, resource_group): + response = self.client.app_service_environments.list_multi_role_pool_instance_metric_definitions( + resource_group_name=resource_group.name, + name="str", + instance="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_multi_role_metric_definitions(self, resource_group): + response = self.client.app_service_environments.list_multi_role_metric_definitions( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_multi_role_pool_skus(self, resource_group): + response = self.client.app_service_environments.list_multi_role_pool_skus( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_test_upgrade_available_notification(self, resource_group): + response = await self.client.app_service_environments.test_upgrade_available_notification( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_upgrade(self, resource_group): + response = await ( + await self.client.app_service_environments.begin_upgrade( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_multi_role_usages(self, resource_group): + response = self.client.app_service_environments.list_multi_role_usages( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_operations(self, resource_group): + response = await self.client.app_service_environments.list_operations( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_outbound_network_dependencies_endpoints(self, resource_group): + response = self.client.app_service_environments.get_outbound_network_dependencies_endpoints( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_endpoint_connection_list(self, resource_group): + response = self.client.app_service_environments.get_private_endpoint_connection_list( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_endpoint_connection(self, resource_group): + response = await self.client.app_service_environments.get_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_approve_or_reject_private_endpoint_connection(self, resource_group): + response = await ( + await self.client.app_service_environments.begin_approve_or_reject_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + private_endpoint_wrapper={ + "id": "str", + "ipAddresses": ["str"], + "kind": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_private_endpoint_connection(self, resource_group): + response = await ( + await self.client.app_service_environments.begin_delete_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_link_resources(self, resource_group): + response = await self.client.app_service_environments.get_private_link_resources( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_reboot(self, resource_group): + response = await self.client.app_service_environments.reboot( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_resume(self, resource_group): + response = await ( + await self.client.app_service_environments.begin_resume( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_app_service_plans(self, resource_group): + response = self.client.app_service_environments.list_app_service_plans( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_web_apps(self, resource_group): + response = self.client.app_service_environments.list_web_apps( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_suspend(self, resource_group): + response = await ( + await self.client.app_service_environments.begin_suspend( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_usages(self, resource_group): + response = self.client.app_service_environments.list_usages( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_worker_pools(self, resource_group): + response = self.client.app_service_environments.list_worker_pools( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_worker_pool(self, resource_group): + response = await self.client.app_service_environments.get_worker_pool( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update_worker_pool(self, resource_group): + response = await ( + await self.client.app_service_environments.begin_create_or_update_worker_pool( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + worker_pool_envelope={ + "computeMode": "str", + "id": "str", + "instanceNames": ["str"], + "kind": "str", + "name": "str", + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": { + "default": 0, + "elasticMaximum": 0, + "maximum": 0, + "minimum": 0, + "scaleType": "str", + }, + "tier": "str", + }, + "type": "str", + "workerCount": 0, + "workerSize": "str", + "workerSizeId": 0, + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_worker_pool(self, resource_group): + response = await self.client.app_service_environments.update_worker_pool( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + worker_pool_envelope={ + "computeMode": "str", + "id": "str", + "instanceNames": ["str"], + "kind": "str", + "name": "str", + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": {"default": 0, "elasticMaximum": 0, "maximum": 0, "minimum": 0, "scaleType": "str"}, + "tier": "str", + }, + "type": "str", + "workerCount": 0, + "workerSize": "str", + "workerSizeId": 0, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_worker_pool_instance_metric_definitions(self, resource_group): + response = self.client.app_service_environments.list_worker_pool_instance_metric_definitions( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + instance="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_web_worker_metric_definitions(self, resource_group): + response = self.client.app_service_environments.list_web_worker_metric_definitions( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_worker_pool_skus(self, resource_group): + response = self.client.app_service_environments.list_worker_pool_skus( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_web_worker_usages(self, resource_group): + response = self.client.app_service_environments.list_web_worker_usages( + resource_group_name=resource_group.name, + name="str", + worker_pool_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_plans_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_plans_operations.py new file mode 100644 index 0000000000000..08537004fa189 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_plans_operations.py @@ -0,0 +1,460 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementAppServicePlansOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.app_service_plans.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.app_service_plans.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.app_service_plans.get( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.app_service_plans.begin_create_or_update( + resource_group_name=resource_group.name, + name="str", + app_service_plan={ + "location": "str", + "elasticScaleEnabled": bool, + "extendedLocation": {"name": "str", "type": "str"}, + "freeOfferExpirationTime": "2020-02-20 00:00:00", + "geoRegion": "str", + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "hyperV": False, + "id": "str", + "isSpot": bool, + "isXenon": False, + "kind": "str", + "kubeEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "maximumElasticWorkerCount": 0, + "maximumNumberOfWorkers": 0, + "name": "str", + "numberOfSites": 0, + "numberOfWorkers": 0, + "perSiteScaling": False, + "provisioningState": "str", + "reserved": False, + "resourceGroup": "str", + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": {"default": 0, "elasticMaximum": 0, "maximum": 0, "minimum": 0, "scaleType": "str"}, + "tier": "str", + }, + "spotExpirationTime": "2020-02-20 00:00:00", + "status": "str", + "subscription": "str", + "tags": {"str": "str"}, + "targetWorkerCount": 0, + "targetWorkerSizeId": 0, + "type": "str", + "workerTierName": "str", + "zoneRedundant": False, + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.app_service_plans.delete( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.app_service_plans.update( + resource_group_name=resource_group.name, + name="str", + app_service_plan={ + "elasticScaleEnabled": bool, + "freeOfferExpirationTime": "2020-02-20 00:00:00", + "geoRegion": "str", + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "hyperV": False, + "id": "str", + "isSpot": bool, + "isXenon": False, + "kind": "str", + "kubeEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "maximumElasticWorkerCount": 0, + "maximumNumberOfWorkers": 0, + "name": "str", + "numberOfSites": 0, + "numberOfWorkers": 0, + "perSiteScaling": False, + "provisioningState": "str", + "reserved": False, + "resourceGroup": "str", + "spotExpirationTime": "2020-02-20 00:00:00", + "status": "str", + "subscription": "str", + "targetWorkerCount": 0, + "targetWorkerSizeId": 0, + "type": "str", + "workerTierName": "str", + "zoneRedundant": False, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_capabilities(self, resource_group): + response = self.client.app_service_plans.list_capabilities( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_hybrid_connection(self, resource_group): + response = self.client.app_service_plans.get_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_hybrid_connection(self, resource_group): + response = self.client.app_service_plans.delete_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_hybrid_connection_keys(self, resource_group): + response = self.client.app_service_plans.list_hybrid_connection_keys( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_web_apps_by_hybrid_connection(self, resource_group): + response = self.client.app_service_plans.list_web_apps_by_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_hybrid_connection_plan_limit(self, resource_group): + response = self.client.app_service_plans.get_hybrid_connection_plan_limit( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_hybrid_connections(self, resource_group): + response = self.client.app_service_plans.list_hybrid_connections( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restart_web_apps(self, resource_group): + response = self.client.app_service_plans.restart_web_apps( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_web_apps(self, resource_group): + response = self.client.app_service_plans.list_web_apps( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_server_farm_skus(self, resource_group): + response = self.client.app_service_plans.get_server_farm_skus( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_usages(self, resource_group): + response = self.client.app_service_plans.list_usages( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_vnets(self, resource_group): + response = self.client.app_service_plans.list_vnets( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_vnet_from_server_farm(self, resource_group): + response = self.client.app_service_plans.get_vnet_from_server_farm( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_vnet_gateway(self, resource_group): + response = self.client.app_service_plans.get_vnet_gateway( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_vnet_gateway(self, resource_group): + response = self.client.app_service_plans.update_vnet_gateway( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "vnetName": "str", + "vpnPackageUri": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_routes_for_vnet(self, resource_group): + response = self.client.app_service_plans.list_routes_for_vnet( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_route_for_vnet(self, resource_group): + response = self.client.app_service_plans.get_route_for_vnet( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + route_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_vnet_route(self, resource_group): + response = self.client.app_service_plans.create_or_update_vnet_route( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + route_name="str", + route={ + "endAddress": "str", + "id": "str", + "kind": "str", + "name": "str", + "routeType": "str", + "startAddress": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_vnet_route(self, resource_group): + response = self.client.app_service_plans.delete_vnet_route( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + route_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_vnet_route(self, resource_group): + response = self.client.app_service_plans.update_vnet_route( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + route_name="str", + route={ + "endAddress": "str", + "id": "str", + "kind": "str", + "name": "str", + "routeType": "str", + "startAddress": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_reboot_worker(self, resource_group): + response = self.client.app_service_plans.reboot_worker( + resource_group_name=resource_group.name, + name="str", + worker_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_plans_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_plans_operations_async.py new file mode 100644 index 0000000000000..646c01e77bf6f --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_app_service_plans_operations_async.py @@ -0,0 +1,469 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementAppServicePlansOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.app_service_plans.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.app_service_plans.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.app_service_plans.get( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.app_service_plans.begin_create_or_update( + resource_group_name=resource_group.name, + name="str", + app_service_plan={ + "location": "str", + "elasticScaleEnabled": bool, + "extendedLocation": {"name": "str", "type": "str"}, + "freeOfferExpirationTime": "2020-02-20 00:00:00", + "geoRegion": "str", + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "hyperV": False, + "id": "str", + "isSpot": bool, + "isXenon": False, + "kind": "str", + "kubeEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "maximumElasticWorkerCount": 0, + "maximumNumberOfWorkers": 0, + "name": "str", + "numberOfSites": 0, + "numberOfWorkers": 0, + "perSiteScaling": False, + "provisioningState": "str", + "reserved": False, + "resourceGroup": "str", + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": { + "default": 0, + "elasticMaximum": 0, + "maximum": 0, + "minimum": 0, + "scaleType": "str", + }, + "tier": "str", + }, + "spotExpirationTime": "2020-02-20 00:00:00", + "status": "str", + "subscription": "str", + "tags": {"str": "str"}, + "targetWorkerCount": 0, + "targetWorkerSizeId": 0, + "type": "str", + "workerTierName": "str", + "zoneRedundant": False, + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.app_service_plans.delete( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.app_service_plans.update( + resource_group_name=resource_group.name, + name="str", + app_service_plan={ + "elasticScaleEnabled": bool, + "freeOfferExpirationTime": "2020-02-20 00:00:00", + "geoRegion": "str", + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "hyperV": False, + "id": "str", + "isSpot": bool, + "isXenon": False, + "kind": "str", + "kubeEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "maximumElasticWorkerCount": 0, + "maximumNumberOfWorkers": 0, + "name": "str", + "numberOfSites": 0, + "numberOfWorkers": 0, + "perSiteScaling": False, + "provisioningState": "str", + "reserved": False, + "resourceGroup": "str", + "spotExpirationTime": "2020-02-20 00:00:00", + "status": "str", + "subscription": "str", + "targetWorkerCount": 0, + "targetWorkerSizeId": 0, + "type": "str", + "workerTierName": "str", + "zoneRedundant": False, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_capabilities(self, resource_group): + response = await self.client.app_service_plans.list_capabilities( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_hybrid_connection(self, resource_group): + response = await self.client.app_service_plans.get_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_hybrid_connection(self, resource_group): + response = await self.client.app_service_plans.delete_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_hybrid_connection_keys(self, resource_group): + response = await self.client.app_service_plans.list_hybrid_connection_keys( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_web_apps_by_hybrid_connection(self, resource_group): + response = self.client.app_service_plans.list_web_apps_by_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_hybrid_connection_plan_limit(self, resource_group): + response = await self.client.app_service_plans.get_hybrid_connection_plan_limit( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_hybrid_connections(self, resource_group): + response = self.client.app_service_plans.list_hybrid_connections( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restart_web_apps(self, resource_group): + response = await self.client.app_service_plans.restart_web_apps( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_web_apps(self, resource_group): + response = self.client.app_service_plans.list_web_apps( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_server_farm_skus(self, resource_group): + response = await self.client.app_service_plans.get_server_farm_skus( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_usages(self, resource_group): + response = self.client.app_service_plans.list_usages( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_vnets(self, resource_group): + response = await self.client.app_service_plans.list_vnets( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_vnet_from_server_farm(self, resource_group): + response = await self.client.app_service_plans.get_vnet_from_server_farm( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_vnet_gateway(self, resource_group): + response = await self.client.app_service_plans.get_vnet_gateway( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_vnet_gateway(self, resource_group): + response = await self.client.app_service_plans.update_vnet_gateway( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "vnetName": "str", + "vpnPackageUri": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_routes_for_vnet(self, resource_group): + response = await self.client.app_service_plans.list_routes_for_vnet( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_route_for_vnet(self, resource_group): + response = await self.client.app_service_plans.get_route_for_vnet( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + route_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_vnet_route(self, resource_group): + response = await self.client.app_service_plans.create_or_update_vnet_route( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + route_name="str", + route={ + "endAddress": "str", + "id": "str", + "kind": "str", + "name": "str", + "routeType": "str", + "startAddress": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_vnet_route(self, resource_group): + response = await self.client.app_service_plans.delete_vnet_route( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + route_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_vnet_route(self, resource_group): + response = await self.client.app_service_plans.update_vnet_route( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + route_name="str", + route={ + "endAddress": "str", + "id": "str", + "kind": "str", + "name": "str", + "routeType": "str", + "startAddress": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_reboot_worker(self, resource_group): + response = await self.client.app_service_plans.reboot_worker( + resource_group_name=resource_group.name, + name="str", + worker_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_async.py new file mode 100644 index 0000000000000..f5963da367b64 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_async.py @@ -0,0 +1,304 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_publishing_user(self, resource_group): + response = await self.client.get_publishing_user( + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_publishing_user(self, resource_group): + response = await self.client.update_publishing_user( + user_details={ + "id": "str", + "kind": "str", + "name": "str", + "publishingPassword": "str", + "publishingPasswordHash": "str", + "publishingPasswordHashSalt": "str", + "publishingUserName": "str", + "scmUri": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_source_controls(self, resource_group): + response = self.client.list_source_controls( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_source_control(self, resource_group): + response = await self.client.get_source_control( + source_control_type="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_source_control(self, resource_group): + response = await self.client.update_source_control( + source_control_type="str", + request_message={ + "expirationTime": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "name": "str", + "refreshToken": "str", + "token": "str", + "tokenSecret": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_billing_meters(self, resource_group): + response = self.client.list_billing_meters( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_name_availability(self, resource_group): + response = await self.client.check_name_availability( + name="str", + type="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_custom_host_name_sites(self, resource_group): + response = self.client.list_custom_host_name_sites( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_subscription_deployment_locations(self, resource_group): + response = await self.client.get_subscription_deployment_locations( + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_ase_regions(self, resource_group): + response = self.client.list_ase_regions( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_geo_regions(self, resource_group): + response = self.client.list_geo_regions( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_identifiers_assigned_to_host_name(self, resource_group): + response = self.client.list_site_identifiers_assigned_to_host_name( + name_identifier={"name": "str"}, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_premier_add_on_offers(self, resource_group): + response = self.client.list_premier_add_on_offers( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_skus(self, resource_group): + response = await self.client.list_skus( + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_verify_hosting_environment_vnet(self, resource_group): + response = await self.client.verify_hosting_environment_vnet( + parameters={ + "id": "str", + "kind": "str", + "name": "str", + "subnetResourceId": "str", + "type": "str", + "vnetName": "str", + "vnetResourceGroup": "str", + "vnetSubnetName": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_move(self, resource_group): + response = await self.client.move( + resource_group_name=resource_group.name, + move_resource_envelope={"resources": ["str"], "targetResourceGroup": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_validate(self, resource_group): + response = await self.client.validate( + resource_group_name=resource_group.name, + validate_request={ + "location": "str", + "name": "str", + "type": "str", + "appServiceEnvironment": { + "virtualNetwork": {"id": "str", "name": "str", "subnet": "str", "type": "str"}, + "clusterSettings": [{"name": "str", "value": "str"}], + "customDnsSuffixConfiguration": { + "certificateUrl": "str", + "dnsSuffix": "str", + "id": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "name": "str", + "provisioningDetails": "str", + "provisioningState": "str", + "type": "str", + }, + "dedicatedHostCount": 0, + "dnsSuffix": "str", + "frontEndScaleFactor": 0, + "hasLinuxWorkers": bool, + "internalLoadBalancingMode": "str", + "ipsslAddressCount": 0, + "maximumNumberOfMachines": 0, + "multiRoleCount": 0, + "multiSize": "str", + "networkingConfiguration": { + "allowNewPrivateEndpointConnections": bool, + "externalInboundIpAddresses": ["str"], + "ftpEnabled": bool, + "id": "str", + "inboundIpAddressOverride": "str", + "internalInboundIpAddresses": ["str"], + "kind": "str", + "linuxOutboundIpAddresses": ["str"], + "name": "str", + "remoteDebugEnabled": bool, + "type": "str", + "windowsOutboundIpAddresses": ["str"], + }, + "provisioningState": "str", + "status": "str", + "suspended": bool, + "upgradeAvailability": "str", + "upgradePreference": "None", + "userWhitelistedIpRanges": ["str"], + "zoneRedundant": bool, + }, + "capacity": 0, + "containerImagePlatform": "str", + "containerImageRepository": "str", + "containerImageTag": "str", + "containerRegistryBaseUrl": "str", + "containerRegistryPassword": "str", + "containerRegistryUsername": "str", + "hostingEnvironment": "str", + "isSpot": bool, + "isXenon": bool, + "needLinuxWorkers": bool, + "serverFarmId": "str", + "skuName": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_validate_move(self, resource_group): + response = await self.client.validate_move( + resource_group_name=resource_group.name, + move_resource_envelope={"resources": ["str"], "targetResourceGroup": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificate_orders_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificate_orders_diagnostics_operations.py new file mode 100644 index 0000000000000..bf70ceefb4413 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificate_orders_diagnostics_operations.py @@ -0,0 +1,44 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementCertificateOrdersDiagnosticsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_app_service_certificate_order_detector_response(self, resource_group): + response = self.client.certificate_orders_diagnostics.list_app_service_certificate_order_detector_response( + resource_group_name=resource_group.name, + certificate_order_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_app_service_certificate_order_detector_response(self, resource_group): + response = self.client.certificate_orders_diagnostics.get_app_service_certificate_order_detector_response( + resource_group_name=resource_group.name, + certificate_order_name="str", + detector_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificate_orders_diagnostics_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificate_orders_diagnostics_operations_async.py new file mode 100644 index 0000000000000..fdb968f7e3a0e --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificate_orders_diagnostics_operations_async.py @@ -0,0 +1,45 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementCertificateOrdersDiagnosticsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_app_service_certificate_order_detector_response(self, resource_group): + response = self.client.certificate_orders_diagnostics.list_app_service_certificate_order_detector_response( + resource_group_name=resource_group.name, + certificate_order_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_app_service_certificate_order_detector_response(self, resource_group): + response = await self.client.certificate_orders_diagnostics.get_app_service_certificate_order_detector_response( + resource_group_name=resource_group.name, + certificate_order_name="str", + detector_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificate_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificate_registration_provider_operations.py new file mode 100644 index 0000000000000..63728a5fe298d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificate_registration_provider_operations.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementCertificateRegistrationProviderOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_operations(self, resource_group): + response = self.client.certificate_registration_provider.list_operations( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificate_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificate_registration_provider_operations_async.py new file mode 100644 index 0000000000000..ca4f4c63b5e91 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificate_registration_provider_operations_async.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementCertificateRegistrationProviderOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_operations(self, resource_group): + response = self.client.certificate_registration_provider.list_operations( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificates_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificates_operations.py new file mode 100644 index 0000000000000..d0776cd37ea27 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificates_operations.py @@ -0,0 +1,144 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementCertificatesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.certificates.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.certificates.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.certificates.get( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.certificates.create_or_update( + resource_group_name=resource_group.name, + name="str", + certificate_envelope={ + "location": "str", + "canonicalName": "str", + "cerBlob": bytes("bytes", encoding="utf-8"), + "domainValidationMethod": "str", + "expirationDate": "2020-02-20 00:00:00", + "friendlyName": "str", + "hostNames": ["str"], + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "id": "str", + "issueDate": "2020-02-20 00:00:00", + "issuer": "str", + "keyVaultId": "str", + "keyVaultSecretName": "str", + "keyVaultSecretStatus": "str", + "kind": "str", + "name": "str", + "password": "str", + "pfxBlob": bytes("bytes", encoding="utf-8"), + "publicKeyHash": "str", + "selfLink": "str", + "serverFarmId": "str", + "siteName": "str", + "subjectName": "str", + "tags": {"str": "str"}, + "thumbprint": "str", + "type": "str", + "valid": bool, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.certificates.delete( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.certificates.update( + resource_group_name=resource_group.name, + name="str", + certificate_envelope={ + "canonicalName": "str", + "cerBlob": bytes("bytes", encoding="utf-8"), + "domainValidationMethod": "str", + "expirationDate": "2020-02-20 00:00:00", + "friendlyName": "str", + "hostNames": ["str"], + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "id": "str", + "issueDate": "2020-02-20 00:00:00", + "issuer": "str", + "keyVaultId": "str", + "keyVaultSecretName": "str", + "keyVaultSecretStatus": "str", + "kind": "str", + "name": "str", + "password": "str", + "pfxBlob": bytes("bytes", encoding="utf-8"), + "publicKeyHash": "str", + "selfLink": "str", + "serverFarmId": "str", + "siteName": "str", + "subjectName": "str", + "thumbprint": "str", + "type": "str", + "valid": bool, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificates_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificates_operations_async.py new file mode 100644 index 0000000000000..9864bf033eb0d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_certificates_operations_async.py @@ -0,0 +1,145 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementCertificatesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.certificates.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.certificates.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.certificates.get( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.certificates.create_or_update( + resource_group_name=resource_group.name, + name="str", + certificate_envelope={ + "location": "str", + "canonicalName": "str", + "cerBlob": bytes("bytes", encoding="utf-8"), + "domainValidationMethod": "str", + "expirationDate": "2020-02-20 00:00:00", + "friendlyName": "str", + "hostNames": ["str"], + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "id": "str", + "issueDate": "2020-02-20 00:00:00", + "issuer": "str", + "keyVaultId": "str", + "keyVaultSecretName": "str", + "keyVaultSecretStatus": "str", + "kind": "str", + "name": "str", + "password": "str", + "pfxBlob": bytes("bytes", encoding="utf-8"), + "publicKeyHash": "str", + "selfLink": "str", + "serverFarmId": "str", + "siteName": "str", + "subjectName": "str", + "tags": {"str": "str"}, + "thumbprint": "str", + "type": "str", + "valid": bool, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.certificates.delete( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.certificates.update( + resource_group_name=resource_group.name, + name="str", + certificate_envelope={ + "canonicalName": "str", + "cerBlob": bytes("bytes", encoding="utf-8"), + "domainValidationMethod": "str", + "expirationDate": "2020-02-20 00:00:00", + "friendlyName": "str", + "hostNames": ["str"], + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "id": "str", + "issueDate": "2020-02-20 00:00:00", + "issuer": "str", + "keyVaultId": "str", + "keyVaultSecretName": "str", + "keyVaultSecretStatus": "str", + "kind": "str", + "name": "str", + "password": "str", + "pfxBlob": bytes("bytes", encoding="utf-8"), + "publicKeyHash": "str", + "selfLink": "str", + "serverFarmId": "str", + "siteName": "str", + "subjectName": "str", + "thumbprint": "str", + "type": "str", + "valid": bool, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_container_apps_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_container_apps_operations.py new file mode 100644 index 0000000000000..0c8ca34164991 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_container_apps_operations.py @@ -0,0 +1,161 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementContainerAppsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.container_apps.list_by_subscription( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps.get( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.container_apps.begin_create_or_update( + resource_group_name=resource_group.name, + name="str", + container_app_envelope={ + "location": "str", + "configuration": { + "activeRevisionsMode": "str", + "ingress": { + "allowInsecure": bool, + "external": False, + "fqdn": "str", + "targetPort": 0, + "traffic": [{"latestRevision": False, "revisionName": "str", "weight": 0}], + "transport": "str", + }, + "registries": [{"passwordSecretRef": "str", "server": "str", "username": "str"}], + "secrets": [{"name": "str", "value": "str"}], + }, + "id": "str", + "kind": "str", + "kubeEnvironmentId": "str", + "latestRevisionFqdn": "str", + "latestRevisionName": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "dapr": { + "appId": "str", + "appPort": 0, + "components": [ + { + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "name": "str", + "type": "str", + "version": "str", + } + ], + "enabled": bool, + }, + "revisionSuffix": "str", + "scale": { + "maxReplicas": 0, + "minReplicas": 0, + "rules": [ + { + "azureQueue": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "queueLength": 0, + "queueName": "str", + }, + "custom": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + "type": "str", + }, + "http": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + }, + "name": "str", + } + ], + }, + }, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps.begin_delete( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_secrets(self, resource_group): + response = self.client.container_apps.list_secrets( + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_container_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_container_apps_operations_async.py new file mode 100644 index 0000000000000..34698c4723328 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_container_apps_operations_async.py @@ -0,0 +1,166 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementContainerAppsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.container_apps.list_by_subscription( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps.get( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.container_apps.begin_create_or_update( + resource_group_name=resource_group.name, + name="str", + container_app_envelope={ + "location": "str", + "configuration": { + "activeRevisionsMode": "str", + "ingress": { + "allowInsecure": bool, + "external": False, + "fqdn": "str", + "targetPort": 0, + "traffic": [{"latestRevision": False, "revisionName": "str", "weight": 0}], + "transport": "str", + }, + "registries": [{"passwordSecretRef": "str", "server": "str", "username": "str"}], + "secrets": [{"name": "str", "value": "str"}], + }, + "id": "str", + "kind": "str", + "kubeEnvironmentId": "str", + "latestRevisionFqdn": "str", + "latestRevisionName": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "template": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "dapr": { + "appId": "str", + "appPort": 0, + "components": [ + { + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "name": "str", + "type": "str", + "version": "str", + } + ], + "enabled": bool, + }, + "revisionSuffix": "str", + "scale": { + "maxReplicas": 0, + "minReplicas": 0, + "rules": [ + { + "azureQueue": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "queueLength": 0, + "queueName": "str", + }, + "custom": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + "type": "str", + }, + "http": { + "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "metadata": {"str": "str"}, + }, + "name": "str", + } + ], + }, + }, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps.begin_delete( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_secrets(self, resource_group): + response = await self.client.container_apps.list_secrets( + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_container_apps_revisions_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_container_apps_revisions_operations.py new file mode 100644 index 0000000000000..d7b5389fd009f --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_container_apps_revisions_operations.py @@ -0,0 +1,83 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementContainerAppsRevisionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_revisions(self, resource_group): + response = self.client.container_apps_revisions.list_revisions( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_revision(self, resource_group): + response = self.client.container_apps_revisions.get_revision( + resource_group_name=resource_group.name, + container_app_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_activate_revision(self, resource_group): + response = self.client.container_apps_revisions.activate_revision( + resource_group_name=resource_group.name, + container_app_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deactivate_revision(self, resource_group): + response = self.client.container_apps_revisions.deactivate_revision( + resource_group_name=resource_group.name, + container_app_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restart_revision(self, resource_group): + response = self.client.container_apps_revisions.restart_revision( + resource_group_name=resource_group.name, + container_app_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_container_apps_revisions_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_container_apps_revisions_operations_async.py new file mode 100644 index 0000000000000..986ec763f464e --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_container_apps_revisions_operations_async.py @@ -0,0 +1,84 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementContainerAppsRevisionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_revisions(self, resource_group): + response = self.client.container_apps_revisions.list_revisions( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_revision(self, resource_group): + response = await self.client.container_apps_revisions.get_revision( + resource_group_name=resource_group.name, + container_app_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_activate_revision(self, resource_group): + response = await self.client.container_apps_revisions.activate_revision( + resource_group_name=resource_group.name, + container_app_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deactivate_revision(self, resource_group): + response = await self.client.container_apps_revisions.deactivate_revision( + resource_group_name=resource_group.name, + container_app_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restart_revision(self, resource_group): + response = await self.client.container_apps_revisions.restart_revision( + resource_group_name=resource_group.name, + container_app_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_deleted_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_deleted_web_apps_operations.py new file mode 100644 index 0000000000000..020ece86188e9 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_deleted_web_apps_operations.py @@ -0,0 +1,52 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementDeletedWebAppsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.deleted_web_apps.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_location(self, resource_group): + response = self.client.deleted_web_apps.list_by_location( + location="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_deleted_web_app_by_location(self, resource_group): + response = self.client.deleted_web_apps.get_deleted_web_app_by_location( + location="str", + deleted_site_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_deleted_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_deleted_web_apps_operations_async.py new file mode 100644 index 0000000000000..3ddd184ae9bde --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_deleted_web_apps_operations_async.py @@ -0,0 +1,53 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementDeletedWebAppsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.deleted_web_apps.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_location(self, resource_group): + response = self.client.deleted_web_apps.list_by_location( + location="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_deleted_web_app_by_location(self, resource_group): + response = await self.client.deleted_web_apps.get_deleted_web_app_by_location( + location="str", + deleted_site_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_diagnostics_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_diagnostics_operations.py new file mode 100644 index 0000000000000..085ae8e8ff5b4 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_diagnostics_operations.py @@ -0,0 +1,318 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementDiagnosticsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_hosting_environment_detector_responses(self, resource_group): + response = self.client.diagnostics.list_hosting_environment_detector_responses( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_hosting_environment_detector_response(self, resource_group): + response = self.client.diagnostics.get_hosting_environment_detector_response( + resource_group_name=resource_group.name, + name="str", + detector_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_detector_responses(self, resource_group): + response = self.client.diagnostics.list_site_detector_responses( + resource_group_name=resource_group.name, + site_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_detector_response(self, resource_group): + response = self.client.diagnostics.get_site_detector_response( + resource_group_name=resource_group.name, + site_name="str", + detector_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_diagnostic_categories(self, resource_group): + response = self.client.diagnostics.list_site_diagnostic_categories( + resource_group_name=resource_group.name, + site_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_diagnostic_category(self, resource_group): + response = self.client.diagnostics.get_site_diagnostic_category( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_analyses(self, resource_group): + response = self.client.diagnostics.list_site_analyses( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_analysis(self, resource_group): + response = self.client.diagnostics.get_site_analysis( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + analysis_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_execute_site_analysis(self, resource_group): + response = self.client.diagnostics.execute_site_analysis( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + analysis_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_detectors(self, resource_group): + response = self.client.diagnostics.list_site_detectors( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_detector(self, resource_group): + response = self.client.diagnostics.get_site_detector( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + detector_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_execute_site_detector(self, resource_group): + response = self.client.diagnostics.execute_site_detector( + resource_group_name=resource_group.name, + site_name="str", + detector_name="str", + diagnostic_category="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_detector_responses_slot(self, resource_group): + response = self.client.diagnostics.list_site_detector_responses_slot( + resource_group_name=resource_group.name, + site_name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_detector_response_slot(self, resource_group): + response = self.client.diagnostics.get_site_detector_response_slot( + resource_group_name=resource_group.name, + site_name="str", + detector_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_diagnostic_categories_slot(self, resource_group): + response = self.client.diagnostics.list_site_diagnostic_categories_slot( + resource_group_name=resource_group.name, + site_name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_diagnostic_category_slot(self, resource_group): + response = self.client.diagnostics.get_site_diagnostic_category_slot( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_analyses_slot(self, resource_group): + response = self.client.diagnostics.list_site_analyses_slot( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_analysis_slot(self, resource_group): + response = self.client.diagnostics.get_site_analysis_slot( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + analysis_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_execute_site_analysis_slot(self, resource_group): + response = self.client.diagnostics.execute_site_analysis_slot( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + analysis_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_detectors_slot(self, resource_group): + response = self.client.diagnostics.list_site_detectors_slot( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_detector_slot(self, resource_group): + response = self.client.diagnostics.get_site_detector_slot( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + detector_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_execute_site_detector_slot(self, resource_group): + response = self.client.diagnostics.execute_site_detector_slot( + resource_group_name=resource_group.name, + site_name="str", + detector_name="str", + diagnostic_category="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_diagnostics_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_diagnostics_operations_async.py new file mode 100644 index 0000000000000..993fca5542307 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_diagnostics_operations_async.py @@ -0,0 +1,319 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementDiagnosticsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_hosting_environment_detector_responses(self, resource_group): + response = self.client.diagnostics.list_hosting_environment_detector_responses( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_hosting_environment_detector_response(self, resource_group): + response = await self.client.diagnostics.get_hosting_environment_detector_response( + resource_group_name=resource_group.name, + name="str", + detector_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_detector_responses(self, resource_group): + response = self.client.diagnostics.list_site_detector_responses( + resource_group_name=resource_group.name, + site_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_detector_response(self, resource_group): + response = await self.client.diagnostics.get_site_detector_response( + resource_group_name=resource_group.name, + site_name="str", + detector_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_diagnostic_categories(self, resource_group): + response = self.client.diagnostics.list_site_diagnostic_categories( + resource_group_name=resource_group.name, + site_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_diagnostic_category(self, resource_group): + response = await self.client.diagnostics.get_site_diagnostic_category( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_analyses(self, resource_group): + response = self.client.diagnostics.list_site_analyses( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_analysis(self, resource_group): + response = await self.client.diagnostics.get_site_analysis( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + analysis_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_execute_site_analysis(self, resource_group): + response = await self.client.diagnostics.execute_site_analysis( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + analysis_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_detectors(self, resource_group): + response = self.client.diagnostics.list_site_detectors( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_detector(self, resource_group): + response = await self.client.diagnostics.get_site_detector( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + detector_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_execute_site_detector(self, resource_group): + response = await self.client.diagnostics.execute_site_detector( + resource_group_name=resource_group.name, + site_name="str", + detector_name="str", + diagnostic_category="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_detector_responses_slot(self, resource_group): + response = self.client.diagnostics.list_site_detector_responses_slot( + resource_group_name=resource_group.name, + site_name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_detector_response_slot(self, resource_group): + response = await self.client.diagnostics.get_site_detector_response_slot( + resource_group_name=resource_group.name, + site_name="str", + detector_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_diagnostic_categories_slot(self, resource_group): + response = self.client.diagnostics.list_site_diagnostic_categories_slot( + resource_group_name=resource_group.name, + site_name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_diagnostic_category_slot(self, resource_group): + response = await self.client.diagnostics.get_site_diagnostic_category_slot( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_analyses_slot(self, resource_group): + response = self.client.diagnostics.list_site_analyses_slot( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_analysis_slot(self, resource_group): + response = await self.client.diagnostics.get_site_analysis_slot( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + analysis_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_execute_site_analysis_slot(self, resource_group): + response = await self.client.diagnostics.execute_site_analysis_slot( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + analysis_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_detectors_slot(self, resource_group): + response = self.client.diagnostics.list_site_detectors_slot( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_detector_slot(self, resource_group): + response = await self.client.diagnostics.get_site_detector_slot( + resource_group_name=resource_group.name, + site_name="str", + diagnostic_category="str", + detector_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_execute_site_detector_slot(self, resource_group): + response = await self.client.diagnostics.execute_site_detector_slot( + resource_group_name=resource_group.name, + site_name="str", + detector_name="str", + diagnostic_category="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_domain_registration_provider_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_domain_registration_provider_operations.py new file mode 100644 index 0000000000000..3a7c4e6eb11fc --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_domain_registration_provider_operations.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementDomainRegistrationProviderOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_operations(self, resource_group): + response = self.client.domain_registration_provider.list_operations( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_domain_registration_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_domain_registration_provider_operations_async.py new file mode 100644 index 0000000000000..b73a75518664c --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_domain_registration_provider_operations_async.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementDomainRegistrationProviderOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_operations(self, resource_group): + response = self.client.domain_registration_provider.list_operations( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_domains_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_domains_operations.py new file mode 100644 index 0000000000000..bf2d94dce4e0e --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_domains_operations.py @@ -0,0 +1,430 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementDomainsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_availability(self, resource_group): + response = self.client.domains.check_availability( + identifier={"name": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.domains.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_control_center_sso_request(self, resource_group): + response = self.client.domains.get_control_center_sso_request( + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_recommendations(self, resource_group): + response = self.client.domains.list_recommendations( + parameters={"keywords": "str", "maxDomainRecommendations": 0}, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.domains.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.domains.get( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.domains.begin_create_or_update( + resource_group_name=resource_group.name, + domain_name="str", + domain={ + "location": "str", + "authCode": "str", + "autoRenew": True, + "consent": {"agreedAt": "2020-02-20 00:00:00", "agreedBy": "str", "agreementKeys": ["str"]}, + "contactAdmin": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "contactBilling": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "contactRegistrant": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "contactTech": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "createdTime": "2020-02-20 00:00:00", + "dnsType": "str", + "dnsZoneId": "str", + "domainNotRenewableReasons": ["str"], + "expirationTime": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "lastRenewedTime": "2020-02-20 00:00:00", + "managedHostNames": [ + { + "azureResourceName": "str", + "azureResourceType": "str", + "customHostNameDnsRecordType": "str", + "hostNameType": "str", + "name": "str", + "siteNames": ["str"], + } + ], + "name": "str", + "nameServers": ["str"], + "privacy": bool, + "provisioningState": "str", + "readyForDnsRecordManagement": bool, + "registrationStatus": "str", + "tags": {"str": "str"}, + "targetDnsType": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.domains.delete( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.domains.update( + resource_group_name=resource_group.name, + domain_name="str", + domain={ + "authCode": "str", + "autoRenew": True, + "consent": {"agreedAt": "2020-02-20 00:00:00", "agreedBy": "str", "agreementKeys": ["str"]}, + "contactAdmin": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "contactBilling": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "contactRegistrant": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "contactTech": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "createdTime": "2020-02-20 00:00:00", + "dnsType": "str", + "dnsZoneId": "str", + "domainNotRenewableReasons": ["str"], + "expirationTime": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "lastRenewedTime": "2020-02-20 00:00:00", + "managedHostNames": [ + { + "azureResourceName": "str", + "azureResourceType": "str", + "customHostNameDnsRecordType": "str", + "hostNameType": "str", + "name": "str", + "siteNames": ["str"], + } + ], + "name": "str", + "nameServers": ["str"], + "privacy": bool, + "provisioningState": "str", + "readyForDnsRecordManagement": bool, + "registrationStatus": "str", + "targetDnsType": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_ownership_identifiers(self, resource_group): + response = self.client.domains.list_ownership_identifiers( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_ownership_identifier(self, resource_group): + response = self.client.domains.get_ownership_identifier( + resource_group_name=resource_group.name, + domain_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_ownership_identifier(self, resource_group): + response = self.client.domains.create_or_update_ownership_identifier( + resource_group_name=resource_group.name, + domain_name="str", + name="str", + domain_ownership_identifier={ + "id": "str", + "kind": "str", + "name": "str", + "ownershipId": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_ownership_identifier(self, resource_group): + response = self.client.domains.delete_ownership_identifier( + resource_group_name=resource_group.name, + domain_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_ownership_identifier(self, resource_group): + response = self.client.domains.update_ownership_identifier( + resource_group_name=resource_group.name, + domain_name="str", + name="str", + domain_ownership_identifier={ + "id": "str", + "kind": "str", + "name": "str", + "ownershipId": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_renew(self, resource_group): + response = self.client.domains.renew( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_transfer_out(self, resource_group): + response = self.client.domains.transfer_out( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_domains_operations_async.py new file mode 100644 index 0000000000000..7c9624b9e81eb --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_domains_operations_async.py @@ -0,0 +1,433 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementDomainsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_availability(self, resource_group): + response = await self.client.domains.check_availability( + identifier={"name": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.domains.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_control_center_sso_request(self, resource_group): + response = await self.client.domains.get_control_center_sso_request( + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_recommendations(self, resource_group): + response = self.client.domains.list_recommendations( + parameters={"keywords": "str", "maxDomainRecommendations": 0}, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.domains.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.domains.get( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.domains.begin_create_or_update( + resource_group_name=resource_group.name, + domain_name="str", + domain={ + "location": "str", + "authCode": "str", + "autoRenew": True, + "consent": {"agreedAt": "2020-02-20 00:00:00", "agreedBy": "str", "agreementKeys": ["str"]}, + "contactAdmin": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "contactBilling": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "contactRegistrant": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "contactTech": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "createdTime": "2020-02-20 00:00:00", + "dnsType": "str", + "dnsZoneId": "str", + "domainNotRenewableReasons": ["str"], + "expirationTime": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "lastRenewedTime": "2020-02-20 00:00:00", + "managedHostNames": [ + { + "azureResourceName": "str", + "azureResourceType": "str", + "customHostNameDnsRecordType": "str", + "hostNameType": "str", + "name": "str", + "siteNames": ["str"], + } + ], + "name": "str", + "nameServers": ["str"], + "privacy": bool, + "provisioningState": "str", + "readyForDnsRecordManagement": bool, + "registrationStatus": "str", + "tags": {"str": "str"}, + "targetDnsType": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.domains.delete( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.domains.update( + resource_group_name=resource_group.name, + domain_name="str", + domain={ + "authCode": "str", + "autoRenew": True, + "consent": {"agreedAt": "2020-02-20 00:00:00", "agreedBy": "str", "agreementKeys": ["str"]}, + "contactAdmin": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "contactBilling": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "contactRegistrant": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "contactTech": { + "email": "str", + "nameFirst": "str", + "nameLast": "str", + "phone": "str", + "addressMailing": { + "address1": "str", + "city": "str", + "country": "str", + "postalCode": "str", + "state": "str", + "address2": "str", + }, + "fax": "str", + "jobTitle": "str", + "nameMiddle": "str", + "organization": "str", + }, + "createdTime": "2020-02-20 00:00:00", + "dnsType": "str", + "dnsZoneId": "str", + "domainNotRenewableReasons": ["str"], + "expirationTime": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "lastRenewedTime": "2020-02-20 00:00:00", + "managedHostNames": [ + { + "azureResourceName": "str", + "azureResourceType": "str", + "customHostNameDnsRecordType": "str", + "hostNameType": "str", + "name": "str", + "siteNames": ["str"], + } + ], + "name": "str", + "nameServers": ["str"], + "privacy": bool, + "provisioningState": "str", + "readyForDnsRecordManagement": bool, + "registrationStatus": "str", + "targetDnsType": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_ownership_identifiers(self, resource_group): + response = self.client.domains.list_ownership_identifiers( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_ownership_identifier(self, resource_group): + response = await self.client.domains.get_ownership_identifier( + resource_group_name=resource_group.name, + domain_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_ownership_identifier(self, resource_group): + response = await self.client.domains.create_or_update_ownership_identifier( + resource_group_name=resource_group.name, + domain_name="str", + name="str", + domain_ownership_identifier={ + "id": "str", + "kind": "str", + "name": "str", + "ownershipId": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_ownership_identifier(self, resource_group): + response = await self.client.domains.delete_ownership_identifier( + resource_group_name=resource_group.name, + domain_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_ownership_identifier(self, resource_group): + response = await self.client.domains.update_ownership_identifier( + resource_group_name=resource_group.name, + domain_name="str", + name="str", + domain_ownership_identifier={ + "id": "str", + "kind": "str", + "name": "str", + "ownershipId": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_renew(self, resource_group): + response = await self.client.domains.renew( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_transfer_out(self, resource_group): + response = await self.client.domains.transfer_out( + resource_group_name=resource_group.name, + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_get_usages_in_location_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_get_usages_in_location_operations.py new file mode 100644 index 0000000000000..1960329b29f44 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_get_usages_in_location_operations.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementGetUsagesInLocationOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.get_usages_in_location.list( + location="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_get_usages_in_location_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_get_usages_in_location_operations_async.py new file mode 100644 index 0000000000000..f24ac1b2ead5c --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_get_usages_in_location_operations_async.py @@ -0,0 +1,31 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementGetUsagesInLocationOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.get_usages_in_location.list( + location="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_global_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_global_operations.py new file mode 100644 index 0000000000000..61e27ba512639 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_global_operations.py @@ -0,0 +1,53 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementGlobalOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_deleted_web_app(self, resource_group): + response = self.client.global_operations.get_deleted_web_app( + deleted_site_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_deleted_web_app_snapshots(self, resource_group): + response = self.client.global_operations.get_deleted_web_app_snapshots( + deleted_site_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_subscription_operation_with_async_response(self, resource_group): + response = self.client.global_operations.get_subscription_operation_with_async_response( + location="str", + operation_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_global_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_global_operations_async.py new file mode 100644 index 0000000000000..7306150ee3254 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_global_operations_async.py @@ -0,0 +1,54 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementGlobalOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_deleted_web_app(self, resource_group): + response = await self.client.global_operations.get_deleted_web_app( + deleted_site_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_deleted_web_app_snapshots(self, resource_group): + response = await self.client.global_operations.get_deleted_web_app_snapshots( + deleted_site_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_subscription_operation_with_async_response(self, resource_group): + response = await self.client.global_operations.get_subscription_operation_with_async_response( + location="str", + operation_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_kube_environments_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_kube_environments_operations.py new file mode 100644 index 0000000000000..1175fb0437711 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_kube_environments_operations.py @@ -0,0 +1,158 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementKubeEnvironmentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.kube_environments.list_by_subscription( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.kube_environments.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.kube_environments.get( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.kube_environments.begin_create_or_update( + resource_group_name=resource_group.name, + name="str", + kube_environment_envelope={ + "location": "str", + "aksResourceID": "str", + "appLogsConfiguration": { + "destination": "str", + "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + }, + "arcConfiguration": { + "artifactStorageAccessMode": "str", + "artifactStorageClassName": "str", + "artifactStorageMountPath": "str", + "artifactStorageNodeName": "str", + "artifactsStorageType": "str", + "frontEndServiceConfiguration": {"kind": "str"}, + "kubeConfig": "str", + }, + "containerAppsConfiguration": { + "appSubnetResourceId": "str", + "controlPlaneSubnetResourceId": "str", + "daprAIInstrumentationKey": "str", + "dockerBridgeCidr": "str", + "platformReservedCidr": "str", + "platformReservedDnsIP": "str", + }, + "defaultDomain": "str", + "deploymentErrors": "str", + "environmentType": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "internalLoadBalancerEnabled": bool, + "kind": "str", + "name": "str", + "provisioningState": "str", + "staticIp": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.kube_environments.begin_delete( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.kube_environments.update( + resource_group_name=resource_group.name, + name="str", + kube_environment_envelope={ + "aksResourceID": "str", + "appLogsConfiguration": { + "destination": "str", + "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + }, + "arcConfiguration": { + "artifactStorageAccessMode": "str", + "artifactStorageClassName": "str", + "artifactStorageMountPath": "str", + "artifactStorageNodeName": "str", + "artifactsStorageType": "str", + "frontEndServiceConfiguration": {"kind": "str"}, + "kubeConfig": "str", + }, + "containerAppsConfiguration": { + "appSubnetResourceId": "str", + "controlPlaneSubnetResourceId": "str", + "daprAIInstrumentationKey": "str", + "dockerBridgeCidr": "str", + "platformReservedCidr": "str", + "platformReservedDnsIP": "str", + }, + "defaultDomain": "str", + "deploymentErrors": "str", + "id": "str", + "internalLoadBalancerEnabled": bool, + "kind": "str", + "name": "str", + "provisioningState": "str", + "staticIp": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_kube_environments_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_kube_environments_operations_async.py new file mode 100644 index 0000000000000..d403f8b4f8f36 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_kube_environments_operations_async.py @@ -0,0 +1,163 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementKubeEnvironmentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.kube_environments.list_by_subscription( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.kube_environments.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.kube_environments.get( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.kube_environments.begin_create_or_update( + resource_group_name=resource_group.name, + name="str", + kube_environment_envelope={ + "location": "str", + "aksResourceID": "str", + "appLogsConfiguration": { + "destination": "str", + "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + }, + "arcConfiguration": { + "artifactStorageAccessMode": "str", + "artifactStorageClassName": "str", + "artifactStorageMountPath": "str", + "artifactStorageNodeName": "str", + "artifactsStorageType": "str", + "frontEndServiceConfiguration": {"kind": "str"}, + "kubeConfig": "str", + }, + "containerAppsConfiguration": { + "appSubnetResourceId": "str", + "controlPlaneSubnetResourceId": "str", + "daprAIInstrumentationKey": "str", + "dockerBridgeCidr": "str", + "platformReservedCidr": "str", + "platformReservedDnsIP": "str", + }, + "defaultDomain": "str", + "deploymentErrors": "str", + "environmentType": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "internalLoadBalancerEnabled": bool, + "kind": "str", + "name": "str", + "provisioningState": "str", + "staticIp": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.kube_environments.begin_delete( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.kube_environments.update( + resource_group_name=resource_group.name, + name="str", + kube_environment_envelope={ + "aksResourceID": "str", + "appLogsConfiguration": { + "destination": "str", + "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + }, + "arcConfiguration": { + "artifactStorageAccessMode": "str", + "artifactStorageClassName": "str", + "artifactStorageMountPath": "str", + "artifactStorageNodeName": "str", + "artifactsStorageType": "str", + "frontEndServiceConfiguration": {"kind": "str"}, + "kubeConfig": "str", + }, + "containerAppsConfiguration": { + "appSubnetResourceId": "str", + "controlPlaneSubnetResourceId": "str", + "daprAIInstrumentationKey": "str", + "dockerBridgeCidr": "str", + "platformReservedCidr": "str", + "platformReservedDnsIP": "str", + }, + "defaultDomain": "str", + "deploymentErrors": "str", + "id": "str", + "internalLoadBalancerEnabled": bool, + "kind": "str", + "name": "str", + "provisioningState": "str", + "staticIp": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_provider_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_provider_operations.py new file mode 100644 index 0000000000000..7a25753eba917 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_provider_operations.py @@ -0,0 +1,91 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementProviderOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_available_stacks(self, resource_group): + response = self.client.provider.get_available_stacks( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_function_app_stacks(self, resource_group): + response = self.client.provider.get_function_app_stacks( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_function_app_stacks_for_location(self, resource_group): + response = self.client.provider.get_function_app_stacks_for_location( + location="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_web_app_stacks_for_location(self, resource_group): + response = self.client.provider.get_web_app_stacks_for_location( + location="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_operations(self, resource_group): + response = self.client.provider.list_operations( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_web_app_stacks(self, resource_group): + response = self.client.provider.get_web_app_stacks( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_available_stacks_on_prem(self, resource_group): + response = self.client.provider.get_available_stacks_on_prem( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_provider_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_provider_operations_async.py new file mode 100644 index 0000000000000..4ead2a06826f5 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_provider_operations_async.py @@ -0,0 +1,92 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementProviderOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_available_stacks(self, resource_group): + response = self.client.provider.get_available_stacks( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_function_app_stacks(self, resource_group): + response = self.client.provider.get_function_app_stacks( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_function_app_stacks_for_location(self, resource_group): + response = self.client.provider.get_function_app_stacks_for_location( + location="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_web_app_stacks_for_location(self, resource_group): + response = self.client.provider.get_web_app_stacks_for_location( + location="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_operations(self, resource_group): + response = self.client.provider.list_operations( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_web_app_stacks(self, resource_group): + response = self.client.provider.get_web_app_stacks( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_available_stacks_on_prem(self, resource_group): + response = self.client.provider.get_available_stacks_on_prem( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_recommendations_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_recommendations_operations.py new file mode 100644 index 0000000000000..f96e36ab058f8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_recommendations_operations.py @@ -0,0 +1,201 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementRecommendationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.recommendations.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_reset_all_filters(self, resource_group): + response = self.client.recommendations.reset_all_filters( + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disable_recommendation_for_subscription(self, resource_group): + response = self.client.recommendations.disable_recommendation_for_subscription( + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_history_for_hosting_environment(self, resource_group): + response = self.client.recommendations.list_history_for_hosting_environment( + resource_group_name=resource_group.name, + hosting_environment_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_recommended_rules_for_hosting_environment(self, resource_group): + response = self.client.recommendations.list_recommended_rules_for_hosting_environment( + resource_group_name=resource_group.name, + hosting_environment_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disable_all_for_hosting_environment(self, resource_group): + response = self.client.recommendations.disable_all_for_hosting_environment( + resource_group_name=resource_group.name, + environment_name="str", + hosting_environment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_reset_all_filters_for_hosting_environment(self, resource_group): + response = self.client.recommendations.reset_all_filters_for_hosting_environment( + resource_group_name=resource_group.name, + environment_name="str", + hosting_environment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_rule_details_by_hosting_environment(self, resource_group): + response = self.client.recommendations.get_rule_details_by_hosting_environment( + resource_group_name=resource_group.name, + hosting_environment_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disable_recommendation_for_hosting_environment(self, resource_group): + response = self.client.recommendations.disable_recommendation_for_hosting_environment( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + hosting_environment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_history_for_web_app(self, resource_group): + response = self.client.recommendations.list_history_for_web_app( + resource_group_name=resource_group.name, + site_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_recommended_rules_for_web_app(self, resource_group): + response = self.client.recommendations.list_recommended_rules_for_web_app( + resource_group_name=resource_group.name, + site_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disable_all_for_web_app(self, resource_group): + response = self.client.recommendations.disable_all_for_web_app( + resource_group_name=resource_group.name, + site_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_reset_all_filters_for_web_app(self, resource_group): + response = self.client.recommendations.reset_all_filters_for_web_app( + resource_group_name=resource_group.name, + site_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_rule_details_by_web_app(self, resource_group): + response = self.client.recommendations.get_rule_details_by_web_app( + resource_group_name=resource_group.name, + site_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_disable_recommendation_for_site(self, resource_group): + response = self.client.recommendations.disable_recommendation_for_site( + resource_group_name=resource_group.name, + site_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_recommendations_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_recommendations_operations_async.py new file mode 100644 index 0000000000000..be8eec4d038cf --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_recommendations_operations_async.py @@ -0,0 +1,202 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementRecommendationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.recommendations.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_reset_all_filters(self, resource_group): + response = await self.client.recommendations.reset_all_filters( + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disable_recommendation_for_subscription(self, resource_group): + response = await self.client.recommendations.disable_recommendation_for_subscription( + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_history_for_hosting_environment(self, resource_group): + response = self.client.recommendations.list_history_for_hosting_environment( + resource_group_name=resource_group.name, + hosting_environment_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_recommended_rules_for_hosting_environment(self, resource_group): + response = self.client.recommendations.list_recommended_rules_for_hosting_environment( + resource_group_name=resource_group.name, + hosting_environment_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disable_all_for_hosting_environment(self, resource_group): + response = await self.client.recommendations.disable_all_for_hosting_environment( + resource_group_name=resource_group.name, + environment_name="str", + hosting_environment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_reset_all_filters_for_hosting_environment(self, resource_group): + response = await self.client.recommendations.reset_all_filters_for_hosting_environment( + resource_group_name=resource_group.name, + environment_name="str", + hosting_environment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_rule_details_by_hosting_environment(self, resource_group): + response = await self.client.recommendations.get_rule_details_by_hosting_environment( + resource_group_name=resource_group.name, + hosting_environment_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disable_recommendation_for_hosting_environment(self, resource_group): + response = await self.client.recommendations.disable_recommendation_for_hosting_environment( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + hosting_environment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_history_for_web_app(self, resource_group): + response = self.client.recommendations.list_history_for_web_app( + resource_group_name=resource_group.name, + site_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_recommended_rules_for_web_app(self, resource_group): + response = self.client.recommendations.list_recommended_rules_for_web_app( + resource_group_name=resource_group.name, + site_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disable_all_for_web_app(self, resource_group): + response = await self.client.recommendations.disable_all_for_web_app( + resource_group_name=resource_group.name, + site_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_reset_all_filters_for_web_app(self, resource_group): + response = await self.client.recommendations.reset_all_filters_for_web_app( + resource_group_name=resource_group.name, + site_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_rule_details_by_web_app(self, resource_group): + response = await self.client.recommendations.get_rule_details_by_web_app( + resource_group_name=resource_group.name, + site_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_disable_recommendation_for_site(self, resource_group): + response = await self.client.recommendations.disable_recommendation_for_site( + resource_group_name=resource_group.name, + site_name="str", + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_resource_health_metadata_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_resource_health_metadata_operations.py new file mode 100644 index 0000000000000..d4a9ea162b016 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_resource_health_metadata_operations.py @@ -0,0 +1,90 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementResourceHealthMetadataOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.resource_health_metadata.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.resource_health_metadata.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_site(self, resource_group): + response = self.client.resource_health_metadata.list_by_site( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_by_site(self, resource_group): + response = self.client.resource_health_metadata.get_by_site( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_site_slot(self, resource_group): + response = self.client.resource_health_metadata.list_by_site_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_by_site_slot(self, resource_group): + response = self.client.resource_health_metadata.get_by_site_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_resource_health_metadata_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_resource_health_metadata_operations_async.py new file mode 100644 index 0000000000000..f22513648348d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_resource_health_metadata_operations_async.py @@ -0,0 +1,91 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementResourceHealthMetadataOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.resource_health_metadata.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.resource_health_metadata.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_site(self, resource_group): + response = self.client.resource_health_metadata.list_by_site( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_by_site(self, resource_group): + response = await self.client.resource_health_metadata.get_by_site( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_site_slot(self, resource_group): + response = self.client.resource_health_metadata.list_by_site_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_by_site_slot(self, resource_group): + response = await self.client.resource_health_metadata.get_by_site_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_static_sites_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_static_sites_operations.py new file mode 100644 index 0000000000000..34ab4c8d42e4e --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_static_sites_operations.py @@ -0,0 +1,1449 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementStaticSitesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_preview_workflow(self, resource_group): + response = self.client.static_sites.preview_workflow( + location="str", + static_sites_workflow_preview_request={ + "branch": "str", + "buildProperties": { + "apiBuildCommand": "str", + "apiLocation": "str", + "appArtifactLocation": "str", + "appBuildCommand": "str", + "appLocation": "str", + "githubActionSecretNameOverride": "str", + "outputLocation": "str", + "skipGithubActionWorkflowGeneration": bool, + }, + "id": "str", + "kind": "str", + "name": "str", + "repositoryUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.static_sites.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_static_sites_by_resource_group(self, resource_group): + response = self.client.static_sites.get_static_sites_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_static_site(self, resource_group): + response = self.client.static_sites.get_static_site( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update_static_site(self, resource_group): + response = self.client.static_sites.begin_create_or_update_static_site( + resource_group_name=resource_group.name, + name="str", + static_site_envelope={ + "location": "str", + "allowConfigFileUpdates": bool, + "branch": "str", + "buildProperties": { + "apiBuildCommand": "str", + "apiLocation": "str", + "appArtifactLocation": "str", + "appBuildCommand": "str", + "appLocation": "str", + "githubActionSecretNameOverride": "str", + "outputLocation": "str", + "skipGithubActionWorkflowGeneration": bool, + }, + "contentDistributionEndpoint": "str", + "customDomains": ["str"], + "databaseConnections": [ + { + "configurationFiles": [{"contents": "str", "fileName": "str", "type": "str"}], + "connectionIdentity": "str", + "name": "str", + "region": "str", + "resourceId": "str", + } + ], + "defaultHostname": "str", + "enterpriseGradeCdnStatus": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "keyVaultReferenceIdentity": "str", + "kind": "str", + "linkedBackends": [ + { + "backendResourceId": "str", + "createdOn": "2020-02-20 00:00:00", + "provisioningState": "str", + "region": "str", + } + ], + "name": "str", + "privateEndpointConnections": [ + { + "error": { + "code": "str", + "details": [...], + "extendedCode": "str", + "innerErrors": [...], + "message": "str", + "messageTemplate": "str", + "parameters": ["str"], + "target": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "plan": { + "name": "str", + "product": "str", + "promotionCode": "str", + "publisher": "str", + "version": "str", + }, + "properties": { + "id": "str", + "ipAddresses": ["str"], + "kind": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + }, + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": { + "default": 0, + "elasticMaximum": 0, + "maximum": 0, + "minimum": 0, + "scaleType": "str", + }, + "tier": "str", + }, + "status": "str", + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + } + ], + "provider": "str", + "publicNetworkAccess": "str", + "repositoryToken": "str", + "repositoryUrl": "str", + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": {"default": 0, "elasticMaximum": 0, "maximum": 0, "minimum": 0, "scaleType": "str"}, + "tier": "str", + }, + "stagingEnvironmentPolicy": "str", + "tags": {"str": "str"}, + "templateProperties": { + "description": "str", + "isPrivate": bool, + "owner": "str", + "repositoryName": "str", + "templateRepositoryUrl": "str", + }, + "type": "str", + "userProvidedFunctionApps": [ + { + "createdOn": "2020-02-20 00:00:00", + "functionAppRegion": "str", + "functionAppResourceId": "str", + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + } + ], + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_static_site(self, resource_group): + response = self.client.static_sites.begin_delete_static_site( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_static_site(self, resource_group): + response = self.client.static_sites.update_static_site( + resource_group_name=resource_group.name, + name="str", + static_site_envelope={ + "allowConfigFileUpdates": bool, + "branch": "str", + "buildProperties": { + "apiBuildCommand": "str", + "apiLocation": "str", + "appArtifactLocation": "str", + "appBuildCommand": "str", + "appLocation": "str", + "githubActionSecretNameOverride": "str", + "outputLocation": "str", + "skipGithubActionWorkflowGeneration": bool, + }, + "contentDistributionEndpoint": "str", + "customDomains": ["str"], + "databaseConnections": [ + { + "configurationFiles": [{"contents": "str", "fileName": "str", "type": "str"}], + "connectionIdentity": "str", + "name": "str", + "region": "str", + "resourceId": "str", + } + ], + "defaultHostname": "str", + "enterpriseGradeCdnStatus": "str", + "id": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "linkedBackends": [ + { + "backendResourceId": "str", + "createdOn": "2020-02-20 00:00:00", + "provisioningState": "str", + "region": "str", + } + ], + "name": "str", + "privateEndpointConnections": [ + { + "error": { + "code": "str", + "details": [...], + "extendedCode": "str", + "innerErrors": [...], + "message": "str", + "messageTemplate": "str", + "parameters": ["str"], + "target": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "plan": { + "name": "str", + "product": "str", + "promotionCode": "str", + "publisher": "str", + "version": "str", + }, + "properties": { + "id": "str", + "ipAddresses": ["str"], + "kind": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + }, + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": { + "default": 0, + "elasticMaximum": 0, + "maximum": 0, + "minimum": 0, + "scaleType": "str", + }, + "tier": "str", + }, + "status": "str", + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + } + ], + "provider": "str", + "publicNetworkAccess": "str", + "repositoryToken": "str", + "repositoryUrl": "str", + "stagingEnvironmentPolicy": "str", + "templateProperties": { + "description": "str", + "isPrivate": bool, + "owner": "str", + "repositoryName": "str", + "templateRepositoryUrl": "str", + }, + "type": "str", + "userProvidedFunctionApps": [ + { + "createdOn": "2020-02-20 00:00:00", + "functionAppRegion": "str", + "functionAppResourceId": "str", + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + } + ], + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_static_site_users(self, resource_group): + response = self.client.static_sites.list_static_site_users( + resource_group_name=resource_group.name, + name="str", + authprovider="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_static_site_user(self, resource_group): + response = self.client.static_sites.delete_static_site_user( + resource_group_name=resource_group.name, + name="str", + authprovider="str", + userid="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_static_site_user(self, resource_group): + response = self.client.static_sites.update_static_site_user( + resource_group_name=resource_group.name, + name="str", + authprovider="str", + userid="str", + static_site_user_envelope={ + "displayName": "str", + "id": "str", + "kind": "str", + "name": "str", + "provider": "str", + "roles": "str", + "type": "str", + "userId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_static_site_builds(self, resource_group): + response = self.client.static_sites.get_static_site_builds( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_static_site_build(self, resource_group): + response = self.client.static_sites.get_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_static_site_build(self, resource_group): + response = self.client.static_sites.begin_delete_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_static_site_build_app_settings(self, resource_group): + response = self.client.static_sites.create_or_update_static_site_build_app_settings( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + app_settings={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_static_site_build_function_app_settings(self, resource_group): + response = self.client.static_sites.create_or_update_static_site_build_function_app_settings( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + app_settings={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_build_database_connections(self, resource_group): + response = self.client.static_sites.get_build_database_connections( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_build_database_connection(self, resource_group): + response = self.client.static_sites.get_build_database_connection( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + database_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_build_database_connection(self, resource_group): + response = self.client.static_sites.create_or_update_build_database_connection( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + database_connection_name="str", + database_connection_request_envelope={ + "configurationFiles": [{"contents": "str", "fileName": "str", "type": "str"}], + "connectionIdentity": "str", + "connectionString": "str", + "id": "str", + "kind": "str", + "name": "str", + "region": "str", + "resourceId": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_build_database_connection(self, resource_group): + response = self.client.static_sites.delete_build_database_connection( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + database_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_build_database_connection(self, resource_group): + response = self.client.static_sites.update_build_database_connection( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + database_connection_name="str", + database_connection_request_envelope={ + "connectionIdentity": "str", + "connectionString": "str", + "region": "str", + "resourceId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_build_database_connection_with_details(self, resource_group): + response = self.client.static_sites.get_build_database_connection_with_details( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + database_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_static_site_build_functions(self, resource_group): + response = self.client.static_sites.list_static_site_build_functions( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_static_site_build_app_settings(self, resource_group): + response = self.client.static_sites.list_static_site_build_app_settings( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_static_site_build_function_app_settings(self, resource_group): + response = self.client.static_sites.list_static_site_build_function_app_settings( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_build_database_connections_with_details(self, resource_group): + response = self.client.static_sites.get_build_database_connections_with_details( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_user_provided_function_apps_for_static_site_build(self, resource_group): + response = self.client.static_sites.get_user_provided_function_apps_for_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_user_provided_function_app_for_static_site_build(self, resource_group): + response = self.client.static_sites.get_user_provided_function_app_for_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + function_app_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_register_user_provided_function_app_with_static_site_build(self, resource_group): + response = self.client.static_sites.begin_register_user_provided_function_app_with_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + function_app_name="str", + static_site_user_provided_function_envelope={ + "createdOn": "2020-02-20 00:00:00", + "functionAppRegion": "str", + "functionAppResourceId": "str", + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_detach_user_provided_function_app_from_static_site_build(self, resource_group): + response = self.client.static_sites.detach_user_provided_function_app_from_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + function_app_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_zip_deployment_for_static_site_build(self, resource_group): + response = self.client.static_sites.begin_create_zip_deployment_for_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + static_site_zip_deployment_envelope={ + "apiZipUrl": "str", + "appZipUrl": "str", + "deploymentTitle": "str", + "functionLanguage": "str", + "id": "str", + "kind": "str", + "name": "str", + "provider": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_static_site_app_settings(self, resource_group): + response = self.client.static_sites.create_or_update_static_site_app_settings( + resource_group_name=resource_group.name, + name="str", + app_settings={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_basic_auth(self, resource_group): + response = self.client.static_sites.list_basic_auth( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_basic_auth(self, resource_group): + response = self.client.static_sites.get_basic_auth( + resource_group_name=resource_group.name, + name="str", + basic_auth_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_basic_auth(self, resource_group): + response = self.client.static_sites.create_or_update_basic_auth( + resource_group_name=resource_group.name, + name="str", + basic_auth_name="str", + basic_auth_envelope={ + "applicableEnvironmentsMode": "str", + "environments": ["str"], + "id": "str", + "kind": "str", + "name": "str", + "password": "str", + "secretState": "str", + "secretUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_static_site_function_app_settings(self, resource_group): + response = self.client.static_sites.create_or_update_static_site_function_app_settings( + resource_group_name=resource_group.name, + name="str", + app_settings={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_user_roles_invitation_link(self, resource_group): + response = self.client.static_sites.create_user_roles_invitation_link( + resource_group_name=resource_group.name, + name="str", + static_site_user_roles_invitation_envelope={ + "domain": "str", + "id": "str", + "kind": "str", + "name": "str", + "numHoursToExpiration": 0, + "provider": "str", + "roles": "str", + "type": "str", + "userDetails": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_static_site_custom_domains(self, resource_group): + response = self.client.static_sites.list_static_site_custom_domains( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_static_site_custom_domain(self, resource_group): + response = self.client.static_sites.get_static_site_custom_domain( + resource_group_name=resource_group.name, + name="str", + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update_static_site_custom_domain(self, resource_group): + response = self.client.static_sites.begin_create_or_update_static_site_custom_domain( + resource_group_name=resource_group.name, + name="str", + domain_name="str", + static_site_custom_domain_request_properties_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "validationMethod": "cname-delegation", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_static_site_custom_domain(self, resource_group): + response = self.client.static_sites.begin_delete_static_site_custom_domain( + resource_group_name=resource_group.name, + name="str", + domain_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_validate_custom_domain_can_be_added_to_static_site(self, resource_group): + response = self.client.static_sites.begin_validate_custom_domain_can_be_added_to_static_site( + resource_group_name=resource_group.name, + name="str", + domain_name="str", + static_site_custom_domain_request_properties_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "validationMethod": "cname-delegation", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_database_connections(self, resource_group): + response = self.client.static_sites.get_database_connections( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_database_connection(self, resource_group): + response = self.client.static_sites.get_database_connection( + resource_group_name=resource_group.name, + name="str", + database_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_database_connection(self, resource_group): + response = self.client.static_sites.create_or_update_database_connection( + resource_group_name=resource_group.name, + name="str", + database_connection_name="str", + database_connection_request_envelope={ + "configurationFiles": [{"contents": "str", "fileName": "str", "type": "str"}], + "connectionIdentity": "str", + "connectionString": "str", + "id": "str", + "kind": "str", + "name": "str", + "region": "str", + "resourceId": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_database_connection(self, resource_group): + response = self.client.static_sites.delete_database_connection( + resource_group_name=resource_group.name, + name="str", + database_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_database_connection(self, resource_group): + response = self.client.static_sites.update_database_connection( + resource_group_name=resource_group.name, + name="str", + database_connection_name="str", + database_connection_request_envelope={ + "connectionIdentity": "str", + "connectionString": "str", + "region": "str", + "resourceId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_database_connection_with_details(self, resource_group): + response = self.client.static_sites.get_database_connection_with_details( + resource_group_name=resource_group.name, + name="str", + database_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_detach_static_site(self, resource_group): + response = self.client.static_sites.begin_detach_static_site( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_static_site_functions(self, resource_group): + response = self.client.static_sites.list_static_site_functions( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_static_site_app_settings(self, resource_group): + response = self.client.static_sites.list_static_site_app_settings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_static_site_configured_roles(self, resource_group): + response = self.client.static_sites.list_static_site_configured_roles( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_static_site_function_app_settings(self, resource_group): + response = self.client.static_sites.list_static_site_function_app_settings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_static_site_secrets(self, resource_group): + response = self.client.static_sites.list_static_site_secrets( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_endpoint_connection_list(self, resource_group): + response = self.client.static_sites.get_private_endpoint_connection_list( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_endpoint_connection(self, resource_group): + response = self.client.static_sites.get_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_approve_or_reject_private_endpoint_connection(self, resource_group): + response = self.client.static_sites.begin_approve_or_reject_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + private_endpoint_wrapper={ + "id": "str", + "ipAddresses": ["str"], + "kind": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_private_endpoint_connection(self, resource_group): + response = self.client.static_sites.begin_delete_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_link_resources(self, resource_group): + response = self.client.static_sites.get_private_link_resources( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_reset_static_site_api_key(self, resource_group): + response = self.client.static_sites.reset_static_site_api_key( + resource_group_name=resource_group.name, + name="str", + reset_properties_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "repositoryToken": "str", + "shouldUpdateRepository": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_database_connections_with_details(self, resource_group): + response = self.client.static_sites.get_database_connections_with_details( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_user_provided_function_apps_for_static_site(self, resource_group): + response = self.client.static_sites.get_user_provided_function_apps_for_static_site( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_user_provided_function_app_for_static_site(self, resource_group): + response = self.client.static_sites.get_user_provided_function_app_for_static_site( + resource_group_name=resource_group.name, + name="str", + function_app_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_register_user_provided_function_app_with_static_site(self, resource_group): + response = self.client.static_sites.begin_register_user_provided_function_app_with_static_site( + resource_group_name=resource_group.name, + name="str", + function_app_name="str", + static_site_user_provided_function_envelope={ + "createdOn": "2020-02-20 00:00:00", + "functionAppRegion": "str", + "functionAppResourceId": "str", + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_detach_user_provided_function_app_from_static_site(self, resource_group): + response = self.client.static_sites.detach_user_provided_function_app_from_static_site( + resource_group_name=resource_group.name, + name="str", + function_app_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_zip_deployment_for_static_site(self, resource_group): + response = self.client.static_sites.begin_create_zip_deployment_for_static_site( + resource_group_name=resource_group.name, + name="str", + static_site_zip_deployment_envelope={ + "apiZipUrl": "str", + "appZipUrl": "str", + "deploymentTitle": "str", + "functionLanguage": "str", + "id": "str", + "kind": "str", + "name": "str", + "provider": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_validate_backend(self, resource_group): + response = self.client.static_sites.begin_validate_backend( + resource_group_name=resource_group.name, + name="str", + linked_backend_name="str", + static_site_linked_backend_envelope={ + "backendResourceId": "str", + "createdOn": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "region": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_validate_backend_for_build(self, resource_group): + response = self.client.static_sites.begin_validate_backend_for_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + linked_backend_name="str", + static_site_linked_backend_envelope={ + "backendResourceId": "str", + "createdOn": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "region": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_linked_backends(self, resource_group): + response = self.client.static_sites.get_linked_backends( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_linked_backends_for_build(self, resource_group): + response = self.client.static_sites.get_linked_backends_for_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_linked_backend(self, resource_group): + response = self.client.static_sites.get_linked_backend( + resource_group_name=resource_group.name, + name="str", + linked_backend_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_link_backend(self, resource_group): + response = self.client.static_sites.begin_link_backend( + resource_group_name=resource_group.name, + name="str", + linked_backend_name="str", + static_site_linked_backend_envelope={ + "backendResourceId": "str", + "createdOn": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "region": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_unlink_backend(self, resource_group): + response = self.client.static_sites.unlink_backend( + resource_group_name=resource_group.name, + name="str", + linked_backend_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_linked_backend_for_build(self, resource_group): + response = self.client.static_sites.get_linked_backend_for_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + linked_backend_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_link_backend_to_build(self, resource_group): + response = self.client.static_sites.begin_link_backend_to_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + linked_backend_name="str", + static_site_linked_backend_envelope={ + "backendResourceId": "str", + "createdOn": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "region": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_unlink_backend_from_build(self, resource_group): + response = self.client.static_sites.unlink_backend_from_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + linked_backend_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_static_sites_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_static_sites_operations_async.py new file mode 100644 index 0000000000000..ca4d9dd85db3d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_static_sites_operations_async.py @@ -0,0 +1,1494 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementStaticSitesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_preview_workflow(self, resource_group): + response = await self.client.static_sites.preview_workflow( + location="str", + static_sites_workflow_preview_request={ + "branch": "str", + "buildProperties": { + "apiBuildCommand": "str", + "apiLocation": "str", + "appArtifactLocation": "str", + "appBuildCommand": "str", + "appLocation": "str", + "githubActionSecretNameOverride": "str", + "outputLocation": "str", + "skipGithubActionWorkflowGeneration": bool, + }, + "id": "str", + "kind": "str", + "name": "str", + "repositoryUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.static_sites.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_static_sites_by_resource_group(self, resource_group): + response = self.client.static_sites.get_static_sites_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_static_site(self, resource_group): + response = await self.client.static_sites.get_static_site( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update_static_site(self, resource_group): + response = await ( + await self.client.static_sites.begin_create_or_update_static_site( + resource_group_name=resource_group.name, + name="str", + static_site_envelope={ + "location": "str", + "allowConfigFileUpdates": bool, + "branch": "str", + "buildProperties": { + "apiBuildCommand": "str", + "apiLocation": "str", + "appArtifactLocation": "str", + "appBuildCommand": "str", + "appLocation": "str", + "githubActionSecretNameOverride": "str", + "outputLocation": "str", + "skipGithubActionWorkflowGeneration": bool, + }, + "contentDistributionEndpoint": "str", + "customDomains": ["str"], + "databaseConnections": [ + { + "configurationFiles": [{"contents": "str", "fileName": "str", "type": "str"}], + "connectionIdentity": "str", + "name": "str", + "region": "str", + "resourceId": "str", + } + ], + "defaultHostname": "str", + "enterpriseGradeCdnStatus": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "keyVaultReferenceIdentity": "str", + "kind": "str", + "linkedBackends": [ + { + "backendResourceId": "str", + "createdOn": "2020-02-20 00:00:00", + "provisioningState": "str", + "region": "str", + } + ], + "name": "str", + "privateEndpointConnections": [ + { + "error": { + "code": "str", + "details": [...], + "extendedCode": "str", + "innerErrors": [...], + "message": "str", + "messageTemplate": "str", + "parameters": ["str"], + "target": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "plan": { + "name": "str", + "product": "str", + "promotionCode": "str", + "publisher": "str", + "version": "str", + }, + "properties": { + "id": "str", + "ipAddresses": ["str"], + "kind": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + }, + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": { + "default": 0, + "elasticMaximum": 0, + "maximum": 0, + "minimum": 0, + "scaleType": "str", + }, + "tier": "str", + }, + "status": "str", + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + } + ], + "provider": "str", + "publicNetworkAccess": "str", + "repositoryToken": "str", + "repositoryUrl": "str", + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": { + "default": 0, + "elasticMaximum": 0, + "maximum": 0, + "minimum": 0, + "scaleType": "str", + }, + "tier": "str", + }, + "stagingEnvironmentPolicy": "str", + "tags": {"str": "str"}, + "templateProperties": { + "description": "str", + "isPrivate": bool, + "owner": "str", + "repositoryName": "str", + "templateRepositoryUrl": "str", + }, + "type": "str", + "userProvidedFunctionApps": [ + { + "createdOn": "2020-02-20 00:00:00", + "functionAppRegion": "str", + "functionAppResourceId": "str", + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + } + ], + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_static_site(self, resource_group): + response = await ( + await self.client.static_sites.begin_delete_static_site( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_static_site(self, resource_group): + response = await self.client.static_sites.update_static_site( + resource_group_name=resource_group.name, + name="str", + static_site_envelope={ + "allowConfigFileUpdates": bool, + "branch": "str", + "buildProperties": { + "apiBuildCommand": "str", + "apiLocation": "str", + "appArtifactLocation": "str", + "appBuildCommand": "str", + "appLocation": "str", + "githubActionSecretNameOverride": "str", + "outputLocation": "str", + "skipGithubActionWorkflowGeneration": bool, + }, + "contentDistributionEndpoint": "str", + "customDomains": ["str"], + "databaseConnections": [ + { + "configurationFiles": [{"contents": "str", "fileName": "str", "type": "str"}], + "connectionIdentity": "str", + "name": "str", + "region": "str", + "resourceId": "str", + } + ], + "defaultHostname": "str", + "enterpriseGradeCdnStatus": "str", + "id": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "linkedBackends": [ + { + "backendResourceId": "str", + "createdOn": "2020-02-20 00:00:00", + "provisioningState": "str", + "region": "str", + } + ], + "name": "str", + "privateEndpointConnections": [ + { + "error": { + "code": "str", + "details": [...], + "extendedCode": "str", + "innerErrors": [...], + "message": "str", + "messageTemplate": "str", + "parameters": ["str"], + "target": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "plan": { + "name": "str", + "product": "str", + "promotionCode": "str", + "publisher": "str", + "version": "str", + }, + "properties": { + "id": "str", + "ipAddresses": ["str"], + "kind": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + }, + "sku": { + "capabilities": [{"name": "str", "reason": "str", "value": "str"}], + "capacity": 0, + "family": "str", + "locations": ["str"], + "name": "str", + "size": "str", + "skuCapacity": { + "default": 0, + "elasticMaximum": 0, + "maximum": 0, + "minimum": 0, + "scaleType": "str", + }, + "tier": "str", + }, + "status": "str", + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + } + ], + "provider": "str", + "publicNetworkAccess": "str", + "repositoryToken": "str", + "repositoryUrl": "str", + "stagingEnvironmentPolicy": "str", + "templateProperties": { + "description": "str", + "isPrivate": bool, + "owner": "str", + "repositoryName": "str", + "templateRepositoryUrl": "str", + }, + "type": "str", + "userProvidedFunctionApps": [ + { + "createdOn": "2020-02-20 00:00:00", + "functionAppRegion": "str", + "functionAppResourceId": "str", + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + } + ], + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_static_site_users(self, resource_group): + response = self.client.static_sites.list_static_site_users( + resource_group_name=resource_group.name, + name="str", + authprovider="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_static_site_user(self, resource_group): + response = await self.client.static_sites.delete_static_site_user( + resource_group_name=resource_group.name, + name="str", + authprovider="str", + userid="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_static_site_user(self, resource_group): + response = await self.client.static_sites.update_static_site_user( + resource_group_name=resource_group.name, + name="str", + authprovider="str", + userid="str", + static_site_user_envelope={ + "displayName": "str", + "id": "str", + "kind": "str", + "name": "str", + "provider": "str", + "roles": "str", + "type": "str", + "userId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_static_site_builds(self, resource_group): + response = self.client.static_sites.get_static_site_builds( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_static_site_build(self, resource_group): + response = await self.client.static_sites.get_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_static_site_build(self, resource_group): + response = await ( + await self.client.static_sites.begin_delete_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_static_site_build_app_settings(self, resource_group): + response = await self.client.static_sites.create_or_update_static_site_build_app_settings( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + app_settings={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_static_site_build_function_app_settings(self, resource_group): + response = await self.client.static_sites.create_or_update_static_site_build_function_app_settings( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + app_settings={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_build_database_connections(self, resource_group): + response = self.client.static_sites.get_build_database_connections( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_build_database_connection(self, resource_group): + response = await self.client.static_sites.get_build_database_connection( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + database_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_build_database_connection(self, resource_group): + response = await self.client.static_sites.create_or_update_build_database_connection( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + database_connection_name="str", + database_connection_request_envelope={ + "configurationFiles": [{"contents": "str", "fileName": "str", "type": "str"}], + "connectionIdentity": "str", + "connectionString": "str", + "id": "str", + "kind": "str", + "name": "str", + "region": "str", + "resourceId": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_build_database_connection(self, resource_group): + response = await self.client.static_sites.delete_build_database_connection( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + database_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_build_database_connection(self, resource_group): + response = await self.client.static_sites.update_build_database_connection( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + database_connection_name="str", + database_connection_request_envelope={ + "connectionIdentity": "str", + "connectionString": "str", + "region": "str", + "resourceId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_build_database_connection_with_details(self, resource_group): + response = await self.client.static_sites.get_build_database_connection_with_details( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + database_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_static_site_build_functions(self, resource_group): + response = self.client.static_sites.list_static_site_build_functions( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_static_site_build_app_settings(self, resource_group): + response = await self.client.static_sites.list_static_site_build_app_settings( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_static_site_build_function_app_settings(self, resource_group): + response = await self.client.static_sites.list_static_site_build_function_app_settings( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_build_database_connections_with_details(self, resource_group): + response = self.client.static_sites.get_build_database_connections_with_details( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_user_provided_function_apps_for_static_site_build(self, resource_group): + response = self.client.static_sites.get_user_provided_function_apps_for_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_user_provided_function_app_for_static_site_build(self, resource_group): + response = await self.client.static_sites.get_user_provided_function_app_for_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + function_app_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_register_user_provided_function_app_with_static_site_build(self, resource_group): + response = await ( + await self.client.static_sites.begin_register_user_provided_function_app_with_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + function_app_name="str", + static_site_user_provided_function_envelope={ + "createdOn": "2020-02-20 00:00:00", + "functionAppRegion": "str", + "functionAppResourceId": "str", + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_detach_user_provided_function_app_from_static_site_build(self, resource_group): + response = await self.client.static_sites.detach_user_provided_function_app_from_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + function_app_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_zip_deployment_for_static_site_build(self, resource_group): + response = await ( + await self.client.static_sites.begin_create_zip_deployment_for_static_site_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + static_site_zip_deployment_envelope={ + "apiZipUrl": "str", + "appZipUrl": "str", + "deploymentTitle": "str", + "functionLanguage": "str", + "id": "str", + "kind": "str", + "name": "str", + "provider": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_static_site_app_settings(self, resource_group): + response = await self.client.static_sites.create_or_update_static_site_app_settings( + resource_group_name=resource_group.name, + name="str", + app_settings={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_basic_auth(self, resource_group): + response = self.client.static_sites.list_basic_auth( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_basic_auth(self, resource_group): + response = await self.client.static_sites.get_basic_auth( + resource_group_name=resource_group.name, + name="str", + basic_auth_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_basic_auth(self, resource_group): + response = await self.client.static_sites.create_or_update_basic_auth( + resource_group_name=resource_group.name, + name="str", + basic_auth_name="str", + basic_auth_envelope={ + "applicableEnvironmentsMode": "str", + "environments": ["str"], + "id": "str", + "kind": "str", + "name": "str", + "password": "str", + "secretState": "str", + "secretUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_static_site_function_app_settings(self, resource_group): + response = await self.client.static_sites.create_or_update_static_site_function_app_settings( + resource_group_name=resource_group.name, + name="str", + app_settings={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_user_roles_invitation_link(self, resource_group): + response = await self.client.static_sites.create_user_roles_invitation_link( + resource_group_name=resource_group.name, + name="str", + static_site_user_roles_invitation_envelope={ + "domain": "str", + "id": "str", + "kind": "str", + "name": "str", + "numHoursToExpiration": 0, + "provider": "str", + "roles": "str", + "type": "str", + "userDetails": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_static_site_custom_domains(self, resource_group): + response = self.client.static_sites.list_static_site_custom_domains( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_static_site_custom_domain(self, resource_group): + response = await self.client.static_sites.get_static_site_custom_domain( + resource_group_name=resource_group.name, + name="str", + domain_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update_static_site_custom_domain(self, resource_group): + response = await ( + await self.client.static_sites.begin_create_or_update_static_site_custom_domain( + resource_group_name=resource_group.name, + name="str", + domain_name="str", + static_site_custom_domain_request_properties_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "validationMethod": "cname-delegation", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_static_site_custom_domain(self, resource_group): + response = await ( + await self.client.static_sites.begin_delete_static_site_custom_domain( + resource_group_name=resource_group.name, + name="str", + domain_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_validate_custom_domain_can_be_added_to_static_site(self, resource_group): + response = await ( + await self.client.static_sites.begin_validate_custom_domain_can_be_added_to_static_site( + resource_group_name=resource_group.name, + name="str", + domain_name="str", + static_site_custom_domain_request_properties_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "validationMethod": "cname-delegation", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_database_connections(self, resource_group): + response = self.client.static_sites.get_database_connections( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_database_connection(self, resource_group): + response = await self.client.static_sites.get_database_connection( + resource_group_name=resource_group.name, + name="str", + database_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_database_connection(self, resource_group): + response = await self.client.static_sites.create_or_update_database_connection( + resource_group_name=resource_group.name, + name="str", + database_connection_name="str", + database_connection_request_envelope={ + "configurationFiles": [{"contents": "str", "fileName": "str", "type": "str"}], + "connectionIdentity": "str", + "connectionString": "str", + "id": "str", + "kind": "str", + "name": "str", + "region": "str", + "resourceId": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_database_connection(self, resource_group): + response = await self.client.static_sites.delete_database_connection( + resource_group_name=resource_group.name, + name="str", + database_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_database_connection(self, resource_group): + response = await self.client.static_sites.update_database_connection( + resource_group_name=resource_group.name, + name="str", + database_connection_name="str", + database_connection_request_envelope={ + "connectionIdentity": "str", + "connectionString": "str", + "region": "str", + "resourceId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_database_connection_with_details(self, resource_group): + response = await self.client.static_sites.get_database_connection_with_details( + resource_group_name=resource_group.name, + name="str", + database_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_detach_static_site(self, resource_group): + response = await ( + await self.client.static_sites.begin_detach_static_site( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_static_site_functions(self, resource_group): + response = self.client.static_sites.list_static_site_functions( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_static_site_app_settings(self, resource_group): + response = await self.client.static_sites.list_static_site_app_settings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_static_site_configured_roles(self, resource_group): + response = await self.client.static_sites.list_static_site_configured_roles( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_static_site_function_app_settings(self, resource_group): + response = await self.client.static_sites.list_static_site_function_app_settings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_static_site_secrets(self, resource_group): + response = await self.client.static_sites.list_static_site_secrets( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_endpoint_connection_list(self, resource_group): + response = self.client.static_sites.get_private_endpoint_connection_list( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_endpoint_connection(self, resource_group): + response = await self.client.static_sites.get_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_approve_or_reject_private_endpoint_connection(self, resource_group): + response = await ( + await self.client.static_sites.begin_approve_or_reject_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + private_endpoint_wrapper={ + "id": "str", + "ipAddresses": ["str"], + "kind": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_private_endpoint_connection(self, resource_group): + response = await ( + await self.client.static_sites.begin_delete_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_link_resources(self, resource_group): + response = await self.client.static_sites.get_private_link_resources( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_reset_static_site_api_key(self, resource_group): + response = await self.client.static_sites.reset_static_site_api_key( + resource_group_name=resource_group.name, + name="str", + reset_properties_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "repositoryToken": "str", + "shouldUpdateRepository": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_database_connections_with_details(self, resource_group): + response = self.client.static_sites.get_database_connections_with_details( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_user_provided_function_apps_for_static_site(self, resource_group): + response = self.client.static_sites.get_user_provided_function_apps_for_static_site( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_user_provided_function_app_for_static_site(self, resource_group): + response = await self.client.static_sites.get_user_provided_function_app_for_static_site( + resource_group_name=resource_group.name, + name="str", + function_app_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_register_user_provided_function_app_with_static_site(self, resource_group): + response = await ( + await self.client.static_sites.begin_register_user_provided_function_app_with_static_site( + resource_group_name=resource_group.name, + name="str", + function_app_name="str", + static_site_user_provided_function_envelope={ + "createdOn": "2020-02-20 00:00:00", + "functionAppRegion": "str", + "functionAppResourceId": "str", + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_detach_user_provided_function_app_from_static_site(self, resource_group): + response = await self.client.static_sites.detach_user_provided_function_app_from_static_site( + resource_group_name=resource_group.name, + name="str", + function_app_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_zip_deployment_for_static_site(self, resource_group): + response = await ( + await self.client.static_sites.begin_create_zip_deployment_for_static_site( + resource_group_name=resource_group.name, + name="str", + static_site_zip_deployment_envelope={ + "apiZipUrl": "str", + "appZipUrl": "str", + "deploymentTitle": "str", + "functionLanguage": "str", + "id": "str", + "kind": "str", + "name": "str", + "provider": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_validate_backend(self, resource_group): + response = await ( + await self.client.static_sites.begin_validate_backend( + resource_group_name=resource_group.name, + name="str", + linked_backend_name="str", + static_site_linked_backend_envelope={ + "backendResourceId": "str", + "createdOn": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "region": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_validate_backend_for_build(self, resource_group): + response = await ( + await self.client.static_sites.begin_validate_backend_for_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + linked_backend_name="str", + static_site_linked_backend_envelope={ + "backendResourceId": "str", + "createdOn": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "region": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_linked_backends(self, resource_group): + response = self.client.static_sites.get_linked_backends( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_linked_backends_for_build(self, resource_group): + response = self.client.static_sites.get_linked_backends_for_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_linked_backend(self, resource_group): + response = await self.client.static_sites.get_linked_backend( + resource_group_name=resource_group.name, + name="str", + linked_backend_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_link_backend(self, resource_group): + response = await ( + await self.client.static_sites.begin_link_backend( + resource_group_name=resource_group.name, + name="str", + linked_backend_name="str", + static_site_linked_backend_envelope={ + "backendResourceId": "str", + "createdOn": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "region": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_unlink_backend(self, resource_group): + response = await self.client.static_sites.unlink_backend( + resource_group_name=resource_group.name, + name="str", + linked_backend_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_linked_backend_for_build(self, resource_group): + response = await self.client.static_sites.get_linked_backend_for_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + linked_backend_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_link_backend_to_build(self, resource_group): + response = await ( + await self.client.static_sites.begin_link_backend_to_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + linked_backend_name="str", + static_site_linked_backend_envelope={ + "backendResourceId": "str", + "createdOn": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "region": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_unlink_backend_from_build(self, resource_group): + response = await self.client.static_sites.unlink_backend_from_build( + resource_group_name=resource_group.name, + name="str", + environment_name="str", + linked_backend_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_top_level_domains_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_top_level_domains_operations.py new file mode 100644 index 0000000000000..2e6a808f72426 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_top_level_domains_operations.py @@ -0,0 +1,52 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementTopLevelDomainsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.top_level_domains.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.top_level_domains.get( + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_agreements(self, resource_group): + response = self.client.top_level_domains.list_agreements( + name="str", + agreement_option={"forTransfer": bool, "includePrivacy": bool}, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_top_level_domains_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_top_level_domains_operations_async.py new file mode 100644 index 0000000000000..871d2cfa39732 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_top_level_domains_operations_async.py @@ -0,0 +1,53 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementTopLevelDomainsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.top_level_domains.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.top_level_domains.get( + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_agreements(self, resource_group): + response = self.client.top_level_domains.list_agreements( + name="str", + agreement_option={"forTransfer": bool, "includePrivacy": bool}, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_web_apps_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_web_apps_operations.py new file mode 100644 index 0000000000000..c804cd566e984 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_web_apps_operations.py @@ -0,0 +1,8649 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWebAppsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.web_apps.list( + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.web_apps.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.web_apps.get( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.web_apps.begin_create_or_update( + resource_group_name=resource_group.name, + name="str", + site_envelope={ + "location": "str", + "availabilityState": "str", + "clientAffinityEnabled": bool, + "clientCertEnabled": bool, + "clientCertExclusionPaths": "str", + "clientCertMode": "str", + "cloningInfo": { + "sourceWebAppId": "str", + "appSettingsOverrides": {"str": "str"}, + "cloneCustomHostNames": bool, + "cloneSourceControl": bool, + "configureLoadBalancing": bool, + "correlationId": "str", + "hostingEnvironment": "str", + "overwrite": bool, + "sourceWebAppLocation": "str", + "trafficManagerProfileId": "str", + "trafficManagerProfileName": "str", + }, + "containerSize": 0, + "customDomainVerificationId": "str", + "dailyMemoryTimeQuota": 0, + "daprConfig": { + "appId": "str", + "appPort": 0, + "enableApiLogging": bool, + "enabled": False, + "httpMaxRequestSize": 0, + "httpReadBufferSize": 0, + "logLevel": "str", + }, + "defaultHostName": "str", + "dnsConfiguration": { + "dnsAltServer": "str", + "dnsLegacySortOrder": bool, + "dnsMaxCacheTimeout": 0, + "dnsRetryAttemptCount": 0, + "dnsRetryAttemptTimeout": 0, + "dnsServers": ["str"], + }, + "enabled": bool, + "enabledHostNames": ["str"], + "extendedLocation": {"name": "str", "type": "str"}, + "functionAppConfig": { + "deployment": { + "storage": { + "authentication": { + "storageAccountConnectionStringName": "str", + "type": "str", + "userAssignedIdentityResourceId": "str", + }, + "type": "str", + "value": "str", + } + }, + "runtime": {"name": "str", "version": "str"}, + "scaleAndConcurrency": { + "alwaysReady": [{"instanceCount": 0, "name": "str"}], + "instanceMemoryMB": 0, + "maximumInstanceCount": 0, + "triggers": {"http": {"perInstanceConcurrency": 0}}, + }, + }, + "hostNameSslStates": [ + { + "hostType": "str", + "name": "str", + "sslState": "str", + "thumbprint": "str", + "toUpdate": bool, + "virtualIP": "str", + } + ], + "hostNames": ["str"], + "hostNamesDisabled": bool, + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "httpsOnly": bool, + "hyperV": False, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inProgressOperationId": "str", + "isDefaultContainer": bool, + "isXenon": False, + "keyVaultReferenceIdentity": "str", + "kind": "str", + "lastModifiedTimeUtc": "2020-02-20 00:00:00", + "managedEnvironmentId": "str", + "maxNumberOfWorkers": 0, + "name": "str", + "outboundIpAddresses": "str", + "possibleOutboundIpAddresses": "str", + "publicNetworkAccess": "str", + "redundancyMode": "str", + "repositorySiteName": "str", + "reserved": False, + "resourceConfig": {"cpu": 0.0, "memory": "str"}, + "resourceGroup": "str", + "scmSiteAlsoStopped": False, + "serverFarmId": "str", + "siteConfig": { + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [ + {"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"} + ], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + "slotSwapStatus": { + "destinationSlotName": "str", + "sourceSlotName": "str", + "timestampUtc": "2020-02-20 00:00:00", + }, + "state": "str", + "storageAccountRequired": bool, + "suspendedTill": "2020-02-20 00:00:00", + "tags": {"str": "str"}, + "targetSwapSlot": "str", + "trafficManagerHostNames": ["str"], + "type": "str", + "usageState": "str", + "virtualNetworkSubnetId": "str", + "vnetBackupRestoreEnabled": bool, + "vnetContentShareEnabled": bool, + "vnetImagePullEnabled": bool, + "vnetRouteAllEnabled": bool, + "workloadProfileName": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.web_apps.delete( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.web_apps.update( + resource_group_name=resource_group.name, + name="str", + site_envelope={ + "availabilityState": "str", + "clientAffinityEnabled": bool, + "clientCertEnabled": bool, + "clientCertExclusionPaths": "str", + "clientCertMode": "str", + "cloningInfo": { + "sourceWebAppId": "str", + "appSettingsOverrides": {"str": "str"}, + "cloneCustomHostNames": bool, + "cloneSourceControl": bool, + "configureLoadBalancing": bool, + "correlationId": "str", + "hostingEnvironment": "str", + "overwrite": bool, + "sourceWebAppLocation": "str", + "trafficManagerProfileId": "str", + "trafficManagerProfileName": "str", + }, + "containerSize": 0, + "customDomainVerificationId": "str", + "dailyMemoryTimeQuota": 0, + "defaultHostName": "str", + "dnsConfiguration": { + "dnsAltServer": "str", + "dnsLegacySortOrder": bool, + "dnsMaxCacheTimeout": 0, + "dnsRetryAttemptCount": 0, + "dnsRetryAttemptTimeout": 0, + "dnsServers": ["str"], + }, + "enabled": bool, + "enabledHostNames": ["str"], + "hostNameSslStates": [ + { + "hostType": "str", + "name": "str", + "sslState": "str", + "thumbprint": "str", + "toUpdate": bool, + "virtualIP": "str", + } + ], + "hostNames": ["str"], + "hostNamesDisabled": bool, + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "httpsOnly": bool, + "hyperV": False, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inProgressOperationId": "str", + "isDefaultContainer": bool, + "isXenon": False, + "keyVaultReferenceIdentity": "str", + "kind": "str", + "lastModifiedTimeUtc": "2020-02-20 00:00:00", + "maxNumberOfWorkers": 0, + "name": "str", + "outboundIpAddresses": "str", + "possibleOutboundIpAddresses": "str", + "redundancyMode": "str", + "repositorySiteName": "str", + "reserved": False, + "resourceGroup": "str", + "scmSiteAlsoStopped": False, + "serverFarmId": "str", + "siteConfig": { + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [ + {"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"} + ], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + "slotSwapStatus": { + "destinationSlotName": "str", + "sourceSlotName": "str", + "timestampUtc": "2020-02-20 00:00:00", + }, + "state": "str", + "storageAccountRequired": bool, + "suspendedTill": "2020-02-20 00:00:00", + "targetSwapSlot": "str", + "trafficManagerHostNames": ["str"], + "type": "str", + "usageState": "str", + "virtualNetworkSubnetId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_analyze_custom_hostname(self, resource_group): + response = self.client.web_apps.analyze_custom_hostname( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_apply_slot_config_to_production(self, resource_group): + response = self.client.web_apps.apply_slot_config_to_production( + resource_group_name=resource_group.name, + name="str", + slot_swap_entity={"preserveVnet": bool, "targetSlot": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup(self, resource_group): + response = self.client.web_apps.backup( + resource_group_name=resource_group.name, + name="str", + request={ + "backupName": "str", + "backupSchedule": { + "frequencyInterval": 7, + "frequencyUnit": "Day", + "keepAtLeastOneBackup": True, + "retentionPeriodInDays": 30, + "lastExecutionTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + }, + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_backups(self, resource_group): + response = self.client.web_apps.list_backups( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_backup_status(self, resource_group): + response = self.client.web_apps.get_backup_status( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_backup(self, resource_group): + response = self.client.web_apps.delete_backup( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_backup_status_secrets(self, resource_group): + response = self.client.web_apps.list_backup_status_secrets( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + request={ + "backupName": "str", + "backupSchedule": { + "frequencyInterval": 7, + "frequencyUnit": "Day", + "keepAtLeastOneBackup": True, + "retentionPeriodInDays": 30, + "lastExecutionTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + }, + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restore(self, resource_group): + response = self.client.web_apps.begin_restore( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + request={ + "adjustConnectionStrings": bool, + "appServicePlan": "str", + "blobName": "str", + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "hostingEnvironment": "str", + "id": "str", + "ignoreConflictingHostNames": False, + "ignoreDatabases": False, + "kind": "str", + "name": "str", + "operationType": "Default", + "overwrite": bool, + "siteName": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_basic_publishing_credentials_policies(self, resource_group): + response = self.client.web_apps.list_basic_publishing_credentials_policies( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_ftp_allowed(self, resource_group): + response = self.client.web_apps.get_ftp_allowed( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_ftp_allowed(self, resource_group): + response = self.client.web_apps.update_ftp_allowed( + resource_group_name=resource_group.name, + name="str", + csm_publishing_access_policies_entity={ + "allow": bool, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_scm_allowed(self, resource_group): + response = self.client.web_apps.get_scm_allowed( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_scm_allowed(self, resource_group): + response = self.client.web_apps.update_scm_allowed( + resource_group_name=resource_group.name, + name="str", + csm_publishing_access_policies_entity={ + "allow": bool, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_configurations(self, resource_group): + response = self.client.web_apps.list_configurations( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_application_settings(self, resource_group): + response = self.client.web_apps.update_application_settings( + resource_group_name=resource_group.name, + name="str", + app_settings={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_application_settings(self, resource_group): + response = self.client.web_apps.list_application_settings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_auth_settings(self, resource_group): + response = self.client.web_apps.update_auth_settings( + resource_group_name=resource_group.name, + name="str", + site_auth_settings={ + "aadClaimsAuthorization": "str", + "additionalLoginParams": ["str"], + "allowedAudiences": ["str"], + "allowedExternalRedirectUrls": ["str"], + "authFilePath": "str", + "clientId": "str", + "clientSecret": "str", + "clientSecretCertificateThumbprint": "str", + "clientSecretSettingName": "str", + "configVersion": "str", + "defaultProvider": "str", + "enabled": bool, + "facebookAppId": "str", + "facebookAppSecret": "str", + "facebookAppSecretSettingName": "str", + "facebookOAuthScopes": ["str"], + "gitHubClientId": "str", + "gitHubClientSecret": "str", + "gitHubClientSecretSettingName": "str", + "gitHubOAuthScopes": ["str"], + "googleClientId": "str", + "googleClientSecret": "str", + "googleClientSecretSettingName": "str", + "googleOAuthScopes": ["str"], + "id": "str", + "isAuthFromFile": "str", + "issuer": "str", + "kind": "str", + "microsoftAccountClientId": "str", + "microsoftAccountClientSecret": "str", + "microsoftAccountClientSecretSettingName": "str", + "microsoftAccountOAuthScopes": ["str"], + "name": "str", + "runtimeVersion": "str", + "tokenRefreshExtensionHours": 0.0, + "tokenStoreEnabled": bool, + "twitterConsumerKey": "str", + "twitterConsumerSecret": "str", + "twitterConsumerSecretSettingName": "str", + "type": "str", + "unauthenticatedClientAction": "str", + "validateIssuer": bool, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_auth_settings(self, resource_group): + response = self.client.web_apps.get_auth_settings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_auth_settings_v2_without_secrets(self, resource_group): + response = self.client.web_apps.get_auth_settings_v2_without_secrets( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_auth_settings_v2(self, resource_group): + response = self.client.web_apps.update_auth_settings_v2( + resource_group_name=resource_group.name, + name="str", + site_auth_settings_v2={ + "globalValidation": { + "excludedPaths": ["str"], + "redirectToProvider": "str", + "requireAuthentication": bool, + "unauthenticatedClientAction": "str", + }, + "httpSettings": { + "forwardProxy": { + "convention": "str", + "customHostHeaderName": "str", + "customProtoHeaderName": "str", + }, + "requireHttps": bool, + "routes": {"apiPrefix": "str"}, + }, + "id": "str", + "identityProviders": { + "apple": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "azureActiveDirectory": { + "enabled": bool, + "isAutoProvisioned": bool, + "login": {"disableWWWAuthenticate": bool, "loginParameters": ["str"]}, + "registration": { + "clientId": "str", + "clientSecretCertificateIssuer": "str", + "clientSecretCertificateSubjectAlternativeName": "str", + "clientSecretCertificateThumbprint": "str", + "clientSecretSettingName": "str", + "openIdIssuer": "str", + }, + "validation": { + "allowedAudiences": ["str"], + "defaultAuthorizationPolicy": { + "allowedApplications": ["str"], + "allowedPrincipals": {"groups": ["str"], "identities": ["str"]}, + }, + "jwtClaimChecks": {"allowedClientApplications": ["str"], "allowedGroups": ["str"]}, + }, + }, + "azureStaticWebApps": {"enabled": bool, "registration": {"clientId": "str"}}, + "customOpenIdConnectProviders": { + "str": { + "enabled": bool, + "login": {"nameClaimType": "str", "scopes": ["str"]}, + "registration": { + "clientCredential": {"clientSecretSettingName": "str", "method": "ClientSecretPost"}, + "clientId": "str", + "openIdConnectConfiguration": { + "authorizationEndpoint": "str", + "certificationUri": "str", + "issuer": "str", + "tokenEndpoint": "str", + "wellKnownOpenIdConfiguration": "str", + }, + }, + } + }, + "facebook": { + "enabled": bool, + "graphApiVersion": "str", + "login": {"scopes": ["str"]}, + "registration": {"appId": "str", "appSecretSettingName": "str"}, + }, + "gitHub": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "google": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + "validation": {"allowedAudiences": ["str"]}, + }, + "legacyMicrosoftAccount": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + "validation": {"allowedAudiences": ["str"]}, + }, + "twitter": { + "enabled": bool, + "registration": {"consumerKey": "str", "consumerSecretSettingName": "str"}, + }, + }, + "kind": "str", + "login": { + "allowedExternalRedirectUrls": ["str"], + "cookieExpiration": {"convention": "str", "timeToExpiration": "str"}, + "nonce": {"nonceExpirationInterval": "str", "validateNonce": bool}, + "preserveUrlFragmentsForLogins": bool, + "routes": {"logoutEndpoint": "str"}, + "tokenStore": { + "azureBlobStorage": {"sasUrlSettingName": "str"}, + "enabled": bool, + "fileSystem": {"directory": "str"}, + "tokenRefreshExtensionHours": 0.0, + }, + }, + "name": "str", + "platform": {"configFilePath": "str", "enabled": bool, "runtimeVersion": "str"}, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_auth_settings_v2(self, resource_group): + response = self.client.web_apps.get_auth_settings_v2( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_azure_storage_accounts(self, resource_group): + response = self.client.web_apps.update_azure_storage_accounts( + resource_group_name=resource_group.name, + name="str", + azure_storage_accounts={ + "id": "str", + "kind": "str", + "name": "str", + "properties": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_azure_storage_accounts(self, resource_group): + response = self.client.web_apps.list_azure_storage_accounts( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_backup_configuration(self, resource_group): + response = self.client.web_apps.update_backup_configuration( + resource_group_name=resource_group.name, + name="str", + request={ + "backupName": "str", + "backupSchedule": { + "frequencyInterval": 7, + "frequencyUnit": "Day", + "keepAtLeastOneBackup": True, + "retentionPeriodInDays": 30, + "lastExecutionTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + }, + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_backup_configuration(self, resource_group): + response = self.client.web_apps.delete_backup_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_backup_configuration(self, resource_group): + response = self.client.web_apps.get_backup_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_app_settings_key_vault_references(self, resource_group): + response = self.client.web_apps.get_app_settings_key_vault_references( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_app_setting_key_vault_reference(self, resource_group): + response = self.client.web_apps.get_app_setting_key_vault_reference( + resource_group_name=resource_group.name, + name="str", + app_setting_key="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_connection_string_key_vault_references(self, resource_group): + response = self.client.web_apps.get_site_connection_string_key_vault_references( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_connection_string_key_vault_reference(self, resource_group): + response = self.client.web_apps.get_site_connection_string_key_vault_reference( + resource_group_name=resource_group.name, + name="str", + connection_string_key="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_connection_strings(self, resource_group): + response = self.client.web_apps.update_connection_strings( + resource_group_name=resource_group.name, + name="str", + connection_strings={ + "id": "str", + "kind": "str", + "name": "str", + "properties": {"str": {"type": "str", "value": "str"}}, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_connection_strings(self, resource_group): + response = self.client.web_apps.list_connection_strings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_diagnostic_logs_configuration(self, resource_group): + response = self.client.web_apps.get_diagnostic_logs_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_diagnostic_logs_config(self, resource_group): + response = self.client.web_apps.update_diagnostic_logs_config( + resource_group_name=resource_group.name, + name="str", + site_logs_config={ + "applicationLogs": { + "azureBlobStorage": {"level": "str", "retentionInDays": 0, "sasUrl": "str"}, + "azureTableStorage": {"sasUrl": "str", "level": "str"}, + "fileSystem": {"level": "str"}, + }, + "detailedErrorMessages": {"enabled": bool}, + "failedRequestsTracing": {"enabled": bool}, + "httpLogs": { + "azureBlobStorage": {"enabled": bool, "retentionInDays": 0, "sasUrl": "str"}, + "fileSystem": {"enabled": bool, "retentionInDays": 0, "retentionInMb": 0}, + }, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_metadata(self, resource_group): + response = self.client.web_apps.update_metadata( + resource_group_name=resource_group.name, + name="str", + metadata={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_metadata(self, resource_group): + response = self.client.web_apps.list_metadata( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_list_publishing_credentials(self, resource_group): + response = self.client.web_apps.begin_list_publishing_credentials( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_site_push_settings(self, resource_group): + response = self.client.web_apps.update_site_push_settings( + resource_group_name=resource_group.name, + name="str", + push_settings={ + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_push_settings(self, resource_group): + response = self.client.web_apps.list_site_push_settings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_slot_configuration_names(self, resource_group): + response = self.client.web_apps.list_slot_configuration_names( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_slot_configuration_names(self, resource_group): + response = self.client.web_apps.update_slot_configuration_names( + resource_group_name=resource_group.name, + name="str", + slot_config_names={ + "appSettingNames": ["str"], + "azureStorageConfigNames": ["str"], + "connectionStringNames": ["str"], + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_configuration(self, resource_group): + response = self.client.web_apps.get_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_configuration(self, resource_group): + response = self.client.web_apps.create_or_update_configuration( + resource_group_name=resource_group.name, + name="str", + site_config={ + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [{"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"}], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "id": "str", + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "name": "str", + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "type": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_configuration(self, resource_group): + response = self.client.web_apps.update_configuration( + resource_group_name=resource_group.name, + name="str", + site_config={ + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [{"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"}], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "id": "str", + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "name": "str", + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "type": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_configuration_snapshot_info(self, resource_group): + response = self.client.web_apps.list_configuration_snapshot_info( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_configuration_snapshot(self, resource_group): + response = self.client.web_apps.get_configuration_snapshot( + resource_group_name=resource_group.name, + name="str", + snapshot_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_recover_site_configuration_snapshot(self, resource_group): + response = self.client.web_apps.recover_site_configuration_snapshot( + resource_group_name=resource_group.name, + name="str", + snapshot_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_web_site_container_logs(self, resource_group): + response = self.client.web_apps.get_web_site_container_logs( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_container_logs_zip(self, resource_group): + response = self.client.web_apps.get_container_logs_zip( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_continuous_web_jobs(self, resource_group): + response = self.client.web_apps.list_continuous_web_jobs( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_continuous_web_job(self, resource_group): + response = self.client.web_apps.get_continuous_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_continuous_web_job(self, resource_group): + response = self.client.web_apps.delete_continuous_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_start_continuous_web_job(self, resource_group): + response = self.client.web_apps.start_continuous_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_stop_continuous_web_job(self, resource_group): + response = self.client.web_apps.stop_continuous_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_production_site_deployment_statuses(self, resource_group): + response = self.client.web_apps.list_production_site_deployment_statuses( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_get_production_site_deployment_status(self, resource_group): + response = self.client.web_apps.begin_get_production_site_deployment_status( + resource_group_name=resource_group.name, + name="str", + deployment_status_id="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_deployments(self, resource_group): + response = self.client.web_apps.list_deployments( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_deployment(self, resource_group): + response = self.client.web_apps.get_deployment( + resource_group_name=resource_group.name, + name="str", + id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_deployment(self, resource_group): + response = self.client.web_apps.create_deployment( + resource_group_name=resource_group.name, + name="str", + id="str", + deployment={ + "active": bool, + "author": "str", + "author_email": "str", + "deployer": "str", + "details": "str", + "end_time": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "message": "str", + "name": "str", + "start_time": "2020-02-20 00:00:00", + "status": 0, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_deployment(self, resource_group): + response = self.client.web_apps.delete_deployment( + resource_group_name=resource_group.name, + name="str", + id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_deployment_log(self, resource_group): + response = self.client.web_apps.list_deployment_log( + resource_group_name=resource_group.name, + name="str", + id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_discover_backup(self, resource_group): + response = self.client.web_apps.discover_backup( + resource_group_name=resource_group.name, + name="str", + request={ + "adjustConnectionStrings": bool, + "appServicePlan": "str", + "blobName": "str", + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "hostingEnvironment": "str", + "id": "str", + "ignoreConflictingHostNames": False, + "ignoreDatabases": False, + "kind": "str", + "name": "str", + "operationType": "Default", + "overwrite": bool, + "siteName": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_domain_ownership_identifiers(self, resource_group): + response = self.client.web_apps.list_domain_ownership_identifiers( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_domain_ownership_identifier(self, resource_group): + response = self.client.web_apps.get_domain_ownership_identifier( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_domain_ownership_identifier(self, resource_group): + response = self.client.web_apps.create_or_update_domain_ownership_identifier( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + domain_ownership_identifier={"id": "str", "kind": "str", "name": "str", "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_domain_ownership_identifier(self, resource_group): + response = self.client.web_apps.delete_domain_ownership_identifier( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_domain_ownership_identifier(self, resource_group): + response = self.client.web_apps.update_domain_ownership_identifier( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + domain_ownership_identifier={"id": "str", "kind": "str", "name": "str", "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_ms_deploy_status(self, resource_group): + response = self.client.web_apps.get_ms_deploy_status( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_ms_deploy_operation(self, resource_group): + response = self.client.web_apps.begin_create_ms_deploy_operation( + resource_group_name=resource_group.name, + name="str", + ms_deploy={ + "appOffline": bool, + "connectionString": "str", + "dbType": "str", + "id": "str", + "kind": "str", + "name": "str", + "packageUri": "str", + "setParameters": {"str": "str"}, + "setParametersXmlFileUri": "str", + "skipAppData": bool, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_ms_deploy_log(self, resource_group): + response = self.client.web_apps.get_ms_deploy_log( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_one_deploy_status(self, resource_group): + response = self.client.web_apps.get_one_deploy_status( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_one_deploy_operation(self, resource_group): + response = self.client.web_apps.create_one_deploy_operation( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_functions(self, resource_group): + response = self.client.web_apps.list_functions( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_functions_admin_token(self, resource_group): + response = self.client.web_apps.get_functions_admin_token( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_function(self, resource_group): + response = self.client.web_apps.get_function( + resource_group_name=resource_group.name, + name="str", + function_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_function(self, resource_group): + response = self.client.web_apps.begin_create_function( + resource_group_name=resource_group.name, + name="str", + function_name="str", + function_envelope={ + "config": {}, + "config_href": "str", + "files": {"str": "str"}, + "function_app_id": "str", + "href": "str", + "id": "str", + "invoke_url_template": "str", + "isDisabled": bool, + "kind": "str", + "language": "str", + "name": "str", + "script_href": "str", + "script_root_path_href": "str", + "secrets_file_href": "str", + "test_data": "str", + "test_data_href": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_function(self, resource_group): + response = self.client.web_apps.delete_function( + resource_group_name=resource_group.name, + name="str", + function_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_function_secret(self, resource_group): + response = self.client.web_apps.create_or_update_function_secret( + resource_group_name=resource_group.name, + name="str", + function_name="str", + key_name="str", + key={"name": "str", "value": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_function_secret(self, resource_group): + response = self.client.web_apps.delete_function_secret( + resource_group_name=resource_group.name, + name="str", + function_name="str", + key_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_function_keys(self, resource_group): + response = self.client.web_apps.list_function_keys( + resource_group_name=resource_group.name, + name="str", + function_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_function_secrets(self, resource_group): + response = self.client.web_apps.list_function_secrets( + resource_group_name=resource_group.name, + name="str", + function_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_host_keys(self, resource_group): + response = self.client.web_apps.list_host_keys( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_sync_status(self, resource_group): + response = self.client.web_apps.list_sync_status( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sync_functions(self, resource_group): + response = self.client.web_apps.sync_functions( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_host_secret(self, resource_group): + response = self.client.web_apps.create_or_update_host_secret( + resource_group_name=resource_group.name, + name="str", + key_type="str", + key_name="str", + key={"name": "str", "value": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_host_secret(self, resource_group): + response = self.client.web_apps.delete_host_secret( + resource_group_name=resource_group.name, + name="str", + key_type="str", + key_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_host_name_bindings(self, resource_group): + response = self.client.web_apps.list_host_name_bindings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_host_name_binding(self, resource_group): + response = self.client.web_apps.get_host_name_binding( + resource_group_name=resource_group.name, + name="str", + host_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_host_name_binding(self, resource_group): + response = self.client.web_apps.create_or_update_host_name_binding( + resource_group_name=resource_group.name, + name="str", + host_name="str", + host_name_binding={ + "azureResourceName": "str", + "azureResourceType": "str", + "customHostNameDnsRecordType": "str", + "domainId": "str", + "hostNameType": "str", + "id": "str", + "kind": "str", + "name": "str", + "siteName": "str", + "sslState": "str", + "thumbprint": "str", + "type": "str", + "virtualIP": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_host_name_binding(self, resource_group): + response = self.client.web_apps.delete_host_name_binding( + resource_group_name=resource_group.name, + name="str", + host_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_hybrid_connection(self, resource_group): + response = self.client.web_apps.get_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_hybrid_connection(self, resource_group): + response = self.client.web_apps.create_or_update_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + connection_envelope={ + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "relayArmUri": "str", + "relayName": "str", + "sendKeyName": "str", + "sendKeyValue": "str", + "serviceBusNamespace": "str", + "serviceBusSuffix": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_hybrid_connection(self, resource_group): + response = self.client.web_apps.delete_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_hybrid_connection(self, resource_group): + response = self.client.web_apps.update_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + connection_envelope={ + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "relayArmUri": "str", + "relayName": "str", + "sendKeyName": "str", + "sendKeyValue": "str", + "serviceBusNamespace": "str", + "serviceBusSuffix": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_hybrid_connections(self, resource_group): + response = self.client.web_apps.list_hybrid_connections( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_relay_service_connections(self, resource_group): + response = self.client.web_apps.list_relay_service_connections( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_relay_service_connection(self, resource_group): + response = self.client.web_apps.get_relay_service_connection( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_relay_service_connection(self, resource_group): + response = self.client.web_apps.create_or_update_relay_service_connection( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + connection_envelope={ + "biztalkUri": "str", + "entityConnectionString": "str", + "entityName": "str", + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "resourceConnectionString": "str", + "resourceType": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_relay_service_connection(self, resource_group): + response = self.client.web_apps.delete_relay_service_connection( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_relay_service_connection(self, resource_group): + response = self.client.web_apps.update_relay_service_connection( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + connection_envelope={ + "biztalkUri": "str", + "entityConnectionString": "str", + "entityName": "str", + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "resourceConnectionString": "str", + "resourceType": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_instance_identifiers(self, resource_group): + response = self.client.web_apps.list_instance_identifiers( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_info(self, resource_group): + response = self.client.web_apps.get_instance_info( + resource_group_name=resource_group.name, + name="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_ms_deploy_status(self, resource_group): + response = self.client.web_apps.get_instance_ms_deploy_status( + resource_group_name=resource_group.name, + name="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_instance_ms_deploy_operation(self, resource_group): + response = self.client.web_apps.begin_create_instance_ms_deploy_operation( + resource_group_name=resource_group.name, + name="str", + instance_id="str", + ms_deploy={ + "appOffline": bool, + "connectionString": "str", + "dbType": "str", + "id": "str", + "kind": "str", + "name": "str", + "packageUri": "str", + "setParameters": {"str": "str"}, + "setParametersXmlFileUri": "str", + "skipAppData": bool, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_ms_deploy_log(self, resource_group): + response = self.client.web_apps.get_instance_ms_deploy_log( + resource_group_name=resource_group.name, + name="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_instance_processes(self, resource_group): + response = self.client.web_apps.list_instance_processes( + resource_group_name=resource_group.name, + name="str", + instance_id="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_process(self, resource_group): + response = self.client.web_apps.get_instance_process( + resource_group_name=resource_group.name, + name="str", + process_id="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_instance_process(self, resource_group): + response = self.client.web_apps.delete_instance_process( + resource_group_name=resource_group.name, + name="str", + process_id="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_process_dump(self, resource_group): + response = self.client.web_apps.get_instance_process_dump( + resource_group_name=resource_group.name, + name="str", + process_id="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_instance_process_modules(self, resource_group): + response = self.client.web_apps.list_instance_process_modules( + resource_group_name=resource_group.name, + name="str", + process_id="str", + instance_id="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_process_module(self, resource_group): + response = self.client.web_apps.get_instance_process_module( + resource_group_name=resource_group.name, + name="str", + process_id="str", + base_address="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_instance_process_threads(self, resource_group): + response = self.client.web_apps.list_instance_process_threads( + resource_group_name=resource_group.name, + name="str", + process_id="str", + instance_id="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_is_cloneable(self, resource_group): + response = self.client.web_apps.is_cloneable( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_backups(self, resource_group): + response = self.client.web_apps.list_site_backups( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_sync_function_triggers(self, resource_group): + response = self.client.web_apps.list_sync_function_triggers( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_migrate_storage(self, resource_group): + response = self.client.web_apps.begin_migrate_storage( + subscription_name="str", + resource_group_name=resource_group.name, + name="str", + migration_options={ + "azurefilesConnectionString": "str", + "azurefilesShare": "str", + "blockWriteAccessToSite": False, + "id": "str", + "kind": "str", + "name": "str", + "switchSiteAfterMigration": False, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_migrate_my_sql(self, resource_group): + response = self.client.web_apps.begin_migrate_my_sql( + resource_group_name=resource_group.name, + name="str", + migration_request_envelope={ + "connectionString": "str", + "id": "str", + "kind": "str", + "migrationType": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_migrate_my_sql_status(self, resource_group): + response = self.client.web_apps.get_migrate_my_sql_status( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_swift_virtual_network_connection(self, resource_group): + response = self.client.web_apps.get_swift_virtual_network_connection( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_swift_virtual_network_connection_with_check(self, resource_group): + response = self.client.web_apps.create_or_update_swift_virtual_network_connection_with_check( + resource_group_name=resource_group.name, + name="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "subnetResourceId": "str", + "swiftSupported": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_swift_virtual_network(self, resource_group): + response = self.client.web_apps.delete_swift_virtual_network( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_swift_virtual_network_connection_with_check(self, resource_group): + response = self.client.web_apps.update_swift_virtual_network_connection_with_check( + resource_group_name=resource_group.name, + name="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "subnetResourceId": "str", + "swiftSupported": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_network_features(self, resource_group): + response = self.client.web_apps.list_network_features( + resource_group_name=resource_group.name, + name="str", + view="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_network_trace_operation(self, resource_group): + response = self.client.web_apps.get_network_trace_operation( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_start_web_site_network_trace(self, resource_group): + response = self.client.web_apps.start_web_site_network_trace( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start_web_site_network_trace_operation(self, resource_group): + response = self.client.web_apps.begin_start_web_site_network_trace_operation( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_stop_web_site_network_trace(self, resource_group): + response = self.client.web_apps.stop_web_site_network_trace( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_network_traces(self, resource_group): + response = self.client.web_apps.get_network_traces( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_network_trace_operation_v2(self, resource_group): + response = self.client.web_apps.get_network_trace_operation_v2( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_network_traces_v2(self, resource_group): + response = self.client.web_apps.get_network_traces_v2( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_generate_new_site_publishing_password(self, resource_group): + response = self.client.web_apps.generate_new_site_publishing_password( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_perf_mon_counters(self, resource_group): + response = self.client.web_apps.list_perf_mon_counters( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_php_error_log_flag(self, resource_group): + response = self.client.web_apps.get_site_php_error_log_flag( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_premier_add_ons(self, resource_group): + response = self.client.web_apps.list_premier_add_ons( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_premier_add_on(self, resource_group): + response = self.client.web_apps.get_premier_add_on( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_add_premier_add_on(self, resource_group): + response = self.client.web_apps.add_premier_add_on( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + premier_add_on={ + "location": "str", + "id": "str", + "kind": "str", + "marketplaceOffer": "str", + "marketplacePublisher": "str", + "name": "str", + "product": "str", + "sku": "str", + "tags": {"str": "str"}, + "type": "str", + "vendor": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_premier_add_on(self, resource_group): + response = self.client.web_apps.delete_premier_add_on( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_premier_add_on(self, resource_group): + response = self.client.web_apps.update_premier_add_on( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + premier_add_on={ + "id": "str", + "kind": "str", + "marketplaceOffer": "str", + "marketplacePublisher": "str", + "name": "str", + "product": "str", + "sku": "str", + "type": "str", + "vendor": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_access(self, resource_group): + response = self.client.web_apps.get_private_access( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_put_private_access_vnet(self, resource_group): + response = self.client.web_apps.put_private_access_vnet( + resource_group_name=resource_group.name, + name="str", + access={ + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "virtualNetworks": [ + {"key": 0, "name": "str", "resourceId": "str", "subnets": [{"key": 0, "name": "str"}]} + ], + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_endpoint_connection_list(self, resource_group): + response = self.client.web_apps.get_private_endpoint_connection_list( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_endpoint_connection(self, resource_group): + response = self.client.web_apps.get_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_approve_or_reject_private_endpoint_connection(self, resource_group): + response = self.client.web_apps.begin_approve_or_reject_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + private_endpoint_wrapper={ + "id": "str", + "ipAddresses": ["str"], + "kind": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_private_endpoint_connection(self, resource_group): + response = self.client.web_apps.begin_delete_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_link_resources(self, resource_group): + response = self.client.web_apps.get_private_link_resources( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_processes(self, resource_group): + response = self.client.web_apps.list_processes( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_process(self, resource_group): + response = self.client.web_apps.get_process( + resource_group_name=resource_group.name, + name="str", + process_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_process(self, resource_group): + response = self.client.web_apps.delete_process( + resource_group_name=resource_group.name, + name="str", + process_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_process_dump(self, resource_group): + response = self.client.web_apps.get_process_dump( + resource_group_name=resource_group.name, + name="str", + process_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_process_modules(self, resource_group): + response = self.client.web_apps.list_process_modules( + resource_group_name=resource_group.name, + name="str", + process_id="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_process_module(self, resource_group): + response = self.client.web_apps.get_process_module( + resource_group_name=resource_group.name, + name="str", + process_id="str", + base_address="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_process_threads(self, resource_group): + response = self.client.web_apps.list_process_threads( + resource_group_name=resource_group.name, + name="str", + process_id="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_public_certificates(self, resource_group): + response = self.client.web_apps.list_public_certificates( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_public_certificate(self, resource_group): + response = self.client.web_apps.get_public_certificate( + resource_group_name=resource_group.name, + name="str", + public_certificate_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_public_certificate(self, resource_group): + response = self.client.web_apps.create_or_update_public_certificate( + resource_group_name=resource_group.name, + name="str", + public_certificate_name="str", + public_certificate={ + "blob": bytes("bytes", encoding="utf-8"), + "id": "str", + "kind": "str", + "name": "str", + "publicCertificateLocation": "str", + "thumbprint": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_public_certificate(self, resource_group): + response = self.client.web_apps.delete_public_certificate( + resource_group_name=resource_group.name, + name="str", + public_certificate_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_publishing_profile_xml_with_secrets(self, resource_group): + response = self.client.web_apps.list_publishing_profile_xml_with_secrets( + resource_group_name=resource_group.name, + name="str", + publishing_profile_options={"format": "str", "includeDisasterRecoveryEndpoints": bool}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_reset_production_slot_config(self, resource_group): + response = self.client.web_apps.reset_production_slot_config( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restart(self, resource_group): + response = self.client.web_apps.restart( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restore_from_backup_blob(self, resource_group): + response = self.client.web_apps.begin_restore_from_backup_blob( + resource_group_name=resource_group.name, + name="str", + request={ + "adjustConnectionStrings": bool, + "appServicePlan": "str", + "blobName": "str", + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "hostingEnvironment": "str", + "id": "str", + "ignoreConflictingHostNames": False, + "ignoreDatabases": False, + "kind": "str", + "name": "str", + "operationType": "Default", + "overwrite": bool, + "siteName": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restore_from_deleted_app(self, resource_group): + response = self.client.web_apps.begin_restore_from_deleted_app( + resource_group_name=resource_group.name, + name="str", + restore_request={ + "deletedSiteId": "str", + "id": "str", + "kind": "str", + "name": "str", + "recoverConfiguration": bool, + "snapshotTime": "str", + "type": "str", + "useDRSecondary": bool, + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restore_snapshot(self, resource_group): + response = self.client.web_apps.begin_restore_snapshot( + resource_group_name=resource_group.name, + name="str", + restore_request={ + "id": "str", + "ignoreConflictingHostNames": bool, + "kind": "str", + "name": "str", + "overwrite": bool, + "recoverConfiguration": bool, + "recoverySource": {"id": "str", "location": "str"}, + "snapshotTime": "str", + "type": "str", + "useDRSecondary": bool, + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_containers(self, resource_group): + response = self.client.web_apps.list_site_containers( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_container(self, resource_group): + response = self.client.web_apps.get_site_container( + resource_group_name=resource_group.name, + name="str", + container_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_site_container(self, resource_group): + response = self.client.web_apps.create_or_update_site_container( + resource_group_name=resource_group.name, + name="str", + container_name="str", + request={ + "authType": "str", + "createdTime": "2020-02-20 00:00:00", + "environmentVariables": [{"name": "str", "value": "str"}], + "id": "str", + "image": "str", + "isMain": bool, + "kind": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "name": "str", + "passwordSecret": "str", + "startUpCommand": "str", + "targetPort": "str", + "type": "str", + "userManagedIdentityClientId": "str", + "userName": "str", + "volumeMounts": [ + {"containerMountPath": "str", "volumeSubPath": "str", "data": "str", "readOnly": bool} + ], + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_site_container(self, resource_group): + response = self.client.web_apps.delete_site_container( + resource_group_name=resource_group.name, + name="str", + container_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_extensions(self, resource_group): + response = self.client.web_apps.list_site_extensions( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_extension(self, resource_group): + response = self.client.web_apps.get_site_extension( + resource_group_name=resource_group.name, + name="str", + site_extension_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_install_site_extension(self, resource_group): + response = self.client.web_apps.begin_install_site_extension( + resource_group_name=resource_group.name, + name="str", + site_extension_id="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_site_extension(self, resource_group): + response = self.client.web_apps.delete_site_extension( + resource_group_name=resource_group.name, + name="str", + site_extension_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_slots(self, resource_group): + response = self.client.web_apps.list_slots( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_slot(self, resource_group): + response = self.client.web_apps.get_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update_slot(self, resource_group): + response = self.client.web_apps.begin_create_or_update_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_envelope={ + "location": "str", + "availabilityState": "str", + "clientAffinityEnabled": bool, + "clientCertEnabled": bool, + "clientCertExclusionPaths": "str", + "clientCertMode": "str", + "cloningInfo": { + "sourceWebAppId": "str", + "appSettingsOverrides": {"str": "str"}, + "cloneCustomHostNames": bool, + "cloneSourceControl": bool, + "configureLoadBalancing": bool, + "correlationId": "str", + "hostingEnvironment": "str", + "overwrite": bool, + "sourceWebAppLocation": "str", + "trafficManagerProfileId": "str", + "trafficManagerProfileName": "str", + }, + "containerSize": 0, + "customDomainVerificationId": "str", + "dailyMemoryTimeQuota": 0, + "daprConfig": { + "appId": "str", + "appPort": 0, + "enableApiLogging": bool, + "enabled": False, + "httpMaxRequestSize": 0, + "httpReadBufferSize": 0, + "logLevel": "str", + }, + "defaultHostName": "str", + "dnsConfiguration": { + "dnsAltServer": "str", + "dnsLegacySortOrder": bool, + "dnsMaxCacheTimeout": 0, + "dnsRetryAttemptCount": 0, + "dnsRetryAttemptTimeout": 0, + "dnsServers": ["str"], + }, + "enabled": bool, + "enabledHostNames": ["str"], + "extendedLocation": {"name": "str", "type": "str"}, + "functionAppConfig": { + "deployment": { + "storage": { + "authentication": { + "storageAccountConnectionStringName": "str", + "type": "str", + "userAssignedIdentityResourceId": "str", + }, + "type": "str", + "value": "str", + } + }, + "runtime": {"name": "str", "version": "str"}, + "scaleAndConcurrency": { + "alwaysReady": [{"instanceCount": 0, "name": "str"}], + "instanceMemoryMB": 0, + "maximumInstanceCount": 0, + "triggers": {"http": {"perInstanceConcurrency": 0}}, + }, + }, + "hostNameSslStates": [ + { + "hostType": "str", + "name": "str", + "sslState": "str", + "thumbprint": "str", + "toUpdate": bool, + "virtualIP": "str", + } + ], + "hostNames": ["str"], + "hostNamesDisabled": bool, + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "httpsOnly": bool, + "hyperV": False, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inProgressOperationId": "str", + "isDefaultContainer": bool, + "isXenon": False, + "keyVaultReferenceIdentity": "str", + "kind": "str", + "lastModifiedTimeUtc": "2020-02-20 00:00:00", + "managedEnvironmentId": "str", + "maxNumberOfWorkers": 0, + "name": "str", + "outboundIpAddresses": "str", + "possibleOutboundIpAddresses": "str", + "publicNetworkAccess": "str", + "redundancyMode": "str", + "repositorySiteName": "str", + "reserved": False, + "resourceConfig": {"cpu": 0.0, "memory": "str"}, + "resourceGroup": "str", + "scmSiteAlsoStopped": False, + "serverFarmId": "str", + "siteConfig": { + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [ + {"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"} + ], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + "slotSwapStatus": { + "destinationSlotName": "str", + "sourceSlotName": "str", + "timestampUtc": "2020-02-20 00:00:00", + }, + "state": "str", + "storageAccountRequired": bool, + "suspendedTill": "2020-02-20 00:00:00", + "tags": {"str": "str"}, + "targetSwapSlot": "str", + "trafficManagerHostNames": ["str"], + "type": "str", + "usageState": "str", + "virtualNetworkSubnetId": "str", + "vnetBackupRestoreEnabled": bool, + "vnetContentShareEnabled": bool, + "vnetImagePullEnabled": bool, + "vnetRouteAllEnabled": bool, + "workloadProfileName": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_slot(self, resource_group): + response = self.client.web_apps.delete_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_slot(self, resource_group): + response = self.client.web_apps.update_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_envelope={ + "availabilityState": "str", + "clientAffinityEnabled": bool, + "clientCertEnabled": bool, + "clientCertExclusionPaths": "str", + "clientCertMode": "str", + "cloningInfo": { + "sourceWebAppId": "str", + "appSettingsOverrides": {"str": "str"}, + "cloneCustomHostNames": bool, + "cloneSourceControl": bool, + "configureLoadBalancing": bool, + "correlationId": "str", + "hostingEnvironment": "str", + "overwrite": bool, + "sourceWebAppLocation": "str", + "trafficManagerProfileId": "str", + "trafficManagerProfileName": "str", + }, + "containerSize": 0, + "customDomainVerificationId": "str", + "dailyMemoryTimeQuota": 0, + "defaultHostName": "str", + "dnsConfiguration": { + "dnsAltServer": "str", + "dnsLegacySortOrder": bool, + "dnsMaxCacheTimeout": 0, + "dnsRetryAttemptCount": 0, + "dnsRetryAttemptTimeout": 0, + "dnsServers": ["str"], + }, + "enabled": bool, + "enabledHostNames": ["str"], + "hostNameSslStates": [ + { + "hostType": "str", + "name": "str", + "sslState": "str", + "thumbprint": "str", + "toUpdate": bool, + "virtualIP": "str", + } + ], + "hostNames": ["str"], + "hostNamesDisabled": bool, + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "httpsOnly": bool, + "hyperV": False, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inProgressOperationId": "str", + "isDefaultContainer": bool, + "isXenon": False, + "keyVaultReferenceIdentity": "str", + "kind": "str", + "lastModifiedTimeUtc": "2020-02-20 00:00:00", + "maxNumberOfWorkers": 0, + "name": "str", + "outboundIpAddresses": "str", + "possibleOutboundIpAddresses": "str", + "redundancyMode": "str", + "repositorySiteName": "str", + "reserved": False, + "resourceGroup": "str", + "scmSiteAlsoStopped": False, + "serverFarmId": "str", + "siteConfig": { + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [ + {"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"} + ], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + "slotSwapStatus": { + "destinationSlotName": "str", + "sourceSlotName": "str", + "timestampUtc": "2020-02-20 00:00:00", + }, + "state": "str", + "storageAccountRequired": bool, + "suspendedTill": "2020-02-20 00:00:00", + "targetSwapSlot": "str", + "trafficManagerHostNames": ["str"], + "type": "str", + "usageState": "str", + "virtualNetworkSubnetId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_analyze_custom_hostname_slot(self, resource_group): + response = self.client.web_apps.analyze_custom_hostname_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_apply_slot_configuration_slot(self, resource_group): + response = self.client.web_apps.apply_slot_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + slot_swap_entity={"preserveVnet": bool, "targetSlot": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_slot(self, resource_group): + response = self.client.web_apps.backup_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + request={ + "backupName": "str", + "backupSchedule": { + "frequencyInterval": 7, + "frequencyUnit": "Day", + "keepAtLeastOneBackup": True, + "retentionPeriodInDays": 30, + "lastExecutionTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + }, + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_backups_slot(self, resource_group): + response = self.client.web_apps.list_backups_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_backup_status_slot(self, resource_group): + response = self.client.web_apps.get_backup_status_slot( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_backup_slot(self, resource_group): + response = self.client.web_apps.delete_backup_slot( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_backup_status_secrets_slot(self, resource_group): + response = self.client.web_apps.list_backup_status_secrets_slot( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + slot="str", + request={ + "backupName": "str", + "backupSchedule": { + "frequencyInterval": 7, + "frequencyUnit": "Day", + "keepAtLeastOneBackup": True, + "retentionPeriodInDays": 30, + "lastExecutionTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + }, + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restore_slot(self, resource_group): + response = self.client.web_apps.begin_restore_slot( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + slot="str", + request={ + "adjustConnectionStrings": bool, + "appServicePlan": "str", + "blobName": "str", + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "hostingEnvironment": "str", + "id": "str", + "ignoreConflictingHostNames": False, + "ignoreDatabases": False, + "kind": "str", + "name": "str", + "operationType": "Default", + "overwrite": bool, + "siteName": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_basic_publishing_credentials_policies_slot(self, resource_group): + response = self.client.web_apps.list_basic_publishing_credentials_policies_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_ftp_allowed_slot(self, resource_group): + response = self.client.web_apps.get_ftp_allowed_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_ftp_allowed_slot(self, resource_group): + response = self.client.web_apps.update_ftp_allowed_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + csm_publishing_access_policies_entity={ + "allow": bool, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_scm_allowed_slot(self, resource_group): + response = self.client.web_apps.get_scm_allowed_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_scm_allowed_slot(self, resource_group): + response = self.client.web_apps.update_scm_allowed_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + csm_publishing_access_policies_entity={ + "allow": bool, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_configurations_slot(self, resource_group): + response = self.client.web_apps.list_configurations_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_application_settings_slot(self, resource_group): + response = self.client.web_apps.update_application_settings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + app_settings={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_application_settings_slot(self, resource_group): + response = self.client.web_apps.list_application_settings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_auth_settings_slot(self, resource_group): + response = self.client.web_apps.update_auth_settings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_auth_settings={ + "aadClaimsAuthorization": "str", + "additionalLoginParams": ["str"], + "allowedAudiences": ["str"], + "allowedExternalRedirectUrls": ["str"], + "authFilePath": "str", + "clientId": "str", + "clientSecret": "str", + "clientSecretCertificateThumbprint": "str", + "clientSecretSettingName": "str", + "configVersion": "str", + "defaultProvider": "str", + "enabled": bool, + "facebookAppId": "str", + "facebookAppSecret": "str", + "facebookAppSecretSettingName": "str", + "facebookOAuthScopes": ["str"], + "gitHubClientId": "str", + "gitHubClientSecret": "str", + "gitHubClientSecretSettingName": "str", + "gitHubOAuthScopes": ["str"], + "googleClientId": "str", + "googleClientSecret": "str", + "googleClientSecretSettingName": "str", + "googleOAuthScopes": ["str"], + "id": "str", + "isAuthFromFile": "str", + "issuer": "str", + "kind": "str", + "microsoftAccountClientId": "str", + "microsoftAccountClientSecret": "str", + "microsoftAccountClientSecretSettingName": "str", + "microsoftAccountOAuthScopes": ["str"], + "name": "str", + "runtimeVersion": "str", + "tokenRefreshExtensionHours": 0.0, + "tokenStoreEnabled": bool, + "twitterConsumerKey": "str", + "twitterConsumerSecret": "str", + "twitterConsumerSecretSettingName": "str", + "type": "str", + "unauthenticatedClientAction": "str", + "validateIssuer": bool, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_auth_settings_slot(self, resource_group): + response = self.client.web_apps.get_auth_settings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_auth_settings_v2_without_secrets_slot(self, resource_group): + response = self.client.web_apps.get_auth_settings_v2_without_secrets_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_auth_settings_v2_slot(self, resource_group): + response = self.client.web_apps.update_auth_settings_v2_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_auth_settings_v2={ + "globalValidation": { + "excludedPaths": ["str"], + "redirectToProvider": "str", + "requireAuthentication": bool, + "unauthenticatedClientAction": "str", + }, + "httpSettings": { + "forwardProxy": { + "convention": "str", + "customHostHeaderName": "str", + "customProtoHeaderName": "str", + }, + "requireHttps": bool, + "routes": {"apiPrefix": "str"}, + }, + "id": "str", + "identityProviders": { + "apple": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "azureActiveDirectory": { + "enabled": bool, + "isAutoProvisioned": bool, + "login": {"disableWWWAuthenticate": bool, "loginParameters": ["str"]}, + "registration": { + "clientId": "str", + "clientSecretCertificateIssuer": "str", + "clientSecretCertificateSubjectAlternativeName": "str", + "clientSecretCertificateThumbprint": "str", + "clientSecretSettingName": "str", + "openIdIssuer": "str", + }, + "validation": { + "allowedAudiences": ["str"], + "defaultAuthorizationPolicy": { + "allowedApplications": ["str"], + "allowedPrincipals": {"groups": ["str"], "identities": ["str"]}, + }, + "jwtClaimChecks": {"allowedClientApplications": ["str"], "allowedGroups": ["str"]}, + }, + }, + "azureStaticWebApps": {"enabled": bool, "registration": {"clientId": "str"}}, + "customOpenIdConnectProviders": { + "str": { + "enabled": bool, + "login": {"nameClaimType": "str", "scopes": ["str"]}, + "registration": { + "clientCredential": {"clientSecretSettingName": "str", "method": "ClientSecretPost"}, + "clientId": "str", + "openIdConnectConfiguration": { + "authorizationEndpoint": "str", + "certificationUri": "str", + "issuer": "str", + "tokenEndpoint": "str", + "wellKnownOpenIdConfiguration": "str", + }, + }, + } + }, + "facebook": { + "enabled": bool, + "graphApiVersion": "str", + "login": {"scopes": ["str"]}, + "registration": {"appId": "str", "appSecretSettingName": "str"}, + }, + "gitHub": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "google": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + "validation": {"allowedAudiences": ["str"]}, + }, + "legacyMicrosoftAccount": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + "validation": {"allowedAudiences": ["str"]}, + }, + "twitter": { + "enabled": bool, + "registration": {"consumerKey": "str", "consumerSecretSettingName": "str"}, + }, + }, + "kind": "str", + "login": { + "allowedExternalRedirectUrls": ["str"], + "cookieExpiration": {"convention": "str", "timeToExpiration": "str"}, + "nonce": {"nonceExpirationInterval": "str", "validateNonce": bool}, + "preserveUrlFragmentsForLogins": bool, + "routes": {"logoutEndpoint": "str"}, + "tokenStore": { + "azureBlobStorage": {"sasUrlSettingName": "str"}, + "enabled": bool, + "fileSystem": {"directory": "str"}, + "tokenRefreshExtensionHours": 0.0, + }, + }, + "name": "str", + "platform": {"configFilePath": "str", "enabled": bool, "runtimeVersion": "str"}, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_auth_settings_v2_slot(self, resource_group): + response = self.client.web_apps.get_auth_settings_v2_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_azure_storage_accounts_slot(self, resource_group): + response = self.client.web_apps.update_azure_storage_accounts_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + azure_storage_accounts={ + "id": "str", + "kind": "str", + "name": "str", + "properties": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_azure_storage_accounts_slot(self, resource_group): + response = self.client.web_apps.list_azure_storage_accounts_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_backup_configuration_slot(self, resource_group): + response = self.client.web_apps.update_backup_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + request={ + "backupName": "str", + "backupSchedule": { + "frequencyInterval": 7, + "frequencyUnit": "Day", + "keepAtLeastOneBackup": True, + "retentionPeriodInDays": 30, + "lastExecutionTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + }, + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_backup_configuration_slot(self, resource_group): + response = self.client.web_apps.delete_backup_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_backup_configuration_slot(self, resource_group): + response = self.client.web_apps.get_backup_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_app_settings_key_vault_references_slot(self, resource_group): + response = self.client.web_apps.get_app_settings_key_vault_references_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_app_setting_key_vault_reference_slot(self, resource_group): + response = self.client.web_apps.get_app_setting_key_vault_reference_slot( + resource_group_name=resource_group.name, + name="str", + app_setting_key="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_connection_string_key_vault_references_slot(self, resource_group): + response = self.client.web_apps.get_site_connection_string_key_vault_references_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_connection_string_key_vault_reference_slot(self, resource_group): + response = self.client.web_apps.get_site_connection_string_key_vault_reference_slot( + resource_group_name=resource_group.name, + name="str", + connection_string_key="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_connection_strings_slot(self, resource_group): + response = self.client.web_apps.update_connection_strings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + connection_strings={ + "id": "str", + "kind": "str", + "name": "str", + "properties": {"str": {"type": "str", "value": "str"}}, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_connection_strings_slot(self, resource_group): + response = self.client.web_apps.list_connection_strings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_diagnostic_logs_configuration_slot(self, resource_group): + response = self.client.web_apps.get_diagnostic_logs_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_diagnostic_logs_config_slot(self, resource_group): + response = self.client.web_apps.update_diagnostic_logs_config_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_logs_config={ + "applicationLogs": { + "azureBlobStorage": {"level": "str", "retentionInDays": 0, "sasUrl": "str"}, + "azureTableStorage": {"sasUrl": "str", "level": "str"}, + "fileSystem": {"level": "str"}, + }, + "detailedErrorMessages": {"enabled": bool}, + "failedRequestsTracing": {"enabled": bool}, + "httpLogs": { + "azureBlobStorage": {"enabled": bool, "retentionInDays": 0, "sasUrl": "str"}, + "fileSystem": {"enabled": bool, "retentionInDays": 0, "retentionInMb": 0}, + }, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_metadata_slot(self, resource_group): + response = self.client.web_apps.update_metadata_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + metadata={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_metadata_slot(self, resource_group): + response = self.client.web_apps.list_metadata_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_list_publishing_credentials_slot(self, resource_group): + response = self.client.web_apps.begin_list_publishing_credentials_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_site_push_settings_slot(self, resource_group): + response = self.client.web_apps.update_site_push_settings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + push_settings={ + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_push_settings_slot(self, resource_group): + response = self.client.web_apps.list_site_push_settings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_configuration_slot(self, resource_group): + response = self.client.web_apps.get_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_configuration_slot(self, resource_group): + response = self.client.web_apps.create_or_update_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_config={ + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [{"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"}], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "id": "str", + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "name": "str", + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "type": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_configuration_slot(self, resource_group): + response = self.client.web_apps.update_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_config={ + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [{"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"}], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "id": "str", + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "name": "str", + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "type": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_configuration_snapshot_info_slot(self, resource_group): + response = self.client.web_apps.list_configuration_snapshot_info_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_configuration_snapshot_slot(self, resource_group): + response = self.client.web_apps.get_configuration_snapshot_slot( + resource_group_name=resource_group.name, + name="str", + snapshot_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_recover_site_configuration_snapshot_slot(self, resource_group): + response = self.client.web_apps.recover_site_configuration_snapshot_slot( + resource_group_name=resource_group.name, + name="str", + snapshot_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_web_site_container_logs_slot(self, resource_group): + response = self.client.web_apps.get_web_site_container_logs_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_container_logs_zip_slot(self, resource_group): + response = self.client.web_apps.get_container_logs_zip_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_continuous_web_jobs_slot(self, resource_group): + response = self.client.web_apps.list_continuous_web_jobs_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_continuous_web_job_slot(self, resource_group): + response = self.client.web_apps.get_continuous_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_continuous_web_job_slot(self, resource_group): + response = self.client.web_apps.delete_continuous_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_start_continuous_web_job_slot(self, resource_group): + response = self.client.web_apps.start_continuous_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_stop_continuous_web_job_slot(self, resource_group): + response = self.client.web_apps.stop_continuous_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_slot_site_deployment_statuses_slot(self, resource_group): + response = self.client.web_apps.list_slot_site_deployment_statuses_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_get_slot_site_deployment_status_slot(self, resource_group): + response = self.client.web_apps.begin_get_slot_site_deployment_status_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + deployment_status_id="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_deployments_slot(self, resource_group): + response = self.client.web_apps.list_deployments_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_deployment_slot(self, resource_group): + response = self.client.web_apps.get_deployment_slot( + resource_group_name=resource_group.name, + name="str", + id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_deployment_slot(self, resource_group): + response = self.client.web_apps.create_deployment_slot( + resource_group_name=resource_group.name, + name="str", + id="str", + slot="str", + deployment={ + "active": bool, + "author": "str", + "author_email": "str", + "deployer": "str", + "details": "str", + "end_time": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "message": "str", + "name": "str", + "start_time": "2020-02-20 00:00:00", + "status": 0, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_deployment_slot(self, resource_group): + response = self.client.web_apps.delete_deployment_slot( + resource_group_name=resource_group.name, + name="str", + id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_deployment_log_slot(self, resource_group): + response = self.client.web_apps.list_deployment_log_slot( + resource_group_name=resource_group.name, + name="str", + id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_discover_backup_slot(self, resource_group): + response = self.client.web_apps.discover_backup_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + request={ + "adjustConnectionStrings": bool, + "appServicePlan": "str", + "blobName": "str", + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "hostingEnvironment": "str", + "id": "str", + "ignoreConflictingHostNames": False, + "ignoreDatabases": False, + "kind": "str", + "name": "str", + "operationType": "Default", + "overwrite": bool, + "siteName": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_domain_ownership_identifiers_slot(self, resource_group): + response = self.client.web_apps.list_domain_ownership_identifiers_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_domain_ownership_identifier_slot(self, resource_group): + response = self.client.web_apps.get_domain_ownership_identifier_slot( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_domain_ownership_identifier_slot(self, resource_group): + response = self.client.web_apps.create_or_update_domain_ownership_identifier_slot( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + slot="str", + domain_ownership_identifier={"id": "str", "kind": "str", "name": "str", "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_domain_ownership_identifier_slot(self, resource_group): + response = self.client.web_apps.delete_domain_ownership_identifier_slot( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_domain_ownership_identifier_slot(self, resource_group): + response = self.client.web_apps.update_domain_ownership_identifier_slot( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + slot="str", + domain_ownership_identifier={"id": "str", "kind": "str", "name": "str", "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_ms_deploy_status_slot(self, resource_group): + response = self.client.web_apps.get_ms_deploy_status_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_ms_deploy_operation_slot(self, resource_group): + response = self.client.web_apps.begin_create_ms_deploy_operation_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + ms_deploy={ + "appOffline": bool, + "connectionString": "str", + "dbType": "str", + "id": "str", + "kind": "str", + "name": "str", + "packageUri": "str", + "setParameters": {"str": "str"}, + "setParametersXmlFileUri": "str", + "skipAppData": bool, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_ms_deploy_log_slot(self, resource_group): + response = self.client.web_apps.get_ms_deploy_log_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_instance_functions_slot(self, resource_group): + response = self.client.web_apps.list_instance_functions_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_functions_admin_token_slot(self, resource_group): + response = self.client.web_apps.get_functions_admin_token_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_function_slot(self, resource_group): + response = self.client.web_apps.get_instance_function_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_instance_function_slot(self, resource_group): + response = self.client.web_apps.begin_create_instance_function_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + slot="str", + function_envelope={ + "config": {}, + "config_href": "str", + "files": {"str": "str"}, + "function_app_id": "str", + "href": "str", + "id": "str", + "invoke_url_template": "str", + "isDisabled": bool, + "kind": "str", + "language": "str", + "name": "str", + "script_href": "str", + "script_root_path_href": "str", + "secrets_file_href": "str", + "test_data": "str", + "test_data_href": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_instance_function_slot(self, resource_group): + response = self.client.web_apps.delete_instance_function_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_function_secret_slot(self, resource_group): + response = self.client.web_apps.create_or_update_function_secret_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + key_name="str", + slot="str", + key={"name": "str", "value": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_function_secret_slot(self, resource_group): + response = self.client.web_apps.delete_function_secret_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + key_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_function_keys_slot(self, resource_group): + response = self.client.web_apps.list_function_keys_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_function_secrets_slot(self, resource_group): + response = self.client.web_apps.list_function_secrets_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_host_keys_slot(self, resource_group): + response = self.client.web_apps.list_host_keys_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_sync_status_slot(self, resource_group): + response = self.client.web_apps.list_sync_status_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sync_functions_slot(self, resource_group): + response = self.client.web_apps.sync_functions_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_host_secret_slot(self, resource_group): + response = self.client.web_apps.create_or_update_host_secret_slot( + resource_group_name=resource_group.name, + name="str", + key_type="str", + key_name="str", + slot="str", + key={"name": "str", "value": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_host_secret_slot(self, resource_group): + response = self.client.web_apps.delete_host_secret_slot( + resource_group_name=resource_group.name, + name="str", + key_type="str", + key_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_host_name_bindings_slot(self, resource_group): + response = self.client.web_apps.list_host_name_bindings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_host_name_binding_slot(self, resource_group): + response = self.client.web_apps.get_host_name_binding_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + host_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_host_name_binding_slot(self, resource_group): + response = self.client.web_apps.create_or_update_host_name_binding_slot( + resource_group_name=resource_group.name, + name="str", + host_name="str", + slot="str", + host_name_binding={ + "azureResourceName": "str", + "azureResourceType": "str", + "customHostNameDnsRecordType": "str", + "domainId": "str", + "hostNameType": "str", + "id": "str", + "kind": "str", + "name": "str", + "siteName": "str", + "sslState": "str", + "thumbprint": "str", + "type": "str", + "virtualIP": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_host_name_binding_slot(self, resource_group): + response = self.client.web_apps.delete_host_name_binding_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + host_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_hybrid_connection_slot(self, resource_group): + response = self.client.web_apps.get_hybrid_connection_slot( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_hybrid_connection_slot(self, resource_group): + response = self.client.web_apps.create_or_update_hybrid_connection_slot( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + slot="str", + connection_envelope={ + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "relayArmUri": "str", + "relayName": "str", + "sendKeyName": "str", + "sendKeyValue": "str", + "serviceBusNamespace": "str", + "serviceBusSuffix": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_hybrid_connection_slot(self, resource_group): + response = self.client.web_apps.delete_hybrid_connection_slot( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_hybrid_connection_slot(self, resource_group): + response = self.client.web_apps.update_hybrid_connection_slot( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + slot="str", + connection_envelope={ + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "relayArmUri": "str", + "relayName": "str", + "sendKeyName": "str", + "sendKeyValue": "str", + "serviceBusNamespace": "str", + "serviceBusSuffix": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_hybrid_connections_slot(self, resource_group): + response = self.client.web_apps.list_hybrid_connections_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_relay_service_connections_slot(self, resource_group): + response = self.client.web_apps.list_relay_service_connections_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_relay_service_connection_slot(self, resource_group): + response = self.client.web_apps.get_relay_service_connection_slot( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_relay_service_connection_slot(self, resource_group): + response = self.client.web_apps.create_or_update_relay_service_connection_slot( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + slot="str", + connection_envelope={ + "biztalkUri": "str", + "entityConnectionString": "str", + "entityName": "str", + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "resourceConnectionString": "str", + "resourceType": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_relay_service_connection_slot(self, resource_group): + response = self.client.web_apps.delete_relay_service_connection_slot( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_relay_service_connection_slot(self, resource_group): + response = self.client.web_apps.update_relay_service_connection_slot( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + slot="str", + connection_envelope={ + "biztalkUri": "str", + "entityConnectionString": "str", + "entityName": "str", + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "resourceConnectionString": "str", + "resourceType": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_instance_identifiers_slot(self, resource_group): + response = self.client.web_apps.list_instance_identifiers_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_info_slot(self, resource_group): + response = self.client.web_apps.get_instance_info_slot( + resource_group_name=resource_group.name, + name="str", + instance_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_ms_deploy_status_slot(self, resource_group): + response = self.client.web_apps.get_instance_ms_deploy_status_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_instance_ms_deploy_operation_slot(self, resource_group): + response = self.client.web_apps.begin_create_instance_ms_deploy_operation_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + instance_id="str", + ms_deploy={ + "appOffline": bool, + "connectionString": "str", + "dbType": "str", + "id": "str", + "kind": "str", + "name": "str", + "packageUri": "str", + "setParameters": {"str": "str"}, + "setParametersXmlFileUri": "str", + "skipAppData": bool, + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_ms_deploy_log_slot(self, resource_group): + response = self.client.web_apps.get_instance_ms_deploy_log_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_instance_processes_slot(self, resource_group): + response = self.client.web_apps.list_instance_processes_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_process_slot(self, resource_group): + response = self.client.web_apps.get_instance_process_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_instance_process_slot(self, resource_group): + response = self.client.web_apps.delete_instance_process_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_process_dump_slot(self, resource_group): + response = self.client.web_apps.get_instance_process_dump_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_instance_process_modules_slot(self, resource_group): + response = self.client.web_apps.list_instance_process_modules_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_process_module_slot(self, resource_group): + response = self.client.web_apps.get_instance_process_module_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + base_address="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_instance_process_threads_slot(self, resource_group): + response = self.client.web_apps.list_instance_process_threads_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_is_cloneable_slot(self, resource_group): + response = self.client.web_apps.is_cloneable_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_backups_slot(self, resource_group): + response = self.client.web_apps.list_site_backups_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_sync_function_triggers_slot(self, resource_group): + response = self.client.web_apps.list_sync_function_triggers_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_migrate_my_sql_status_slot(self, resource_group): + response = self.client.web_apps.get_migrate_my_sql_status_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_swift_virtual_network_connection_slot(self, resource_group): + response = self.client.web_apps.get_swift_virtual_network_connection_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_swift_virtual_network_connection_with_check_slot(self, resource_group): + response = self.client.web_apps.create_or_update_swift_virtual_network_connection_with_check_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "subnetResourceId": "str", + "swiftSupported": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_swift_virtual_network_slot(self, resource_group): + response = self.client.web_apps.delete_swift_virtual_network_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_swift_virtual_network_connection_with_check_slot(self, resource_group): + response = self.client.web_apps.update_swift_virtual_network_connection_with_check_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "subnetResourceId": "str", + "swiftSupported": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_network_features_slot(self, resource_group): + response = self.client.web_apps.list_network_features_slot( + resource_group_name=resource_group.name, + name="str", + view="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_network_trace_operation_slot(self, resource_group): + response = self.client.web_apps.get_network_trace_operation_slot( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_start_web_site_network_trace_slot(self, resource_group): + response = self.client.web_apps.start_web_site_network_trace_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start_web_site_network_trace_operation_slot(self, resource_group): + response = self.client.web_apps.begin_start_web_site_network_trace_operation_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_stop_web_site_network_trace_slot(self, resource_group): + response = self.client.web_apps.stop_web_site_network_trace_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_network_traces_slot(self, resource_group): + response = self.client.web_apps.get_network_traces_slot( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_network_trace_operation_slot_v2(self, resource_group): + response = self.client.web_apps.get_network_trace_operation_slot_v2( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_network_traces_slot_v2(self, resource_group): + response = self.client.web_apps.get_network_traces_slot_v2( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_generate_new_site_publishing_password_slot(self, resource_group): + response = self.client.web_apps.generate_new_site_publishing_password_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_perf_mon_counters_slot(self, resource_group): + response = self.client.web_apps.list_perf_mon_counters_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_php_error_log_flag_slot(self, resource_group): + response = self.client.web_apps.get_site_php_error_log_flag_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_premier_add_ons_slot(self, resource_group): + response = self.client.web_apps.list_premier_add_ons_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_premier_add_on_slot(self, resource_group): + response = self.client.web_apps.get_premier_add_on_slot( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_add_premier_add_on_slot(self, resource_group): + response = self.client.web_apps.add_premier_add_on_slot( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + slot="str", + premier_add_on={ + "location": "str", + "id": "str", + "kind": "str", + "marketplaceOffer": "str", + "marketplacePublisher": "str", + "name": "str", + "product": "str", + "sku": "str", + "tags": {"str": "str"}, + "type": "str", + "vendor": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_premier_add_on_slot(self, resource_group): + response = self.client.web_apps.delete_premier_add_on_slot( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_premier_add_on_slot(self, resource_group): + response = self.client.web_apps.update_premier_add_on_slot( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + slot="str", + premier_add_on={ + "id": "str", + "kind": "str", + "marketplaceOffer": "str", + "marketplacePublisher": "str", + "name": "str", + "product": "str", + "sku": "str", + "type": "str", + "vendor": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_access_slot(self, resource_group): + response = self.client.web_apps.get_private_access_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_put_private_access_vnet_slot(self, resource_group): + response = self.client.web_apps.put_private_access_vnet_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + access={ + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "virtualNetworks": [ + {"key": 0, "name": "str", "resourceId": "str", "subnets": [{"key": 0, "name": "str"}]} + ], + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_endpoint_connection_list_slot(self, resource_group): + response = self.client.web_apps.get_private_endpoint_connection_list_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_endpoint_connection_slot(self, resource_group): + response = self.client.web_apps.get_private_endpoint_connection_slot( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_approve_or_reject_private_endpoint_connection_slot(self, resource_group): + response = self.client.web_apps.begin_approve_or_reject_private_endpoint_connection_slot( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + slot="str", + private_endpoint_wrapper={ + "id": "str", + "ipAddresses": ["str"], + "kind": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_private_endpoint_connection_slot(self, resource_group): + response = self.client.web_apps.begin_delete_private_endpoint_connection_slot( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + slot="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_private_link_resources_slot(self, resource_group): + response = self.client.web_apps.get_private_link_resources_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_processes_slot(self, resource_group): + response = self.client.web_apps.list_processes_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_process_slot(self, resource_group): + response = self.client.web_apps.get_process_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_process_slot(self, resource_group): + response = self.client.web_apps.delete_process_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_process_dump_slot(self, resource_group): + response = self.client.web_apps.get_process_dump_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_process_modules_slot(self, resource_group): + response = self.client.web_apps.list_process_modules_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_process_module_slot(self, resource_group): + response = self.client.web_apps.get_process_module_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + base_address="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_process_threads_slot(self, resource_group): + response = self.client.web_apps.list_process_threads_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_public_certificates_slot(self, resource_group): + response = self.client.web_apps.list_public_certificates_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_public_certificate_slot(self, resource_group): + response = self.client.web_apps.get_public_certificate_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + public_certificate_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_public_certificate_slot(self, resource_group): + response = self.client.web_apps.create_or_update_public_certificate_slot( + resource_group_name=resource_group.name, + name="str", + public_certificate_name="str", + slot="str", + public_certificate={ + "blob": bytes("bytes", encoding="utf-8"), + "id": "str", + "kind": "str", + "name": "str", + "publicCertificateLocation": "str", + "thumbprint": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_public_certificate_slot(self, resource_group): + response = self.client.web_apps.delete_public_certificate_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + public_certificate_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_publishing_profile_xml_with_secrets_slot(self, resource_group): + response = self.client.web_apps.list_publishing_profile_xml_with_secrets_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + publishing_profile_options={"format": "str", "includeDisasterRecoveryEndpoints": bool}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_reset_slot_configuration_slot(self, resource_group): + response = self.client.web_apps.reset_slot_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restart_slot(self, resource_group): + response = self.client.web_apps.restart_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restore_from_backup_blob_slot(self, resource_group): + response = self.client.web_apps.begin_restore_from_backup_blob_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + request={ + "adjustConnectionStrings": bool, + "appServicePlan": "str", + "blobName": "str", + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "hostingEnvironment": "str", + "id": "str", + "ignoreConflictingHostNames": False, + "ignoreDatabases": False, + "kind": "str", + "name": "str", + "operationType": "Default", + "overwrite": bool, + "siteName": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restore_from_deleted_app_slot(self, resource_group): + response = self.client.web_apps.begin_restore_from_deleted_app_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + restore_request={ + "deletedSiteId": "str", + "id": "str", + "kind": "str", + "name": "str", + "recoverConfiguration": bool, + "snapshotTime": "str", + "type": "str", + "useDRSecondary": bool, + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restore_snapshot_slot(self, resource_group): + response = self.client.web_apps.begin_restore_snapshot_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + restore_request={ + "id": "str", + "ignoreConflictingHostNames": bool, + "kind": "str", + "name": "str", + "overwrite": bool, + "recoverConfiguration": bool, + "recoverySource": {"id": "str", "location": "str"}, + "snapshotTime": "str", + "type": "str", + "useDRSecondary": bool, + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_containers_slot(self, resource_group): + response = self.client.web_apps.list_site_containers_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_container_slot(self, resource_group): + response = self.client.web_apps.get_site_container_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + container_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_site_container_slot(self, resource_group): + response = self.client.web_apps.create_or_update_site_container_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + container_name="str", + request={ + "authType": "str", + "createdTime": "2020-02-20 00:00:00", + "environmentVariables": [{"name": "str", "value": "str"}], + "id": "str", + "image": "str", + "isMain": bool, + "kind": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "name": "str", + "passwordSecret": "str", + "startUpCommand": "str", + "targetPort": "str", + "type": "str", + "userManagedIdentityClientId": "str", + "userName": "str", + "volumeMounts": [ + {"containerMountPath": "str", "volumeSubPath": "str", "data": "str", "readOnly": bool} + ], + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_site_container_slot(self, resource_group): + response = self.client.web_apps.delete_site_container_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + container_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_site_extensions_slot(self, resource_group): + response = self.client.web_apps.list_site_extensions_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_site_extension_slot(self, resource_group): + response = self.client.web_apps.get_site_extension_slot( + resource_group_name=resource_group.name, + name="str", + site_extension_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_install_site_extension_slot(self, resource_group): + response = self.client.web_apps.begin_install_site_extension_slot( + resource_group_name=resource_group.name, + name="str", + site_extension_id="str", + slot="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_site_extension_slot(self, resource_group): + response = self.client.web_apps.delete_site_extension_slot( + resource_group_name=resource_group.name, + name="str", + site_extension_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_slot_differences_slot(self, resource_group): + response = self.client.web_apps.list_slot_differences_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + slot_swap_entity={"preserveVnet": bool, "targetSlot": "str"}, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_swap_slot(self, resource_group): + response = self.client.web_apps.begin_swap_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + slot_swap_entity={"preserveVnet": bool, "targetSlot": "str"}, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_snapshots_slot(self, resource_group): + response = self.client.web_apps.list_snapshots_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_snapshots_from_dr_secondary_slot(self, resource_group): + response = self.client.web_apps.list_snapshots_from_dr_secondary_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_source_control_slot(self, resource_group): + response = self.client.web_apps.get_source_control_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update_source_control_slot(self, resource_group): + response = self.client.web_apps.begin_create_or_update_source_control_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_source_control={ + "branch": "str", + "deploymentRollbackEnabled": bool, + "gitHubActionConfiguration": { + "codeConfiguration": {"runtimeStack": "str", "runtimeVersion": "str"}, + "containerConfiguration": { + "imageName": "str", + "password": "str", + "serverUrl": "str", + "username": "str", + }, + "generateWorkflowFile": bool, + "isLinux": bool, + }, + "id": "str", + "isGitHubAction": bool, + "isManualIntegration": bool, + "isMercurial": bool, + "kind": "str", + "name": "str", + "repoUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_source_control_slot(self, resource_group): + response = self.client.web_apps.delete_source_control_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_source_control_slot(self, resource_group): + response = self.client.web_apps.update_source_control_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_source_control={ + "branch": "str", + "deploymentRollbackEnabled": bool, + "gitHubActionConfiguration": { + "codeConfiguration": {"runtimeStack": "str", "runtimeVersion": "str"}, + "containerConfiguration": { + "imageName": "str", + "password": "str", + "serverUrl": "str", + "username": "str", + }, + "generateWorkflowFile": bool, + "isLinux": bool, + }, + "id": "str", + "isGitHubAction": bool, + "isManualIntegration": bool, + "isMercurial": bool, + "kind": "str", + "name": "str", + "repoUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_start_slot(self, resource_group): + response = self.client.web_apps.start_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start_network_trace_slot(self, resource_group): + response = self.client.web_apps.begin_start_network_trace_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_stop_slot(self, resource_group): + response = self.client.web_apps.stop_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_stop_network_trace_slot(self, resource_group): + response = self.client.web_apps.stop_network_trace_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sync_repository_slot(self, resource_group): + response = self.client.web_apps.sync_repository_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sync_function_triggers_slot(self, resource_group): + response = self.client.web_apps.sync_function_triggers_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_triggered_web_jobs_slot(self, resource_group): + response = self.client.web_apps.list_triggered_web_jobs_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_triggered_web_job_slot(self, resource_group): + response = self.client.web_apps.get_triggered_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_triggered_web_job_slot(self, resource_group): + response = self.client.web_apps.delete_triggered_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_triggered_web_job_history_slot(self, resource_group): + response = self.client.web_apps.list_triggered_web_job_history_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_triggered_web_job_history_slot(self, resource_group): + response = self.client.web_apps.get_triggered_web_job_history_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_run_triggered_web_job_slot(self, resource_group): + response = self.client.web_apps.run_triggered_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_usages_slot(self, resource_group): + response = self.client.web_apps.list_usages_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_vnet_connections_slot(self, resource_group): + response = self.client.web_apps.list_vnet_connections_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_vnet_connection_slot(self, resource_group): + response = self.client.web_apps.get_vnet_connection_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_vnet_connection_slot(self, resource_group): + response = self.client.web_apps.create_or_update_vnet_connection_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + slot="str", + connection_envelope={ + "certBlob": "str", + "certThumbprint": "str", + "dnsServers": "str", + "id": "str", + "isSwift": bool, + "kind": "str", + "name": "str", + "resyncRequired": bool, + "routes": [ + { + "endAddress": "str", + "id": "str", + "kind": "str", + "name": "str", + "routeType": "str", + "startAddress": "str", + "type": "str", + } + ], + "type": "str", + "vnetResourceId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_vnet_connection_slot(self, resource_group): + response = self.client.web_apps.delete_vnet_connection_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_vnet_connection_slot(self, resource_group): + response = self.client.web_apps.update_vnet_connection_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + slot="str", + connection_envelope={ + "certBlob": "str", + "certThumbprint": "str", + "dnsServers": "str", + "id": "str", + "isSwift": bool, + "kind": "str", + "name": "str", + "resyncRequired": bool, + "routes": [ + { + "endAddress": "str", + "id": "str", + "kind": "str", + "name": "str", + "routeType": "str", + "startAddress": "str", + "type": "str", + } + ], + "type": "str", + "vnetResourceId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_vnet_connection_gateway_slot(self, resource_group): + response = self.client.web_apps.get_vnet_connection_gateway_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_vnet_connection_gateway_slot(self, resource_group): + response = self.client.web_apps.create_or_update_vnet_connection_gateway_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + slot="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "vnetName": "str", + "vpnPackageUri": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_vnet_connection_gateway_slot(self, resource_group): + response = self.client.web_apps.update_vnet_connection_gateway_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + slot="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "vnetName": "str", + "vpnPackageUri": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_web_jobs_slot(self, resource_group): + response = self.client.web_apps.list_web_jobs_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_web_job_slot(self, resource_group): + response = self.client.web_apps.get_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_slot_differences_from_production(self, resource_group): + response = self.client.web_apps.list_slot_differences_from_production( + resource_group_name=resource_group.name, + name="str", + slot_swap_entity={"preserveVnet": bool, "targetSlot": "str"}, + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_swap_slot_with_production(self, resource_group): + response = self.client.web_apps.begin_swap_slot_with_production( + resource_group_name=resource_group.name, + name="str", + slot_swap_entity={"preserveVnet": bool, "targetSlot": "str"}, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_snapshots(self, resource_group): + response = self.client.web_apps.list_snapshots( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_snapshots_from_dr_secondary(self, resource_group): + response = self.client.web_apps.list_snapshots_from_dr_secondary( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_source_control(self, resource_group): + response = self.client.web_apps.get_source_control( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update_source_control(self, resource_group): + response = self.client.web_apps.begin_create_or_update_source_control( + resource_group_name=resource_group.name, + name="str", + site_source_control={ + "branch": "str", + "deploymentRollbackEnabled": bool, + "gitHubActionConfiguration": { + "codeConfiguration": {"runtimeStack": "str", "runtimeVersion": "str"}, + "containerConfiguration": { + "imageName": "str", + "password": "str", + "serverUrl": "str", + "username": "str", + }, + "generateWorkflowFile": bool, + "isLinux": bool, + }, + "id": "str", + "isGitHubAction": bool, + "isManualIntegration": bool, + "isMercurial": bool, + "kind": "str", + "name": "str", + "repoUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_source_control(self, resource_group): + response = self.client.web_apps.delete_source_control( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_source_control(self, resource_group): + response = self.client.web_apps.update_source_control( + resource_group_name=resource_group.name, + name="str", + site_source_control={ + "branch": "str", + "deploymentRollbackEnabled": bool, + "gitHubActionConfiguration": { + "codeConfiguration": {"runtimeStack": "str", "runtimeVersion": "str"}, + "containerConfiguration": { + "imageName": "str", + "password": "str", + "serverUrl": "str", + "username": "str", + }, + "generateWorkflowFile": bool, + "isLinux": bool, + }, + "id": "str", + "isGitHubAction": bool, + "isManualIntegration": bool, + "isMercurial": bool, + "kind": "str", + "name": "str", + "repoUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_start(self, resource_group): + response = self.client.web_apps.start( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start_network_trace(self, resource_group): + response = self.client.web_apps.begin_start_network_trace( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_stop(self, resource_group): + response = self.client.web_apps.stop( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_stop_network_trace(self, resource_group): + response = self.client.web_apps.stop_network_trace( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sync_repository(self, resource_group): + response = self.client.web_apps.sync_repository( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sync_function_triggers(self, resource_group): + response = self.client.web_apps.sync_function_triggers( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_triggered_web_jobs(self, resource_group): + response = self.client.web_apps.list_triggered_web_jobs( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_triggered_web_job(self, resource_group): + response = self.client.web_apps.get_triggered_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_triggered_web_job(self, resource_group): + response = self.client.web_apps.delete_triggered_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_triggered_web_job_history(self, resource_group): + response = self.client.web_apps.list_triggered_web_job_history( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_triggered_web_job_history(self, resource_group): + response = self.client.web_apps.get_triggered_web_job_history( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_run_triggered_web_job(self, resource_group): + response = self.client.web_apps.run_triggered_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_usages(self, resource_group): + response = self.client.web_apps.list_usages( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_vnet_connections(self, resource_group): + response = self.client.web_apps.list_vnet_connections( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_vnet_connection(self, resource_group): + response = self.client.web_apps.get_vnet_connection( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_vnet_connection(self, resource_group): + response = self.client.web_apps.create_or_update_vnet_connection( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + connection_envelope={ + "certBlob": "str", + "certThumbprint": "str", + "dnsServers": "str", + "id": "str", + "isSwift": bool, + "kind": "str", + "name": "str", + "resyncRequired": bool, + "routes": [ + { + "endAddress": "str", + "id": "str", + "kind": "str", + "name": "str", + "routeType": "str", + "startAddress": "str", + "type": "str", + } + ], + "type": "str", + "vnetResourceId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete_vnet_connection(self, resource_group): + response = self.client.web_apps.delete_vnet_connection( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_vnet_connection(self, resource_group): + response = self.client.web_apps.update_vnet_connection( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + connection_envelope={ + "certBlob": "str", + "certThumbprint": "str", + "dnsServers": "str", + "id": "str", + "isSwift": bool, + "kind": "str", + "name": "str", + "resyncRequired": bool, + "routes": [ + { + "endAddress": "str", + "id": "str", + "kind": "str", + "name": "str", + "routeType": "str", + "startAddress": "str", + "type": "str", + } + ], + "type": "str", + "vnetResourceId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_vnet_connection_gateway(self, resource_group): + response = self.client.web_apps.get_vnet_connection_gateway( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update_vnet_connection_gateway(self, resource_group): + response = self.client.web_apps.create_or_update_vnet_connection_gateway( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "vnetName": "str", + "vpnPackageUri": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_vnet_connection_gateway(self, resource_group): + response = self.client.web_apps.update_vnet_connection_gateway( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "vnetName": "str", + "vpnPackageUri": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_web_jobs(self, resource_group): + response = self.client.web_apps.list_web_jobs( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_web_job(self, resource_group): + response = self.client.web_apps.get_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deploy_workflow_artifacts(self, resource_group): + response = self.client.web_apps.deploy_workflow_artifacts( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deploy_workflow_artifacts_slot(self, resource_group): + response = self.client.web_apps.deploy_workflow_artifacts_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_instance_workflows_slot(self, resource_group): + response = self.client.web_apps.list_instance_workflows_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_instance_workflow_slot(self, resource_group): + response = self.client.web_apps.get_instance_workflow_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + workflow_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_workflows_connections_slot(self, resource_group): + response = self.client.web_apps.list_workflows_connections_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_workflows(self, resource_group): + response = self.client.web_apps.list_workflows( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_workflow(self, resource_group): + response = self.client.web_apps.get_workflow( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_workflows_connections(self, resource_group): + response = self.client.web_apps.list_workflows_connections( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_web_apps_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_web_apps_operations_async.py new file mode 100644 index 0000000000000..2b0bff7555986 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_web_apps_operations_async.py @@ -0,0 +1,8730 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWebAppsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.web_apps.list( + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.web_apps.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.web_apps.get( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.web_apps.begin_create_or_update( + resource_group_name=resource_group.name, + name="str", + site_envelope={ + "location": "str", + "availabilityState": "str", + "clientAffinityEnabled": bool, + "clientCertEnabled": bool, + "clientCertExclusionPaths": "str", + "clientCertMode": "str", + "cloningInfo": { + "sourceWebAppId": "str", + "appSettingsOverrides": {"str": "str"}, + "cloneCustomHostNames": bool, + "cloneSourceControl": bool, + "configureLoadBalancing": bool, + "correlationId": "str", + "hostingEnvironment": "str", + "overwrite": bool, + "sourceWebAppLocation": "str", + "trafficManagerProfileId": "str", + "trafficManagerProfileName": "str", + }, + "containerSize": 0, + "customDomainVerificationId": "str", + "dailyMemoryTimeQuota": 0, + "daprConfig": { + "appId": "str", + "appPort": 0, + "enableApiLogging": bool, + "enabled": False, + "httpMaxRequestSize": 0, + "httpReadBufferSize": 0, + "logLevel": "str", + }, + "defaultHostName": "str", + "dnsConfiguration": { + "dnsAltServer": "str", + "dnsLegacySortOrder": bool, + "dnsMaxCacheTimeout": 0, + "dnsRetryAttemptCount": 0, + "dnsRetryAttemptTimeout": 0, + "dnsServers": ["str"], + }, + "enabled": bool, + "enabledHostNames": ["str"], + "extendedLocation": {"name": "str", "type": "str"}, + "functionAppConfig": { + "deployment": { + "storage": { + "authentication": { + "storageAccountConnectionStringName": "str", + "type": "str", + "userAssignedIdentityResourceId": "str", + }, + "type": "str", + "value": "str", + } + }, + "runtime": {"name": "str", "version": "str"}, + "scaleAndConcurrency": { + "alwaysReady": [{"instanceCount": 0, "name": "str"}], + "instanceMemoryMB": 0, + "maximumInstanceCount": 0, + "triggers": {"http": {"perInstanceConcurrency": 0}}, + }, + }, + "hostNameSslStates": [ + { + "hostType": "str", + "name": "str", + "sslState": "str", + "thumbprint": "str", + "toUpdate": bool, + "virtualIP": "str", + } + ], + "hostNames": ["str"], + "hostNamesDisabled": bool, + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "httpsOnly": bool, + "hyperV": False, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inProgressOperationId": "str", + "isDefaultContainer": bool, + "isXenon": False, + "keyVaultReferenceIdentity": "str", + "kind": "str", + "lastModifiedTimeUtc": "2020-02-20 00:00:00", + "managedEnvironmentId": "str", + "maxNumberOfWorkers": 0, + "name": "str", + "outboundIpAddresses": "str", + "possibleOutboundIpAddresses": "str", + "publicNetworkAccess": "str", + "redundancyMode": "str", + "repositorySiteName": "str", + "reserved": False, + "resourceConfig": {"cpu": 0.0, "memory": "str"}, + "resourceGroup": "str", + "scmSiteAlsoStopped": False, + "serverFarmId": "str", + "siteConfig": { + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [ + {"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"} + ], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + "slotSwapStatus": { + "destinationSlotName": "str", + "sourceSlotName": "str", + "timestampUtc": "2020-02-20 00:00:00", + }, + "state": "str", + "storageAccountRequired": bool, + "suspendedTill": "2020-02-20 00:00:00", + "tags": {"str": "str"}, + "targetSwapSlot": "str", + "trafficManagerHostNames": ["str"], + "type": "str", + "usageState": "str", + "virtualNetworkSubnetId": "str", + "vnetBackupRestoreEnabled": bool, + "vnetContentShareEnabled": bool, + "vnetImagePullEnabled": bool, + "vnetRouteAllEnabled": bool, + "workloadProfileName": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.web_apps.delete( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.web_apps.update( + resource_group_name=resource_group.name, + name="str", + site_envelope={ + "availabilityState": "str", + "clientAffinityEnabled": bool, + "clientCertEnabled": bool, + "clientCertExclusionPaths": "str", + "clientCertMode": "str", + "cloningInfo": { + "sourceWebAppId": "str", + "appSettingsOverrides": {"str": "str"}, + "cloneCustomHostNames": bool, + "cloneSourceControl": bool, + "configureLoadBalancing": bool, + "correlationId": "str", + "hostingEnvironment": "str", + "overwrite": bool, + "sourceWebAppLocation": "str", + "trafficManagerProfileId": "str", + "trafficManagerProfileName": "str", + }, + "containerSize": 0, + "customDomainVerificationId": "str", + "dailyMemoryTimeQuota": 0, + "defaultHostName": "str", + "dnsConfiguration": { + "dnsAltServer": "str", + "dnsLegacySortOrder": bool, + "dnsMaxCacheTimeout": 0, + "dnsRetryAttemptCount": 0, + "dnsRetryAttemptTimeout": 0, + "dnsServers": ["str"], + }, + "enabled": bool, + "enabledHostNames": ["str"], + "hostNameSslStates": [ + { + "hostType": "str", + "name": "str", + "sslState": "str", + "thumbprint": "str", + "toUpdate": bool, + "virtualIP": "str", + } + ], + "hostNames": ["str"], + "hostNamesDisabled": bool, + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "httpsOnly": bool, + "hyperV": False, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inProgressOperationId": "str", + "isDefaultContainer": bool, + "isXenon": False, + "keyVaultReferenceIdentity": "str", + "kind": "str", + "lastModifiedTimeUtc": "2020-02-20 00:00:00", + "maxNumberOfWorkers": 0, + "name": "str", + "outboundIpAddresses": "str", + "possibleOutboundIpAddresses": "str", + "redundancyMode": "str", + "repositorySiteName": "str", + "reserved": False, + "resourceGroup": "str", + "scmSiteAlsoStopped": False, + "serverFarmId": "str", + "siteConfig": { + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [ + {"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"} + ], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + "slotSwapStatus": { + "destinationSlotName": "str", + "sourceSlotName": "str", + "timestampUtc": "2020-02-20 00:00:00", + }, + "state": "str", + "storageAccountRequired": bool, + "suspendedTill": "2020-02-20 00:00:00", + "targetSwapSlot": "str", + "trafficManagerHostNames": ["str"], + "type": "str", + "usageState": "str", + "virtualNetworkSubnetId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_analyze_custom_hostname(self, resource_group): + response = await self.client.web_apps.analyze_custom_hostname( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_apply_slot_config_to_production(self, resource_group): + response = await self.client.web_apps.apply_slot_config_to_production( + resource_group_name=resource_group.name, + name="str", + slot_swap_entity={"preserveVnet": bool, "targetSlot": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup(self, resource_group): + response = await self.client.web_apps.backup( + resource_group_name=resource_group.name, + name="str", + request={ + "backupName": "str", + "backupSchedule": { + "frequencyInterval": 7, + "frequencyUnit": "Day", + "keepAtLeastOneBackup": True, + "retentionPeriodInDays": 30, + "lastExecutionTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + }, + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_backups(self, resource_group): + response = self.client.web_apps.list_backups( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_backup_status(self, resource_group): + response = await self.client.web_apps.get_backup_status( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_backup(self, resource_group): + response = await self.client.web_apps.delete_backup( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_backup_status_secrets(self, resource_group): + response = await self.client.web_apps.list_backup_status_secrets( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + request={ + "backupName": "str", + "backupSchedule": { + "frequencyInterval": 7, + "frequencyUnit": "Day", + "keepAtLeastOneBackup": True, + "retentionPeriodInDays": 30, + "lastExecutionTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + }, + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restore(self, resource_group): + response = await ( + await self.client.web_apps.begin_restore( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + request={ + "adjustConnectionStrings": bool, + "appServicePlan": "str", + "blobName": "str", + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "hostingEnvironment": "str", + "id": "str", + "ignoreConflictingHostNames": False, + "ignoreDatabases": False, + "kind": "str", + "name": "str", + "operationType": "Default", + "overwrite": bool, + "siteName": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_basic_publishing_credentials_policies(self, resource_group): + response = self.client.web_apps.list_basic_publishing_credentials_policies( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_ftp_allowed(self, resource_group): + response = await self.client.web_apps.get_ftp_allowed( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_ftp_allowed(self, resource_group): + response = await self.client.web_apps.update_ftp_allowed( + resource_group_name=resource_group.name, + name="str", + csm_publishing_access_policies_entity={ + "allow": bool, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_scm_allowed(self, resource_group): + response = await self.client.web_apps.get_scm_allowed( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_scm_allowed(self, resource_group): + response = await self.client.web_apps.update_scm_allowed( + resource_group_name=resource_group.name, + name="str", + csm_publishing_access_policies_entity={ + "allow": bool, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_configurations(self, resource_group): + response = self.client.web_apps.list_configurations( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_application_settings(self, resource_group): + response = await self.client.web_apps.update_application_settings( + resource_group_name=resource_group.name, + name="str", + app_settings={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_application_settings(self, resource_group): + response = await self.client.web_apps.list_application_settings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_auth_settings(self, resource_group): + response = await self.client.web_apps.update_auth_settings( + resource_group_name=resource_group.name, + name="str", + site_auth_settings={ + "aadClaimsAuthorization": "str", + "additionalLoginParams": ["str"], + "allowedAudiences": ["str"], + "allowedExternalRedirectUrls": ["str"], + "authFilePath": "str", + "clientId": "str", + "clientSecret": "str", + "clientSecretCertificateThumbprint": "str", + "clientSecretSettingName": "str", + "configVersion": "str", + "defaultProvider": "str", + "enabled": bool, + "facebookAppId": "str", + "facebookAppSecret": "str", + "facebookAppSecretSettingName": "str", + "facebookOAuthScopes": ["str"], + "gitHubClientId": "str", + "gitHubClientSecret": "str", + "gitHubClientSecretSettingName": "str", + "gitHubOAuthScopes": ["str"], + "googleClientId": "str", + "googleClientSecret": "str", + "googleClientSecretSettingName": "str", + "googleOAuthScopes": ["str"], + "id": "str", + "isAuthFromFile": "str", + "issuer": "str", + "kind": "str", + "microsoftAccountClientId": "str", + "microsoftAccountClientSecret": "str", + "microsoftAccountClientSecretSettingName": "str", + "microsoftAccountOAuthScopes": ["str"], + "name": "str", + "runtimeVersion": "str", + "tokenRefreshExtensionHours": 0.0, + "tokenStoreEnabled": bool, + "twitterConsumerKey": "str", + "twitterConsumerSecret": "str", + "twitterConsumerSecretSettingName": "str", + "type": "str", + "unauthenticatedClientAction": "str", + "validateIssuer": bool, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_auth_settings(self, resource_group): + response = await self.client.web_apps.get_auth_settings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_auth_settings_v2_without_secrets(self, resource_group): + response = await self.client.web_apps.get_auth_settings_v2_without_secrets( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_auth_settings_v2(self, resource_group): + response = await self.client.web_apps.update_auth_settings_v2( + resource_group_name=resource_group.name, + name="str", + site_auth_settings_v2={ + "globalValidation": { + "excludedPaths": ["str"], + "redirectToProvider": "str", + "requireAuthentication": bool, + "unauthenticatedClientAction": "str", + }, + "httpSettings": { + "forwardProxy": { + "convention": "str", + "customHostHeaderName": "str", + "customProtoHeaderName": "str", + }, + "requireHttps": bool, + "routes": {"apiPrefix": "str"}, + }, + "id": "str", + "identityProviders": { + "apple": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "azureActiveDirectory": { + "enabled": bool, + "isAutoProvisioned": bool, + "login": {"disableWWWAuthenticate": bool, "loginParameters": ["str"]}, + "registration": { + "clientId": "str", + "clientSecretCertificateIssuer": "str", + "clientSecretCertificateSubjectAlternativeName": "str", + "clientSecretCertificateThumbprint": "str", + "clientSecretSettingName": "str", + "openIdIssuer": "str", + }, + "validation": { + "allowedAudiences": ["str"], + "defaultAuthorizationPolicy": { + "allowedApplications": ["str"], + "allowedPrincipals": {"groups": ["str"], "identities": ["str"]}, + }, + "jwtClaimChecks": {"allowedClientApplications": ["str"], "allowedGroups": ["str"]}, + }, + }, + "azureStaticWebApps": {"enabled": bool, "registration": {"clientId": "str"}}, + "customOpenIdConnectProviders": { + "str": { + "enabled": bool, + "login": {"nameClaimType": "str", "scopes": ["str"]}, + "registration": { + "clientCredential": {"clientSecretSettingName": "str", "method": "ClientSecretPost"}, + "clientId": "str", + "openIdConnectConfiguration": { + "authorizationEndpoint": "str", + "certificationUri": "str", + "issuer": "str", + "tokenEndpoint": "str", + "wellKnownOpenIdConfiguration": "str", + }, + }, + } + }, + "facebook": { + "enabled": bool, + "graphApiVersion": "str", + "login": {"scopes": ["str"]}, + "registration": {"appId": "str", "appSecretSettingName": "str"}, + }, + "gitHub": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "google": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + "validation": {"allowedAudiences": ["str"]}, + }, + "legacyMicrosoftAccount": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + "validation": {"allowedAudiences": ["str"]}, + }, + "twitter": { + "enabled": bool, + "registration": {"consumerKey": "str", "consumerSecretSettingName": "str"}, + }, + }, + "kind": "str", + "login": { + "allowedExternalRedirectUrls": ["str"], + "cookieExpiration": {"convention": "str", "timeToExpiration": "str"}, + "nonce": {"nonceExpirationInterval": "str", "validateNonce": bool}, + "preserveUrlFragmentsForLogins": bool, + "routes": {"logoutEndpoint": "str"}, + "tokenStore": { + "azureBlobStorage": {"sasUrlSettingName": "str"}, + "enabled": bool, + "fileSystem": {"directory": "str"}, + "tokenRefreshExtensionHours": 0.0, + }, + }, + "name": "str", + "platform": {"configFilePath": "str", "enabled": bool, "runtimeVersion": "str"}, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_auth_settings_v2(self, resource_group): + response = await self.client.web_apps.get_auth_settings_v2( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_azure_storage_accounts(self, resource_group): + response = await self.client.web_apps.update_azure_storage_accounts( + resource_group_name=resource_group.name, + name="str", + azure_storage_accounts={ + "id": "str", + "kind": "str", + "name": "str", + "properties": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_azure_storage_accounts(self, resource_group): + response = await self.client.web_apps.list_azure_storage_accounts( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_backup_configuration(self, resource_group): + response = await self.client.web_apps.update_backup_configuration( + resource_group_name=resource_group.name, + name="str", + request={ + "backupName": "str", + "backupSchedule": { + "frequencyInterval": 7, + "frequencyUnit": "Day", + "keepAtLeastOneBackup": True, + "retentionPeriodInDays": 30, + "lastExecutionTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + }, + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_backup_configuration(self, resource_group): + response = await self.client.web_apps.delete_backup_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_backup_configuration(self, resource_group): + response = await self.client.web_apps.get_backup_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_app_settings_key_vault_references(self, resource_group): + response = self.client.web_apps.get_app_settings_key_vault_references( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_app_setting_key_vault_reference(self, resource_group): + response = await self.client.web_apps.get_app_setting_key_vault_reference( + resource_group_name=resource_group.name, + name="str", + app_setting_key="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_connection_string_key_vault_references(self, resource_group): + response = self.client.web_apps.get_site_connection_string_key_vault_references( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_connection_string_key_vault_reference(self, resource_group): + response = await self.client.web_apps.get_site_connection_string_key_vault_reference( + resource_group_name=resource_group.name, + name="str", + connection_string_key="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_connection_strings(self, resource_group): + response = await self.client.web_apps.update_connection_strings( + resource_group_name=resource_group.name, + name="str", + connection_strings={ + "id": "str", + "kind": "str", + "name": "str", + "properties": {"str": {"type": "str", "value": "str"}}, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_connection_strings(self, resource_group): + response = await self.client.web_apps.list_connection_strings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_diagnostic_logs_configuration(self, resource_group): + response = await self.client.web_apps.get_diagnostic_logs_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_diagnostic_logs_config(self, resource_group): + response = await self.client.web_apps.update_diagnostic_logs_config( + resource_group_name=resource_group.name, + name="str", + site_logs_config={ + "applicationLogs": { + "azureBlobStorage": {"level": "str", "retentionInDays": 0, "sasUrl": "str"}, + "azureTableStorage": {"sasUrl": "str", "level": "str"}, + "fileSystem": {"level": "str"}, + }, + "detailedErrorMessages": {"enabled": bool}, + "failedRequestsTracing": {"enabled": bool}, + "httpLogs": { + "azureBlobStorage": {"enabled": bool, "retentionInDays": 0, "sasUrl": "str"}, + "fileSystem": {"enabled": bool, "retentionInDays": 0, "retentionInMb": 0}, + }, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_metadata(self, resource_group): + response = await self.client.web_apps.update_metadata( + resource_group_name=resource_group.name, + name="str", + metadata={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_metadata(self, resource_group): + response = await self.client.web_apps.list_metadata( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_list_publishing_credentials(self, resource_group): + response = await ( + await self.client.web_apps.begin_list_publishing_credentials( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_site_push_settings(self, resource_group): + response = await self.client.web_apps.update_site_push_settings( + resource_group_name=resource_group.name, + name="str", + push_settings={ + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_push_settings(self, resource_group): + response = await self.client.web_apps.list_site_push_settings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_slot_configuration_names(self, resource_group): + response = await self.client.web_apps.list_slot_configuration_names( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_slot_configuration_names(self, resource_group): + response = await self.client.web_apps.update_slot_configuration_names( + resource_group_name=resource_group.name, + name="str", + slot_config_names={ + "appSettingNames": ["str"], + "azureStorageConfigNames": ["str"], + "connectionStringNames": ["str"], + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_configuration(self, resource_group): + response = await self.client.web_apps.get_configuration( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_configuration(self, resource_group): + response = await self.client.web_apps.create_or_update_configuration( + resource_group_name=resource_group.name, + name="str", + site_config={ + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [{"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"}], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "id": "str", + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "name": "str", + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "type": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_configuration(self, resource_group): + response = await self.client.web_apps.update_configuration( + resource_group_name=resource_group.name, + name="str", + site_config={ + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [{"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"}], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "id": "str", + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "name": "str", + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "type": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_configuration_snapshot_info(self, resource_group): + response = self.client.web_apps.list_configuration_snapshot_info( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_configuration_snapshot(self, resource_group): + response = await self.client.web_apps.get_configuration_snapshot( + resource_group_name=resource_group.name, + name="str", + snapshot_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_recover_site_configuration_snapshot(self, resource_group): + response = await self.client.web_apps.recover_site_configuration_snapshot( + resource_group_name=resource_group.name, + name="str", + snapshot_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_web_site_container_logs(self, resource_group): + response = await self.client.web_apps.get_web_site_container_logs( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_container_logs_zip(self, resource_group): + response = await self.client.web_apps.get_container_logs_zip( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_continuous_web_jobs(self, resource_group): + response = self.client.web_apps.list_continuous_web_jobs( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_continuous_web_job(self, resource_group): + response = await self.client.web_apps.get_continuous_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_continuous_web_job(self, resource_group): + response = await self.client.web_apps.delete_continuous_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_start_continuous_web_job(self, resource_group): + response = await self.client.web_apps.start_continuous_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_stop_continuous_web_job(self, resource_group): + response = await self.client.web_apps.stop_continuous_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_production_site_deployment_statuses(self, resource_group): + response = self.client.web_apps.list_production_site_deployment_statuses( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_get_production_site_deployment_status(self, resource_group): + response = await ( + await self.client.web_apps.begin_get_production_site_deployment_status( + resource_group_name=resource_group.name, + name="str", + deployment_status_id="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_deployments(self, resource_group): + response = self.client.web_apps.list_deployments( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_deployment(self, resource_group): + response = await self.client.web_apps.get_deployment( + resource_group_name=resource_group.name, + name="str", + id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_deployment(self, resource_group): + response = await self.client.web_apps.create_deployment( + resource_group_name=resource_group.name, + name="str", + id="str", + deployment={ + "active": bool, + "author": "str", + "author_email": "str", + "deployer": "str", + "details": "str", + "end_time": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "message": "str", + "name": "str", + "start_time": "2020-02-20 00:00:00", + "status": 0, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_deployment(self, resource_group): + response = await self.client.web_apps.delete_deployment( + resource_group_name=resource_group.name, + name="str", + id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_deployment_log(self, resource_group): + response = await self.client.web_apps.list_deployment_log( + resource_group_name=resource_group.name, + name="str", + id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_discover_backup(self, resource_group): + response = await self.client.web_apps.discover_backup( + resource_group_name=resource_group.name, + name="str", + request={ + "adjustConnectionStrings": bool, + "appServicePlan": "str", + "blobName": "str", + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "hostingEnvironment": "str", + "id": "str", + "ignoreConflictingHostNames": False, + "ignoreDatabases": False, + "kind": "str", + "name": "str", + "operationType": "Default", + "overwrite": bool, + "siteName": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_domain_ownership_identifiers(self, resource_group): + response = self.client.web_apps.list_domain_ownership_identifiers( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_domain_ownership_identifier(self, resource_group): + response = await self.client.web_apps.get_domain_ownership_identifier( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_domain_ownership_identifier(self, resource_group): + response = await self.client.web_apps.create_or_update_domain_ownership_identifier( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + domain_ownership_identifier={"id": "str", "kind": "str", "name": "str", "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_domain_ownership_identifier(self, resource_group): + response = await self.client.web_apps.delete_domain_ownership_identifier( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_domain_ownership_identifier(self, resource_group): + response = await self.client.web_apps.update_domain_ownership_identifier( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + domain_ownership_identifier={"id": "str", "kind": "str", "name": "str", "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_ms_deploy_status(self, resource_group): + response = await self.client.web_apps.get_ms_deploy_status( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_ms_deploy_operation(self, resource_group): + response = await ( + await self.client.web_apps.begin_create_ms_deploy_operation( + resource_group_name=resource_group.name, + name="str", + ms_deploy={ + "appOffline": bool, + "connectionString": "str", + "dbType": "str", + "id": "str", + "kind": "str", + "name": "str", + "packageUri": "str", + "setParameters": {"str": "str"}, + "setParametersXmlFileUri": "str", + "skipAppData": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_ms_deploy_log(self, resource_group): + response = await self.client.web_apps.get_ms_deploy_log( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_one_deploy_status(self, resource_group): + response = await self.client.web_apps.get_one_deploy_status( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_one_deploy_operation(self, resource_group): + response = await self.client.web_apps.create_one_deploy_operation( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_functions(self, resource_group): + response = self.client.web_apps.list_functions( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_functions_admin_token(self, resource_group): + response = await self.client.web_apps.get_functions_admin_token( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_function(self, resource_group): + response = await self.client.web_apps.get_function( + resource_group_name=resource_group.name, + name="str", + function_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_function(self, resource_group): + response = await ( + await self.client.web_apps.begin_create_function( + resource_group_name=resource_group.name, + name="str", + function_name="str", + function_envelope={ + "config": {}, + "config_href": "str", + "files": {"str": "str"}, + "function_app_id": "str", + "href": "str", + "id": "str", + "invoke_url_template": "str", + "isDisabled": bool, + "kind": "str", + "language": "str", + "name": "str", + "script_href": "str", + "script_root_path_href": "str", + "secrets_file_href": "str", + "test_data": "str", + "test_data_href": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_function(self, resource_group): + response = await self.client.web_apps.delete_function( + resource_group_name=resource_group.name, + name="str", + function_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_function_secret(self, resource_group): + response = await self.client.web_apps.create_or_update_function_secret( + resource_group_name=resource_group.name, + name="str", + function_name="str", + key_name="str", + key={"name": "str", "value": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_function_secret(self, resource_group): + response = await self.client.web_apps.delete_function_secret( + resource_group_name=resource_group.name, + name="str", + function_name="str", + key_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_function_keys(self, resource_group): + response = await self.client.web_apps.list_function_keys( + resource_group_name=resource_group.name, + name="str", + function_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_function_secrets(self, resource_group): + response = await self.client.web_apps.list_function_secrets( + resource_group_name=resource_group.name, + name="str", + function_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_host_keys(self, resource_group): + response = await self.client.web_apps.list_host_keys( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_sync_status(self, resource_group): + response = await self.client.web_apps.list_sync_status( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sync_functions(self, resource_group): + response = await self.client.web_apps.sync_functions( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_host_secret(self, resource_group): + response = await self.client.web_apps.create_or_update_host_secret( + resource_group_name=resource_group.name, + name="str", + key_type="str", + key_name="str", + key={"name": "str", "value": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_host_secret(self, resource_group): + response = await self.client.web_apps.delete_host_secret( + resource_group_name=resource_group.name, + name="str", + key_type="str", + key_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_host_name_bindings(self, resource_group): + response = self.client.web_apps.list_host_name_bindings( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_host_name_binding(self, resource_group): + response = await self.client.web_apps.get_host_name_binding( + resource_group_name=resource_group.name, + name="str", + host_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_host_name_binding(self, resource_group): + response = await self.client.web_apps.create_or_update_host_name_binding( + resource_group_name=resource_group.name, + name="str", + host_name="str", + host_name_binding={ + "azureResourceName": "str", + "azureResourceType": "str", + "customHostNameDnsRecordType": "str", + "domainId": "str", + "hostNameType": "str", + "id": "str", + "kind": "str", + "name": "str", + "siteName": "str", + "sslState": "str", + "thumbprint": "str", + "type": "str", + "virtualIP": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_host_name_binding(self, resource_group): + response = await self.client.web_apps.delete_host_name_binding( + resource_group_name=resource_group.name, + name="str", + host_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_hybrid_connection(self, resource_group): + response = await self.client.web_apps.get_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_hybrid_connection(self, resource_group): + response = await self.client.web_apps.create_or_update_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + connection_envelope={ + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "relayArmUri": "str", + "relayName": "str", + "sendKeyName": "str", + "sendKeyValue": "str", + "serviceBusNamespace": "str", + "serviceBusSuffix": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_hybrid_connection(self, resource_group): + response = await self.client.web_apps.delete_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_hybrid_connection(self, resource_group): + response = await self.client.web_apps.update_hybrid_connection( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + connection_envelope={ + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "relayArmUri": "str", + "relayName": "str", + "sendKeyName": "str", + "sendKeyValue": "str", + "serviceBusNamespace": "str", + "serviceBusSuffix": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_hybrid_connections(self, resource_group): + response = await self.client.web_apps.list_hybrid_connections( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_relay_service_connections(self, resource_group): + response = await self.client.web_apps.list_relay_service_connections( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_relay_service_connection(self, resource_group): + response = await self.client.web_apps.get_relay_service_connection( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_relay_service_connection(self, resource_group): + response = await self.client.web_apps.create_or_update_relay_service_connection( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + connection_envelope={ + "biztalkUri": "str", + "entityConnectionString": "str", + "entityName": "str", + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "resourceConnectionString": "str", + "resourceType": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_relay_service_connection(self, resource_group): + response = await self.client.web_apps.delete_relay_service_connection( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_relay_service_connection(self, resource_group): + response = await self.client.web_apps.update_relay_service_connection( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + connection_envelope={ + "biztalkUri": "str", + "entityConnectionString": "str", + "entityName": "str", + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "resourceConnectionString": "str", + "resourceType": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_instance_identifiers(self, resource_group): + response = self.client.web_apps.list_instance_identifiers( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_info(self, resource_group): + response = await self.client.web_apps.get_instance_info( + resource_group_name=resource_group.name, + name="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_ms_deploy_status(self, resource_group): + response = await self.client.web_apps.get_instance_ms_deploy_status( + resource_group_name=resource_group.name, + name="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_instance_ms_deploy_operation(self, resource_group): + response = await ( + await self.client.web_apps.begin_create_instance_ms_deploy_operation( + resource_group_name=resource_group.name, + name="str", + instance_id="str", + ms_deploy={ + "appOffline": bool, + "connectionString": "str", + "dbType": "str", + "id": "str", + "kind": "str", + "name": "str", + "packageUri": "str", + "setParameters": {"str": "str"}, + "setParametersXmlFileUri": "str", + "skipAppData": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_ms_deploy_log(self, resource_group): + response = await self.client.web_apps.get_instance_ms_deploy_log( + resource_group_name=resource_group.name, + name="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_instance_processes(self, resource_group): + response = self.client.web_apps.list_instance_processes( + resource_group_name=resource_group.name, + name="str", + instance_id="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_process(self, resource_group): + response = await self.client.web_apps.get_instance_process( + resource_group_name=resource_group.name, + name="str", + process_id="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_instance_process(self, resource_group): + response = await self.client.web_apps.delete_instance_process( + resource_group_name=resource_group.name, + name="str", + process_id="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_process_dump(self, resource_group): + response = await self.client.web_apps.get_instance_process_dump( + resource_group_name=resource_group.name, + name="str", + process_id="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_instance_process_modules(self, resource_group): + response = self.client.web_apps.list_instance_process_modules( + resource_group_name=resource_group.name, + name="str", + process_id="str", + instance_id="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_process_module(self, resource_group): + response = await self.client.web_apps.get_instance_process_module( + resource_group_name=resource_group.name, + name="str", + process_id="str", + base_address="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_instance_process_threads(self, resource_group): + response = self.client.web_apps.list_instance_process_threads( + resource_group_name=resource_group.name, + name="str", + process_id="str", + instance_id="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_is_cloneable(self, resource_group): + response = await self.client.web_apps.is_cloneable( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_backups(self, resource_group): + response = self.client.web_apps.list_site_backups( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_sync_function_triggers(self, resource_group): + response = await self.client.web_apps.list_sync_function_triggers( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_migrate_storage(self, resource_group): + response = await ( + await self.client.web_apps.begin_migrate_storage( + subscription_name="str", + resource_group_name=resource_group.name, + name="str", + migration_options={ + "azurefilesConnectionString": "str", + "azurefilesShare": "str", + "blockWriteAccessToSite": False, + "id": "str", + "kind": "str", + "name": "str", + "switchSiteAfterMigration": False, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_migrate_my_sql(self, resource_group): + response = await ( + await self.client.web_apps.begin_migrate_my_sql( + resource_group_name=resource_group.name, + name="str", + migration_request_envelope={ + "connectionString": "str", + "id": "str", + "kind": "str", + "migrationType": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_migrate_my_sql_status(self, resource_group): + response = await self.client.web_apps.get_migrate_my_sql_status( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_swift_virtual_network_connection(self, resource_group): + response = await self.client.web_apps.get_swift_virtual_network_connection( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_swift_virtual_network_connection_with_check(self, resource_group): + response = await self.client.web_apps.create_or_update_swift_virtual_network_connection_with_check( + resource_group_name=resource_group.name, + name="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "subnetResourceId": "str", + "swiftSupported": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_swift_virtual_network(self, resource_group): + response = await self.client.web_apps.delete_swift_virtual_network( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_swift_virtual_network_connection_with_check(self, resource_group): + response = await self.client.web_apps.update_swift_virtual_network_connection_with_check( + resource_group_name=resource_group.name, + name="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "subnetResourceId": "str", + "swiftSupported": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_network_features(self, resource_group): + response = await self.client.web_apps.list_network_features( + resource_group_name=resource_group.name, + name="str", + view="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_network_trace_operation(self, resource_group): + response = await self.client.web_apps.get_network_trace_operation( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_start_web_site_network_trace(self, resource_group): + response = await self.client.web_apps.start_web_site_network_trace( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start_web_site_network_trace_operation(self, resource_group): + response = await ( + await self.client.web_apps.begin_start_web_site_network_trace_operation( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_stop_web_site_network_trace(self, resource_group): + response = await self.client.web_apps.stop_web_site_network_trace( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_network_traces(self, resource_group): + response = await self.client.web_apps.get_network_traces( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_network_trace_operation_v2(self, resource_group): + response = await self.client.web_apps.get_network_trace_operation_v2( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_network_traces_v2(self, resource_group): + response = await self.client.web_apps.get_network_traces_v2( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_generate_new_site_publishing_password(self, resource_group): + response = await self.client.web_apps.generate_new_site_publishing_password( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_perf_mon_counters(self, resource_group): + response = self.client.web_apps.list_perf_mon_counters( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_php_error_log_flag(self, resource_group): + response = await self.client.web_apps.get_site_php_error_log_flag( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_premier_add_ons(self, resource_group): + response = await self.client.web_apps.list_premier_add_ons( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_premier_add_on(self, resource_group): + response = await self.client.web_apps.get_premier_add_on( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_add_premier_add_on(self, resource_group): + response = await self.client.web_apps.add_premier_add_on( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + premier_add_on={ + "location": "str", + "id": "str", + "kind": "str", + "marketplaceOffer": "str", + "marketplacePublisher": "str", + "name": "str", + "product": "str", + "sku": "str", + "tags": {"str": "str"}, + "type": "str", + "vendor": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_premier_add_on(self, resource_group): + response = await self.client.web_apps.delete_premier_add_on( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_premier_add_on(self, resource_group): + response = await self.client.web_apps.update_premier_add_on( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + premier_add_on={ + "id": "str", + "kind": "str", + "marketplaceOffer": "str", + "marketplacePublisher": "str", + "name": "str", + "product": "str", + "sku": "str", + "type": "str", + "vendor": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_access(self, resource_group): + response = await self.client.web_apps.get_private_access( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_put_private_access_vnet(self, resource_group): + response = await self.client.web_apps.put_private_access_vnet( + resource_group_name=resource_group.name, + name="str", + access={ + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "virtualNetworks": [ + {"key": 0, "name": "str", "resourceId": "str", "subnets": [{"key": 0, "name": "str"}]} + ], + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_endpoint_connection_list(self, resource_group): + response = self.client.web_apps.get_private_endpoint_connection_list( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_endpoint_connection(self, resource_group): + response = await self.client.web_apps.get_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_approve_or_reject_private_endpoint_connection(self, resource_group): + response = await ( + await self.client.web_apps.begin_approve_or_reject_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + private_endpoint_wrapper={ + "id": "str", + "ipAddresses": ["str"], + "kind": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_private_endpoint_connection(self, resource_group): + response = await ( + await self.client.web_apps.begin_delete_private_endpoint_connection( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_link_resources(self, resource_group): + response = await self.client.web_apps.get_private_link_resources( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_processes(self, resource_group): + response = self.client.web_apps.list_processes( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_process(self, resource_group): + response = await self.client.web_apps.get_process( + resource_group_name=resource_group.name, + name="str", + process_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_process(self, resource_group): + response = await self.client.web_apps.delete_process( + resource_group_name=resource_group.name, + name="str", + process_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_process_dump(self, resource_group): + response = await self.client.web_apps.get_process_dump( + resource_group_name=resource_group.name, + name="str", + process_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_process_modules(self, resource_group): + response = self.client.web_apps.list_process_modules( + resource_group_name=resource_group.name, + name="str", + process_id="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_process_module(self, resource_group): + response = await self.client.web_apps.get_process_module( + resource_group_name=resource_group.name, + name="str", + process_id="str", + base_address="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_process_threads(self, resource_group): + response = self.client.web_apps.list_process_threads( + resource_group_name=resource_group.name, + name="str", + process_id="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_public_certificates(self, resource_group): + response = self.client.web_apps.list_public_certificates( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_public_certificate(self, resource_group): + response = await self.client.web_apps.get_public_certificate( + resource_group_name=resource_group.name, + name="str", + public_certificate_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_public_certificate(self, resource_group): + response = await self.client.web_apps.create_or_update_public_certificate( + resource_group_name=resource_group.name, + name="str", + public_certificate_name="str", + public_certificate={ + "blob": bytes("bytes", encoding="utf-8"), + "id": "str", + "kind": "str", + "name": "str", + "publicCertificateLocation": "str", + "thumbprint": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_public_certificate(self, resource_group): + response = await self.client.web_apps.delete_public_certificate( + resource_group_name=resource_group.name, + name="str", + public_certificate_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_publishing_profile_xml_with_secrets(self, resource_group): + response = await self.client.web_apps.list_publishing_profile_xml_with_secrets( + resource_group_name=resource_group.name, + name="str", + publishing_profile_options={"format": "str", "includeDisasterRecoveryEndpoints": bool}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_reset_production_slot_config(self, resource_group): + response = await self.client.web_apps.reset_production_slot_config( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restart(self, resource_group): + response = await self.client.web_apps.restart( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restore_from_backup_blob(self, resource_group): + response = await ( + await self.client.web_apps.begin_restore_from_backup_blob( + resource_group_name=resource_group.name, + name="str", + request={ + "adjustConnectionStrings": bool, + "appServicePlan": "str", + "blobName": "str", + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "hostingEnvironment": "str", + "id": "str", + "ignoreConflictingHostNames": False, + "ignoreDatabases": False, + "kind": "str", + "name": "str", + "operationType": "Default", + "overwrite": bool, + "siteName": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restore_from_deleted_app(self, resource_group): + response = await ( + await self.client.web_apps.begin_restore_from_deleted_app( + resource_group_name=resource_group.name, + name="str", + restore_request={ + "deletedSiteId": "str", + "id": "str", + "kind": "str", + "name": "str", + "recoverConfiguration": bool, + "snapshotTime": "str", + "type": "str", + "useDRSecondary": bool, + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restore_snapshot(self, resource_group): + response = await ( + await self.client.web_apps.begin_restore_snapshot( + resource_group_name=resource_group.name, + name="str", + restore_request={ + "id": "str", + "ignoreConflictingHostNames": bool, + "kind": "str", + "name": "str", + "overwrite": bool, + "recoverConfiguration": bool, + "recoverySource": {"id": "str", "location": "str"}, + "snapshotTime": "str", + "type": "str", + "useDRSecondary": bool, + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_containers(self, resource_group): + response = self.client.web_apps.list_site_containers( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_container(self, resource_group): + response = await self.client.web_apps.get_site_container( + resource_group_name=resource_group.name, + name="str", + container_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_site_container(self, resource_group): + response = await self.client.web_apps.create_or_update_site_container( + resource_group_name=resource_group.name, + name="str", + container_name="str", + request={ + "authType": "str", + "createdTime": "2020-02-20 00:00:00", + "environmentVariables": [{"name": "str", "value": "str"}], + "id": "str", + "image": "str", + "isMain": bool, + "kind": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "name": "str", + "passwordSecret": "str", + "startUpCommand": "str", + "targetPort": "str", + "type": "str", + "userManagedIdentityClientId": "str", + "userName": "str", + "volumeMounts": [ + {"containerMountPath": "str", "volumeSubPath": "str", "data": "str", "readOnly": bool} + ], + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_site_container(self, resource_group): + response = await self.client.web_apps.delete_site_container( + resource_group_name=resource_group.name, + name="str", + container_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_extensions(self, resource_group): + response = self.client.web_apps.list_site_extensions( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_extension(self, resource_group): + response = await self.client.web_apps.get_site_extension( + resource_group_name=resource_group.name, + name="str", + site_extension_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_install_site_extension(self, resource_group): + response = await ( + await self.client.web_apps.begin_install_site_extension( + resource_group_name=resource_group.name, + name="str", + site_extension_id="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_site_extension(self, resource_group): + response = await self.client.web_apps.delete_site_extension( + resource_group_name=resource_group.name, + name="str", + site_extension_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_slots(self, resource_group): + response = self.client.web_apps.list_slots( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_slot(self, resource_group): + response = await self.client.web_apps.get_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_create_or_update_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_envelope={ + "location": "str", + "availabilityState": "str", + "clientAffinityEnabled": bool, + "clientCertEnabled": bool, + "clientCertExclusionPaths": "str", + "clientCertMode": "str", + "cloningInfo": { + "sourceWebAppId": "str", + "appSettingsOverrides": {"str": "str"}, + "cloneCustomHostNames": bool, + "cloneSourceControl": bool, + "configureLoadBalancing": bool, + "correlationId": "str", + "hostingEnvironment": "str", + "overwrite": bool, + "sourceWebAppLocation": "str", + "trafficManagerProfileId": "str", + "trafficManagerProfileName": "str", + }, + "containerSize": 0, + "customDomainVerificationId": "str", + "dailyMemoryTimeQuota": 0, + "daprConfig": { + "appId": "str", + "appPort": 0, + "enableApiLogging": bool, + "enabled": False, + "httpMaxRequestSize": 0, + "httpReadBufferSize": 0, + "logLevel": "str", + }, + "defaultHostName": "str", + "dnsConfiguration": { + "dnsAltServer": "str", + "dnsLegacySortOrder": bool, + "dnsMaxCacheTimeout": 0, + "dnsRetryAttemptCount": 0, + "dnsRetryAttemptTimeout": 0, + "dnsServers": ["str"], + }, + "enabled": bool, + "enabledHostNames": ["str"], + "extendedLocation": {"name": "str", "type": "str"}, + "functionAppConfig": { + "deployment": { + "storage": { + "authentication": { + "storageAccountConnectionStringName": "str", + "type": "str", + "userAssignedIdentityResourceId": "str", + }, + "type": "str", + "value": "str", + } + }, + "runtime": {"name": "str", "version": "str"}, + "scaleAndConcurrency": { + "alwaysReady": [{"instanceCount": 0, "name": "str"}], + "instanceMemoryMB": 0, + "maximumInstanceCount": 0, + "triggers": {"http": {"perInstanceConcurrency": 0}}, + }, + }, + "hostNameSslStates": [ + { + "hostType": "str", + "name": "str", + "sslState": "str", + "thumbprint": "str", + "toUpdate": bool, + "virtualIP": "str", + } + ], + "hostNames": ["str"], + "hostNamesDisabled": bool, + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "httpsOnly": bool, + "hyperV": False, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inProgressOperationId": "str", + "isDefaultContainer": bool, + "isXenon": False, + "keyVaultReferenceIdentity": "str", + "kind": "str", + "lastModifiedTimeUtc": "2020-02-20 00:00:00", + "managedEnvironmentId": "str", + "maxNumberOfWorkers": 0, + "name": "str", + "outboundIpAddresses": "str", + "possibleOutboundIpAddresses": "str", + "publicNetworkAccess": "str", + "redundancyMode": "str", + "repositorySiteName": "str", + "reserved": False, + "resourceConfig": {"cpu": 0.0, "memory": "str"}, + "resourceGroup": "str", + "scmSiteAlsoStopped": False, + "serverFarmId": "str", + "siteConfig": { + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [ + {"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"} + ], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + "slotSwapStatus": { + "destinationSlotName": "str", + "sourceSlotName": "str", + "timestampUtc": "2020-02-20 00:00:00", + }, + "state": "str", + "storageAccountRequired": bool, + "suspendedTill": "2020-02-20 00:00:00", + "tags": {"str": "str"}, + "targetSwapSlot": "str", + "trafficManagerHostNames": ["str"], + "type": "str", + "usageState": "str", + "virtualNetworkSubnetId": "str", + "vnetBackupRestoreEnabled": bool, + "vnetContentShareEnabled": bool, + "vnetImagePullEnabled": bool, + "vnetRouteAllEnabled": bool, + "workloadProfileName": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_slot(self, resource_group): + response = await self.client.web_apps.delete_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_slot(self, resource_group): + response = await self.client.web_apps.update_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_envelope={ + "availabilityState": "str", + "clientAffinityEnabled": bool, + "clientCertEnabled": bool, + "clientCertExclusionPaths": "str", + "clientCertMode": "str", + "cloningInfo": { + "sourceWebAppId": "str", + "appSettingsOverrides": {"str": "str"}, + "cloneCustomHostNames": bool, + "cloneSourceControl": bool, + "configureLoadBalancing": bool, + "correlationId": "str", + "hostingEnvironment": "str", + "overwrite": bool, + "sourceWebAppLocation": "str", + "trafficManagerProfileId": "str", + "trafficManagerProfileName": "str", + }, + "containerSize": 0, + "customDomainVerificationId": "str", + "dailyMemoryTimeQuota": 0, + "defaultHostName": "str", + "dnsConfiguration": { + "dnsAltServer": "str", + "dnsLegacySortOrder": bool, + "dnsMaxCacheTimeout": 0, + "dnsRetryAttemptCount": 0, + "dnsRetryAttemptTimeout": 0, + "dnsServers": ["str"], + }, + "enabled": bool, + "enabledHostNames": ["str"], + "hostNameSslStates": [ + { + "hostType": "str", + "name": "str", + "sslState": "str", + "thumbprint": "str", + "toUpdate": bool, + "virtualIP": "str", + } + ], + "hostNames": ["str"], + "hostNamesDisabled": bool, + "hostingEnvironmentProfile": {"id": "str", "name": "str", "type": "str"}, + "httpsOnly": bool, + "hyperV": False, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "inProgressOperationId": "str", + "isDefaultContainer": bool, + "isXenon": False, + "keyVaultReferenceIdentity": "str", + "kind": "str", + "lastModifiedTimeUtc": "2020-02-20 00:00:00", + "maxNumberOfWorkers": 0, + "name": "str", + "outboundIpAddresses": "str", + "possibleOutboundIpAddresses": "str", + "redundancyMode": "str", + "repositorySiteName": "str", + "reserved": False, + "resourceGroup": "str", + "scmSiteAlsoStopped": False, + "serverFarmId": "str", + "siteConfig": { + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [ + {"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"} + ], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + "slotSwapStatus": { + "destinationSlotName": "str", + "sourceSlotName": "str", + "timestampUtc": "2020-02-20 00:00:00", + }, + "state": "str", + "storageAccountRequired": bool, + "suspendedTill": "2020-02-20 00:00:00", + "targetSwapSlot": "str", + "trafficManagerHostNames": ["str"], + "type": "str", + "usageState": "str", + "virtualNetworkSubnetId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_analyze_custom_hostname_slot(self, resource_group): + response = await self.client.web_apps.analyze_custom_hostname_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_apply_slot_configuration_slot(self, resource_group): + response = await self.client.web_apps.apply_slot_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + slot_swap_entity={"preserveVnet": bool, "targetSlot": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_slot(self, resource_group): + response = await self.client.web_apps.backup_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + request={ + "backupName": "str", + "backupSchedule": { + "frequencyInterval": 7, + "frequencyUnit": "Day", + "keepAtLeastOneBackup": True, + "retentionPeriodInDays": 30, + "lastExecutionTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + }, + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_backups_slot(self, resource_group): + response = self.client.web_apps.list_backups_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_backup_status_slot(self, resource_group): + response = await self.client.web_apps.get_backup_status_slot( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_backup_slot(self, resource_group): + response = await self.client.web_apps.delete_backup_slot( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_backup_status_secrets_slot(self, resource_group): + response = await self.client.web_apps.list_backup_status_secrets_slot( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + slot="str", + request={ + "backupName": "str", + "backupSchedule": { + "frequencyInterval": 7, + "frequencyUnit": "Day", + "keepAtLeastOneBackup": True, + "retentionPeriodInDays": 30, + "lastExecutionTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + }, + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restore_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_restore_slot( + resource_group_name=resource_group.name, + name="str", + backup_id="str", + slot="str", + request={ + "adjustConnectionStrings": bool, + "appServicePlan": "str", + "blobName": "str", + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "hostingEnvironment": "str", + "id": "str", + "ignoreConflictingHostNames": False, + "ignoreDatabases": False, + "kind": "str", + "name": "str", + "operationType": "Default", + "overwrite": bool, + "siteName": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_basic_publishing_credentials_policies_slot(self, resource_group): + response = self.client.web_apps.list_basic_publishing_credentials_policies_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_ftp_allowed_slot(self, resource_group): + response = await self.client.web_apps.get_ftp_allowed_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_ftp_allowed_slot(self, resource_group): + response = await self.client.web_apps.update_ftp_allowed_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + csm_publishing_access_policies_entity={ + "allow": bool, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_scm_allowed_slot(self, resource_group): + response = await self.client.web_apps.get_scm_allowed_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_scm_allowed_slot(self, resource_group): + response = await self.client.web_apps.update_scm_allowed_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + csm_publishing_access_policies_entity={ + "allow": bool, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_configurations_slot(self, resource_group): + response = self.client.web_apps.list_configurations_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_application_settings_slot(self, resource_group): + response = await self.client.web_apps.update_application_settings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + app_settings={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_application_settings_slot(self, resource_group): + response = await self.client.web_apps.list_application_settings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_auth_settings_slot(self, resource_group): + response = await self.client.web_apps.update_auth_settings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_auth_settings={ + "aadClaimsAuthorization": "str", + "additionalLoginParams": ["str"], + "allowedAudiences": ["str"], + "allowedExternalRedirectUrls": ["str"], + "authFilePath": "str", + "clientId": "str", + "clientSecret": "str", + "clientSecretCertificateThumbprint": "str", + "clientSecretSettingName": "str", + "configVersion": "str", + "defaultProvider": "str", + "enabled": bool, + "facebookAppId": "str", + "facebookAppSecret": "str", + "facebookAppSecretSettingName": "str", + "facebookOAuthScopes": ["str"], + "gitHubClientId": "str", + "gitHubClientSecret": "str", + "gitHubClientSecretSettingName": "str", + "gitHubOAuthScopes": ["str"], + "googleClientId": "str", + "googleClientSecret": "str", + "googleClientSecretSettingName": "str", + "googleOAuthScopes": ["str"], + "id": "str", + "isAuthFromFile": "str", + "issuer": "str", + "kind": "str", + "microsoftAccountClientId": "str", + "microsoftAccountClientSecret": "str", + "microsoftAccountClientSecretSettingName": "str", + "microsoftAccountOAuthScopes": ["str"], + "name": "str", + "runtimeVersion": "str", + "tokenRefreshExtensionHours": 0.0, + "tokenStoreEnabled": bool, + "twitterConsumerKey": "str", + "twitterConsumerSecret": "str", + "twitterConsumerSecretSettingName": "str", + "type": "str", + "unauthenticatedClientAction": "str", + "validateIssuer": bool, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_auth_settings_slot(self, resource_group): + response = await self.client.web_apps.get_auth_settings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_auth_settings_v2_without_secrets_slot(self, resource_group): + response = await self.client.web_apps.get_auth_settings_v2_without_secrets_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_auth_settings_v2_slot(self, resource_group): + response = await self.client.web_apps.update_auth_settings_v2_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_auth_settings_v2={ + "globalValidation": { + "excludedPaths": ["str"], + "redirectToProvider": "str", + "requireAuthentication": bool, + "unauthenticatedClientAction": "str", + }, + "httpSettings": { + "forwardProxy": { + "convention": "str", + "customHostHeaderName": "str", + "customProtoHeaderName": "str", + }, + "requireHttps": bool, + "routes": {"apiPrefix": "str"}, + }, + "id": "str", + "identityProviders": { + "apple": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "azureActiveDirectory": { + "enabled": bool, + "isAutoProvisioned": bool, + "login": {"disableWWWAuthenticate": bool, "loginParameters": ["str"]}, + "registration": { + "clientId": "str", + "clientSecretCertificateIssuer": "str", + "clientSecretCertificateSubjectAlternativeName": "str", + "clientSecretCertificateThumbprint": "str", + "clientSecretSettingName": "str", + "openIdIssuer": "str", + }, + "validation": { + "allowedAudiences": ["str"], + "defaultAuthorizationPolicy": { + "allowedApplications": ["str"], + "allowedPrincipals": {"groups": ["str"], "identities": ["str"]}, + }, + "jwtClaimChecks": {"allowedClientApplications": ["str"], "allowedGroups": ["str"]}, + }, + }, + "azureStaticWebApps": {"enabled": bool, "registration": {"clientId": "str"}}, + "customOpenIdConnectProviders": { + "str": { + "enabled": bool, + "login": {"nameClaimType": "str", "scopes": ["str"]}, + "registration": { + "clientCredential": {"clientSecretSettingName": "str", "method": "ClientSecretPost"}, + "clientId": "str", + "openIdConnectConfiguration": { + "authorizationEndpoint": "str", + "certificationUri": "str", + "issuer": "str", + "tokenEndpoint": "str", + "wellKnownOpenIdConfiguration": "str", + }, + }, + } + }, + "facebook": { + "enabled": bool, + "graphApiVersion": "str", + "login": {"scopes": ["str"]}, + "registration": {"appId": "str", "appSecretSettingName": "str"}, + }, + "gitHub": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + }, + "google": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + "validation": {"allowedAudiences": ["str"]}, + }, + "legacyMicrosoftAccount": { + "enabled": bool, + "login": {"scopes": ["str"]}, + "registration": {"clientId": "str", "clientSecretSettingName": "str"}, + "validation": {"allowedAudiences": ["str"]}, + }, + "twitter": { + "enabled": bool, + "registration": {"consumerKey": "str", "consumerSecretSettingName": "str"}, + }, + }, + "kind": "str", + "login": { + "allowedExternalRedirectUrls": ["str"], + "cookieExpiration": {"convention": "str", "timeToExpiration": "str"}, + "nonce": {"nonceExpirationInterval": "str", "validateNonce": bool}, + "preserveUrlFragmentsForLogins": bool, + "routes": {"logoutEndpoint": "str"}, + "tokenStore": { + "azureBlobStorage": {"sasUrlSettingName": "str"}, + "enabled": bool, + "fileSystem": {"directory": "str"}, + "tokenRefreshExtensionHours": 0.0, + }, + }, + "name": "str", + "platform": {"configFilePath": "str", "enabled": bool, "runtimeVersion": "str"}, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_auth_settings_v2_slot(self, resource_group): + response = await self.client.web_apps.get_auth_settings_v2_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_azure_storage_accounts_slot(self, resource_group): + response = await self.client.web_apps.update_azure_storage_accounts_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + azure_storage_accounts={ + "id": "str", + "kind": "str", + "name": "str", + "properties": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_azure_storage_accounts_slot(self, resource_group): + response = await self.client.web_apps.list_azure_storage_accounts_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_backup_configuration_slot(self, resource_group): + response = await self.client.web_apps.update_backup_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + request={ + "backupName": "str", + "backupSchedule": { + "frequencyInterval": 7, + "frequencyUnit": "Day", + "keepAtLeastOneBackup": True, + "retentionPeriodInDays": 30, + "lastExecutionTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + }, + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_backup_configuration_slot(self, resource_group): + response = await self.client.web_apps.delete_backup_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_backup_configuration_slot(self, resource_group): + response = await self.client.web_apps.get_backup_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_app_settings_key_vault_references_slot(self, resource_group): + response = self.client.web_apps.get_app_settings_key_vault_references_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_app_setting_key_vault_reference_slot(self, resource_group): + response = await self.client.web_apps.get_app_setting_key_vault_reference_slot( + resource_group_name=resource_group.name, + name="str", + app_setting_key="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_connection_string_key_vault_references_slot(self, resource_group): + response = self.client.web_apps.get_site_connection_string_key_vault_references_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_connection_string_key_vault_reference_slot(self, resource_group): + response = await self.client.web_apps.get_site_connection_string_key_vault_reference_slot( + resource_group_name=resource_group.name, + name="str", + connection_string_key="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_connection_strings_slot(self, resource_group): + response = await self.client.web_apps.update_connection_strings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + connection_strings={ + "id": "str", + "kind": "str", + "name": "str", + "properties": {"str": {"type": "str", "value": "str"}}, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_connection_strings_slot(self, resource_group): + response = await self.client.web_apps.list_connection_strings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_diagnostic_logs_configuration_slot(self, resource_group): + response = await self.client.web_apps.get_diagnostic_logs_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_diagnostic_logs_config_slot(self, resource_group): + response = await self.client.web_apps.update_diagnostic_logs_config_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_logs_config={ + "applicationLogs": { + "azureBlobStorage": {"level": "str", "retentionInDays": 0, "sasUrl": "str"}, + "azureTableStorage": {"sasUrl": "str", "level": "str"}, + "fileSystem": {"level": "str"}, + }, + "detailedErrorMessages": {"enabled": bool}, + "failedRequestsTracing": {"enabled": bool}, + "httpLogs": { + "azureBlobStorage": {"enabled": bool, "retentionInDays": 0, "sasUrl": "str"}, + "fileSystem": {"enabled": bool, "retentionInDays": 0, "retentionInMb": 0}, + }, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_metadata_slot(self, resource_group): + response = await self.client.web_apps.update_metadata_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + metadata={"id": "str", "kind": "str", "name": "str", "properties": {"str": "str"}, "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_metadata_slot(self, resource_group): + response = await self.client.web_apps.list_metadata_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_list_publishing_credentials_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_list_publishing_credentials_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_site_push_settings_slot(self, resource_group): + response = await self.client.web_apps.update_site_push_settings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + push_settings={ + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_push_settings_slot(self, resource_group): + response = await self.client.web_apps.list_site_push_settings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_configuration_slot(self, resource_group): + response = await self.client.web_apps.get_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_configuration_slot(self, resource_group): + response = await self.client.web_apps.create_or_update_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_config={ + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [{"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"}], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "id": "str", + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "name": "str", + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "type": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_configuration_slot(self, resource_group): + response = await self.client.web_apps.update_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_config={ + "acrUseManagedIdentityCreds": bool, + "acrUserManagedIdentityID": "str", + "alwaysOn": bool, + "apiDefinition": {"url": "str"}, + "apiManagementConfig": {"id": "str"}, + "appCommandLine": "str", + "appSettings": [{"name": "str", "value": "str"}], + "autoHealEnabled": bool, + "autoHealRules": { + "actions": { + "actionType": "str", + "customAction": {"exe": "str", "parameters": "str"}, + "minProcessExecutionTime": "str", + }, + "triggers": { + "privateBytesInKB": 0, + "requests": {"count": 0, "timeInterval": "str"}, + "slowRequests": {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"}, + "slowRequestsWithPath": [ + {"count": 0, "path": "str", "timeInterval": "str", "timeTaken": "str"} + ], + "statusCodes": [ + { + "count": 0, + "path": "str", + "status": 0, + "subStatus": 0, + "timeInterval": "str", + "win32Status": 0, + } + ], + "statusCodesRange": [{"count": 0, "path": "str", "statusCodes": "str", "timeInterval": "str"}], + }, + }, + "autoSwapSlotName": "str", + "azureStorageAccounts": { + "str": { + "accessKey": "str", + "accountName": "str", + "mountPath": "str", + "protocol": "str", + "shareName": "str", + "state": "str", + "type": "str", + } + }, + "connectionStrings": [{"connectionString": "str", "name": "str", "type": "str"}], + "cors": {"allowedOrigins": ["str"], "supportCredentials": bool}, + "defaultDocuments": ["str"], + "detailedErrorLoggingEnabled": bool, + "documentRoot": "str", + "elasticWebAppScaleLimit": 0, + "experiments": { + "rampUpRules": [ + { + "actionHostName": "str", + "changeDecisionCallbackUrl": "str", + "changeIntervalInMinutes": 0, + "changeStep": 0.0, + "maxReroutePercentage": 0.0, + "minReroutePercentage": 0.0, + "name": "str", + "reroutePercentage": 0.0, + } + ] + }, + "ftpsState": "str", + "functionAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": bool, + "handlerMappings": [{"arguments": "str", "extension": "str", "scriptProcessor": "str"}], + "healthCheckPath": "str", + "http20Enabled": True, + "httpLoggingEnabled": bool, + "id": "str", + "ipSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "ipSecurityRestrictionsDefaultAction": "str", + "javaContainer": "str", + "javaContainerVersion": "str", + "javaVersion": "str", + "keyVaultReferenceIdentity": "str", + "kind": "str", + "limits": {"maxDiskSizeInMb": 0, "maxMemoryInMb": 0, "maxPercentageCpu": 0.0}, + "linuxFxVersion": "str", + "loadBalancing": "str", + "localMySqlEnabled": False, + "logsDirectorySizeLimit": 0, + "machineKey": { + "decryption": "str", + "decryptionKey": "str", + "validation": "str", + "validationKey": "str", + }, + "managedPipelineMode": "str", + "managedServiceIdentityId": 0, + "metadata": [{"name": "str", "value": "str"}], + "minTlsCipherSuite": "str", + "minTlsVersion": "str", + "minimumElasticInstanceCount": 0, + "name": "str", + "netFrameworkVersion": "v4.6", + "nodeVersion": "str", + "numberOfWorkers": 0, + "phpVersion": "str", + "powerShellVersion": "str", + "preWarmedInstanceCount": 0, + "publicNetworkAccess": "str", + "publishingUsername": "str", + "push": { + "dynamicTagsJson": "str", + "id": "str", + "isPushEnabled": bool, + "kind": "str", + "name": "str", + "tagWhitelistJson": "str", + "tagsRequiringAuth": "str", + "type": "str", + }, + "pythonVersion": "str", + "remoteDebuggingEnabled": bool, + "remoteDebuggingVersion": "str", + "requestTracingEnabled": bool, + "requestTracingExpirationTime": "2020-02-20 00:00:00", + "scmIpSecurityRestrictions": [ + { + "action": "str", + "description": "str", + "headers": {"str": ["str"]}, + "ipAddress": "str", + "name": "str", + "priority": 0, + "subnetMask": "str", + "subnetTrafficTag": 0, + "tag": "str", + "vnetSubnetResourceId": "str", + "vnetTrafficTag": 0, + } + ], + "scmIpSecurityRestrictionsDefaultAction": "str", + "scmIpSecurityRestrictionsUseMain": bool, + "scmMinTlsVersion": "str", + "scmType": "str", + "tracingOptions": "str", + "type": "str", + "use32BitWorkerProcess": bool, + "virtualApplications": [ + { + "physicalPath": "str", + "preloadEnabled": bool, + "virtualDirectories": [{"physicalPath": "str", "virtualPath": "str"}], + "virtualPath": "str", + } + ], + "vnetName": "str", + "vnetPrivatePortsCount": 0, + "vnetRouteAllEnabled": bool, + "webSocketsEnabled": bool, + "websiteTimeZone": "str", + "windowsFxVersion": "str", + "xManagedServiceIdentityId": 0, + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_configuration_snapshot_info_slot(self, resource_group): + response = self.client.web_apps.list_configuration_snapshot_info_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_configuration_snapshot_slot(self, resource_group): + response = await self.client.web_apps.get_configuration_snapshot_slot( + resource_group_name=resource_group.name, + name="str", + snapshot_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_recover_site_configuration_snapshot_slot(self, resource_group): + response = await self.client.web_apps.recover_site_configuration_snapshot_slot( + resource_group_name=resource_group.name, + name="str", + snapshot_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_web_site_container_logs_slot(self, resource_group): + response = await self.client.web_apps.get_web_site_container_logs_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_container_logs_zip_slot(self, resource_group): + response = await self.client.web_apps.get_container_logs_zip_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_continuous_web_jobs_slot(self, resource_group): + response = self.client.web_apps.list_continuous_web_jobs_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_continuous_web_job_slot(self, resource_group): + response = await self.client.web_apps.get_continuous_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_continuous_web_job_slot(self, resource_group): + response = await self.client.web_apps.delete_continuous_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_start_continuous_web_job_slot(self, resource_group): + response = await self.client.web_apps.start_continuous_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_stop_continuous_web_job_slot(self, resource_group): + response = await self.client.web_apps.stop_continuous_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_slot_site_deployment_statuses_slot(self, resource_group): + response = self.client.web_apps.list_slot_site_deployment_statuses_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_get_slot_site_deployment_status_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_get_slot_site_deployment_status_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + deployment_status_id="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_deployments_slot(self, resource_group): + response = self.client.web_apps.list_deployments_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_deployment_slot(self, resource_group): + response = await self.client.web_apps.get_deployment_slot( + resource_group_name=resource_group.name, + name="str", + id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_deployment_slot(self, resource_group): + response = await self.client.web_apps.create_deployment_slot( + resource_group_name=resource_group.name, + name="str", + id="str", + slot="str", + deployment={ + "active": bool, + "author": "str", + "author_email": "str", + "deployer": "str", + "details": "str", + "end_time": "2020-02-20 00:00:00", + "id": "str", + "kind": "str", + "message": "str", + "name": "str", + "start_time": "2020-02-20 00:00:00", + "status": 0, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_deployment_slot(self, resource_group): + response = await self.client.web_apps.delete_deployment_slot( + resource_group_name=resource_group.name, + name="str", + id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_deployment_log_slot(self, resource_group): + response = await self.client.web_apps.list_deployment_log_slot( + resource_group_name=resource_group.name, + name="str", + id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_discover_backup_slot(self, resource_group): + response = await self.client.web_apps.discover_backup_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + request={ + "adjustConnectionStrings": bool, + "appServicePlan": "str", + "blobName": "str", + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "hostingEnvironment": "str", + "id": "str", + "ignoreConflictingHostNames": False, + "ignoreDatabases": False, + "kind": "str", + "name": "str", + "operationType": "Default", + "overwrite": bool, + "siteName": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_domain_ownership_identifiers_slot(self, resource_group): + response = self.client.web_apps.list_domain_ownership_identifiers_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_domain_ownership_identifier_slot(self, resource_group): + response = await self.client.web_apps.get_domain_ownership_identifier_slot( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_domain_ownership_identifier_slot(self, resource_group): + response = await self.client.web_apps.create_or_update_domain_ownership_identifier_slot( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + slot="str", + domain_ownership_identifier={"id": "str", "kind": "str", "name": "str", "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_domain_ownership_identifier_slot(self, resource_group): + response = await self.client.web_apps.delete_domain_ownership_identifier_slot( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_domain_ownership_identifier_slot(self, resource_group): + response = await self.client.web_apps.update_domain_ownership_identifier_slot( + resource_group_name=resource_group.name, + name="str", + domain_ownership_identifier_name="str", + slot="str", + domain_ownership_identifier={"id": "str", "kind": "str", "name": "str", "type": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_ms_deploy_status_slot(self, resource_group): + response = await self.client.web_apps.get_ms_deploy_status_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_ms_deploy_operation_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_create_ms_deploy_operation_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + ms_deploy={ + "appOffline": bool, + "connectionString": "str", + "dbType": "str", + "id": "str", + "kind": "str", + "name": "str", + "packageUri": "str", + "setParameters": {"str": "str"}, + "setParametersXmlFileUri": "str", + "skipAppData": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_ms_deploy_log_slot(self, resource_group): + response = await self.client.web_apps.get_ms_deploy_log_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_instance_functions_slot(self, resource_group): + response = self.client.web_apps.list_instance_functions_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_functions_admin_token_slot(self, resource_group): + response = await self.client.web_apps.get_functions_admin_token_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_function_slot(self, resource_group): + response = await self.client.web_apps.get_instance_function_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_instance_function_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_create_instance_function_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + slot="str", + function_envelope={ + "config": {}, + "config_href": "str", + "files": {"str": "str"}, + "function_app_id": "str", + "href": "str", + "id": "str", + "invoke_url_template": "str", + "isDisabled": bool, + "kind": "str", + "language": "str", + "name": "str", + "script_href": "str", + "script_root_path_href": "str", + "secrets_file_href": "str", + "test_data": "str", + "test_data_href": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_instance_function_slot(self, resource_group): + response = await self.client.web_apps.delete_instance_function_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_function_secret_slot(self, resource_group): + response = await self.client.web_apps.create_or_update_function_secret_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + key_name="str", + slot="str", + key={"name": "str", "value": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_function_secret_slot(self, resource_group): + response = await self.client.web_apps.delete_function_secret_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + key_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_function_keys_slot(self, resource_group): + response = await self.client.web_apps.list_function_keys_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_function_secrets_slot(self, resource_group): + response = await self.client.web_apps.list_function_secrets_slot( + resource_group_name=resource_group.name, + name="str", + function_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_host_keys_slot(self, resource_group): + response = await self.client.web_apps.list_host_keys_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_sync_status_slot(self, resource_group): + response = await self.client.web_apps.list_sync_status_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sync_functions_slot(self, resource_group): + response = await self.client.web_apps.sync_functions_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_host_secret_slot(self, resource_group): + response = await self.client.web_apps.create_or_update_host_secret_slot( + resource_group_name=resource_group.name, + name="str", + key_type="str", + key_name="str", + slot="str", + key={"name": "str", "value": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_host_secret_slot(self, resource_group): + response = await self.client.web_apps.delete_host_secret_slot( + resource_group_name=resource_group.name, + name="str", + key_type="str", + key_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_host_name_bindings_slot(self, resource_group): + response = self.client.web_apps.list_host_name_bindings_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_host_name_binding_slot(self, resource_group): + response = await self.client.web_apps.get_host_name_binding_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + host_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_host_name_binding_slot(self, resource_group): + response = await self.client.web_apps.create_or_update_host_name_binding_slot( + resource_group_name=resource_group.name, + name="str", + host_name="str", + slot="str", + host_name_binding={ + "azureResourceName": "str", + "azureResourceType": "str", + "customHostNameDnsRecordType": "str", + "domainId": "str", + "hostNameType": "str", + "id": "str", + "kind": "str", + "name": "str", + "siteName": "str", + "sslState": "str", + "thumbprint": "str", + "type": "str", + "virtualIP": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_host_name_binding_slot(self, resource_group): + response = await self.client.web_apps.delete_host_name_binding_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + host_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_hybrid_connection_slot(self, resource_group): + response = await self.client.web_apps.get_hybrid_connection_slot( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_hybrid_connection_slot(self, resource_group): + response = await self.client.web_apps.create_or_update_hybrid_connection_slot( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + slot="str", + connection_envelope={ + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "relayArmUri": "str", + "relayName": "str", + "sendKeyName": "str", + "sendKeyValue": "str", + "serviceBusNamespace": "str", + "serviceBusSuffix": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_hybrid_connection_slot(self, resource_group): + response = await self.client.web_apps.delete_hybrid_connection_slot( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_hybrid_connection_slot(self, resource_group): + response = await self.client.web_apps.update_hybrid_connection_slot( + resource_group_name=resource_group.name, + name="str", + namespace_name="str", + relay_name="str", + slot="str", + connection_envelope={ + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "relayArmUri": "str", + "relayName": "str", + "sendKeyName": "str", + "sendKeyValue": "str", + "serviceBusNamespace": "str", + "serviceBusSuffix": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_hybrid_connections_slot(self, resource_group): + response = await self.client.web_apps.list_hybrid_connections_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_relay_service_connections_slot(self, resource_group): + response = await self.client.web_apps.list_relay_service_connections_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_relay_service_connection_slot(self, resource_group): + response = await self.client.web_apps.get_relay_service_connection_slot( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_relay_service_connection_slot(self, resource_group): + response = await self.client.web_apps.create_or_update_relay_service_connection_slot( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + slot="str", + connection_envelope={ + "biztalkUri": "str", + "entityConnectionString": "str", + "entityName": "str", + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "resourceConnectionString": "str", + "resourceType": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_relay_service_connection_slot(self, resource_group): + response = await self.client.web_apps.delete_relay_service_connection_slot( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_relay_service_connection_slot(self, resource_group): + response = await self.client.web_apps.update_relay_service_connection_slot( + resource_group_name=resource_group.name, + name="str", + entity_name="str", + slot="str", + connection_envelope={ + "biztalkUri": "str", + "entityConnectionString": "str", + "entityName": "str", + "hostname": "str", + "id": "str", + "kind": "str", + "name": "str", + "port": 0, + "resourceConnectionString": "str", + "resourceType": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_instance_identifiers_slot(self, resource_group): + response = self.client.web_apps.list_instance_identifiers_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_info_slot(self, resource_group): + response = await self.client.web_apps.get_instance_info_slot( + resource_group_name=resource_group.name, + name="str", + instance_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_ms_deploy_status_slot(self, resource_group): + response = await self.client.web_apps.get_instance_ms_deploy_status_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_instance_ms_deploy_operation_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_create_instance_ms_deploy_operation_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + instance_id="str", + ms_deploy={ + "appOffline": bool, + "connectionString": "str", + "dbType": "str", + "id": "str", + "kind": "str", + "name": "str", + "packageUri": "str", + "setParameters": {"str": "str"}, + "setParametersXmlFileUri": "str", + "skipAppData": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_ms_deploy_log_slot(self, resource_group): + response = await self.client.web_apps.get_instance_ms_deploy_log_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_instance_processes_slot(self, resource_group): + response = self.client.web_apps.list_instance_processes_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_process_slot(self, resource_group): + response = await self.client.web_apps.get_instance_process_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_instance_process_slot(self, resource_group): + response = await self.client.web_apps.delete_instance_process_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_process_dump_slot(self, resource_group): + response = await self.client.web_apps.get_instance_process_dump_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_instance_process_modules_slot(self, resource_group): + response = self.client.web_apps.list_instance_process_modules_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_process_module_slot(self, resource_group): + response = await self.client.web_apps.get_instance_process_module_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + base_address="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_instance_process_threads_slot(self, resource_group): + response = self.client.web_apps.list_instance_process_threads_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + instance_id="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_is_cloneable_slot(self, resource_group): + response = await self.client.web_apps.is_cloneable_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_backups_slot(self, resource_group): + response = self.client.web_apps.list_site_backups_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_sync_function_triggers_slot(self, resource_group): + response = await self.client.web_apps.list_sync_function_triggers_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_migrate_my_sql_status_slot(self, resource_group): + response = await self.client.web_apps.get_migrate_my_sql_status_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_swift_virtual_network_connection_slot(self, resource_group): + response = await self.client.web_apps.get_swift_virtual_network_connection_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_swift_virtual_network_connection_with_check_slot(self, resource_group): + response = await self.client.web_apps.create_or_update_swift_virtual_network_connection_with_check_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "subnetResourceId": "str", + "swiftSupported": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_swift_virtual_network_slot(self, resource_group): + response = await self.client.web_apps.delete_swift_virtual_network_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_swift_virtual_network_connection_with_check_slot(self, resource_group): + response = await self.client.web_apps.update_swift_virtual_network_connection_with_check_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "subnetResourceId": "str", + "swiftSupported": bool, + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_network_features_slot(self, resource_group): + response = await self.client.web_apps.list_network_features_slot( + resource_group_name=resource_group.name, + name="str", + view="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_network_trace_operation_slot(self, resource_group): + response = await self.client.web_apps.get_network_trace_operation_slot( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_start_web_site_network_trace_slot(self, resource_group): + response = await self.client.web_apps.start_web_site_network_trace_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start_web_site_network_trace_operation_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_start_web_site_network_trace_operation_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_stop_web_site_network_trace_slot(self, resource_group): + response = await self.client.web_apps.stop_web_site_network_trace_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_network_traces_slot(self, resource_group): + response = await self.client.web_apps.get_network_traces_slot( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_network_trace_operation_slot_v2(self, resource_group): + response = await self.client.web_apps.get_network_trace_operation_slot_v2( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_network_traces_slot_v2(self, resource_group): + response = await self.client.web_apps.get_network_traces_slot_v2( + resource_group_name=resource_group.name, + name="str", + operation_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_generate_new_site_publishing_password_slot(self, resource_group): + response = await self.client.web_apps.generate_new_site_publishing_password_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_perf_mon_counters_slot(self, resource_group): + response = self.client.web_apps.list_perf_mon_counters_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_php_error_log_flag_slot(self, resource_group): + response = await self.client.web_apps.get_site_php_error_log_flag_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_premier_add_ons_slot(self, resource_group): + response = await self.client.web_apps.list_premier_add_ons_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_premier_add_on_slot(self, resource_group): + response = await self.client.web_apps.get_premier_add_on_slot( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_add_premier_add_on_slot(self, resource_group): + response = await self.client.web_apps.add_premier_add_on_slot( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + slot="str", + premier_add_on={ + "location": "str", + "id": "str", + "kind": "str", + "marketplaceOffer": "str", + "marketplacePublisher": "str", + "name": "str", + "product": "str", + "sku": "str", + "tags": {"str": "str"}, + "type": "str", + "vendor": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_premier_add_on_slot(self, resource_group): + response = await self.client.web_apps.delete_premier_add_on_slot( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_premier_add_on_slot(self, resource_group): + response = await self.client.web_apps.update_premier_add_on_slot( + resource_group_name=resource_group.name, + name="str", + premier_add_on_name="str", + slot="str", + premier_add_on={ + "id": "str", + "kind": "str", + "marketplaceOffer": "str", + "marketplacePublisher": "str", + "name": "str", + "product": "str", + "sku": "str", + "type": "str", + "vendor": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_access_slot(self, resource_group): + response = await self.client.web_apps.get_private_access_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_put_private_access_vnet_slot(self, resource_group): + response = await self.client.web_apps.put_private_access_vnet_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + access={ + "enabled": bool, + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "virtualNetworks": [ + {"key": 0, "name": "str", "resourceId": "str", "subnets": [{"key": 0, "name": "str"}]} + ], + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_endpoint_connection_list_slot(self, resource_group): + response = self.client.web_apps.get_private_endpoint_connection_list_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_endpoint_connection_slot(self, resource_group): + response = await self.client.web_apps.get_private_endpoint_connection_slot( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_approve_or_reject_private_endpoint_connection_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_approve_or_reject_private_endpoint_connection_slot( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + slot="str", + private_endpoint_wrapper={ + "id": "str", + "ipAddresses": ["str"], + "kind": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_private_endpoint_connection_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_delete_private_endpoint_connection_slot( + resource_group_name=resource_group.name, + name="str", + private_endpoint_connection_name="str", + slot="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_private_link_resources_slot(self, resource_group): + response = await self.client.web_apps.get_private_link_resources_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_processes_slot(self, resource_group): + response = self.client.web_apps.list_processes_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_process_slot(self, resource_group): + response = await self.client.web_apps.get_process_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_process_slot(self, resource_group): + response = await self.client.web_apps.delete_process_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_process_dump_slot(self, resource_group): + response = await self.client.web_apps.get_process_dump_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_process_modules_slot(self, resource_group): + response = self.client.web_apps.list_process_modules_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_process_module_slot(self, resource_group): + response = await self.client.web_apps.get_process_module_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + base_address="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_process_threads_slot(self, resource_group): + response = self.client.web_apps.list_process_threads_slot( + resource_group_name=resource_group.name, + name="str", + process_id="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_public_certificates_slot(self, resource_group): + response = self.client.web_apps.list_public_certificates_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_public_certificate_slot(self, resource_group): + response = await self.client.web_apps.get_public_certificate_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + public_certificate_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_public_certificate_slot(self, resource_group): + response = await self.client.web_apps.create_or_update_public_certificate_slot( + resource_group_name=resource_group.name, + name="str", + public_certificate_name="str", + slot="str", + public_certificate={ + "blob": bytes("bytes", encoding="utf-8"), + "id": "str", + "kind": "str", + "name": "str", + "publicCertificateLocation": "str", + "thumbprint": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_public_certificate_slot(self, resource_group): + response = await self.client.web_apps.delete_public_certificate_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + public_certificate_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_publishing_profile_xml_with_secrets_slot(self, resource_group): + response = await self.client.web_apps.list_publishing_profile_xml_with_secrets_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + publishing_profile_options={"format": "str", "includeDisasterRecoveryEndpoints": bool}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_reset_slot_configuration_slot(self, resource_group): + response = await self.client.web_apps.reset_slot_configuration_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restart_slot(self, resource_group): + response = await self.client.web_apps.restart_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restore_from_backup_blob_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_restore_from_backup_blob_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + request={ + "adjustConnectionStrings": bool, + "appServicePlan": "str", + "blobName": "str", + "databases": [ + {"databaseType": "str", "connectionString": "str", "connectionStringName": "str", "name": "str"} + ], + "hostingEnvironment": "str", + "id": "str", + "ignoreConflictingHostNames": False, + "ignoreDatabases": False, + "kind": "str", + "name": "str", + "operationType": "Default", + "overwrite": bool, + "siteName": "str", + "storageAccountUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restore_from_deleted_app_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_restore_from_deleted_app_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + restore_request={ + "deletedSiteId": "str", + "id": "str", + "kind": "str", + "name": "str", + "recoverConfiguration": bool, + "snapshotTime": "str", + "type": "str", + "useDRSecondary": bool, + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restore_snapshot_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_restore_snapshot_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + restore_request={ + "id": "str", + "ignoreConflictingHostNames": bool, + "kind": "str", + "name": "str", + "overwrite": bool, + "recoverConfiguration": bool, + "recoverySource": {"id": "str", "location": "str"}, + "snapshotTime": "str", + "type": "str", + "useDRSecondary": bool, + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_containers_slot(self, resource_group): + response = self.client.web_apps.list_site_containers_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_container_slot(self, resource_group): + response = await self.client.web_apps.get_site_container_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + container_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_site_container_slot(self, resource_group): + response = await self.client.web_apps.create_or_update_site_container_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + container_name="str", + request={ + "authType": "str", + "createdTime": "2020-02-20 00:00:00", + "environmentVariables": [{"name": "str", "value": "str"}], + "id": "str", + "image": "str", + "isMain": bool, + "kind": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "name": "str", + "passwordSecret": "str", + "startUpCommand": "str", + "targetPort": "str", + "type": "str", + "userManagedIdentityClientId": "str", + "userName": "str", + "volumeMounts": [ + {"containerMountPath": "str", "volumeSubPath": "str", "data": "str", "readOnly": bool} + ], + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_site_container_slot(self, resource_group): + response = await self.client.web_apps.delete_site_container_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + container_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_site_extensions_slot(self, resource_group): + response = self.client.web_apps.list_site_extensions_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_site_extension_slot(self, resource_group): + response = await self.client.web_apps.get_site_extension_slot( + resource_group_name=resource_group.name, + name="str", + site_extension_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_install_site_extension_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_install_site_extension_slot( + resource_group_name=resource_group.name, + name="str", + site_extension_id="str", + slot="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_site_extension_slot(self, resource_group): + response = await self.client.web_apps.delete_site_extension_slot( + resource_group_name=resource_group.name, + name="str", + site_extension_id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_slot_differences_slot(self, resource_group): + response = self.client.web_apps.list_slot_differences_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + slot_swap_entity={"preserveVnet": bool, "targetSlot": "str"}, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_swap_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_swap_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + slot_swap_entity={"preserveVnet": bool, "targetSlot": "str"}, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_snapshots_slot(self, resource_group): + response = self.client.web_apps.list_snapshots_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_snapshots_from_dr_secondary_slot(self, resource_group): + response = self.client.web_apps.list_snapshots_from_dr_secondary_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_source_control_slot(self, resource_group): + response = await self.client.web_apps.get_source_control_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update_source_control_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_create_or_update_source_control_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_source_control={ + "branch": "str", + "deploymentRollbackEnabled": bool, + "gitHubActionConfiguration": { + "codeConfiguration": {"runtimeStack": "str", "runtimeVersion": "str"}, + "containerConfiguration": { + "imageName": "str", + "password": "str", + "serverUrl": "str", + "username": "str", + }, + "generateWorkflowFile": bool, + "isLinux": bool, + }, + "id": "str", + "isGitHubAction": bool, + "isManualIntegration": bool, + "isMercurial": bool, + "kind": "str", + "name": "str", + "repoUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_source_control_slot(self, resource_group): + response = await self.client.web_apps.delete_source_control_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_source_control_slot(self, resource_group): + response = await self.client.web_apps.update_source_control_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + site_source_control={ + "branch": "str", + "deploymentRollbackEnabled": bool, + "gitHubActionConfiguration": { + "codeConfiguration": {"runtimeStack": "str", "runtimeVersion": "str"}, + "containerConfiguration": { + "imageName": "str", + "password": "str", + "serverUrl": "str", + "username": "str", + }, + "generateWorkflowFile": bool, + "isLinux": bool, + }, + "id": "str", + "isGitHubAction": bool, + "isManualIntegration": bool, + "isMercurial": bool, + "kind": "str", + "name": "str", + "repoUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_start_slot(self, resource_group): + response = await self.client.web_apps.start_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start_network_trace_slot(self, resource_group): + response = await ( + await self.client.web_apps.begin_start_network_trace_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_stop_slot(self, resource_group): + response = await self.client.web_apps.stop_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_stop_network_trace_slot(self, resource_group): + response = await self.client.web_apps.stop_network_trace_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sync_repository_slot(self, resource_group): + response = await self.client.web_apps.sync_repository_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sync_function_triggers_slot(self, resource_group): + response = await self.client.web_apps.sync_function_triggers_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_triggered_web_jobs_slot(self, resource_group): + response = self.client.web_apps.list_triggered_web_jobs_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_triggered_web_job_slot(self, resource_group): + response = await self.client.web_apps.get_triggered_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_triggered_web_job_slot(self, resource_group): + response = await self.client.web_apps.delete_triggered_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_triggered_web_job_history_slot(self, resource_group): + response = self.client.web_apps.list_triggered_web_job_history_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_triggered_web_job_history_slot(self, resource_group): + response = await self.client.web_apps.get_triggered_web_job_history_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + id="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_run_triggered_web_job_slot(self, resource_group): + response = await self.client.web_apps.run_triggered_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_usages_slot(self, resource_group): + response = self.client.web_apps.list_usages_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_vnet_connections_slot(self, resource_group): + response = await self.client.web_apps.list_vnet_connections_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_vnet_connection_slot(self, resource_group): + response = await self.client.web_apps.get_vnet_connection_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_vnet_connection_slot(self, resource_group): + response = await self.client.web_apps.create_or_update_vnet_connection_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + slot="str", + connection_envelope={ + "certBlob": "str", + "certThumbprint": "str", + "dnsServers": "str", + "id": "str", + "isSwift": bool, + "kind": "str", + "name": "str", + "resyncRequired": bool, + "routes": [ + { + "endAddress": "str", + "id": "str", + "kind": "str", + "name": "str", + "routeType": "str", + "startAddress": "str", + "type": "str", + } + ], + "type": "str", + "vnetResourceId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_vnet_connection_slot(self, resource_group): + response = await self.client.web_apps.delete_vnet_connection_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_vnet_connection_slot(self, resource_group): + response = await self.client.web_apps.update_vnet_connection_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + slot="str", + connection_envelope={ + "certBlob": "str", + "certThumbprint": "str", + "dnsServers": "str", + "id": "str", + "isSwift": bool, + "kind": "str", + "name": "str", + "resyncRequired": bool, + "routes": [ + { + "endAddress": "str", + "id": "str", + "kind": "str", + "name": "str", + "routeType": "str", + "startAddress": "str", + "type": "str", + } + ], + "type": "str", + "vnetResourceId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_vnet_connection_gateway_slot(self, resource_group): + response = await self.client.web_apps.get_vnet_connection_gateway_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_vnet_connection_gateway_slot(self, resource_group): + response = await self.client.web_apps.create_or_update_vnet_connection_gateway_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + slot="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "vnetName": "str", + "vpnPackageUri": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_vnet_connection_gateway_slot(self, resource_group): + response = await self.client.web_apps.update_vnet_connection_gateway_slot( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + slot="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "vnetName": "str", + "vpnPackageUri": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_web_jobs_slot(self, resource_group): + response = self.client.web_apps.list_web_jobs_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_web_job_slot(self, resource_group): + response = await self.client.web_apps.get_web_job_slot( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_slot_differences_from_production(self, resource_group): + response = self.client.web_apps.list_slot_differences_from_production( + resource_group_name=resource_group.name, + name="str", + slot_swap_entity={"preserveVnet": bool, "targetSlot": "str"}, + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_swap_slot_with_production(self, resource_group): + response = await ( + await self.client.web_apps.begin_swap_slot_with_production( + resource_group_name=resource_group.name, + name="str", + slot_swap_entity={"preserveVnet": bool, "targetSlot": "str"}, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_snapshots(self, resource_group): + response = self.client.web_apps.list_snapshots( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_snapshots_from_dr_secondary(self, resource_group): + response = self.client.web_apps.list_snapshots_from_dr_secondary( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_source_control(self, resource_group): + response = await self.client.web_apps.get_source_control( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update_source_control(self, resource_group): + response = await ( + await self.client.web_apps.begin_create_or_update_source_control( + resource_group_name=resource_group.name, + name="str", + site_source_control={ + "branch": "str", + "deploymentRollbackEnabled": bool, + "gitHubActionConfiguration": { + "codeConfiguration": {"runtimeStack": "str", "runtimeVersion": "str"}, + "containerConfiguration": { + "imageName": "str", + "password": "str", + "serverUrl": "str", + "username": "str", + }, + "generateWorkflowFile": bool, + "isLinux": bool, + }, + "id": "str", + "isGitHubAction": bool, + "isManualIntegration": bool, + "isMercurial": bool, + "kind": "str", + "name": "str", + "repoUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_source_control(self, resource_group): + response = await self.client.web_apps.delete_source_control( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_source_control(self, resource_group): + response = await self.client.web_apps.update_source_control( + resource_group_name=resource_group.name, + name="str", + site_source_control={ + "branch": "str", + "deploymentRollbackEnabled": bool, + "gitHubActionConfiguration": { + "codeConfiguration": {"runtimeStack": "str", "runtimeVersion": "str"}, + "containerConfiguration": { + "imageName": "str", + "password": "str", + "serverUrl": "str", + "username": "str", + }, + "generateWorkflowFile": bool, + "isLinux": bool, + }, + "id": "str", + "isGitHubAction": bool, + "isManualIntegration": bool, + "isMercurial": bool, + "kind": "str", + "name": "str", + "repoUrl": "str", + "type": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_start(self, resource_group): + response = await self.client.web_apps.start( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start_network_trace(self, resource_group): + response = await ( + await self.client.web_apps.begin_start_network_trace( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_stop(self, resource_group): + response = await self.client.web_apps.stop( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_stop_network_trace(self, resource_group): + response = await self.client.web_apps.stop_network_trace( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sync_repository(self, resource_group): + response = await self.client.web_apps.sync_repository( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sync_function_triggers(self, resource_group): + response = await self.client.web_apps.sync_function_triggers( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_triggered_web_jobs(self, resource_group): + response = self.client.web_apps.list_triggered_web_jobs( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_triggered_web_job(self, resource_group): + response = await self.client.web_apps.get_triggered_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_triggered_web_job(self, resource_group): + response = await self.client.web_apps.delete_triggered_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_triggered_web_job_history(self, resource_group): + response = self.client.web_apps.list_triggered_web_job_history( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_triggered_web_job_history(self, resource_group): + response = await self.client.web_apps.get_triggered_web_job_history( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_run_triggered_web_job(self, resource_group): + response = await self.client.web_apps.run_triggered_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_usages(self, resource_group): + response = self.client.web_apps.list_usages( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_vnet_connections(self, resource_group): + response = await self.client.web_apps.list_vnet_connections( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_vnet_connection(self, resource_group): + response = await self.client.web_apps.get_vnet_connection( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_vnet_connection(self, resource_group): + response = await self.client.web_apps.create_or_update_vnet_connection( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + connection_envelope={ + "certBlob": "str", + "certThumbprint": "str", + "dnsServers": "str", + "id": "str", + "isSwift": bool, + "kind": "str", + "name": "str", + "resyncRequired": bool, + "routes": [ + { + "endAddress": "str", + "id": "str", + "kind": "str", + "name": "str", + "routeType": "str", + "startAddress": "str", + "type": "str", + } + ], + "type": "str", + "vnetResourceId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete_vnet_connection(self, resource_group): + response = await self.client.web_apps.delete_vnet_connection( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_vnet_connection(self, resource_group): + response = await self.client.web_apps.update_vnet_connection( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + connection_envelope={ + "certBlob": "str", + "certThumbprint": "str", + "dnsServers": "str", + "id": "str", + "isSwift": bool, + "kind": "str", + "name": "str", + "resyncRequired": bool, + "routes": [ + { + "endAddress": "str", + "id": "str", + "kind": "str", + "name": "str", + "routeType": "str", + "startAddress": "str", + "type": "str", + } + ], + "type": "str", + "vnetResourceId": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_vnet_connection_gateway(self, resource_group): + response = await self.client.web_apps.get_vnet_connection_gateway( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update_vnet_connection_gateway(self, resource_group): + response = await self.client.web_apps.create_or_update_vnet_connection_gateway( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "vnetName": "str", + "vpnPackageUri": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_vnet_connection_gateway(self, resource_group): + response = await self.client.web_apps.update_vnet_connection_gateway( + resource_group_name=resource_group.name, + name="str", + vnet_name="str", + gateway_name="str", + connection_envelope={ + "id": "str", + "kind": "str", + "name": "str", + "type": "str", + "vnetName": "str", + "vpnPackageUri": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_web_jobs(self, resource_group): + response = self.client.web_apps.list_web_jobs( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_web_job(self, resource_group): + response = await self.client.web_apps.get_web_job( + resource_group_name=resource_group.name, + name="str", + web_job_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deploy_workflow_artifacts(self, resource_group): + response = await self.client.web_apps.deploy_workflow_artifacts( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deploy_workflow_artifacts_slot(self, resource_group): + response = await self.client.web_apps.deploy_workflow_artifacts_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_instance_workflows_slot(self, resource_group): + response = self.client.web_apps.list_instance_workflows_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_instance_workflow_slot(self, resource_group): + response = await self.client.web_apps.get_instance_workflow_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + workflow_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_workflows_connections_slot(self, resource_group): + response = await self.client.web_apps.list_workflows_connections_slot( + resource_group_name=resource_group.name, + name="str", + slot="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_workflows(self, resource_group): + response = self.client.web_apps.list_workflows( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_workflow(self, resource_group): + response = await self.client.web_apps.get_workflow( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_workflows_connections(self, resource_group): + response = await self.client.web_apps.list_workflows_connections( + resource_group_name=resource_group.name, + name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_repetitions_operations.py new file mode 100644 index 0000000000000..debe6c06acfce --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_repetitions_operations.py @@ -0,0 +1,66 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowRunActionRepetitionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.workflow_run_action_repetitions.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.workflow_run_action_repetitions.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + repetition_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_expression_traces(self, resource_group): + response = self.client.workflow_run_action_repetitions.list_expression_traces( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + repetition_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_repetitions_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_repetitions_operations_async.py new file mode 100644 index 0000000000000..8405d816ccf8a --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_repetitions_operations_async.py @@ -0,0 +1,67 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowRunActionRepetitionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.workflow_run_action_repetitions.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.workflow_run_action_repetitions.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + repetition_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_expression_traces(self, resource_group): + response = self.client.workflow_run_action_repetitions.list_expression_traces( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + repetition_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_repetitions_request_histories_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_repetitions_request_histories_operations.py new file mode 100644 index 0000000000000..c5348399641f0 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_repetitions_request_histories_operations.py @@ -0,0 +1,52 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowRunActionRepetitionsRequestHistoriesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.workflow_run_action_repetitions_request_histories.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + repetition_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.workflow_run_action_repetitions_request_histories.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + repetition_name="str", + request_history_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_repetitions_request_histories_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_repetitions_request_histories_operations_async.py new file mode 100644 index 0000000000000..dd33a6096b016 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_repetitions_request_histories_operations_async.py @@ -0,0 +1,53 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowRunActionRepetitionsRequestHistoriesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.workflow_run_action_repetitions_request_histories.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + repetition_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.workflow_run_action_repetitions_request_histories.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + repetition_name="str", + request_history_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_scope_repetitions_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_scope_repetitions_operations.py new file mode 100644 index 0000000000000..bc967c779aa3b --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_scope_repetitions_operations.py @@ -0,0 +1,50 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowRunActionScopeRepetitionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.workflow_run_action_scope_repetitions.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.workflow_run_action_scope_repetitions.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + repetition_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_scope_repetitions_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_scope_repetitions_operations_async.py new file mode 100644 index 0000000000000..fd4d3b043c072 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_action_scope_repetitions_operations_async.py @@ -0,0 +1,51 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowRunActionScopeRepetitionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.workflow_run_action_scope_repetitions.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.workflow_run_action_scope_repetitions.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + repetition_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_actions_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_actions_operations.py new file mode 100644 index 0000000000000..e4f0748410c05 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_actions_operations.py @@ -0,0 +1,63 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowRunActionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.workflow_run_actions.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.workflow_run_actions.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_expression_traces(self, resource_group): + response = self.client.workflow_run_actions.list_expression_traces( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_actions_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_actions_operations_async.py new file mode 100644 index 0000000000000..2c783686ccded --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_run_actions_operations_async.py @@ -0,0 +1,64 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowRunActionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.workflow_run_actions.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.workflow_run_actions.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_expression_traces(self, resource_group): + response = self.client.workflow_run_actions.list_expression_traces( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + action_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_runs_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_runs_operations.py new file mode 100644 index 0000000000000..a76962624b841 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_runs_operations.py @@ -0,0 +1,60 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowRunsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.workflow_runs.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.workflow_runs.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cancel(self, resource_group): + response = self.client.workflow_runs.cancel( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_runs_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_runs_operations_async.py new file mode 100644 index 0000000000000..99420c9332a06 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_runs_operations_async.py @@ -0,0 +1,61 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowRunsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.workflow_runs.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.workflow_runs.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cancel(self, resource_group): + response = await self.client.workflow_runs.cancel( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + run_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_trigger_histories_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_trigger_histories_operations.py new file mode 100644 index 0000000000000..26e902ed42bcd --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_trigger_histories_operations.py @@ -0,0 +1,63 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowTriggerHistoriesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.workflow_trigger_histories.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.workflow_trigger_histories.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + history_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_resubmit(self, resource_group): + response = self.client.workflow_trigger_histories.begin_resubmit( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + history_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_trigger_histories_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_trigger_histories_operations_async.py new file mode 100644 index 0000000000000..468372a56b0ad --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_trigger_histories_operations_async.py @@ -0,0 +1,66 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowTriggerHistoriesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.workflow_trigger_histories.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.workflow_trigger_histories.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + history_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_resubmit(self, resource_group): + response = await ( + await self.client.workflow_trigger_histories.begin_resubmit( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + history_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_triggers_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_triggers_operations.py new file mode 100644 index 0000000000000..3e1619ae1adc8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_triggers_operations.py @@ -0,0 +1,88 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowTriggersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.workflow_triggers.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.workflow_triggers.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_callback_url(self, resource_group): + response = self.client.workflow_triggers.list_callback_url( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_run(self, resource_group): + response = self.client.workflow_triggers.begin_run( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + api_version="2023-12-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_schema_json(self, resource_group): + response = self.client.workflow_triggers.get_schema_json( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_triggers_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_triggers_operations_async.py new file mode 100644 index 0000000000000..333a558cb2682 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_triggers_operations_async.py @@ -0,0 +1,91 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowTriggersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.workflow_triggers.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.workflow_triggers.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_callback_url(self, resource_group): + response = await self.client.workflow_triggers.list_callback_url( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_run(self, resource_group): + response = await ( + await self.client.workflow_triggers.begin_run( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + api_version="2023-12-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_schema_json(self, resource_group): + response = await self.client.workflow_triggers.get_schema_json( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + trigger_name="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_versions_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_versions_operations.py new file mode 100644 index 0000000000000..efd5f531629a8 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_versions_operations.py @@ -0,0 +1,46 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.workflow_versions.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + api_version="2023-12-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.workflow_versions.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + version_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_versions_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_versions_operations_async.py new file mode 100644 index 0000000000000..60c2d396108ac --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflow_versions_operations_async.py @@ -0,0 +1,47 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.workflow_versions.list( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + api_version="2023-12-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.workflow_versions.get( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + version_id="str", + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflows_operations.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflows_operations.py new file mode 100644 index 0000000000000..37bf2e8f91cae --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflows_operations.py @@ -0,0 +1,107 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_regenerate_access_key(self, resource_group): + response = self.client.workflows.regenerate_access_key( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + key_type={"keyType": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_validate(self, resource_group): + response = self.client.workflows.validate( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + validate={ + "accessControl": { + "actions": { + "allowedCallerIpAddresses": [{"addressRange": "str"}], + "openAuthenticationPolicies": { + "policies": {"str": {"claims": [{"name": "str", "value": "str"}], "type": "str"}} + }, + }, + "contents": { + "allowedCallerIpAddresses": [{"addressRange": "str"}], + "openAuthenticationPolicies": { + "policies": {"str": {"claims": [{"name": "str", "value": "str"}], "type": "str"}} + }, + }, + "triggers": { + "allowedCallerIpAddresses": [{"addressRange": "str"}], + "openAuthenticationPolicies": { + "policies": {"str": {"claims": [{"name": "str", "value": "str"}], "type": "str"}} + }, + }, + "workflowManagement": { + "allowedCallerIpAddresses": [{"addressRange": "str"}], + "openAuthenticationPolicies": { + "policies": {"str": {"claims": [{"name": "str", "value": "str"}], "type": "str"}} + }, + }, + }, + "accessEndpoint": "str", + "changedTime": "2020-02-20 00:00:00", + "createdTime": "2020-02-20 00:00:00", + "definition": {}, + "endpointsConfiguration": { + "connector": { + "accessEndpointIpAddresses": [{"address": "str"}], + "outgoingIpAddresses": [{"address": "str"}], + }, + "workflow": { + "accessEndpointIpAddresses": [{"address": "str"}], + "outgoingIpAddresses": [{"address": "str"}], + }, + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "integrationAccount": {"id": "str", "name": "str", "type": "str"}, + "integrationServiceEnvironment": {"id": "str", "name": "str", "type": "str"}, + "kind": "str", + "location": "str", + "name": "str", + "parameters": {"str": {"description": "str", "metadata": {}, "type": "str", "value": {}}}, + "provisioningState": "str", + "sku": {"name": "str", "plan": {"id": "str", "name": "str", "type": "str"}}, + "state": "str", + "tags": {"str": "str"}, + "type": "str", + "version": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflows_operations_async.py b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflows_operations_async.py new file mode 100644 index 0000000000000..0916bacafea2d --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/generated_tests/test_web_site_management_workflows_operations_async.py @@ -0,0 +1,108 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWebSiteManagementWorkflowsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_regenerate_access_key(self, resource_group): + response = await self.client.workflows.regenerate_access_key( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + key_type={"keyType": "str"}, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_validate(self, resource_group): + response = await self.client.workflows.validate( + resource_group_name=resource_group.name, + name="str", + workflow_name="str", + validate={ + "accessControl": { + "actions": { + "allowedCallerIpAddresses": [{"addressRange": "str"}], + "openAuthenticationPolicies": { + "policies": {"str": {"claims": [{"name": "str", "value": "str"}], "type": "str"}} + }, + }, + "contents": { + "allowedCallerIpAddresses": [{"addressRange": "str"}], + "openAuthenticationPolicies": { + "policies": {"str": {"claims": [{"name": "str", "value": "str"}], "type": "str"}} + }, + }, + "triggers": { + "allowedCallerIpAddresses": [{"addressRange": "str"}], + "openAuthenticationPolicies": { + "policies": {"str": {"claims": [{"name": "str", "value": "str"}], "type": "str"}} + }, + }, + "workflowManagement": { + "allowedCallerIpAddresses": [{"addressRange": "str"}], + "openAuthenticationPolicies": { + "policies": {"str": {"claims": [{"name": "str", "value": "str"}], "type": "str"}} + }, + }, + }, + "accessEndpoint": "str", + "changedTime": "2020-02-20 00:00:00", + "createdTime": "2020-02-20 00:00:00", + "definition": {}, + "endpointsConfiguration": { + "connector": { + "accessEndpointIpAddresses": [{"address": "str"}], + "outgoingIpAddresses": [{"address": "str"}], + }, + "workflow": { + "accessEndpointIpAddresses": [{"address": "str"}], + "outgoingIpAddresses": [{"address": "str"}], + }, + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "integrationAccount": {"id": "str", "name": "str", "type": "str"}, + "integrationServiceEnvironment": {"id": "str", "name": "str", "type": "str"}, + "kind": "str", + "location": "str", + "name": "str", + "parameters": {"str": {"description": "str", "metadata": {}, "type": "str", "value": {}}}, + "provisioningState": "str", + "sku": {"name": "str", "plan": {"id": "str", "name": "str", "type": "str"}}, + "state": "str", + "tags": {"str": "str"}, + "type": "str", + "version": "str", + }, + api_version="2023-12-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appservice/azure-mgmt-web/pyproject.toml b/sdk/appservice/azure-mgmt-web/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/appservice/azure-mgmt-web/setup.py b/sdk/appservice/azure-mgmt-web/setup.py index eeb475056d1f2..35a589a46dfe3 100644 --- a/sdk/appservice/azure-mgmt-web/setup.py +++ b/sdk/appservice/azure-mgmt-web/setup.py @@ -75,6 +75,7 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", "azure-mgmt-core>=1.3.2", ], diff --git a/sdk/appservice/azure-mgmt-web/tests/conftest.py b/sdk/appservice/azure-mgmt-web/tests/conftest.py new file mode 100644 index 0000000000000..5bf74943ea0c0 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/tests/conftest.py @@ -0,0 +1,35 @@ +# 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. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + websitemanagement_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + websitemanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + websitemanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + websitemanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=websitemanagement_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=websitemanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=websitemanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=websitemanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/appservice/azure-mgmt-web/tests/test_web_site_management_web_apps_operations_async_test.py b/sdk/appservice/azure-mgmt-web/tests/test_web_site_management_web_apps_operations_async_test.py new file mode 100644 index 0000000000000..f7b3b5ce1ea53 --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/tests/test_web_site_management_web_apps_operations_async_test.py @@ -0,0 +1,31 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web.aio import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestWebSiteManagementWebAppsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.web_apps.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r async for r in response] + assert result == [] + \ No newline at end of file diff --git a/sdk/appservice/azure-mgmt-web/tests/test_web_site_management_web_apps_operations_test.py b/sdk/appservice/azure-mgmt-web/tests/test_web_site_management_web_apps_operations_test.py new file mode 100644 index 0000000000000..eb9ba3209e62c --- /dev/null +++ b/sdk/appservice/azure-mgmt-web/tests/test_web_site_management_web_apps_operations_test.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.web import WebSiteManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestWebSiteManagementWebAppsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WebSiteManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.web_apps.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-12-01", + ) + result = [r for r in response] + assert result == [] + \ No newline at end of file diff --git a/sdk/astro/azure-mgmt-astro/pyproject.toml b/sdk/astro/azure-mgmt-astro/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/astro/azure-mgmt-astro/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/attestation/azure-mgmt-attestation/pyproject.toml b/sdk/attestation/azure-mgmt-attestation/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/attestation/azure-security-attestation/pyproject.toml b/sdk/attestation/azure-security-attestation/pyproject.toml index a3a58bd090306..b8570555c5c38 100644 --- a/sdk/attestation/azure-security-attestation/pyproject.toml +++ b/sdk/attestation/azure-security-attestation/pyproject.toml @@ -2,5 +2,4 @@ pylint = false pyright = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/authorization/azure-mgmt-authorization/pyproject.toml b/sdk/authorization/azure-mgmt-authorization/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/automanage/azure-mgmt-automanage/pyproject.toml b/sdk/automanage/azure-mgmt-automanage/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/automanage/azure-mgmt-automanage/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/automation/azure-mgmt-automation/pyproject.toml b/sdk/automation/azure-mgmt-automation/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/automation/azure-mgmt-automation/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/pyproject.toml b/sdk/azurearcdata/azure-mgmt-azurearcdata/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/pyproject.toml b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/azurelargeinstance/azure-mgmt-azurelargeinstance/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/azurestack/azure-mgmt-azurestack/pyproject.toml b/sdk/azurestack/azure-mgmt-azurestack/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/azurestack/azure-mgmt-azurestack/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/pyproject.toml b/sdk/azurestackhci/azure-mgmt-azurestackhci/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/baremetalinfrastructure/azure-mgmt-baremetalinfrastructure/pyproject.toml b/sdk/baremetalinfrastructure/azure-mgmt-baremetalinfrastructure/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-mgmt-baremetalinfrastructure/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/batch/azure-mgmt-batch/pyproject.toml b/sdk/batch/azure-mgmt-batch/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/batch/azure-mgmt-batch/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/batchai/azure-mgmt-batchai/pyproject.toml b/sdk/batchai/azure-mgmt-batchai/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/batchai/azure-mgmt-batchai/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/billing/azure-mgmt-billing/pyproject.toml b/sdk/billing/azure-mgmt-billing/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/billingbenefits/azure-mgmt-billingbenefits/pyproject.toml b/sdk/billingbenefits/azure-mgmt-billingbenefits/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/billingbenefits/azure-mgmt-billingbenefits/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/botservice/azure-mgmt-botservice/pyproject.toml b/sdk/botservice/azure-mgmt-botservice/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/cdn/azure-mgmt-cdn/pyproject.toml b/sdk/cdn/azure-mgmt-cdn/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/cdn/azure-mgmt-cdn/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/changeanalysis/azure-mgmt-changeanalysis/pyproject.toml b/sdk/changeanalysis/azure-mgmt-changeanalysis/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/changeanalysis/azure-mgmt-changeanalysis/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/chaos/azure-mgmt-chaos/pyproject.toml b/sdk/chaos/azure-mgmt-chaos/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/chaos/azure-mgmt-chaos/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/README.md b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/README.md index 9cae6af3254ce..370d92b0b3d6a 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/README.md @@ -23,7 +23,6 @@ These sample programs show common scenarios for the Conversational Language Unde |-|-| |[sample_analyze_conversation_app.py][sample_analyze_conversation_app] and [sample_analyze_conversation_app_async.py][sample_analyze_conversation_app_async] | Analyze intents and entities in your utterance using a conversation project. | | [sample_analyze_orchestration_app_conv_response.py][sample_analyze_orchestration_app_conv_response] and [sample_analyze_orchestration_app_conv_response_async.py][sample_analyze_orchestration_app_conv_response_async]| Analyze user utterance using an orchestration project, which selects the best candidate from one of your different apps to analyze user query (ex: Qna, Conversation, and Luis). In this case, it uses a conversation project. | -| [sample_analyze_orchestration_app_luis_response.py][sample_analyze_orchestration_app_luis_response] and [sample_analyze_orchestration_app_luis_response_async.py][sample_analyze_orchestration_app_luis_response_async]| Analyze user utterance using an orchestration project, which selects the best candidate from one of your different apps to analyze user query (ex: Qna, Conversation, and Luis). In this case, it uses a Luis project. | | [sample_analyze_orchestration_app_qna_response.py][sample_analyze_orchestration_app_qna_response] and [sample_analyze_orchestration_app_qna_response_async.py][sample_analyze_orchestration_app_qna_response_async]| Analyze user utterance using an orchestration project, which selects the best candidate from one of your different apps to analyze user query (ex: Qna, Conversation, and Luis). In this case, it uses a Qna project. | | [sample_conv_summarization.py][sample_conv_summarization] and [sample_conv_summarization_async.py][sample_conv_summarization_async]| Summarize conversation in the form of issues and resolutions (ex: tech support conversation) | | [sample_manage_projects.py][sample_manage_projects] and [sample_manage_projects_async.py][sample_manage_projects_async]| Shows common authoring operations on projects. | @@ -73,9 +72,6 @@ what you can do with the Azure Conversational Language Understanding client libr [sample_analyze_orchestration_app_conv_response]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_analyze_orchestration_app_conv_response.py [sample_analyze_orchestration_app_conv_response_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_analyze_orchestration_app_conv_response_async.py -[sample_analyze_orchestration_app_luis_response]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_analyze_orchestration_app_luis_response.py -[sample_analyze_orchestration_app_luis_response_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_analyze_orchestration_app_luis_response_async.py - [sample_analyze_orchestration_app_qna_response]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_analyze_orchestration_app_qna_response.py [sample_analyze_orchestration_app_qna_response_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_analyze_orchestration_app_qna_response_async.py diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_analyze_orchestration_app_luis_response_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_analyze_orchestration_app_luis_response_async.py deleted file mode 100644 index 7c2c83898750e..0000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_analyze_orchestration_app_luis_response_async.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding=utf-8 -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - -""" -FILE: sample_analyze_orchestration_app_luis_response_async.py - -DESCRIPTION: - This sample demonstrates how to analyze user query using an orchestration project. - In this sample, orchestration project's top intent will map to a LUIS project. - - For more info about how to setup a CLU orchestration project, see the README. - -USAGE: - python sample_analyze_orchestration_app_luis_response_async.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_CONVERSATIONS_ENDPOINT - endpoint for your CLU resource. - 2) AZURE_CONVERSATIONS_KEY - API key for your CLU resource. - 3) AZURE_CONVERSATIONS_WORKFLOW_PROJECT_NAME - project name for your CLU orchestration project. - 4) AZURE_CONVERSATIONS_WORKFLOW_DEPLOYMENT_NAME - deployment name for your CLU orchestration project. -""" - -import asyncio - -async def sample_analyze_orchestration_app_luis_response_async(): - # [START analyze_orchestration_app_luis_response] - # import libraries - import os - from azure.core.credentials import AzureKeyCredential - from azure.ai.language.conversations.aio import ConversationAnalysisClient - - # get secrets - clu_endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"] - clu_key = os.environ["AZURE_CONVERSATIONS_KEY"] - project_name = os.environ["AZURE_CONVERSATIONS_WORKFLOW_PROJECT_NAME"] - deployment_name = os.environ["AZURE_CONVERSATIONS_WORKFLOW_DEPLOYMENT_NAME"] - - # analyze query - client = ConversationAnalysisClient(clu_endpoint, AzureKeyCredential(clu_key)) - async with client: - query = "Reserve a table for 2 at the Italian restaurant" - result = await client.analyze_conversation( - task={ - "kind": "Conversation", - "analysisInput": { - "conversationItem": { - "participantId": "1", - "id": "1", - "modality": "text", - "language": "en", - "text": query - }, - "isLoggingEnabled": False - }, - "parameters": { - "projectName": project_name, - "deploymentName": deployment_name, - "verbose": True - } - } - ) - - # view result - print(f"query: {result['result']['query']}") - print(f"project kind: {result['result']['prediction']['projectKind']}\n") - - # top intent - top_intent = result['result']['prediction']['topIntent'] - print(f"top intent: {top_intent}") - top_intent_object = result['result']['prediction']['intents'][top_intent] - print(f"confidence score: {top_intent_object['confidenceScore']}") - print(f"project kind: {top_intent_object['targetProjectKind']}") - - if top_intent_object['targetProjectKind'] == "Luis": - print("\nluis response:") - luis_response = top_intent_object['result']['prediction'] - print(f"top intent: {luis_response['topIntent']}") - print("\nentities:") - for entity in luis_response['entities']: - print(f"\n{entity}") - - # [END analyze_orchestration_app_luis_response] - -async def main(): - await sample_analyze_orchestration_app_luis_response_async() - -if __name__ == '__main__': - asyncio.run(main()) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_analyze_orchestration_app_luis_response.py b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_analyze_orchestration_app_luis_response.py deleted file mode 100644 index 1ff77b79bf24c..0000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_analyze_orchestration_app_luis_response.py +++ /dev/null @@ -1,86 +0,0 @@ -# coding=utf-8 -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - -""" -FILE: sample_analyze_orchestration_app_luis_response.py - -DESCRIPTION: - This sample demonstrates how to analyze user query using an orchestration project. - In this sample, orchestration project's top intent will map to a LUIS project. - - For more info about how to setup a CLU orchestration project, see the README. - -USAGE: - python sample_analyze_orchestration_app_luis_response.py - - Set the environment variables with your own values before running the sample: - 1) AZURE_CONVERSATIONS_ENDPOINT - endpoint for your CLU resource. - 2) AZURE_CONVERSATIONS_KEY - API key for your CLU resource. - 3) AZURE_CONVERSATIONS_WORKFLOW_PROJECT_NAME - project name for your CLU orchestration project. - 4) AZURE_CONVERSATIONS_WORKFLOW_DEPLOYMENT_NAME - deployment name for your CLU orchestration project. -""" - -def sample_analyze_orchestration_app_luis_response(): - # [START analyze_orchestration_app_luis_response] - # import libraries - import os - from azure.core.credentials import AzureKeyCredential - from azure.ai.language.conversations import ConversationAnalysisClient - - # get secrets - clu_endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"] - clu_key = os.environ["AZURE_CONVERSATIONS_KEY"] - project_name = os.environ["AZURE_CONVERSATIONS_WORKFLOW_PROJECT_NAME"] - deployment_name = os.environ["AZURE_CONVERSATIONS_WORKFLOW_DEPLOYMENT_NAME"] - - # analyze query - client = ConversationAnalysisClient(clu_endpoint, AzureKeyCredential(clu_key)) - with client: - query = "Reserve a table for 2 at the Italian restaurant" - result = client.analyze_conversation( - task={ - "kind": "Conversation", - "analysisInput": { - "conversationItem": { - "participantId": "1", - "id": "1", - "modality": "text", - "language": "en", - "text": query - }, - "isLoggingEnabled": False - }, - "parameters": { - "projectName": project_name, - "deploymentName": deployment_name, - "verbose": True - } - } - ) - - # view result - print(f"query: {result['result']['query']}") - print(f"project kind: {result['result']['prediction']['projectKind']}\n") - - # top intent - top_intent = result["result"]["prediction"]["topIntent"] - print(f"top intent: {top_intent}") - top_intent_object = result["result"]["prediction"]["intents"][top_intent] - print(f"confidence score: {top_intent_object['confidenceScore']}") - print(f"project kind: {top_intent_object['targetProjectKind']}") - - if top_intent_object["targetProjectKind"] == "Luis": - print("\nluis response:") - luis_response = top_intent_object["result"]["prediction"] - print(f"top intent: {luis_response['topIntent']}") - print("\nentities:") - for entity in luis_response["entities"]: - print(f"\n{entity}") - - # [END analyze_orchestration_app_luis_response] - -if __name__ == '__main__': - sample_analyze_orchestration_app_luis_response() \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/CHANGELOG.md index 4a93989a294da..615c7069c59dc 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/CHANGELOG.md @@ -1,5 +1,13 @@ # Release History +## 0.3.1 (2024-08-13) + +### Other Changes + +- This package is no longer being maintained. Use the [azure-ai-language-questionanswering](https://pypi.org/project/azure-ai-language-questionanswering/) package instead. + +- For migration instructions, see the [migration guide](https://aka.ms/azsdk/python/migrate/azure-ai-language-questionanswering). + ## 0.3.0 (2020-11-07) **Features** diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/README.md b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/README.md index f9dfbc0b30701..71cbfb770caf8 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/README.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/README.md @@ -1,23 +1,5 @@ # Microsoft Azure SDK for Python -This is the Microsoft Azure QnA Maker Client Library. -This package has been tested with Python 2.7, 3.6+. -For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). +This package is no longer being maintained. Use the [azure-ai-language-questionanswering](https://pypi.org/project/azure-ai-language-questionanswering/) package instead. - -# Usage - - - - -For code examples, see [QnA Maker](https://docs.microsoft.com/python/api/overview/azure/cognitive-services) on docs.microsoft.com. - - -# Provide Feedback - -If you encounter any bugs or have suggestions, please file an issue in the -[Issues](https://github.com/Azure/azure-sdk-for-python/issues) -section of the project. - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-cognitiveservices-knowledge-qnamaker%2FREADME.png) +For migration instructions, see the [migration guide](https://aka.ms/azsdk/python/migrate/azure-ai-language-questionanswering). \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/version.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/version.py index fcb88654af0a5..61693008bc105 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/version.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/version.py @@ -9,4 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.3.0" +VERSION = "0.3.1" diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/pyproject.toml index 0891ce3392f5f..53def8d6712f2 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/pyproject.toml +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/pyproject.toml @@ -1,2 +1,3 @@ [tool.azure-sdk-build] pylint = false +ci_enabled = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/sdk_packaging.toml b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/sdk_packaging.toml index 2eafc2941fe31..b5fad1f6f0b48 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/sdk_packaging.toml +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/sdk_packaging.toml @@ -6,3 +6,4 @@ package_doc_id = "cognitive-services" is_stable = false is_arm = false need_msrestazure = false +auto_update = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/setup.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/setup.py index d6d673c492f2a..9ec13587294d6 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/setup.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/setup.py @@ -62,7 +62,7 @@ url='https://github.com/Azure/azure-sdk-for-python', keywords="azure, azure sdk", classifiers=[ - 'Development Status :: 4 - Beta', + 'Development Status :: 7 - Inactive', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/CHANGELOG.md index d5551708186f4..614e4cb492347 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/CHANGELOG.md @@ -1,10 +1,16 @@ # Release History +## 0.7.1 (2024-08-15) + +### Other Changes + +- This package is no longer being maintained. Use the [azure-ai-language-conversations](https://pypi.org/project/azure-ai-language-conversations/) package instead. + ## 0.7.0 (2020-06-15) *Authoring* -**Features** +### Features Added - Model JSONEntity has a new parameter children - Model EntityLabel has a new parameter children @@ -12,7 +18,7 @@ - Model EntityLabelObject has a new parameter children - Model ModelFeatureInformation has a new parameter is_required -**Breaking changes** +### Breaking Changes - Operation ExamplesOperations.add has a new signature - Operation ExamplesOperations.batch has a new signature diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/README.md b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/README.md index 728f1865ed0e5..e62c9035baa92 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/README.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/README.md @@ -1,23 +1,3 @@ # Microsoft Azure SDK for Python -This is the Microsoft Azure Cognitive Services LUIS Client Library. -This package has been tested with Python 2.7, 3.6+. -For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). - - -# Usage - - - - -For code examples, see [Cognitive Services LUIS](https://docs.microsoft.com/python/api/overview/azure/cognitive-services) on docs.microsoft.com. - - -# Provide Feedback - -If you encounter any bugs or have suggestions, please file an issue in the -[Issues](https://github.com/Azure/azure-sdk-for-python/issues) -section of the project. - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-cognitiveservices-language-luis%2FREADME.png) +This package is no longer being maintained. Use the [azure-ai-language-conversations](https://pypi.org/project/azure-ai-language-conversations/) package instead. diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/version.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/version.py index 21801edec7d86..e6a39d5dfec08 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/version.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/version.py @@ -9,4 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.7.0" +VERSION = "0.7.1" diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/pyproject.toml b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/pyproject.toml index 0891ce3392f5f..53def8d6712f2 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/pyproject.toml +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/pyproject.toml @@ -1,2 +1,3 @@ [tool.azure-sdk-build] pylint = false +ci_enabled = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/sdk_packaging.toml b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/sdk_packaging.toml index ffd80048fed4f..6832783e40a20 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/sdk_packaging.toml +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/sdk_packaging.toml @@ -4,3 +4,4 @@ package_pprint_name = "Cognitive Services LUIS" package_doc_id = "cognitive-services" is_stable = false is_arm = false +auto_update = false diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/setup.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/setup.py index 7b67f3117b7b9..b23a5703866e3 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/setup.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/setup.py @@ -62,7 +62,7 @@ url='https://github.com/Azure/azure-sdk-for-python', keywords="azure, azure sdk", classifiers=[ - 'Development Status :: 4 - Beta', + 'Development Status :: 7 - Inactive', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/CHANGELOG.md index b9b187f3228af..3006c2072c5d4 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/CHANGELOG.md @@ -2,32 +2,11 @@ ## 2.0.0 (2020-01-12) -**Breaking changes** +### Breaking Changes - SpellCheckAPI main client has been renamed SpellCheckClient -**General Breaking Changes** - -This version uses a next-generation code generator that might introduce -breaking changes if from some import. In summary, some modules were -incorrectly visible/importable and have been renamed. This fixed several -issues caused by usage of classes that were not supposed to be used in -the first place. SpellCheckClient cannot be imported from -azure.cognitiveservices.language.spellcheck.spell_check_api anymore -(import from azure.cognitiveservices.language.spellcheck works like -before) SpellCheckClientConfiguration import has been moved from -azure.cognitiveservices.language.spellcheck.spell_check_api to -azure.cognitiveservices.language.spellcheck A model MyClass from a -"models" sub-module cannot be imported anymore using -azure.cognitiveservices.language.spellcheck.models.my_class (import -from azure.cognitiveservices.language.spellcheck.models works like -before) An operation class MyClassOperations from an operations -sub-module cannot be imported anymore using -azure.cognitiveservices.language.spellcheck.operations.my_class_operations -(import from azure.cognitiveservices.language.spellcheck.operations -works like before) Last but not least, HTTP connection pooling is now -enabled by default. You should always use a client as a context manager, -or call close(), or use no more than one client per process. + - This version uses a next-generation code generator that might introduce breaking changes if from some import. In summary, some modules were incorrectly visible/importable and have been renamed. This fixed several issues caused by usage of classes that were not supposed to be used in the first place. SpellCheckClient cannot be imported from azure.cognitiveservices.language.spellcheck.spell_check_api anymore (import from azure.cognitiveservices.language.spellcheck works like before) SpellCheckClientConfiguration import has been moved from azure.cognitiveservices.language.spellcheck.spell_check_api to azure.cognitiveservices.language.spellcheck A model MyClass from a "models" sub-module cannot be imported anymore using azure.cognitiveservices.language.spellcheck.models.my_class (import from azure.cognitiveservices.language.spellcheck.models works like before) An operation class MyClassOperations from an operations sub-module cannot be imported anymore using azure.cognitiveservices.language.spellcheck.operations.my_class_operations (import from azure.cognitiveservices.language.spellcheck.operations works like before) Last but not least, HTTP connection pooling is now enabled by default. You should always use a client as a context manager, or call close(), or use no more than one client per process. ## 1.0.0 (2018-05-02) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-personalizer/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-personalizer/CHANGELOG.md index 674922afd2975..d343a07d4bb0b 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-personalizer/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-personalizer/CHANGELOG.md @@ -2,4 +2,6 @@ ## 0.1.0 (2019-05-29) +### Features Added + * Initial Release \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/CHANGELOG.md index a7749c9771b6d..18f606f2ed18f 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision/CHANGELOG.md @@ -2,7 +2,7 @@ ## 0.9.0 (2021-05-31) -**Breaking changes** +### Breaking Changes - Operation ComputerVisionClientOperationsMixin.read has a new signature - Operation ComputerVisionClientOperationsMixin.read_in_stream has a new signature diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-contentmoderator/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-vision-contentmoderator/CHANGELOG.md index aad22a020e90a..d1eb9732f0f4b 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-contentmoderator/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-contentmoderator/CHANGELOG.md @@ -2,6 +2,8 @@ ## 1.0.0 (2019-01-02) +### Features Added + - Initial stable release ## 0.1.0 (2018-02-06) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/CHANGELOG.md index f42a7c773c98e..8e469a75d2fca 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/CHANGELOG.md @@ -4,7 +4,7 @@ *Training 3.4-preview* -**Features** +### Features Added - Support for `3.4-preview` API version. diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/CHANGELOG.md index fdde4b0696075..9cf1e326e0fd8 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/CHANGELOG.md @@ -2,11 +2,11 @@ ## 0.6.0 (2021-12-02) -**Features** +### Features Added - Add support for Face Recognition Quality Score. -**Breaking changes** +### Breaking Changes - Various operations that previously accepted an optional name parameter are now required. diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/pyproject.toml b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/cognitiveservices/ci.yml b/sdk/cognitiveservices/ci.yml index 0de6ee87c488f..4786c83b8295f 100644 --- a/sdk/cognitiveservices/ci.yml +++ b/sdk/cognitiveservices/ci.yml @@ -29,10 +29,6 @@ extends: ServiceDirectory: cognitiveservices TestTimeoutInMinutes: 150 Artifacts: - - name: azure-cognitiveservices-knowledge-qnamaker - safeName: azurecognitiveservicesknowledgeqnamaker - - name: azure-cognitiveservices-language-luis - safeName: azurecognitiveserviceslanguageluis - name: azure-cognitiveservices-language-spellcheck safeName: azurecognitiveserviceslanguagespellcheck - name: azure-cognitiveservices-personalizer diff --git a/sdk/commerce/azure-mgmt-commerce/pyproject.toml b/sdk/commerce/azure-mgmt-commerce/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/commerce/azure-mgmt-commerce/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/communication/azure-communication-callautomation/pyproject.toml b/sdk/communication/azure-communication-callautomation/pyproject.toml index ff779a518143f..05ee5668ed6ac 100644 --- a/sdk/communication/azure-communication-callautomation/pyproject.toml +++ b/sdk/communication/azure-communication-callautomation/pyproject.toml @@ -2,4 +2,3 @@ mypy = false pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/communication/azure-communication-chat/pyproject.toml b/sdk/communication/azure-communication-chat/pyproject.toml index ff779a518143f..05ee5668ed6ac 100644 --- a/sdk/communication/azure-communication-chat/pyproject.toml +++ b/sdk/communication/azure-communication-chat/pyproject.toml @@ -2,4 +2,3 @@ mypy = false pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/communication/azure-communication-email/pyproject.toml b/sdk/communication/azure-communication-email/pyproject.toml index 7e21996d43175..ae6b3321db78e 100644 --- a/sdk/communication/azure-communication-email/pyproject.toml +++ b/sdk/communication/azure-communication-email/pyproject.toml @@ -1,4 +1,3 @@ [tool.azure-sdk-build] pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/communication/azure-communication-identity/pyproject.toml b/sdk/communication/azure-communication-identity/pyproject.toml index 7e21996d43175..ae6b3321db78e 100644 --- a/sdk/communication/azure-communication-identity/pyproject.toml +++ b/sdk/communication/azure-communication-identity/pyproject.toml @@ -1,4 +1,3 @@ [tool.azure-sdk-build] pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/communication/azure-communication-jobrouter/pyproject.toml b/sdk/communication/azure-communication-jobrouter/pyproject.toml index e17338ed79b71..691e599192990 100644 --- a/sdk/communication/azure-communication-jobrouter/pyproject.toml +++ b/sdk/communication/azure-communication-jobrouter/pyproject.toml @@ -1,5 +1,4 @@ [tool.azure-sdk-build] pyright = false type_check_samples = false -verifytypes = false sphinx = false diff --git a/sdk/communication/azure-communication-jobrouter/samples/classification_policy_crud_ops.py b/sdk/communication/azure-communication-jobrouter/samples/classification_policy_crud_ops.py index 99061dbbb9a2f..1561ee729eafb 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/classification_policy_crud_ops.py +++ b/sdk/communication/azure-communication-jobrouter/samples/classification_policy_crud_ops.py @@ -13,19 +13,19 @@ USAGE: python classification_policy_crud_ops.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os class ClassificationPolicySamples(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] _cp_policy_id = "sample_cp_policy" def create_classification_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._cp_policy_id # [START create_classification_policy] from azure.communication.jobrouter import ( @@ -90,7 +90,7 @@ def create_classification_policy(self): # [END create_classification_policy] def update_classification_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._cp_policy_id # [START update_classification_policy] from azure.communication.jobrouter import ( @@ -114,7 +114,7 @@ def update_classification_policy(self): # [END update_classification_policy] def get_classification_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._cp_policy_id # [START get_classification_policy] from azure.communication.jobrouter import JobRouterAdministrationClient @@ -128,7 +128,7 @@ def get_classification_policy(self): # [END get_classification_policy] def list_classification_policies_batched(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_classification_policies_batched] from azure.communication.jobrouter import JobRouterAdministrationClient @@ -147,7 +147,7 @@ def list_classification_policies_batched(self): # [END list_classification_policies_batched] def list_classification_policies(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_classification_policies] from azure.communication.jobrouter import JobRouterAdministrationClient @@ -162,7 +162,7 @@ def list_classification_policies(self): # [END list_classification_policies] def clean_up(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._cp_policy_id # [START delete_classification_policy] diff --git a/sdk/communication/azure-communication-jobrouter/samples/classification_policy_crud_ops_async.py b/sdk/communication/azure-communication-jobrouter/samples/classification_policy_crud_ops_async.py index e55538dd89bc3..a5e62048cc1aa 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/classification_policy_crud_ops_async.py +++ b/sdk/communication/azure-communication-jobrouter/samples/classification_policy_crud_ops_async.py @@ -13,7 +13,7 @@ USAGE: python classification_policy_crud_ops_async.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os @@ -21,12 +21,12 @@ class ClassificationPolicySamplesAsync(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] _cp_policy_id = "sample_cp_policy" async def create_classification_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._cp_policy_id # [START create_classification_policy_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -92,7 +92,7 @@ async def create_classification_policy(self): # [END create_classification_policy_async] async def update_classification_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._cp_policy_id # [START update_classification_policy_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -117,7 +117,7 @@ async def update_classification_policy(self): # [END update_classification_policy_async] async def get_classification_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._cp_policy_id # [START get_classification_policy_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -131,7 +131,7 @@ async def get_classification_policy(self): # [END get_classification_policy_async] async def list_classification_policies_batched(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_classification_policies_batched_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -151,7 +151,7 @@ async def list_classification_policies_batched(self): # [END list_classification_policies_batched_async] async def list_classification_policies(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_classification_policies_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -167,7 +167,7 @@ async def list_classification_policies(self): # [END list_classification_policies_async] async def clean_up(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._cp_policy_id # [START delete_classification_policy_async] diff --git a/sdk/communication/azure-communication-jobrouter/samples/distribution_policy_crud_ops.py b/sdk/communication/azure-communication-jobrouter/samples/distribution_policy_crud_ops.py index 3bfc595d7024e..e92a76e24c777 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/distribution_policy_crud_ops.py +++ b/sdk/communication/azure-communication-jobrouter/samples/distribution_policy_crud_ops.py @@ -13,19 +13,19 @@ USAGE: python distribution_policy_crud_ops.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os class DistributionPolicySamples(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] _dp_policy_id = "sample_dp_policy" def create_distribution_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._dp_policy_id # [START create_distribution_policy] from azure.communication.jobrouter import ( @@ -53,7 +53,7 @@ def create_distribution_policy(self): # [END create_distribution_policy] def update_distribution_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._dp_policy_id # [START update_distribution_policy] from azure.communication.jobrouter import ( @@ -76,7 +76,7 @@ def update_distribution_policy(self): # [END update_distribution_policy] def get_distribution_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._dp_policy_id # [START get_distribution_policy] from azure.communication.jobrouter import JobRouterAdministrationClient @@ -89,7 +89,7 @@ def get_distribution_policy(self): # [END get_distribution_policy] def list_distribution_policies(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_distribution_policies] from azure.communication.jobrouter import JobRouterAdministrationClient @@ -104,7 +104,7 @@ def list_distribution_policies(self): # [END list_distribution_policies] def list_distribution_policies_batched(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_distribution_policies_batched] from azure.communication.jobrouter import JobRouterAdministrationClient @@ -123,7 +123,7 @@ def list_distribution_policies_batched(self): # [END list_distribution_policies_batched] def clean_up(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._dp_policy_id # [START delete_distribution_policy] diff --git a/sdk/communication/azure-communication-jobrouter/samples/distribution_policy_crud_ops_async.py b/sdk/communication/azure-communication-jobrouter/samples/distribution_policy_crud_ops_async.py index 9dc5908f6296f..d592bfd337d7f 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/distribution_policy_crud_ops_async.py +++ b/sdk/communication/azure-communication-jobrouter/samples/distribution_policy_crud_ops_async.py @@ -13,7 +13,7 @@ USAGE: python distribution_policy_crud_ops_async.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os @@ -21,12 +21,12 @@ class DistributionPolicySamplesAsync(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] _dp_policy_id = "sample_dp_policy" async def create_distribution_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._dp_policy_id # [START create_distribution_policy_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -53,7 +53,7 @@ async def create_distribution_policy(self): # [END create_distribution_policy_async] async def update_distribution_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._dp_policy_id # [START update_distribution_policy_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -75,7 +75,7 @@ async def update_distribution_policy(self): # [END update_distribution_policy_async] async def get_distribution_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._dp_policy_id # [START get_distribution_policy_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -89,7 +89,7 @@ async def get_distribution_policy(self): # [END get_distribution_policy_async] async def list_distribution_policies(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_distribution_policies_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -105,7 +105,7 @@ async def list_distribution_policies(self): # [END list_distribution_policies_async] async def list_distribution_policies_batched(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_distribution_policies_batched_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -125,7 +125,7 @@ async def list_distribution_policies_batched(self): # [END list_distribution_policies_batched_async] async def clean_up(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._dp_policy_id # [START delete_distribution_policy_async] diff --git a/sdk/communication/azure-communication-jobrouter/samples/exception_policy_crud_ops.py b/sdk/communication/azure-communication-jobrouter/samples/exception_policy_crud_ops.py index 212e6a83026fb..4457c33aa5d3e 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/exception_policy_crud_ops.py +++ b/sdk/communication/azure-communication-jobrouter/samples/exception_policy_crud_ops.py @@ -13,14 +13,14 @@ USAGE: python exception_policy_crud_ops.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os class ExceptionPolicySamples(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] _ep_policy_id = "sample_ep_policy" _cp_policy_ids = [ @@ -29,7 +29,7 @@ class ExceptionPolicySamples(object): ] def setup(self): - connection_string = self.endpoint + connection_string = self.connection_string from azure.communication.jobrouter import ( JobRouterAdministrationClient, @@ -71,7 +71,7 @@ def setup(self): ) def create_exception_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._ep_policy_id # [START create_exception_policy] @@ -140,7 +140,7 @@ def create_exception_policy(self): # [END create_exception_policy] def update_exception_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._ep_policy_id # [START update_exception_policy] from azure.communication.jobrouter import ( @@ -203,7 +203,7 @@ def update_exception_policy(self): # [END update_exception_policy] def get_exception_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._ep_policy_id # [START get_exception_policy] from azure.communication.jobrouter import JobRouterAdministrationClient @@ -216,7 +216,7 @@ def get_exception_policy(self): # [END get_exception_policy] def list_exception_policies(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_exception_policies] from azure.communication.jobrouter import JobRouterAdministrationClient @@ -231,7 +231,7 @@ def list_exception_policies(self): # [END list_exception_policies] def list_exception_policies_batched(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_exception_policies_batched] from azure.communication.jobrouter import JobRouterAdministrationClient @@ -250,7 +250,7 @@ def list_exception_policies_batched(self): # [END list_exception_policies_batched] def clean_up(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._ep_policy_id # [START delete_exception_policy] diff --git a/sdk/communication/azure-communication-jobrouter/samples/exception_policy_crud_ops_async.py b/sdk/communication/azure-communication-jobrouter/samples/exception_policy_crud_ops_async.py index 7a38afeec691b..a6ced8c936266 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/exception_policy_crud_ops_async.py +++ b/sdk/communication/azure-communication-jobrouter/samples/exception_policy_crud_ops_async.py @@ -13,7 +13,7 @@ USAGE: python exception_policy_crud_ops_async.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os @@ -21,7 +21,7 @@ class ExceptionPolicySamplesAsync(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] _ep_policy_id = "sample_ep_policy" _cp_policy_ids = [ @@ -30,7 +30,7 @@ class ExceptionPolicySamplesAsync(object): ] async def setup(self): - connection_string = self.endpoint + connection_string = self.connection_string from azure.communication.jobrouter.aio import JobRouterAdministrationClient from azure.communication.jobrouter.models import ( @@ -71,7 +71,7 @@ async def setup(self): ) async def create_exception_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._ep_policy_id # [START create_exception_policy_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -138,7 +138,7 @@ async def create_exception_policy(self): # [END create_exception_policy_async] async def update_exception_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._ep_policy_id # [START update_exception_policy_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -200,7 +200,7 @@ async def update_exception_policy(self): # [END update_exception_policy_async] async def get_exception_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._ep_policy_id # [START get_exception_policy_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -214,7 +214,7 @@ async def get_exception_policy(self): # [END get_exception_policy_async] async def list_exception_policies(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_exception_policies_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -230,7 +230,7 @@ async def list_exception_policies(self): # [END list_exception_policies_async] async def list_exception_policies_batched(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_exception_policies_batched_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -250,7 +250,7 @@ async def list_exception_policies_batched(self): # [END list_exception_policies_batched_async] async def clean_up(self): - connection_string = self.endpoint + connection_string = self.connection_string policy_id = self._ep_policy_id # [START delete_exception_policy_async] diff --git a/sdk/communication/azure-communication-jobrouter/samples/job_queue_crud_ops.py b/sdk/communication/azure-communication-jobrouter/samples/job_queue_crud_ops.py index af9d4132b5b45..72859e876dd90 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/job_queue_crud_ops.py +++ b/sdk/communication/azure-communication-jobrouter/samples/job_queue_crud_ops.py @@ -13,20 +13,20 @@ USAGE: python job_queue_crud_ops.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os class JobQueueSamples(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] _job_queue_id = "sample_q_policy" _distribution_policy_id = "sample_dp_policy" def setup_distribution_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string distribution_policy_id = self._distribution_policy_id from azure.communication.jobrouter import JobRouterAdministrationClient from azure.communication.jobrouter.models import LongestIdleMode, DistributionPolicy @@ -42,7 +42,7 @@ def setup_distribution_policy(self): print(f"Sample setup completed: Created distribution policy") def create_queue(self): - connection_string = self.endpoint + connection_string = self.connection_string job_queue_id = self._job_queue_id distribution_policy_id = self._distribution_policy_id # [START create_queue] @@ -66,7 +66,7 @@ def create_queue(self): # [END create_queue] def update_queue(self): - connection_string = self.endpoint + connection_string = self.connection_string job_queue_id = self._job_queue_id # [START update_queue] from azure.communication.jobrouter import ( @@ -88,7 +88,7 @@ def update_queue(self): # [END update_queue] def get_queue(self): - connection_string = self.endpoint + connection_string = self.connection_string job_queue_id = self._job_queue_id # [START get_queue] from azure.communication.jobrouter import JobRouterAdministrationClient @@ -101,7 +101,7 @@ def get_queue(self): # [END get_queue] def get_queue_statistics(self): - connection_string = self.endpoint + connection_string = self.connection_string job_queue_id = self._job_queue_id # [START get_queue_statistics] @@ -116,7 +116,7 @@ def get_queue_statistics(self): # [END get_queue_statistics] def list_queues(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_queues] from azure.communication.jobrouter import JobRouterAdministrationClient @@ -131,7 +131,7 @@ def list_queues(self): # [END list_queues] def list_queues_batched(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_queues_batched] from azure.communication.jobrouter import JobRouterAdministrationClient @@ -150,7 +150,7 @@ def list_queues_batched(self): # [END list_queues_batched] def clean_up(self): - connection_string = self.endpoint + connection_string = self.connection_string job_queue_id = self._job_queue_id # [START delete_queue] diff --git a/sdk/communication/azure-communication-jobrouter/samples/job_queue_crud_ops_async.py b/sdk/communication/azure-communication-jobrouter/samples/job_queue_crud_ops_async.py index 2d7c810635d96..519632d7f9be7 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/job_queue_crud_ops_async.py +++ b/sdk/communication/azure-communication-jobrouter/samples/job_queue_crud_ops_async.py @@ -13,7 +13,7 @@ USAGE: python job_queue_crud_ops_async.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os @@ -21,13 +21,13 @@ class JobQueueSamplesAsync(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] _job_queue_id = "sample_q_policy" _distribution_policy_id = "sample_dp_policy" async def setup_distribution_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string distribution_policy_id = self._distribution_policy_id from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -45,7 +45,7 @@ async def setup_distribution_policy(self): print(f"Sample setup completed: Created distribution policy") async def create_queue(self): - connection_string = self.endpoint + connection_string = self.connection_string job_queue_id = self._job_queue_id distribution_policy_id = self._distribution_policy_id # [START create_queue_async] @@ -69,7 +69,7 @@ async def create_queue(self): # [END create_queue_async] async def update_queue(self): - connection_string = self.endpoint + connection_string = self.connection_string job_queue_id = self._job_queue_id # [START update_queue_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -90,7 +90,7 @@ async def update_queue(self): # [END update_queue_async] async def get_queue(self): - connection_string = self.endpoint + connection_string = self.connection_string job_queue_id = self._job_queue_id # [START get_queue_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -104,7 +104,7 @@ async def get_queue(self): # [END get_queue_async] async def get_queue_statistics(self): - connection_string = self.endpoint + connection_string = self.connection_string job_queue_id = self._job_queue_id # [START get_queue_statistics_async] @@ -120,7 +120,7 @@ async def get_queue_statistics(self): # [END get_queue_statistics_async] async def list_queues(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_queues_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -136,7 +136,7 @@ async def list_queues(self): # [END list_queues_async] async def list_queues_batched(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_queues_batched_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -156,7 +156,7 @@ async def list_queues_batched(self): # [END list_queues_batched_async] async def clean_up(self): - connection_string = self.endpoint + connection_string = self.connection_string job_queue_id = self._job_queue_id # [START delete_queue_async] diff --git a/sdk/communication/azure-communication-jobrouter/samples/router_job_crud_ops.py b/sdk/communication/azure-communication-jobrouter/samples/router_job_crud_ops.py index 2872943dab188..c7ad344aa6668 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/router_job_crud_ops.py +++ b/sdk/communication/azure-communication-jobrouter/samples/router_job_crud_ops.py @@ -13,7 +13,7 @@ USAGE: python router_job_crud_ops.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ from datetime import datetime, timedelta @@ -22,7 +22,7 @@ class RouterJobSamples(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] _job_id = "sample_job" _job_w_cp_id = "sample_job_w_cp" @@ -34,7 +34,7 @@ class RouterJobSamples(object): _worker_id = "sample_worker" def setup_distribution_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string distribution_policy_id = self._distribution_policy_id from azure.communication.jobrouter import JobRouterAdministrationClient from azure.communication.jobrouter.models import LongestIdleMode, DistributionPolicy @@ -51,7 +51,7 @@ def setup_distribution_policy(self): ) def setup_queue(self): - connection_string = self.endpoint + connection_string = self.connection_string queue_id = self._queue_id from azure.communication.jobrouter import JobRouterAdministrationClient from azure.communication.jobrouter.models import RouterQueue @@ -63,7 +63,7 @@ def setup_queue(self): ) def setup_classification_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string classification_policy_id = self._classification_policy_id from azure.communication.jobrouter import ( @@ -95,7 +95,7 @@ def setup_classification_policy(self): ) def setup_worker(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id queue_id = self._queue_id @@ -114,7 +114,7 @@ def setup_worker(self): ) def create_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id job_w_cp_id = self._job_w_cp_id scheduled_job_id = self._job_scheduled_id @@ -165,7 +165,7 @@ def create_job(self): # [END create_job] def update_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id # [START update_job] from azure.communication.jobrouter import ( @@ -182,7 +182,7 @@ def update_job(self): # [END update_job] def get_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id # [START get_job] from azure.communication.jobrouter import JobRouterClient @@ -195,7 +195,7 @@ def get_job(self): # [END get_job] def get_job_position(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id # [START get_job_position] from azure.communication.jobrouter import JobRouterClient @@ -208,7 +208,7 @@ def get_job_position(self): # [END get_job_position] def reclassify_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_w_cp_id # [START reclassify_job] from azure.communication.jobrouter import JobRouterClient @@ -221,7 +221,7 @@ def reclassify_job(self): # [END reclassify_job] def unassign_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_w_cp_id assignment_id = self._assignment_id # [START unassign_job] @@ -235,7 +235,7 @@ def unassign_job(self): # [END unassign_job] def accept_job_offer(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id worker_id = self._worker_id @@ -291,7 +291,7 @@ def accept_job_offer(self): print(f"Error encountered") def complete_and_close_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id # [START complete_job] @@ -326,7 +326,7 @@ def complete_and_close_job(self): # [END close_job] def list_jobs(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_jobs] from azure.communication.jobrouter import JobRouterClient @@ -341,7 +341,7 @@ def list_jobs(self): # [END list_jobs] def list_jobs_batched(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_jobs_batched] from azure.communication.jobrouter import JobRouterClient @@ -360,7 +360,7 @@ def list_jobs_batched(self): # [END list_jobs_batched] def list_scheduled_jobs(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_scheduled_jobs] from datetime import datetime from azure.communication.jobrouter import JobRouterClient @@ -382,7 +382,7 @@ def list_scheduled_jobs(self): # [END list_scheduled_jobs] def cancel_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_w_cp_id # [START cancel_job] @@ -395,7 +395,7 @@ def cancel_job(self): # [END cancel_job] def clean_up(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id # [START delete_job] diff --git a/sdk/communication/azure-communication-jobrouter/samples/router_job_crud_ops_async.py b/sdk/communication/azure-communication-jobrouter/samples/router_job_crud_ops_async.py index 978da9cb0b0c0..dbd7c94057076 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/router_job_crud_ops_async.py +++ b/sdk/communication/azure-communication-jobrouter/samples/router_job_crud_ops_async.py @@ -13,7 +13,7 @@ USAGE: python router_job_crud_ops_async.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os @@ -21,7 +21,7 @@ class RouterJobSamplesAsync(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] _job_id = "sample_job" _job_w_cp_id = "sample_job_w_cp" @@ -33,7 +33,7 @@ class RouterJobSamplesAsync(object): _worker_id = "sample_worker" async def setup_distribution_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string distribution_policy_id = self._distribution_policy_id from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -52,7 +52,7 @@ async def setup_distribution_policy(self): ) async def setup_queue(self): - connection_string = self.endpoint + connection_string = self.connection_string queue_id = self._queue_id from azure.communication.jobrouter.aio import JobRouterAdministrationClient from azure.communication.jobrouter.models import RouterQueue @@ -65,7 +65,7 @@ async def setup_queue(self): ) async def setup_classification_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string classification_policy_id = self._classification_policy_id from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -96,7 +96,7 @@ async def setup_classification_policy(self): ) async def setup_worker(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id queue_id = self._queue_id @@ -117,7 +117,7 @@ async def setup_worker(self): ) async def create_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id job_w_cp_id = self._job_w_cp_id scheduled_job_id = self._job_scheduled_id @@ -171,7 +171,7 @@ async def create_job(self): # [END create_job_async] async def update_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id # [START update_job_async] from azure.communication.jobrouter.aio import ( @@ -189,7 +189,7 @@ async def update_job(self): # [END update_job_async] async def get_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id # [START get_job_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -203,7 +203,7 @@ async def get_job(self): # [END get_job_async] async def get_job_position(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id # [START get_job_position_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -217,7 +217,7 @@ async def get_job_position(self): # [END get_job_position_async] async def reclassify_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_w_cp_id # [START reclassify_job_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -231,7 +231,7 @@ async def reclassify_job(self): # [END reclassify_job_async] async def unassign_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_w_cp_id assignment_id = self._assignment_id # [START unassign_job_async] @@ -245,7 +245,7 @@ async def unassign_job(self): # [END unassign_job_async] async def accept_job_offer(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id worker_id = self._worker_id @@ -304,7 +304,7 @@ async def accept_job_offer(self): print(f"Error encountered") async def complete_and_close_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id # [START complete_job_async] @@ -343,7 +343,7 @@ async def complete_and_close_job(self): # [END close_job_async] async def list_jobs(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_jobs_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -359,7 +359,7 @@ async def list_jobs(self): # [END list_jobs_async] async def list_jobs_batched(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_jobs_batched_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -379,7 +379,7 @@ async def list_jobs_batched(self): # [END list_jobs_batched_async] async def list_scheduled_jobs(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_scheduled_jobs_async] from datetime import datetime from azure.communication.jobrouter.aio import JobRouterClient @@ -402,7 +402,7 @@ async def list_scheduled_jobs(self): # [END list_scheduled_jobs_async] async def cancel_job(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_w_cp_id # [START cancel_job_async] @@ -416,7 +416,7 @@ async def cancel_job(self): # [END cancel_job_async] async def clean_up(self): - connection_string = self.endpoint + connection_string = self.connection_string job_id = self._job_id # [START delete_job_async] diff --git a/sdk/communication/azure-communication-jobrouter/samples/router_worker_crud_ops.py b/sdk/communication/azure-communication-jobrouter/samples/router_worker_crud_ops.py index 5b639ed2dcc1e..a9c1705015aca 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/router_worker_crud_ops.py +++ b/sdk/communication/azure-communication-jobrouter/samples/router_worker_crud_ops.py @@ -13,20 +13,20 @@ USAGE: python router_worker_crud_ops.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os class RouterWorkerSamples(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] _worker_id = "sample_worker" _distribution_policy_id = "sample_dp_policy" def setup_distribution_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string distribution_policy_id = self._distribution_policy_id from azure.communication.jobrouter import JobRouterAdministrationClient @@ -43,7 +43,7 @@ def setup_distribution_policy(self): print(f"Sample setup completed: Created distribution policy") def setup_queues(self): - connection_string = self.endpoint + connection_string = self.connection_string distribution_policy_id = self._distribution_policy_id from azure.communication.jobrouter import JobRouterAdministrationClient @@ -74,7 +74,7 @@ def setup_queues(self): print(f"Sample setup completed: Created queues") def create_worker(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id # [START create_worker] from azure.communication.jobrouter import ( @@ -145,7 +145,7 @@ def create_worker_w_limit_concurrent_offers(self): # [END create_worker_w_limit_concurrent_offers] def update_worker(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id # [START update_worker] from azure.communication.jobrouter import ( @@ -178,7 +178,7 @@ def update_worker(self): # [END update_worker] def get_worker(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id # [START get_worker] from azure.communication.jobrouter import JobRouterClient @@ -191,7 +191,7 @@ def get_worker(self): # [END get_worker] def register_worker(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id # [START register_worker] from azure.communication.jobrouter import JobRouterClient @@ -204,7 +204,7 @@ def register_worker(self): # [END register_worker] def deregister_worker(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id # [START deregister_worker] from azure.communication.jobrouter import JobRouterClient @@ -219,7 +219,7 @@ def deregister_worker(self): # [END deregister_worker] def list_workers(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_workers] from azure.communication.jobrouter import JobRouterClient @@ -234,7 +234,7 @@ def list_workers(self): # [END list_workers] def list_workers_batched(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_workers_batched] from azure.communication.jobrouter import JobRouterClient @@ -253,7 +253,7 @@ def list_workers_batched(self): # [END list_workers_batched] def clean_up(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id # [START delete_worker] diff --git a/sdk/communication/azure-communication-jobrouter/samples/router_worker_crud_ops_async.py b/sdk/communication/azure-communication-jobrouter/samples/router_worker_crud_ops_async.py index 58ca6d76ff703..ee461febddf84 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/router_worker_crud_ops_async.py +++ b/sdk/communication/azure-communication-jobrouter/samples/router_worker_crud_ops_async.py @@ -13,7 +13,7 @@ USAGE: python router_worker_crud_ops_async.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os @@ -21,13 +21,13 @@ class RouterWorkerSamplesAsync(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] _worker_id = "sample_worker" _distribution_policy_id = "sample_dp_policy" async def setup_distribution_policy(self): - connection_string = self.endpoint + connection_string = self.connection_string distribution_policy_id = self._distribution_policy_id from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -46,7 +46,7 @@ async def setup_distribution_policy(self): print(f"Sample setup completed: Created distribution policy") async def setup_queues(self): - connection_string = self.endpoint + connection_string = self.connection_string distribution_policy_id = self._distribution_policy_id from azure.communication.jobrouter.aio import JobRouterAdministrationClient @@ -79,7 +79,7 @@ async def setup_queues(self): print(f"Sample setup completed: Created queues") async def create_worker(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id # [START create_worker_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -148,7 +148,7 @@ async def create_worker_w_limit_concurrent_offers(self): # [END create_worker_w_limit_concurrent_offers_async] async def update_worker(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id # [START update_worker_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -180,7 +180,7 @@ async def update_worker(self): # [END update_worker_async] async def get_worker(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id # [START get_worker_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -194,7 +194,7 @@ async def get_worker(self): # [END get_worker_async] async def register_worker(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id # [START register_worker_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -210,7 +210,7 @@ async def register_worker(self): # [END register_worker_async] async def deregister_worker(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id # [START deregister_worker_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -227,7 +227,7 @@ async def deregister_worker(self): # [END deregister_worker_async] async def list_workers(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_workers_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -243,7 +243,7 @@ async def list_workers(self): # [END list_workers_async] async def list_workers_batched(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START list_workers_batched_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -263,7 +263,7 @@ async def list_workers_batched(self): # [END list_workers_batched_async] async def clean_up(self): - connection_string = self.endpoint + connection_string = self.connection_string worker_id = self._worker_id # [START delete_worker_async] diff --git a/sdk/communication/azure-communication-jobrouter/samples/sample_authentication.py b/sdk/communication/azure-communication-jobrouter/samples/sample_authentication.py index f0c5872ce90b8..87c321711fdbd 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/sample_authentication.py +++ b/sdk/communication/azure-communication-jobrouter/samples/sample_authentication.py @@ -13,17 +13,17 @@ USAGE: python sample_authentication.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os class RouterClientAuthenticationSamples(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] def create_router_client(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START auth_from_connection_string] from azure.communication.jobrouter import JobRouterClient @@ -35,7 +35,7 @@ def create_router_client(self): # [END auth_from_connection_string] def create_router_admin_client(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START admin_auth_from_connection_string] from azure.communication.jobrouter import JobRouterAdministrationClient diff --git a/sdk/communication/azure-communication-jobrouter/samples/sample_authentication_async.py b/sdk/communication/azure-communication-jobrouter/samples/sample_authentication_async.py index d24c9a4d75f21..ab84f469630ef 100644 --- a/sdk/communication/azure-communication-jobrouter/samples/sample_authentication_async.py +++ b/sdk/communication/azure-communication-jobrouter/samples/sample_authentication_async.py @@ -13,7 +13,7 @@ USAGE: python sample_authentication_async.py Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url + 1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - Communication Service connection string """ import os @@ -21,10 +21,10 @@ class RouterClientAuthenticationSamplesAsync(object): - endpoint = os.environ["AZURE_COMMUNICATION_SERVICE_ENDPOINT"] + connection_string = os.environ["AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING"] async def create_router_client(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START auth_from_connection_string_async] from azure.communication.jobrouter.aio import JobRouterClient @@ -36,7 +36,7 @@ async def create_router_client(self): # [END auth_from_connection_string_async] async def create_router_admin_client(self): - connection_string = self.endpoint + connection_string = self.connection_string # [START admin_auth_from_connection_string_async] from azure.communication.jobrouter.aio import JobRouterAdministrationClient diff --git a/sdk/communication/azure-communication-messages/pyproject.toml b/sdk/communication/azure-communication-messages/pyproject.toml index 7e21996d43175..ae6b3321db78e 100644 --- a/sdk/communication/azure-communication-messages/pyproject.toml +++ b/sdk/communication/azure-communication-messages/pyproject.toml @@ -1,4 +1,3 @@ [tool.azure-sdk-build] pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/communication/azure-communication-phonenumbers/pyproject.toml b/sdk/communication/azure-communication-phonenumbers/pyproject.toml index ff779a518143f..05ee5668ed6ac 100644 --- a/sdk/communication/azure-communication-phonenumbers/pyproject.toml +++ b/sdk/communication/azure-communication-phonenumbers/pyproject.toml @@ -2,4 +2,3 @@ mypy = false pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/communication/azure-communication-rooms/pyproject.toml b/sdk/communication/azure-communication-rooms/pyproject.toml index ff779a518143f..05ee5668ed6ac 100644 --- a/sdk/communication/azure-communication-rooms/pyproject.toml +++ b/sdk/communication/azure-communication-rooms/pyproject.toml @@ -2,4 +2,3 @@ mypy = false pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/communication/azure-communication-sms/pyproject.toml b/sdk/communication/azure-communication-sms/pyproject.toml index ff779a518143f..05ee5668ed6ac 100644 --- a/sdk/communication/azure-communication-sms/pyproject.toml +++ b/sdk/communication/azure-communication-sms/pyproject.toml @@ -2,4 +2,3 @@ mypy = false pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/communication/azure-mgmt-communication/pyproject.toml b/sdk/communication/azure-mgmt-communication/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/communication/azure-mgmt-communication/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/compute/azure-mgmt-avs/pyproject.toml b/sdk/compute/azure-mgmt-avs/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/compute/azure-mgmt-avs/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/compute/azure-mgmt-compute/pyproject.toml b/sdk/compute/azure-mgmt-compute/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/compute/azure-mgmt-imagebuilder/pyproject.toml b/sdk/compute/azure-mgmt-imagebuilder/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/compute/azure-mgmt-imagebuilder/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/compute/azure-mgmt-vmwarecloudsimple/pyproject.toml b/sdk/compute/azure-mgmt-vmwarecloudsimple/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/compute/azure-mgmt-vmwarecloudsimple/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/computefleet/azure-mgmt-computefleet/pyproject.toml b/sdk/computefleet/azure-mgmt-computefleet/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/computefleet/azure-mgmt-computefleet/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/confidentialledger/azure-confidentialledger/pyproject.toml b/sdk/confidentialledger/azure-confidentialledger/pyproject.toml index 7e21996d43175..ae6b3321db78e 100644 --- a/sdk/confidentialledger/azure-confidentialledger/pyproject.toml +++ b/sdk/confidentialledger/azure-confidentialledger/pyproject.toml @@ -1,4 +1,3 @@ [tool.azure-sdk-build] pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/confidentialledger/azure-mgmt-confidentialledger/pyproject.toml b/sdk/confidentialledger/azure-mgmt-confidentialledger/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/confluent/azure-mgmt-confluent/pyproject.toml b/sdk/confluent/azure-mgmt-confluent/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/confluent/azure-mgmt-confluent/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/pyproject.toml b/sdk/connectedvmware/azure-mgmt-connectedvmware/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/consumption/azure-mgmt-consumption/pyproject.toml b/sdk/consumption/azure-mgmt-consumption/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/consumption/azure-mgmt-consumption/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/containerinstance/azure-mgmt-containerinstance/pyproject.toml b/sdk/containerinstance/azure-mgmt-containerinstance/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/containerinstance/azure-mgmt-containerinstance/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/pyproject.toml b/sdk/containerregistry/azure-mgmt-containerregistry/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/containerservice/azure-mgmt-containerservice/pyproject.toml b/sdk/containerservice/azure-mgmt-containerservice/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/pyproject.toml b/sdk/containerservice/azure-mgmt-containerservicefleet/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/core/azure-core-experimental/pyproject.toml b/sdk/core/azure-core-experimental/pyproject.toml index ac2f0b76d799f..b2797a3242f29 100644 --- a/sdk/core/azure-core-experimental/pyproject.toml +++ b/sdk/core/azure-core-experimental/pyproject.toml @@ -1,5 +1,4 @@ [tool.azure-sdk-build] type_check_samples = false -verifytypes = false pyright = false mypy = true diff --git a/sdk/core/azure-core-tracing-opentelemetry/pyproject.toml b/sdk/core/azure-core-tracing-opentelemetry/pyproject.toml index e68e9286f1327..f9fdc05263173 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/pyproject.toml +++ b/sdk/core/azure-core-tracing-opentelemetry/pyproject.toml @@ -1,4 +1,3 @@ [tool.azure-sdk-build] type_check_samples = false -verifytypes = false pyright = false diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index f691edaed02b8..5740ca3f39893 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -6,6 +6,7 @@ - `AccessToken` now has an optional `refresh_on` attribute that can be used to specify when the token should be refreshed. #36183 - `BearerTokenCredentialPolicy` and `AsyncBearerTokenCredentialPolicy` now check the `refresh_on` attribute when determining if a token request should be made. +- Added `azure.core.AzureClouds` enum to represent the different Azure clouds. ### Breaking Changes diff --git a/sdk/core/azure-core/azure/core/__init__.py b/sdk/core/azure-core/azure/core/__init__.py index 1332b4aba45ef..d38a1045ea6e3 100644 --- a/sdk/core/azure-core/azure/core/__init__.py +++ b/sdk/core/azure-core/azure/core/__init__.py @@ -30,6 +30,7 @@ from ._pipeline_client import PipelineClient from ._match_conditions import MatchConditions +from ._azure_clouds import AzureClouds from ._enum_meta import CaseInsensitiveEnumMeta from ._pipeline_client_async import AsyncPipelineClient @@ -38,4 +39,5 @@ "MatchConditions", "CaseInsensitiveEnumMeta", "AsyncPipelineClient", + "AzureClouds", ] diff --git a/sdk/core/azure-core/azure/core/_azure_clouds.py b/sdk/core/azure-core/azure/core/_azure_clouds.py new file mode 100644 index 0000000000000..90b0c7f9984ff --- /dev/null +++ b/sdk/core/azure-core/azure/core/_azure_clouds.py @@ -0,0 +1,41 @@ +# -------------------------------------------------------------------------- +# +# 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. +# +# -------------------------------------------------------------------------- +# pylint: disable=enum-must-inherit-case-insensitive-enum-meta + +from enum import Enum + + +class AzureClouds(str, Enum): + """An enum to describe Azure Cloud.""" + + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD" + """Azure public cloud""" + + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD" + """Azure China cloud""" + + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" + """Azure US government cloud""" diff --git a/sdk/core/azure-core/azure/core/settings.py b/sdk/core/azure-core/azure/core/settings.py index d828de25807b5..1bb718a439922 100644 --- a/sdk/core/azure-core/azure/core/settings.py +++ b/sdk/core/azure-core/azure/core/settings.py @@ -33,6 +33,7 @@ import sys from typing import Type, Optional, Callable, Union, Dict, Any, TypeVar, Tuple, Generic, Mapping, List from azure.core.tracing import AbstractSpan +from ._azure_clouds import AzureClouds ValidInputType = TypeVar("ValidInputType") ValueType = TypeVar("ValueType") @@ -114,6 +115,28 @@ def convert_logging(value: Union[str, int]) -> int: return level +def convert_azure_cloud(value: Union[str, AzureClouds]) -> AzureClouds: + """Convert a string to an Azure Cloud + + :param value: the value to convert + :type value: string + :returns: An AzureClouds enum value + :rtype: AzureClouds + :raises ValueError: If conversion to AzureClouds fails + + """ + if isinstance(value, AzureClouds): + return value + if isinstance(value, str): + azure_clouds = {cloud.name: cloud for cloud in AzureClouds} + if value in azure_clouds: + return azure_clouds[value] + raise ValueError( + "Cannot convert {} to Azure Cloud, valid values are: {}".format(value, ", ".join(azure_clouds.keys())) + ) + raise ValueError("Cannot convert {} to Azure Cloud".format(value)) + + def _get_opencensus_span() -> Optional[Type[AbstractSpan]]: """Returns the OpenCensusSpan if the opencensus tracing plugin is installed else returns None. @@ -482,6 +505,13 @@ def _config(self, props: Mapping[str, Any]) -> Tuple[Any, ...]: default=None, ) + azure_cloud: PrioritizedSetting[Union[str, AzureClouds], AzureClouds] = PrioritizedSetting( + "azure_cloud", + env_var="AZURE_CLOUD", + convert=convert_azure_cloud, + default=AzureClouds.AZURE_PUBLIC_CLOUD, + ) + settings: Settings = Settings() """The settings unique instance. diff --git a/sdk/core/azure-core/tests/test_settings.py b/sdk/core/azure-core/tests/test_settings.py index 368094f3bc357..e66dd278b38c0 100644 --- a/sdk/core/azure-core/tests/test_settings.py +++ b/sdk/core/azure-core/tests/test_settings.py @@ -30,6 +30,7 @@ # module under test import azure.core.settings as m +from azure.core import AzureClouds class TestPrioritizedSetting(object): @@ -167,6 +168,10 @@ def test_convert_logging_bad(self): with pytest.raises(ValueError): m.convert_logging("junk") + def test_convert_azure_cloud(self): + with pytest.raises(ValueError): + m.convert_azure_cloud(10) + _standard_settings = ["log_level", "tracing_enabled"] @@ -184,23 +189,26 @@ def test_setting_env_var(self, name): assert ps.env_var == "AZURE_" + name.upper() def test_init(self): - assert m.settings.defaults_only == False + assert m.settings.defaults_only is False def test_config(self): val = m.settings.config(log_level=30, tracing_enabled=True) assert isinstance(val, tuple) - assert val.tracing_enabled == True + assert val.tracing_enabled is True assert val.log_level == 30 os.environ["AZURE_LOG_LEVEL"] = "debug" val = m.settings.config(tracing_enabled=False) - assert val.tracing_enabled == False + assert val.tracing_enabled is False assert val.log_level == 10 val = m.settings.config(log_level=30, tracing_enabled=False) - assert val.tracing_enabled == False + assert val.tracing_enabled is False assert val.log_level == 30 del os.environ["AZURE_LOG_LEVEL"] + val = m.settings.config(azure_cloud=AzureClouds.AZURE_US_GOVERNMENT) + assert val.azure_cloud == AzureClouds.AZURE_US_GOVERNMENT + def test_defaults(self): val = m.settings.defaults # assert isinstance(val, tuple) @@ -208,12 +216,17 @@ def test_defaults(self): assert val.log_level == defaults.log_level assert val.tracing_enabled == defaults.tracing_enabled assert val.tracing_implementation == defaults.tracing_implementation + assert val.azure_cloud == AzureClouds.AZURE_PUBLIC_CLOUD os.environ["AZURE_LOG_LEVEL"] = "debug" defaults = m.settings.config(log_level=20, tracing_enabled=False, tracing_implementation=None) assert val.log_level == defaults.log_level assert val.tracing_enabled == defaults.tracing_enabled assert val.tracing_implementation == defaults.tracing_implementation del os.environ["AZURE_LOG_LEVEL"] + os.environ["AZURE_CLOUD"] = "AZURE_PUBLIC_CLOUD" + defaults = m.settings.config(log_level=20, tracing_enabled=False, tracing_implementation=None) + assert val.azure_cloud == AzureClouds.AZURE_PUBLIC_CLOUD + del os.environ["AZURE_CLOUD"] def test_current(self): os.environ["AZURE_LOG_LEVEL"] = "debug" @@ -221,3 +234,8 @@ def test_current(self): assert isinstance(val, tuple) assert val.log_level == 10 del os.environ["AZURE_LOG_LEVEL"] + os.environ["AZURE_CLOUD"] = "AZURE_CHINA_CLOUD" + val = m.settings.current + assert isinstance(val, tuple) + assert val.azure_cloud == AzureClouds.AZURE_CHINA_CLOUD + del os.environ["AZURE_CLOUD"] diff --git a/sdk/core/azure-mgmt-core/pyproject.toml b/sdk/core/azure-mgmt-core/pyproject.toml index 121219672a10c..e17295dc55070 100644 --- a/sdk/core/azure-mgmt-core/pyproject.toml +++ b/sdk/core/azure-mgmt-core/pyproject.toml @@ -3,3 +3,4 @@ mypy = true verifytypes = true pyright = false type_check_samples = false +breaking = false diff --git a/sdk/cosmos/azure-cosmos/pyproject.toml b/sdk/cosmos/azure-cosmos/pyproject.toml index 7b159c297f47d..2c328e2831240 100644 --- a/sdk/cosmos/azure-cosmos/pyproject.toml +++ b/sdk/cosmos/azure-cosmos/pyproject.toml @@ -2,5 +2,4 @@ mypy = true pyright = false type_check_samples = false -verifytypes = false pylint = true diff --git a/sdk/cosmos/azure-cosmos/samples/transactional_batch.py b/sdk/cosmos/azure-cosmos/samples/transactional_batch.py new file mode 100644 index 0000000000000..1957bd9719891 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/samples/transactional_batch.py @@ -0,0 +1,137 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE.txt in the project root for +# license information. +# ------------------------------------------------------------------------- +import azure.cosmos.cosmos_client as cosmos_client +import azure.cosmos.exceptions as exceptions +from azure.cosmos.http_constants import StatusCodes +from azure.cosmos.partition_key import PartitionKey +import datetime + +import config + +# ---------------------------------------------------------------------------------------------------------- +# Prerequisites - +# +# 1. An Azure Cosmos account - +# https://learn.microsoft.com/azure/cosmos-db/nosql/quickstart-portal#create-account +# +# 2. Microsoft Azure Cosmos PyPi package - +# https://pypi.python.org/pypi/azure-cosmos/ +# ---------------------------------------------------------------------------------------------------------- +# Sample - demonstrates Transactional Batch for Azure Cosmos DB Python SDK +# ---------------------------------------------------------------------------------------------------------- + +HOST = config.settings['host'] +MASTER_KEY = config.settings['master_key'] +DATABASE_ID = config.settings['database_id'] +CONTAINER_ID = "batch_container" + + +def execute_item_batch(database, container): + print('\n1.11 Executing Batch Item operations\n') + + # We create three items to use for the sample. These are not part of the batch operations + container.create_item(get_sales_order("read_item")) + container.create_item(get_sales_order("delete_item")) + container.create_item(get_sales_order("replace_item")) + + # We create our batch operations + create_item_operation = ("create", (get_sales_order("create_item"),)) + upsert_item_operation = ("upsert", (get_sales_order("upsert_item"),)) + read_item_operation = ("read", ("read_item",)) + delete_item_operation = ("delete", ("delete_item",)) + replace_item_operation = ("replace", ("replace_item", {"id": "replace_item", 'account_number': 'Account1', + "message": "item was replaced"})) + replace_item_if_match_operation = ("replace", + ("replace_item", {"id": "replace_item", 'account_number': 'Account1', + "message": "item was replaced"}), + {"if_match_etag": container.client_connection.last_response_headers.get("etag")}) + replace_item_if_none_match_operation = ("replace", + ("replace_item", {"id": "replace_item", 'account_number': 'Account1', + "message": "item was replaced"}), + {"if_none_match_etag": + container.client_connection.last_response_headers.get("etag")}) + + # Put our operations into a list + batch_operations = [ + create_item_operation, + upsert_item_operation, + read_item_operation, + delete_item_operation, + replace_item_operation, + # This below operation fails with status code 412, causing batch to fail and all operations to roll back + replace_item_if_match_operation, # -> Comment this line out to see batch operations succeeding. + replace_item_if_none_match_operation] + + # Run that list of operations + try: + # Batch results are returned as a list of item operation results - or raise a CosmosBatchOperationError if + # one of the operations failed within your batch request. + batch_results = container.execute_item_batch(batch_operations=batch_operations, partition_key="Account1") + print("\nResults for the batch operations: {}\n".format(batch_results)) + + # For error handling, use try/ except with CosmosBatchOperationError and use the information in the + # error returned for your application debugging, making it easy to pinpoint the failing operation + except exceptions.CosmosBatchOperationError as e: + error_operation_index = e.error_index + error_operation_response = e.operation_responses[error_operation_index] + error_operation = batch_operations[error_operation_index] + print("\nError operation: {}, error operation response: {}\n".format(error_operation, error_operation_response)) + print("\nAn error occurred in the batch operation. All operations have been rolled back.\n") + + + # You can also use this logic to read directly from a file into the batch you'd like to create: + # with open("file_name.txt", "r") as data_file: + # container.execute_item_batch([("upsert", (t,)) for t in data_file.readlines()]) + + +def get_sales_order(item_id): + order1 = {'id': item_id, + 'account_number': 'Account1', + 'purchase_order_number': 'PO18009186470', + 'order_date': datetime.date(2005, 1, 10).strftime('%c'), + 'subtotal': 419.4589, + 'tax_amount': 12.5838, + 'freight': 472.3108, + 'total_due': 985.018, + 'items': [ + {'order_qty': 1, + 'product_id': 100, + 'unit_price': 418.4589, + 'line_price': 418.4589 + } + ], + 'ttl': 60 * 60 * 24 * 30 + } + + return order1 + + +def run_sample(): + client = cosmos_client.CosmosClient(HOST, {'masterKey': MASTER_KEY}) + try: + # setup database for this sample + db = client.create_database_if_not_exists(id=DATABASE_ID) + # setup container for this sample + container = db.create_container_if_not_exists(id=CONTAINER_ID, + partition_key=PartitionKey(path='/account_number')) + execute_item_batch(db, container) + + # cleanup database after sample + try: + client.delete_database(db) + + except exceptions.CosmosResourceNotFoundError: + pass + + except exceptions.CosmosHttpResponseError as e: + print('\nrun_sample has caught an error. {0}'.format(e.message)) + + finally: + print("\nrun_sample done") + + +if __name__ == '__main__': + run_sample() diff --git a/sdk/cosmos/azure-cosmos/samples/transactional_batch_async.py b/sdk/cosmos/azure-cosmos/samples/transactional_batch_async.py new file mode 100644 index 0000000000000..a0c98370c4a8c --- /dev/null +++ b/sdk/cosmos/azure-cosmos/samples/transactional_batch_async.py @@ -0,0 +1,141 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE.txt in the project root for +# license information. +# ------------------------------------------------------------------------- +from azure.cosmos.aio import CosmosClient +import azure.cosmos.exceptions as exceptions +from azure.cosmos.http_constants import StatusCodes +from azure.cosmos.partition_key import PartitionKey +import datetime + +import asyncio +import config + +# ---------------------------------------------------------------------------------------------------------- +# Prerequisites - +# +# 1. An Azure Cosmos account - +# https://learn.microsoft.com/azure/cosmos-db/nosql/quickstart-portal#create-account +# +# 2. Microsoft Azure Cosmos PyPi package - +# https://pypi.python.org/pypi/azure-cosmos/ +# ---------------------------------------------------------------------------------------------------------- +# Sample - demonstrates Transactional Batch for Azure Cosmos DB Python SDK async +# ---------------------------------------------------------------------------------------------------------- + +HOST = config.settings['host'] +MASTER_KEY = config.settings['master_key'] +DATABASE_ID = config.settings['database_id'] +CONTAINER_ID = "batch_container" + + +async def execute_item_batch(database, container): + print('\n1.11 Executing Batch Item operations\n') + + # We create three items to use for the sample. These are not part of the batch operations + await container.create_item(get_sales_order("read_item")) + await container.create_item(get_sales_order("delete_item")) + await container.create_item(get_sales_order("replace_item")) + + # We create our batch operations + create_item_operation = ("create", (get_sales_order("create_item"),)) + upsert_item_operation = ("upsert", (get_sales_order("upsert_item"),)) + read_item_operation = ("read", ("read_item",)) + delete_item_operation = ("delete", ("delete_item",)) + replace_item_operation = ("replace", ("replace_item", {"id": "replace_item", 'account_number': 'Account1', + "message": "item was replaced"})) + replace_item_if_match_operation = ("replace", + ("replace_item", {"id": "replace_item", 'account_number': 'Account1', + "message": "item was replaced"}), + {"if_match_etag": container.client_connection.last_response_headers.get("etag")}) + replace_item_if_none_match_operation = ("replace", + ("replace_item", {"id": "replace_item", 'account_number': 'Account1', + "message": "item was replaced"}), + {"if_none_match_etag": + container.client_connection.last_response_headers.get("etag")}) + + # Put our operations into a list + batch_operations = [ + create_item_operation, + upsert_item_operation, + read_item_operation, + delete_item_operation, + replace_item_operation, + # This below operation fails with status code 412, causing batch to fail and all operations to roll back + replace_item_if_match_operation, # -> Comment this line out to see batch operations succeeding. + replace_item_if_none_match_operation] + + # Run that list of operations + try: + # Batch results are returned as a list of item operation results - or raise a CosmosBatchOperationError if + # one of the operations failed within your batch request. + batch_results = await container.execute_item_batch(batch_operations=batch_operations, partition_key="Account1") + print("\nResults for the batch operations: {}\n".format(batch_results)) + + # For error handling, use try/ except with CosmosBatchOperationError and use the information in the + # error returned for your application debugging, making it easy to pinpoint the failing operation + except exceptions.CosmosBatchOperationError as e: + error_operation_index = e.error_index + error_operation_response = e.operation_responses[error_operation_index] + error_operation = batch_operations[error_operation_index] + print("\nError operation: {}, error operation response: {}\n".format(error_operation, error_operation_response)) + print("\nAn error occurred in the batch operation. All operations have been rolled back.\n") + + + # You can also use this logic to read directly from a file into the batch you'd like to create: + # with open("file_name.txt", "r") as data_file: + # container.execute_item_batch([("upsert", (t,)) for t in data_file.readlines()]) + + +def get_sales_order(item_id): + order1 = {'id': item_id, + 'account_number': 'Account1', + 'purchase_order_number': 'PO18009186470', + 'order_date': datetime.date(2005, 1, 10).strftime('%c'), + 'subtotal': 419.4589, + 'tax_amount': 12.5838, + 'freight': 472.3108, + 'total_due': 985.018, + 'items': [ + {'order_qty': 1, + 'product_id': 100, + 'unit_price': 418.4589, + 'line_price': 418.4589 + } + ], + 'ttl': 60 * 60 * 24 * 30 + } + + return order1 + + +async def run_sample(): + async with CosmosClient(HOST, {'masterKey': MASTER_KEY}) as client: + try: + # setup database for this sample + db = await client.create_database_if_not_exists(id=DATABASE_ID) + + # setup container for this sample + container = await db.create_container_if_not_exists(id="batch_container", + partition_key=PartitionKey(path='/account_number')) + print('Container with id \'{0}\' created'.format(CONTAINER_ID)) + + await execute_item_batch(db, container) + + # cleanup database after sample + try: + await client.delete_database(db) + + except exceptions.CosmosResourceNotFoundError: + pass + + except exceptions.CosmosHttpResponseError as e: + print('\nrun_sample has caught an error. {0}'.format(e.message)) + + finally: + print("\nrun_sample done") + + +if __name__ == '__main__': + asyncio.run(run_sample()) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/pyproject.toml b/sdk/cosmos/azure-mgmt-cosmosdb/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/cosmos/azure-mgmt-documentdb/pyproject.toml b/sdk/cosmos/azure-mgmt-documentdb/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-documentdb/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql/pyproject.toml b/sdk/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/cosmosdbforpostgresql/azure-mgmt-cosmosdbforpostgresql/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/pyproject.toml b/sdk/costmanagement/azure-mgmt-costmanagement/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/customproviders/azure-mgmt-customproviders/pyproject.toml b/sdk/customproviders/azure-mgmt-customproviders/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/customproviders/azure-mgmt-customproviders/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/dashboard/azure-mgmt-dashboard/pyproject.toml b/sdk/dashboard/azure-mgmt-dashboard/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/dashboard/azure-mgmt-dashboard/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/databox/azure-mgmt-databox/pyproject.toml b/sdk/databox/azure-mgmt-databox/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/databox/azure-mgmt-databox/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/databoxedge/azure-mgmt-databoxedge/pyproject.toml b/sdk/databoxedge/azure-mgmt-databoxedge/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/databoxedge/azure-mgmt-databoxedge/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/databricks/azure-mgmt-databricks/pyproject.toml b/sdk/databricks/azure-mgmt-databricks/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/databricks/azure-mgmt-databricks/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/datadog/azure-mgmt-datadog/pyproject.toml b/sdk/datadog/azure-mgmt-datadog/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/datadog/azure-mgmt-datadog/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/datafactory/azure-mgmt-datafactory/CHANGELOG.md b/sdk/datafactory/azure-mgmt-datafactory/CHANGELOG.md index 88ac3ff4e361e..148d576691380 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/CHANGELOG.md +++ b/sdk/datafactory/azure-mgmt-datafactory/CHANGELOG.md @@ -1,5 +1,176 @@ # Release History +## 9.0.0 (2024-08-19) + +### Features Added + + - The model or publicly exposed class 'AmazonMWSLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AmazonRdsForOracleLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AmazonRdsForSqlServerLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AmazonRedshiftLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AmazonS3CompatibleLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AmazonS3LinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AppFiguresLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AsanaLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureBatchLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureBlobFSLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureBlobStorageLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureDataExplorerLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureDataLakeAnalyticsLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureDataLakeStoreLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureDatabricksDeltaLakeLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureDatabricksLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureFileStorageLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureFileStorageLinkedService' had property 'service_endpoint' added in the current version + - The model or publicly exposed class 'AzureFileStorageLinkedService' had property 'credential' added in the current version + - The model or publicly exposed class 'AzureFunctionLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureKeyVaultLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureMLLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureMLServiceLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureMariaDBLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureMySqlLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzurePostgreSqlLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureSearchLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureSqlDWLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureSqlDatabaseLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureSqlMILinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureStorageLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureSynapseArtifactsLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureTableStorageLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureTableStorageLinkedService' had property 'service_endpoint' added in the current version + - The model or publicly exposed class 'AzureTableStorageLinkedService' had property 'credential' added in the current version + - The model or publicly exposed class 'CassandraLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'CommonDataServiceForAppsLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'CommonDataServiceForAppsLinkedService' had property 'domain' added in the current version + - The model or publicly exposed class 'ConcurLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'CosmosDbLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'CosmosDbMongoDbApiLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'CouchbaseLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'CustomDataSourceLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'DataworldLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'Db2LinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'DrillLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'DynamicsAXLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'DynamicsAuthenticationType' had property 'ACTIVE_DIRECTORY' added in the current version + - The model or publicly exposed class 'DynamicsCrmLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'DynamicsCrmLinkedService' had property 'domain' added in the current version + - The model or publicly exposed class 'DynamicsLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'DynamicsLinkedService' had property 'domain' added in the current version + - The model or publicly exposed class 'EloquaLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'ExecuteDataFlowActivity' had property 'continuation_settings' added in the current version + - The model or publicly exposed class 'ExecuteDataFlowActivityTypeProperties' had property 'continuation_settings' added in the current version + - The model or publicly exposed class 'ExecutePowerQueryActivityTypeProperties' had property 'continuation_settings' added in the __init__ method in the current version + - The model or publicly exposed class 'ExecuteWranglingDataflowActivity' had property 'continuation_settings' added in the current version + - The model or publicly exposed class 'FileServerLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'FtpServerLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'GlobalParameterType' had property 'INT' added in the current version + - The model or publicly exposed class 'GoogleAdWordsLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'GoogleBigQueryLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'GoogleBigQueryV2LinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'GoogleCloudStorageLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'GoogleSheetsLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'GreenplumLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'HBaseLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'HDInsightLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'HDInsightOnDemandLinkedService' had property 'version_type_properties_version' added in the current version + - The model or publicly exposed class 'HdfsLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'HiveLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'HttpLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'HubspotLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'ImpalaLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'InformixLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'JiraLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'LakeHouseLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'LinkedService' had property 'version' added in the current version + - The model or publicly exposed class 'MagentoLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'MariaDBLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'MarketoLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'MicrosoftAccessLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'MongoDbAtlasLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'MongoDbLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'MongoDbV2LinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'MySqlLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'NetezzaLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'NotebookParameterType' had property 'INT' added in the current version + - The model or publicly exposed class 'ODataLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'OdbcLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'Office365LinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'OracleCloudStorageLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'OracleLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'OracleServiceCloudLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'ParameterType' had property 'INT' added in the current version + - The model or publicly exposed class 'PaypalLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'PhoenixLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'PostgreSqlLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'PostgreSqlV2LinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'PrestoLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'QuickBooksLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'QuickbaseLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'ResponsysLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'RestServiceLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'RestServiceLinkedService' had property 'service_principal_credential_type' added in the current version + - The model or publicly exposed class 'RestServiceLinkedService' had property 'service_principal_embedded_cert' added in the current version + - The model or publicly exposed class 'RestServiceLinkedService' had property 'service_principal_embedded_cert_password' added in the current version + - The model or publicly exposed class 'RunQueryFilterOperator' had property 'IN' added in the current version + - The model or publicly exposed class 'SalesforceLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SalesforceMarketingCloudLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SalesforceServiceCloudLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SalesforceServiceCloudV2LinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SalesforceV2LinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SapBWLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SapCloudForCustomerLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SapEccLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SapHanaLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SapOdpLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SapOpenHubLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SapTableLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'ServiceNowLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'ServiceNowV2LinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SftpServerLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SharePointOnlineListLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SharePointOnlineListLinkedService' had property 'service_principal_credential_type' added in the current version + - The model or publicly exposed class 'SharePointOnlineListLinkedService' had property 'service_principal_embedded_cert' added in the current version + - The model or publicly exposed class 'SharePointOnlineListLinkedService' had property 'service_principal_embedded_cert_password' added in the current version + - The model or publicly exposed class 'ShopifyLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SmartsheetLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SnowflakeExportCopyCommand' had property 'storage_integration' added in the current version + - The model or publicly exposed class 'SnowflakeImportCopyCommand' had property 'storage_integration' added in the current version + - The model or publicly exposed class 'SnowflakeLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SnowflakeV2LinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SparkLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SqlServerAuthenticationType' had property 'USER_ASSIGNED_MANAGED_IDENTITY' added in the current version + - The model or publicly exposed class 'SqlServerLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'SqlServerLinkedService' had property 'credential' added in the current version + - The model or publicly exposed class 'SqlServerLinkedServiceTypeProperties' had property 'credential' added in the current version + - The model or publicly exposed class 'SquareLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'StoredProcedureParameterType' had property 'INT' added in the current version + - The model or publicly exposed class 'SybaseLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'TeamDeskLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'TeradataLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'TwilioLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'VerticaLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'VerticaLinkedService' had property 'server' added in the current version + - The model or publicly exposed class 'VerticaLinkedService' had property 'port' added in the current version + - The model or publicly exposed class 'VerticaLinkedService' had property 'uid' added in the current version + - The model or publicly exposed class 'VerticaLinkedService' had property 'database' added in the current version + - The model or publicly exposed class 'WarehouseLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'WebLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'XeroLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'ZendeskLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'ZohoLinkedService' had property 'version' added in the __init__ method in the current version + - The model or publicly exposed class 'AzureStorageLinkedServiceTypeProperties' was added in the current version + - The model or publicly exposed class 'AzureTableStorageLinkedServiceTypeProperties' was added in the current version + - The model or publicly exposed class 'ContinuationSettingsReference' was added in the current version + +### Breaking Changes + + - The 'GlobalParameterType' enum had its value 'INT_ENUM' deleted or renamed in the current version + - The model or publicly exposed class 'HDInsightOnDemandLinkedService' had its instance variable 'version' deleted or renamed in the current version + - The 'NotebookParameterType' enum had its value 'INT_ENUM' deleted or renamed in the current version + - The 'ParameterType' enum had its value 'INT_ENUM' deleted or renamed in the current version + - The 'RunQueryFilterOperator' enum had its value 'IN_ENUM' deleted or renamed in the current version + - The 'StoredProcedureParameterType' enum had its value 'INT_ENUM' deleted or renamed in the current version + ## 8.0.0 (2024-06-06) ### Features Added diff --git a/sdk/datafactory/azure-mgmt-datafactory/_meta.json b/sdk/datafactory/azure-mgmt-datafactory/_meta.json index f132eab3f42f8..7a98149e5eed0 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/_meta.json +++ b/sdk/datafactory/azure-mgmt-datafactory/_meta.json @@ -1,11 +1,11 @@ { - "commit": "92a02c9755fa3b2359df8dfc031babcddf6d91ba", + "commit": "471fbc404548c3c6611833680dbbeefcc010e201", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.16", + "@autorest/python@6.17.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/datafactory/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/python@6.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/datafactory/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.17.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/datafactory/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_data_factory_management_client.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_data_factory_management_client.py index 9d12f544c4192..127c83a86a1fb 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_data_factory_management_client.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_data_factory_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -230,7 +231,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "DataFactoryManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_serialization.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_serialization.py index 2f781d740827a..8139854b97bb8 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_serialization.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_serialization.py @@ -144,6 +144,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -1441,7 +1443,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_vendor.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_vendor.py deleted file mode 100644 index 0dafe0e287ff1..0000000000000 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_version.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_version.py index 142a0420b39b4..b77ac9246082f 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_version.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0" +VERSION = "9.0.0" diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/_data_factory_management_client.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/_data_factory_management_client.py index ec9b4794fbad1..597d4988e2b8a 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/_data_factory_management_client.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/_data_factory_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -233,7 +234,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "DataFactoryManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_activity_runs_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_activity_runs_operations.py index a45e6ed5bca21..ccfa35e15c734 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_activity_runs_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_activity_runs_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._activity_runs_operations import build_query_by_pipeline_run_request if sys.version_info >= (3, 9): @@ -173,7 +171,6 @@ async def query_by_pipeline_run( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -187,7 +184,7 @@ async def query_by_pipeline_run( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ActivityRunsQueryResponse", pipeline_response) + deserialized = self._deserialize("ActivityRunsQueryResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_change_data_capture_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_change_data_capture_operations.py index bf52dd3a28e1e..8b8fabbfbe20d 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_change_data_capture_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_change_data_capture_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._change_data_capture_operations import ( build_create_or_update_request, build_delete_request, @@ -108,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -287,7 +283,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -301,7 +296,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ChangeDataCaptureResource", pipeline_response) + deserialized = self._deserialize("ChangeDataCaptureResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -357,7 +352,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +365,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ChangeDataCaptureResource", pipeline_response) + deserialized = self._deserialize("ChangeDataCaptureResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -417,7 +411,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -473,7 +466,6 @@ async def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +521,6 @@ async def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -585,7 +576,6 @@ async def status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -599,7 +589,7 @@ async def status( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_credential_operations_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_credential_operations_operations.py index 345cf3b20aa22..894ca06edda9c 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_credential_operations_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_credential_operations_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._credential_operations_operations import ( build_create_or_update_request, build_delete_request, @@ -104,7 +102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +117,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -279,7 +275,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -293,7 +288,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CredentialResource", pipeline_response) + deserialized = self._deserialize("CredentialResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -349,7 +344,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -365,7 +359,7 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("CredentialResource", pipeline_response) + deserialized = self._deserialize("CredentialResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -411,7 +405,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_data_flow_debug_session_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_data_flow_debug_session_operations.py index f3e4c2ccbc795..7ac3b03f24e1a 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_data_flow_debug_session_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_data_flow_debug_session_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._data_flow_debug_session_operations import ( build_add_data_flow_request, build_create_request, @@ -73,7 +73,7 @@ async def _create_initial( factory_name: str, request: Union[_models.CreateDataFlowDebugSessionRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.CreateDataFlowDebugSessionResponse]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -87,7 +87,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CreateDataFlowDebugSessionResponse]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -108,10 +108,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -119,17 +119,19 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("CreateDataFlowDebugSessionResponse", pipeline_response) - if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -235,10 +237,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CreateDataFlowDebugSessionResponse", pipeline_response) + deserialized = self._deserialize("CreateDataFlowDebugSessionResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -301,7 +304,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +319,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -453,7 +454,6 @@ async def add_data_flow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -467,7 +467,7 @@ async def add_data_flow( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddDataFlowToDebugSessionResponse", pipeline_response) + deserialized = self._deserialize("AddDataFlowToDebugSessionResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -581,7 +581,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -604,7 +603,7 @@ async def _execute_command_initial( factory_name: str, request: Union[_models.DataFlowDebugCommandRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.DataFlowDebugCommandResponse]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -618,7 +617,7 @@ async def _execute_command_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.DataFlowDebugCommandResponse]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -639,10 +638,10 @@ async def _execute_command_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -650,17 +649,19 @@ async def _execute_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("DataFlowDebugCommandResponse", pipeline_response) - if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -766,10 +767,11 @@ async def begin_execute_command( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DataFlowDebugCommandResponse", pipeline_response) + deserialized = self._deserialize("DataFlowDebugCommandResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_data_flows_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_data_flows_operations.py index d8c02e74412d0..e884f876bb440 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_data_flows_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_data_flows_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._data_flows_operations import ( build_create_or_update_request, build_delete_request, @@ -194,7 +192,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -208,7 +205,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DataFlowResource", pipeline_response) + deserialized = self._deserialize("DataFlowResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -264,7 +261,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -278,7 +274,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DataFlowResource", pipeline_response) + deserialized = self._deserialize("DataFlowResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -324,7 +320,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -381,7 +376,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -397,7 +391,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_datasets_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_datasets_operations.py index 2bd7d817a9e70..9877c25864523 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_datasets_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_datasets_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._datasets_operations import ( build_create_or_update_request, build_delete_request, @@ -103,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -278,7 +274,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -292,7 +287,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatasetResource", pipeline_response) + deserialized = self._deserialize("DatasetResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -348,7 +343,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -364,7 +358,7 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("DatasetResource", pipeline_response) + deserialized = self._deserialize("DatasetResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -410,7 +404,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_exposure_control_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_exposure_control_operations.py index fc55ec9c00354..9378b4cbc2db0 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_exposure_control_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_exposure_control_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._exposure_control_operations import ( build_get_feature_value_by_factory_request, build_get_feature_value_request, @@ -158,7 +156,6 @@ async def get_feature_value( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -172,7 +169,7 @@ async def get_feature_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ExposureControlResponse", pipeline_response) + deserialized = self._deserialize("ExposureControlResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -287,7 +284,6 @@ async def get_feature_value_by_factory( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -301,7 +297,7 @@ async def get_feature_value_by_factory( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ExposureControlResponse", pipeline_response) + deserialized = self._deserialize("ExposureControlResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -419,7 +415,6 @@ async def query_feature_values_by_factory( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -433,7 +428,7 @@ async def query_feature_values_by_factory( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ExposureControlBatchResponse", pipeline_response) + deserialized = self._deserialize("ExposureControlBatchResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_factories_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_factories_operations.py index 141ac5bfd894e..909d7e58b3fce 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_factories_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_factories_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._factories_operations import ( build_configure_factory_repo_request, build_create_or_update_request, @@ -100,7 +98,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -116,7 +113,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -234,7 +230,6 @@ async def configure_factory_repo( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -248,7 +243,7 @@ async def configure_factory_repo( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Factory", pipeline_response) + deserialized = self._deserialize("Factory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -289,7 +284,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -305,7 +299,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -454,7 +447,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -468,7 +460,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Factory", pipeline_response) + deserialized = self._deserialize("Factory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -583,7 +575,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -597,7 +588,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Factory", pipeline_response) + deserialized = self._deserialize("Factory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -645,7 +636,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -661,7 +651,7 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Factory", pipeline_response) + deserialized = self._deserialize("Factory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -704,7 +694,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -829,7 +818,6 @@ async def get_git_hub_access_token( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -843,7 +831,7 @@ async def get_git_hub_access_token( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubAccessTokenResponse", pipeline_response) + deserialized = self._deserialize("GitHubAccessTokenResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -957,7 +945,6 @@ async def get_data_plane_access( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -971,7 +958,7 @@ async def get_data_plane_access( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AccessPolicyResponse", pipeline_response) + deserialized = self._deserialize("AccessPolicyResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_global_parameters_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_global_parameters_operations.py index 3ba8eb0e8fc03..e65591c4497e3 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_global_parameters_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_global_parameters_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._global_parameters_operations import ( build_create_or_update_request, build_delete_request, @@ -105,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -189,7 +185,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -203,7 +198,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalParameterResource", pipeline_response) + deserialized = self._deserialize("GlobalParameterResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -327,7 +322,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -341,7 +335,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalParameterResource", pipeline_response) + deserialized = self._deserialize("GlobalParameterResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -387,7 +381,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_integration_runtime_nodes_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_integration_runtime_nodes_operations.py index ad6d4e6ce278d..491a0c2790075 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_integration_runtime_nodes_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_integration_runtime_nodes_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._integration_runtime_nodes_operations import ( build_delete_request, build_get_ip_address_request, @@ -103,7 +101,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -117,7 +114,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SelfHostedIntegrationRuntimeNode", pipeline_response) + deserialized = self._deserialize("SelfHostedIntegrationRuntimeNode", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -166,7 +163,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +311,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -329,7 +324,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SelfHostedIntegrationRuntimeNode", pipeline_response) + deserialized = self._deserialize("SelfHostedIntegrationRuntimeNode", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +373,6 @@ async def get_ip_address( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -392,7 +386,7 @@ async def get_ip_address( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeNodeIpAddress", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeNodeIpAddress", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_integration_runtime_object_metadata_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_integration_runtime_object_metadata_operations.py index 398280e5e34e6..12eae02fd3a01 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_integration_runtime_object_metadata_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_integration_runtime_object_metadata_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,19 +16,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._integration_runtime_object_metadata_operations import build_get_request, build_refresh_request if sys.version_info >= (3, 9): @@ -60,7 +60,7 @@ def __init__(self, *args, **kwargs) -> None: async def _refresh_initial( self, resource_group_name: str, factory_name: str, integration_runtime_name: str, **kwargs: Any - ) -> Optional[_models.SsisObjectMetadataStatusResponse]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -73,7 +73,7 @@ async def _refresh_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.SsisObjectMetadataStatusResponse]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_refresh_request( resource_group_name=resource_group_name, @@ -84,10 +84,10 @@ async def _refresh_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -95,12 +95,14 @@ async def _refresh_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SsisObjectMetadataStatusResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -144,10 +146,11 @@ async def begin_refresh( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SsisObjectMetadataStatusResponse", pipeline_response) + deserialized = self._deserialize("SsisObjectMetadataStatusResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -295,7 +298,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -309,7 +311,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SsisObjectMetadataListResponse", pipeline_response) + deserialized = self._deserialize("SsisObjectMetadataListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_integration_runtimes_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_integration_runtimes_operations.py index ed69ede06e6f3..1c5791abd67ed 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_integration_runtimes_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_integration_runtimes_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._integration_runtimes_operations import ( build_create_linked_integration_runtime_request, build_create_or_update_request, @@ -120,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -136,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -299,7 +297,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -313,7 +310,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeResource", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -369,7 +366,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -385,7 +381,7 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("IntegrationRuntimeResource", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -513,7 +509,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -527,7 +522,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeResource", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -573,7 +568,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -629,7 +623,6 @@ async def get_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -643,7 +636,7 @@ async def get_status( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -691,7 +684,6 @@ async def list_outbound_network_dependencies_endpoints( # pylint: disable=name- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -706,7 +698,7 @@ async def list_outbound_network_dependencies_endpoints( # pylint: disable=name- raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize( - "IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse", pipeline_response + "IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse", pipeline_response.http_response ) if cls: @@ -754,7 +746,6 @@ async def get_connection_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -768,7 +759,7 @@ async def get_connection_info( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeConnectionInfo", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeConnectionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -897,7 +888,6 @@ async def regenerate_auth_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -911,7 +901,7 @@ async def regenerate_auth_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeAuthKeys", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeAuthKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -957,7 +947,6 @@ async def list_auth_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -971,7 +960,7 @@ async def list_auth_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeAuthKeys", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeAuthKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -980,7 +969,7 @@ async def list_auth_keys( async def _start_initial( self, resource_group_name: str, factory_name: str, integration_runtime_name: str, **kwargs: Any - ) -> Optional[_models.IntegrationRuntimeStatusResponse]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -993,7 +982,7 @@ async def _start_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.IntegrationRuntimeStatusResponse]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -1004,10 +993,10 @@ async def _start_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1015,12 +1004,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1064,10 +1055,11 @@ async def begin_start( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1089,9 +1081,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _stop_initial( # pylint: disable=inconsistent-return-statements + async def _stop_initial( self, resource_group_name: str, factory_name: str, integration_runtime_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1104,7 +1096,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -1115,10 +1107,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1126,11 +1118,19 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_stop( @@ -1157,7 +1157,7 @@ async def begin_stop( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._stop_initial( # type: ignore + raw_result = await self._stop_initial( resource_group_name=resource_group_name, factory_name=factory_name, integration_runtime_name=integration_runtime_name, @@ -1167,6 +1167,7 @@ async def begin_stop( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1230,7 +1231,6 @@ async def sync_credentials( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1287,7 +1287,6 @@ async def get_monitoring_data( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1301,7 +1300,7 @@ async def get_monitoring_data( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeMonitoringData", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeMonitoringData", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1347,7 +1346,6 @@ async def upgrade( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1488,7 +1486,6 @@ async def remove_links( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1628,7 +1625,6 @@ async def create_linked_integration_runtime( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1642,7 +1638,7 @@ async def create_linked_integration_runtime( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_linked_services_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_linked_services_operations.py index a31e4b4db3680..6f20219541a7a 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_linked_services_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_linked_services_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._linked_services_operations import ( build_create_or_update_request, build_delete_request, @@ -105,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -283,7 +279,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -297,7 +292,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LinkedServiceResource", pipeline_response) + deserialized = self._deserialize("LinkedServiceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -353,7 +348,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -369,7 +363,7 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("LinkedServiceResource", pipeline_response) + deserialized = self._deserialize("LinkedServiceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -415,7 +409,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_managed_private_endpoints_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_managed_private_endpoints_operations.py index f09e7b1641e56..da3e687c4de14 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_managed_private_endpoints_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_managed_private_endpoints_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._managed_private_endpoints_operations import ( build_create_or_update_request, build_delete_request, @@ -108,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -297,7 +293,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -311,7 +306,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedPrivateEndpointResource", pipeline_response) + deserialized = self._deserialize("ManagedPrivateEndpointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,7 +366,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -385,7 +379,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedPrivateEndpointResource", pipeline_response) + deserialized = self._deserialize("ManagedPrivateEndpointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -439,7 +433,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_managed_virtual_networks_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_managed_virtual_networks_operations.py index 4a4f128d4bae5..d393270392229 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_managed_virtual_networks_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_managed_virtual_networks_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._managed_virtual_networks_operations import ( build_create_or_update_request, build_get_request, @@ -104,7 +102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +117,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -283,7 +279,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -297,7 +292,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedVirtualNetworkResource", pipeline_response) + deserialized = self._deserialize("ManagedVirtualNetworkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -353,7 +348,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +361,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedVirtualNetworkResource", pipeline_response) + deserialized = self._deserialize("ManagedVirtualNetworkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_operations.py index a848d37430caa..d5b7a449d0840 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): @@ -87,7 +85,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -103,7 +100,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_pipeline_runs_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_pipeline_runs_operations.py index c6ae1b858107a..136dd4e28d062 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_pipeline_runs_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_pipeline_runs_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._pipeline_runs_operations import ( build_cancel_request, build_get_request, @@ -167,7 +165,6 @@ async def query_by_factory( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -181,7 +178,7 @@ async def query_by_factory( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PipelineRunsQueryResponse", pipeline_response) + deserialized = self._deserialize("PipelineRunsQueryResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -225,7 +222,6 @@ async def get(self, resource_group_name: str, factory_name: str, run_id: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -239,7 +235,7 @@ async def get(self, resource_group_name: str, factory_name: str, run_id: str, ** map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PipelineRun", pipeline_response) + deserialized = self._deserialize("PipelineRun", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -294,7 +290,6 @@ async def cancel( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_pipelines_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_pipelines_operations.py index d5e054e681598..1d7c423bdfff3 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_pipelines_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_pipelines_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._pipelines_operations import ( build_create_or_update_request, build_create_run_request, @@ -106,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -122,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -281,7 +277,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -295,7 +290,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PipelineResource", pipeline_response) + deserialized = self._deserialize("PipelineResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -351,7 +346,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +361,7 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("PipelineResource", pipeline_response) + deserialized = self._deserialize("PipelineResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -413,7 +407,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +604,6 @@ async def create_run( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -625,7 +617,7 @@ async def create_run( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CreateRunResponse", pipeline_response) + deserialized = self._deserialize("CreateRunResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_private_end_point_connections_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_private_end_point_connections_operations.py index aaa8d9cb39c24..4448a257ebc33 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_private_end_point_connections_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_private_end_point_connections_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_end_point_connections_operations import build_list_by_factory_request if sys.version_info >= (3, 9): @@ -98,7 +96,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -114,7 +111,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_private_endpoint_connection_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_private_endpoint_connection_operations.py index d444ea0bf9d6a..0708068b34b38 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_private_endpoint_connection_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_private_endpoint_connection_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connection_operations import ( build_create_or_update_request, build_delete_request, @@ -195,7 +193,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +206,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -265,7 +262,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -279,7 +275,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -325,7 +321,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_private_link_resources_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_private_link_resources_operations.py index deefa40fd5b35..0a374306c498c 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_private_link_resources_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_private_link_resources_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request if sys.version_info >= (3, 9): @@ -91,7 +89,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -105,7 +102,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_trigger_runs_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_trigger_runs_operations.py index bf3baef1b991d..83963ccb52121 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_trigger_runs_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_trigger_runs_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._trigger_runs_operations import ( build_cancel_request, build_query_by_factory_request, @@ -102,7 +100,6 @@ async def rerun( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -161,7 +158,6 @@ async def cancel( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -285,7 +281,6 @@ async def query_by_factory( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -299,7 +294,7 @@ async def query_by_factory( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggerRunsQueryResponse", pipeline_response) + deserialized = self._deserialize("TriggerRunsQueryResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_triggers_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_triggers_operations.py index 98cc206b7c9df..a5f24c3462244 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_triggers_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_triggers_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._triggers_operations import ( build_create_or_update_request, build_delete_request, @@ -111,7 +111,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -127,7 +126,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -263,7 +261,6 @@ async def query_by_factory( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -277,7 +274,7 @@ async def query_by_factory( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggerQueryResponse", pipeline_response) + deserialized = self._deserialize("TriggerQueryResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -414,7 +411,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -428,7 +424,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggerResource", pipeline_response) + deserialized = self._deserialize("TriggerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -484,7 +480,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -500,7 +495,7 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggerResource", pipeline_response) + deserialized = self._deserialize("TriggerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -546,7 +541,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -565,7 +559,7 @@ async def delete( # pylint: disable=inconsistent-return-statements async def _subscribe_to_events_initial( self, resource_group_name: str, factory_name: str, trigger_name: str, **kwargs: Any - ) -> Optional[_models.TriggerSubscriptionOperationStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -578,7 +572,7 @@ async def _subscribe_to_events_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.TriggerSubscriptionOperationStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_subscribe_to_events_request( resource_group_name=resource_group_name, @@ -589,10 +583,10 @@ async def _subscribe_to_events_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -600,12 +594,14 @@ async def _subscribe_to_events_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -649,10 +645,11 @@ async def begin_subscribe_to_events( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response) + deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -713,7 +710,6 @@ async def get_event_subscription_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -727,7 +723,7 @@ async def get_event_subscription_status( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response) + deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -736,7 +732,7 @@ async def get_event_subscription_status( async def _unsubscribe_from_events_initial( self, resource_group_name: str, factory_name: str, trigger_name: str, **kwargs: Any - ) -> Optional[_models.TriggerSubscriptionOperationStatus]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -749,7 +745,7 @@ async def _unsubscribe_from_events_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.TriggerSubscriptionOperationStatus]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_unsubscribe_from_events_request( resource_group_name=resource_group_name, @@ -760,10 +756,10 @@ async def _unsubscribe_from_events_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -771,12 +767,14 @@ async def _unsubscribe_from_events_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -820,10 +818,11 @@ async def begin_unsubscribe_from_events( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response) + deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -845,9 +844,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _start_initial( # pylint: disable=inconsistent-return-statements + async def _start_initial( self, resource_group_name: str, factory_name: str, trigger_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -860,7 +859,7 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -871,10 +870,10 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -882,11 +881,19 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_start( @@ -913,7 +920,7 @@ async def begin_start( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._start_initial( # type: ignore + raw_result = await self._start_initial( resource_group_name=resource_group_name, factory_name=factory_name, trigger_name=trigger_name, @@ -923,6 +930,7 @@ async def begin_start( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -944,9 +952,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _stop_initial( # pylint: disable=inconsistent-return-statements + async def _stop_initial( self, resource_group_name: str, factory_name: str, trigger_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -959,7 +967,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -970,10 +978,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -981,11 +989,19 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_stop( @@ -1012,7 +1028,7 @@ async def begin_stop( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._stop_initial( # type: ignore + raw_result = await self._stop_initial( resource_group_name=resource_group_name, factory_name=factory_name, trigger_name=trigger_name, @@ -1022,6 +1038,7 @@ async def begin_stop( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/__init__.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/__init__.py index 53a0c4e851d9b..5616a16fc7fbb 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/__init__.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/__init__.py @@ -119,11 +119,13 @@ from ._models_py3 import AzureSqlSource from ._models_py3 import AzureSqlTableDataset from ._models_py3 import AzureStorageLinkedService +from ._models_py3 import AzureStorageLinkedServiceTypeProperties from ._models_py3 import AzureSynapseArtifactsLinkedService from ._models_py3 import AzureTableDataset from ._models_py3 import AzureTableSink from ._models_py3 import AzureTableSource from ._models_py3 import AzureTableStorageLinkedService +from ._models_py3 import AzureTableStorageLinkedServiceTypeProperties from ._models_py3 import BigDataPoolParametrizationReference from ._models_py3 import BinaryDataset from ._models_py3 import BinaryReadSettings @@ -153,6 +155,7 @@ from ._models_py3 import ConcurObjectDataset from ._models_py3 import ConcurSource from ._models_py3 import ConnectionStateProperties +from ._models_py3 import ContinuationSettingsReference from ._models_py3 import ControlActivity from ._models_py3 import CopyActivity from ._models_py3 import CopyActivityLogSettings @@ -1037,11 +1040,13 @@ "AzureSqlSource", "AzureSqlTableDataset", "AzureStorageLinkedService", + "AzureStorageLinkedServiceTypeProperties", "AzureSynapseArtifactsLinkedService", "AzureTableDataset", "AzureTableSink", "AzureTableSource", "AzureTableStorageLinkedService", + "AzureTableStorageLinkedServiceTypeProperties", "BigDataPoolParametrizationReference", "BinaryDataset", "BinaryReadSettings", @@ -1071,6 +1076,7 @@ "ConcurObjectDataset", "ConcurSource", "ConnectionStateProperties", + "ContinuationSettingsReference", "ControlActivity", "CopyActivity", "CopyActivityLogSettings", diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_data_factory_management_client_enums.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_data_factory_management_client_enums.py index 5f07e7eab04d2..bc478c060a66a 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_data_factory_management_client_enums.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_data_factory_management_client_enums.py @@ -274,6 +274,7 @@ class DynamicsAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): OFFICE365 = "Office365" IFD = "Ifd" AAD_SERVICE_PRINCIPAL = "AADServicePrincipal" + ACTIVE_DIRECTORY = "Active Directory" class DynamicsDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -343,10 +344,11 @@ class GlobalParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): OBJECT = "Object" STRING = "String" - INT_ENUM = "Int" + INT = "Int" FLOAT = "Float" BOOL = "Bool" ARRAY = "Array" + INT_ENUM = "Int" class GoogleAdWordsAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -588,9 +590,10 @@ class NotebookParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Notebook parameter type.""" STRING = "string" - INT_ENUM = "int" + INT = "int" FLOAT = "float" BOOL = "bool" + INT_ENUM = "int" class NotebookReferenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -638,11 +641,12 @@ class ParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): OBJECT = "Object" STRING = "String" - INT_ENUM = "Int" + INT = "Int" FLOAT = "Float" BOOL = "Bool" ARRAY = "Array" SECURE_STRING = "SecureString" + INT_ENUM = "Int" class PhoenixAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -728,8 +732,9 @@ class RunQueryFilterOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): EQUALS = "Equals" NOT_EQUALS = "NotEquals" - IN_ENUM = "In" + IN = "In" NOT_IN = "NotIn" + IN_ENUM = "In" class RunQueryOrder(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -964,6 +969,7 @@ class SqlServerAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SQL = "SQL" WINDOWS = "Windows" + USER_ASSIGNED_MANAGED_IDENTITY = "UserAssignedManagedIdentity" class SqlWriteBehaviorEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1002,12 +1008,13 @@ class StoredProcedureParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta) """Stored procedure parameter type.""" STRING = "String" - INT_ENUM = "Int" + INT = "Int" INT64 = "Int64" DECIMAL = "Decimal" GUID = "Guid" BOOLEAN = "Boolean" DATE = "Date" + INT_ENUM = "Int" class SybaseAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py index c0b5f7a60d601..6415cfc305b6c 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py @@ -511,6 +511,8 @@ class LinkedService(_serialization.Model): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -528,6 +530,7 @@ class LinkedService(_serialization.Model): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -664,6 +667,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -674,6 +678,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -686,6 +692,7 @@ def __init__( super().__init__(**kwargs) self.additional_properties = additional_properties self.type: Optional[str] = None + self.version = version self.connect_via = connect_via self.description = description self.parameters = parameters @@ -702,6 +709,8 @@ class AmazonMWSLinkedService(LinkedService): # pylint: disable=too-many-instanc :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -750,6 +759,7 @@ class AmazonMWSLinkedService(LinkedService): # pylint: disable=too-many-instanc _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -774,6 +784,7 @@ def __init__( seller_id: JSON, access_key_id: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -790,6 +801,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -829,6 +842,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -1603,6 +1617,8 @@ class AmazonRdsForOracleLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -1629,6 +1645,7 @@ class AmazonRdsForOracleLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -1643,6 +1660,7 @@ def __init__( *, connection_string: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -1655,6 +1673,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -1674,6 +1694,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -1986,6 +2007,8 @@ class AmazonRdsForSqlServerLinkedService(LinkedService): # pylint: disable=too- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -2099,6 +2122,7 @@ class AmazonRdsForSqlServerLinkedService(LinkedService): # pylint: disable=too- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -2137,6 +2161,7 @@ def __init__( # pylint: disable=too-many-locals self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -2172,6 +2197,8 @@ def __init__( # pylint: disable=too-many-locals :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -2280,6 +2307,7 @@ def __init__( # pylint: disable=too-many-locals """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -3115,6 +3143,8 @@ class AmazonRedshiftLinkedService(LinkedService): # pylint: disable=too-many-in :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -3151,6 +3181,7 @@ class AmazonRedshiftLinkedService(LinkedService): # pylint: disable=too-many-in _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -3169,6 +3200,7 @@ def __init__( server: JSON, database: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -3183,6 +3215,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -3211,6 +3245,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -3469,6 +3504,8 @@ class AmazonS3CompatibleLinkedService(LinkedService): # pylint: disable=too-man :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -3503,6 +3540,7 @@ class AmazonS3CompatibleLinkedService(LinkedService): # pylint: disable=too-man _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -3518,6 +3556,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -3533,6 +3572,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -3561,6 +3602,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -4130,6 +4172,8 @@ class AmazonS3LinkedService(LinkedService): # pylint: disable=too-many-instance :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -4165,6 +4209,7 @@ class AmazonS3LinkedService(LinkedService): # pylint: disable=too-many-instance _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -4181,6 +4226,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -4197,6 +4243,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -4226,6 +4274,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -4686,6 +4735,8 @@ class AppFiguresLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -4713,6 +4764,7 @@ class AppFiguresLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -4729,6 +4781,7 @@ def __init__( password: "_models.SecretBase", client_key: "_models.SecretBase", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -4739,6 +4792,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -4757,6 +4812,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -4802,6 +4858,8 @@ class AsanaLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -4825,6 +4883,7 @@ class AsanaLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -4838,6 +4897,7 @@ def __init__( *, api_token: "_models.SecretBase", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -4849,6 +4909,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -4865,6 +4927,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -5650,6 +5713,8 @@ class AzureBatchLinkedService(LinkedService): # pylint: disable=too-many-instan :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -5689,6 +5754,7 @@ class AzureBatchLinkedService(LinkedService): # pylint: disable=too-many-instan _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -5710,6 +5776,7 @@ def __init__( pool_name: JSON, linked_service_name: "_models.LinkedServiceReference", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -5723,6 +5790,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -5752,6 +5821,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -6059,6 +6129,8 @@ class AzureBlobFSLinkedService(LinkedService): # pylint: disable=too-many-insta :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -6115,6 +6187,7 @@ class AzureBlobFSLinkedService(LinkedService): # pylint: disable=too-many-insta _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -6137,6 +6210,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -6159,6 +6233,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -6209,6 +6285,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -6826,6 +6903,8 @@ class AzureBlobStorageLinkedService(LinkedService): # pylint: disable=too-many- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -6886,6 +6965,7 @@ class AzureBlobStorageLinkedService(LinkedService): # pylint: disable=too-many- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -6910,6 +6990,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -6934,6 +7015,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -6988,6 +7071,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -7618,6 +7702,8 @@ class AzureDatabricksDeltaLakeLinkedService(LinkedService): # pylint: disable=t :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -7654,6 +7740,7 @@ class AzureDatabricksDeltaLakeLinkedService(LinkedService): # pylint: disable=t _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -7671,6 +7758,7 @@ def __init__( *, domain: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -7686,6 +7774,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -7715,6 +7805,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -7942,6 +8033,8 @@ class AzureDatabricksLinkedService(LinkedService): # pylint: disable=too-many-i :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -8026,6 +8119,7 @@ class AzureDatabricksLinkedService(LinkedService): # pylint: disable=too-many-i _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -8056,6 +8150,7 @@ def __init__( # pylint: disable=too-many-locals *, domain: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -8084,6 +8179,8 @@ def __init__( # pylint: disable=too-many-locals :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -8161,6 +8258,7 @@ def __init__( # pylint: disable=too-many-locals """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -8463,6 +8561,8 @@ class AzureDataExplorerLinkedService(LinkedService): # pylint: disable=too-many :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -8500,6 +8600,7 @@ class AzureDataExplorerLinkedService(LinkedService): # pylint: disable=too-many _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -8518,6 +8619,7 @@ def __init__( endpoint: JSON, database: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -8532,6 +8634,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -8561,6 +8665,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -8922,6 +9027,8 @@ class AzureDataLakeAnalyticsLinkedService(LinkedService): # pylint: disable=too :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -8965,6 +9072,7 @@ class AzureDataLakeAnalyticsLinkedService(LinkedService): # pylint: disable=too _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -8985,6 +9093,7 @@ def __init__( account_name: JSON, tenant: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -9001,6 +9110,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -9036,6 +9147,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -9192,6 +9304,8 @@ class AzureDataLakeStoreLinkedService(LinkedService): # pylint: disable=too-man :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -9240,6 +9354,7 @@ class AzureDataLakeStoreLinkedService(LinkedService): # pylint: disable=too-man _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -9261,6 +9376,7 @@ def __init__( *, data_lake_store_uri: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -9280,6 +9396,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -9321,6 +9439,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -9843,6 +9962,8 @@ class AzureFileStorageLinkedService(LinkedService): # pylint: disable=too-many- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -9877,6 +9998,11 @@ class AzureFileStorageLinkedService(LinkedService): # pylint: disable=too-many- :ivar encrypted_credential: The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string. :vartype encrypted_credential: str + :ivar service_endpoint: File service endpoint of the Azure File Storage resource. It is + mutually exclusive with connectionString, sasUri property. + :vartype service_endpoint: JSON + :ivar credential: The credential reference containing authentication information. + :vartype credential: ~azure.mgmt.datafactory.models.CredentialReference """ _validation = { @@ -9886,6 +10012,7 @@ class AzureFileStorageLinkedService(LinkedService): # pylint: disable=too-many- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -9900,12 +10027,15 @@ class AzureFileStorageLinkedService(LinkedService): # pylint: disable=too-many- "file_share": {"key": "typeProperties.fileShare", "type": "object"}, "snapshot": {"key": "typeProperties.snapshot", "type": "object"}, "encrypted_credential": {"key": "typeProperties.encryptedCredential", "type": "str"}, + "service_endpoint": {"key": "typeProperties.serviceEndpoint", "type": "object"}, + "credential": {"key": "typeProperties.credential", "type": "CredentialReference"}, } def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -9920,12 +10050,16 @@ def __init__( file_share: Optional[JSON] = None, snapshot: Optional[JSON] = None, encrypted_credential: Optional[str] = None, + service_endpoint: Optional[JSON] = None, + credential: Optional["_models.CredentialReference"] = None, **kwargs: Any ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -9960,9 +10094,15 @@ def __init__( :keyword encrypted_credential: The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string. :paramtype encrypted_credential: str + :keyword service_endpoint: File service endpoint of the Azure File Storage resource. It is + mutually exclusive with connectionString, sasUri property. + :paramtype service_endpoint: JSON + :keyword credential: The credential reference containing authentication information. + :paramtype credential: ~azure.mgmt.datafactory.models.CredentialReference """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -9980,6 +10120,8 @@ def __init__( self.file_share = file_share self.snapshot = snapshot self.encrypted_credential = encrypted_credential + self.service_endpoint = service_endpoint + self.credential = credential class AzureFileStorageLocation(DatasetLocation): @@ -10410,6 +10552,8 @@ class AzureFunctionLinkedService(LinkedService): # pylint: disable=too-many-ins :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -10445,6 +10589,7 @@ class AzureFunctionLinkedService(LinkedService): # pylint: disable=too-many-ins _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -10462,6 +10607,7 @@ def __init__( *, function_app_url: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -10477,6 +10623,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -10505,6 +10653,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -10530,6 +10679,8 @@ class AzureKeyVaultLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -10553,6 +10704,7 @@ class AzureKeyVaultLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -10566,6 +10718,7 @@ def __init__( *, base_url: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -10577,6 +10730,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -10593,6 +10748,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -10697,6 +10853,8 @@ class AzureMariaDBLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -10722,6 +10880,7 @@ class AzureMariaDBLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -10735,6 +10894,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -10748,6 +10908,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -10767,6 +10929,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -11320,6 +11483,8 @@ class AzureMLLinkedService(LinkedService): # pylint: disable=too-many-instance- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -11363,6 +11528,7 @@ class AzureMLLinkedService(LinkedService): # pylint: disable=too-many-instance- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -11383,6 +11549,7 @@ def __init__( ml_endpoint: JSON, api_key: "_models.SecretBase", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -11399,6 +11566,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -11434,6 +11603,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -11461,6 +11631,8 @@ class AzureMLServiceLinkedService(LinkedService): # pylint: disable=too-many-in :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -11506,6 +11678,7 @@ class AzureMLServiceLinkedService(LinkedService): # pylint: disable=too-many-in _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -11527,6 +11700,7 @@ def __init__( resource_group_name: JSON, ml_workspace_name: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -11542,6 +11716,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -11578,6 +11754,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -11783,6 +11960,8 @@ class AzureMySqlLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -11809,6 +11988,7 @@ class AzureMySqlLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -11823,6 +12003,7 @@ def __init__( *, connection_string: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -11835,6 +12016,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -11854,6 +12037,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -12191,6 +12375,8 @@ class AzurePostgreSqlLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -12216,6 +12402,7 @@ class AzurePostgreSqlLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -12229,6 +12416,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -12242,6 +12430,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -12261,6 +12451,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -12911,6 +13102,8 @@ class AzureSearchLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -12937,6 +13130,7 @@ class AzureSearchLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -12951,6 +13145,7 @@ def __init__( *, url: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -12963,6 +13158,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -12982,6 +13179,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -13004,6 +13202,8 @@ class AzureSqlDatabaseLinkedService(LinkedService): # pylint: disable=too-many- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -13142,6 +13342,7 @@ class AzureSqlDatabaseLinkedService(LinkedService): # pylint: disable=too-many- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -13187,6 +13388,7 @@ def __init__( # pylint: disable=too-many-locals self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -13229,6 +13431,8 @@ def __init__( # pylint: disable=too-many-locals :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -13362,6 +13566,7 @@ def __init__( # pylint: disable=too-many-locals """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -13774,6 +13979,8 @@ class AzureSqlDWLinkedService(LinkedService): # pylint: disable=too-many-instan :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -13910,6 +14117,7 @@ class AzureSqlDWLinkedService(LinkedService): # pylint: disable=too-many-instan _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -13951,6 +14159,7 @@ def __init__( # pylint: disable=too-many-locals self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -13992,6 +14201,8 @@ def __init__( # pylint: disable=too-many-locals :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -14122,6 +14333,7 @@ def __init__( # pylint: disable=too-many-locals """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -14647,6 +14859,8 @@ class AzureSqlMILinkedService(LinkedService): # pylint: disable=too-many-instan :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -14785,6 +14999,7 @@ class AzureSqlMILinkedService(LinkedService): # pylint: disable=too-many-instan _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -14830,6 +15045,7 @@ def __init__( # pylint: disable=too-many-locals self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -14872,6 +15088,8 @@ def __init__( # pylint: disable=too-many-locals :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -15005,6 +15223,7 @@ def __init__( # pylint: disable=too-many-locals """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -15991,6 +16210,8 @@ class AzureStorageLinkedService(LinkedService): # pylint: disable=too-many-inst :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -16021,6 +16242,7 @@ class AzureStorageLinkedService(LinkedService): # pylint: disable=too-many-inst _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -16036,6 +16258,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -16051,6 +16274,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -16075,6 +16300,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -16089,6 +16315,65 @@ def __init__( self.encrypted_credential = encrypted_credential +class AzureStorageLinkedServiceTypeProperties(_serialization.Model): + """Azure Storage linked service properties. + + :ivar connection_string: The connection string. It is mutually exclusive with sasUri property. + Type: string, SecureString or AzureKeyVaultSecretReference. + :vartype connection_string: JSON + :ivar account_key: The Azure key vault secret reference of accountKey in connection string. + :vartype account_key: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference + :ivar sas_uri: SAS URI of the Azure Storage resource. It is mutually exclusive with + connectionString property. Type: string, SecureString or AzureKeyVaultSecretReference. + :vartype sas_uri: JSON + :ivar sas_token: The Azure key vault secret reference of sasToken in sas uri. + :vartype sas_token: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference + :ivar encrypted_credential: The encrypted credential used for authentication. Credentials are + encrypted using the integration runtime credential manager. Type: string. + :vartype encrypted_credential: str + """ + + _attribute_map = { + "connection_string": {"key": "connectionString", "type": "object"}, + "account_key": {"key": "accountKey", "type": "AzureKeyVaultSecretReference"}, + "sas_uri": {"key": "sasUri", "type": "object"}, + "sas_token": {"key": "sasToken", "type": "AzureKeyVaultSecretReference"}, + "encrypted_credential": {"key": "encryptedCredential", "type": "str"}, + } + + def __init__( + self, + *, + connection_string: Optional[JSON] = None, + account_key: Optional["_models.AzureKeyVaultSecretReference"] = None, + sas_uri: Optional[JSON] = None, + sas_token: Optional["_models.AzureKeyVaultSecretReference"] = None, + encrypted_credential: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword connection_string: The connection string. It is mutually exclusive with sasUri + property. Type: string, SecureString or AzureKeyVaultSecretReference. + :paramtype connection_string: JSON + :keyword account_key: The Azure key vault secret reference of accountKey in connection string. + :paramtype account_key: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference + :keyword sas_uri: SAS URI of the Azure Storage resource. It is mutually exclusive with + connectionString property. Type: string, SecureString or AzureKeyVaultSecretReference. + :paramtype sas_uri: JSON + :keyword sas_token: The Azure key vault secret reference of sasToken in sas uri. + :paramtype sas_token: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference + :keyword encrypted_credential: The encrypted credential used for authentication. Credentials + are encrypted using the integration runtime credential manager. Type: string. + :paramtype encrypted_credential: str + """ + super().__init__(**kwargs) + self.connection_string = connection_string + self.account_key = account_key + self.sas_uri = sas_uri + self.sas_token = sas_token + self.encrypted_credential = encrypted_credential + + class AzureSynapseArtifactsLinkedService(LinkedService): """Azure Synapse Analytics (Artifacts) linked service. @@ -16099,6 +16384,8 @@ class AzureSynapseArtifactsLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -16127,6 +16414,7 @@ class AzureSynapseArtifactsLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -16141,6 +16429,7 @@ def __init__( *, endpoint: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -16153,6 +16442,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -16174,6 +16465,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -16541,6 +16833,8 @@ class AzureTableStorageLinkedService(LinkedService): # pylint: disable=too-many :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -16562,6 +16856,11 @@ class AzureTableStorageLinkedService(LinkedService): # pylint: disable=too-many :ivar encrypted_credential: The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string. :vartype encrypted_credential: str + :ivar service_endpoint: Table service endpoint of the Azure Table Storage resource. It is + mutually exclusive with connectionString, sasUri property. + :vartype service_endpoint: JSON + :ivar credential: The credential reference containing authentication information. + :vartype credential: ~azure.mgmt.datafactory.models.CredentialReference """ _validation = { @@ -16571,6 +16870,7 @@ class AzureTableStorageLinkedService(LinkedService): # pylint: disable=too-many _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -16580,12 +16880,15 @@ class AzureTableStorageLinkedService(LinkedService): # pylint: disable=too-many "sas_uri": {"key": "typeProperties.sasUri", "type": "object"}, "sas_token": {"key": "typeProperties.sasToken", "type": "AzureKeyVaultSecretReference"}, "encrypted_credential": {"key": "typeProperties.encryptedCredential", "type": "str"}, + "service_endpoint": {"key": "typeProperties.serviceEndpoint", "type": "object"}, + "credential": {"key": "typeProperties.credential", "type": "CredentialReference"}, } def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -16595,12 +16898,16 @@ def __init__( sas_uri: Optional[JSON] = None, sas_token: Optional["_models.AzureKeyVaultSecretReference"] = None, encrypted_credential: Optional[str] = None, + service_endpoint: Optional[JSON] = None, + credential: Optional["_models.CredentialReference"] = None, **kwargs: Any ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -16622,9 +16929,15 @@ def __init__( :keyword encrypted_credential: The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string. :paramtype encrypted_credential: str + :keyword service_endpoint: Table service endpoint of the Azure Table Storage resource. It is + mutually exclusive with connectionString, sasUri property. + :paramtype service_endpoint: JSON + :keyword credential: The credential reference containing authentication information. + :paramtype credential: ~azure.mgmt.datafactory.models.CredentialReference """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -16637,6 +16950,87 @@ def __init__( self.sas_uri = sas_uri self.sas_token = sas_token self.encrypted_credential = encrypted_credential + self.service_endpoint = service_endpoint + self.credential = credential + + +class AzureTableStorageLinkedServiceTypeProperties( + AzureStorageLinkedServiceTypeProperties +): # pylint: disable=name-too-long + """Azure Table Storage linked service properties. + + :ivar connection_string: The connection string. It is mutually exclusive with sasUri property. + Type: string, SecureString or AzureKeyVaultSecretReference. + :vartype connection_string: JSON + :ivar account_key: The Azure key vault secret reference of accountKey in connection string. + :vartype account_key: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference + :ivar sas_uri: SAS URI of the Azure Storage resource. It is mutually exclusive with + connectionString property. Type: string, SecureString or AzureKeyVaultSecretReference. + :vartype sas_uri: JSON + :ivar sas_token: The Azure key vault secret reference of sasToken in sas uri. + :vartype sas_token: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference + :ivar encrypted_credential: The encrypted credential used for authentication. Credentials are + encrypted using the integration runtime credential manager. Type: string. + :vartype encrypted_credential: str + :ivar service_endpoint: Table service endpoint of the Azure Table Storage resource. It is + mutually exclusive with connectionString, sasUri property. + :vartype service_endpoint: JSON + :ivar credential: The credential reference containing authentication information. + :vartype credential: ~azure.mgmt.datafactory.models.CredentialReference + """ + + _attribute_map = { + "connection_string": {"key": "connectionString", "type": "object"}, + "account_key": {"key": "accountKey", "type": "AzureKeyVaultSecretReference"}, + "sas_uri": {"key": "sasUri", "type": "object"}, + "sas_token": {"key": "sasToken", "type": "AzureKeyVaultSecretReference"}, + "encrypted_credential": {"key": "encryptedCredential", "type": "str"}, + "service_endpoint": {"key": "serviceEndpoint", "type": "object"}, + "credential": {"key": "credential", "type": "CredentialReference"}, + } + + def __init__( + self, + *, + connection_string: Optional[JSON] = None, + account_key: Optional["_models.AzureKeyVaultSecretReference"] = None, + sas_uri: Optional[JSON] = None, + sas_token: Optional["_models.AzureKeyVaultSecretReference"] = None, + encrypted_credential: Optional[str] = None, + service_endpoint: Optional[JSON] = None, + credential: Optional["_models.CredentialReference"] = None, + **kwargs: Any + ) -> None: + """ + :keyword connection_string: The connection string. It is mutually exclusive with sasUri + property. Type: string, SecureString or AzureKeyVaultSecretReference. + :paramtype connection_string: JSON + :keyword account_key: The Azure key vault secret reference of accountKey in connection string. + :paramtype account_key: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference + :keyword sas_uri: SAS URI of the Azure Storage resource. It is mutually exclusive with + connectionString property. Type: string, SecureString or AzureKeyVaultSecretReference. + :paramtype sas_uri: JSON + :keyword sas_token: The Azure key vault secret reference of sasToken in sas uri. + :paramtype sas_token: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference + :keyword encrypted_credential: The encrypted credential used for authentication. Credentials + are encrypted using the integration runtime credential manager. Type: string. + :paramtype encrypted_credential: str + :keyword service_endpoint: Table service endpoint of the Azure Table Storage resource. It is + mutually exclusive with connectionString, sasUri property. + :paramtype service_endpoint: JSON + :keyword credential: The credential reference containing authentication information. + :paramtype credential: ~azure.mgmt.datafactory.models.CredentialReference + """ + super().__init__( + connection_string=connection_string, + account_key=account_key, + sas_uri=sas_uri, + sas_token=sas_token, + encrypted_credential=encrypted_credential, + **kwargs + ) + self.service_endpoint = service_endpoint + self.credential = credential class BigDataPoolParametrizationReference(_serialization.Model): @@ -17666,6 +18060,8 @@ class CassandraLinkedService(LinkedService): # pylint: disable=too-many-instanc :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -17700,6 +18096,7 @@ class CassandraLinkedService(LinkedService): # pylint: disable=too-many-instanc _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -17717,6 +18114,7 @@ def __init__( *, host: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -17732,6 +18130,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -17760,6 +18160,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -18537,6 +18938,8 @@ class CommonDataServiceForAppsLinkedService(LinkedService): # pylint: disable=t :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -18569,9 +18972,13 @@ class CommonDataServiceForAppsLinkedService(LinkedService): # pylint: disable=t :vartype organization_name: JSON :ivar authentication_type: The authentication type to connect to Common Data Service for Apps server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario. - 'AADServicePrincipal' for Server-To-Server authentication in online scenario. Type: string (or - Expression with resultType string). Required. + 'AADServicePrincipal' for Server-To-Server authentication in online scenario, 'Active + Directory' for Dynamics on-premises with IFD. Type: string (or Expression with resultType + string). Required. :vartype authentication_type: JSON + :ivar domain: The Active Directory domain that will verify user credentials. Type: string (or + Expression with resultType string). + :vartype domain: JSON :ivar username: User name to access the Common Data Service for Apps instance. Type: string (or Expression with resultType string). :vartype username: JSON @@ -18604,6 +19011,7 @@ class CommonDataServiceForAppsLinkedService(LinkedService): # pylint: disable=t _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -18614,6 +19022,7 @@ class CommonDataServiceForAppsLinkedService(LinkedService): # pylint: disable=t "service_uri": {"key": "typeProperties.serviceUri", "type": "object"}, "organization_name": {"key": "typeProperties.organizationName", "type": "object"}, "authentication_type": {"key": "typeProperties.authenticationType", "type": "object"}, + "domain": {"key": "typeProperties.domain", "type": "object"}, "username": {"key": "typeProperties.username", "type": "object"}, "password": {"key": "typeProperties.password", "type": "SecretBase"}, "service_principal_id": {"key": "typeProperties.servicePrincipalId", "type": "object"}, @@ -18628,6 +19037,7 @@ def __init__( deployment_type: JSON, authentication_type: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -18636,6 +19046,7 @@ def __init__( port: Optional[JSON] = None, service_uri: Optional[JSON] = None, organization_name: Optional[JSON] = None, + domain: Optional[JSON] = None, username: Optional[JSON] = None, password: Optional["_models.SecretBase"] = None, service_principal_id: Optional[JSON] = None, @@ -18648,6 +19059,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -18680,9 +19093,13 @@ def __init__( :paramtype organization_name: JSON :keyword authentication_type: The authentication type to connect to Common Data Service for Apps server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario. - 'AADServicePrincipal' for Server-To-Server authentication in online scenario. Type: string (or - Expression with resultType string). Required. + 'AADServicePrincipal' for Server-To-Server authentication in online scenario, 'Active + Directory' for Dynamics on-premises with IFD. Type: string (or Expression with resultType + string). Required. :paramtype authentication_type: JSON + :keyword domain: The Active Directory domain that will verify user credentials. Type: string + (or Expression with resultType string). + :paramtype domain: JSON :keyword username: User name to access the Common Data Service for Apps instance. Type: string (or Expression with resultType string). :paramtype username: JSON @@ -18707,6 +19124,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -18720,6 +19138,7 @@ def __init__( self.service_uri = service_uri self.organization_name = organization_name self.authentication_type = authentication_type + self.domain = domain self.username = username self.password = password self.service_principal_id = service_principal_id @@ -19034,6 +19453,8 @@ class ConcurLinkedService(LinkedService): # pylint: disable=too-many-instance-a :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -19076,6 +19497,7 @@ class ConcurLinkedService(LinkedService): # pylint: disable=too-many-instance-a _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -19096,6 +19518,7 @@ def __init__( client_id: JSON, username: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -19112,6 +19535,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -19146,6 +19571,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -19400,6 +19826,45 @@ def __init__(self, **kwargs: Any) -> None: self.status = None +class ContinuationSettingsReference(_serialization.Model): + """Continuation settings for execute data flow activity. + + :ivar continuation_ttl_in_minutes: Continuation TTL in minutes. + :vartype continuation_ttl_in_minutes: JSON + :ivar idle_condition: Idle condition. + :vartype idle_condition: JSON + :ivar customized_checkpoint_key: Customized checkpoint key. + :vartype customized_checkpoint_key: JSON + """ + + _attribute_map = { + "continuation_ttl_in_minutes": {"key": "continuationTtlInMinutes", "type": "object"}, + "idle_condition": {"key": "idleCondition", "type": "object"}, + "customized_checkpoint_key": {"key": "customizedCheckpointKey", "type": "object"}, + } + + def __init__( + self, + *, + continuation_ttl_in_minutes: Optional[JSON] = None, + idle_condition: Optional[JSON] = None, + customized_checkpoint_key: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword continuation_ttl_in_minutes: Continuation TTL in minutes. + :paramtype continuation_ttl_in_minutes: JSON + :keyword idle_condition: Idle condition. + :paramtype idle_condition: JSON + :keyword customized_checkpoint_key: Customized checkpoint key. + :paramtype customized_checkpoint_key: JSON + """ + super().__init__(**kwargs) + self.continuation_ttl_in_minutes = continuation_ttl_in_minutes + self.idle_condition = idle_condition + self.customized_checkpoint_key = customized_checkpoint_key + + class CopyActivity(ExecutionActivity): # pylint: disable=too-many-instance-attributes """Copy activity. @@ -19773,6 +20238,8 @@ class CosmosDbLinkedService(LinkedService): # pylint: disable=too-many-instance :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -19829,6 +20296,7 @@ class CosmosDbLinkedService(LinkedService): # pylint: disable=too-many-instance _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -19851,6 +20319,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -19873,6 +20342,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -19924,6 +20395,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -20060,6 +20532,8 @@ class CosmosDbMongoDbApiLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -20089,6 +20563,7 @@ class CosmosDbMongoDbApiLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -20104,6 +20579,7 @@ def __init__( connection_string: JSON, database: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -20115,6 +20591,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -20136,6 +20614,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -20711,6 +21190,8 @@ class CouchbaseLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -20736,6 +21217,7 @@ class CouchbaseLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -20749,6 +21231,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -20762,6 +21245,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -20781,6 +21266,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -21645,6 +22131,8 @@ class CustomDataSourceLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -21665,6 +22153,7 @@ class CustomDataSourceLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -21677,6 +22166,7 @@ def __init__( *, type_properties: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -21687,6 +22177,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -21700,6 +22192,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -23594,6 +24087,8 @@ class DataworldLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -23617,6 +24112,7 @@ class DataworldLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -23630,6 +24126,7 @@ def __init__( *, api_token: "_models.SecretBase", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -23641,6 +24138,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -23657,6 +24156,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -23678,6 +24178,8 @@ class Db2LinkedService(LinkedService): # pylint: disable=too-many-instance-attr :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -23724,6 +24226,7 @@ class Db2LinkedService(LinkedService): # pylint: disable=too-many-instance-attr _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -23743,6 +24246,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -23762,6 +24266,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -23802,6 +24308,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -25151,6 +25658,8 @@ class DrillLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -25176,6 +25685,7 @@ class DrillLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -25189,6 +25699,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -25202,6 +25713,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -25221,6 +25734,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -25538,6 +26052,8 @@ class DynamicsAXLinkedService(LinkedService): # pylint: disable=too-many-instan :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -25580,6 +26096,7 @@ class DynamicsAXLinkedService(LinkedService): # pylint: disable=too-many-instan _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -25601,6 +26118,7 @@ def __init__( tenant: JSON, aad_resource_id: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -25612,6 +26130,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -25643,6 +26163,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -25992,6 +26513,8 @@ class DynamicsCrmLinkedService(LinkedService): # pylint: disable=too-many-insta :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -26020,9 +26543,12 @@ class DynamicsCrmLinkedService(LinkedService): # pylint: disable=too-many-insta :vartype organization_name: JSON :ivar authentication_type: The authentication type to connect to Dynamics CRM server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario, 'AADServicePrincipal' - for Server-To-Server authentication in online scenario. Type: string (or Expression with - resultType string). Required. + for Server-To-Server authentication in online scenario, 'Active Directory' for Dynamics + on-premises with IFD. Type: string (or Expression with resultType string). Required. :vartype authentication_type: JSON + :ivar domain: The Active Directory domain that will verify user credentials. Type: string (or + Expression with resultType string). + :vartype domain: JSON :ivar username: User name to access the Dynamics CRM instance. Type: string (or Expression with resultType string). :vartype username: JSON @@ -26057,6 +26583,7 @@ class DynamicsCrmLinkedService(LinkedService): # pylint: disable=too-many-insta _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -26067,6 +26594,7 @@ class DynamicsCrmLinkedService(LinkedService): # pylint: disable=too-many-insta "service_uri": {"key": "typeProperties.serviceUri", "type": "object"}, "organization_name": {"key": "typeProperties.organizationName", "type": "object"}, "authentication_type": {"key": "typeProperties.authenticationType", "type": "object"}, + "domain": {"key": "typeProperties.domain", "type": "object"}, "username": {"key": "typeProperties.username", "type": "object"}, "password": {"key": "typeProperties.password", "type": "SecretBase"}, "service_principal_id": {"key": "typeProperties.servicePrincipalId", "type": "object"}, @@ -26082,6 +26610,7 @@ def __init__( deployment_type: JSON, authentication_type: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -26090,6 +26619,7 @@ def __init__( port: Optional[JSON] = None, service_uri: Optional[JSON] = None, organization_name: Optional[JSON] = None, + domain: Optional[JSON] = None, username: Optional[JSON] = None, password: Optional["_models.SecretBase"] = None, service_principal_id: Optional[JSON] = None, @@ -26103,6 +26633,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -26132,9 +26664,12 @@ def __init__( :paramtype organization_name: JSON :keyword authentication_type: The authentication type to connect to Dynamics CRM server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario, 'AADServicePrincipal' - for Server-To-Server authentication in online scenario. Type: string (or Expression with - resultType string). Required. + for Server-To-Server authentication in online scenario, 'Active Directory' for Dynamics + on-premises with IFD. Type: string (or Expression with resultType string). Required. :paramtype authentication_type: JSON + :keyword domain: The Active Directory domain that will verify user credentials. Type: string + (or Expression with resultType string). + :paramtype domain: JSON :keyword username: User name to access the Dynamics CRM instance. Type: string (or Expression with resultType string). :paramtype username: JSON @@ -26161,6 +26696,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -26174,6 +26710,7 @@ def __init__( self.service_uri = service_uri self.organization_name = organization_name self.authentication_type = authentication_type + self.domain = domain self.username = username self.password = password self.service_principal_id = service_principal_id @@ -26511,6 +27048,8 @@ class DynamicsLinkedService(LinkedService): # pylint: disable=too-many-instance :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -26539,9 +27078,12 @@ class DynamicsLinkedService(LinkedService): # pylint: disable=too-many-instance :vartype organization_name: JSON :ivar authentication_type: The authentication type to connect to Dynamics server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario, 'AADServicePrincipal' for - Server-To-Server authentication in online scenario. Type: string (or Expression with resultType - string). Required. + Server-To-Server authentication in online scenario, 'Active Directory' for Dynamics on-premises + with IFD. Type: string (or Expression with resultType string). Required. :vartype authentication_type: JSON + :ivar domain: The Active Directory domain that will verify user credentials. Type: string (or + Expression with resultType string). + :vartype domain: JSON :ivar username: User name to access the Dynamics instance. Type: string (or Expression with resultType string). :vartype username: JSON @@ -26576,6 +27118,7 @@ class DynamicsLinkedService(LinkedService): # pylint: disable=too-many-instance _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -26586,6 +27129,7 @@ class DynamicsLinkedService(LinkedService): # pylint: disable=too-many-instance "service_uri": {"key": "typeProperties.serviceUri", "type": "object"}, "organization_name": {"key": "typeProperties.organizationName", "type": "object"}, "authentication_type": {"key": "typeProperties.authenticationType", "type": "object"}, + "domain": {"key": "typeProperties.domain", "type": "object"}, "username": {"key": "typeProperties.username", "type": "object"}, "password": {"key": "typeProperties.password", "type": "SecretBase"}, "service_principal_id": {"key": "typeProperties.servicePrincipalId", "type": "object"}, @@ -26601,6 +27145,7 @@ def __init__( deployment_type: JSON, authentication_type: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -26609,6 +27154,7 @@ def __init__( port: Optional[JSON] = None, service_uri: Optional[JSON] = None, organization_name: Optional[JSON] = None, + domain: Optional[JSON] = None, username: Optional[JSON] = None, password: Optional["_models.SecretBase"] = None, service_principal_id: Optional[JSON] = None, @@ -26622,6 +27168,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -26650,9 +27198,12 @@ def __init__( :paramtype organization_name: JSON :keyword authentication_type: The authentication type to connect to Dynamics server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario, 'AADServicePrincipal' - for Server-To-Server authentication in online scenario. Type: string (or Expression with - resultType string). Required. + for Server-To-Server authentication in online scenario, 'Active Directory' for Dynamics + on-premises with IFD. Type: string (or Expression with resultType string). Required. :paramtype authentication_type: JSON + :keyword domain: The Active Directory domain that will verify user credentials. Type: string + (or Expression with resultType string). + :paramtype domain: JSON :keyword username: User name to access the Dynamics instance. Type: string (or Expression with resultType string). :paramtype username: JSON @@ -26679,6 +27230,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -26692,6 +27244,7 @@ def __init__( self.service_uri = service_uri self.organization_name = organization_name self.authentication_type = authentication_type + self.domain = domain self.username = username self.password = password self.service_principal_id = service_principal_id @@ -26925,6 +27478,8 @@ class EloquaLinkedService(LinkedService): # pylint: disable=too-many-instance-a :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -26964,6 +27519,7 @@ class EloquaLinkedService(LinkedService): # pylint: disable=too-many-instance-a _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -26983,6 +27539,7 @@ def __init__( endpoint: JSON, username: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -26998,6 +27555,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -27029,6 +27588,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -27661,6 +28221,8 @@ class ExecuteDataFlowActivity(ExecutionActivity): # pylint: disable=too-many-in :vartype staging: ~azure.mgmt.datafactory.models.DataFlowStagingInfo :ivar integration_runtime: The integration runtime reference. :vartype integration_runtime: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :ivar continuation_settings: Continuation settings for execute data flow activity. + :vartype continuation_settings: ~azure.mgmt.datafactory.models.ContinuationSettingsReference :ivar compute: Compute properties for data flow activity. :vartype compute: ~azure.mgmt.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute :ivar trace_level: Trace level setting used for data flow monitoring output. Supported values @@ -27698,6 +28260,10 @@ class ExecuteDataFlowActivity(ExecutionActivity): # pylint: disable=too-many-in "data_flow": {"key": "typeProperties.dataFlow", "type": "DataFlowReference"}, "staging": {"key": "typeProperties.staging", "type": "DataFlowStagingInfo"}, "integration_runtime": {"key": "typeProperties.integrationRuntime", "type": "IntegrationRuntimeReference"}, + "continuation_settings": { + "key": "typeProperties.continuationSettings", + "type": "ContinuationSettingsReference", + }, "compute": {"key": "typeProperties.compute", "type": "ExecuteDataFlowActivityTypePropertiesCompute"}, "trace_level": {"key": "typeProperties.traceLevel", "type": "object"}, "continue_on_error": {"key": "typeProperties.continueOnError", "type": "object"}, @@ -27720,6 +28286,7 @@ def __init__( policy: Optional["_models.ActivityPolicy"] = None, staging: Optional["_models.DataFlowStagingInfo"] = None, integration_runtime: Optional["_models.IntegrationRuntimeReference"] = None, + continuation_settings: Optional["_models.ContinuationSettingsReference"] = None, compute: Optional["_models.ExecuteDataFlowActivityTypePropertiesCompute"] = None, trace_level: Optional[JSON] = None, continue_on_error: Optional[JSON] = None, @@ -27756,6 +28323,8 @@ def __init__( :paramtype staging: ~azure.mgmt.datafactory.models.DataFlowStagingInfo :keyword integration_runtime: The integration runtime reference. :paramtype integration_runtime: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :keyword continuation_settings: Continuation settings for execute data flow activity. + :paramtype continuation_settings: ~azure.mgmt.datafactory.models.ContinuationSettingsReference :keyword compute: Compute properties for data flow activity. :paramtype compute: ~azure.mgmt.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute :keyword trace_level: Trace level setting used for data flow monitoring output. Supported @@ -27788,6 +28357,7 @@ def __init__( self.data_flow = data_flow self.staging = staging self.integration_runtime = integration_runtime + self.continuation_settings = continuation_settings self.compute = compute self.trace_level = trace_level self.continue_on_error = continue_on_error @@ -27806,6 +28376,8 @@ class ExecuteDataFlowActivityTypeProperties(_serialization.Model): :vartype staging: ~azure.mgmt.datafactory.models.DataFlowStagingInfo :ivar integration_runtime: The integration runtime reference. :vartype integration_runtime: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :ivar continuation_settings: Continuation settings for execute data flow activity. + :vartype continuation_settings: ~azure.mgmt.datafactory.models.ContinuationSettingsReference :ivar compute: Compute properties for data flow activity. :vartype compute: ~azure.mgmt.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute :ivar trace_level: Trace level setting used for data flow monitoring output. Supported values @@ -27831,6 +28403,7 @@ class ExecuteDataFlowActivityTypeProperties(_serialization.Model): "data_flow": {"key": "dataFlow", "type": "DataFlowReference"}, "staging": {"key": "staging", "type": "DataFlowStagingInfo"}, "integration_runtime": {"key": "integrationRuntime", "type": "IntegrationRuntimeReference"}, + "continuation_settings": {"key": "continuationSettings", "type": "ContinuationSettingsReference"}, "compute": {"key": "compute", "type": "ExecuteDataFlowActivityTypePropertiesCompute"}, "trace_level": {"key": "traceLevel", "type": "object"}, "continue_on_error": {"key": "continueOnError", "type": "object"}, @@ -27844,6 +28417,7 @@ def __init__( data_flow: "_models.DataFlowReference", staging: Optional["_models.DataFlowStagingInfo"] = None, integration_runtime: Optional["_models.IntegrationRuntimeReference"] = None, + continuation_settings: Optional["_models.ContinuationSettingsReference"] = None, compute: Optional["_models.ExecuteDataFlowActivityTypePropertiesCompute"] = None, trace_level: Optional[JSON] = None, continue_on_error: Optional[JSON] = None, @@ -27858,6 +28432,8 @@ def __init__( :paramtype staging: ~azure.mgmt.datafactory.models.DataFlowStagingInfo :keyword integration_runtime: The integration runtime reference. :paramtype integration_runtime: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :keyword continuation_settings: Continuation settings for execute data flow activity. + :paramtype continuation_settings: ~azure.mgmt.datafactory.models.ContinuationSettingsReference :keyword compute: Compute properties for data flow activity. :paramtype compute: ~azure.mgmt.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute :keyword trace_level: Trace level setting used for data flow monitoring output. Supported @@ -27878,6 +28454,7 @@ def __init__( self.data_flow = data_flow self.staging = staging self.integration_runtime = integration_runtime + self.continuation_settings = continuation_settings self.compute = compute self.trace_level = trace_level self.continue_on_error = continue_on_error @@ -28075,7 +28652,9 @@ def __init__( self.secure_input = secure_input -class ExecutePowerQueryActivityTypeProperties(ExecuteDataFlowActivityTypeProperties): +class ExecutePowerQueryActivityTypeProperties( + ExecuteDataFlowActivityTypeProperties +): # pylint: disable=too-many-instance-attributes """Execute power query data flow activity properties. All required parameters must be populated in order to send to server. @@ -28086,6 +28665,8 @@ class ExecutePowerQueryActivityTypeProperties(ExecuteDataFlowActivityTypePropert :vartype staging: ~azure.mgmt.datafactory.models.DataFlowStagingInfo :ivar integration_runtime: The integration runtime reference. :vartype integration_runtime: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :ivar continuation_settings: Continuation settings for execute data flow activity. + :vartype continuation_settings: ~azure.mgmt.datafactory.models.ContinuationSettingsReference :ivar compute: Compute properties for data flow activity. :vartype compute: ~azure.mgmt.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute :ivar trace_level: Trace level setting used for data flow monitoring output. Supported values @@ -28116,6 +28697,7 @@ class ExecutePowerQueryActivityTypeProperties(ExecuteDataFlowActivityTypePropert "data_flow": {"key": "dataFlow", "type": "DataFlowReference"}, "staging": {"key": "staging", "type": "DataFlowStagingInfo"}, "integration_runtime": {"key": "integrationRuntime", "type": "IntegrationRuntimeReference"}, + "continuation_settings": {"key": "continuationSettings", "type": "ContinuationSettingsReference"}, "compute": {"key": "compute", "type": "ExecuteDataFlowActivityTypePropertiesCompute"}, "trace_level": {"key": "traceLevel", "type": "object"}, "continue_on_error": {"key": "continueOnError", "type": "object"}, @@ -28131,6 +28713,7 @@ def __init__( data_flow: "_models.DataFlowReference", staging: Optional["_models.DataFlowStagingInfo"] = None, integration_runtime: Optional["_models.IntegrationRuntimeReference"] = None, + continuation_settings: Optional["_models.ContinuationSettingsReference"] = None, compute: Optional["_models.ExecuteDataFlowActivityTypePropertiesCompute"] = None, trace_level: Optional[JSON] = None, continue_on_error: Optional[JSON] = None, @@ -28147,6 +28730,8 @@ def __init__( :paramtype staging: ~azure.mgmt.datafactory.models.DataFlowStagingInfo :keyword integration_runtime: The integration runtime reference. :paramtype integration_runtime: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :keyword continuation_settings: Continuation settings for execute data flow activity. + :paramtype continuation_settings: ~azure.mgmt.datafactory.models.ContinuationSettingsReference :keyword compute: Compute properties for data flow activity. :paramtype compute: ~azure.mgmt.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute :keyword trace_level: Trace level setting used for data flow monitoring output. Supported @@ -28172,6 +28757,7 @@ def __init__( data_flow=data_flow, staging=staging, integration_runtime=integration_runtime, + continuation_settings=continuation_settings, compute=compute, trace_level=trace_level, continue_on_error=continue_on_error, @@ -28424,6 +29010,8 @@ class ExecuteWranglingDataflowActivity(Activity): # pylint: disable=too-many-in :vartype staging: ~azure.mgmt.datafactory.models.DataFlowStagingInfo :ivar integration_runtime: The integration runtime reference. :vartype integration_runtime: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :ivar continuation_settings: Continuation settings for execute data flow activity. + :vartype continuation_settings: ~azure.mgmt.datafactory.models.ContinuationSettingsReference :ivar compute: Compute properties for data flow activity. :vartype compute: ~azure.mgmt.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute :ivar trace_level: Trace level setting used for data flow monitoring output. Supported values @@ -28465,6 +29053,10 @@ class ExecuteWranglingDataflowActivity(Activity): # pylint: disable=too-many-in "data_flow": {"key": "typeProperties.dataFlow", "type": "DataFlowReference"}, "staging": {"key": "typeProperties.staging", "type": "DataFlowStagingInfo"}, "integration_runtime": {"key": "typeProperties.integrationRuntime", "type": "IntegrationRuntimeReference"}, + "continuation_settings": { + "key": "typeProperties.continuationSettings", + "type": "ContinuationSettingsReference", + }, "compute": {"key": "typeProperties.compute", "type": "ExecuteDataFlowActivityTypePropertiesCompute"}, "trace_level": {"key": "typeProperties.traceLevel", "type": "object"}, "continue_on_error": {"key": "typeProperties.continueOnError", "type": "object"}, @@ -28488,6 +29080,7 @@ def __init__( policy: Optional["_models.ActivityPolicy"] = None, staging: Optional["_models.DataFlowStagingInfo"] = None, integration_runtime: Optional["_models.IntegrationRuntimeReference"] = None, + continuation_settings: Optional["_models.ContinuationSettingsReference"] = None, compute: Optional["_models.ExecuteDataFlowActivityTypePropertiesCompute"] = None, trace_level: Optional[JSON] = None, continue_on_error: Optional[JSON] = None, @@ -28524,6 +29117,8 @@ def __init__( :paramtype staging: ~azure.mgmt.datafactory.models.DataFlowStagingInfo :keyword integration_runtime: The integration runtime reference. :paramtype integration_runtime: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference + :keyword continuation_settings: Continuation settings for execute data flow activity. + :paramtype continuation_settings: ~azure.mgmt.datafactory.models.ContinuationSettingsReference :keyword compute: Compute properties for data flow activity. :paramtype compute: ~azure.mgmt.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute :keyword trace_level: Trace level setting used for data flow monitoring output. Supported @@ -28560,6 +29155,7 @@ def __init__( self.data_flow = data_flow self.staging = staging self.integration_runtime = integration_runtime + self.continuation_settings = continuation_settings self.compute = compute self.trace_level = trace_level self.continue_on_error = continue_on_error @@ -29483,7 +30079,7 @@ def __init__( self.error_code = error_code -class FileServerLinkedService(LinkedService): +class FileServerLinkedService(LinkedService): # pylint: disable=too-many-instance-attributes """File system linked service. All required parameters must be populated in order to send to server. @@ -29493,6 +30089,8 @@ class FileServerLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -29522,6 +30120,7 @@ class FileServerLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -29537,6 +30136,7 @@ def __init__( *, host: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -29550,6 +30150,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -29572,6 +30174,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -30666,6 +31269,8 @@ class FtpServerLinkedService(LinkedService): # pylint: disable=too-many-instanc :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -30708,6 +31313,7 @@ class FtpServerLinkedService(LinkedService): # pylint: disable=too-many-instanc _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -30730,6 +31336,7 @@ def __init__( *, host: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -30747,6 +31354,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -30782,6 +31391,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -31219,7 +31829,7 @@ class GlobalParameterSpecification(_serialization.Model): All required parameters must be populated in order to send to server. :ivar type: Global Parameter type. Required. Known values are: "Object", "String", "Int", - "Float", "Bool", and "Array". + "Float", "Bool", "Array", and "Int". :vartype type: str or ~azure.mgmt.datafactory.models.GlobalParameterType :ivar value: Value of parameter. Required. :vartype value: JSON @@ -31238,7 +31848,7 @@ class GlobalParameterSpecification(_serialization.Model): def __init__(self, *, type: Union[str, "_models.GlobalParameterType"], value: JSON, **kwargs: Any) -> None: """ :keyword type: Global Parameter type. Required. Known values are: "Object", "String", "Int", - "Float", "Bool", and "Array". + "Float", "Bool", "Array", and "Int". :paramtype type: str or ~azure.mgmt.datafactory.models.GlobalParameterType :keyword value: Value of parameter. Required. :paramtype value: JSON @@ -31258,6 +31868,8 @@ class GoogleAdWordsLinkedService(LinkedService): # pylint: disable=too-many-ins :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -31333,6 +31945,7 @@ class GoogleAdWordsLinkedService(LinkedService): # pylint: disable=too-many-ins _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -31359,6 +31972,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -31385,6 +31999,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -31455,6 +32071,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -31694,6 +32311,8 @@ class GoogleBigQueryLinkedService(LinkedService): # pylint: disable=too-many-in :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -31756,6 +32375,7 @@ class GoogleBigQueryLinkedService(LinkedService): # pylint: disable=too-many-in _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -31780,6 +32400,7 @@ def __init__( project: JSON, authentication_type: Union[str, "_models.GoogleBigQueryAuthenticationType"], additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -31800,6 +32421,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -31854,6 +32477,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -32109,6 +32733,8 @@ class GoogleBigQueryV2LinkedService(LinkedService): # pylint: disable=too-many- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -32150,6 +32776,7 @@ class GoogleBigQueryV2LinkedService(LinkedService): # pylint: disable=too-many- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -32169,6 +32796,7 @@ def __init__( project_id: JSON, authentication_type: Union[str, "_models.GoogleBigQueryV2AuthenticationType"], additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -32184,6 +32812,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -32217,6 +32847,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -32448,7 +33079,7 @@ def __init__( self.query = query -class GoogleCloudStorageLinkedService(LinkedService): +class GoogleCloudStorageLinkedService(LinkedService): # pylint: disable=too-many-instance-attributes """Linked service for Google Cloud Storage. All required parameters must be populated in order to send to server. @@ -32458,6 +33089,8 @@ class GoogleCloudStorageLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -32489,6 +33122,7 @@ class GoogleCloudStorageLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -32503,6 +33137,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -32517,6 +33152,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -32542,6 +33179,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -32786,6 +33424,8 @@ class GoogleSheetsLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -32809,6 +33449,7 @@ class GoogleSheetsLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -32822,6 +33463,7 @@ def __init__( *, api_token: "_models.SecretBase", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -32833,6 +33475,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -32849,6 +33493,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -32870,6 +33515,8 @@ class GreenplumLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -32895,6 +33542,7 @@ class GreenplumLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -32908,6 +33556,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -32921,6 +33570,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -32940,6 +33591,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -33185,6 +33837,8 @@ class HBaseLinkedService(LinkedService): # pylint: disable=too-many-instance-at :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -33235,6 +33889,7 @@ class HBaseLinkedService(LinkedService): # pylint: disable=too-many-instance-at _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -33258,6 +33913,7 @@ def __init__( host: JSON, authentication_type: Union[str, "_models.HBaseAuthenticationType"], additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -33277,6 +33933,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -33320,6 +33978,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -33554,6 +34213,8 @@ class HdfsLinkedService(LinkedService): # pylint: disable=too-many-instance-att :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -33586,6 +34247,7 @@ class HdfsLinkedService(LinkedService): # pylint: disable=too-many-instance-att _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -33602,6 +34264,7 @@ def __init__( *, url: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -33616,6 +34279,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -33641,6 +34306,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -34118,6 +34784,8 @@ class HDInsightLinkedService(LinkedService): # pylint: disable=too-many-instanc :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -34158,6 +34826,7 @@ class HDInsightLinkedService(LinkedService): # pylint: disable=too-many-instanc _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -34180,6 +34849,7 @@ def __init__( *, cluster_uri: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -34197,6 +34867,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -34230,6 +34902,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -34419,6 +35092,8 @@ class HDInsightOnDemandLinkedService(LinkedService): # pylint: disable=too-many :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -34435,9 +35110,9 @@ class HDInsightOnDemandLinkedService(LinkedService): # pylint: disable=too-many are no other active jobs in the cluster. The minimum value is 5 mins. Type: string (or Expression with resultType string). Required. :vartype time_to_live: JSON - :ivar version: Version of the HDInsight cluster.  Type: string (or Expression with resultType - string). Required. - :vartype version: JSON + :ivar version_type_properties_version: Version of the HDInsight cluster.  Type: string (or + Expression with resultType string). Required. + :vartype version_type_properties_version: JSON :ivar linked_service_name: Azure Storage linked service to be used by the on-demand cluster for storing and processing data. Required. :vartype linked_service_name: ~azure.mgmt.datafactory.models.LinkedServiceReference @@ -34532,7 +35207,7 @@ class HDInsightOnDemandLinkedService(LinkedService): # pylint: disable=too-many "type": {"required": True}, "cluster_size": {"required": True}, "time_to_live": {"required": True}, - "version": {"required": True}, + "version_type_properties_version": {"required": True}, "linked_service_name": {"required": True}, "host_subscription_id": {"required": True}, "tenant": {"required": True}, @@ -34542,13 +35217,14 @@ class HDInsightOnDemandLinkedService(LinkedService): # pylint: disable=too-many _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, "annotations": {"key": "annotations", "type": "[object]"}, "cluster_size": {"key": "typeProperties.clusterSize", "type": "object"}, "time_to_live": {"key": "typeProperties.timeToLive", "type": "object"}, - "version": {"key": "typeProperties.version", "type": "object"}, + "version_type_properties_version": {"key": "typeProperties.version", "type": "object"}, "linked_service_name": {"key": "typeProperties.linkedServiceName", "type": "LinkedServiceReference"}, "host_subscription_id": {"key": "typeProperties.hostSubscriptionId", "type": "object"}, "service_principal_id": {"key": "typeProperties.servicePrincipalId", "type": "object"}, @@ -34593,12 +35269,13 @@ def __init__( # pylint: disable=too-many-locals *, cluster_size: JSON, time_to_live: JSON, - version: JSON, + version_type_properties_version: JSON, linked_service_name: "_models.LinkedServiceReference", host_subscription_id: JSON, tenant: JSON, cluster_resource_group: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -34636,6 +35313,8 @@ def __init__( # pylint: disable=too-many-locals :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -34652,9 +35331,9 @@ def __init__( # pylint: disable=too-many-locals are no other active jobs in the cluster. The minimum value is 5 mins. Type: string (or Expression with resultType string). Required. :paramtype time_to_live: JSON - :keyword version: Version of the HDInsight cluster.  Type: string (or Expression with - resultType string). Required. - :paramtype version: JSON + :keyword version_type_properties_version: Version of the HDInsight cluster.  Type: string (or + Expression with resultType string). Required. + :paramtype version_type_properties_version: JSON :keyword linked_service_name: Azure Storage linked service to be used by the on-demand cluster for storing and processing data. Required. :paramtype linked_service_name: ~azure.mgmt.datafactory.models.LinkedServiceReference @@ -34747,6 +35426,7 @@ def __init__( # pylint: disable=too-many-locals """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -34756,7 +35436,7 @@ def __init__( # pylint: disable=too-many-locals self.type: str = "HDInsightOnDemand" self.cluster_size = cluster_size self.time_to_live = time_to_live - self.version = version + self.version_type_properties_version = version_type_properties_version self.linked_service_name = linked_service_name self.host_subscription_id = host_subscription_id self.service_principal_id = service_principal_id @@ -35314,6 +35994,8 @@ class HiveLinkedService(LinkedService): # pylint: disable=too-many-instance-att :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -35383,6 +36065,7 @@ class HiveLinkedService(LinkedService): # pylint: disable=too-many-instance-att _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -35406,12 +36089,13 @@ class HiveLinkedService(LinkedService): # pylint: disable=too-many-instance-att "encrypted_credential": {"key": "typeProperties.encryptedCredential", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, host: JSON, authentication_type: Union[str, "_models.HiveAuthenticationType"], additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -35437,6 +36121,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -35498,6 +36184,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -35908,6 +36595,8 @@ class HttpLinkedService(LinkedService): # pylint: disable=too-many-instance-att :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -35957,6 +36646,7 @@ class HttpLinkedService(LinkedService): # pylint: disable=too-many-instance-att _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -35980,6 +36670,7 @@ def __init__( *, url: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -35998,6 +36689,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -36040,6 +36733,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -36321,6 +37015,8 @@ class HubspotLinkedService(LinkedService): # pylint: disable=too-many-instance- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -36362,6 +37058,7 @@ class HubspotLinkedService(LinkedService): # pylint: disable=too-many-instance- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -36381,6 +37078,7 @@ def __init__( *, client_id: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -36398,6 +37096,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -36432,6 +37132,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -36783,6 +37484,8 @@ class ImpalaLinkedService(LinkedService): # pylint: disable=too-many-instance-a :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -36834,6 +37537,7 @@ class ImpalaLinkedService(LinkedService): # pylint: disable=too-many-instance-a _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -36857,6 +37561,7 @@ def __init__( host: JSON, authentication_type: Union[str, "_models.ImpalaAuthenticationType"], additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -36876,6 +37581,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -36920,6 +37627,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -37173,6 +37881,8 @@ class InformixLinkedService(LinkedService): # pylint: disable=too-many-instance :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -37210,6 +37920,7 @@ class InformixLinkedService(LinkedService): # pylint: disable=too-many-instance _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -37227,6 +37938,7 @@ def __init__( *, connection_string: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -37242,6 +37954,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -37272,6 +37986,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -38826,6 +39541,8 @@ class JiraLinkedService(LinkedService): # pylint: disable=too-many-instance-att :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -38868,6 +39585,7 @@ class JiraLinkedService(LinkedService): # pylint: disable=too-many-instance-att _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -38888,6 +39606,7 @@ def __init__( host: JSON, username: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -38904,6 +39623,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -38939,6 +39660,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -39694,6 +40416,8 @@ class LakeHouseLinkedService(LinkedService): # pylint: disable=too-many-instanc :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -39739,6 +40463,7 @@ class LakeHouseLinkedService(LinkedService): # pylint: disable=too-many-instanc _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -39757,6 +40482,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -39775,6 +40501,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -39814,6 +40542,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -41054,6 +41783,8 @@ class MagentoLinkedService(LinkedService): # pylint: disable=too-many-instance- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -41089,6 +41820,7 @@ class MagentoLinkedService(LinkedService): # pylint: disable=too-many-instance- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -41106,6 +41838,7 @@ def __init__( *, host: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -41121,6 +41854,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -41149,6 +41884,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -42599,6 +43335,8 @@ class MariaDBLinkedService(LinkedService): # pylint: disable=too-many-instance- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -42636,6 +43374,7 @@ class MariaDBLinkedService(LinkedService): # pylint: disable=too-many-instance- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -42654,6 +43393,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -42672,6 +43412,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -42703,6 +43445,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -42934,6 +43677,8 @@ class MarketoLinkedService(LinkedService): # pylint: disable=too-many-instance- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -42972,6 +43717,7 @@ class MarketoLinkedService(LinkedService): # pylint: disable=too-many-instance- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -42991,6 +43737,7 @@ def __init__( endpoint: JSON, client_id: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -43006,6 +43753,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -43037,6 +43786,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -43293,6 +44043,8 @@ class MicrosoftAccessLinkedService(LinkedService): # pylint: disable=too-many-i :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -43330,6 +44082,7 @@ class MicrosoftAccessLinkedService(LinkedService): # pylint: disable=too-many-i _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -43347,6 +44100,7 @@ def __init__( *, connection_string: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -43362,6 +44116,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -43392,6 +44148,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -43819,6 +44576,8 @@ class MongoDbAtlasLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -43848,6 +44607,7 @@ class MongoDbAtlasLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -43863,6 +44623,7 @@ def __init__( connection_string: JSON, database: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -43874,6 +44635,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -43895,6 +44658,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -44319,6 +45083,8 @@ class MongoDbLinkedService(LinkedService): # pylint: disable=too-many-instance- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -44367,6 +45133,7 @@ class MongoDbLinkedService(LinkedService): # pylint: disable=too-many-instance- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -44389,6 +45156,7 @@ def __init__( server: JSON, database_name: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -44407,6 +45175,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -44449,6 +45219,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -44676,6 +45447,8 @@ class MongoDbV2LinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -44702,6 +45475,7 @@ class MongoDbV2LinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -44716,6 +45490,7 @@ def __init__( connection_string: JSON, database: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -44726,6 +45501,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -44744,6 +45521,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -44993,6 +45771,8 @@ class MySqlLinkedService(LinkedService): # pylint: disable=too-many-instance-at :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -45036,6 +45816,7 @@ class MySqlLinkedService(LinkedService): # pylint: disable=too-many-instance-at _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -45056,6 +45837,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -45076,6 +45858,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -45113,6 +45897,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -45344,6 +46129,8 @@ class NetezzaLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -45369,6 +46156,7 @@ class NetezzaLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -45382,6 +46170,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -45395,6 +46184,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -45414,6 +46205,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -45721,7 +46513,8 @@ class NotebookParameter(_serialization.Model): :ivar value: Notebook parameter value. Type: string (or Expression with resultType string). :vartype value: JSON - :ivar type: Notebook parameter type. Known values are: "string", "int", "float", and "bool". + :ivar type: Notebook parameter type. Known values are: "string", "int", "float", "bool", and + "int". :vartype type: str or ~azure.mgmt.datafactory.models.NotebookParameterType """ @@ -45740,7 +46533,8 @@ def __init__( """ :keyword value: Notebook parameter value. Type: string (or Expression with resultType string). :paramtype value: JSON - :keyword type: Notebook parameter type. Known values are: "string", "int", "float", and "bool". + :keyword type: Notebook parameter type. Known values are: "string", "int", "float", "bool", and + "int". :paramtype type: str or ~azure.mgmt.datafactory.models.NotebookParameterType """ super().__init__(**kwargs) @@ -45758,6 +46552,8 @@ class ODataLinkedService(LinkedService): # pylint: disable=too-many-instance-at :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -45822,6 +46618,7 @@ class ODataLinkedService(LinkedService): # pylint: disable=too-many-instance-at _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -45853,6 +46650,7 @@ def __init__( *, url: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -45878,6 +46676,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -45935,6 +46735,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -46176,6 +46977,8 @@ class OdbcLinkedService(LinkedService): # pylint: disable=too-many-instance-att :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -46212,6 +47015,7 @@ class OdbcLinkedService(LinkedService): # pylint: disable=too-many-instance-att _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -46229,6 +47033,7 @@ def __init__( *, connection_string: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -46244,6 +47049,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -46273,6 +47080,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -46716,6 +47524,8 @@ class Office365LinkedService(LinkedService): # pylint: disable=too-many-instanc :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -46751,6 +47561,7 @@ class Office365LinkedService(LinkedService): # pylint: disable=too-many-instanc _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -46770,6 +47581,7 @@ def __init__( service_principal_id: JSON, service_principal_key: "_models.SecretBase", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -46781,6 +47593,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -46806,6 +47620,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -47299,7 +48114,7 @@ def __init__( self.metric_specifications = metric_specifications -class OracleCloudStorageLinkedService(LinkedService): +class OracleCloudStorageLinkedService(LinkedService): # pylint: disable=too-many-instance-attributes """Linked service for Oracle Cloud Storage. All required parameters must be populated in order to send to server. @@ -47309,6 +48124,8 @@ class OracleCloudStorageLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -47340,6 +48157,7 @@ class OracleCloudStorageLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -47354,6 +48172,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -47368,6 +48187,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -47393,6 +48214,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -47637,6 +48459,8 @@ class OracleLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -47663,6 +48487,7 @@ class OracleLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -47677,6 +48502,7 @@ def __init__( *, connection_string: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -47689,6 +48515,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -47708,6 +48536,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -47786,6 +48615,8 @@ class OracleServiceCloudLinkedService(LinkedService): # pylint: disable=too-man :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -47827,6 +48658,7 @@ class OracleServiceCloudLinkedService(LinkedService): # pylint: disable=too-man _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -47847,6 +48679,7 @@ def __init__( username: JSON, password: "_models.SecretBase", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -47861,6 +48694,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -47893,6 +48728,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -48930,7 +49766,7 @@ class ParameterSpecification(_serialization.Model): All required parameters must be populated in order to send to server. :ivar type: Parameter type. Required. Known values are: "Object", "String", "Int", "Float", - "Bool", "Array", and "SecureString". + "Bool", "Array", "SecureString", and "Int". :vartype type: str or ~azure.mgmt.datafactory.models.ParameterType :ivar default_value: Default value of parameter. :vartype default_value: JSON @@ -48950,7 +49786,7 @@ def __init__( ) -> None: """ :keyword type: Parameter type. Required. Known values are: "Object", "String", "Int", "Float", - "Bool", "Array", and "SecureString". + "Bool", "Array", "SecureString", and "Int". :paramtype type: str or ~azure.mgmt.datafactory.models.ParameterType :keyword default_value: Default value of parameter. :paramtype default_value: JSON @@ -49435,6 +50271,8 @@ class PaypalLinkedService(LinkedService): # pylint: disable=too-many-instance-a :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -49473,6 +50311,7 @@ class PaypalLinkedService(LinkedService): # pylint: disable=too-many-instance-a _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -49492,6 +50331,7 @@ def __init__( host: JSON, client_id: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -49507,6 +50347,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -49537,6 +50379,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -49767,6 +50610,8 @@ class PhoenixLinkedService(LinkedService): # pylint: disable=too-many-instance- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -49823,6 +50668,7 @@ class PhoenixLinkedService(LinkedService): # pylint: disable=too-many-instance- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -49847,6 +50693,7 @@ def __init__( host: JSON, authentication_type: Union[str, "_models.PhoenixAuthenticationType"], additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -49867,6 +50714,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -49915,6 +50764,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -50724,6 +51574,8 @@ class PostgreSqlLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -50750,6 +51602,7 @@ class PostgreSqlLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -50764,6 +51617,7 @@ def __init__( *, connection_string: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -50776,6 +51630,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -50795,6 +51651,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -51037,6 +51894,8 @@ class PostgreSqlV2LinkedService(LinkedService): # pylint: disable=too-many-inst :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -51107,6 +51966,7 @@ class PostgreSqlV2LinkedService(LinkedService): # pylint: disable=too-many-inst _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -51140,6 +52000,7 @@ def __init__( # pylint: disable=too-many-locals database: JSON, ssl_mode: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -51165,6 +52026,8 @@ def __init__( # pylint: disable=too-many-locals :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -51227,6 +52090,7 @@ def __init__( # pylint: disable=too-many-locals """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -51665,6 +52529,8 @@ class PrestoLinkedService(LinkedService): # pylint: disable=too-many-instance-a :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -51724,6 +52590,7 @@ class PrestoLinkedService(LinkedService): # pylint: disable=too-many-instance-a _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -51752,6 +52619,7 @@ def __init__( catalog: JSON, authentication_type: Union[str, "_models.PrestoAuthenticationType"], additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -51772,6 +52640,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -51822,6 +52692,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -52450,6 +53321,8 @@ class QuickbaseLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -52477,6 +53350,7 @@ class QuickbaseLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -52492,6 +53366,7 @@ def __init__( url: JSON, user_token: "_models.SecretBase", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -52503,6 +53378,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -52522,6 +53399,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -52544,6 +53422,8 @@ class QuickBooksLinkedService(LinkedService): # pylint: disable=too-many-instan :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -52582,6 +53462,7 @@ class QuickBooksLinkedService(LinkedService): # pylint: disable=too-many-instan _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -52601,6 +53482,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -52620,6 +53502,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -52652,6 +53536,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -53426,6 +54311,8 @@ class ResponsysLinkedService(LinkedService): # pylint: disable=too-many-instanc :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -53467,6 +54354,7 @@ class ResponsysLinkedService(LinkedService): # pylint: disable=too-many-instanc _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -53486,6 +54374,7 @@ def __init__( endpoint: JSON, client_id: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -53501,6 +54390,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -53534,6 +54425,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -53900,6 +54792,8 @@ class RestServiceLinkedService(LinkedService): # pylint: disable=too-many-insta :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -53964,6 +54858,18 @@ class RestServiceLinkedService(LinkedService): # pylint: disable=too-many-insta :ivar scope: The scope of the access required. It describes what kind of access will be requested. Type: string (or Expression with resultType string). :vartype scope: JSON + :ivar service_principal_credential_type: The service principal credential type to use in + Server-To-Server authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' + for certificate. Type: string (or Expression with resultType string). + :vartype service_principal_credential_type: JSON + :ivar service_principal_embedded_cert: Specify the base64 encoded certificate of your + application registered in Azure Active Directory. Type: string (or Expression with resultType + string). + :vartype service_principal_embedded_cert: ~azure.mgmt.datafactory.models.SecretBase + :ivar service_principal_embedded_cert_password: Specify the password of your certificate if + your certificate has a password and you are using AadServicePrincipal authentication. Type: + string (or Expression with resultType string). + :vartype service_principal_embedded_cert_password: ~azure.mgmt.datafactory.models.SecretBase """ _validation = { @@ -53975,6 +54881,7 @@ class RestServiceLinkedService(LinkedService): # pylint: disable=too-many-insta _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -54000,6 +54907,12 @@ class RestServiceLinkedService(LinkedService): # pylint: disable=too-many-insta "token_endpoint": {"key": "typeProperties.tokenEndpoint", "type": "object"}, "resource": {"key": "typeProperties.resource", "type": "object"}, "scope": {"key": "typeProperties.scope", "type": "object"}, + "service_principal_credential_type": {"key": "typeProperties.servicePrincipalCredentialType", "type": "object"}, + "service_principal_embedded_cert": {"key": "typeProperties.servicePrincipalEmbeddedCert", "type": "SecretBase"}, + "service_principal_embedded_cert_password": { + "key": "typeProperties.servicePrincipalEmbeddedCertPassword", + "type": "SecretBase", + }, } def __init__( # pylint: disable=too-many-locals @@ -54008,6 +54921,7 @@ def __init__( # pylint: disable=too-many-locals url: JSON, authentication_type: Union[str, "_models.RestServiceAuthenticationType"], additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -54028,12 +54942,17 @@ def __init__( # pylint: disable=too-many-locals token_endpoint: Optional[JSON] = None, resource: Optional[JSON] = None, scope: Optional[JSON] = None, + service_principal_credential_type: Optional[JSON] = None, + service_principal_embedded_cert: Optional["_models.SecretBase"] = None, + service_principal_embedded_cert_password: Optional["_models.SecretBase"] = None, **kwargs: Any ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -54098,9 +55017,22 @@ def __init__( # pylint: disable=too-many-locals :keyword scope: The scope of the access required. It describes what kind of access will be requested. Type: string (or Expression with resultType string). :paramtype scope: JSON + :keyword service_principal_credential_type: The service principal credential type to use in + Server-To-Server authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' + for certificate. Type: string (or Expression with resultType string). + :paramtype service_principal_credential_type: JSON + :keyword service_principal_embedded_cert: Specify the base64 encoded certificate of your + application registered in Azure Active Directory. Type: string (or Expression with resultType + string). + :paramtype service_principal_embedded_cert: ~azure.mgmt.datafactory.models.SecretBase + :keyword service_principal_embedded_cert_password: Specify the password of your certificate if + your certificate has a password and you are using AadServicePrincipal authentication. Type: + string (or Expression with resultType string). + :paramtype service_principal_embedded_cert_password: ~azure.mgmt.datafactory.models.SecretBase """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -54126,6 +55058,9 @@ def __init__( # pylint: disable=too-many-locals self.token_endpoint = token_endpoint self.resource = resource self.scope = scope + self.service_principal_credential_type = service_principal_credential_type + self.service_principal_embedded_cert = service_principal_embedded_cert + self.service_principal_embedded_cert_password = service_principal_embedded_cert_password class RestSink(CopySink): # pylint: disable=too-many-instance-attributes @@ -54523,7 +55458,7 @@ class RunQueryFilter(_serialization.Model): "ActivityType", "TriggerName", "TriggerRunTimestamp", "RunGroupId", and "LatestOnly". :vartype operand: str or ~azure.mgmt.datafactory.models.RunQueryFilterOperand :ivar operator: Operator to be used for filter. Required. Known values are: "Equals", - "NotEquals", "In", and "NotIn". + "NotEquals", "In", "NotIn", and "In". :vartype operator: str or ~azure.mgmt.datafactory.models.RunQueryFilterOperator :ivar values: List of filter values. Required. :vartype values: list[str] @@ -54558,7 +55493,7 @@ def __init__( "ActivityType", "TriggerName", "TriggerRunTimestamp", "RunGroupId", and "LatestOnly". :paramtype operand: str or ~azure.mgmt.datafactory.models.RunQueryFilterOperand :keyword operator: Operator to be used for filter. Required. Known values are: "Equals", - "NotEquals", "In", and "NotIn". + "NotEquals", "In", "NotIn", and "In". :paramtype operator: str or ~azure.mgmt.datafactory.models.RunQueryFilterOperator :keyword values: List of filter values. Required. :paramtype values: list[str] @@ -54628,6 +55563,8 @@ class SalesforceLinkedService(LinkedService): # pylint: disable=too-many-instan :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -54663,6 +55600,7 @@ class SalesforceLinkedService(LinkedService): # pylint: disable=too-many-instan _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -54679,6 +55617,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -54695,6 +55634,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -54724,6 +55665,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -54749,6 +55691,8 @@ class SalesforceMarketingCloudLinkedService(LinkedService): # pylint: disable=t :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -54789,6 +55733,7 @@ class SalesforceMarketingCloudLinkedService(LinkedService): # pylint: disable=t _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -54806,6 +55751,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -54823,6 +55769,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -54857,6 +55805,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -55191,6 +56140,8 @@ class SalesforceServiceCloudLinkedService(LinkedService): # pylint: disable=too :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -55229,6 +56180,7 @@ class SalesforceServiceCloudLinkedService(LinkedService): # pylint: disable=too _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -55246,6 +56198,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -55263,6 +56216,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -55295,6 +56250,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -55654,6 +56610,8 @@ class SalesforceServiceCloudV2LinkedService(LinkedService): # pylint: disable=t :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -55690,6 +56648,7 @@ class SalesforceServiceCloudV2LinkedService(LinkedService): # pylint: disable=t _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -55706,6 +56665,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -55722,6 +56682,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -55752,6 +56714,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -56376,6 +57339,8 @@ class SalesforceV2LinkedService(LinkedService): # pylint: disable=too-many-inst :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -56412,6 +57377,7 @@ class SalesforceV2LinkedService(LinkedService): # pylint: disable=too-many-inst _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -56428,6 +57394,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -56444,6 +57411,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -56474,6 +57443,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -56964,6 +57934,8 @@ class SapBWLinkedService(LinkedService): # pylint: disable=too-many-instance-at :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -57001,6 +57973,7 @@ class SapBWLinkedService(LinkedService): # pylint: disable=too-many-instance-at _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -57020,6 +57993,7 @@ def __init__( system_number: JSON, client_id: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -57033,6 +58007,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -57061,6 +58037,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -57176,7 +58153,7 @@ def __init__( self.query = query -class SapCloudForCustomerLinkedService(LinkedService): +class SapCloudForCustomerLinkedService(LinkedService): # pylint: disable=too-many-instance-attributes """Linked service for SAP Cloud for Customer. All required parameters must be populated in order to send to server. @@ -57186,6 +58163,8 @@ class SapCloudForCustomerLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -57217,6 +58196,7 @@ class SapCloudForCustomerLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -57232,6 +58212,7 @@ def __init__( *, url: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -57245,6 +58226,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -57269,6 +58252,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -57619,7 +58603,7 @@ def __init__( self.http_request_timeout = http_request_timeout -class SapEccLinkedService(LinkedService): +class SapEccLinkedService(LinkedService): # pylint: disable=too-many-instance-attributes """Linked service for SAP ERP Central Component(SAP ECC). All required parameters must be populated in order to send to server. @@ -57629,6 +58613,8 @@ class SapEccLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -57660,6 +58646,7 @@ class SapEccLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -57675,6 +58662,7 @@ def __init__( *, url: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -57688,6 +58676,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -57712,6 +58702,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -57955,6 +58946,8 @@ class SapHanaLinkedService(LinkedService): # pylint: disable=too-many-instance- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -57989,6 +58982,7 @@ class SapHanaLinkedService(LinkedService): # pylint: disable=too-many-instance- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -58005,6 +58999,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -58021,6 +59016,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -58049,6 +59046,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -58334,6 +59332,8 @@ class SapOdpLinkedService(LinkedService): # pylint: disable=too-many-instance-a :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -58406,6 +59406,7 @@ class SapOdpLinkedService(LinkedService): # pylint: disable=too-many-instance-a _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -58434,6 +59435,7 @@ def __init__( # pylint: disable=too-many-locals self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -58462,6 +59464,8 @@ def __init__( # pylint: disable=too-many-locals :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -58528,6 +59532,7 @@ def __init__( # pylint: disable=too-many-locals """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -58809,6 +59814,8 @@ class SapOpenHubLinkedService(LinkedService): # pylint: disable=too-many-instan :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -58860,6 +59867,7 @@ class SapOpenHubLinkedService(LinkedService): # pylint: disable=too-many-instan _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -58881,6 +59889,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -58902,6 +59911,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -58948,6 +59959,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -59236,6 +60248,8 @@ class SapTableLinkedService(LinkedService): # pylint: disable=too-many-instance :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -59302,6 +60316,7 @@ class SapTableLinkedService(LinkedService): # pylint: disable=too-many-instance _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -59328,6 +60343,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -59354,6 +60370,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -59414,6 +60432,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -60708,6 +61727,8 @@ class ServiceNowLinkedService(LinkedService): # pylint: disable=too-many-instan :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -60757,6 +61778,7 @@ class ServiceNowLinkedService(LinkedService): # pylint: disable=too-many-instan _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -60779,6 +61801,7 @@ def __init__( endpoint: JSON, authentication_type: Union[str, "_models.ServiceNowAuthenticationType"], additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -60797,6 +61820,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -60838,6 +61863,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -61071,6 +62097,8 @@ class ServiceNowV2LinkedService(LinkedService): # pylint: disable=too-many-inst :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -61112,6 +62140,7 @@ class ServiceNowV2LinkedService(LinkedService): # pylint: disable=too-many-inst _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -61132,6 +62161,7 @@ def __init__( endpoint: JSON, authentication_type: Union[str, "_models.ServiceNowV2AuthenticationType"], additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -61148,6 +62178,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -61181,6 +62213,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -61800,6 +62833,8 @@ class SftpServerLinkedService(LinkedService): # pylint: disable=too-many-instan :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -61854,6 +62889,7 @@ class SftpServerLinkedService(LinkedService): # pylint: disable=too-many-instan _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -61876,6 +62912,7 @@ def __init__( *, host: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -61896,6 +62933,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -61943,6 +62982,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -62066,6 +63106,8 @@ class SharePointOnlineListLinkedService(LinkedService): # pylint: disable=too-m :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -62087,8 +63129,20 @@ class SharePointOnlineListLinkedService(LinkedService): # pylint: disable=too-m string (or Expression with resultType string). Required. :vartype service_principal_id: JSON :ivar service_principal_key: The client secret of your application registered in Azure Active - Directory. Type: string (or Expression with resultType string). Required. + Directory. Type: string (or Expression with resultType string). :vartype service_principal_key: ~azure.mgmt.datafactory.models.SecretBase + :ivar service_principal_credential_type: The service principal credential type to use in + Server-To-Server authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' + for certificate. Type: string (or Expression with resultType string). + :vartype service_principal_credential_type: JSON + :ivar service_principal_embedded_cert: Specify the base64 encoded certificate of your + application registered in Azure Active Directory. Type: string (or Expression with resultType + string). + :vartype service_principal_embedded_cert: ~azure.mgmt.datafactory.models.SecretBase + :ivar service_principal_embedded_cert_password: Specify the password of your certificate if + your certificate has a password and you are using AadServicePrincipal authentication. Type: + string (or Expression with resultType string). + :vartype service_principal_embedded_cert_password: ~azure.mgmt.datafactory.models.SecretBase :ivar encrypted_credential: The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string. :vartype encrypted_credential: str @@ -62099,12 +63153,12 @@ class SharePointOnlineListLinkedService(LinkedService): # pylint: disable=too-m "site_url": {"required": True}, "tenant_id": {"required": True}, "service_principal_id": {"required": True}, - "service_principal_key": {"required": True}, } _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -62113,6 +63167,12 @@ class SharePointOnlineListLinkedService(LinkedService): # pylint: disable=too-m "tenant_id": {"key": "typeProperties.tenantId", "type": "object"}, "service_principal_id": {"key": "typeProperties.servicePrincipalId", "type": "object"}, "service_principal_key": {"key": "typeProperties.servicePrincipalKey", "type": "SecretBase"}, + "service_principal_credential_type": {"key": "typeProperties.servicePrincipalCredentialType", "type": "object"}, + "service_principal_embedded_cert": {"key": "typeProperties.servicePrincipalEmbeddedCert", "type": "SecretBase"}, + "service_principal_embedded_cert_password": { + "key": "typeProperties.servicePrincipalEmbeddedCertPassword", + "type": "SecretBase", + }, "encrypted_credential": {"key": "typeProperties.encryptedCredential", "type": "str"}, } @@ -62122,12 +63182,16 @@ def __init__( site_url: JSON, tenant_id: JSON, service_principal_id: JSON, - service_principal_key: "_models.SecretBase", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, annotations: Optional[List[JSON]] = None, + service_principal_key: Optional["_models.SecretBase"] = None, + service_principal_credential_type: Optional[JSON] = None, + service_principal_embedded_cert: Optional["_models.SecretBase"] = None, + service_principal_embedded_cert_password: Optional["_models.SecretBase"] = None, encrypted_credential: Optional[str] = None, **kwargs: Any ) -> None: @@ -62135,6 +63199,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -62156,14 +63222,27 @@ def __init__( Type: string (or Expression with resultType string). Required. :paramtype service_principal_id: JSON :keyword service_principal_key: The client secret of your application registered in Azure - Active Directory. Type: string (or Expression with resultType string). Required. + Active Directory. Type: string (or Expression with resultType string). :paramtype service_principal_key: ~azure.mgmt.datafactory.models.SecretBase + :keyword service_principal_credential_type: The service principal credential type to use in + Server-To-Server authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' + for certificate. Type: string (or Expression with resultType string). + :paramtype service_principal_credential_type: JSON + :keyword service_principal_embedded_cert: Specify the base64 encoded certificate of your + application registered in Azure Active Directory. Type: string (or Expression with resultType + string). + :paramtype service_principal_embedded_cert: ~azure.mgmt.datafactory.models.SecretBase + :keyword service_principal_embedded_cert_password: Specify the password of your certificate if + your certificate has a password and you are using AadServicePrincipal authentication. Type: + string (or Expression with resultType string). + :paramtype service_principal_embedded_cert_password: ~azure.mgmt.datafactory.models.SecretBase :keyword encrypted_credential: The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string. :paramtype encrypted_credential: str """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -62175,6 +63254,9 @@ def __init__( self.tenant_id = tenant_id self.service_principal_id = service_principal_id self.service_principal_key = service_principal_key + self.service_principal_credential_type = service_principal_credential_type + self.service_principal_embedded_cert = service_principal_embedded_cert + self.service_principal_embedded_cert_password = service_principal_embedded_cert_password self.encrypted_credential = encrypted_credential @@ -62387,6 +63469,8 @@ class ShopifyLinkedService(LinkedService): # pylint: disable=too-many-instance- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -62423,6 +63507,7 @@ class ShopifyLinkedService(LinkedService): # pylint: disable=too-many-instance- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -62440,6 +63525,7 @@ def __init__( *, host: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -62455,6 +63541,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -62484,6 +63572,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -62745,6 +63834,8 @@ class SmartsheetLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -62768,6 +63859,7 @@ class SmartsheetLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -62781,6 +63873,7 @@ def __init__( *, api_token: "_models.SecretBase", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -62792,6 +63885,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -62808,6 +63903,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -62952,6 +64048,9 @@ class SnowflakeExportCopyCommand(ExportSettings): object). Example: "additionalFormatOptions": { "OVERWRITE": "TRUE", "MAX_FILE_SIZE": "'FALSE'" }. :vartype additional_format_options: dict[str, JSON] + :ivar storage_integration: The name of the snowflake storage integration to use for the copy + operation. Type: string (or Expression with resultType string). + :vartype storage_integration: JSON """ _validation = { @@ -62963,6 +64062,7 @@ class SnowflakeExportCopyCommand(ExportSettings): "type": {"key": "type", "type": "str"}, "additional_copy_options": {"key": "additionalCopyOptions", "type": "{object}"}, "additional_format_options": {"key": "additionalFormatOptions", "type": "{object}"}, + "storage_integration": {"key": "storageIntegration", "type": "object"}, } def __init__( @@ -62971,6 +64071,7 @@ def __init__( additional_properties: Optional[Dict[str, JSON]] = None, additional_copy_options: Optional[Dict[str, JSON]] = None, additional_format_options: Optional[Dict[str, JSON]] = None, + storage_integration: Optional[JSON] = None, **kwargs: Any ) -> None: """ @@ -62987,11 +64088,15 @@ def __init__( object). Example: "additionalFormatOptions": { "OVERWRITE": "TRUE", "MAX_FILE_SIZE": "'FALSE'" }. :paramtype additional_format_options: dict[str, JSON] + :keyword storage_integration: The name of the snowflake storage integration to use for the copy + operation. Type: string (or Expression with resultType string). + :paramtype storage_integration: JSON """ super().__init__(additional_properties=additional_properties, **kwargs) self.type: str = "SnowflakeExportCopyCommand" self.additional_copy_options = additional_copy_options self.additional_format_options = additional_format_options + self.storage_integration = storage_integration class SnowflakeImportCopyCommand(ImportSettings): @@ -63014,6 +64119,9 @@ class SnowflakeImportCopyCommand(ImportSettings): object). Example: "additionalFormatOptions": { "FORCE": "TRUE", "LOAD_UNCERTAIN_FILES": "'FALSE'" }. :vartype additional_format_options: dict[str, JSON] + :ivar storage_integration: The name of the snowflake storage integration to use for the copy + operation. Type: string (or Expression with resultType string). + :vartype storage_integration: JSON """ _validation = { @@ -63025,6 +64133,7 @@ class SnowflakeImportCopyCommand(ImportSettings): "type": {"key": "type", "type": "str"}, "additional_copy_options": {"key": "additionalCopyOptions", "type": "{object}"}, "additional_format_options": {"key": "additionalFormatOptions", "type": "{object}"}, + "storage_integration": {"key": "storageIntegration", "type": "object"}, } def __init__( @@ -63033,6 +64142,7 @@ def __init__( additional_properties: Optional[Dict[str, JSON]] = None, additional_copy_options: Optional[Dict[str, JSON]] = None, additional_format_options: Optional[Dict[str, JSON]] = None, + storage_integration: Optional[JSON] = None, **kwargs: Any ) -> None: """ @@ -63049,11 +64159,15 @@ def __init__( object). Example: "additionalFormatOptions": { "FORCE": "TRUE", "LOAD_UNCERTAIN_FILES": "'FALSE'" }. :paramtype additional_format_options: dict[str, JSON] + :keyword storage_integration: The name of the snowflake storage integration to use for the copy + operation. Type: string (or Expression with resultType string). + :paramtype storage_integration: JSON """ super().__init__(additional_properties=additional_properties, **kwargs) self.type: str = "SnowflakeImportCopyCommand" self.additional_copy_options = additional_copy_options self.additional_format_options = additional_format_options + self.storage_integration = storage_integration class SnowflakeLinkedService(LinkedService): @@ -63066,6 +64180,8 @@ class SnowflakeLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -63092,6 +64208,7 @@ class SnowflakeLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -63106,6 +64223,7 @@ def __init__( *, connection_string: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -63118,6 +64236,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -63137,6 +64257,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -63471,6 +64592,8 @@ class SnowflakeV2LinkedService(LinkedService): # pylint: disable=too-many-insta :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -63525,6 +64648,7 @@ class SnowflakeV2LinkedService(LinkedService): # pylint: disable=too-many-insta _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -63551,6 +64675,7 @@ def __init__( database: JSON, warehouse: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -63571,6 +64696,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -63617,6 +64744,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -63885,6 +65013,8 @@ class SparkLinkedService(LinkedService): # pylint: disable=too-many-instance-at :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -63946,6 +65076,7 @@ class SparkLinkedService(LinkedService): # pylint: disable=too-many-instance-at _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -63973,6 +65104,7 @@ def __init__( port: JSON, authentication_type: Union[str, "_models.SparkAuthenticationType"], additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -63994,6 +65126,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -64047,6 +65181,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -65107,6 +66242,8 @@ class SqlServerLinkedService(LinkedService): # pylint: disable=too-many-instanc :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -65198,7 +66335,7 @@ class SqlServerLinkedService(LinkedService): # pylint: disable=too-many-instanc AzureKeyVaultSecretReference. :vartype connection_string: JSON :ivar authentication_type: The type used for authentication. Type: string. Known values are: - "SQL" and "Windows". + "SQL", "Windows", and "UserAssignedManagedIdentity". :vartype authentication_type: str or ~azure.mgmt.datafactory.models.SqlServerAuthenticationType :ivar user_name: The on-premises Windows authentication user name. Type: string (or Expression with resultType string). @@ -65210,6 +66347,8 @@ class SqlServerLinkedService(LinkedService): # pylint: disable=too-many-instanc :vartype encrypted_credential: str :ivar always_encrypted_settings: Sql always encrypted properties. :vartype always_encrypted_settings: ~azure.mgmt.datafactory.models.SqlAlwaysEncryptedProperties + :ivar credential: The credential reference containing authentication information. + :vartype credential: ~azure.mgmt.datafactory.models.CredentialReference """ _validation = { @@ -65219,6 +66358,7 @@ class SqlServerLinkedService(LinkedService): # pylint: disable=too-many-instanc _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -65251,12 +66391,14 @@ class SqlServerLinkedService(LinkedService): # pylint: disable=too-many-instanc "key": "typeProperties.alwaysEncryptedSettings", "type": "SqlAlwaysEncryptedProperties", }, + "credential": {"key": "typeProperties.credential", "type": "CredentialReference"}, } def __init__( # pylint: disable=too-many-locals self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -65286,12 +66428,15 @@ def __init__( # pylint: disable=too-many-locals password: Optional["_models.SecretBase"] = None, encrypted_credential: Optional[str] = None, always_encrypted_settings: Optional["_models.SqlAlwaysEncryptedProperties"] = None, + credential: Optional["_models.CredentialReference"] = None, **kwargs: Any ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -65383,7 +66528,7 @@ def __init__( # pylint: disable=too-many-locals AzureKeyVaultSecretReference. :paramtype connection_string: JSON :keyword authentication_type: The type used for authentication. Type: string. Known values are: - "SQL" and "Windows". + "SQL", "Windows", and "UserAssignedManagedIdentity". :paramtype authentication_type: str or ~azure.mgmt.datafactory.models.SqlServerAuthenticationType :keyword user_name: The on-premises Windows authentication user name. Type: string (or @@ -65397,9 +66542,12 @@ def __init__( # pylint: disable=too-many-locals :keyword always_encrypted_settings: Sql always encrypted properties. :paramtype always_encrypted_settings: ~azure.mgmt.datafactory.models.SqlAlwaysEncryptedProperties + :keyword credential: The credential reference containing authentication information. + :paramtype credential: ~azure.mgmt.datafactory.models.CredentialReference """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -65432,6 +66580,7 @@ def __init__( # pylint: disable=too-many-locals self.password = password self.encrypted_credential = encrypted_credential self.always_encrypted_settings = always_encrypted_settings + self.credential = credential class SqlServerLinkedServiceTypeProperties( @@ -65522,7 +66671,7 @@ class SqlServerLinkedServiceTypeProperties( AzureKeyVaultSecretReference. :vartype connection_string: JSON :ivar authentication_type: The type used for authentication. Type: string. Known values are: - "SQL" and "Windows". + "SQL", "Windows", and "UserAssignedManagedIdentity". :vartype authentication_type: str or ~azure.mgmt.datafactory.models.SqlServerAuthenticationType :ivar user_name: The on-premises Windows authentication user name. Type: string (or Expression with resultType string). @@ -65534,6 +66683,8 @@ class SqlServerLinkedServiceTypeProperties( :vartype encrypted_credential: str :ivar always_encrypted_settings: Sql always encrypted properties. :vartype always_encrypted_settings: ~azure.mgmt.datafactory.models.SqlAlwaysEncryptedProperties + :ivar credential: The credential reference containing authentication information. + :vartype credential: ~azure.mgmt.datafactory.models.CredentialReference """ _attribute_map = { @@ -65562,6 +66713,7 @@ class SqlServerLinkedServiceTypeProperties( "password": {"key": "password", "type": "SecretBase"}, "encrypted_credential": {"key": "encryptedCredential", "type": "str"}, "always_encrypted_settings": {"key": "alwaysEncryptedSettings", "type": "SqlAlwaysEncryptedProperties"}, + "credential": {"key": "credential", "type": "CredentialReference"}, } def __init__( # pylint: disable=too-many-locals @@ -65592,6 +66744,7 @@ def __init__( # pylint: disable=too-many-locals password: Optional["_models.SecretBase"] = None, encrypted_credential: Optional[str] = None, always_encrypted_settings: Optional["_models.SqlAlwaysEncryptedProperties"] = None, + credential: Optional["_models.CredentialReference"] = None, **kwargs: Any ) -> None: """ @@ -65678,7 +66831,7 @@ def __init__( # pylint: disable=too-many-locals AzureKeyVaultSecretReference. :paramtype connection_string: JSON :keyword authentication_type: The type used for authentication. Type: string. Known values are: - "SQL" and "Windows". + "SQL", "Windows", and "UserAssignedManagedIdentity". :paramtype authentication_type: str or ~azure.mgmt.datafactory.models.SqlServerAuthenticationType :keyword user_name: The on-premises Windows authentication user name. Type: string (or @@ -65692,6 +66845,8 @@ def __init__( # pylint: disable=too-many-locals :keyword always_encrypted_settings: Sql always encrypted properties. :paramtype always_encrypted_settings: ~azure.mgmt.datafactory.models.SqlAlwaysEncryptedProperties + :keyword credential: The credential reference containing authentication information. + :paramtype credential: ~azure.mgmt.datafactory.models.CredentialReference """ super().__init__( server=server, @@ -65721,6 +66876,7 @@ def __init__( # pylint: disable=too-many-locals self.password = password self.encrypted_credential = encrypted_credential self.always_encrypted_settings = always_encrypted_settings + self.credential = credential class SqlServerSink(CopySink): # pylint: disable=too-many-instance-attributes @@ -66674,6 +67830,8 @@ class SquareLinkedService(LinkedService): # pylint: disable=too-many-instance-a :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -66716,6 +67874,7 @@ class SquareLinkedService(LinkedService): # pylint: disable=too-many-instance-a _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -66735,6 +67894,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -66754,6 +67914,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -66790,6 +67952,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -68056,7 +69219,7 @@ class StoredProcedureParameter(_serialization.Model): string). :vartype value: JSON :ivar type: Stored procedure parameter type. Known values are: "String", "Int", "Int64", - "Decimal", "Guid", "Boolean", and "Date". + "Decimal", "Guid", "Boolean", "Date", and "Int". :vartype type: str or ~azure.mgmt.datafactory.models.StoredProcedureParameterType """ @@ -68077,7 +69240,7 @@ def __init__( string). :paramtype value: JSON :keyword type: Stored procedure parameter type. Known values are: "String", "Int", "Int64", - "Decimal", "Guid", "Boolean", and "Date". + "Decimal", "Guid", "Boolean", "Date", and "Int". :paramtype type: str or ~azure.mgmt.datafactory.models.StoredProcedureParameterType """ super().__init__(**kwargs) @@ -68242,6 +69405,8 @@ class SybaseLinkedService(LinkedService): # pylint: disable=too-many-instance-a :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -68280,6 +69445,7 @@ class SybaseLinkedService(LinkedService): # pylint: disable=too-many-instance-a _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -68299,6 +69465,7 @@ def __init__( server: JSON, database: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -68314,6 +69481,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -68345,6 +69514,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -69310,6 +70480,8 @@ class TeamDeskLinkedService(LinkedService): # pylint: disable=too-many-instance :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -69345,6 +70517,7 @@ class TeamDeskLinkedService(LinkedService): # pylint: disable=too-many-instance _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -69363,6 +70536,7 @@ def __init__( authentication_type: Union[str, "_models.TeamDeskAuthenticationType"], url: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -69377,6 +70551,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -69405,6 +70581,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -69430,6 +70607,8 @@ class TeradataLinkedService(LinkedService): # pylint: disable=too-many-instance :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -69463,6 +70642,7 @@ class TeradataLinkedService(LinkedService): # pylint: disable=too-many-instance _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -69479,6 +70659,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -69495,6 +70676,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -69524,6 +70707,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -70553,6 +71737,8 @@ class TwilioLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -70577,6 +71763,7 @@ class TwilioLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -70591,6 +71778,7 @@ def __init__( user_name: JSON, password: "_models.SecretBase", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -70601,6 +71789,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -70617,6 +71807,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -71151,7 +72342,7 @@ def __init__( self.default_value = default_value -class VerticaLinkedService(LinkedService): +class VerticaLinkedService(LinkedService): # pylint: disable=too-many-instance-attributes """Vertica linked service. All required parameters must be populated in order to send to server. @@ -71161,6 +72352,8 @@ class VerticaLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -71172,6 +72365,14 @@ class VerticaLinkedService(LinkedService): :ivar connection_string: An ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. :vartype connection_string: JSON + :ivar server: Server name for connection. Type: string. + :vartype server: JSON + :ivar port: The port for the connection. Type: integer. + :vartype port: JSON + :ivar uid: Username for authentication. Type: string. + :vartype uid: JSON + :ivar database: Database name for connection. Type: string. + :vartype database: JSON :ivar pwd: The Azure key vault secret reference of password in connection string. :vartype pwd: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference :ivar encrypted_credential: The encrypted credential used for authentication. Credentials are @@ -71186,11 +72387,16 @@ class VerticaLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, "annotations": {"key": "annotations", "type": "[object]"}, "connection_string": {"key": "typeProperties.connectionString", "type": "object"}, + "server": {"key": "typeProperties.server", "type": "object"}, + "port": {"key": "typeProperties.port", "type": "object"}, + "uid": {"key": "typeProperties.uid", "type": "object"}, + "database": {"key": "typeProperties.database", "type": "object"}, "pwd": {"key": "typeProperties.pwd", "type": "AzureKeyVaultSecretReference"}, "encrypted_credential": {"key": "typeProperties.encryptedCredential", "type": "str"}, } @@ -71199,11 +72405,16 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, annotations: Optional[List[JSON]] = None, connection_string: Optional[JSON] = None, + server: Optional[JSON] = None, + port: Optional[JSON] = None, + uid: Optional[JSON] = None, + database: Optional[JSON] = None, pwd: Optional["_models.AzureKeyVaultSecretReference"] = None, encrypted_credential: Optional[str] = None, **kwargs: Any @@ -71212,6 +72423,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -71223,6 +72436,14 @@ def __init__( :keyword connection_string: An ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. :paramtype connection_string: JSON + :keyword server: Server name for connection. Type: string. + :paramtype server: JSON + :keyword port: The port for the connection. Type: integer. + :paramtype port: JSON + :keyword uid: Username for authentication. Type: string. + :paramtype uid: JSON + :keyword database: Database name for connection. Type: string. + :paramtype database: JSON :keyword pwd: The Azure key vault secret reference of password in connection string. :paramtype pwd: ~azure.mgmt.datafactory.models.AzureKeyVaultSecretReference :keyword encrypted_credential: The encrypted credential used for authentication. Credentials @@ -71231,6 +72452,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -71239,6 +72461,10 @@ def __init__( ) self.type: str = "Vertica" self.connection_string = connection_string + self.server = server + self.port = port + self.uid = uid + self.database = database self.pwd = pwd self.encrypted_credential = encrypted_credential @@ -71575,6 +72801,8 @@ class WarehouseLinkedService(LinkedService): # pylint: disable=too-many-instanc :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -71625,6 +72853,7 @@ class WarehouseLinkedService(LinkedService): # pylint: disable=too-many-instanc _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -71646,6 +72875,7 @@ def __init__( artifact_id: JSON, endpoint: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -71663,6 +72893,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -71705,6 +72937,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -72755,6 +73988,8 @@ class WebLinkedService(LinkedService): :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -72775,6 +74010,7 @@ class WebLinkedService(LinkedService): _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -72787,6 +74023,7 @@ def __init__( *, type_properties: "_models.WebLinkedServiceTypeProperties", additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -72797,6 +74034,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -72810,6 +74049,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -73097,6 +74337,8 @@ class XeroLinkedService(LinkedService): # pylint: disable=too-many-instance-att :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -73138,6 +74380,7 @@ class XeroLinkedService(LinkedService): # pylint: disable=too-many-instance-att _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -73156,6 +74399,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -73174,6 +74418,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -73210,6 +74456,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -73754,6 +75001,8 @@ class ZendeskLinkedService(LinkedService): # pylint: disable=too-many-instance- :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -73789,6 +75038,7 @@ class ZendeskLinkedService(LinkedService): # pylint: disable=too-many-instance- _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -73807,6 +75057,7 @@ def __init__( authentication_type: Union[str, "_models.ZendeskAuthenticationType"], url: JSON, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -73821,6 +75072,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -73848,6 +75101,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, @@ -73918,6 +75172,8 @@ class ZohoLinkedService(LinkedService): # pylint: disable=too-many-instance-att :vartype additional_properties: dict[str, JSON] :ivar type: Type of linked service. Required. :vartype type: str + :ivar version: Version of the linked service. + :vartype version: str :ivar connect_via: The integration runtime reference. :vartype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :ivar description: Linked service description. @@ -73955,6 +75211,7 @@ class ZohoLinkedService(LinkedService): # pylint: disable=too-many-instance-att _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "type": {"key": "type", "type": "str"}, + "version": {"key": "version", "type": "str"}, "connect_via": {"key": "connectVia", "type": "IntegrationRuntimeReference"}, "description": {"key": "description", "type": "str"}, "parameters": {"key": "parameters", "type": "{ParameterSpecification}"}, @@ -73972,6 +75229,7 @@ def __init__( self, *, additional_properties: Optional[Dict[str, JSON]] = None, + version: Optional[str] = None, connect_via: Optional["_models.IntegrationRuntimeReference"] = None, description: Optional[str] = None, parameters: Optional[Dict[str, "_models.ParameterSpecification"]] = None, @@ -73989,6 +75247,8 @@ def __init__( :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. :paramtype additional_properties: dict[str, JSON] + :keyword version: Version of the linked service. + :paramtype version: str :keyword connect_via: The integration runtime reference. :paramtype connect_via: ~azure.mgmt.datafactory.models.IntegrationRuntimeReference :keyword description: Linked service description. @@ -74020,6 +75280,7 @@ def __init__( """ super().__init__( additional_properties=additional_properties, + version=version, connect_via=connect_via, description=description, parameters=parameters, diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_activity_runs_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_activity_runs_operations.py index d3afb059e48b1..12464e49f4842 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_activity_runs_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_activity_runs_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -220,7 +218,6 @@ def query_by_pipeline_run( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -234,7 +231,7 @@ def query_by_pipeline_run( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ActivityRunsQueryResponse", pipeline_response) + deserialized = self._deserialize("ActivityRunsQueryResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_change_data_capture_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_change_data_capture_operations.py index eea39471fce31..e7ffb77afaaab 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_change_data_capture_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_change_data_capture_operations.py @@ -21,15 +21,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -448,7 +446,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -464,7 +461,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -627,7 +623,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -641,7 +636,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ChangeDataCaptureResource", pipeline_response) + deserialized = self._deserialize("ChangeDataCaptureResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -697,7 +692,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -711,7 +705,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ChangeDataCaptureResource", pipeline_response) + deserialized = self._deserialize("ChangeDataCaptureResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -757,7 +751,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -813,7 +806,6 @@ def start( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -869,7 +861,6 @@ def stop( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -923,7 +914,6 @@ def status(self, resource_group_name: str, factory_name: str, change_data_captur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -937,7 +927,7 @@ def status(self, resource_group_name: str, factory_name: str, change_data_captur map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_credential_operations_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_credential_operations_operations.py index 5ec7d70c2a12d..adbba32f483bc 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_credential_operations_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_credential_operations_operations.py @@ -21,15 +21,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -303,7 +301,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -319,7 +316,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -478,7 +474,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -492,7 +487,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CredentialResource", pipeline_response) + deserialized = self._deserialize("CredentialResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,7 +543,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -564,7 +558,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("CredentialResource", pipeline_response) + deserialized = self._deserialize("CredentialResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -610,7 +604,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_data_flow_debug_session_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_data_flow_debug_session_operations.py index 879a98f2b5c09..84a649ab4a6c1 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_data_flow_debug_session_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_data_flow_debug_session_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -281,7 +281,7 @@ def _create_initial( factory_name: str, request: Union[_models.CreateDataFlowDebugSessionRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.CreateDataFlowDebugSessionResponse]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -295,7 +295,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CreateDataFlowDebugSessionResponse]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -316,10 +316,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -327,17 +327,19 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("CreateDataFlowDebugSessionResponse", pipeline_response) - if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -443,10 +445,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CreateDataFlowDebugSessionResponse", pipeline_response) + deserialized = self._deserialize("CreateDataFlowDebugSessionResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -508,7 +511,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -524,7 +526,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -660,7 +661,6 @@ def add_data_flow( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -674,7 +674,7 @@ def add_data_flow( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AddDataFlowToDebugSessionResponse", pipeline_response) + deserialized = self._deserialize("AddDataFlowToDebugSessionResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -788,7 +788,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -811,7 +810,7 @@ def _execute_command_initial( factory_name: str, request: Union[_models.DataFlowDebugCommandRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.DataFlowDebugCommandResponse]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -825,7 +824,7 @@ def _execute_command_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.DataFlowDebugCommandResponse]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -846,10 +845,10 @@ def _execute_command_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -857,17 +856,19 @@ def _execute_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("DataFlowDebugCommandResponse", pipeline_response) - if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -973,10 +974,11 @@ def begin_execute_command( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DataFlowDebugCommandResponse", pipeline_response) + deserialized = self._deserialize("DataFlowDebugCommandResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_data_flows_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_data_flows_operations.py index 7203524250bbe..062bf07233672 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_data_flows_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_data_flows_operations.py @@ -21,15 +21,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -394,7 +392,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -408,7 +405,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DataFlowResource", pipeline_response) + deserialized = self._deserialize("DataFlowResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +461,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -478,7 +474,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DataFlowResource", pipeline_response) + deserialized = self._deserialize("DataFlowResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -524,7 +520,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -580,7 +575,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -596,7 +590,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_datasets_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_datasets_operations.py index e66e71189f370..62880ce2cad6f 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_datasets_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_datasets_operations.py @@ -21,15 +21,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -303,7 +301,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -319,7 +316,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -478,7 +474,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -492,7 +487,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatasetResource", pipeline_response) + deserialized = self._deserialize("DatasetResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,7 +543,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -564,7 +558,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("DatasetResource", pipeline_response) + deserialized = self._deserialize("DatasetResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -610,7 +604,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_exposure_control_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_exposure_control_operations.py index 7eee946d5922b..94d33618346b5 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_exposure_control_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_exposure_control_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -274,7 +272,6 @@ def get_feature_value( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -288,7 +285,7 @@ def get_feature_value( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ExposureControlResponse", pipeline_response) + deserialized = self._deserialize("ExposureControlResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -403,7 +400,6 @@ def get_feature_value_by_factory( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -417,7 +413,7 @@ def get_feature_value_by_factory( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ExposureControlResponse", pipeline_response) + deserialized = self._deserialize("ExposureControlResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -535,7 +531,6 @@ def query_feature_values_by_factory( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -549,7 +544,7 @@ def query_feature_values_by_factory( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ExposureControlBatchResponse", pipeline_response) + deserialized = self._deserialize("ExposureControlBatchResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_factories_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_factories_operations.py index b3e6a1adeab79..8854b1aced51f 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_factories_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_factories_operations.py @@ -21,15 +21,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -438,7 +436,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -454,7 +451,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -572,7 +568,6 @@ def configure_factory_repo( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -586,7 +581,7 @@ def configure_factory_repo( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Factory", pipeline_response) + deserialized = self._deserialize("Factory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -627,7 +622,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -643,7 +637,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -792,7 +785,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -806,7 +798,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Factory", pipeline_response) + deserialized = self._deserialize("Factory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -921,7 +913,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -935,7 +926,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Factory", pipeline_response) + deserialized = self._deserialize("Factory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -983,7 +974,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -999,7 +989,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Factory", pipeline_response) + deserialized = self._deserialize("Factory", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1042,7 +1032,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1167,7 +1156,6 @@ def get_git_hub_access_token( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1181,7 +1169,7 @@ def get_git_hub_access_token( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubAccessTokenResponse", pipeline_response) + deserialized = self._deserialize("GitHubAccessTokenResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1295,7 +1283,6 @@ def get_data_plane_access( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1309,7 +1296,7 @@ def get_data_plane_access( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AccessPolicyResponse", pipeline_response) + deserialized = self._deserialize("AccessPolicyResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_global_parameters_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_global_parameters_operations.py index b2eaa48001d42..e68dbb25f6f87 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_global_parameters_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_global_parameters_operations.py @@ -21,15 +21,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -288,7 +286,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -304,7 +301,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -372,7 +368,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -386,7 +381,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalParameterResource", pipeline_response) + deserialized = self._deserialize("GlobalParameterResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -510,7 +505,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -524,7 +518,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalParameterResource", pipeline_response) + deserialized = self._deserialize("GlobalParameterResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -570,7 +564,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_integration_runtime_nodes_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_integration_runtime_nodes_operations.py index 6514255e5e815..a925184863fb9 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_integration_runtime_nodes_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_integration_runtime_nodes_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -328,7 +326,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -342,7 +339,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SelfHostedIntegrationRuntimeNode", pipeline_response) + deserialized = self._deserialize("SelfHostedIntegrationRuntimeNode", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -391,7 +388,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -540,7 +536,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -554,7 +549,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SelfHostedIntegrationRuntimeNode", pipeline_response) + deserialized = self._deserialize("SelfHostedIntegrationRuntimeNode", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -603,7 +598,6 @@ def get_ip_address( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -617,7 +611,7 @@ def get_ip_address( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeNodeIpAddress", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeNodeIpAddress", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_integration_runtime_object_metadata_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_integration_runtime_object_metadata_operations.py index da07d23ee07c2..f3a6f5410db06 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_integration_runtime_object_metadata_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_integration_runtime_object_metadata_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,7 +30,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -162,7 +162,7 @@ def __init__(self, *args, **kwargs): def _refresh_initial( self, resource_group_name: str, factory_name: str, integration_runtime_name: str, **kwargs: Any - ) -> Optional[_models.SsisObjectMetadataStatusResponse]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -175,7 +175,7 @@ def _refresh_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.SsisObjectMetadataStatusResponse]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_refresh_request( resource_group_name=resource_group_name, @@ -186,10 +186,10 @@ def _refresh_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -197,12 +197,14 @@ def _refresh_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SsisObjectMetadataStatusResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -246,10 +248,11 @@ def begin_refresh( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SsisObjectMetadataStatusResponse", pipeline_response) + deserialized = self._deserialize("SsisObjectMetadataStatusResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -397,7 +400,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -411,7 +413,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SsisObjectMetadataListResponse", pipeline_response) + deserialized = self._deserialize("SsisObjectMetadataListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_integration_runtimes_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_integration_runtimes_operations.py index a697acdc95b6d..b3fec9c18ddcc 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_integration_runtimes_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_integration_runtimes_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -942,7 +942,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -958,7 +957,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1121,7 +1119,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1135,7 +1132,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeResource", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1191,7 +1188,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1207,7 +1203,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("IntegrationRuntimeResource", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1335,7 +1331,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1349,7 +1344,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeResource", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1395,7 +1390,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1451,7 +1445,6 @@ def get_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1465,7 +1458,7 @@ def get_status( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1513,7 +1506,6 @@ def list_outbound_network_dependencies_endpoints( # pylint: disable=name-too-lo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1528,7 +1520,7 @@ def list_outbound_network_dependencies_endpoints( # pylint: disable=name-too-lo raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize( - "IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse", pipeline_response + "IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse", pipeline_response.http_response ) if cls: @@ -1576,7 +1568,6 @@ def get_connection_info( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1590,7 +1581,7 @@ def get_connection_info( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeConnectionInfo", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeConnectionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1719,7 +1710,6 @@ def regenerate_auth_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1733,7 +1723,7 @@ def regenerate_auth_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeAuthKeys", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeAuthKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1779,7 +1769,6 @@ def list_auth_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1793,7 +1782,7 @@ def list_auth_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeAuthKeys", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeAuthKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1802,7 +1791,7 @@ def list_auth_keys( def _start_initial( self, resource_group_name: str, factory_name: str, integration_runtime_name: str, **kwargs: Any - ) -> Optional[_models.IntegrationRuntimeStatusResponse]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1815,7 +1804,7 @@ def _start_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.IntegrationRuntimeStatusResponse]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -1826,10 +1815,10 @@ def _start_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1837,12 +1826,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1886,10 +1877,11 @@ def begin_start( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1911,9 +1903,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _stop_initial( # pylint: disable=inconsistent-return-statements + def _stop_initial( self, resource_group_name: str, factory_name: str, integration_runtime_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1926,7 +1918,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -1937,10 +1929,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1948,11 +1940,19 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_stop( @@ -1979,7 +1979,7 @@ def begin_stop( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._stop_initial( # type: ignore + raw_result = self._stop_initial( resource_group_name=resource_group_name, factory_name=factory_name, integration_runtime_name=integration_runtime_name, @@ -1989,6 +1989,7 @@ def begin_stop( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2052,7 +2053,6 @@ def sync_credentials( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2109,7 +2109,6 @@ def get_monitoring_data( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2123,7 +2122,7 @@ def get_monitoring_data( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeMonitoringData", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeMonitoringData", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2169,7 +2168,6 @@ def upgrade( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2310,7 +2308,6 @@ def remove_links( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2450,7 +2447,6 @@ def create_linked_integration_runtime( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2464,7 +2460,7 @@ def create_linked_integration_runtime( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeStatusResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_linked_services_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_linked_services_operations.py index 336723385af27..63d7ce3107512 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_linked_services_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_linked_services_operations.py @@ -21,15 +21,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -304,7 +302,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -320,7 +317,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -482,7 +478,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -496,7 +491,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LinkedServiceResource", pipeline_response) + deserialized = self._deserialize("LinkedServiceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -552,7 +547,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -568,7 +562,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("LinkedServiceResource", pipeline_response) + deserialized = self._deserialize("LinkedServiceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +608,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_managed_private_endpoints_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_managed_private_endpoints_operations.py index d6d035e10c31b..20257def35883 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_managed_private_endpoints_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_managed_private_endpoints_operations.py @@ -21,15 +21,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -347,7 +345,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -363,7 +360,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -536,7 +532,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -550,7 +545,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedPrivateEndpointResource", pipeline_response) + deserialized = self._deserialize("ManagedPrivateEndpointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -610,7 +605,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -624,7 +618,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedPrivateEndpointResource", pipeline_response) + deserialized = self._deserialize("ManagedPrivateEndpointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -678,7 +672,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_managed_virtual_networks_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_managed_virtual_networks_operations.py index 8e8d3c925a40b..f13244070d734 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_managed_virtual_networks_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_managed_virtual_networks_operations.py @@ -21,15 +21,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -257,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -273,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -436,7 +432,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -450,7 +445,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedVirtualNetworkResource", pipeline_response) + deserialized = self._deserialize("ManagedVirtualNetworkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -506,7 +501,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -520,7 +514,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagedVirtualNetworkResource", pipeline_response) + deserialized = self._deserialize("ManagedVirtualNetworkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_operations.py index 6cc126f9ab3d5..b6be3c7fe2493 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_operations.py @@ -20,15 +20,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -109,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_pipeline_runs_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_pipeline_runs_operations.py index 2a211e013a6eb..9fc1d2636bd2d 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_pipeline_runs_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_pipeline_runs_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -299,7 +297,6 @@ def query_by_factory( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -313,7 +310,7 @@ def query_by_factory( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PipelineRunsQueryResponse", pipeline_response) + deserialized = self._deserialize("PipelineRunsQueryResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -357,7 +354,6 @@ def get(self, resource_group_name: str, factory_name: str, run_id: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +367,7 @@ def get(self, resource_group_name: str, factory_name: str, run_id: str, **kwargs map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PipelineRun", pipeline_response) + deserialized = self._deserialize("PipelineRun", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -426,7 +422,6 @@ def cancel( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_pipelines_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_pipelines_operations.py index 6d3f7ef8bae2d..573caa3617a6a 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_pipelines_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_pipelines_operations.py @@ -21,15 +21,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -374,7 +372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -390,7 +387,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -549,7 +545,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -563,7 +558,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PipelineResource", pipeline_response) + deserialized = self._deserialize("PipelineResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -619,7 +614,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -635,7 +629,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("PipelineResource", pipeline_response) + deserialized = self._deserialize("PipelineResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -681,7 +675,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -879,7 +872,6 @@ def create_run( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -893,7 +885,7 @@ def create_run( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CreateRunResponse", pipeline_response) + deserialized = self._deserialize("CreateRunResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_end_point_connections_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_end_point_connections_operations.py index 99924ff8aef82..3976f19d464bf 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_end_point_connections_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_end_point_connections_operations.py @@ -20,15 +20,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -141,7 +139,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -157,7 +154,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_endpoint_connection_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_endpoint_connection_operations.py index 4ae9311014f3f..c731ff51c36d6 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_endpoint_connection_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_endpoint_connection_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -346,7 +344,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +357,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +413,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -430,7 +426,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -476,7 +472,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_link_resources_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_link_resources_operations.py index 69246e7ba86ba..02ddf24d59913 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_link_resources_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_link_resources_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -130,7 +128,6 @@ def get(self, resource_group_name: str, factory_name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -144,7 +141,7 @@ def get(self, resource_group_name: str, factory_name: str, **kwargs: Any) -> _mo map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesWrapper", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_trigger_runs_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_trigger_runs_operations.py index b7287aa292e7b..885ad4224f886 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_trigger_runs_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_trigger_runs_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -242,7 +240,6 @@ def rerun( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -301,7 +298,6 @@ def cancel( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -425,7 +421,6 @@ def query_by_factory( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -439,7 +434,7 @@ def query_by_factory( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggerRunsQueryResponse", pipeline_response) + deserialized = self._deserialize("TriggerRunsQueryResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_triggers_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_triggers_operations.py index 34014519da017..90d8ee35aea99 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_triggers_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_triggers_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -588,7 +588,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -604,7 +603,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -740,7 +738,6 @@ def query_by_factory( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -754,7 +751,7 @@ def query_by_factory( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggerQueryResponse", pipeline_response) + deserialized = self._deserialize("TriggerQueryResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -891,7 +888,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -905,7 +901,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggerResource", pipeline_response) + deserialized = self._deserialize("TriggerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -961,7 +957,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -977,7 +972,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("TriggerResource", pipeline_response) + deserialized = self._deserialize("TriggerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1023,7 +1018,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1042,7 +1036,7 @@ def delete( # pylint: disable=inconsistent-return-statements def _subscribe_to_events_initial( self, resource_group_name: str, factory_name: str, trigger_name: str, **kwargs: Any - ) -> Optional[_models.TriggerSubscriptionOperationStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1055,7 +1049,7 @@ def _subscribe_to_events_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.TriggerSubscriptionOperationStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_subscribe_to_events_request( resource_group_name=resource_group_name, @@ -1066,10 +1060,10 @@ def _subscribe_to_events_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1077,12 +1071,14 @@ def _subscribe_to_events_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1126,10 +1122,11 @@ def begin_subscribe_to_events( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response) + deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1190,7 +1187,6 @@ def get_event_subscription_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1204,7 +1200,7 @@ def get_event_subscription_status( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response) + deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1213,7 +1209,7 @@ def get_event_subscription_status( def _unsubscribe_from_events_initial( self, resource_group_name: str, factory_name: str, trigger_name: str, **kwargs: Any - ) -> Optional[_models.TriggerSubscriptionOperationStatus]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1226,7 +1222,7 @@ def _unsubscribe_from_events_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.TriggerSubscriptionOperationStatus]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_unsubscribe_from_events_request( resource_group_name=resource_group_name, @@ -1237,10 +1233,10 @@ def _unsubscribe_from_events_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1248,12 +1244,14 @@ def _unsubscribe_from_events_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1297,10 +1295,11 @@ def begin_unsubscribe_from_events( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response) + deserialized = self._deserialize("TriggerSubscriptionOperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1322,9 +1321,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _start_initial( # pylint: disable=inconsistent-return-statements + def _start_initial( self, resource_group_name: str, factory_name: str, trigger_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1337,7 +1336,7 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -1348,10 +1347,10 @@ def _start_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1359,11 +1358,19 @@ def _start_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_start( @@ -1390,7 +1397,7 @@ def begin_start( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._start_initial( # type: ignore + raw_result = self._start_initial( resource_group_name=resource_group_name, factory_name=factory_name, trigger_name=trigger_name, @@ -1400,6 +1407,7 @@ def begin_start( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1421,9 +1429,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements + def _stop_initial( self, resource_group_name: str, factory_name: str, trigger_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1436,7 +1444,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -1447,10 +1455,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1458,11 +1466,19 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_stop( @@ -1489,7 +1505,7 @@ def begin_stop( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._stop_initial( # type: ignore + raw_result = self._stop_initial( resource_group_name=resource_group_name, factory_name=factory_name, trigger_name=trigger_name, @@ -1499,6 +1515,7 @@ def begin_stop( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/datafactory/azure-mgmt-datafactory/dev_requirements.txt b/sdk/datafactory/azure-mgmt-datafactory/dev_requirements.txt index 1cfa079cdfb14..fa6811a93df07 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/dev_requirements.txt +++ b/sdk/datafactory/azure-mgmt-datafactory/dev_requirements.txt @@ -1,2 +1,3 @@ -e ../../../tools/azure-sdk-tools -e ../../resources/azure-mgmt-resource +aiohttp \ No newline at end of file diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/conftest.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/conftest.py new file mode 100644 index 0000000000000..6d9707a4e6e20 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/conftest.py @@ -0,0 +1,39 @@ +# 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. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + datafactorymanagement_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + datafactorymanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + datafactorymanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + datafactorymanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=datafactorymanagement_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=datafactorymanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=datafactorymanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=datafactorymanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_activity_runs_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_activity_runs_operations.py new file mode 100644 index 0000000000000..30425facce342 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_activity_runs_operations.py @@ -0,0 +1,39 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementActivityRunsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_query_by_pipeline_run(self, resource_group): + response = self.client.activity_runs.query_by_pipeline_run( + resource_group_name=resource_group.name, + factory_name="str", + run_id="str", + filter_parameters={ + "lastUpdatedAfter": "2020-02-20 00:00:00", + "lastUpdatedBefore": "2020-02-20 00:00:00", + "continuationToken": "str", + "filters": [{"operand": "str", "operator": "str", "values": ["str"]}], + "orderBy": [{"order": "str", "orderBy": "str"}], + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_activity_runs_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_activity_runs_operations_async.py new file mode 100644 index 0000000000000..26a8455f02dee --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_activity_runs_operations_async.py @@ -0,0 +1,40 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementActivityRunsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_query_by_pipeline_run(self, resource_group): + response = await self.client.activity_runs.query_by_pipeline_run( + resource_group_name=resource_group.name, + factory_name="str", + run_id="str", + filter_parameters={ + "lastUpdatedAfter": "2020-02-20 00:00:00", + "lastUpdatedBefore": "2020-02-20 00:00:00", + "continuationToken": "str", + "filters": [{"operand": "str", "operator": "str", "values": ["str"]}], + "orderBy": [{"order": "str", "orderBy": "str"}], + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_change_data_capture_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_change_data_capture_operations.py new file mode 100644 index 0000000000000..edee8c213e4d7 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_change_data_capture_operations.py @@ -0,0 +1,190 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementChangeDataCaptureOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_factory(self, resource_group): + response = self.client.change_data_capture.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.change_data_capture.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + change_data_capture_name="str", + change_data_capture={ + "policy": {"mode": "str", "recurrence": {"frequency": "str", "interval": 0}}, + "sourceConnectionsInfo": [ + { + "connection": { + "type": "str", + "commonDslConnectorProperties": [{"name": "str", "value": {}}], + "isInlineDataset": bool, + "linkedService": {"referenceName": "str", "type": "str", "parameters": {"str": {}}}, + "linkedServiceType": "str", + }, + "sourceEntities": [ + { + "dslConnectorProperties": [{"name": "str", "value": {}}], + "name": "str", + "schema": [{"dataType": "str", "name": "str"}], + } + ], + } + ], + "targetConnectionsInfo": [ + { + "connection": { + "type": "str", + "commonDslConnectorProperties": [{"name": "str", "value": {}}], + "isInlineDataset": bool, + "linkedService": {"referenceName": "str", "type": "str", "parameters": {"str": {}}}, + "linkedServiceType": "str", + }, + "dataMapperMappings": [ + { + "attributeMappingInfo": { + "attributeMappings": [ + { + "attributeReference": { + "entity": "str", + "entityConnectionReference": {"connectionName": "str", "type": "str"}, + "name": "str", + }, + "attributeReferences": [ + { + "entity": "str", + "entityConnectionReference": { + "connectionName": "str", + "type": "str", + }, + "name": "str", + } + ], + "expression": "str", + "functionName": "str", + "name": "str", + "type": "str", + } + ] + }, + "sourceConnectionReference": {"connectionName": "str", "type": "str"}, + "sourceDenormalizeInfo": {}, + "sourceEntityName": "str", + "targetEntityName": "str", + } + ], + "relationships": [{}], + "targetEntities": [ + { + "dslConnectorProperties": [{"name": "str", "value": {}}], + "name": "str", + "schema": [{"dataType": "str", "name": "str"}], + } + ], + } + ], + "allowVNetOverride": bool, + "description": "str", + "etag": "str", + "folder": {"name": "str"}, + "id": "str", + "name": "str", + "status": "str", + "type": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.change_data_capture.get( + resource_group_name=resource_group.name, + factory_name="str", + change_data_capture_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.change_data_capture.delete( + resource_group_name=resource_group.name, + factory_name="str", + change_data_capture_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_start(self, resource_group): + response = self.client.change_data_capture.start( + resource_group_name=resource_group.name, + factory_name="str", + change_data_capture_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_stop(self, resource_group): + response = self.client.change_data_capture.stop( + resource_group_name=resource_group.name, + factory_name="str", + change_data_capture_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_status(self, resource_group): + response = self.client.change_data_capture.status( + resource_group_name=resource_group.name, + factory_name="str", + change_data_capture_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_change_data_capture_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_change_data_capture_operations_async.py new file mode 100644 index 0000000000000..325a9f0e1cf96 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_change_data_capture_operations_async.py @@ -0,0 +1,191 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementChangeDataCaptureOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_factory(self, resource_group): + response = self.client.change_data_capture.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.change_data_capture.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + change_data_capture_name="str", + change_data_capture={ + "policy": {"mode": "str", "recurrence": {"frequency": "str", "interval": 0}}, + "sourceConnectionsInfo": [ + { + "connection": { + "type": "str", + "commonDslConnectorProperties": [{"name": "str", "value": {}}], + "isInlineDataset": bool, + "linkedService": {"referenceName": "str", "type": "str", "parameters": {"str": {}}}, + "linkedServiceType": "str", + }, + "sourceEntities": [ + { + "dslConnectorProperties": [{"name": "str", "value": {}}], + "name": "str", + "schema": [{"dataType": "str", "name": "str"}], + } + ], + } + ], + "targetConnectionsInfo": [ + { + "connection": { + "type": "str", + "commonDslConnectorProperties": [{"name": "str", "value": {}}], + "isInlineDataset": bool, + "linkedService": {"referenceName": "str", "type": "str", "parameters": {"str": {}}}, + "linkedServiceType": "str", + }, + "dataMapperMappings": [ + { + "attributeMappingInfo": { + "attributeMappings": [ + { + "attributeReference": { + "entity": "str", + "entityConnectionReference": {"connectionName": "str", "type": "str"}, + "name": "str", + }, + "attributeReferences": [ + { + "entity": "str", + "entityConnectionReference": { + "connectionName": "str", + "type": "str", + }, + "name": "str", + } + ], + "expression": "str", + "functionName": "str", + "name": "str", + "type": "str", + } + ] + }, + "sourceConnectionReference": {"connectionName": "str", "type": "str"}, + "sourceDenormalizeInfo": {}, + "sourceEntityName": "str", + "targetEntityName": "str", + } + ], + "relationships": [{}], + "targetEntities": [ + { + "dslConnectorProperties": [{"name": "str", "value": {}}], + "name": "str", + "schema": [{"dataType": "str", "name": "str"}], + } + ], + } + ], + "allowVNetOverride": bool, + "description": "str", + "etag": "str", + "folder": {"name": "str"}, + "id": "str", + "name": "str", + "status": "str", + "type": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.change_data_capture.get( + resource_group_name=resource_group.name, + factory_name="str", + change_data_capture_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.change_data_capture.delete( + resource_group_name=resource_group.name, + factory_name="str", + change_data_capture_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_start(self, resource_group): + response = await self.client.change_data_capture.start( + resource_group_name=resource_group.name, + factory_name="str", + change_data_capture_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_stop(self, resource_group): + response = await self.client.change_data_capture.stop( + resource_group_name=resource_group.name, + factory_name="str", + change_data_capture_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_status(self, resource_group): + response = await self.client.change_data_capture.status( + resource_group_name=resource_group.name, + factory_name="str", + change_data_capture_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_credential_operations_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_credential_operations_operations.py new file mode 100644 index 0000000000000..aa12eb5bb295b --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_credential_operations_operations.py @@ -0,0 +1,71 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementCredentialOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_factory(self, resource_group): + response = self.client.credential_operations.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.credential_operations.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + credential_name="str", + credential={"properties": "credential", "etag": "str", "id": "str", "name": "str", "type": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.credential_operations.get( + resource_group_name=resource_group.name, + factory_name="str", + credential_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.credential_operations.delete( + resource_group_name=resource_group.name, + factory_name="str", + credential_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_credential_operations_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_credential_operations_operations_async.py new file mode 100644 index 0000000000000..bc363029eb586 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_credential_operations_operations_async.py @@ -0,0 +1,72 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementCredentialOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_factory(self, resource_group): + response = self.client.credential_operations.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.credential_operations.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + credential_name="str", + credential={"properties": "credential", "etag": "str", "id": "str", "name": "str", "type": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.credential_operations.get( + resource_group_name=resource_group.name, + factory_name="str", + credential_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.credential_operations.delete( + resource_group_name=resource_group.name, + factory_name="str", + credential_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_data_flow_debug_session_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_data_flow_debug_session_operations.py new file mode 100644 index 0000000000000..009a428155ed7 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_data_flow_debug_session_operations.py @@ -0,0 +1,107 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementDataFlowDebugSessionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.data_flow_debug_session.begin_create( + resource_group_name=resource_group.name, + factory_name="str", + request={ + "computeType": "str", + "coreCount": 0, + "integrationRuntime": {"properties": "integration_runtime", "name": "str"}, + "timeToLive": 0, + }, + api_version="2018-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_query_by_factory(self, resource_group): + response = self.client.data_flow_debug_session.query_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_add_data_flow(self, resource_group): + response = self.client.data_flow_debug_session.add_data_flow( + resource_group_name=resource_group.name, + factory_name="str", + request={ + "dataFlow": {"properties": "data_flow", "name": "str"}, + "dataFlows": [{"properties": "data_flow", "name": "str"}], + "datasets": [{"properties": "dataset", "name": "str"}], + "debugSettings": { + "datasetParameters": {}, + "parameters": {"str": {}}, + "sourceSettings": [{"rowLimit": 0, "sourceName": "str"}], + }, + "linkedServices": [{"properties": "linked_service", "name": "str"}], + "sessionId": "str", + "staging": { + "folderPath": {}, + "linkedService": {"referenceName": "str", "type": "str", "parameters": {"str": {}}}, + }, + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.data_flow_debug_session.delete( + resource_group_name=resource_group.name, + factory_name="str", + request={"sessionId": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_execute_command(self, resource_group): + response = self.client.data_flow_debug_session.begin_execute_command( + resource_group_name=resource_group.name, + factory_name="str", + request={ + "command": "str", + "commandPayload": {"streamName": "str", "columns": ["str"], "expression": "str", "rowLimits": 0}, + "sessionId": "str", + }, + api_version="2018-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_data_flow_debug_session_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_data_flow_debug_session_operations_async.py new file mode 100644 index 0000000000000..c8fc8f2c97803 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_data_flow_debug_session_operations_async.py @@ -0,0 +1,112 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementDataFlowDebugSessionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.data_flow_debug_session.begin_create( + resource_group_name=resource_group.name, + factory_name="str", + request={ + "computeType": "str", + "coreCount": 0, + "integrationRuntime": {"properties": "integration_runtime", "name": "str"}, + "timeToLive": 0, + }, + api_version="2018-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_query_by_factory(self, resource_group): + response = self.client.data_flow_debug_session.query_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_add_data_flow(self, resource_group): + response = await self.client.data_flow_debug_session.add_data_flow( + resource_group_name=resource_group.name, + factory_name="str", + request={ + "dataFlow": {"properties": "data_flow", "name": "str"}, + "dataFlows": [{"properties": "data_flow", "name": "str"}], + "datasets": [{"properties": "dataset", "name": "str"}], + "debugSettings": { + "datasetParameters": {}, + "parameters": {"str": {}}, + "sourceSettings": [{"rowLimit": 0, "sourceName": "str"}], + }, + "linkedServices": [{"properties": "linked_service", "name": "str"}], + "sessionId": "str", + "staging": { + "folderPath": {}, + "linkedService": {"referenceName": "str", "type": "str", "parameters": {"str": {}}}, + }, + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.data_flow_debug_session.delete( + resource_group_name=resource_group.name, + factory_name="str", + request={"sessionId": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_execute_command(self, resource_group): + response = await ( + await self.client.data_flow_debug_session.begin_execute_command( + resource_group_name=resource_group.name, + factory_name="str", + request={ + "command": "str", + "commandPayload": {"streamName": "str", "columns": ["str"], "expression": "str", "rowLimits": 0}, + "sessionId": "str", + }, + api_version="2018-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_data_flows_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_data_flows_operations.py new file mode 100644 index 0000000000000..3db90f62abd43 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_data_flows_operations.py @@ -0,0 +1,71 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementDataFlowsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.data_flows.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + data_flow_name="str", + data_flow={"properties": "data_flow", "etag": "str", "id": "str", "name": "str", "type": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.data_flows.get( + resource_group_name=resource_group.name, + factory_name="str", + data_flow_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.data_flows.delete( + resource_group_name=resource_group.name, + factory_name="str", + data_flow_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_factory(self, resource_group): + response = self.client.data_flows.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_data_flows_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_data_flows_operations_async.py new file mode 100644 index 0000000000000..41513ff09d7bb --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_data_flows_operations_async.py @@ -0,0 +1,72 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementDataFlowsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.data_flows.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + data_flow_name="str", + data_flow={"properties": "data_flow", "etag": "str", "id": "str", "name": "str", "type": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.data_flows.get( + resource_group_name=resource_group.name, + factory_name="str", + data_flow_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.data_flows.delete( + resource_group_name=resource_group.name, + factory_name="str", + data_flow_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_factory(self, resource_group): + response = self.client.data_flows.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_datasets_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_datasets_operations.py new file mode 100644 index 0000000000000..14348641640bd --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_datasets_operations.py @@ -0,0 +1,71 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementDatasetsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_factory(self, resource_group): + response = self.client.datasets.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.datasets.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + dataset_name="str", + dataset={"properties": "dataset", "etag": "str", "id": "str", "name": "str", "type": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.datasets.get( + resource_group_name=resource_group.name, + factory_name="str", + dataset_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.datasets.delete( + resource_group_name=resource_group.name, + factory_name="str", + dataset_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_datasets_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_datasets_operations_async.py new file mode 100644 index 0000000000000..97836ed4ceb58 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_datasets_operations_async.py @@ -0,0 +1,72 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementDatasetsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_factory(self, resource_group): + response = self.client.datasets.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.datasets.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + dataset_name="str", + dataset={"properties": "dataset", "etag": "str", "id": "str", "name": "str", "type": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.datasets.get( + resource_group_name=resource_group.name, + factory_name="str", + dataset_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.datasets.delete( + resource_group_name=resource_group.name, + factory_name="str", + dataset_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_exposure_control_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_exposure_control_operations.py new file mode 100644 index 0000000000000..246081c8f53ff --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_exposure_control_operations.py @@ -0,0 +1,57 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementExposureControlOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_feature_value(self, resource_group): + response = self.client.exposure_control.get_feature_value( + location_id="str", + exposure_control_request={"featureName": "str", "featureType": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_feature_value_by_factory(self, resource_group): + response = self.client.exposure_control.get_feature_value_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + exposure_control_request={"featureName": "str", "featureType": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_query_feature_values_by_factory(self, resource_group): + response = self.client.exposure_control.query_feature_values_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + exposure_control_batch_request={"exposureControlRequests": [{"featureName": "str", "featureType": "str"}]}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_exposure_control_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_exposure_control_operations_async.py new file mode 100644 index 0000000000000..a0ceb77d02033 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_exposure_control_operations_async.py @@ -0,0 +1,58 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementExposureControlOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_feature_value(self, resource_group): + response = await self.client.exposure_control.get_feature_value( + location_id="str", + exposure_control_request={"featureName": "str", "featureType": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_feature_value_by_factory(self, resource_group): + response = await self.client.exposure_control.get_feature_value_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + exposure_control_request={"featureName": "str", "featureType": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_query_feature_values_by_factory(self, resource_group): + response = await self.client.exposure_control.query_feature_values_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + exposure_control_batch_request={"exposureControlRequests": [{"featureName": "str", "featureType": "str"}]}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations.py new file mode 100644 index 0000000000000..94dbeb5cf9fb9 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations.py @@ -0,0 +1,174 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementFactoriesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.factories.list( + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_configure_factory_repo(self, resource_group): + response = self.client.factories.configure_factory_repo( + location_id="str", + factory_repo_update={"factoryResourceId": "str", "repoConfiguration": "factory_repo_configuration"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.factories.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.factories.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + factory={ + "createTime": "2020-02-20 00:00:00", + "eTag": "str", + "encryption": { + "keyName": "str", + "vaultBaseUrl": "str", + "identity": {"userAssignedIdentity": "str"}, + "keyVersion": "str", + }, + "globalParameters": {"str": {"type": "str", "value": {}}}, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {}}, + }, + "location": "str", + "name": "str", + "provisioningState": "str", + "publicNetworkAccess": "str", + "purviewConfiguration": {"purviewResourceId": "str"}, + "repoConfiguration": "factory_repo_configuration", + "tags": {"str": "str"}, + "type": "str", + "version": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.factories.update( + resource_group_name=resource_group.name, + factory_name="str", + factory_update_parameters={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {}}, + }, + "publicNetworkAccess": "str", + "tags": {"str": "str"}, + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.factories.get( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.factories.delete( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_git_hub_access_token(self, resource_group): + response = self.client.factories.get_git_hub_access_token( + resource_group_name=resource_group.name, + factory_name="str", + git_hub_access_token_request={ + "gitHubAccessCode": "str", + "gitHubAccessTokenBaseUrl": "str", + "gitHubClientId": "str", + "gitHubClientSecret": {"byoaSecretAkvUrl": "str", "byoaSecretName": "str"}, + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_data_plane_access(self, resource_group): + response = self.client.factories.get_data_plane_access( + resource_group_name=resource_group.name, + factory_name="str", + policy={ + "accessResourcePath": "str", + "expireTime": "str", + "permissions": "str", + "profileName": "str", + "startTime": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations_async.py new file mode 100644 index 0000000000000..fd08741d55f96 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations_async.py @@ -0,0 +1,175 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementFactoriesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.factories.list( + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_configure_factory_repo(self, resource_group): + response = await self.client.factories.configure_factory_repo( + location_id="str", + factory_repo_update={"factoryResourceId": "str", "repoConfiguration": "factory_repo_configuration"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.factories.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.factories.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + factory={ + "createTime": "2020-02-20 00:00:00", + "eTag": "str", + "encryption": { + "keyName": "str", + "vaultBaseUrl": "str", + "identity": {"userAssignedIdentity": "str"}, + "keyVersion": "str", + }, + "globalParameters": {"str": {"type": "str", "value": {}}}, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {}}, + }, + "location": "str", + "name": "str", + "provisioningState": "str", + "publicNetworkAccess": "str", + "purviewConfiguration": {"purviewResourceId": "str"}, + "repoConfiguration": "factory_repo_configuration", + "tags": {"str": "str"}, + "type": "str", + "version": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.factories.update( + resource_group_name=resource_group.name, + factory_name="str", + factory_update_parameters={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {}}, + }, + "publicNetworkAccess": "str", + "tags": {"str": "str"}, + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.factories.get( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.factories.delete( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_git_hub_access_token(self, resource_group): + response = await self.client.factories.get_git_hub_access_token( + resource_group_name=resource_group.name, + factory_name="str", + git_hub_access_token_request={ + "gitHubAccessCode": "str", + "gitHubAccessTokenBaseUrl": "str", + "gitHubClientId": "str", + "gitHubClientSecret": {"byoaSecretAkvUrl": "str", "byoaSecretName": "str"}, + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_data_plane_access(self, resource_group): + response = await self.client.factories.get_data_plane_access( + resource_group_name=resource_group.name, + factory_name="str", + policy={ + "accessResourcePath": "str", + "expireTime": "str", + "permissions": "str", + "profileName": "str", + "startTime": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_global_parameters_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_global_parameters_operations.py new file mode 100644 index 0000000000000..55324ca068c38 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_global_parameters_operations.py @@ -0,0 +1,77 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementGlobalParametersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_factory(self, resource_group): + response = self.client.global_parameters.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.global_parameters.get( + resource_group_name=resource_group.name, + factory_name="str", + global_parameter_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.global_parameters.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + global_parameter_name="str", + default={ + "properties": {"str": {"type": "str", "value": {}}}, + "etag": "str", + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.global_parameters.delete( + resource_group_name=resource_group.name, + factory_name="str", + global_parameter_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_global_parameters_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_global_parameters_operations_async.py new file mode 100644 index 0000000000000..704e5a26b0cd4 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_global_parameters_operations_async.py @@ -0,0 +1,78 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementGlobalParametersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_factory(self, resource_group): + response = self.client.global_parameters.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.global_parameters.get( + resource_group_name=resource_group.name, + factory_name="str", + global_parameter_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.global_parameters.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + global_parameter_name="str", + default={ + "properties": {"str": {"type": "str", "value": {}}}, + "etag": "str", + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.global_parameters.delete( + resource_group_name=resource_group.name, + factory_name="str", + global_parameter_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtime_nodes_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtime_nodes_operations.py new file mode 100644 index 0000000000000..f8966ee56c401 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtime_nodes_operations.py @@ -0,0 +1,76 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementIntegrationRuntimeNodesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.integration_runtime_nodes.get( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + node_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.integration_runtime_nodes.delete( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + node_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.integration_runtime_nodes.update( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + node_name="str", + update_integration_runtime_node_request={"concurrentJobsLimit": 0}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_ip_address(self, resource_group): + response = self.client.integration_runtime_nodes.get_ip_address( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + node_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtime_nodes_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtime_nodes_operations_async.py new file mode 100644 index 0000000000000..52b99df852d98 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtime_nodes_operations_async.py @@ -0,0 +1,77 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementIntegrationRuntimeNodesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.integration_runtime_nodes.get( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + node_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.integration_runtime_nodes.delete( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + node_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.integration_runtime_nodes.update( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + node_name="str", + update_integration_runtime_node_request={"concurrentJobsLimit": 0}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_ip_address(self, resource_group): + response = await self.client.integration_runtime_nodes.get_ip_address( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + node_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtime_object_metadata_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtime_object_metadata_operations.py new file mode 100644 index 0000000000000..8b3f0ea1ecf68 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtime_object_metadata_operations.py @@ -0,0 +1,45 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementIntegrationRuntimeObjectMetadataOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_refresh(self, resource_group): + response = self.client.integration_runtime_object_metadata.begin_refresh( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.integration_runtime_object_metadata.get( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtime_object_metadata_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtime_object_metadata_operations_async.py new file mode 100644 index 0000000000000..1d095b566c430 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtime_object_metadata_operations_async.py @@ -0,0 +1,48 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementIntegrationRuntimeObjectMetadataOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_refresh(self, resource_group): + response = await ( + await self.client.integration_runtime_object_metadata.begin_refresh( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.integration_runtime_object_metadata.get( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtimes_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtimes_operations.py new file mode 100644 index 0000000000000..7816caf1974ba --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtimes_operations.py @@ -0,0 +1,255 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementIntegrationRuntimesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_factory(self, resource_group): + response = self.client.integration_runtimes.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.integration_runtimes.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + integration_runtime={ + "properties": "integration_runtime", + "etag": "str", + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.integration_runtimes.get( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.integration_runtimes.update( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + update_integration_runtime_request={"autoUpdate": "str", "updateDelayOffset": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.integration_runtimes.delete( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_status(self, resource_group): + response = self.client.integration_runtimes.get_status( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_outbound_network_dependencies_endpoints(self, resource_group): + response = self.client.integration_runtimes.list_outbound_network_dependencies_endpoints( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_connection_info(self, resource_group): + response = self.client.integration_runtimes.get_connection_info( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_regenerate_auth_key(self, resource_group): + response = self.client.integration_runtimes.regenerate_auth_key( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + regenerate_key_parameters={"keyName": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_auth_keys(self, resource_group): + response = self.client.integration_runtimes.list_auth_keys( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start(self, resource_group): + response = self.client.integration_runtimes.begin_start( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_stop(self, resource_group): + response = self.client.integration_runtimes.begin_stop( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sync_credentials(self, resource_group): + response = self.client.integration_runtimes.sync_credentials( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_monitoring_data(self, resource_group): + response = self.client.integration_runtimes.get_monitoring_data( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_upgrade(self, resource_group): + response = self.client.integration_runtimes.upgrade( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_remove_links(self, resource_group): + response = self.client.integration_runtimes.remove_links( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + linked_integration_runtime_request={"factoryName": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_linked_integration_runtime(self, resource_group): + response = self.client.integration_runtimes.create_linked_integration_runtime( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + create_linked_integration_runtime_request={ + "dataFactoryLocation": "str", + "dataFactoryName": "str", + "name": "str", + "subscriptionId": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtimes_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtimes_operations_async.py new file mode 100644 index 0000000000000..50675e5348608 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_integration_runtimes_operations_async.py @@ -0,0 +1,260 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementIntegrationRuntimesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_factory(self, resource_group): + response = self.client.integration_runtimes.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.integration_runtimes.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + integration_runtime={ + "properties": "integration_runtime", + "etag": "str", + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.integration_runtimes.get( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.integration_runtimes.update( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + update_integration_runtime_request={"autoUpdate": "str", "updateDelayOffset": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.integration_runtimes.delete( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_status(self, resource_group): + response = await self.client.integration_runtimes.get_status( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_outbound_network_dependencies_endpoints(self, resource_group): + response = await self.client.integration_runtimes.list_outbound_network_dependencies_endpoints( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_connection_info(self, resource_group): + response = await self.client.integration_runtimes.get_connection_info( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_regenerate_auth_key(self, resource_group): + response = await self.client.integration_runtimes.regenerate_auth_key( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + regenerate_key_parameters={"keyName": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_auth_keys(self, resource_group): + response = await self.client.integration_runtimes.list_auth_keys( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start(self, resource_group): + response = await ( + await self.client.integration_runtimes.begin_start( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_stop(self, resource_group): + response = await ( + await self.client.integration_runtimes.begin_stop( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sync_credentials(self, resource_group): + response = await self.client.integration_runtimes.sync_credentials( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_monitoring_data(self, resource_group): + response = await self.client.integration_runtimes.get_monitoring_data( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_upgrade(self, resource_group): + response = await self.client.integration_runtimes.upgrade( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_remove_links(self, resource_group): + response = await self.client.integration_runtimes.remove_links( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + linked_integration_runtime_request={"factoryName": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_linked_integration_runtime(self, resource_group): + response = await self.client.integration_runtimes.create_linked_integration_runtime( + resource_group_name=resource_group.name, + factory_name="str", + integration_runtime_name="str", + create_linked_integration_runtime_request={ + "dataFactoryLocation": "str", + "dataFactoryName": "str", + "name": "str", + "subscriptionId": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_linked_services_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_linked_services_operations.py new file mode 100644 index 0000000000000..860fca87ee4dc --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_linked_services_operations.py @@ -0,0 +1,71 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementLinkedServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_factory(self, resource_group): + response = self.client.linked_services.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.linked_services.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + linked_service_name="str", + linked_service={"properties": "linked_service", "etag": "str", "id": "str", "name": "str", "type": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.linked_services.get( + resource_group_name=resource_group.name, + factory_name="str", + linked_service_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.linked_services.delete( + resource_group_name=resource_group.name, + factory_name="str", + linked_service_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_linked_services_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_linked_services_operations_async.py new file mode 100644 index 0000000000000..4e76602593684 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_linked_services_operations_async.py @@ -0,0 +1,72 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementLinkedServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_factory(self, resource_group): + response = self.client.linked_services.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.linked_services.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + linked_service_name="str", + linked_service={"properties": "linked_service", "etag": "str", "id": "str", "name": "str", "type": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.linked_services.get( + resource_group_name=resource_group.name, + factory_name="str", + linked_service_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.linked_services.delete( + resource_group_name=resource_group.name, + factory_name="str", + linked_service_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_managed_private_endpoints_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_managed_private_endpoints_operations.py new file mode 100644 index 0000000000000..14df0f72198bb --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_managed_private_endpoints_operations.py @@ -0,0 +1,88 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementManagedPrivateEndpointsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_factory(self, resource_group): + response = self.client.managed_private_endpoints.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + managed_virtual_network_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.managed_private_endpoints.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + managed_virtual_network_name="str", + managed_private_endpoint_name="str", + managed_private_endpoint={ + "properties": { + "connectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "fqdns": ["str"], + "groupId": "str", + "isReserved": bool, + "privateLinkResourceId": "str", + "provisioningState": "str", + }, + "etag": "str", + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.managed_private_endpoints.get( + resource_group_name=resource_group.name, + factory_name="str", + managed_virtual_network_name="str", + managed_private_endpoint_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.managed_private_endpoints.delete( + resource_group_name=resource_group.name, + factory_name="str", + managed_virtual_network_name="str", + managed_private_endpoint_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_managed_private_endpoints_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_managed_private_endpoints_operations_async.py new file mode 100644 index 0000000000000..5fbd619b88710 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_managed_private_endpoints_operations_async.py @@ -0,0 +1,89 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementManagedPrivateEndpointsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_factory(self, resource_group): + response = self.client.managed_private_endpoints.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + managed_virtual_network_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.managed_private_endpoints.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + managed_virtual_network_name="str", + managed_private_endpoint_name="str", + managed_private_endpoint={ + "properties": { + "connectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "fqdns": ["str"], + "groupId": "str", + "isReserved": bool, + "privateLinkResourceId": "str", + "provisioningState": "str", + }, + "etag": "str", + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.managed_private_endpoints.get( + resource_group_name=resource_group.name, + factory_name="str", + managed_virtual_network_name="str", + managed_private_endpoint_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.managed_private_endpoints.delete( + resource_group_name=resource_group.name, + factory_name="str", + managed_virtual_network_name="str", + managed_private_endpoint_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_managed_virtual_networks_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_managed_virtual_networks_operations.py new file mode 100644 index 0000000000000..fb8000b8e9853 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_managed_virtual_networks_operations.py @@ -0,0 +1,64 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementManagedVirtualNetworksOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_factory(self, resource_group): + response = self.client.managed_virtual_networks.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.managed_virtual_networks.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + managed_virtual_network_name="str", + managed_virtual_network={ + "properties": {"alias": "str", "vNetId": "str"}, + "etag": "str", + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.managed_virtual_networks.get( + resource_group_name=resource_group.name, + factory_name="str", + managed_virtual_network_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_managed_virtual_networks_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_managed_virtual_networks_operations_async.py new file mode 100644 index 0000000000000..73dfcaa3240bf --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_managed_virtual_networks_operations_async.py @@ -0,0 +1,65 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementManagedVirtualNetworksOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_factory(self, resource_group): + response = self.client.managed_virtual_networks.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.managed_virtual_networks.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + managed_virtual_network_name="str", + managed_virtual_network={ + "properties": {"alias": "str", "vNetId": "str"}, + "etag": "str", + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.managed_virtual_networks.get( + resource_group_name=resource_group.name, + factory_name="str", + managed_virtual_network_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_operations.py new file mode 100644 index 0000000000000..cc44ace480d24 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_operations.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_operations_async.py new file mode 100644 index 0000000000000..17590fc1dfcaa --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_operations_async.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_pipeline_runs_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_pipeline_runs_operations.py new file mode 100644 index 0000000000000..5836d281d1f32 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_pipeline_runs_operations.py @@ -0,0 +1,64 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementPipelineRunsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_query_by_factory(self, resource_group): + response = self.client.pipeline_runs.query_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + filter_parameters={ + "lastUpdatedAfter": "2020-02-20 00:00:00", + "lastUpdatedBefore": "2020-02-20 00:00:00", + "continuationToken": "str", + "filters": [{"operand": "str", "operator": "str", "values": ["str"]}], + "orderBy": [{"order": "str", "orderBy": "str"}], + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.pipeline_runs.get( + resource_group_name=resource_group.name, + factory_name="str", + run_id="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cancel(self, resource_group): + response = self.client.pipeline_runs.cancel( + resource_group_name=resource_group.name, + factory_name="str", + run_id="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_pipeline_runs_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_pipeline_runs_operations_async.py new file mode 100644 index 0000000000000..acd95502267f7 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_pipeline_runs_operations_async.py @@ -0,0 +1,65 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementPipelineRunsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_query_by_factory(self, resource_group): + response = await self.client.pipeline_runs.query_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + filter_parameters={ + "lastUpdatedAfter": "2020-02-20 00:00:00", + "lastUpdatedBefore": "2020-02-20 00:00:00", + "continuationToken": "str", + "filters": [{"operand": "str", "operator": "str", "values": ["str"]}], + "orderBy": [{"order": "str", "orderBy": "str"}], + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.pipeline_runs.get( + resource_group_name=resource_group.name, + factory_name="str", + run_id="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cancel(self, resource_group): + response = await self.client.pipeline_runs.cancel( + resource_group_name=resource_group.name, + factory_name="str", + run_id="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_pipelines_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_pipelines_operations.py new file mode 100644 index 0000000000000..055cc41ae31eb --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_pipelines_operations.py @@ -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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementPipelinesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_factory(self, resource_group): + response = self.client.pipelines.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.pipelines.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + pipeline_name="str", + pipeline={ + "activities": ["activity"], + "annotations": [{}], + "concurrency": 0, + "description": "str", + "etag": "str", + "folder": {"name": "str"}, + "id": "str", + "name": "str", + "parameters": {"str": {"type": "str", "defaultValue": {}}}, + "policy": {"elapsedTimeMetric": {"duration": {}}}, + "runDimensions": {"str": {}}, + "type": "str", + "variables": {"str": {"type": "str", "defaultValue": {}}}, + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.pipelines.get( + resource_group_name=resource_group.name, + factory_name="str", + pipeline_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.pipelines.delete( + resource_group_name=resource_group.name, + factory_name="str", + pipeline_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_run(self, resource_group): + response = self.client.pipelines.create_run( + resource_group_name=resource_group.name, + factory_name="str", + pipeline_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_pipelines_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_pipelines_operations_async.py new file mode 100644 index 0000000000000..2be64cd4e6ab2 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_pipelines_operations_async.py @@ -0,0 +1,99 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementPipelinesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_factory(self, resource_group): + response = self.client.pipelines.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.pipelines.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + pipeline_name="str", + pipeline={ + "activities": ["activity"], + "annotations": [{}], + "concurrency": 0, + "description": "str", + "etag": "str", + "folder": {"name": "str"}, + "id": "str", + "name": "str", + "parameters": {"str": {"type": "str", "defaultValue": {}}}, + "policy": {"elapsedTimeMetric": {"duration": {}}}, + "runDimensions": {"str": {}}, + "type": "str", + "variables": {"str": {"type": "str", "defaultValue": {}}}, + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.pipelines.get( + resource_group_name=resource_group.name, + factory_name="str", + pipeline_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.pipelines.delete( + resource_group_name=resource_group.name, + factory_name="str", + pipeline_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_run(self, resource_group): + response = await self.client.pipelines.create_run( + resource_group_name=resource_group.name, + factory_name="str", + pipeline_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_end_point_connections_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_end_point_connections_operations.py new file mode 100644 index 0000000000000..9cfadc91770c8 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_end_point_connections_operations.py @@ -0,0 +1,31 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementPrivateEndPointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_factory(self, resource_group): + response = self.client.private_end_point_connections.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_end_point_connections_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_end_point_connections_operations_async.py new file mode 100644 index 0000000000000..c152ee8bc1138 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_end_point_connections_operations_async.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementPrivateEndPointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_factory(self, resource_group): + response = self.client.private_end_point_connections.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_endpoint_connection_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_endpoint_connection_operations.py new file mode 100644 index 0000000000000..6ac9901e27e24 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_endpoint_connection_operations.py @@ -0,0 +1,72 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementPrivateEndpointConnectionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.private_endpoint_connection.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + private_endpoint_connection_name="str", + private_endpoint_wrapper={ + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + }, + "type": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.private_endpoint_connection.get( + resource_group_name=resource_group.name, + factory_name="str", + private_endpoint_connection_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.private_endpoint_connection.delete( + resource_group_name=resource_group.name, + factory_name="str", + private_endpoint_connection_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_endpoint_connection_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_endpoint_connection_operations_async.py new file mode 100644 index 0000000000000..f2cda1711bc26 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_endpoint_connection_operations_async.py @@ -0,0 +1,73 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementPrivateEndpointConnectionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.private_endpoint_connection.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + private_endpoint_connection_name="str", + private_endpoint_wrapper={ + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + }, + "type": "str", + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.private_endpoint_connection.get( + resource_group_name=resource_group.name, + factory_name="str", + private_endpoint_connection_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.private_endpoint_connection.delete( + resource_group_name=resource_group.name, + factory_name="str", + private_endpoint_connection_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_link_resources_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_link_resources_operations.py new file mode 100644 index 0000000000000..30ec19b28be78 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_link_resources_operations.py @@ -0,0 +1,31 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.private_link_resources.get( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_link_resources_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_link_resources_operations_async.py new file mode 100644 index 0000000000000..1625dcd3f94ad --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_private_link_resources_operations_async.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.private_link_resources.get( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_trigger_runs_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_trigger_runs_operations.py new file mode 100644 index 0000000000000..2f0c2a0fc27fa --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_trigger_runs_operations.py @@ -0,0 +1,66 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementTriggerRunsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_rerun(self, resource_group): + response = self.client.trigger_runs.rerun( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + run_id="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cancel(self, resource_group): + response = self.client.trigger_runs.cancel( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + run_id="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_query_by_factory(self, resource_group): + response = self.client.trigger_runs.query_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + filter_parameters={ + "lastUpdatedAfter": "2020-02-20 00:00:00", + "lastUpdatedBefore": "2020-02-20 00:00:00", + "continuationToken": "str", + "filters": [{"operand": "str", "operator": "str", "values": ["str"]}], + "orderBy": [{"order": "str", "orderBy": "str"}], + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_trigger_runs_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_trigger_runs_operations_async.py new file mode 100644 index 0000000000000..cc17d0de01c99 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_trigger_runs_operations_async.py @@ -0,0 +1,67 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementTriggerRunsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_rerun(self, resource_group): + response = await self.client.trigger_runs.rerun( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + run_id="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cancel(self, resource_group): + response = await self.client.trigger_runs.cancel( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + run_id="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_query_by_factory(self, resource_group): + response = await self.client.trigger_runs.query_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + filter_parameters={ + "lastUpdatedAfter": "2020-02-20 00:00:00", + "lastUpdatedBefore": "2020-02-20 00:00:00", + "continuationToken": "str", + "filters": [{"operand": "str", "operator": "str", "values": ["str"]}], + "orderBy": [{"order": "str", "orderBy": "str"}], + }, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_triggers_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_triggers_operations.py new file mode 100644 index 0000000000000..24be0b35dec45 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_triggers_operations.py @@ -0,0 +1,149 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementTriggersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_factory(self, resource_group): + response = self.client.triggers.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_query_by_factory(self, resource_group): + response = self.client.triggers.query_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + filter_parameters={"continuationToken": "str", "parentTriggerName": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.triggers.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + trigger={"properties": "trigger", "etag": "str", "id": "str", "name": "str", "type": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.triggers.get( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.triggers.delete( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_subscribe_to_events(self, resource_group): + response = self.client.triggers.begin_subscribe_to_events( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_event_subscription_status(self, resource_group): + response = self.client.triggers.get_event_subscription_status( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_unsubscribe_from_events(self, resource_group): + response = self.client.triggers.begin_unsubscribe_from_events( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start(self, resource_group): + response = self.client.triggers.begin_start( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_stop(self, resource_group): + response = self.client.triggers.begin_stop( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_triggers_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_triggers_operations_async.py new file mode 100644 index 0000000000000..53e316ff588ed --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_triggers_operations_async.py @@ -0,0 +1,158 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataFactoryManagementTriggersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_factory(self, resource_group): + response = self.client.triggers.list_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + api_version="2018-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_query_by_factory(self, resource_group): + response = await self.client.triggers.query_by_factory( + resource_group_name=resource_group.name, + factory_name="str", + filter_parameters={"continuationToken": "str", "parentTriggerName": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.triggers.create_or_update( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + trigger={"properties": "trigger", "etag": "str", "id": "str", "name": "str", "type": "str"}, + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.triggers.get( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.triggers.delete( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_subscribe_to_events(self, resource_group): + response = await ( + await self.client.triggers.begin_subscribe_to_events( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_event_subscription_status(self, resource_group): + response = await self.client.triggers.get_event_subscription_status( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_unsubscribe_from_events(self, resource_group): + response = await ( + await self.client.triggers.begin_unsubscribe_from_events( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start(self, resource_group): + response = await ( + await self.client.triggers.begin_start( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_stop(self, resource_group): + response = await ( + await self.client.triggers.begin_stop( + resource_group_name=resource_group.name, + factory_name="str", + trigger_name="str", + api_version="2018-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/datafactory/azure-mgmt-datafactory/pyproject.toml b/sdk/datafactory/azure-mgmt-datafactory/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/datafactory/azure-mgmt-datafactory/setup.py b/sdk/datafactory/azure-mgmt-datafactory/setup.py index 59a3dd52eeeab..907fd55998d6c 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/setup.py +++ b/sdk/datafactory/azure-mgmt-datafactory/setup.py @@ -75,6 +75,7 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", "azure-mgmt-core>=1.3.2", ], diff --git a/sdk/datafactory/azure-mgmt-datafactory/tests/conftest.py b/sdk/datafactory/azure-mgmt-datafactory/tests/conftest.py index 587e126e50b08..6d9707a4e6e20 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/tests/conftest.py +++ b/sdk/datafactory/azure-mgmt-datafactory/tests/conftest.py @@ -1,50 +1,39 @@ +# 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. -# +# 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. # -------------------------------------------------------------------------- import os -import platform import pytest -import sys - from dotenv import load_dotenv - -from devtools_testutils import test_proxy, add_general_regex_sanitizer -from devtools_testutils import add_header_regex_sanitizer, add_body_key_sanitizer +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) load_dotenv() + +# aovid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): - subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") - client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=client_secret, value="00000000-0000-0000-0000-000000000000") + datafactorymanagement_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + datafactorymanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + datafactorymanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + datafactorymanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=datafactorymanagement_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=datafactorymanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=datafactorymanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=datafactorymanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") add_header_regex_sanitizer(key="Cookie", value="cookie;") - add_body_key_sanitizer(json_path="$..access_token", value="access_token") \ No newline at end of file + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/datafactory/azure-mgmt-datafactory/tests/test_cli_mgmt_datafactory.py b/sdk/datafactory/azure-mgmt-datafactory/tests/test_cli_mgmt_datafactory.py deleted file mode 100644 index d827b9388a937..0000000000000 --- a/sdk/datafactory/azure-mgmt-datafactory/tests/test_cli_mgmt_datafactory.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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. -#-------------------------------------------------------------------------- - -from azure.mgmt.datafactory import DataFactoryManagementClient -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = 'eastus' - -class TestMgmtDataFactory(AzureMgmtRecordedTestCase): - - def setup_method(self, method): - self.client = self.create_mgmt_client(DataFactoryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): - assert list(self.client.factories.list_by_resource_group(resource_group.name)) == [] - - @recorded_by_proxy - def test_list_operations(self): - assert list(self.client.operations.list()) \ No newline at end of file diff --git a/sdk/datafactory/azure-mgmt-datafactory/tests/test_data_factory_management_factories_operations_async_test.py b/sdk/datafactory/azure-mgmt-datafactory/tests/test_data_factory_management_factories_operations_async_test.py new file mode 100644 index 0000000000000..6d0d067a1260b --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/tests/test_data_factory_management_factories_operations_async_test.py @@ -0,0 +1,31 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestDataFactoryManagementFactoriesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.factories.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2018-06-01", + ) + result = [r async for r in response] + assert result == [] + \ No newline at end of file diff --git a/sdk/datafactory/azure-mgmt-datafactory/tests/test_data_factory_management_factories_operations_test.py b/sdk/datafactory/azure-mgmt-datafactory/tests/test_data_factory_management_factories_operations_test.py new file mode 100644 index 0000000000000..9125475e11368 --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/tests/test_data_factory_management_factories_operations_test.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestDataFactoryManagementFactoriesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.factories.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2018-06-01", + ) + result = [r for r in response] + assert result == [] diff --git a/sdk/datafactory/azure-mgmt-datafactory/tests/test_data_factory_management_operations_async_test.py b/sdk/datafactory/azure-mgmt-datafactory/tests/test_data_factory_management_operations_async_test.py new file mode 100644 index 0000000000000..aa94e85853dad --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/tests/test_data_factory_management_operations_async_test.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory.aio import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestDataFactoryManagementOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2018-06-01", + ) + result = [r async for r in response] + assert result + diff --git a/sdk/datafactory/azure-mgmt-datafactory/tests/test_data_factory_management_operations_test.py b/sdk/datafactory/azure-mgmt-datafactory/tests/test_data_factory_management_operations_test.py new file mode 100644 index 0000000000000..e01cacf32602a --- /dev/null +++ b/sdk/datafactory/azure-mgmt-datafactory/tests/test_data_factory_management_operations_test.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.datafactory import DataFactoryManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestDataFactoryManagementOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataFactoryManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2018-06-01", + ) + result = [r for r in response] + assert result + diff --git a/sdk/datalake/azure-mgmt-datalake-analytics/pyproject.toml b/sdk/datalake/azure-mgmt-datalake-analytics/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-analytics/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/datalake/azure-mgmt-datalake-store/pyproject.toml b/sdk/datalake/azure-mgmt-datalake-store/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/datalake/azure-mgmt-datalake-store/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/datamigration/azure-mgmt-datamigration/pyproject.toml b/sdk/datamigration/azure-mgmt-datamigration/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/datamigration/azure-mgmt-datamigration/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/pyproject.toml b/sdk/dataprotection/azure-mgmt-dataprotection/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/datashare/azure-mgmt-datashare/pyproject.toml b/sdk/datashare/azure-mgmt-datashare/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/datashare/azure-mgmt-datashare/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/defendereasm/azure-mgmt-defendereasm/pyproject.toml b/sdk/defendereasm/azure-mgmt-defendereasm/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/defendereasm/azure-mgmt-defendereasm/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/deploymentmanager/azure-mgmt-deploymentmanager/pyproject.toml b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/deploymentmanager/azure-mgmt-deploymentmanager/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/pyproject.toml b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/devcenter/azure-developer-devcenter/pyproject.toml b/sdk/devcenter/azure-developer-devcenter/pyproject.toml index 45f4a483fc063..90102e2ec3386 100644 --- a/sdk/devcenter/azure-developer-devcenter/pyproject.toml +++ b/sdk/devcenter/azure-developer-devcenter/pyproject.toml @@ -2,4 +2,3 @@ pylint = false pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/devcenter/azure-mgmt-devcenter/pyproject.toml b/sdk/devcenter/azure-mgmt-devcenter/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/devcenter/azure-mgmt-devcenter/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/devhub/azure-mgmt-devhub/pyproject.toml b/sdk/devhub/azure-mgmt-devhub/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/devhub/azure-mgmt-devhub/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/pyproject.toml b/sdk/deviceregistry/azure-mgmt-deviceregistry/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/deviceupdate/azure-iot-deviceupdate/pyproject.toml b/sdk/deviceupdate/azure-iot-deviceupdate/pyproject.toml index a3a58bd090306..b8570555c5c38 100644 --- a/sdk/deviceupdate/azure-iot-deviceupdate/pyproject.toml +++ b/sdk/deviceupdate/azure-iot-deviceupdate/pyproject.toml @@ -2,5 +2,4 @@ pylint = false pyright = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/deviceupdate/azure-mgmt-deviceupdate/pyproject.toml b/sdk/deviceupdate/azure-mgmt-deviceupdate/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/deviceupdate/azure-mgmt-deviceupdate/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/pyproject.toml b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/devopsinfrastructure/azure-mgmt-devopsinfrastructure/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/devtestlabs/azure-mgmt-devtestlabs/pyproject.toml b/sdk/devtestlabs/azure-mgmt-devtestlabs/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/devtestlabs/azure-mgmt-devtestlabs/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/digitaltwins/azure-digitaltwins-core/pyproject.toml b/sdk/digitaltwins/azure-digitaltwins-core/pyproject.toml index cf845e14852bf..df558bb3b1e74 100644 --- a/sdk/digitaltwins/azure-digitaltwins-core/pyproject.toml +++ b/sdk/digitaltwins/azure-digitaltwins-core/pyproject.toml @@ -1,5 +1,4 @@ [tool.azure-sdk-build] pyright = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/digitaltwins/azure-mgmt-digitaltwins/pyproject.toml b/sdk/digitaltwins/azure-mgmt-digitaltwins/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/digitaltwins/azure-mgmt-digitaltwins/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/dnsresolver/azure-mgmt-dnsresolver/pyproject.toml b/sdk/dnsresolver/azure-mgmt-dnsresolver/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/dnsresolver/azure-mgmt-dnsresolver/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/CHANGELOG.md b/sdk/documentintelligence/azure-ai-documentintelligence/CHANGELOG.md index d2420cebd6d87..63f97ac454833 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/CHANGELOG.md +++ b/sdk/documentintelligence/azure-ai-documentintelligence/CHANGELOG.md @@ -3,12 +3,40 @@ ## 1.0.0b4 (Unreleased) ### Features Added +- Added support for the Analyze Batch Documents API: + - Added LRO operation `begin_analyze_batch_documents()` to `DocumentIntelligenceClient`. + - Added models `AnalyzeBatchDocumentsRequest`, `AnalyzeBatchResult` and `AnalyzeBatchOperationDetail`. +- Added support for different kinds of output in the Analyze Document API: + - Added operations `get_analyze_result_figure()` and `get_analyze_result_pdf()` to `DocumentIntelligenceClient`. + - Added optional kwarg `output` to LRO operation `begin_analyze_document()` overloads in `DocumentIntelligenceClient`. + - Added enum `AnalyzeOutputOption` to specify output kind, either `pdf` or `figures`. + - Added property `id` to model `DocumentFigure`. +- Added support for the Copy Classifier API: + - Added operations `authorize_classifier_copy()` and `begin_copy_classifier_to()` to `DocumentIntelligenceAdministrationClient`. + - Added models `AuthorizeClassifierCopyRequest` and `ClassifierCopyAuthorization`. +- Added optional kwarg `pages` to LRO operation `begin_classify_document()` overloads in `DocumentIntelligenceClient`. +- Added new kind `GENERATIVE` to enum `DocumentBuildMode`. +- Added property `warnings` to model `AnalyzeResult`. +- Added properties `classifier_id`, `split`, and `training_hours` to model `DocumentModelDetails`. +- Added properties `model_id`, `confidence_threshold`, `features`, `query_fields` and `max_documents_to_analyze` to model `DocumentTypeDetails`. +- Added property `allow_overwrite` to model `BuildDocumentClassifierRequest`. +- Added properties `allow_overwrite` and `max_training_hours` to model `BuildDocumentModelRequest`. +- Added properties `classifier_id`, `split` and `doc_types` to model `ComposeDocumentModelRequest`. ### Breaking Changes - -### Bugs Fixed +- Removed support for extracting lists from analyzed documents: + - Removed models `DocumentList` and `DocumentListItem`. + - Removed property `lists` from model `AnalyzeResult`. +- Changes to the Compose Document API: + - Removed model `ComponentDocumentModelDetails`. + - Removed property `component_models` from model `ComposeDocumentModelRequest`. + - `ComposeDocumentModelRequest` now requires a dictionary of `DocumentTypeDetails` instances and a classifier ID to be constructed. +- Removed model `QuotaDetails`. +- Removed property `custom_neural_document_model_builds` from model `ResourceDetails`. +- Changed the _required_ property `field_schema` from `DocumentTypeDetails` to be _optional_. ### Other Changes +- Changed the default service API version to `2024-07-31-preview`. ## 1.0.0b3 (2024-04-09) @@ -19,9 +47,9 @@ ### Features Added -- Added model `AnalyzeResultOperation` and `Warning`. +- Added models `AnalyzeResultOperation` and `Warning`. - Added property `base_classifier_id` to model `BuildDocumentClassifierRequest`. -- Added property `base_classifier_id` and `warnings` to model `DocumentClassifierDetails`. +- Added properties `base_classifier_id` and `warnings` to model `DocumentClassifierDetails`. - Added property `warnings` to model `DocumentModelDetails`. - Added property `value_selection_group` to model `DocumentField`. - Added value `selectionGroup` to enum `DocumentFieldType`. diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/README.md b/sdk/documentintelligence/azure-ai-documentintelligence/README.md index 863f2dbd6780d..e12c6b7aa9461 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/README.md +++ b/sdk/documentintelligence/azure-ai-documentintelligence/README.md @@ -544,12 +544,13 @@ if model.doc_types: print("Doc types the model can recognize:") for name, doc_type in model.doc_types.items(): print(f"Doc Type: '{name}' built with '{doc_type.build_mode}' mode which has the following fields:") - for field_name, field in doc_type.field_schema.items(): - if doc_type.field_confidence: - print( - f"Field: '{field_name}' has type '{field['type']}' and confidence score " - f"{doc_type.field_confidence[field_name]}" - ) + if doc_type.field_schema: + for field_name, field in doc_type.field_schema.items(): + if doc_type.field_confidence: + print( + f"Field: '{field_name}' has type '{field['type']}' and confidence score " + f"{doc_type.field_confidence[field_name]}" + ) ``` @@ -737,12 +738,13 @@ if model.doc_types: print("Doc types the model can recognize:") for name, doc_type in model.doc_types.items(): print(f"Doc Type: '{name}' built with '{doc_type.build_mode}' mode which has the following fields:") - for field_name, field in doc_type.field_schema.items(): - if doc_type.field_confidence: - print( - f"Field: '{field_name}' has type '{field['type']}' and confidence score " - f"{doc_type.field_confidence[field_name]}" - ) + if doc_type.field_schema: + for field_name, field in doc_type.field_schema.items(): + if doc_type.field_confidence: + print( + f"Field: '{field_name}' has type '{field['type']}' and confidence score " + f"{doc_type.field_confidence[field_name]}" + ) ``` @@ -755,11 +757,6 @@ print( f"Our resource has {account_details.custom_document_models.count} custom models, " f"and we can have at most {account_details.custom_document_models.limit} custom models" ) -neural_models = account_details.custom_neural_document_model_builds -print( - f"The quota limit for custom neural document models is {neural_models.quota} and the resource has" - f"used {neural_models.used}. The resource quota will reset on {neural_models.quota_reset_date_time}" -) ``` diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/assets.json b/sdk/documentintelligence/azure-ai-documentintelligence/assets.json index adbde4e909667..b4f647d26e0da 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/assets.json +++ b/sdk/documentintelligence/azure-ai-documentintelligence/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/documentintelligence/azure-ai-documentintelligence", - "Tag": "python/documentintelligence/azure-ai-documentintelligence_ea63c55a80" + "Tag": "python/documentintelligence/azure-ai-documentintelligence_d5576d9de8" } diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_client.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_client.py index e560f0f677672..cc227bcddc28f 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_client.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING, Union +from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -36,12 +37,12 @@ class DocumentIntelligenceClient( :param endpoint: The Document Intelligence service endpoint. Required. :type endpoint: str - :param credential: Credential needed for the client to connect to Azure. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-02-29-preview". Note that overriding this default value may result in unsupported + "2024-07-31-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -103,7 +104,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "DocumentIntelligenceClient": + def __enter__(self) -> Self: self._client.__enter__() return self @@ -118,12 +119,12 @@ class DocumentIntelligenceAdministrationClient( :param endpoint: The Document Intelligence service endpoint. Required. :type endpoint: str - :param credential: Credential needed for the client to connect to Azure. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-02-29-preview". Note that overriding this default value may result in unsupported + "2024-07-31-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -187,7 +188,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "DocumentIntelligenceAdministrationClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_configuration.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_configuration.py index 7eafe0d0a8b72..dff48015d919f 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_configuration.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_configuration.py @@ -26,18 +26,18 @@ class DocumentIntelligenceClientConfiguration: # pylint: disable=too-many-insta :param endpoint: The Document Intelligence service endpoint. Required. :type endpoint: str - :param credential: Credential needed for the client to connect to Azure. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-02-29-preview". Note that overriding this default value may result in unsupported + "2024-07-31-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-02-29-preview") + api_version: str = kwargs.pop("api_version", "2024-07-31-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -81,18 +81,18 @@ class DocumentIntelligenceAdministrationClientConfiguration: # pylint: disable= :param endpoint: The Document Intelligence service endpoint. Required. :type endpoint: str - :param credential: Credential needed for the client to connect to Azure. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-02-29-preview". Note that overriding this default value may result in unsupported + "2024-07-31-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-02-29-preview") + api_version: str = kwargs.pop("api_version", "2024-07-31-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_model_base.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_model_base.py index 1ddc071517d69..7d82ac3456cbb 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_model_base.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_model_base.py @@ -6,6 +6,7 @@ # -------------------------------------------------------------------------- # pylint: disable=protected-access, arguments-differ, signature-differs, broad-except +import copy import calendar import decimal import functools @@ -13,7 +14,6 @@ import logging import base64 import re -import copy import typing import enum import email.utils @@ -339,7 +339,7 @@ def _get_model(module_name: str, model_name: str): class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object def __init__(self, data: typing.Dict[str, typing.Any]) -> None: - self._data = copy.deepcopy(data) + self._data = data def __contains__(self, key: typing.Any) -> bool: return key in self._data @@ -378,16 +378,13 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any: return default @typing.overload - def pop(self, key: str) -> typing.Any: - ... + def pop(self, key: str) -> typing.Any: ... @typing.overload - def pop(self, key: str, default: _T) -> _T: - ... + def pop(self, key: str, default: _T) -> _T: ... @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: - ... + def pop(self, key: str, default: typing.Any) -> typing.Any: ... def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: if default is _UNSET: @@ -404,12 +401,10 @@ def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: self._data.update(*args, **kwargs) @typing.overload - def setdefault(self, key: str, default: None = None) -> None: - ... + def setdefault(self, key: str, default: None = None) -> None: ... @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: - ... + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: if default is _UNSET: @@ -568,6 +563,7 @@ def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing. """ result = {} + readonly_props = [] if exclude_readonly: readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] for k, v in self.items(): @@ -594,6 +590,64 @@ def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: typing.Dict[typing.Any, typing.Any], +): + if obj is None: + return obj + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: typing.List[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912 annotation: typing.Any, module: typing.Optional[str], @@ -621,11 +675,6 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, if rf: rf._is_model = True - def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): - if _is_model(obj): - return obj - return _deserialize(model_deserializer, obj) - return functools.partial(_deserialize_model, annotation) # pyright: ignore except Exception: pass @@ -640,36 +689,27 @@ def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj # is it optional? try: if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore - if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore - ) - - def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): - if obj is None: - return obj - return _deserialize_with_callable(if_obj_deserializer, obj) - - return functools.partial(_deserialize_with_optional, if_obj_deserializer) + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) except AttributeError: pass + # is it union? if getattr(annotation, "__origin__", None) is typing.Union: # initial ordering is we make `string` the last deserialization option, because it is often them most generic deserializers = [ _get_deserialize_callable_from_annotation(arg, module, rf) - for arg in sorted( - annotation.__args__, key=lambda x: hasattr(x, "__name__") and x.__name__ == "str" # pyright: ignore - ) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore ] - def _deserialize_with_union(deserializers, obj): - for deserializer in deserializers: - try: - return _deserialize(deserializer, obj) - except DeserializationError: - pass - raise DeserializationError() - return functools.partial(_deserialize_with_union, deserializers) try: @@ -678,17 +718,10 @@ def _deserialize_with_union(deserializers, obj): annotation.__args__[1], module, rf # pyright: ignore ) - def _deserialize_dict( - value_deserializer: typing.Optional[typing.Callable], - obj: typing.Dict[typing.Any, typing.Any], - ): - if obj is None: - return obj - return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} - return functools.partial( _deserialize_dict, value_deserializer, + module, ) except (AttributeError, IndexError): pass @@ -696,35 +729,16 @@ def _deserialize_dict( if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore if len(annotation.__args__) > 1: # pyright: ignore - def _deserialize_multiple_sequence( - entry_deserializers: typing.List[typing.Optional[typing.Callable]], - obj, - ): - if obj is None: - return obj - return type(obj)( - _deserialize(deserializer, entry, module) - for entry, deserializer in zip(obj, entry_deserializers) - ) - entry_deserializers = [ _get_deserialize_callable_from_annotation(dt, module, rf) for dt in annotation.__args__ # pyright: ignore ] - return functools.partial(_deserialize_multiple_sequence, entry_deserializers) + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) deserializer = _get_deserialize_callable_from_annotation( annotation.__args__[0], module, rf # pyright: ignore ) - def _deserialize_sequence( - deserializer: typing.Optional[typing.Callable], - obj, - ): - if obj is None: - return obj - return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) - - return functools.partial(_deserialize_sequence, deserializer) + return functools.partial(_deserialize_sequence, deserializer, module) except (TypeError, IndexError, AttributeError, SyntaxError): pass @@ -870,5 +884,6 @@ def rest_discriminator( *, name: typing.Optional[str] = None, type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, ) -> typing.Any: - return _RestField(name=name, type=type, is_discriminator=True) + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility) diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_operations/_operations.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_operations/_operations.py index 6e0353904461b..b742b8c8a26b3 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_operations/_operations.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -54,13 +56,16 @@ def build_document_intelligence_analyze_document_request( # pylint: disable=nam features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, query_fields: Optional[List[str]] = None, output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/documentModels/{modelId}:analyze" path_format_arguments = { @@ -83,26 +88,139 @@ def build_document_intelligence_analyze_document_request( # pylint: disable=nam _params["queryFields"] = _SERIALIZER.query("query_fields", query_fields, "[str]", div=",") if output_content_format is not None: _params["outputContentFormat"] = _SERIALIZER.query("output_content_format", output_content_format, "str") + if output is not None: + _params["output"] = _SERIALIZER.query("output", output, "[str]", div=",") + + # Construct headers + if content_type is not None: + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_document_intelligence_analyze_batch_documents_request( # pylint: disable=name-too-long + model_id: str, + *, + pages: Optional[str] = None, + locale: Optional[str] = None, + string_index_type: Optional[Union[str, _models.StringIndexType]] = None, + features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, + query_fields: Optional[List[str]] = None, + output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/documentModels/{modelId}:analyzeBatch" + path_format_arguments = { + "modelId": _SERIALIZER.url("model_id", model_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if pages is not None: + _params["pages"] = _SERIALIZER.query("pages", pages, "str") + if locale is not None: + _params["locale"] = _SERIALIZER.query("locale", locale, "str") + if string_index_type is not None: + _params["stringIndexType"] = _SERIALIZER.query("string_index_type", string_index_type, "str") + if features is not None: + _params["features"] = _SERIALIZER.query("features", features, "[str]", div=",") + if query_fields is not None: + _params["queryFields"] = _SERIALIZER.query("query_fields", query_fields, "[str]", div=",") + if output_content_format is not None: + _params["outputContentFormat"] = _SERIALIZER.query("output_content_format", output_content_format, "str") + if output is not None: + _params["output"] = _SERIALIZER.query("output", output, "[str]", div=",") # Construct headers if content_type is not None: _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_document_intelligence_get_analyze_result_pdf_request( # pylint: disable=name-too-long + model_id: str, result_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "application/pdf") + + # Construct URL + _url = "/documentModels/{modelId}/analyzeResults/{resultId}/pdf" + path_format_arguments = { + "modelId": _SERIALIZER.url("model_id", model_id, "str"), + "resultId": _SERIALIZER.url("result_id", result_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_document_intelligence_get_analyze_result_figure_request( # pylint: disable=name-too-long + model_id: str, result_id: str, figure_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "image/png") + + # Construct URL + _url = "/documentModels/{modelId}/analyzeResults/{resultId}/figures/{figureId}" + path_format_arguments = { + "modelId": _SERIALIZER.url("model_id", model_id, "str"), + "resultId": _SERIALIZER.url("result_id", result_id, "str"), + "figureId": _SERIALIZER.url("figure_id", figure_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + def build_document_intelligence_classify_document_request( # pylint: disable=name-too-long classifier_id: str, *, string_index_type: Optional[Union[str, _models.StringIndexType]] = None, split: Optional[Union[str, _models.SplitMode]] = None, + pages: Optional[str] = None, **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/documentClassifiers/{classifierId}:analyze" path_format_arguments = { @@ -117,10 +235,13 @@ def build_document_intelligence_classify_document_request( # pylint: disable=na _params["stringIndexType"] = _SERIALIZER.query("string_index_type", string_index_type, "str") if split is not None: _params["split"] = _SERIALIZER.query("split", split, "str") + if pages is not None: + _params["pages"] = _SERIALIZER.query("pages", pages, "str") # Construct headers if content_type is not None: _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) @@ -132,7 +253,9 @@ def build_document_intelligence_administration_build_document_model_request( # _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/documentModels:build" @@ -142,6 +265,7 @@ def build_document_intelligence_administration_build_document_model_request( # # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) @@ -153,7 +277,9 @@ def build_document_intelligence_administration_compose_model_request( # pylint: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/documentModels:compose" @@ -163,6 +289,7 @@ def build_document_intelligence_administration_compose_model_request( # pylint: # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) @@ -174,7 +301,7 @@ def build_document_intelligence_administration_authorize_model_copy_request( # _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,9 +311,9 @@ def build_document_intelligence_administration_authorize_model_copy_request( # _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) @@ -198,7 +325,9 @@ def build_document_intelligence_administration_copy_model_to_request( # pylint: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/documentModels/{modelId}:copyTo" path_format_arguments = { @@ -213,6 +342,7 @@ def build_document_intelligence_administration_copy_model_to_request( # pylint: # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) @@ -223,7 +353,7 @@ def build_document_intelligence_administration_get_model_request( # pylint: dis _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -249,7 +379,7 @@ def build_document_intelligence_administration_list_models_request( # pylint: d _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +400,9 @@ def build_document_intelligence_administration_delete_model_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/documentModels/{modelId}" path_format_arguments = { @@ -283,6 +415,7 @@ def build_document_intelligence_administration_delete_model_request( # pylint: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) @@ -293,7 +426,7 @@ def build_document_intelligence_administration_get_resource_info_request( # pyl _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -314,7 +447,7 @@ def build_document_intelligence_administration_get_operation_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +473,7 @@ def build_document_intelligence_administration_list_operations_request( # pylin _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -362,7 +495,9 @@ def build_document_intelligence_administration_build_classifier_request( # pyli _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/documentClassifiers:build" @@ -372,6 +507,60 @@ def build_document_intelligence_administration_build_classifier_request( # pyli # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_document_intelligence_administration_authorize_classifier_copy_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/documentClassifiers:authorizeCopy" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_document_intelligence_administration_copy_classifier_to_request( # pylint: disable=name-too-long + classifier_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/documentClassifiers/{classifierId}:copyTo" + path_format_arguments = { + "classifierId": _SERIALIZER.url("classifier_id", classifier_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) @@ -382,7 +571,7 @@ def build_document_intelligence_administration_get_classifier_request( # pylint _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -408,7 +597,7 @@ def build_document_intelligence_administration_list_classifiers_request( # pyli _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -429,7 +618,9 @@ def build_document_intelligence_administration_delete_classifier_request( # pyl _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-29-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-07-31-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/documentClassifiers/{classifierId}" path_format_arguments = { @@ -442,12 +633,14 @@ def build_document_intelligence_administration_delete_classifier_request( # pyl _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class DocumentIntelligenceClientOperationsMixin(DocumentIntelligenceClientMixinABC): # pylint: disable=name-too-long - def _analyze_document_initial( # pylint: disable=inconsistent-return-statements + + def _analyze_document_initial( self, model_id: str, analyze_request: Optional[Union[_models.AnalyzeDocumentRequest, JSON, IO[bytes]]] = None, @@ -458,8 +651,9 @@ def _analyze_document_initial( # pylint: disable=inconsistent-return-statements features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, query_fields: Optional[List[str]] = None, output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, **kwargs: Any, - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -472,7 +666,7 @@ def _analyze_document_initial( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -492,6 +686,7 @@ def _analyze_document_initial( # pylint: disable=inconsistent-return-statements features=features, query_fields=query_fields, output_content_format=output_content_format, + output=output, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -503,7 +698,7 @@ def _analyze_document_initial( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -511,8 +706,10 @@ def _analyze_document_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: - if _stream: + try: response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -521,8 +718,12 @@ def _analyze_document_initial( # pylint: disable=inconsistent-return-statements response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_analyze_document( @@ -536,17 +737,17 @@ def begin_analyze_document( features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, query_fields: Optional[List[str]] = None, output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, content_type: str = "application/json", **kwargs: Any, ) -> LROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Analyzes document with document model. :param model_id: Unique document model name. Required. :type model_id: str :param analyze_request: Analyze request parameters. Default value is None. :type analyze_request: ~azure.ai.documentintelligence.models.AnalyzeDocumentRequest - :keyword pages: List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is None. :paramtype pages: str :keyword locale: Locale hint for text recognition and document analysis. Value may contain @@ -565,6 +766,8 @@ def begin_analyze_document( :keyword output_content_format: Format of the analyze result top-level content. Known values are: "text" and "markdown". Default value is None. :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -578,292 +781,177 @@ def begin_analyze_document( # JSON input template you can fill out and use as your body input. analyze_request = { - "base64Source": bytes("bytes", encoding="utf-8"), # Optional. Base64 - encoding of the document to analyze. Either urlSource or base64Source must be - specified. - "urlSource": "str" # Optional. Document URL to analyze. Either urlSource or - base64Source must be specified. + "base64Source": bytes("bytes", encoding="utf-8"), + "urlSource": "str" } # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -872,149 +960,99 @@ def begin_analyze_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -1023,281 +1061,161 @@ def begin_analyze_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -1314,17 +1232,17 @@ def begin_analyze_document( features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, query_fields: Optional[List[str]] = None, output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, content_type: str = "application/json", **kwargs: Any, ) -> LROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Analyzes document with document model. :param model_id: Unique document model name. Required. :type model_id: str :param analyze_request: Analyze request parameters. Default value is None. :type analyze_request: JSON - :keyword pages: List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is None. :paramtype pages: str :keyword locale: Locale hint for text recognition and document analysis. Value may contain @@ -1343,6 +1261,8 @@ def begin_analyze_document( :keyword output_content_format: Format of the analyze result top-level content. Known values are: "text" and "markdown". Default value is None. :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1356,283 +1276,171 @@ def begin_analyze_document( # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -1641,149 +1449,99 @@ def begin_analyze_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -1792,281 +1550,161 @@ def begin_analyze_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -2083,17 +1721,17 @@ def begin_analyze_document( features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, query_fields: Optional[List[str]] = None, output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, content_type: str = "application/json", **kwargs: Any, ) -> LROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Analyzes document with document model. :param model_id: Unique document model name. Required. :type model_id: str :param analyze_request: Analyze request parameters. Default value is None. :type analyze_request: IO[bytes] - :keyword pages: List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is None. :paramtype pages: str :keyword locale: Locale hint for text recognition and document analysis. Value may contain @@ -2112,6 +1750,8 @@ def begin_analyze_document( :keyword output_content_format: Format of the analyze result top-level content. Known values are: "text" and "markdown". Default value is None. :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -2125,283 +1765,171 @@ def begin_analyze_document( # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -2410,149 +1938,99 @@ def begin_analyze_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -2561,281 +2039,161 @@ def begin_analyze_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], - "lists": [ + "paragraphs": [ { - "items": [ + "content": "str", + "spans": [ { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] + "length": 0, + "offset": 0 } ], - "spans": [ + "boundingRegions": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "pageNumber": 0, + "polygon": [ + 0.0 + ] } - ] - } - ], - "paragraphs": [ - { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. - "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + ], + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -2852,9 +2210,9 @@ def begin_analyze_document( features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, query_fields: Optional[List[str]] = None, output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, **kwargs: Any, ) -> LROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Analyzes document with document model. :param model_id: Unique document model name. Required. @@ -2863,7 +2221,7 @@ def begin_analyze_document( AnalyzeDocumentRequest, JSON, IO[bytes] Default value is None. :type analyze_request: ~azure.ai.documentintelligence.models.AnalyzeDocumentRequest or JSON or IO[bytes] - :keyword pages: List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is None. :paramtype pages: str :keyword locale: Locale hint for text recognition and document analysis. Value may contain @@ -2882,6 +2240,8 @@ def begin_analyze_document( :keyword output_content_format: Format of the analyze result top-level content. Known values are: "text" and "markdown". Default value is None. :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] :return: An instance of LROPoller that returns AnalyzeResult. The AnalyzeResult is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.AnalyzeResult] @@ -2892,292 +2252,177 @@ def begin_analyze_document( # JSON input template you can fill out and use as your body input. analyze_request = { - "base64Source": bytes("bytes", encoding="utf-8"), # Optional. Base64 - encoding of the document to analyze. Either urlSource or base64Source must be - specified. - "urlSource": "str" # Optional. Document URL to analyze. Either urlSource or - base64Source must be specified. + "base64Source": bytes("bytes", encoding="utf-8"), + "urlSource": "str" } # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -3186,149 +2431,99 @@ def begin_analyze_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -3337,281 +2532,161 @@ def begin_analyze_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -3624,7 +2699,7 @@ def begin_analyze_document( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._analyze_document_initial( # type: ignore + raw_result = self._analyze_document_initial( model_id=model_id, analyze_request=analyze_request, pages=pages, @@ -3633,12 +2708,14 @@ def begin_analyze_document( features=features, query_fields=query_fields, output_content_format=output_content_format, + output=output, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs, ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3677,15 +2754,20 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _classify_document_initial( # pylint: disable=inconsistent-return-statements + def _analyze_batch_documents_initial( self, - classifier_id: str, - classify_request: Union[_models.ClassifyDocumentRequest, JSON, IO[bytes]], + model_id: str, + analyze_batch_request: Optional[Union[_models.AnalyzeBatchDocumentsRequest, JSON, IO[bytes]]] = None, *, + pages: Optional[str] = None, + locale: Optional[str] = None, string_index_type: Optional[Union[str, _models.StringIndexType]] = None, - split: Optional[Union[str, _models.SplitMode]] = None, + features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, + query_fields: Optional[List[str]] = None, + output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, **kwargs: Any, - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3698,19 +2780,27 @@ def _classify_document_initial( # pylint: disable=inconsistent-return-statement _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(classify_request, (IOBase, bytes)): - _content = classify_request + if isinstance(analyze_batch_request, (IOBase, bytes)): + _content = analyze_batch_request else: - _content = json.dumps(classify_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + if analyze_batch_request is not None: + _content = json.dumps(analyze_batch_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None - _request = build_document_intelligence_classify_document_request( - classifier_id=classifier_id, + _request = build_document_intelligence_analyze_batch_documents_request( + model_id=model_id, + pages=pages, + locale=locale, string_index_type=string_index_type, - split=split, + features=features, + query_fields=query_fields, + output_content_format=output_content_format, + output=output, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -3722,7 +2812,7 @@ def _classify_document_initial( # pylint: disable=inconsistent-return-statement } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3730,8 +2820,10 @@ def _classify_document_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [202]: - if _stream: + try: response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -3740,800 +2832,241 @@ def _classify_document_initial( # pylint: disable=inconsistent-return-statement response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - def begin_classify_document( + def begin_analyze_batch_documents( self, - classifier_id: str, - classify_request: _models.ClassifyDocumentRequest, + model_id: str, + analyze_batch_request: Optional[_models.AnalyzeBatchDocumentsRequest] = None, *, + pages: Optional[str] = None, + locale: Optional[str] = None, string_index_type: Optional[Union[str, _models.StringIndexType]] = None, - split: Optional[Union[str, _models.SplitMode]] = None, + features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, + query_fields: Optional[List[str]] = None, + output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, content_type: str = "application/json", **kwargs: Any, - ) -> LROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long - """Classifies document with document classifier. + ) -> LROPoller[_models.AnalyzeBatchResult]: + """Analyzes batch documents with document model. - :param classifier_id: Unique document classifier name. Required. - :type classifier_id: str - :param classify_request: Classify request parameters. Required. - :type classify_request: ~azure.ai.documentintelligence.models.ClassifyDocumentRequest + :param model_id: Unique document model name. Required. + :type model_id: str + :param analyze_batch_request: Analyze batch request parameters. Default value is None. + :type analyze_batch_request: ~azure.ai.documentintelligence.models.AnalyzeBatchDocumentsRequest + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str + :keyword locale: Locale hint for text recognition and document analysis. Value may contain + only + the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). Default value is + None. + :paramtype locale: str :keyword string_index_type: Method used to compute string offset and length. Known values are: "textElements", "unicodeCodePoint", and "utf16CodeUnit". Default value is None. :paramtype string_index_type: str or ~azure.ai.documentintelligence.models.StringIndexType - :keyword split: Document splitting mode. Known values are: "auto", "none", and "perPage". + :keyword features: List of optional analysis features. Default value is None. + :paramtype features: list[str or ~azure.ai.documentintelligence.models.DocumentAnalysisFeature] + :keyword query_fields: List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". Default value is None. - :paramtype split: str or ~azure.ai.documentintelligence.models.SplitMode + :paramtype query_fields: list[str] + :keyword output_content_format: Format of the analyze result top-level content. Known values + are: "text" and "markdown". Default value is None. + :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AnalyzeResult. The AnalyzeResult is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.AnalyzeResult] + :return: An instance of LROPoller that returns AnalyzeBatchResult. The AnalyzeBatchResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.AnalyzeBatchResult] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - classify_request = { - "base64Source": bytes("bytes", encoding="utf-8"), # Optional. Base64 - encoding of the document to classify. Either urlSource or base64Source must be - specified. - "urlSource": "str" # Optional. Document URL to classify. Either urlSource - or base64Source must be specified. + analyze_batch_request = { + "resultContainerUrl": "str", + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "overwriteExisting": bool, + "resultPrefix": "str" } # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. - "pages": [ - { - "pageNumber": 0, # 1-based page number in the input - document. Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. - "barcodes": [ - { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". - "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - }, - "value": "str", # Barcode value. Required. - "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. - ] - } - ], - "formulas": [ - { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". - "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - }, - "value": "str", # LaTex expression - describing the formula. Required. - "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. - ] - } - ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. - "lines": [ - { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. - ] - } - ], - "selectionMarks": [ - { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. - "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". - "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. - ] - } - ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. - "words": [ - { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. - "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - }, - "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. - ] - } - ] - } - ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". - "documents": [ - { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. - "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "fields": { - "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. - }, - "valueArray": [ - ... - ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). - "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. - }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. - "valueObject": { - "str": ... - }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). - "valueSelectionGroup": [ - "str" # Optional. Selection group - value. - ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). - } - } - } - ], - "figures": [ + "details": [ { - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. - "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "caption": { - "content": "str", # Content of the caption. - Required. - "spans": [ - { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. - "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. - ] - } + "sourceUrl": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... ], - "elements": [ - "str" # Optional. Child elements of the - caption. - ] + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" }, - "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. - ], - "footnotes": [ - { - "content": "str", # Content of the footnote. - Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the footnote. - ] - } - ] + "resultUrl": "str" } ], - "keyValuePairs": [ + "failedCount": 0, + "skippedCount": 0, + "succeededCount": 0 + } + """ + + @overload + def begin_analyze_batch_documents( + self, + model_id: str, + analyze_batch_request: Optional[JSON] = None, + *, + pages: Optional[str] = None, + locale: Optional[str] = None, + string_index_type: Optional[Union[str, _models.StringIndexType]] = None, + features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, + query_fields: Optional[List[str]] = None, + output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.AnalyzeBatchResult]: + """Analyzes batch documents with document model. + + :param model_id: Unique document model name. Required. + :type model_id: str + :param analyze_batch_request: Analyze batch request parameters. Default value is None. + :type analyze_batch_request: JSON + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str + :keyword locale: Locale hint for text recognition and document analysis. Value may contain + only + the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). Default value is + None. + :paramtype locale: str + :keyword string_index_type: Method used to compute string offset and length. Known values are: + "textElements", "unicodeCodePoint", and "utf16CodeUnit". Default value is None. + :paramtype string_index_type: str or ~azure.ai.documentintelligence.models.StringIndexType + :keyword features: List of optional analysis features. Default value is None. + :paramtype features: list[str or ~azure.ai.documentintelligence.models.DocumentAnalysisFeature] + :keyword query_fields: List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". + Default value is None. + :paramtype query_fields: list[str] + :keyword output_content_format: Format of the analyze result top-level content. Known values + are: "text" and "markdown". Default value is None. + :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AnalyzeBatchResult. The AnalyzeBatchResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.AnalyzeBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 202 + response == { + "details": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. - "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. - "spans": [ - { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - } + "sourceUrl": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. - "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. - ] - } - ] + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" }, - "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. - "spans": [ - { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. - "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. - ] - } - ] - } - } - ], - "languages": [ - { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "paragraphs": [ - { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. - "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". - } - ], - "sections": [ - { - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "elements": [ - "str" # Optional. Child elements of the section. - ] - } - ], - "styles": [ - { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "resultUrl": "str" } ], - "tables": [ - { - "cells": [ - { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. - "elements": [ - "str" # Optional. Child elements of - the table cell. - ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. - } - ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. - "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "caption": { - "content": "str", # Content of the caption. - Required. - "spans": [ - { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. - "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of the - caption. - ] - }, - "footnotes": [ - { - "content": "str", # Content of the footnote. - Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the footnote. - ] - } - ] - } - ] + "failedCount": 0, + "skippedCount": 0, + "succeededCount": 0 } """ @overload - def begin_classify_document( + def begin_analyze_batch_documents( self, - classifier_id: str, - classify_request: JSON, + model_id: str, + analyze_batch_request: Optional[IO[bytes]] = None, *, + pages: Optional[str] = None, + locale: Optional[str] = None, string_index_type: Optional[Union[str, _models.StringIndexType]] = None, - split: Optional[Union[str, _models.SplitMode]] = None, + features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, + query_fields: Optional[List[str]] = None, + output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, content_type: str = "application/json", **kwargs: Any, - ) -> LROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long - """Classifies document with document classifier. + ) -> LROPoller[_models.AnalyzeBatchResult]: + """Analyzes batch documents with document model. - :param classifier_id: Unique document classifier name. Required. - :type classifier_id: str - :param classify_request: Classify request parameters. Required. - :type classify_request: JSON + :param model_id: Unique document model name. Required. + :type model_id: str + :param analyze_batch_request: Analyze batch request parameters. Default value is None. + :type analyze_batch_request: IO[bytes] + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str + :keyword locale: Locale hint for text recognition and document analysis. Value may contain + only + the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). Default value is + None. + :paramtype locale: str :keyword string_index_type: Method used to compute string offset and length. Known values are: "textElements", "unicodeCodePoint", and "utf16CodeUnit". Default value is None. :paramtype string_index_type: str or ~azure.ai.documentintelligence.models.StringIndexType - :keyword split: Document splitting mode. Known values are: "auto", "none", and "perPage". + :keyword features: List of optional analysis features. Default value is None. + :paramtype features: list[str or ~azure.ai.documentintelligence.models.DocumentAnalysisFeature] + :keyword query_fields: List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". Default value is None. - :paramtype split: str or ~azure.ai.documentintelligence.models.SplitMode - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + :paramtype query_fields: list[str] + :keyword output_content_format: Format of the analyze result top-level content. Known values + are: "text" and "markdown". Default value is None. + :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AnalyzeResult. The AnalyzeResult is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.AnalyzeResult] + :return: An instance of LROPoller that returns AnalyzeBatchResult. The AnalyzeBatchResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.AnalyzeBatchResult] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -4541,283 +3074,1081 @@ def begin_classify_document( # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. - "pages": [ + "details": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. - "barcodes": [ - { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". - "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - }, - "value": "str", # Barcode value. Required. - "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. - ] - } - ], - "formulas": [ - { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". - "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - }, - "value": "str", # LaTex expression - describing the formula. Required. - "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. - ] - } - ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. - "lines": [ - { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], + "sourceUrl": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "resultUrl": "str" + } + ], + "failedCount": 0, + "skippedCount": 0, + "succeededCount": 0 + } + """ + + @distributed_trace + def begin_analyze_batch_documents( + self, + model_id: str, + analyze_batch_request: Optional[Union[_models.AnalyzeBatchDocumentsRequest, JSON, IO[bytes]]] = None, + *, + pages: Optional[str] = None, + locale: Optional[str] = None, + string_index_type: Optional[Union[str, _models.StringIndexType]] = None, + features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, + query_fields: Optional[List[str]] = None, + output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, + **kwargs: Any, + ) -> LROPoller[_models.AnalyzeBatchResult]: + """Analyzes batch documents with document model. + + :param model_id: Unique document model name. Required. + :type model_id: str + :param analyze_batch_request: Analyze batch request parameters. Is one of the following types: + AnalyzeBatchDocumentsRequest, JSON, IO[bytes] Default value is None. + :type analyze_batch_request: ~azure.ai.documentintelligence.models.AnalyzeBatchDocumentsRequest + or JSON or IO[bytes] + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str + :keyword locale: Locale hint for text recognition and document analysis. Value may contain + only + the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). Default value is + None. + :paramtype locale: str + :keyword string_index_type: Method used to compute string offset and length. Known values are: + "textElements", "unicodeCodePoint", and "utf16CodeUnit". Default value is None. + :paramtype string_index_type: str or ~azure.ai.documentintelligence.models.StringIndexType + :keyword features: List of optional analysis features. Default value is None. + :paramtype features: list[str or ~azure.ai.documentintelligence.models.DocumentAnalysisFeature] + :keyword query_fields: List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". + Default value is None. + :paramtype query_fields: list[str] + :keyword output_content_format: Format of the analyze result top-level content. Known values + are: "text" and "markdown". Default value is None. + :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] + :return: An instance of LROPoller that returns AnalyzeBatchResult. The AnalyzeBatchResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.AnalyzeBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + analyze_batch_request = { + "resultContainerUrl": "str", + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "overwriteExisting": bool, + "resultPrefix": "str" + } + + # response body for status code(s): 202 + response == { + "details": [ + { + "sourceUrl": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "resultUrl": "str" + } + ], + "failedCount": 0, + "skippedCount": 0, + "succeededCount": 0 + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) + cls: ClsType[_models.AnalyzeBatchResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._analyze_batch_documents_initial( + model_id=model_id, + analyze_batch_request=analyze_batch_request, + pages=pages, + locale=locale, + string_index_type=string_index_type, + features=features, + query_fields=query_fields, + output_content_format=output_content_format, + output=output, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs, + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = _deserialize(_models.AnalyzeBatchResult, response.json().get("result")) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AnalyzeBatchResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AnalyzeBatchResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_analyze_result_pdf(self, model_id: str, result_id: str, **kwargs: Any) -> Iterator[bytes]: + """Gets the generated searchable PDF output from document analysis. + + :param model_id: Unique document model name. Required. + :type model_id: str + :param result_id: Analyze operation result ID. Required. + :type result_id: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_document_intelligence_get_analyze_result_pdf_request( + model_id=model_id, + result_id=result_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_analyze_result_figure( + self, model_id: str, result_id: str, figure_id: str, **kwargs: Any + ) -> Iterator[bytes]: + """Gets the generated cropped image of specified figure from document analysis. + + :param model_id: Unique document model name. Required. + :type model_id: str + :param result_id: Analyze operation result ID. Required. + :type result_id: str + :param figure_id: Figure ID. Required. + :type figure_id: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_document_intelligence_get_analyze_result_figure_request( + model_id=model_id, + result_id=result_id, + figure_id=figure_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def _classify_document_initial( + self, + classifier_id: str, + classify_request: Union[_models.ClassifyDocumentRequest, JSON, IO[bytes]], + *, + string_index_type: Optional[Union[str, _models.StringIndexType]] = None, + split: Optional[Union[str, _models.SplitMode]] = None, + pages: Optional[str] = None, + **kwargs: Any, + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(classify_request, (IOBase, bytes)): + _content = classify_request + else: + _content = json.dumps(classify_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_document_intelligence_classify_document_request( + classifier_id=classifier_id, + string_index_type=string_index_type, + split=split, + pages=pages, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_classify_document( + self, + classifier_id: str, + classify_request: _models.ClassifyDocumentRequest, + *, + string_index_type: Optional[Union[str, _models.StringIndexType]] = None, + split: Optional[Union[str, _models.SplitMode]] = None, + pages: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.AnalyzeResult]: + """Classifies document with document classifier. + + :param classifier_id: Unique document classifier name. Required. + :type classifier_id: str + :param classify_request: Classify request parameters. Required. + :type classify_request: ~azure.ai.documentintelligence.models.ClassifyDocumentRequest + :keyword string_index_type: Method used to compute string offset and length. Known values are: + "textElements", "unicodeCodePoint", and "utf16CodeUnit". Default value is None. + :paramtype string_index_type: str or ~azure.ai.documentintelligence.models.StringIndexType + :keyword split: Document splitting mode. Known values are: "auto", "none", and "perPage". + Default value is None. + :paramtype split: str or ~azure.ai.documentintelligence.models.SplitMode + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AnalyzeResult. The AnalyzeResult is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.AnalyzeResult] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + classify_request = { + "base64Source": bytes("bytes", encoding="utf-8"), + "urlSource": "str" + } + + # response body for status code(s): 202 + response == { + "apiVersion": "str", + "content": "str", + "modelId": "str", + "pages": [ + { + "pageNumber": 0, + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "angle": 0.0, + "barcodes": [ + { + "confidence": 0.0, + "kind": "str", + "span": { + "length": 0, + "offset": 0 + }, + "value": "str", + "polygon": [ + 0.0 + ] + } + ], + "formulas": [ + { + "confidence": 0.0, + "kind": "str", + "span": { + "length": 0, + "offset": 0 + }, + "value": "str", + "polygon": [ + 0.0 + ] + } + ], + "height": 0.0, + "lines": [ + { + "content": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "polygon": [ + 0.0 + ] + } + ], + "selectionMarks": [ + { + "confidence": 0.0, + "span": { + "length": 0, + "offset": 0 + }, + "state": "str", + "polygon": [ + 0.0 + ] + } + ], + "unit": "str", + "width": 0.0, + "words": [ + { + "confidence": 0.0, + "content": "str", + "span": { + "length": 0, + "offset": 0 + }, + "polygon": [ + 0.0 + ] + } + ] + } + ], + "stringIndexType": "str", + "contentFormat": "str", + "documents": [ + { + "confidence": 0.0, + "docType": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "boundingRegions": [ + { + "pageNumber": 0, + "polygon": [ + 0.0 + ] + } + ], + "fields": { + "str": { + "type": "str", + "boundingRegions": [ + { + "pageNumber": 0, + "polygon": [ + 0.0 + ] + } + ], + "confidence": 0.0, + "content": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "valueAddress": { + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" + }, + "valueArray": [ + ... + ], + "valueBoolean": bool, + "valueCountryRegion": "str", + "valueCurrency": { + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" + }, + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, + "valueObject": { + "str": ... + }, + "valuePhoneNumber": "str", + "valueSelectionGroup": [ + "str" + ], + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" + } + } + } + ], + "figures": [ + { + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "boundingRegions": [ + { + "pageNumber": 0, + "polygon": [ + 0.0 + ] + } + ], + "caption": { + "content": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "boundingRegions": [ + { + "pageNumber": 0, + "polygon": [ + 0.0 + ] + } + ], + "elements": [ + "str" + ] + }, + "elements": [ + "str" + ], + "footnotes": [ + { + "content": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "boundingRegions": [ + { + "pageNumber": 0, + "polygon": [ + 0.0 + ] + } + ], + "elements": [ + "str" + ] + } + ], + "id": "str" + } + ], + "keyValuePairs": [ + { + "confidence": 0.0, + "key": { + "content": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "boundingRegions": [ + { + "pageNumber": 0, + "polygon": [ + 0.0 + ] + } + ] + }, + "value": { + "content": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "boundingRegions": [ + { + "pageNumber": 0, + "polygon": [ + 0.0 + ] + } + ] + } + } + ], + "languages": [ + { + "confidence": 0.0, + "locale": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ] + } + ], + "paragraphs": [ + { + "content": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "boundingRegions": [ + { + "pageNumber": 0, + "polygon": [ + 0.0 + ] + } + ], + "role": "str" + } + ], + "sections": [ + { + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "elements": [ + "str" + ] + } + ], + "styles": [ + { + "confidence": 0.0, + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" + } + ], + "tables": [ + { + "cells": [ + { + "columnIndex": 0, + "content": "str", + "rowIndex": 0, + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "boundingRegions": [ + { + "pageNumber": 0, + "polygon": [ + 0.0 + ] + } + ], + "columnSpan": 0, + "elements": [ + "str" + ], + "kind": "str", + "rowSpan": 0 + } + ], + "columnCount": 0, + "rowCount": 0, + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "boundingRegions": [ + { + "pageNumber": 0, + "polygon": [ + 0.0 + ] + } + ], + "caption": { + "content": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "boundingRegions": [ + { + "pageNumber": 0, + "polygon": [ + 0.0 + ] + } + ], + "elements": [ + "str" + ] + }, + "footnotes": [ + { + "content": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "boundingRegions": [ + { + "pageNumber": 0, + "polygon": [ + 0.0 + ] + } + ], + "elements": [ + "str" + ] + } + ] + } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + } + """ + + @overload + def begin_classify_document( + self, + classifier_id: str, + classify_request: JSON, + *, + string_index_type: Optional[Union[str, _models.StringIndexType]] = None, + split: Optional[Union[str, _models.SplitMode]] = None, + pages: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.AnalyzeResult]: + """Classifies document with document classifier. + + :param classifier_id: Unique document classifier name. Required. + :type classifier_id: str + :param classify_request: Classify request parameters. Required. + :type classify_request: JSON + :keyword string_index_type: Method used to compute string offset and length. Known values are: + "textElements", "unicodeCodePoint", and "utf16CodeUnit". Default value is None. + :paramtype string_index_type: str or ~azure.ai.documentintelligence.models.StringIndexType + :keyword split: Document splitting mode. Known values are: "auto", "none", and "perPage". + Default value is None. + :paramtype split: str or ~azure.ai.documentintelligence.models.SplitMode + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns AnalyzeResult. The AnalyzeResult is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.AnalyzeResult] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 202 + response == { + "apiVersion": "str", + "content": "str", + "modelId": "str", + "pages": [ + { + "pageNumber": 0, + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "angle": 0.0, + "barcodes": [ + { + "confidence": 0.0, + "kind": "str", + "span": { + "length": 0, + "offset": 0 + }, + "value": "str", + "polygon": [ + 0.0 + ] + } + ], + "formulas": [ + { + "confidence": 0.0, + "kind": "str", + "span": { + "length": 0, + "offset": 0 + }, + "value": "str", + "polygon": [ + 0.0 + ] + } + ], + "height": 0.0, + "lines": [ + { + "content": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -4826,149 +4157,99 @@ def begin_classify_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -4977,281 +4258,161 @@ def begin_classify_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -5264,10 +4425,10 @@ def begin_classify_document( *, string_index_type: Optional[Union[str, _models.StringIndexType]] = None, split: Optional[Union[str, _models.SplitMode]] = None, + pages: Optional[str] = None, content_type: str = "application/json", **kwargs: Any, ) -> LROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Classifies document with document classifier. :param classifier_id: Unique document classifier name. Required. @@ -5280,6 +4441,9 @@ def begin_classify_document( :keyword split: Document splitting mode. Known values are: "auto", "none", and "perPage". Default value is None. :paramtype split: str or ~azure.ai.documentintelligence.models.SplitMode + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -5293,283 +4457,171 @@ def begin_classify_document( # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -5578,432 +4630,262 @@ def begin_classify_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] } - } - ], - "languages": [ - { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + } + ], + "languages": [ + { + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -6016,9 +4898,9 @@ def begin_classify_document( *, string_index_type: Optional[Union[str, _models.StringIndexType]] = None, split: Optional[Union[str, _models.SplitMode]] = None, + pages: Optional[str] = None, **kwargs: Any, ) -> LROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Classifies document with document classifier. :param classifier_id: Unique document classifier name. Required. @@ -6033,6 +4915,9 @@ def begin_classify_document( :keyword split: Document splitting mode. Known values are: "auto", "none", and "perPage". Default value is None. :paramtype split: str or ~azure.ai.documentintelligence.models.SplitMode + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str :return: An instance of LROPoller that returns AnalyzeResult. The AnalyzeResult is compatible with MutableMapping :rtype: ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.AnalyzeResult] @@ -6043,292 +4928,177 @@ def begin_classify_document( # JSON input template you can fill out and use as your body input. classify_request = { - "base64Source": bytes("bytes", encoding="utf-8"), # Optional. Base64 - encoding of the document to classify. Either urlSource or base64Source must be - specified. - "urlSource": "str" # Optional. Document URL to classify. Either urlSource - or base64Source must be specified. + "base64Source": bytes("bytes", encoding="utf-8"), + "urlSource": "str" } # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -6337,149 +5107,99 @@ def begin_classify_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -6488,281 +5208,161 @@ def begin_classify_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -6775,17 +5375,19 @@ def begin_classify_document( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._classify_document_initial( # type: ignore + raw_result = self._classify_document_initial( classifier_id=classifier_id, classify_request=classify_request, string_index_type=string_index_type, split=split, + pages=pages, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs, ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -6825,12 +5427,13 @@ def get_long_running_output(pipeline_response): ) -class DocumentIntelligenceAdministrationClientOperationsMixin( # pylint: disable=name-too-long +class DocumentIntelligenceAdministrationClientOperationsMixin( # pylint: disable=too-many-public-methods,name-too-long DocumentIntelligenceAdministrationClientMixinABC ): - def _build_document_model_initial( # pylint: disable=inconsistent-return-statements + + def _build_document_model_initial( self, build_request: Union[_models.BuildDocumentModelRequest, JSON, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6843,7 +5446,7 @@ def _build_document_model_initial( # pylint: disable=inconsistent-return-statem _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -6864,7 +5467,7 @@ def _build_document_model_initial( # pylint: disable=inconsistent-return-statem } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6872,8 +5475,10 @@ def _build_document_model_initial( # pylint: disable=inconsistent-return-statem response = pipeline_response.http_response if response.status_code not in [202]: - if _stream: + try: response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -6882,14 +5487,17 @@ def _build_document_model_initial( # pylint: disable=inconsistent-return-statem response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_build_document_model( self, build_request: _models.BuildDocumentModelRequest, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Builds a custom document analysis model. :param build_request: Build request parameters. Required. @@ -6908,86 +5516,80 @@ def begin_build_document_model( # JSON input template you can fill out and use as your body input. build_request = { - "buildMode": "str", # Custom document model build mode. Required. Known - values are: "template" and "neural". - "modelId": "str", # Unique document model name. Required. + "buildMode": "str", + "modelId": "str", + "allowOverwrite": bool, "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "description": "str", # Optional. Document model description. + "description": "str", + "maxTrainingHours": 0.0, "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -6997,7 +5599,6 @@ def begin_build_document_model( def begin_build_document_model( self, build_request: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Builds a custom document analysis model. :param build_request: Build request parameters. Required. @@ -7016,65 +5617,60 @@ def begin_build_document_model( # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7084,7 +5680,6 @@ def begin_build_document_model( def begin_build_document_model( self, build_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Builds a custom document analysis model. :param build_request: Build request parameters. Required. @@ -7103,65 +5698,60 @@ def begin_build_document_model( # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7171,7 +5761,6 @@ def begin_build_document_model( def begin_build_document_model( self, build_request: Union[_models.BuildDocumentModelRequest, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Builds a custom document analysis model. :param build_request: Build request parameters. Is one of the following types: @@ -7189,86 +5778,80 @@ def begin_build_document_model( # JSON input template you can fill out and use as your body input. build_request = { - "buildMode": "str", # Custom document model build mode. Required. Known - values are: "template" and "neural". - "modelId": "str", # Unique document model name. Required. + "buildMode": "str", + "modelId": "str", + "allowOverwrite": bool, "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "description": "str", # Optional. Document model description. + "description": "str", + "maxTrainingHours": 0.0, "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7282,7 +5865,7 @@ def begin_build_document_model( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._build_document_model_initial( # type: ignore + raw_result = self._build_document_model_initial( build_request=build_request, content_type=content_type, cls=lambda x, y, z: x, @@ -7290,6 +5873,7 @@ def begin_build_document_model( params=_params, **kwargs, ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -7328,9 +5912,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _compose_model_initial( # pylint: disable=inconsistent-return-statements + def _compose_model_initial( self, compose_request: Union[_models.ComposeDocumentModelRequest, JSON, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7343,7 +5927,7 @@ def _compose_model_initial( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -7364,7 +5948,7 @@ def _compose_model_initial( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7372,8 +5956,10 @@ def _compose_model_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: - if _stream: + try: response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -7382,8 +5968,12 @@ def _compose_model_initial( # pylint: disable=inconsistent-return-statements response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_compose_model( @@ -7393,7 +5983,6 @@ def begin_compose_model( content_type: str = "application/json", **kwargs: Any, ) -> LROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Creates a new document model from document types of existing document models. :param compose_request: Compose request parameters. Required. @@ -7412,80 +6001,100 @@ def begin_compose_model( # JSON input template you can fill out and use as your body input. compose_request = { - "componentModels": [ - { - "modelId": "str" # Unique document model name. Required. + "classifierId": "str", + "docTypes": { + "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, + "fieldSchema": { + "str": { + "type": "str", + "description": "str", + "example": "str", + "items": ..., + "properties": { + "str": ... + } + } + }, + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } - ], - "modelId": "str", # Unique document model name. Required. - "description": "str", # Optional. Document model description. + }, + "modelId": "str", + "description": "str", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7495,7 +6104,6 @@ def begin_compose_model( def begin_compose_model( self, compose_request: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Creates a new document model from document types of existing document models. :param compose_request: Compose request parameters. Required. @@ -7514,65 +6122,60 @@ def begin_compose_model( # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7582,7 +6185,6 @@ def begin_compose_model( def begin_compose_model( self, compose_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Creates a new document model from document types of existing document models. :param compose_request: Compose request parameters. Required. @@ -7601,65 +6203,60 @@ def begin_compose_model( # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7669,7 +6266,6 @@ def begin_compose_model( def begin_compose_model( self, compose_request: Union[_models.ComposeDocumentModelRequest, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Creates a new document model from document types of existing document models. :param compose_request: Compose request parameters. Is one of the following types: @@ -7687,80 +6283,100 @@ def begin_compose_model( # JSON input template you can fill out and use as your body input. compose_request = { - "componentModels": [ - { - "modelId": "str" # Unique document model name. Required. + "classifierId": "str", + "docTypes": { + "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, + "fieldSchema": { + "str": { + "type": "str", + "description": "str", + "example": "str", + "items": ..., + "properties": { + "str": ... + } + } + }, + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } - ], - "modelId": "str", # Unique document model name. Required. - "description": "str", # Optional. Document model description. + }, + "modelId": "str", + "description": "str", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7774,7 +6390,7 @@ def begin_compose_model( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._compose_model_initial( # type: ignore + raw_result = self._compose_model_initial( compose_request=compose_request, content_type=content_type, cls=lambda x, y, z: x, @@ -7782,6 +6398,7 @@ def begin_compose_model( params=_params, **kwargs, ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -7828,7 +6445,6 @@ def authorize_model_copy( content_type: str = "application/json", **kwargs: Any, ) -> _models.CopyAuthorization: - # pylint: disable=line-too-long """Generates authorization to copy a document model to this location with specified modelId and optional description. @@ -7846,26 +6462,21 @@ def authorize_model_copy( # JSON input template you can fill out and use as your body input. authorize_copy_request = { - "modelId": "str", # Unique document model name. Required. - "description": "str", # Optional. Document model description. + "modelId": "str", + "description": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 200 response == { - "accessToken": "str", # Token used to authorize the request. Required. - "expirationDateTime": "2020-02-20 00:00:00", # Date/time when the access - token expires. Required. - "targetModelId": "str", # Identifier of the target document model. Required. - "targetModelLocation": "str", # URL of the copied document model in the - target account. Required. - "targetResourceId": "str", # ID of the target Azure resource where the - document model should be copied to. Required. - "targetResourceRegion": "str" # Location of the target Azure resource where - the document model should be copied to. Required. + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetModelId": "str", + "targetModelLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } """ @@ -7873,7 +6484,6 @@ def authorize_model_copy( def authorize_model_copy( self, authorize_copy_request: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> _models.CopyAuthorization: - # pylint: disable=line-too-long """Generates authorization to copy a document model to this location with specified modelId and optional description. @@ -7891,16 +6501,12 @@ def authorize_model_copy( # response body for status code(s): 200 response == { - "accessToken": "str", # Token used to authorize the request. Required. - "expirationDateTime": "2020-02-20 00:00:00", # Date/time when the access - token expires. Required. - "targetModelId": "str", # Identifier of the target document model. Required. - "targetModelLocation": "str", # URL of the copied document model in the - target account. Required. - "targetResourceId": "str", # ID of the target Azure resource where the - document model should be copied to. Required. - "targetResourceRegion": "str" # Location of the target Azure resource where - the document model should be copied to. Required. + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetModelId": "str", + "targetModelLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } """ @@ -7908,7 +6514,6 @@ def authorize_model_copy( def authorize_model_copy( self, authorize_copy_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.CopyAuthorization: - # pylint: disable=line-too-long """Generates authorization to copy a document model to this location with specified modelId and optional description. @@ -7926,16 +6531,12 @@ def authorize_model_copy( # response body for status code(s): 200 response == { - "accessToken": "str", # Token used to authorize the request. Required. - "expirationDateTime": "2020-02-20 00:00:00", # Date/time when the access - token expires. Required. - "targetModelId": "str", # Identifier of the target document model. Required. - "targetModelLocation": "str", # URL of the copied document model in the - target account. Required. - "targetResourceId": "str", # ID of the target Azure resource where the - document model should be copied to. Required. - "targetResourceRegion": "str" # Location of the target Azure resource where - the document model should be copied to. Required. + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetModelId": "str", + "targetModelLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } """ @@ -7943,7 +6544,6 @@ def authorize_model_copy( def authorize_model_copy( self, authorize_copy_request: Union[_models.AuthorizeCopyRequest, JSON, IO[bytes]], **kwargs: Any ) -> _models.CopyAuthorization: - # pylint: disable=line-too-long """Generates authorization to copy a document model to this location with specified modelId and optional description. @@ -7960,26 +6560,21 @@ def authorize_model_copy( # JSON input template you can fill out and use as your body input. authorize_copy_request = { - "modelId": "str", # Unique document model name. Required. - "description": "str", # Optional. Document model description. + "modelId": "str", + "description": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 200 response == { - "accessToken": "str", # Token used to authorize the request. Required. - "expirationDateTime": "2020-02-20 00:00:00", # Date/time when the access - token expires. Required. - "targetModelId": "str", # Identifier of the target document model. Required. - "targetModelLocation": "str", # URL of the copied document model in the - target account. Required. - "targetResourceId": "str", # ID of the target Azure resource where the - document model should be copied to. Required. - "targetResourceRegion": "str" # Location of the target Azure resource where - the document model should be copied to. Required. + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetModelId": "str", + "targetModelLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -8024,7 +6619,10 @@ def authorize_model_copy( if response.status_code not in [200]: if _stream: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -8039,9 +6637,9 @@ def authorize_model_copy( return deserialized # type: ignore - def _copy_model_to_initial( # pylint: disable=inconsistent-return-statements + def _copy_model_to_initial( self, model_id: str, copy_to_request: Union[_models.CopyAuthorization, JSON, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8054,7 +6652,7 @@ def _copy_model_to_initial( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -8076,7 +6674,7 @@ def _copy_model_to_initial( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8084,8 +6682,10 @@ def _copy_model_to_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: - if _stream: + try: response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -8094,8 +6694,12 @@ def _copy_model_to_initial( # pylint: disable=inconsistent-return-statements response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_copy_model_to( @@ -8106,7 +6710,6 @@ def begin_copy_model_to( content_type: str = "application/json", **kwargs: Any, ) -> LROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Copies document model to the target resource, region, and modelId. :param model_id: Unique document model name. Required. @@ -8127,79 +6730,70 @@ def begin_copy_model_to( # JSON input template you can fill out and use as your body input. copy_to_request = { - "accessToken": "str", # Token used to authorize the request. Required. - "expirationDateTime": "2020-02-20 00:00:00", # Date/time when the access - token expires. Required. - "targetModelId": "str", # Identifier of the target document model. Required. - "targetModelLocation": "str", # URL of the copied document model in the - target account. Required. - "targetResourceId": "str", # ID of the target Azure resource where the - document model should be copied to. Required. - "targetResourceRegion": "str" # Location of the target Azure resource where - the document model should be copied to. Required. + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetModelId": "str", + "targetModelLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -8209,7 +6803,6 @@ def begin_copy_model_to( def begin_copy_model_to( self, model_id: str, copy_to_request: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Copies document model to the target resource, region, and modelId. :param model_id: Unique document model name. Required. @@ -8230,65 +6823,60 @@ def begin_copy_model_to( # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -8298,7 +6886,6 @@ def begin_copy_model_to( def begin_copy_model_to( self, model_id: str, copy_to_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Copies document model to the target resource, region, and modelId. :param model_id: Unique document model name. Required. @@ -8319,65 +6906,60 @@ def begin_copy_model_to( # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -8387,7 +6969,6 @@ def begin_copy_model_to( def begin_copy_model_to( self, model_id: str, copy_to_request: Union[_models.CopyAuthorization, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Copies document model to the target resource, region, and modelId. :param model_id: Unique document model name. Required. @@ -8407,79 +6988,70 @@ def begin_copy_model_to( # JSON input template you can fill out and use as your body input. copy_to_request = { - "accessToken": "str", # Token used to authorize the request. Required. - "expirationDateTime": "2020-02-20 00:00:00", # Date/time when the access - token expires. Required. - "targetModelId": "str", # Identifier of the target document model. Required. - "targetModelLocation": "str", # URL of the copied document model in the - target account. Required. - "targetResourceId": "str", # ID of the target Azure resource where the - document model should be copied to. Required. - "targetResourceRegion": "str" # Location of the target Azure resource where - the document model should be copied to. Required. + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetModelId": "str", + "targetModelLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -8493,7 +7065,7 @@ def begin_copy_model_to( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._copy_model_to_initial( # type: ignore + raw_result = self._copy_model_to_initial( model_id=model_id, copy_to_request=copy_to_request, content_type=content_type, @@ -8502,6 +7074,7 @@ def begin_copy_model_to( params=_params, **kwargs, ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -8542,7 +7115,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_model(self, model_id: str, **kwargs: Any) -> _models.DocumentModelDetails: - # pylint: disable=line-too-long """Gets detailed document model information. :param model_id: Unique document model name. Required. @@ -8556,65 +7128,60 @@ def get_model(self, model_id: str, **kwargs: Any) -> _models.DocumentModelDetail # response body for status code(s): 200 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -8652,7 +7219,10 @@ def get_model(self, model_id: str, **kwargs: Any) -> _models.DocumentModelDetail if response.status_code not in [200]: if _stream: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -8674,7 +7244,6 @@ def get_model(self, model_id: str, **kwargs: Any) -> _models.DocumentModelDetail @distributed_trace def list_models(self, **kwargs: Any) -> Iterable["_models.DocumentModelDetails"]: - # pylint: disable=line-too-long """List all document models. :return: An iterator like instance of DocumentModelDetails @@ -8687,65 +7256,60 @@ def list_models(self, **kwargs: Any) -> Iterable["_models.DocumentModelDetails"] # response body for status code(s): 200 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -8817,8 +7381,6 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -8848,10 +7410,72 @@ def delete_model(self, model_id: str, **kwargs: Any) -> None: # pylint: disable _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_document_intelligence_administration_delete_model_request( + model_id=model_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def get_resource_info(self, **kwargs: Any) -> _models.ResourceDetails: + """Return information about the current resource. + + :return: ResourceDetails. The ResourceDetails is compatible with MutableMapping + :rtype: ~azure.ai.documentintelligence.models.ResourceDetails + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "customDocumentModels": { + "count": 0, + "limit": 0 + } + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ResourceDetails] = kwargs.pop("cls", None) - _request = build_document_intelligence_administration_delete_model_request( - model_id=model_id, + _request = build_document_intelligence_administration_get_resource_info_request( api_version=self._config.api_version, headers=_headers, params=_params, @@ -8861,55 +7485,421 @@ def delete_model(self, model_id: str, **kwargs: Any) -> None: # pylint: disable } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: if _stream: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ResourceDetails, response.json()) if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get_resource_info(self, **kwargs: Any) -> _models.ResourceDetails: - # pylint: disable=line-too-long - """Return information about the current resource. + def get_operation(self, operation_id: str, **kwargs: Any) -> _models.OperationDetails: + """Gets operation info. - :return: ResourceDetails. The ResourceDetails is compatible with MutableMapping - :rtype: ~azure.ai.documentintelligence.models.ResourceDetails + :param operation_id: Operation ID. Required. + :type operation_id: str + :return: OperationDetails. The OperationDetails is compatible with MutableMapping + :rtype: ~azure.ai.documentintelligence.models.OperationDetails :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 - response == { - "customDocumentModels": { - "count": 0, # Number of custom document models in the current - resource. Required. - "limit": 0 # Maximum number of custom document models supported in - the current resource. Required. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "documentClassifierBuild": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentClassifierBuild", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + }, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "documentClassifierCopyTo": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentClassifierCopyTo", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + }, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "documentModelBuild": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentModelBuild", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "buildMode": "str", + "classifierId": "str", + "description": "str", + "docTypes": { + "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, + "fieldSchema": { + "str": { + "type": "str", + "description": "str", + "example": "str", + "items": ..., + "properties": { + "str": ... + } + } + }, + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] + } + }, + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", + "tags": { + "str": "str" + }, + "trainingHours": 0.0, + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + }, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "documentModelCompose": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentModelCompose", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "buildMode": "str", + "classifierId": "str", + "description": "str", + "docTypes": { + "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, + "fieldSchema": { + "str": { + "type": "str", + "description": "str", + "example": "str", + "items": ..., + "properties": { + "str": ... + } + } + }, + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] + } + }, + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", + "tags": { + "str": "str" + }, + "trainingHours": 0.0, + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + }, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "documentModelCopyTo": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentModelCopyTo", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "buildMode": "str", + "classifierId": "str", + "description": "str", + "docTypes": { + "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, + "fieldSchema": { + "str": { + "type": "str", + "description": "str", + "example": "str", + "items": ..., + "properties": { + "str": ... + } + } + }, + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] + } + }, + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", + "tags": { + "str": "str" + }, + "trainingHours": 0.0, + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] }, - "customNeuralDocumentModelBuilds": { - "quota": 0, # Resource quota limit. Required. - "quotaResetDateTime": "2020-02-20 00:00:00", # Date/time when the - resource quota usage will be reset. Required. - "used": 0 # Amount of the resource quota used. Required. + "tags": { + "str": "str" } } + + # response body for status code(s): 200 + response == operation_details """ error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -8922,9 +7912,10 @@ def get_resource_info(self, **kwargs: Any) -> _models.ResourceDetails: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ResourceDetails] = kwargs.pop("cls", None) + cls: ClsType[_models.OperationDetails] = kwargs.pop("cls", None) - _request = build_document_intelligence_administration_get_resource_info_request( + _request = build_document_intelligence_administration_get_operation_request( + operation_id=operation_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8943,30 +7934,35 @@ def get_resource_info(self, **kwargs: Any) -> _models.ResourceDetails: if response.status_code not in [200]: if _stream: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) + if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.ResourceDetails, response.json()) + deserialized = _deserialize(_models.OperationDetails, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def get_operation(self, operation_id: str, **kwargs: Any) -> _models.OperationDetails: - # pylint: disable=line-too-long - """Gets operation info. + def list_operations(self, **kwargs: Any) -> Iterable["_models.OperationDetails"]: + """Lists all operations. - :param operation_id: Operation ID. Required. - :type operation_id: str - :return: OperationDetails. The OperationDetails is compatible with MutableMapping - :rtype: ~azure.ai.documentintelligence.models.OperationDetails + :return: An iterator like instance of OperationDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.documentintelligence.models.OperationDetails] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8975,295 +7971,384 @@ def get_operation(self, operation_id: str, **kwargs: Any) -> _models.OperationDe # The response is polymorphic. The following are possible polymorphic responses based off discriminator "kind": - # JSON input template for discriminator value "documentClassifierBuild": + # JSON input template for discriminator value "documentClassifierBuild": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentClassifierBuild", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + }, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "documentClassifierCopyTo": operation_details = { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - operation was created. Required. - "kind": "documentClassifierBuild", - "lastUpdatedDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - status was last updated. Required. - "operationId": "str", # Operation ID. Required. - "resourceLocation": "str", # URL of the resource targeted by this operation. - Required. - "status": "str", # Operation status. notStarted, running, completed, or - failed. Required. Known values are: "notStarted", "running", "failed", - "succeeded", "completed", and "canceled". - "apiVersion": "str", # Optional. API version used to create this operation. + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentClassifierCopyTo", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", "error": { - "code": "str", # One of a server-defined set of error codes. - Required. - "message": "str", # A human-readable representation of the error. - Required. + "code": "str", + "message": "str", "details": [ ... ], "innererror": { - "code": "str", # Optional. One of a server-defined set of - error codes. + "code": "str", "innererror": ..., - "message": "str" # Optional. A human-readable representation - of the error. + "message": "str" }, - "target": "str" # Optional. The target of the error. + "target": "str" }, - "percentCompleted": 0, # Optional. Operation progress (0-100). + "percentCompleted": 0, "result": { - "apiVersion": "str", # API version used to create this document - classifier. Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when - the document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file - within the container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name - prefix. + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + }, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "documentModelBuild": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentModelBuild", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "buildMode": "str", + "classifierId": "str", + "description": "str", + "docTypes": { + "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, + "fieldSchema": { + "str": { + "type": "str", + "description": "str", + "example": "str", + "items": ..., + "properties": { + "str": ... + } + } }, - "sourceKind": "str" # Optional. Type of training - data source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of - which the classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and - time (UTC) when the document classifier will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", + "tags": { + "str": "str" + }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of - warning codes. Required. - "message": "str", # A human-readable representation - of the warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] }, "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # JSON input template for discriminator value "documentModelCompose": operation_details = { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - operation was created. Required. + "createdDateTime": "2020-02-20 00:00:00", "kind": "documentModelCompose", - "lastUpdatedDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - status was last updated. Required. - "operationId": "str", # Operation ID. Required. - "resourceLocation": "str", # URL of the resource targeted by this operation. - Required. - "status": "str", # Operation status. notStarted, running, completed, or - failed. Required. Known values are: "notStarted", "running", "failed", - "succeeded", "completed", and "canceled". - "apiVersion": "str", # Optional. API version used to create this operation. + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", "error": { - "code": "str", # One of a server-defined set of error codes. - Required. - "message": "str", # A human-readable representation of the error. - Required. + "code": "str", + "message": "str", "details": [ ... ], "innererror": { - "code": "str", # Optional. One of a server-defined set of - error codes. + "code": "str", "innererror": ..., - "message": "str" # Optional. A human-readable representation - of the error. + "message": "str" }, - "target": "str" # Optional. The target of the error. + "target": "str" }, - "percentCompleted": 0, # Optional. Operation progress (0-100). + "percentCompleted": 0, "result": { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when - the document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this - document model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. - Known values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type - of the field value. Required. Known values are: "string", - "date", "time", "phoneNumber", "number", "integer", - "selectionMark", "countryRegion", "signature", "array", - "object", "currency", "address", "boolean", and - "selectionGroup". - "description": "str", # Optional. - Field description. - "example": "str", # Optional. - Example field content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document - model build mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence - for each field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and - time (UTC) when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes - associated with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of - warning codes. Required. - "message": "str", # A human-readable representation - of the warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] }, "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # JSON input template for discriminator value "documentModelCopyTo": operation_details = { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - operation was created. Required. + "createdDateTime": "2020-02-20 00:00:00", "kind": "documentModelCopyTo", - "lastUpdatedDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - status was last updated. Required. - "operationId": "str", # Operation ID. Required. - "resourceLocation": "str", # URL of the resource targeted by this operation. - Required. - "status": "str", # Operation status. notStarted, running, completed, or - failed. Required. Known values are: "notStarted", "running", "failed", - "succeeded", "completed", and "canceled". - "apiVersion": "str", # Optional. API version used to create this operation. + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", "error": { - "code": "str", # One of a server-defined set of error codes. - Required. - "message": "str", # A human-readable representation of the error. - Required. + "code": "str", + "message": "str", "details": [ ... ], "innererror": { - "code": "str", # Optional. One of a server-defined set of - error codes. + "code": "str", "innererror": ..., - "message": "str" # Optional. A human-readable representation - of the error. + "message": "str" }, - "target": "str" # Optional. The target of the error. + "target": "str" }, - "percentCompleted": 0, # Optional. Operation progress (0-100). + "percentCompleted": 0, "result": { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when - the document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this - document model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. - Known values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type - of the field value. Required. Known values are: "string", - "date", "time", "phoneNumber", "number", "integer", - "selectionMark", "countryRegion", "signature", "array", - "object", "currency", "address", "boolean", and - "selectionGroup". - "description": "str", # Optional. - Field description. - "example": "str", # Optional. - Example field content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document - model build mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence - for each field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and - time (UTC) when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes - associated with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of - warning codes. Required. - "message": "str", # A human-readable representation - of the warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] }, "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 200 response == operation_details """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OperationDetails]] = kwargs.pop("cls", None) + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9272,14 +8357,96 @@ def get_operation(self, operation_id: str, **kwargs: Any) -> _models.OperationDe } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + def prepare_request(next_link=None): + if not next_link: + + _request = build_document_intelligence_administration_list_operations_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OperationDetails], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _build_classifier_initial( + self, build_request: Union[_models.BuildDocumentClassifierRequest, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OperationDetails] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_document_intelligence_administration_get_operation_request( - operation_id=operation_id, + content_type = content_type or "application/json" + _content = None + if isinstance(build_request, (IOBase, bytes)): + _content = build_request + else: + _content = json.dumps(build_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_document_intelligence_administration_build_classifier_request( + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -9288,344 +8455,482 @@ def get_operation(self, operation_id: str, **kwargs: Any) -> _models.OperationDe } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: + if response.status_code not in [202]: + try: response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_build_classifier( + self, + build_request: _models.BuildDocumentClassifierRequest, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.DocumentClassifierDetails]: + """Builds a custom document classifier. + + :param build_request: Build request parameters. Required. + :type build_request: ~azure.ai.documentintelligence.models.BuildDocumentClassifierRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DocumentClassifierDetails. The + DocumentClassifierDetails is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.DocumentClassifierDetails] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + build_request = { + "classifierId": "str", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "allowOverwrite": bool, + "baseClassifierId": "str", + "description": "str" + } + + # response body for status code(s): 202 + response == { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + } + """ + + @overload + def begin_build_classifier( + self, build_request: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.DocumentClassifierDetails]: + """Builds a custom document classifier. + + :param build_request: Build request parameters. Required. + :type build_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DocumentClassifierDetails. The + DocumentClassifierDetails is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.DocumentClassifierDetails] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 202 + response == { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + } + """ + + @overload + def begin_build_classifier( + self, build_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.DocumentClassifierDetails]: + """Builds a custom document classifier. - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.OperationDetails, response.json()) + :param build_request: Build request parameters. Required. + :type build_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DocumentClassifierDetails. The + DocumentClassifierDetails is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.DocumentClassifierDetails] + :raises ~azure.core.exceptions.HttpResponseError: - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + Example: + .. code-block:: python - return deserialized # type: ignore + # response body for status code(s): 202 + response == { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + } + """ @distributed_trace - def list_operations(self, **kwargs: Any) -> Iterable["_models.OperationDetails"]: - # pylint: disable=line-too-long - """Lists all operations. + def begin_build_classifier( + self, build_request: Union[_models.BuildDocumentClassifierRequest, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.DocumentClassifierDetails]: + """Builds a custom document classifier. - :return: An iterator like instance of OperationDetails - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.documentintelligence.models.OperationDetails] + :param build_request: Build request parameters. Is one of the following types: + BuildDocumentClassifierRequest, JSON, IO[bytes] Required. + :type build_request: ~azure.ai.documentintelligence.models.BuildDocumentClassifierRequest or + JSON or IO[bytes] + :return: An instance of LROPoller that returns DocumentClassifierDetails. The + DocumentClassifierDetails is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.ai.documentintelligence.models.DocumentClassifierDetails] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # The response is polymorphic. The following are possible polymorphic responses based - off discriminator "kind": - - # JSON input template for discriminator value "documentClassifierBuild": - operation_details = { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - operation was created. Required. - "kind": "documentClassifierBuild", - "lastUpdatedDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - status was last updated. Required. - "operationId": "str", # Operation ID. Required. - "resourceLocation": "str", # URL of the resource targeted by this operation. - Required. - "status": "str", # Operation status. notStarted, running, completed, or - failed. Required. Known values are: "notStarted", "running", "failed", - "succeeded", "completed", and "canceled". - "apiVersion": "str", # Optional. API version used to create this operation. - "error": { - "code": "str", # One of a server-defined set of error codes. - Required. - "message": "str", # A human-readable representation of the error. - Required. - "details": [ - ... - ], - "innererror": { - "code": "str", # Optional. One of a server-defined set of - error codes. - "innererror": ..., - "message": "str" # Optional. A human-readable representation - of the error. - }, - "target": "str" # Optional. The target of the error. - }, - "percentCompleted": 0, # Optional. Operation progress (0-100). - "result": { - "apiVersion": "str", # API version used to create this document - classifier. Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when - the document classifier was created. Required. - "docTypes": { - "str": { - "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file - within the container specifying a subset of documents. Required. - }, - "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name - prefix. - }, - "sourceKind": "str" # Optional. Type of training - data source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". - } - }, - "baseClassifierId": "str", # Optional. Base classifierId on top of - which the classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and - time (UTC) when the document classifier will expire. - "warnings": [ - { - "code": "str", # One of a server-defined set of - warning codes. Required. - "message": "str", # A human-readable representation - of the warning. Required. - "target": "str" # Optional. The target of the error. - } - ] + # JSON input template you can fill out and use as your body input. + build_request = { + "classifierId": "str", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } }, - "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. - } + "allowOverwrite": bool, + "baseClassifierId": "str", + "description": "str" } - # JSON input template for discriminator value "documentModelCompose": - operation_details = { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - operation was created. Required. - "kind": "documentModelCompose", - "lastUpdatedDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - status was last updated. Required. - "operationId": "str", # Operation ID. Required. - "resourceLocation": "str", # URL of the resource targeted by this operation. - Required. - "status": "str", # Operation status. notStarted, running, completed, or - failed. Required. Known values are: "notStarted", "running", "failed", - "succeeded", "completed", and "canceled". - "apiVersion": "str", # Optional. API version used to create this operation. - "error": { - "code": "str", # One of a server-defined set of error codes. - Required. - "message": "str", # A human-readable representation of the error. - Required. - "details": [ - ... - ], - "innererror": { - "code": "str", # Optional. One of a server-defined set of - error codes. - "innererror": ..., - "message": "str" # Optional. A human-readable representation - of the error. - }, - "target": "str" # Optional. The target of the error. - }, - "percentCompleted": 0, # Optional. Operation progress (0-100). - "result": { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when - the document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this - document model. - "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. - }, - "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "prefix": "str" # Optional. Blob name prefix. - }, - "buildMode": "str", # Optional. Custom document model build mode. - Known values are: "template" and "neural". - "description": "str", # Optional. Document model description. - "docTypes": { - "str": { - "fieldSchema": { - "str": { - "type": "str", # Semantic data type - of the field value. Required. Known values are: "string", - "date", "time", "phoneNumber", "number", "integer", - "selectionMark", "countryRegion", "signature", "array", - "object", "currency", "address", "boolean", and - "selectionGroup". - "description": "str", # Optional. - Field description. - "example": "str", # Optional. - Example field content. - "items": ..., - "properties": { - "str": ... - } - } - }, - "buildMode": "str", # Optional. Custom document - model build mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence - for each field. - } - } - }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and - time (UTC) when the document model will expire. - "tags": { - "str": "str" # Optional. List of key-value tag attributes - associated with the document model. - }, - "warnings": [ - { - "code": "str", # One of a server-defined set of - warning codes. Required. - "message": "str", # A human-readable representation - of the warning. Required. - "target": "str" # Optional. The target of the error. - } - ] + # response body for status code(s): 202 + response == { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } }, - "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. - } + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - # JSON input template for discriminator value "documentModelCopyTo": - operation_details = { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - operation was created. Required. - "kind": "documentModelCopyTo", - "lastUpdatedDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - status was last updated. Required. - "operationId": "str", # Operation ID. Required. - "resourceLocation": "str", # URL of the resource targeted by this operation. - Required. - "status": "str", # Operation status. notStarted, running, completed, or - failed. Required. Known values are: "notStarted", "running", "failed", - "succeeded", "completed", and "canceled". - "apiVersion": "str", # Optional. API version used to create this operation. - "error": { - "code": "str", # One of a server-defined set of error codes. - Required. - "message": "str", # A human-readable representation of the error. - Required. - "details": [ - ... - ], - "innererror": { - "code": "str", # Optional. One of a server-defined set of - error codes. - "innererror": ..., - "message": "str" # Optional. A human-readable representation - of the error. - }, - "target": "str" # Optional. The target of the error. - }, - "percentCompleted": 0, # Optional. Operation progress (0-100). - "result": { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when - the document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this - document model. - "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. - }, - "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "prefix": "str" # Optional. Blob name prefix. - }, - "buildMode": "str", # Optional. Custom document model build mode. - Known values are: "template" and "neural". - "description": "str", # Optional. Document model description. - "docTypes": { - "str": { - "fieldSchema": { - "str": { - "type": "str", # Semantic data type - of the field value. Required. Known values are: "string", - "date", "time", "phoneNumber", "number", "integer", - "selectionMark", "countryRegion", "signature", "array", - "object", "currency", "address", "boolean", and - "selectionGroup". - "description": "str", # Optional. - Field description. - "example": "str", # Optional. - Example field content. - "items": ..., - "properties": { - "str": ... - } - } - }, - "buildMode": "str", # Optional. Custom document - model build mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence - for each field. - } - } - }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and - time (UTC) when the document model will expire. - "tags": { - "str": "str" # Optional. List of key-value tag attributes - associated with the document model. - }, - "warnings": [ - { - "code": "str", # One of a server-defined set of - warning codes. Required. - "message": "str", # A human-readable representation - of the warning. Required. - "target": "str" # Optional. The target of the error. - } - ] - }, + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DocumentClassifierDetails] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._build_classifier_initial( + build_request=build_request, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs, + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result")) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DocumentClassifierDetails].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DocumentClassifierDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def authorize_classifier_copy( + self, + authorize_copy_request: _models.AuthorizeClassifierCopyRequest, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.ClassifierCopyAuthorization: + """Generates authorization to copy a document classifier to this location with + specified classifierId and optional description. + + :param authorize_copy_request: Authorize copy request parameters. Required. + :type authorize_copy_request: + ~azure.ai.documentintelligence.models.AuthorizeClassifierCopyRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ClassifierCopyAuthorization. The ClassifierCopyAuthorization is compatible with + MutableMapping + :rtype: ~azure.ai.documentintelligence.models.ClassifierCopyAuthorization + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + authorize_copy_request = { + "classifierId": "str", + "description": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 200 - response == operation_details + response == { + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetClassifierId": "str", + "targetClassifierLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" + } """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.OperationDetails]] = kwargs.pop("cls", None) + @overload + def authorize_classifier_copy( + self, authorize_copy_request: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ClassifierCopyAuthorization: + """Generates authorization to copy a document classifier to this location with + specified classifierId and optional description. + + :param authorize_copy_request: Authorize copy request parameters. Required. + :type authorize_copy_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ClassifierCopyAuthorization. The ClassifierCopyAuthorization is compatible with + MutableMapping + :rtype: ~azure.ai.documentintelligence.models.ClassifierCopyAuthorization + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetClassifierId": "str", + "targetClassifierLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" + } + """ + + @overload + def authorize_classifier_copy( + self, authorize_copy_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ClassifierCopyAuthorization: + """Generates authorization to copy a document classifier to this location with + specified classifierId and optional description. + + :param authorize_copy_request: Authorize copy request parameters. Required. + :type authorize_copy_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ClassifierCopyAuthorization. The ClassifierCopyAuthorization is compatible with + MutableMapping + :rtype: ~azure.ai.documentintelligence.models.ClassifierCopyAuthorization + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetClassifierId": "str", + "targetClassifierLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" + } + """ + + @distributed_trace + def authorize_classifier_copy( + self, authorize_copy_request: Union[_models.AuthorizeClassifierCopyRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.ClassifierCopyAuthorization: + """Generates authorization to copy a document classifier to this location with + specified classifierId and optional description. + + :param authorize_copy_request: Authorize copy request parameters. Is one of the following + types: AuthorizeClassifierCopyRequest, JSON, IO[bytes] Required. + :type authorize_copy_request: + ~azure.ai.documentintelligence.models.AuthorizeClassifierCopyRequest or JSON or IO[bytes] + :return: ClassifierCopyAuthorization. The ClassifierCopyAuthorization is compatible with + MutableMapping + :rtype: ~azure.ai.documentintelligence.models.ClassifierCopyAuthorization + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + authorize_copy_request = { + "classifierId": "str", + "description": "str", + "tags": { + "str": "str" + } + } + # response body for status code(s): 200 + response == { + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetClassifierId": "str", + "targetClassifierLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" + } + """ error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9634,73 +8939,64 @@ def list_operations(self, **kwargs: Any) -> Iterable["_models.OperationDetails"] } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_document_intelligence_administration_list_operations_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClassifierCopyAuthorization] = kwargs.pop("cls", None) - return _request + content_type = content_type or "application/json" + _content = None + if isinstance(authorize_copy_request, (IOBase, bytes)): + _content = authorize_copy_request + else: + _content = json.dumps(authorize_copy_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.OperationDetails], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _request = build_document_intelligence_administration_authorize_classifier_copy_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def get_next(next_link=None): - _request = prepare_request(next_link) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: + if response.status_code not in [200]: + if _stream: + try: response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error) + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) - return pipeline_response + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ClassifierCopyAuthorization, response.json()) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def _build_classifier_initial( # pylint: disable=inconsistent-return-statements - self, build_request: Union[_models.BuildDocumentClassifierRequest, JSON, IO[bytes]], **kwargs: Any - ) -> None: + return deserialized # type: ignore + + def _copy_classifier_to_initial( + self, + classifier_id: str, + copy_to_request: Union[_models.ClassifierCopyAuthorization, JSON, IO[bytes]], + **kwargs: Any, + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9713,16 +9009,17 @@ def _build_classifier_initial( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(build_request, (IOBase, bytes)): - _content = build_request + if isinstance(copy_to_request, (IOBase, bytes)): + _content = copy_to_request else: - _content = json.dumps(build_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(copy_to_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_document_intelligence_administration_build_classifier_request( + _request = build_document_intelligence_administration_copy_classifier_to_request( + classifier_id=classifier_id, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -9734,7 +9031,7 @@ def _build_classifier_initial( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9742,8 +9039,10 @@ def _build_classifier_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: - if _stream: + try: response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -9752,22 +9051,28 @@ def _build_classifier_initial( # pylint: disable=inconsistent-return-statements response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - def begin_build_classifier( + def begin_copy_classifier_to( self, - build_request: _models.BuildDocumentClassifierRequest, + classifier_id: str, + copy_to_request: _models.ClassifierCopyAuthorization, *, content_type: str = "application/json", **kwargs: Any, ) -> LROPoller[_models.DocumentClassifierDetails]: - # pylint: disable=line-too-long - """Builds a custom document classifier. + """Copies document classifier to the target resource, region, and classifierId. - :param build_request: Build request parameters. Required. - :type build_request: ~azure.ai.documentintelligence.models.BuildDocumentClassifierRequest + :param classifier_id: Unique document classifier name. Required. + :type classifier_id: str + :param copy_to_request: Copy to request parameters. Required. + :type copy_to_request: ~azure.ai.documentintelligence.models.ClassifierCopyAuthorization :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9781,82 +9086,56 @@ def begin_build_classifier( .. code-block:: python # JSON input template you can fill out and use as your body input. - build_request = { - "classifierId": "str", # Unique document classifier name. Required. - "docTypes": { - "str": { - "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. - }, - "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. - }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". - } - }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which to - train the classifier. - "description": "str" # Optional. Document classifier description. + copy_to_request = { + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetClassifierId": "str", + "targetClassifierLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to create this document classifier. - Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "sourceKind": "str" } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which the - classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document classifier will expire. + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } """ @overload - def begin_build_classifier( - self, build_request: JSON, *, content_type: str = "application/json", **kwargs: Any + def begin_copy_classifier_to( + self, classifier_id: str, copy_to_request: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DocumentClassifierDetails]: - # pylint: disable=line-too-long - """Builds a custom document classifier. + """Copies document classifier to the target resource, region, and classifierId. - :param build_request: Build request parameters. Required. - :type build_request: JSON + :param classifier_id: Unique document classifier name. Required. + :type classifier_id: str + :param copy_to_request: Copy to request parameters. Required. + :type copy_to_request: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9871,55 +9150,45 @@ def begin_build_classifier( # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to create this document classifier. - Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "sourceKind": "str" } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which the - classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document classifier will expire. + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } """ @overload - def begin_build_classifier( - self, build_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + def begin_copy_classifier_to( + self, classifier_id: str, copy_to_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DocumentClassifierDetails]: - # pylint: disable=line-too-long - """Builds a custom document classifier. + """Copies document classifier to the target resource, region, and classifierId. - :param build_request: Build request parameters. Required. - :type build_request: IO[bytes] + :param classifier_id: Unique document classifier name. Required. + :type classifier_id: str + :param copy_to_request: Copy to request parameters. Required. + :type copy_to_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -9934,56 +9203,49 @@ def begin_build_classifier( # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to create this document classifier. - Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "sourceKind": "str" } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which the - classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document classifier will expire. + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } """ @distributed_trace - def begin_build_classifier( - self, build_request: Union[_models.BuildDocumentClassifierRequest, JSON, IO[bytes]], **kwargs: Any + def begin_copy_classifier_to( + self, + classifier_id: str, + copy_to_request: Union[_models.ClassifierCopyAuthorization, JSON, IO[bytes]], + **kwargs: Any, ) -> LROPoller[_models.DocumentClassifierDetails]: - # pylint: disable=line-too-long - """Builds a custom document classifier. + """Copies document classifier to the target resource, region, and classifierId. - :param build_request: Build request parameters. Is one of the following types: - BuildDocumentClassifierRequest, JSON, IO[bytes] Required. - :type build_request: ~azure.ai.documentintelligence.models.BuildDocumentClassifierRequest or + :param classifier_id: Unique document classifier name. Required. + :type classifier_id: str + :param copy_to_request: Copy to request parameters. Is one of the following types: + ClassifierCopyAuthorization, JSON, IO[bytes] Required. + :type copy_to_request: ~azure.ai.documentintelligence.models.ClassifierCopyAuthorization or JSON or IO[bytes] :return: An instance of LROPoller that returns DocumentClassifierDetails. The DocumentClassifierDetails is compatible with MutableMapping @@ -9995,68 +9257,41 @@ def begin_build_classifier( .. code-block:: python # JSON input template you can fill out and use as your body input. - build_request = { - "classifierId": "str", # Unique document classifier name. Required. - "docTypes": { - "str": { - "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. - }, - "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. - }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". - } - }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which to - train the classifier. - "description": "str" # Optional. Document classifier description. + copy_to_request = { + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetClassifierId": "str", + "targetClassifierLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to create this document classifier. - Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "sourceKind": "str" } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which the - classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document classifier will expire. + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -10070,14 +9305,16 @@ def begin_build_classifier( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._build_classifier_initial( # type: ignore - build_request=build_request, + raw_result = self._copy_classifier_to_initial( + classifier_id=classifier_id, + copy_to_request=copy_to_request, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs, ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -10118,7 +9355,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_classifier(self, classifier_id: str, **kwargs: Any) -> _models.DocumentClassifierDetails: - # pylint: disable=line-too-long """Gets detailed document classifier information. :param classifier_id: Unique document classifier name. Required. @@ -10133,41 +9369,30 @@ def get_classifier(self, classifier_id: str, **kwargs: Any) -> _models.DocumentC # response body for status code(s): 200 response == { - "apiVersion": "str", # API version used to create this document classifier. - Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "sourceKind": "str" } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which the - classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document classifier will expire. + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -10205,7 +9430,10 @@ def get_classifier(self, classifier_id: str, **kwargs: Any) -> _models.DocumentC if response.status_code not in [200]: if _stream: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -10227,7 +9455,6 @@ def get_classifier(self, classifier_id: str, **kwargs: Any) -> _models.DocumentC @distributed_trace def list_classifiers(self, **kwargs: Any) -> Iterable["_models.DocumentClassifierDetails"]: - # pylint: disable=line-too-long """List all document classifiers. :return: An iterator like instance of DocumentClassifierDetails @@ -10240,41 +9467,30 @@ def list_classifiers(self, **kwargs: Any) -> Iterable["_models.DocumentClassifie # response body for status code(s): 200 response == { - "apiVersion": "str", # API version used to create this document classifier. - Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "sourceKind": "str" } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which the - classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document classifier will expire. + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -10346,8 +9562,6 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -10400,8 +9614,6 @@ def delete_classifier( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_patch.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_patch.py index b4a2449c14b7d..9a54ac213a85f 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_patch.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_patch.py @@ -26,7 +26,7 @@ class DocumentIntelligenceClient(DIClientGenerated): # pylint: disable=client-a :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-02-29-preview". Note that overriding this default value may result in unsupported + "2024-07-31-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -61,7 +61,7 @@ class DocumentIntelligenceAdministrationClient( :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-02-29-preview". Note that overriding this default value may result in unsupported + "2024-07-31-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_serialization.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_serialization.py index 2f781d740827a..8139854b97bb8 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_serialization.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_serialization.py @@ -144,6 +144,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -1441,7 +1443,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_client.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_client.py index dbcd5b6a05d86..a6f494c9d4533 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_client.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING, Union +from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -36,12 +37,12 @@ class DocumentIntelligenceClient( :param endpoint: The Document Intelligence service endpoint. Required. :type endpoint: str - :param credential: Credential needed for the client to connect to Azure. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-02-29-preview". Note that overriding this default value may result in unsupported + "2024-07-31-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -107,7 +108,7 @@ def send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "DocumentIntelligenceClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self @@ -122,12 +123,12 @@ class DocumentIntelligenceAdministrationClient( :param endpoint: The Document Intelligence service endpoint. Required. :type endpoint: str - :param credential: Credential needed for the client to connect to Azure. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-02-29-preview". Note that overriding this default value may result in unsupported + "2024-07-31-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -195,7 +196,7 @@ def send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "DocumentIntelligenceAdministrationClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_configuration.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_configuration.py index 2692188c79664..d3b2e4208e9f2 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_configuration.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_configuration.py @@ -26,12 +26,12 @@ class DocumentIntelligenceClientConfiguration: # pylint: disable=too-many-insta :param endpoint: The Document Intelligence service endpoint. Required. :type endpoint: str - :param credential: Credential needed for the client to connect to Azure. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-02-29-preview". Note that overriding this default value may result in unsupported + "2024-07-31-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -39,7 +39,7 @@ class DocumentIntelligenceClientConfiguration: # pylint: disable=too-many-insta def __init__( self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2024-02-29-preview") + api_version: str = kwargs.pop("api_version", "2024-07-31-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -83,12 +83,12 @@ class DocumentIntelligenceAdministrationClientConfiguration: # pylint: disable= :param endpoint: The Document Intelligence service endpoint. Required. :type endpoint: str - :param credential: Credential needed for the client to connect to Azure. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-02-29-preview". Note that overriding this default value may result in unsupported + "2024-07-31-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -96,7 +96,7 @@ class DocumentIntelligenceAdministrationClientConfiguration: # pylint: disable= def __init__( self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2024-02-29-preview") + api_version: str = kwargs.pop("api_version", "2024-07-31-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_operations/_operations.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_operations/_operations.py index ab2c442d9c9be..4b4d21d322a68 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_operations/_operations.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_operations/_operations.py @@ -9,7 +9,21 @@ from io import IOBase import json import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -32,10 +48,12 @@ from ... import models as _models from ..._model_base import SdkJSONEncoder, _deserialize from ..._operations._operations import ( + build_document_intelligence_administration_authorize_classifier_copy_request, build_document_intelligence_administration_authorize_model_copy_request, build_document_intelligence_administration_build_classifier_request, build_document_intelligence_administration_build_document_model_request, build_document_intelligence_administration_compose_model_request, + build_document_intelligence_administration_copy_classifier_to_request, build_document_intelligence_administration_copy_model_to_request, build_document_intelligence_administration_delete_classifier_request, build_document_intelligence_administration_delete_model_request, @@ -46,8 +64,11 @@ build_document_intelligence_administration_list_classifiers_request, build_document_intelligence_administration_list_models_request, build_document_intelligence_administration_list_operations_request, + build_document_intelligence_analyze_batch_documents_request, build_document_intelligence_analyze_document_request, build_document_intelligence_classify_document_request, + build_document_intelligence_get_analyze_result_figure_request, + build_document_intelligence_get_analyze_result_pdf_request, ) from .._vendor import DocumentIntelligenceAdministrationClientMixinABC, DocumentIntelligenceClientMixinABC @@ -61,7 +82,8 @@ class DocumentIntelligenceClientOperationsMixin(DocumentIntelligenceClientMixinABC): # pylint: disable=name-too-long - async def _analyze_document_initial( # pylint: disable=inconsistent-return-statements + + async def _analyze_document_initial( self, model_id: str, analyze_request: Optional[Union[_models.AnalyzeDocumentRequest, JSON, IO[bytes]]] = None, @@ -72,8 +94,9 @@ async def _analyze_document_initial( # pylint: disable=inconsistent-return-stat features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, query_fields: Optional[List[str]] = None, output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -86,7 +109,7 @@ async def _analyze_document_initial( # pylint: disable=inconsistent-return-stat _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -106,6 +129,7 @@ async def _analyze_document_initial( # pylint: disable=inconsistent-return-stat features=features, query_fields=query_fields, output_content_format=output_content_format, + output=output, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -117,7 +141,7 @@ async def _analyze_document_initial( # pylint: disable=inconsistent-return-stat } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -125,8 +149,10 @@ async def _analyze_document_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [202]: - if _stream: + try: await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -135,8 +161,12 @@ async def _analyze_document_initial( # pylint: disable=inconsistent-return-stat response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_analyze_document( @@ -150,17 +180,17 @@ async def begin_analyze_document( features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, query_fields: Optional[List[str]] = None, output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Analyzes document with document model. :param model_id: Unique document model name. Required. :type model_id: str :param analyze_request: Analyze request parameters. Default value is None. :type analyze_request: ~azure.ai.documentintelligence.models.AnalyzeDocumentRequest - :keyword pages: List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is None. :paramtype pages: str :keyword locale: Locale hint for text recognition and document analysis. Value may contain @@ -179,6 +209,8 @@ async def begin_analyze_document( :keyword output_content_format: Format of the analyze result top-level content. Known values are: "text" and "markdown". Default value is None. :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -192,292 +224,177 @@ async def begin_analyze_document( # JSON input template you can fill out and use as your body input. analyze_request = { - "base64Source": bytes("bytes", encoding="utf-8"), # Optional. Base64 - encoding of the document to analyze. Either urlSource or base64Source must be - specified. - "urlSource": "str" # Optional. Document URL to analyze. Either urlSource or - base64Source must be specified. + "base64Source": bytes("bytes", encoding="utf-8"), + "urlSource": "str" } # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -486,149 +403,99 @@ async def begin_analyze_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -637,281 +504,161 @@ async def begin_analyze_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -928,17 +675,17 @@ async def begin_analyze_document( features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, query_fields: Optional[List[str]] = None, output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Analyzes document with document model. :param model_id: Unique document model name. Required. :type model_id: str :param analyze_request: Analyze request parameters. Default value is None. :type analyze_request: JSON - :keyword pages: List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is None. :paramtype pages: str :keyword locale: Locale hint for text recognition and document analysis. Value may contain @@ -957,6 +704,8 @@ async def begin_analyze_document( :keyword output_content_format: Format of the analyze result top-level content. Known values are: "text" and "markdown". Default value is None. :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -970,283 +719,171 @@ async def begin_analyze_document( # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -1255,149 +892,99 @@ async def begin_analyze_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -1406,281 +993,161 @@ async def begin_analyze_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -1697,17 +1164,17 @@ async def begin_analyze_document( features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, query_fields: Optional[List[str]] = None, output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Analyzes document with document model. :param model_id: Unique document model name. Required. :type model_id: str :param analyze_request: Analyze request parameters. Default value is None. :type analyze_request: IO[bytes] - :keyword pages: List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is None. :paramtype pages: str :keyword locale: Locale hint for text recognition and document analysis. Value may contain @@ -1726,6 +1193,8 @@ async def begin_analyze_document( :keyword output_content_format: Format of the analyze result top-level content. Known values are: "text" and "markdown". Default value is None. :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -1739,283 +1208,171 @@ async def begin_analyze_document( # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -2024,149 +1381,99 @@ async def begin_analyze_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -2175,281 +1482,161 @@ async def begin_analyze_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -2466,9 +1653,9 @@ async def begin_analyze_document( features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, query_fields: Optional[List[str]] = None, output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, **kwargs: Any ) -> AsyncLROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Analyzes document with document model. :param model_id: Unique document model name. Required. @@ -2477,7 +1664,7 @@ async def begin_analyze_document( AnalyzeDocumentRequest, JSON, IO[bytes] Default value is None. :type analyze_request: ~azure.ai.documentintelligence.models.AnalyzeDocumentRequest or JSON or IO[bytes] - :keyword pages: List of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is None. :paramtype pages: str :keyword locale: Locale hint for text recognition and document analysis. Value may contain @@ -2496,6 +1683,8 @@ async def begin_analyze_document( :keyword output_content_format: Format of the analyze result top-level content. Known values are: "text" and "markdown". Default value is None. :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] :return: An instance of AsyncLROPoller that returns AnalyzeResult. The AnalyzeResult is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.ai.documentintelligence.models.AnalyzeResult] @@ -2506,292 +1695,177 @@ async def begin_analyze_document( # JSON input template you can fill out and use as your body input. analyze_request = { - "base64Source": bytes("bytes", encoding="utf-8"), # Optional. Base64 - encoding of the document to analyze. Either urlSource or base64Source must be - specified. - "urlSource": "str" # Optional. Document URL to analyze. Either urlSource or - base64Source must be specified. + "base64Source": bytes("bytes", encoding="utf-8"), + "urlSource": "str" } # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -2800,149 +1874,99 @@ async def begin_analyze_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -2951,281 +1975,161 @@ async def begin_analyze_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -3238,7 +2142,7 @@ async def begin_analyze_document( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._analyze_document_initial( # type: ignore + raw_result = await self._analyze_document_initial( model_id=model_id, analyze_request=analyze_request, pages=pages, @@ -3247,12 +2151,14 @@ async def begin_analyze_document( features=features, query_fields=query_fields, output_content_format=output_content_format, + output=output, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -3292,15 +2198,20 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _classify_document_initial( # pylint: disable=inconsistent-return-statements + async def _analyze_batch_documents_initial( self, - classifier_id: str, - classify_request: Union[_models.ClassifyDocumentRequest, JSON, IO[bytes]], + model_id: str, + analyze_batch_request: Optional[Union[_models.AnalyzeBatchDocumentsRequest, JSON, IO[bytes]]] = None, *, + pages: Optional[str] = None, + locale: Optional[str] = None, string_index_type: Optional[Union[str, _models.StringIndexType]] = None, - split: Optional[Union[str, _models.SplitMode]] = None, + features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, + query_fields: Optional[List[str]] = None, + output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3313,19 +2224,27 @@ async def _classify_document_initial( # pylint: disable=inconsistent-return-sta _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(classify_request, (IOBase, bytes)): - _content = classify_request + if isinstance(analyze_batch_request, (IOBase, bytes)): + _content = analyze_batch_request else: - _content = json.dumps(classify_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + if analyze_batch_request is not None: + _content = json.dumps(analyze_batch_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None - _request = build_document_intelligence_classify_document_request( - classifier_id=classifier_id, + _request = build_document_intelligence_analyze_batch_documents_request( + model_id=model_id, + pages=pages, + locale=locale, string_index_type=string_index_type, - split=split, + features=features, + query_fields=query_fields, + output_content_format=output_content_format, + output=output, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -3337,7 +2256,7 @@ async def _classify_document_initial( # pylint: disable=inconsistent-return-sta } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3345,8 +2264,10 @@ async def _classify_document_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [202]: - if _stream: + try: await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -3355,332 +2276,855 @@ async def _classify_document_initial( # pylint: disable=inconsistent-return-sta response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - async def begin_classify_document( + async def begin_analyze_batch_documents( self, - classifier_id: str, - classify_request: _models.ClassifyDocumentRequest, + model_id: str, + analyze_batch_request: Optional[_models.AnalyzeBatchDocumentsRequest] = None, *, + pages: Optional[str] = None, + locale: Optional[str] = None, string_index_type: Optional[Union[str, _models.StringIndexType]] = None, - split: Optional[Union[str, _models.SplitMode]] = None, + features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, + query_fields: Optional[List[str]] = None, + output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long - """Classifies document with document classifier. + ) -> AsyncLROPoller[_models.AnalyzeBatchResult]: + """Analyzes batch documents with document model. - :param classifier_id: Unique document classifier name. Required. - :type classifier_id: str - :param classify_request: Classify request parameters. Required. - :type classify_request: ~azure.ai.documentintelligence.models.ClassifyDocumentRequest + :param model_id: Unique document model name. Required. + :type model_id: str + :param analyze_batch_request: Analyze batch request parameters. Default value is None. + :type analyze_batch_request: ~azure.ai.documentintelligence.models.AnalyzeBatchDocumentsRequest + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str + :keyword locale: Locale hint for text recognition and document analysis. Value may contain + only + the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). Default value is + None. + :paramtype locale: str :keyword string_index_type: Method used to compute string offset and length. Known values are: "textElements", "unicodeCodePoint", and "utf16CodeUnit". Default value is None. :paramtype string_index_type: str or ~azure.ai.documentintelligence.models.StringIndexType - :keyword split: Document splitting mode. Known values are: "auto", "none", and "perPage". + :keyword features: List of optional analysis features. Default value is None. + :paramtype features: list[str or ~azure.ai.documentintelligence.models.DocumentAnalysisFeature] + :keyword query_fields: List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". Default value is None. - :paramtype split: str or ~azure.ai.documentintelligence.models.SplitMode + :paramtype query_fields: list[str] + :keyword output_content_format: Format of the analyze result top-level content. Known values + are: "text" and "markdown". Default value is None. + :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns AnalyzeResult. The AnalyzeResult is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.ai.documentintelligence.models.AnalyzeResult] + :return: An instance of AsyncLROPoller that returns AnalyzeBatchResult. The AnalyzeBatchResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.ai.documentintelligence.models.AnalyzeBatchResult] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - classify_request = { - "base64Source": bytes("bytes", encoding="utf-8"), # Optional. Base64 - encoding of the document to classify. Either urlSource or base64Source must be - specified. - "urlSource": "str" # Optional. Document URL to classify. Either urlSource - or base64Source must be specified. + analyze_batch_request = { + "resultContainerUrl": "str", + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "overwriteExisting": bool, + "resultPrefix": "str" } # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. - "pages": [ + "details": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. - "barcodes": [ - { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". - "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - }, - "value": "str", # Barcode value. Required. - "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. - ] - } - ], - "formulas": [ - { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". - "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - }, - "value": "str", # LaTex expression - describing the formula. Required. - "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. - ] - } - ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. - "lines": [ - { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. - ] - } - ], - "selectionMarks": [ - { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. - "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". - "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. - ] - } - ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. - "words": [ - { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. - "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. - }, - "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. - ] - } - ] + "sourceUrl": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "resultUrl": "str" } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "failedCount": 0, + "skippedCount": 0, + "succeededCount": 0 + } + """ + + @overload + async def begin_analyze_batch_documents( + self, + model_id: str, + analyze_batch_request: Optional[JSON] = None, + *, + pages: Optional[str] = None, + locale: Optional[str] = None, + string_index_type: Optional[Union[str, _models.StringIndexType]] = None, + features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, + query_fields: Optional[List[str]] = None, + output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AnalyzeBatchResult]: + """Analyzes batch documents with document model. + + :param model_id: Unique document model name. Required. + :type model_id: str + :param analyze_batch_request: Analyze batch request parameters. Default value is None. + :type analyze_batch_request: JSON + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str + :keyword locale: Locale hint for text recognition and document analysis. Value may contain + only + the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). Default value is + None. + :paramtype locale: str + :keyword string_index_type: Method used to compute string offset and length. Known values are: + "textElements", "unicodeCodePoint", and "utf16CodeUnit". Default value is None. + :paramtype string_index_type: str or ~azure.ai.documentintelligence.models.StringIndexType + :keyword features: List of optional analysis features. Default value is None. + :paramtype features: list[str or ~azure.ai.documentintelligence.models.DocumentAnalysisFeature] + :keyword query_fields: List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". + Default value is None. + :paramtype query_fields: list[str] + :keyword output_content_format: Format of the analyze result top-level content. Known values + are: "text" and "markdown". Default value is None. + :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AnalyzeBatchResult. The AnalyzeBatchResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.ai.documentintelligence.models.AnalyzeBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 202 + response == { + "details": [ + { + "sourceUrl": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "resultUrl": "str" + } + ], + "failedCount": 0, + "skippedCount": 0, + "succeededCount": 0 + } + """ + + @overload + async def begin_analyze_batch_documents( + self, + model_id: str, + analyze_batch_request: Optional[IO[bytes]] = None, + *, + pages: Optional[str] = None, + locale: Optional[str] = None, + string_index_type: Optional[Union[str, _models.StringIndexType]] = None, + features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, + query_fields: Optional[List[str]] = None, + output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AnalyzeBatchResult]: + """Analyzes batch documents with document model. + + :param model_id: Unique document model name. Required. + :type model_id: str + :param analyze_batch_request: Analyze batch request parameters. Default value is None. + :type analyze_batch_request: IO[bytes] + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str + :keyword locale: Locale hint for text recognition and document analysis. Value may contain + only + the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). Default value is + None. + :paramtype locale: str + :keyword string_index_type: Method used to compute string offset and length. Known values are: + "textElements", "unicodeCodePoint", and "utf16CodeUnit". Default value is None. + :paramtype string_index_type: str or ~azure.ai.documentintelligence.models.StringIndexType + :keyword features: List of optional analysis features. Default value is None. + :paramtype features: list[str or ~azure.ai.documentintelligence.models.DocumentAnalysisFeature] + :keyword query_fields: List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". + Default value is None. + :paramtype query_fields: list[str] + :keyword output_content_format: Format of the analyze result top-level content. Known values + are: "text" and "markdown". Default value is None. + :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AnalyzeBatchResult. The AnalyzeBatchResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.ai.documentintelligence.models.AnalyzeBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 202 + response == { + "details": [ + { + "sourceUrl": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "resultUrl": "str" + } + ], + "failedCount": 0, + "skippedCount": 0, + "succeededCount": 0 + } + """ + + @distributed_trace_async + async def begin_analyze_batch_documents( + self, + model_id: str, + analyze_batch_request: Optional[Union[_models.AnalyzeBatchDocumentsRequest, JSON, IO[bytes]]] = None, + *, + pages: Optional[str] = None, + locale: Optional[str] = None, + string_index_type: Optional[Union[str, _models.StringIndexType]] = None, + features: Optional[List[Union[str, _models.DocumentAnalysisFeature]]] = None, + query_fields: Optional[List[str]] = None, + output_content_format: Optional[Union[str, _models.ContentFormat]] = None, + output: Optional[List[Union[str, _models.AnalyzeOutputOption]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AnalyzeBatchResult]: + """Analyzes batch documents with document model. + + :param model_id: Unique document model name. Required. + :type model_id: str + :param analyze_batch_request: Analyze batch request parameters. Is one of the following types: + AnalyzeBatchDocumentsRequest, JSON, IO[bytes] Default value is None. + :type analyze_batch_request: ~azure.ai.documentintelligence.models.AnalyzeBatchDocumentsRequest + or JSON or IO[bytes] + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str + :keyword locale: Locale hint for text recognition and document analysis. Value may contain + only + the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). Default value is + None. + :paramtype locale: str + :keyword string_index_type: Method used to compute string offset and length. Known values are: + "textElements", "unicodeCodePoint", and "utf16CodeUnit". Default value is None. + :paramtype string_index_type: str or ~azure.ai.documentintelligence.models.StringIndexType + :keyword features: List of optional analysis features. Default value is None. + :paramtype features: list[str or ~azure.ai.documentintelligence.models.DocumentAnalysisFeature] + :keyword query_fields: List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". + Default value is None. + :paramtype query_fields: list[str] + :keyword output_content_format: Format of the analyze result top-level content. Known values + are: "text" and "markdown". Default value is None. + :paramtype output_content_format: str or ~azure.ai.documentintelligence.models.ContentFormat + :keyword output: Additional outputs to generate during analysis. Default value is None. + :paramtype output: list[str or ~azure.ai.documentintelligence.models.AnalyzeOutputOption] + :return: An instance of AsyncLROPoller that returns AnalyzeBatchResult. The AnalyzeBatchResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.ai.documentintelligence.models.AnalyzeBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + analyze_batch_request = { + "resultContainerUrl": "str", + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "overwriteExisting": bool, + "resultPrefix": "str" + } + + # response body for status code(s): 202 + response == { + "details": [ + { + "sourceUrl": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "resultUrl": "str" + } + ], + "failedCount": 0, + "skippedCount": 0, + "succeededCount": 0 + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) + cls: ClsType[_models.AnalyzeBatchResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._analyze_batch_documents_initial( + model_id=model_id, + analyze_batch_request=analyze_batch_request, + pages=pages, + locale=locale, + string_index_type=string_index_type, + features=features, + query_fields=query_fields, + output_content_format=output_content_format, + output=output, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = _deserialize(_models.AnalyzeBatchResult, response.json().get("result")) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AnalyzeBatchResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AnalyzeBatchResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get_analyze_result_pdf(self, model_id: str, result_id: str, **kwargs: Any) -> AsyncIterator[bytes]: + """Gets the generated searchable PDF output from document analysis. + + :param model_id: Unique document model name. Required. + :type model_id: str + :param result_id: Analyze operation result ID. Required. + :type result_id: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_document_intelligence_get_analyze_result_pdf_request( + model_id=model_id, + result_id=result_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_analyze_result_figure( + self, model_id: str, result_id: str, figure_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + """Gets the generated cropped image of specified figure from document analysis. + + :param model_id: Unique document model name. Required. + :type model_id: str + :param result_id: Analyze operation result ID. Required. + :type result_id: str + :param figure_id: Figure ID. Required. + :type figure_id: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_document_intelligence_get_analyze_result_figure_request( + model_id=model_id, + result_id=result_id, + figure_id=figure_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def _classify_document_initial( + self, + classifier_id: str, + classify_request: Union[_models.ClassifyDocumentRequest, JSON, IO[bytes]], + *, + string_index_type: Optional[Union[str, _models.StringIndexType]] = None, + split: Optional[Union[str, _models.SplitMode]] = None, + pages: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(classify_request, (IOBase, bytes)): + _content = classify_request + else: + _content = json.dumps(classify_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_document_intelligence_classify_document_request( + classifier_id=classifier_id, + string_index_type=string_index_type, + split=split, + pages=pages, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_classify_document( + self, + classifier_id: str, + classify_request: _models.ClassifyDocumentRequest, + *, + string_index_type: Optional[Union[str, _models.StringIndexType]] = None, + split: Optional[Union[str, _models.SplitMode]] = None, + pages: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AnalyzeResult]: + """Classifies document with document classifier. + + :param classifier_id: Unique document classifier name. Required. + :type classifier_id: str + :param classify_request: Classify request parameters. Required. + :type classify_request: ~azure.ai.documentintelligence.models.ClassifyDocumentRequest + :keyword string_index_type: Method used to compute string offset and length. Known values are: + "textElements", "unicodeCodePoint", and "utf16CodeUnit". Default value is None. + :paramtype string_index_type: str or ~azure.ai.documentintelligence.models.StringIndexType + :keyword split: Document splitting mode. Known values are: "auto", "none", and "perPage". + Default value is None. + :paramtype split: str or ~azure.ai.documentintelligence.models.SplitMode + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns AnalyzeResult. The AnalyzeResult is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.ai.documentintelligence.models.AnalyzeResult] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + classify_request = { + "base64Source": bytes("bytes", encoding="utf-8"), + "urlSource": "str" + } + + # response body for status code(s): 202 + response == { + "apiVersion": "str", + "content": "str", + "modelId": "str", + "pages": [ + { + "pageNumber": 0, + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "angle": 0.0, + "barcodes": [ + { + "confidence": 0.0, + "kind": "str", + "span": { + "length": 0, + "offset": 0 + }, + "value": "str", + "polygon": [ + 0.0 + ] + } + ], + "formulas": [ + { + "confidence": 0.0, + "kind": "str", + "span": { + "length": 0, + "offset": 0 + }, + "value": "str", + "polygon": [ + 0.0 + ] + } + ], + "height": 0.0, + "lines": [ + { + "content": "str", + "spans": [ + { + "length": 0, + "offset": 0 + } + ], + "polygon": [ + 0.0 + ] + } + ], + "selectionMarks": [ + { + "confidence": 0.0, + "span": { + "length": 0, + "offset": 0 + }, + "state": "str", + "polygon": [ + 0.0 + ] + } + ], + "unit": "str", + "width": 0.0, + "words": [ + { + "confidence": 0.0, + "content": "str", + "span": { + "length": 0, + "offset": 0 + }, + "polygon": [ + 0.0 + ] + } + ] + } + ], + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -3689,149 +3133,99 @@ async def begin_classify_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -3840,281 +3234,161 @@ async def begin_classify_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -4127,10 +3401,10 @@ async def begin_classify_document( *, string_index_type: Optional[Union[str, _models.StringIndexType]] = None, split: Optional[Union[str, _models.SplitMode]] = None, + pages: Optional[str] = None, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Classifies document with document classifier. :param classifier_id: Unique document classifier name. Required. @@ -4143,6 +3417,9 @@ async def begin_classify_document( :keyword split: Document splitting mode. Known values are: "auto", "none", and "perPage". Default value is None. :paramtype split: str or ~azure.ai.documentintelligence.models.SplitMode + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -4156,283 +3433,171 @@ async def begin_classify_document( # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -4441,149 +3606,99 @@ async def begin_classify_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -4592,281 +3707,161 @@ async def begin_classify_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -4879,10 +3874,10 @@ async def begin_classify_document( *, string_index_type: Optional[Union[str, _models.StringIndexType]] = None, split: Optional[Union[str, _models.SplitMode]] = None, + pages: Optional[str] = None, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Classifies document with document classifier. :param classifier_id: Unique document classifier name. Required. @@ -4895,6 +3890,9 @@ async def begin_classify_document( :keyword split: Document splitting mode. Known values are: "auto", "none", and "perPage". Default value is None. :paramtype split: str or ~azure.ai.documentintelligence.models.SplitMode + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -4908,283 +3906,171 @@ async def begin_classify_document( # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -5193,432 +4079,262 @@ async def begin_classify_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] - } - } - ], - "languages": [ - { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + } + } + ], + "languages": [ + { + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -5631,9 +4347,9 @@ async def begin_classify_document( *, string_index_type: Optional[Union[str, _models.StringIndexType]] = None, split: Optional[Union[str, _models.SplitMode]] = None, + pages: Optional[str] = None, **kwargs: Any ) -> AsyncLROPoller[_models.AnalyzeResult]: - # pylint: disable=line-too-long """Classifies document with document classifier. :param classifier_id: Unique document classifier name. Required. @@ -5648,6 +4364,9 @@ async def begin_classify_document( :keyword split: Document splitting mode. Known values are: "auto", "none", and "perPage". Default value is None. :paramtype split: str or ~azure.ai.documentintelligence.models.SplitMode + :keyword pages: Range of 1-based page numbers to analyze. Ex. "1-3,5,7-9". Default value is + None. + :paramtype pages: str :return: An instance of AsyncLROPoller that returns AnalyzeResult. The AnalyzeResult is compatible with MutableMapping :rtype: ~azure.core.polling.AsyncLROPoller[~azure.ai.documentintelligence.models.AnalyzeResult] @@ -5658,292 +4377,177 @@ async def begin_classify_document( # JSON input template you can fill out and use as your body input. classify_request = { - "base64Source": bytes("bytes", encoding="utf-8"), # Optional. Base64 - encoding of the document to classify. Either urlSource or base64Source must be - specified. - "urlSource": "str" # Optional. Document URL to classify. Either urlSource - or base64Source must be specified. + "base64Source": bytes("bytes", encoding="utf-8"), + "urlSource": "str" } # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to produce this result. Required. - "content": "str", # Concatenate string representation of all textual and - visual elements in reading order. Required. - "modelId": "str", # Document model ID used to produce this result. Required. + "apiVersion": "str", + "content": "str", + "modelId": "str", "pages": [ { - "pageNumber": 0, # 1-based page number in the input - document. Required. + "pageNumber": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], - "angle": 0.0, # Optional. The general orientation of the - content in clockwise direction, measured in degrees between (-180, 180]. + "angle": 0.0, "barcodes": [ { - "confidence": 0.0, # Confidence of correctly - extracting the barcode. Required. - "kind": "str", # Barcode kind. Required. - Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", - "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", - "DataBarExpanded", "ITF", "MicroQRCode", "Aztec", "DataMatrix", - and "MaxiCode". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # Barcode value. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the barcode, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], "formulas": [ { - "confidence": 0.0, # Confidence of correctly - extracting the formula. Required. - "kind": "str", # Formula kind. Required. - Known values are: "inline" and "display". + "confidence": 0.0, + "kind": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "value": "str", # LaTex expression - describing the formula. Required. + "value": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the formula, with coordinates specified relative to the - top-left of the page. The numbers represent the x, y values - of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "height": 0.0, # Optional. The height of the image/PDF in - pixels/inches, respectively. + "height": 0.0, "lines": [ { - "content": "str", # Concatenated content of - the contained elements in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "polygon": [ - 0.0 # Optional. Bounding polygon of - the line, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ], "selectionMarks": [ { - "confidence": 0.0, # Confidence of correctly - extracting the selection mark. Required. + "confidence": 0.0, "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, - "state": "str", # State of the selection - mark. Required. Known values are: "selected" and "unselected". + "state": "str", "polygon": [ - 0.0 # Optional. Bounding polygon of - the selection mark, with coordinates specified relative to - the top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the left (-180 - degrees inclusive) relative to the element orientation. + 0.0 ] } ], - "unit": "str", # Optional. The unit used by the width, - height, and polygon properties. For images, the unit is "pixel". For PDF, - the unit is "inch". Known values are: "pixel" and "inch". - "width": 0.0, # Optional. The width of the image/PDF in - pixels/inches, respectively. + "unit": "str", + "width": 0.0, "words": [ { - "confidence": 0.0, # Confidence of correctly - extracting the word. Required. - "content": "str", # Text content of the - word. Required. + "confidence": 0.0, + "content": "str", "span": { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 }, "polygon": [ - 0.0 # Optional. Bounding polygon of - the word, with coordinates specified relative to the top-left - of the page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. + 0.0 ] } ] } ], - "stringIndexType": "str", # Method used to compute string offset and length. - Required. Known values are: "textElements", "unicodeCodePoint", and - "utf16CodeUnit". - "contentFormat": "str", # Optional. Format of the analyze result top-level - content. Known values are: "text" and "markdown". + "stringIndexType": "str", + "contentFormat": "str", "documents": [ { - "confidence": 0.0, # Confidence of correctly extracting the - document. Required. - "docType": "str", # Document type. Required. + "confidence": 0.0, + "docType": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "fields": { "str": { - "type": "str", # Data type of the field - value. Required. Known values are: "string", "date", "time", - "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". + "type": "str", "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "confidence": 0.0, # Optional. Confidence of - correctly extracting the field. - "content": "str", # Optional. Field content. + "confidence": 0.0, + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "valueAddress": { - "city": "str", # Optional. Name of - city, town, village, etc. - "cityDistrict": "str", # Optional. - Districts or boroughs within a city, such as Brooklyn in New - York City or City of Westminster in London. - "countryRegion": "str", # Optional. - Country/region. - "house": "str", # Optional. Build - name, such as World Trade Center. - "houseNumber": "str", # Optional. - House or building number. - "level": "str", # Optional. Floor - number, such as 3F. - "poBox": "str", # Optional. Post - office box number. - "postalCode": "str", # Optional. - Postal code used for mail sorting. - "road": "str", # Optional. Street - name. - "state": "str", # Optional. - First-level administrative division. - "stateDistrict": "str", # Optional. - Second-level administrative division used in certain locales. - "streetAddress": "str", # Optional. - Street-level address, excluding city, state, countryRegion, - and postalCode. - "suburb": "str", # Optional. - Unofficial neighborhood name, like Chinatown. - "unit": "str" # Optional. Apartment - or office number. + "city": "str", + "cityDistrict": "str", + "countryRegion": "str", + "house": "str", + "houseNumber": "str", + "level": "str", + "poBox": "str", + "postalCode": "str", + "road": "str", + "state": "str", + "stateDistrict": "str", + "streetAddress": "str", + "suburb": "str", + "unit": "str" }, "valueArray": [ ... ], - "valueBoolean": bool, # Optional. Boolean - value. - "valueCountryRegion": "str", # Optional. - 3-letter country code value (ISO 3166-1 alpha-3). + "valueBoolean": bool, + "valueCountryRegion": "str", "valueCurrency": { - "amount": 0.0, # Currency amount. - Required. - "currencyCode": "str", # Optional. - Resolved currency code (ISO 4217), if any. - "currencySymbol": "str" # Optional. - Currency symbol label, if any. + "amount": 0.0, + "currencyCode": "str", + "currencySymbol": "str" }, - "valueDate": "2020-02-20", # Optional. Date - value in YYYY-MM-DD format (ISO 8601). - "valueInteger": 0, # Optional. Integer - value. - "valueNumber": 0.0, # Optional. Floating - point value. + "valueDate": "2020-02-20", + "valueInteger": 0, + "valueNumber": 0.0, "valueObject": { "str": ... }, - "valuePhoneNumber": "str", # Optional. Phone - number value in E.164 format (ex. +19876543210). + "valuePhoneNumber": "str", "valueSelectionGroup": [ - "str" # Optional. Selection group - value. + "str" ], - "valueSelectionMark": "str", # Optional. - Selection mark value. Known values are: "selected" and - "unselected". - "valueSignature": "str", # Optional. - Presence of signature. Known values are: "signed" and "unsigned". - "valueString": "str", # Optional. String - value. - "valueTime": "12:30:00" # Optional. Time - value in hh:mm:ss format (ISO 8601). + "valueSelectionMark": "str", + "valueSignature": "str", + "valueString": "str", + "valueTime": "12:30:00" } } } @@ -5952,149 +4556,99 @@ async def begin_classify_document( { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "elements": [ - "str" # Optional. Child elements of the figure, - excluding any caption or footnotes. + "str" ], "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } - ] + ], + "id": "str" } ], "keyValuePairs": [ { - "confidence": 0.0, # Confidence of correctly extracting the - key-value pair. Required. + "confidence": 0.0, "key": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] }, "value": { - "content": "str", # Concatenated content of the - key-value element in reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ] @@ -6103,281 +4657,161 @@ async def begin_classify_document( ], "languages": [ { - "confidence": 0.0, # Confidence of correctly identifying the - language. Required. - "locale": "str", # Detected language. Value may an ISO - 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. - "zh-Hans"). Required. - "spans": [ - { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ] - } - ], - "lists": [ - { - "items": [ - { - "content": "str", # Content of the list - item. Required. - "level": 0, # Level of the list item - (1-indexed). Required. - "spans": [ - { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. - } - ], - "boundingRegions": [ - { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. - "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. - ] - } - ], - "elements": [ - "str" # Optional. Child elements of - the list item. - ] - } - ], + "confidence": 0.0, + "locale": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ] } ], "paragraphs": [ { - "content": "str", # Concatenated content of the paragraph in - reading order. Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "role": "str" # Optional. Semantic role of the paragraph. - Known values are: "pageHeader", "pageFooter", "pageNumber", "title", - "sectionHeading", "footnote", and "formulaBlock". + "role": "str" } ], "sections": [ { "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "elements": [ - "str" # Optional. Child elements of the section. + "str" ] } ], "styles": [ { - "confidence": 0.0, # Confidence of correctly identifying the - style. Required. + "confidence": 0.0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. - } - ], - "backgroundColor": "str", # Optional. Background color in - #rrggbb hexadecimal format.. - "color": "str", # Optional. Foreground color in #rrggbb - hexadecimal format. - "fontStyle": "str", # Optional. Font style. Known values - are: "normal" and "italic". - "fontWeight": "str", # Optional. Font weight. Known values - are: "normal" and "bold". - "isHandwritten": bool, # Optional. Is content handwritten?. - "similarFontFamily": "str" # Optional. Visually most similar - font from among the set of supported font families, with fallback fonts - following CSS convention (ex. 'Arial, sans-serif'). + "length": 0, + "offset": 0 + } + ], + "backgroundColor": "str", + "color": "str", + "fontStyle": "str", + "fontWeight": "str", + "isHandwritten": bool, + "similarFontFamily": "str" } ], "tables": [ { "cells": [ { - "columnIndex": 0, # Column index of the - cell. Required. - "content": "str", # Concatenated content of - the table cell in reading order. Required. - "rowIndex": 0, # Row index of the cell. - Required. + "columnIndex": 0, + "content": "str", + "rowIndex": 0, "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], - "columnSpan": 0, # Optional. Number of - columns spanned by this cell. + "columnSpan": 0, "elements": [ - "str" # Optional. Child elements of - the table cell. + "str" ], - "kind": "str", # Optional. Table cell kind. - Known values are: "content", "rowHeader", "columnHeader", - "stubHead", and "description". - "rowSpan": 0 # Optional. Number of rows - spanned by this cell. + "kind": "str", + "rowSpan": 0 } ], - "columnCount": 0, # Number of columns in the table. - Required. - "rowCount": 0, # Number of rows in the table. Required. + "columnCount": 0, + "rowCount": 0, "spans": [ { - "length": 0, # Number of characters in the - content represented by the span. Required. - "offset": 0 # Zero-based index of the - content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page number of - page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on the page, - or the entire page if not specified. Coordinates specified - relative to the top-left of the page. The numbers represent - the x, y values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "caption": { - "content": "str", # Content of the caption. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of characters - in the content represented by the span. Required. - "offset": 0 # Zero-based index of - the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based page - number of page containing the bounding region. Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding polygon on - the page, or the entire page if not specified. - Coordinates specified relative to the top-left of the - page. The numbers represent the x, y values of the - polygon vertices, clockwise from the left (-180 degrees - inclusive) relative to the element orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of the - caption. + "str" ] }, "footnotes": [ { - "content": "str", # Content of the footnote. - Required. + "content": "str", "spans": [ { - "length": 0, # Number of - characters in the content represented by the span. - Required. - "offset": 0 # Zero-based - index of the content represented by the span. Required. + "length": 0, + "offset": 0 } ], "boundingRegions": [ { - "pageNumber": 0, # 1-based - page number of page containing the bounding region. - Required. + "pageNumber": 0, "polygon": [ - 0.0 # Bounding - polygon on the page, or the entire page if not - specified. Coordinates specified relative to the - top-left of the page. The numbers represent the x, y - values of the polygon vertices, clockwise from the - left (-180 degrees inclusive) relative to the element - orientation. Required. + 0.0 ] } ], "elements": [ - "str" # Optional. Child elements of - the footnote. + "str" ] } ] } + ], + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } ] } """ @@ -6390,17 +4824,19 @@ async def begin_classify_document( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._classify_document_initial( # type: ignore + raw_result = await self._classify_document_initial( classifier_id=classifier_id, classify_request=classify_request, string_index_type=string_index_type, split=split, + pages=pages, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -6441,12 +4877,13 @@ def get_long_running_output(pipeline_response): ) -class DocumentIntelligenceAdministrationClientOperationsMixin( # pylint: disable=name-too-long +class DocumentIntelligenceAdministrationClientOperationsMixin( # pylint: disable=too-many-public-methods,name-too-long DocumentIntelligenceAdministrationClientMixinABC ): - async def _build_document_model_initial( # pylint: disable=inconsistent-return-statements + + async def _build_document_model_initial( self, build_request: Union[_models.BuildDocumentModelRequest, JSON, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6459,7 +4896,7 @@ async def _build_document_model_initial( # pylint: disable=inconsistent-return- _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -6480,7 +4917,7 @@ async def _build_document_model_initial( # pylint: disable=inconsistent-return- } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6488,8 +4925,10 @@ async def _build_document_model_initial( # pylint: disable=inconsistent-return- response = pipeline_response.http_response if response.status_code not in [202]: - if _stream: + try: await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -6498,14 +4937,17 @@ async def _build_document_model_initial( # pylint: disable=inconsistent-return- response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_build_document_model( self, build_request: _models.BuildDocumentModelRequest, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Builds a custom document analysis model. :param build_request: Build request parameters. Required. @@ -6524,86 +4966,80 @@ async def begin_build_document_model( # JSON input template you can fill out and use as your body input. build_request = { - "buildMode": "str", # Custom document model build mode. Required. Known - values are: "template" and "neural". - "modelId": "str", # Unique document model name. Required. + "buildMode": "str", + "modelId": "str", + "allowOverwrite": bool, "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "description": "str", # Optional. Document model description. + "description": "str", + "maxTrainingHours": 0.0, "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -6613,7 +5049,6 @@ async def begin_build_document_model( async def begin_build_document_model( self, build_request: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Builds a custom document analysis model. :param build_request: Build request parameters. Required. @@ -6632,65 +5067,60 @@ async def begin_build_document_model( # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -6700,7 +5130,6 @@ async def begin_build_document_model( async def begin_build_document_model( self, build_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Builds a custom document analysis model. :param build_request: Build request parameters. Required. @@ -6719,65 +5148,60 @@ async def begin_build_document_model( # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -6787,7 +5211,6 @@ async def begin_build_document_model( async def begin_build_document_model( self, build_request: Union[_models.BuildDocumentModelRequest, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Builds a custom document analysis model. :param build_request: Build request parameters. Is one of the following types: @@ -6805,86 +5228,80 @@ async def begin_build_document_model( # JSON input template you can fill out and use as your body input. build_request = { - "buildMode": "str", # Custom document model build mode. Required. Known - values are: "template" and "neural". - "modelId": "str", # Unique document model name. Required. + "buildMode": "str", + "modelId": "str", + "allowOverwrite": bool, "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "description": "str", # Optional. Document model description. + "description": "str", + "maxTrainingHours": 0.0, "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -6898,7 +5315,7 @@ async def begin_build_document_model( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._build_document_model_initial( # type: ignore + raw_result = await self._build_document_model_initial( build_request=build_request, content_type=content_type, cls=lambda x, y, z: x, @@ -6906,6 +5323,7 @@ async def begin_build_document_model( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -6945,9 +5363,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _compose_model_initial( # pylint: disable=inconsistent-return-statements + async def _compose_model_initial( self, compose_request: Union[_models.ComposeDocumentModelRequest, JSON, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6960,7 +5378,7 @@ async def _compose_model_initial( # pylint: disable=inconsistent-return-stateme _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -6981,7 +5399,7 @@ async def _compose_model_initial( # pylint: disable=inconsistent-return-stateme } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6989,8 +5407,10 @@ async def _compose_model_initial( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [202]: - if _stream: + try: await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -6999,8 +5419,12 @@ async def _compose_model_initial( # pylint: disable=inconsistent-return-stateme response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_compose_model( @@ -7010,7 +5434,6 @@ async def begin_compose_model( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Creates a new document model from document types of existing document models. :param compose_request: Compose request parameters. Required. @@ -7029,80 +5452,100 @@ async def begin_compose_model( # JSON input template you can fill out and use as your body input. compose_request = { - "componentModels": [ - { - "modelId": "str" # Unique document model name. Required. + "classifierId": "str", + "docTypes": { + "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, + "fieldSchema": { + "str": { + "type": "str", + "description": "str", + "example": "str", + "items": ..., + "properties": { + "str": ... + } + } + }, + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } - ], - "modelId": "str", # Unique document model name. Required. - "description": "str", # Optional. Document model description. + }, + "modelId": "str", + "description": "str", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7112,7 +5555,6 @@ async def begin_compose_model( async def begin_compose_model( self, compose_request: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Creates a new document model from document types of existing document models. :param compose_request: Compose request parameters. Required. @@ -7131,65 +5573,60 @@ async def begin_compose_model( # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7199,7 +5636,6 @@ async def begin_compose_model( async def begin_compose_model( self, compose_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Creates a new document model from document types of existing document models. :param compose_request: Compose request parameters. Required. @@ -7218,65 +5654,60 @@ async def begin_compose_model( # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7286,7 +5717,6 @@ async def begin_compose_model( async def begin_compose_model( self, compose_request: Union[_models.ComposeDocumentModelRequest, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Creates a new document model from document types of existing document models. :param compose_request: Compose request parameters. Is one of the following types: @@ -7304,80 +5734,100 @@ async def begin_compose_model( # JSON input template you can fill out and use as your body input. compose_request = { - "componentModels": [ - { - "modelId": "str" # Unique document model name. Required. + "classifierId": "str", + "docTypes": { + "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, + "fieldSchema": { + "str": { + "type": "str", + "description": "str", + "example": "str", + "items": ..., + "properties": { + "str": ... + } + } + }, + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } - ], - "modelId": "str", # Unique document model name. Required. - "description": "str", # Optional. Document model description. + }, + "modelId": "str", + "description": "str", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7391,7 +5841,7 @@ async def begin_compose_model( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._compose_model_initial( # type: ignore + raw_result = await self._compose_model_initial( compose_request=compose_request, content_type=content_type, cls=lambda x, y, z: x, @@ -7399,6 +5849,7 @@ async def begin_compose_model( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -7446,7 +5897,6 @@ async def authorize_model_copy( content_type: str = "application/json", **kwargs: Any ) -> _models.CopyAuthorization: - # pylint: disable=line-too-long """Generates authorization to copy a document model to this location with specified modelId and optional description. @@ -7464,26 +5914,21 @@ async def authorize_model_copy( # JSON input template you can fill out and use as your body input. authorize_copy_request = { - "modelId": "str", # Unique document model name. Required. - "description": "str", # Optional. Document model description. + "modelId": "str", + "description": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 200 response == { - "accessToken": "str", # Token used to authorize the request. Required. - "expirationDateTime": "2020-02-20 00:00:00", # Date/time when the access - token expires. Required. - "targetModelId": "str", # Identifier of the target document model. Required. - "targetModelLocation": "str", # URL of the copied document model in the - target account. Required. - "targetResourceId": "str", # ID of the target Azure resource where the - document model should be copied to. Required. - "targetResourceRegion": "str" # Location of the target Azure resource where - the document model should be copied to. Required. + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetModelId": "str", + "targetModelLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } """ @@ -7491,7 +5936,6 @@ async def authorize_model_copy( async def authorize_model_copy( self, authorize_copy_request: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> _models.CopyAuthorization: - # pylint: disable=line-too-long """Generates authorization to copy a document model to this location with specified modelId and optional description. @@ -7509,16 +5953,12 @@ async def authorize_model_copy( # response body for status code(s): 200 response == { - "accessToken": "str", # Token used to authorize the request. Required. - "expirationDateTime": "2020-02-20 00:00:00", # Date/time when the access - token expires. Required. - "targetModelId": "str", # Identifier of the target document model. Required. - "targetModelLocation": "str", # URL of the copied document model in the - target account. Required. - "targetResourceId": "str", # ID of the target Azure resource where the - document model should be copied to. Required. - "targetResourceRegion": "str" # Location of the target Azure resource where - the document model should be copied to. Required. + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetModelId": "str", + "targetModelLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } """ @@ -7526,7 +5966,6 @@ async def authorize_model_copy( async def authorize_model_copy( self, authorize_copy_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.CopyAuthorization: - # pylint: disable=line-too-long """Generates authorization to copy a document model to this location with specified modelId and optional description. @@ -7544,16 +5983,12 @@ async def authorize_model_copy( # response body for status code(s): 200 response == { - "accessToken": "str", # Token used to authorize the request. Required. - "expirationDateTime": "2020-02-20 00:00:00", # Date/time when the access - token expires. Required. - "targetModelId": "str", # Identifier of the target document model. Required. - "targetModelLocation": "str", # URL of the copied document model in the - target account. Required. - "targetResourceId": "str", # ID of the target Azure resource where the - document model should be copied to. Required. - "targetResourceRegion": "str" # Location of the target Azure resource where - the document model should be copied to. Required. + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetModelId": "str", + "targetModelLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } """ @@ -7561,7 +5996,6 @@ async def authorize_model_copy( async def authorize_model_copy( self, authorize_copy_request: Union[_models.AuthorizeCopyRequest, JSON, IO[bytes]], **kwargs: Any ) -> _models.CopyAuthorization: - # pylint: disable=line-too-long """Generates authorization to copy a document model to this location with specified modelId and optional description. @@ -7578,26 +6012,21 @@ async def authorize_model_copy( # JSON input template you can fill out and use as your body input. authorize_copy_request = { - "modelId": "str", # Unique document model name. Required. - "description": "str", # Optional. Document model description. + "modelId": "str", + "description": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 200 response == { - "accessToken": "str", # Token used to authorize the request. Required. - "expirationDateTime": "2020-02-20 00:00:00", # Date/time when the access - token expires. Required. - "targetModelId": "str", # Identifier of the target document model. Required. - "targetModelLocation": "str", # URL of the copied document model in the - target account. Required. - "targetResourceId": "str", # ID of the target Azure resource where the - document model should be copied to. Required. - "targetResourceRegion": "str" # Location of the target Azure resource where - the document model should be copied to. Required. + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetModelId": "str", + "targetModelLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -7642,7 +6071,10 @@ async def authorize_model_copy( if response.status_code not in [200]: if _stream: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -7657,9 +6089,9 @@ async def authorize_model_copy( return deserialized # type: ignore - async def _copy_model_to_initial( # pylint: disable=inconsistent-return-statements + async def _copy_model_to_initial( self, model_id: str, copy_to_request: Union[_models.CopyAuthorization, JSON, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7672,7 +6104,7 @@ async def _copy_model_to_initial( # pylint: disable=inconsistent-return-stateme _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -7694,7 +6126,7 @@ async def _copy_model_to_initial( # pylint: disable=inconsistent-return-stateme } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7702,8 +6134,10 @@ async def _copy_model_to_initial( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [202]: - if _stream: + try: await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -7712,8 +6146,12 @@ async def _copy_model_to_initial( # pylint: disable=inconsistent-return-stateme response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_copy_model_to( @@ -7724,7 +6162,6 @@ async def begin_copy_model_to( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Copies document model to the target resource, region, and modelId. :param model_id: Unique document model name. Required. @@ -7745,79 +6182,70 @@ async def begin_copy_model_to( # JSON input template you can fill out and use as your body input. copy_to_request = { - "accessToken": "str", # Token used to authorize the request. Required. - "expirationDateTime": "2020-02-20 00:00:00", # Date/time when the access - token expires. Required. - "targetModelId": "str", # Identifier of the target document model. Required. - "targetModelLocation": "str", # URL of the copied document model in the - target account. Required. - "targetResourceId": "str", # ID of the target Azure resource where the - document model should be copied to. Required. - "targetResourceRegion": "str" # Location of the target Azure resource where - the document model should be copied to. Required. + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetModelId": "str", + "targetModelLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7827,7 +6255,6 @@ async def begin_copy_model_to( async def begin_copy_model_to( self, model_id: str, copy_to_request: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Copies document model to the target resource, region, and modelId. :param model_id: Unique document model name. Required. @@ -7848,65 +6275,60 @@ async def begin_copy_model_to( # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -7916,7 +6338,6 @@ async def begin_copy_model_to( async def begin_copy_model_to( self, model_id: str, copy_to_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Copies document model to the target resource, region, and modelId. :param model_id: Unique document model name. Required. @@ -7937,65 +6358,60 @@ async def begin_copy_model_to( # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -8005,7 +6421,6 @@ async def begin_copy_model_to( async def begin_copy_model_to( self, model_id: str, copy_to_request: Union[_models.CopyAuthorization, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DocumentModelDetails]: - # pylint: disable=line-too-long """Copies document model to the target resource, region, and modelId. :param model_id: Unique document model name. Required. @@ -8025,79 +6440,70 @@ async def begin_copy_model_to( # JSON input template you can fill out and use as your body input. copy_to_request = { - "accessToken": "str", # Token used to authorize the request. Required. - "expirationDateTime": "2020-02-20 00:00:00", # Date/time when the access - token expires. Required. - "targetModelId": "str", # Identifier of the target document model. Required. - "targetModelLocation": "str", # URL of the copied document model in the - target account. Required. - "targetResourceId": "str", # ID of the target Azure resource where the - document model should be copied to. Required. - "targetResourceRegion": "str" # Location of the target Azure resource where - the document model should be copied to. Required. + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetModelId": "str", + "targetModelLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } # response body for status code(s): 202 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -8111,7 +6517,7 @@ async def begin_copy_model_to( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._copy_model_to_initial( # type: ignore + raw_result = await self._copy_model_to_initial( model_id=model_id, copy_to_request=copy_to_request, content_type=content_type, @@ -8120,6 +6526,7 @@ async def begin_copy_model_to( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -8161,7 +6568,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_model(self, model_id: str, **kwargs: Any) -> _models.DocumentModelDetails: - # pylint: disable=line-too-long """Gets detailed document model information. :param model_id: Unique document model name. Required. @@ -8175,65 +6581,60 @@ async def get_model(self, model_id: str, **kwargs: Any) -> _models.DocumentModel # response body for status code(s): 200 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -8271,7 +6672,10 @@ async def get_model(self, model_id: str, **kwargs: Any) -> _models.DocumentModel if response.status_code not in [200]: if _stream: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -8293,7 +6697,6 @@ async def get_model(self, model_id: str, **kwargs: Any) -> _models.DocumentModel @distributed_trace def list_models(self, **kwargs: Any) -> AsyncIterable["_models.DocumentModelDetails"]: - # pylint: disable=line-too-long """List all document models. :return: An iterator like instance of DocumentModelDetails @@ -8306,65 +6709,60 @@ def list_models(self, **kwargs: Any) -> AsyncIterable["_models.DocumentModelDeta # response body for status code(s): 200 response == { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this document - model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "fileList": "str" # Path to a JSONL file within the container - specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. Known - values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type of the - field value. Required. Known values are: "string", "date", - "time", "phoneNumber", "number", "integer", "selectionMark", - "countryRegion", "signature", "array", "object", "currency", - "address", "boolean", and "selectionGroup". - "description": "str", # Optional. Field - description. - "example": "str", # Optional. Example field - content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document model build - mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence for each - field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -8436,8 +6834,6 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -8482,55 +6878,483 @@ async def delete_model( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def get_resource_info(self, **kwargs: Any) -> _models.ResourceDetails: + """Return information about the current resource. + + :return: ResourceDetails. The ResourceDetails is compatible with MutableMapping + :rtype: ~azure.ai.documentintelligence.models.ResourceDetails + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "customDocumentModels": { + "count": 0, + "limit": 0 + } + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ResourceDetails] = kwargs.pop("cls", None) + + _request = build_document_intelligence_administration_get_resource_info_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: if _stream: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ResourceDetails, response.json()) if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async - async def get_resource_info(self, **kwargs: Any) -> _models.ResourceDetails: - # pylint: disable=line-too-long - """Return information about the current resource. + async def get_operation(self, operation_id: str, **kwargs: Any) -> _models.OperationDetails: + """Gets operation info. - :return: ResourceDetails. The ResourceDetails is compatible with MutableMapping - :rtype: ~azure.ai.documentintelligence.models.ResourceDetails + :param operation_id: Operation ID. Required. + :type operation_id: str + :return: OperationDetails. The OperationDetails is compatible with MutableMapping + :rtype: ~azure.ai.documentintelligence.models.OperationDetails :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 - response == { - "customDocumentModels": { - "count": 0, # Number of custom document models in the current - resource. Required. - "limit": 0 # Maximum number of custom document models supported in - the current resource. Required. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "documentClassifierBuild": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentClassifierBuild", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + }, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "documentClassifierCopyTo": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentClassifierCopyTo", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + }, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "documentModelBuild": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentModelBuild", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "buildMode": "str", + "classifierId": "str", + "description": "str", + "docTypes": { + "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, + "fieldSchema": { + "str": { + "type": "str", + "description": "str", + "example": "str", + "items": ..., + "properties": { + "str": ... + } + } + }, + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] + } + }, + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", + "tags": { + "str": "str" + }, + "trainingHours": 0.0, + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + }, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "documentModelCompose": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentModelCompose", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "buildMode": "str", + "classifierId": "str", + "description": "str", + "docTypes": { + "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, + "fieldSchema": { + "str": { + "type": "str", + "description": "str", + "example": "str", + "items": ..., + "properties": { + "str": ... + } + } + }, + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] + } + }, + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", + "tags": { + "str": "str" + }, + "trainingHours": 0.0, + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + }, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "documentModelCopyTo": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentModelCopyTo", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "buildMode": "str", + "classifierId": "str", + "description": "str", + "docTypes": { + "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, + "fieldSchema": { + "str": { + "type": "str", + "description": "str", + "example": "str", + "items": ..., + "properties": { + "str": ... + } + } + }, + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] + } + }, + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", + "tags": { + "str": "str" + }, + "trainingHours": 0.0, + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] }, - "customNeuralDocumentModelBuilds": { - "quota": 0, # Resource quota limit. Required. - "quotaResetDateTime": "2020-02-20 00:00:00", # Date/time when the - resource quota usage will be reset. Required. - "used": 0 # Amount of the resource quota used. Required. + "tags": { + "str": "str" } } + + # response body for status code(s): 200 + response == operation_details """ error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -8543,9 +7367,10 @@ async def get_resource_info(self, **kwargs: Any) -> _models.ResourceDetails: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ResourceDetails] = kwargs.pop("cls", None) + cls: ClsType[_models.OperationDetails] = kwargs.pop("cls", None) - _request = build_document_intelligence_administration_get_resource_info_request( + _request = build_document_intelligence_administration_get_operation_request( + operation_id=operation_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8564,30 +7389,36 @@ async def get_resource_info(self, **kwargs: Any) -> _models.ResourceDetails: if response.status_code not in [200]: if _stream: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) + if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.ResourceDetails, response.json()) + deserialized = _deserialize(_models.OperationDetails, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def get_operation(self, operation_id: str, **kwargs: Any) -> _models.OperationDetails: - # pylint: disable=line-too-long - """Gets operation info. + @distributed_trace + def list_operations(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetails"]: + """Lists all operations. - :param operation_id: Operation ID. Required. - :type operation_id: str - :return: OperationDetails. The OperationDetails is compatible with MutableMapping - :rtype: ~azure.ai.documentintelligence.models.OperationDetails + :return: An iterator like instance of OperationDetails + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.documentintelligence.models.OperationDetails] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8596,295 +7427,384 @@ async def get_operation(self, operation_id: str, **kwargs: Any) -> _models.Opera # The response is polymorphic. The following are possible polymorphic responses based off discriminator "kind": - # JSON input template for discriminator value "documentClassifierBuild": + # JSON input template for discriminator value "documentClassifierBuild": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentClassifierBuild", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + }, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "documentClassifierCopyTo": operation_details = { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - operation was created. Required. - "kind": "documentClassifierBuild", - "lastUpdatedDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - status was last updated. Required. - "operationId": "str", # Operation ID. Required. - "resourceLocation": "str", # URL of the resource targeted by this operation. - Required. - "status": "str", # Operation status. notStarted, running, completed, or - failed. Required. Known values are: "notStarted", "running", "failed", - "succeeded", "completed", and "canceled". - "apiVersion": "str", # Optional. API version used to create this operation. + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentClassifierCopyTo", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", "error": { - "code": "str", # One of a server-defined set of error codes. - Required. - "message": "str", # A human-readable representation of the error. - Required. + "code": "str", + "message": "str", "details": [ ... ], "innererror": { - "code": "str", # Optional. One of a server-defined set of - error codes. + "code": "str", "innererror": ..., - "message": "str" # Optional. A human-readable representation - of the error. + "message": "str" }, - "target": "str" # Optional. The target of the error. + "target": "str" }, - "percentCompleted": 0, # Optional. Operation progress (0-100). + "percentCompleted": 0, "result": { - "apiVersion": "str", # API version used to create this document - classifier. Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when - the document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file - within the container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name - prefix. + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + }, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "documentModelBuild": + operation_details = { + "createdDateTime": "2020-02-20 00:00:00", + "kind": "documentModelBuild", + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", + "error": { + "code": "str", + "message": "str", + "details": [ + ... + ], + "innererror": { + "code": "str", + "innererror": ..., + "message": "str" + }, + "target": "str" + }, + "percentCompleted": 0, + "result": { + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "buildMode": "str", + "classifierId": "str", + "description": "str", + "docTypes": { + "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, + "fieldSchema": { + "str": { + "type": "str", + "description": "str", + "example": "str", + "items": ..., + "properties": { + "str": ... + } + } }, - "sourceKind": "str" # Optional. Type of training - data source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of - which the classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and - time (UTC) when the document classifier will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", + "tags": { + "str": "str" + }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of - warning codes. Required. - "message": "str", # A human-readable representation - of the warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] }, "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # JSON input template for discriminator value "documentModelCompose": operation_details = { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - operation was created. Required. + "createdDateTime": "2020-02-20 00:00:00", "kind": "documentModelCompose", - "lastUpdatedDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - status was last updated. Required. - "operationId": "str", # Operation ID. Required. - "resourceLocation": "str", # URL of the resource targeted by this operation. - Required. - "status": "str", # Operation status. notStarted, running, completed, or - failed. Required. Known values are: "notStarted", "running", "failed", - "succeeded", "completed", and "canceled". - "apiVersion": "str", # Optional. API version used to create this operation. + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", "error": { - "code": "str", # One of a server-defined set of error codes. - Required. - "message": "str", # A human-readable representation of the error. - Required. + "code": "str", + "message": "str", "details": [ ... ], "innererror": { - "code": "str", # Optional. One of a server-defined set of - error codes. + "code": "str", "innererror": ..., - "message": "str" # Optional. A human-readable representation - of the error. + "message": "str" }, - "target": "str" # Optional. The target of the error. + "target": "str" }, - "percentCompleted": 0, # Optional. Operation progress (0-100). + "percentCompleted": 0, "result": { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when - the document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this - document model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. - Known values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type - of the field value. Required. Known values are: "string", - "date", "time", "phoneNumber", "number", "integer", - "selectionMark", "countryRegion", "signature", "array", - "object", "currency", "address", "boolean", and - "selectionGroup". - "description": "str", # Optional. - Field description. - "example": "str", # Optional. - Example field content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document - model build mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence - for each field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and - time (UTC) when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes - associated with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of - warning codes. Required. - "message": "str", # A human-readable representation - of the warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] }, "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # JSON input template for discriminator value "documentModelCopyTo": operation_details = { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - operation was created. Required. + "createdDateTime": "2020-02-20 00:00:00", "kind": "documentModelCopyTo", - "lastUpdatedDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - status was last updated. Required. - "operationId": "str", # Operation ID. Required. - "resourceLocation": "str", # URL of the resource targeted by this operation. - Required. - "status": "str", # Operation status. notStarted, running, completed, or - failed. Required. Known values are: "notStarted", "running", "failed", - "succeeded", "completed", and "canceled". - "apiVersion": "str", # Optional. API version used to create this operation. + "lastUpdatedDateTime": "2020-02-20 00:00:00", + "operationId": "str", + "resourceLocation": "str", + "status": "str", + "apiVersion": "str", "error": { - "code": "str", # One of a server-defined set of error codes. - Required. - "message": "str", # A human-readable representation of the error. - Required. + "code": "str", + "message": "str", "details": [ ... ], "innererror": { - "code": "str", # Optional. One of a server-defined set of - error codes. + "code": "str", "innererror": ..., - "message": "str" # Optional. A human-readable representation - of the error. + "message": "str" }, - "target": "str" # Optional. The target of the error. + "target": "str" }, - "percentCompleted": 0, # Optional. Operation progress (0-100). + "percentCompleted": 0, "result": { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when - the document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this - document model. + "createdDateTime": "2020-02-20 00:00:00", + "modelId": "str", + "apiVersion": "str", "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "buildMode": "str", # Optional. Custom document model build mode. - Known values are: "template" and "neural". - "description": "str", # Optional. Document model description. + "buildMode": "str", + "classifierId": "str", + "description": "str", "docTypes": { "str": { + "buildMode": "str", + "confidenceThreshold": 0.0, + "description": "str", + "features": [ + "str" + ], + "fieldConfidence": { + "str": 0.0 + }, "fieldSchema": { "str": { - "type": "str", # Semantic data type - of the field value. Required. Known values are: "string", - "date", "time", "phoneNumber", "number", "integer", - "selectionMark", "countryRegion", "signature", "array", - "object", "currency", "address", "boolean", and - "selectionGroup". - "description": "str", # Optional. - Field description. - "example": "str", # Optional. - Example field content. + "type": "str", + "description": "str", + "example": "str", "items": ..., "properties": { "str": ... } } }, - "buildMode": "str", # Optional. Custom document - model build mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence - for each field. - } + "maxDocumentsToAnalyze": 0, + "modelId": "str", + "queryFields": [ + "str" + ] } }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and - time (UTC) when the document model will expire. + "expirationDateTime": "2020-02-20 00:00:00", + "split": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes - associated with the document model. + "str": "str" }, + "trainingHours": 0.0, "warnings": [ { - "code": "str", # One of a server-defined set of - warning codes. Required. - "message": "str", # A human-readable representation - of the warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] }, "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 200 response == operation_details """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OperationDetails]] = kwargs.pop("cls", None) + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8893,14 +7813,96 @@ async def get_operation(self, operation_id: str, **kwargs: Any) -> _models.Opera } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + def prepare_request(next_link=None): + if not next_link: + + _request = build_document_intelligence_administration_list_operations_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OperationDetails], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _build_classifier_initial( + self, build_request: Union[_models.BuildDocumentClassifierRequest, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OperationDetails] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_document_intelligence_administration_get_operation_request( - operation_id=operation_id, + content_type = content_type or "application/json" + _content = None + if isinstance(build_request, (IOBase, bytes)): + _content = build_request + else: + _content = json.dumps(build_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_document_intelligence_administration_build_classifier_request( + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -8909,345 +7911,483 @@ async def get_operation(self, operation_id: str, **kwargs: Any) -> _models.Opera } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: + if response.status_code not in [202]: + try: await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_build_classifier( + self, + build_request: _models.BuildDocumentClassifierRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DocumentClassifierDetails]: + """Builds a custom document classifier. + + :param build_request: Build request parameters. Required. + :type build_request: ~azure.ai.documentintelligence.models.BuildDocumentClassifierRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DocumentClassifierDetails. The + DocumentClassifierDetails is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.ai.documentintelligence.models.DocumentClassifierDetails] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + build_request = { + "classifierId": "str", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "allowOverwrite": bool, + "baseClassifierId": "str", + "description": "str" + } + + # response body for status code(s): 202 + response == { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + } + """ + + @overload + async def begin_build_classifier( + self, build_request: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.DocumentClassifierDetails]: + """Builds a custom document classifier. + + :param build_request: Build request parameters. Required. + :type build_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DocumentClassifierDetails. The + DocumentClassifierDetails is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.ai.documentintelligence.models.DocumentClassifierDetails] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 202 + response == { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + } + """ + + @overload + async def begin_build_classifier( + self, build_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.DocumentClassifierDetails]: + """Builds a custom document classifier. - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.OperationDetails, response.json()) + :param build_request: Build request parameters. Required. + :type build_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DocumentClassifierDetails. The + DocumentClassifierDetails is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.ai.documentintelligence.models.DocumentClassifierDetails] + :raises ~azure.core.exceptions.HttpResponseError: - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + Example: + .. code-block:: python - return deserialized # type: ignore + # response body for status code(s): 202 + response == { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } + }, + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] + } + """ - @distributed_trace - def list_operations(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetails"]: - # pylint: disable=line-too-long - """Lists all operations. + @distributed_trace_async + async def begin_build_classifier( + self, build_request: Union[_models.BuildDocumentClassifierRequest, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.DocumentClassifierDetails]: + """Builds a custom document classifier. - :return: An iterator like instance of OperationDetails + :param build_request: Build request parameters. Is one of the following types: + BuildDocumentClassifierRequest, JSON, IO[bytes] Required. + :type build_request: ~azure.ai.documentintelligence.models.BuildDocumentClassifierRequest or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DocumentClassifierDetails. The + DocumentClassifierDetails is compatible with MutableMapping :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.documentintelligence.models.OperationDetails] + ~azure.core.polling.AsyncLROPoller[~azure.ai.documentintelligence.models.DocumentClassifierDetails] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # The response is polymorphic. The following are possible polymorphic responses based - off discriminator "kind": - - # JSON input template for discriminator value "documentClassifierBuild": - operation_details = { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - operation was created. Required. - "kind": "documentClassifierBuild", - "lastUpdatedDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - status was last updated. Required. - "operationId": "str", # Operation ID. Required. - "resourceLocation": "str", # URL of the resource targeted by this operation. - Required. - "status": "str", # Operation status. notStarted, running, completed, or - failed. Required. Known values are: "notStarted", "running", "failed", - "succeeded", "completed", and "canceled". - "apiVersion": "str", # Optional. API version used to create this operation. - "error": { - "code": "str", # One of a server-defined set of error codes. - Required. - "message": "str", # A human-readable representation of the error. - Required. - "details": [ - ... - ], - "innererror": { - "code": "str", # Optional. One of a server-defined set of - error codes. - "innererror": ..., - "message": "str" # Optional. A human-readable representation - of the error. - }, - "target": "str" # Optional. The target of the error. - }, - "percentCompleted": 0, # Optional. Operation progress (0-100). - "result": { - "apiVersion": "str", # API version used to create this document - classifier. Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when - the document classifier was created. Required. - "docTypes": { - "str": { - "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file - within the container specifying a subset of documents. Required. - }, - "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name - prefix. - }, - "sourceKind": "str" # Optional. Type of training - data source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". - } - }, - "baseClassifierId": "str", # Optional. Base classifierId on top of - which the classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and - time (UTC) when the document classifier will expire. - "warnings": [ - { - "code": "str", # One of a server-defined set of - warning codes. Required. - "message": "str", # A human-readable representation - of the warning. Required. - "target": "str" # Optional. The target of the error. - } - ] + # JSON input template you can fill out and use as your body input. + build_request = { + "classifierId": "str", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } }, - "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. - } + "allowOverwrite": bool, + "baseClassifierId": "str", + "description": "str" } - # JSON input template for discriminator value "documentModelCompose": - operation_details = { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - operation was created. Required. - "kind": "documentModelCompose", - "lastUpdatedDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - status was last updated. Required. - "operationId": "str", # Operation ID. Required. - "resourceLocation": "str", # URL of the resource targeted by this operation. - Required. - "status": "str", # Operation status. notStarted, running, completed, or - failed. Required. Known values are: "notStarted", "running", "failed", - "succeeded", "completed", and "canceled". - "apiVersion": "str", # Optional. API version used to create this operation. - "error": { - "code": "str", # One of a server-defined set of error codes. - Required. - "message": "str", # A human-readable representation of the error. - Required. - "details": [ - ... - ], - "innererror": { - "code": "str", # Optional. One of a server-defined set of - error codes. - "innererror": ..., - "message": "str" # Optional. A human-readable representation - of the error. - }, - "target": "str" # Optional. The target of the error. - }, - "percentCompleted": 0, # Optional. Operation progress (0-100). - "result": { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when - the document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this - document model. - "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. - }, - "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "prefix": "str" # Optional. Blob name prefix. - }, - "buildMode": "str", # Optional. Custom document model build mode. - Known values are: "template" and "neural". - "description": "str", # Optional. Document model description. - "docTypes": { - "str": { - "fieldSchema": { - "str": { - "type": "str", # Semantic data type - of the field value. Required. Known values are: "string", - "date", "time", "phoneNumber", "number", "integer", - "selectionMark", "countryRegion", "signature", "array", - "object", "currency", "address", "boolean", and - "selectionGroup". - "description": "str", # Optional. - Field description. - "example": "str", # Optional. - Example field content. - "items": ..., - "properties": { - "str": ... - } - } - }, - "buildMode": "str", # Optional. Custom document - model build mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence - for each field. - } - } - }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and - time (UTC) when the document model will expire. - "tags": { - "str": "str" # Optional. List of key-value tag attributes - associated with the document model. - }, - "warnings": [ - { - "code": "str", # One of a server-defined set of - warning codes. Required. - "message": "str", # A human-readable representation - of the warning. Required. - "target": "str" # Optional. The target of the error. - } - ] + # response body for status code(s): 202 + response == { + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", + "docTypes": { + "str": { + "azureBlobFileListSource": { + "containerUrl": "str", + "fileList": "str" + }, + "azureBlobSource": { + "containerUrl": "str", + "prefix": "str" + }, + "sourceKind": "str" + } }, - "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. - } + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "warnings": [ + { + "code": "str", + "message": "str", + "target": "str" + } + ] } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - # JSON input template for discriminator value "documentModelCopyTo": - operation_details = { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - operation was created. Required. - "kind": "documentModelCopyTo", - "lastUpdatedDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - status was last updated. Required. - "operationId": "str", # Operation ID. Required. - "resourceLocation": "str", # URL of the resource targeted by this operation. - Required. - "status": "str", # Operation status. notStarted, running, completed, or - failed. Required. Known values are: "notStarted", "running", "failed", - "succeeded", "completed", and "canceled". - "apiVersion": "str", # Optional. API version used to create this operation. - "error": { - "code": "str", # One of a server-defined set of error codes. - Required. - "message": "str", # A human-readable representation of the error. - Required. - "details": [ - ... - ], - "innererror": { - "code": "str", # Optional. One of a server-defined set of - error codes. - "innererror": ..., - "message": "str" # Optional. A human-readable representation - of the error. - }, - "target": "str" # Optional. The target of the error. - }, - "percentCompleted": 0, # Optional. Operation progress (0-100). - "result": { - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when - the document model was created. Required. - "modelId": "str", # Unique document model name. Required. - "apiVersion": "str", # Optional. API version used to create this - document model. - "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. - }, - "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage container URL. - Required. - "prefix": "str" # Optional. Blob name prefix. - }, - "buildMode": "str", # Optional. Custom document model build mode. - Known values are: "template" and "neural". - "description": "str", # Optional. Document model description. - "docTypes": { - "str": { - "fieldSchema": { - "str": { - "type": "str", # Semantic data type - of the field value. Required. Known values are: "string", - "date", "time", "phoneNumber", "number", "integer", - "selectionMark", "countryRegion", "signature", "array", - "object", "currency", "address", "boolean", and - "selectionGroup". - "description": "str", # Optional. - Field description. - "example": "str", # Optional. - Example field content. - "items": ..., - "properties": { - "str": ... - } - } - }, - "buildMode": "str", # Optional. Custom document - model build mode. Known values are: "template" and "neural". - "description": "str", # Optional. Document model - description. - "fieldConfidence": { - "str": 0.0 # Optional. Estimated confidence - for each field. - } - } - }, - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and - time (UTC) when the document model will expire. - "tags": { - "str": "str" # Optional. List of key-value tag attributes - associated with the document model. - }, - "warnings": [ - { - "code": "str", # One of a server-defined set of - warning codes. Required. - "message": "str", # A human-readable representation - of the warning. Required. - "target": "str" # Optional. The target of the error. - } - ] - }, + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DocumentClassifierDetails] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._build_classifier_initial( + build_request=build_request, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result")) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DocumentClassifierDetails].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DocumentClassifierDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def authorize_classifier_copy( + self, + authorize_copy_request: _models.AuthorizeClassifierCopyRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ClassifierCopyAuthorization: + """Generates authorization to copy a document classifier to this location with + specified classifierId and optional description. + + :param authorize_copy_request: Authorize copy request parameters. Required. + :type authorize_copy_request: + ~azure.ai.documentintelligence.models.AuthorizeClassifierCopyRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ClassifierCopyAuthorization. The ClassifierCopyAuthorization is compatible with + MutableMapping + :rtype: ~azure.ai.documentintelligence.models.ClassifierCopyAuthorization + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + authorize_copy_request = { + "classifierId": "str", + "description": "str", "tags": { - "str": "str" # Optional. List of key-value tag attributes associated - with the document model. + "str": "str" } } # response body for status code(s): 200 - response == operation_details + response == { + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetClassifierId": "str", + "targetClassifierLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" + } """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.OperationDetails]] = kwargs.pop("cls", None) + @overload + async def authorize_classifier_copy( + self, authorize_copy_request: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ClassifierCopyAuthorization: + """Generates authorization to copy a document classifier to this location with + specified classifierId and optional description. + + :param authorize_copy_request: Authorize copy request parameters. Required. + :type authorize_copy_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ClassifierCopyAuthorization. The ClassifierCopyAuthorization is compatible with + MutableMapping + :rtype: ~azure.ai.documentintelligence.models.ClassifierCopyAuthorization + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetClassifierId": "str", + "targetClassifierLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" + } + """ + + @overload + async def authorize_classifier_copy( + self, authorize_copy_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ClassifierCopyAuthorization: + """Generates authorization to copy a document classifier to this location with + specified classifierId and optional description. + + :param authorize_copy_request: Authorize copy request parameters. Required. + :type authorize_copy_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ClassifierCopyAuthorization. The ClassifierCopyAuthorization is compatible with + MutableMapping + :rtype: ~azure.ai.documentintelligence.models.ClassifierCopyAuthorization + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetClassifierId": "str", + "targetClassifierLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" + } + """ + + @distributed_trace_async + async def authorize_classifier_copy( + self, authorize_copy_request: Union[_models.AuthorizeClassifierCopyRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.ClassifierCopyAuthorization: + """Generates authorization to copy a document classifier to this location with + specified classifierId and optional description. + + :param authorize_copy_request: Authorize copy request parameters. Is one of the following + types: AuthorizeClassifierCopyRequest, JSON, IO[bytes] Required. + :type authorize_copy_request: + ~azure.ai.documentintelligence.models.AuthorizeClassifierCopyRequest or JSON or IO[bytes] + :return: ClassifierCopyAuthorization. The ClassifierCopyAuthorization is compatible with + MutableMapping + :rtype: ~azure.ai.documentintelligence.models.ClassifierCopyAuthorization + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + authorize_copy_request = { + "classifierId": "str", + "description": "str", + "tags": { + "str": "str" + } + } + # response body for status code(s): 200 + response == { + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetClassifierId": "str", + "targetClassifierLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" + } + """ error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9256,73 +8396,64 @@ def list_operations(self, **kwargs: Any) -> AsyncIterable["_models.OperationDeta } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_document_intelligence_administration_list_operations_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClassifierCopyAuthorization] = kwargs.pop("cls", None) - return _request + content_type = content_type or "application/json" + _content = None + if isinstance(authorize_copy_request, (IOBase, bytes)): + _content = authorize_copy_request + else: + _content = json.dumps(authorize_copy_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.OperationDetails], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _request = build_document_intelligence_administration_authorize_classifier_copy_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: + if response.status_code not in [200]: + if _stream: + try: await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error) + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) - return pipeline_response + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ClassifierCopyAuthorization, response.json()) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - async def _build_classifier_initial( # pylint: disable=inconsistent-return-statements - self, build_request: Union[_models.BuildDocumentClassifierRequest, JSON, IO[bytes]], **kwargs: Any - ) -> None: + return deserialized # type: ignore + + async def _copy_classifier_to_initial( + self, + classifier_id: str, + copy_to_request: Union[_models.ClassifierCopyAuthorization, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9335,16 +8466,17 @@ async def _build_classifier_initial( # pylint: disable=inconsistent-return-stat _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(build_request, (IOBase, bytes)): - _content = build_request + if isinstance(copy_to_request, (IOBase, bytes)): + _content = copy_to_request else: - _content = json.dumps(build_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(copy_to_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_document_intelligence_administration_build_classifier_request( + _request = build_document_intelligence_administration_copy_classifier_to_request( + classifier_id=classifier_id, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -9356,7 +8488,7 @@ async def _build_classifier_initial( # pylint: disable=inconsistent-return-stat } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9364,8 +8496,10 @@ async def _build_classifier_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [202]: - if _stream: + try: await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -9374,22 +8508,28 @@ async def _build_classifier_initial( # pylint: disable=inconsistent-return-stat response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + deserialized = response.iter_bytes() + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - async def begin_build_classifier( + async def begin_copy_classifier_to( self, - build_request: _models.BuildDocumentClassifierRequest, + classifier_id: str, + copy_to_request: _models.ClassifierCopyAuthorization, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DocumentClassifierDetails]: - # pylint: disable=line-too-long - """Builds a custom document classifier. + """Copies document classifier to the target resource, region, and classifierId. - :param build_request: Build request parameters. Required. - :type build_request: ~azure.ai.documentintelligence.models.BuildDocumentClassifierRequest + :param classifier_id: Unique document classifier name. Required. + :type classifier_id: str + :param copy_to_request: Copy to request parameters. Required. + :type copy_to_request: ~azure.ai.documentintelligence.models.ClassifierCopyAuthorization :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9403,82 +8543,56 @@ async def begin_build_classifier( .. code-block:: python # JSON input template you can fill out and use as your body input. - build_request = { - "classifierId": "str", # Unique document classifier name. Required. - "docTypes": { - "str": { - "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. - }, - "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. - }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". - } - }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which to - train the classifier. - "description": "str" # Optional. Document classifier description. + copy_to_request = { + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetClassifierId": "str", + "targetClassifierLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to create this document classifier. - Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "sourceKind": "str" } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which the - classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document classifier will expire. + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } """ @overload - async def begin_build_classifier( - self, build_request: JSON, *, content_type: str = "application/json", **kwargs: Any + async def begin_copy_classifier_to( + self, classifier_id: str, copy_to_request: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DocumentClassifierDetails]: - # pylint: disable=line-too-long - """Builds a custom document classifier. + """Copies document classifier to the target resource, region, and classifierId. - :param build_request: Build request parameters. Required. - :type build_request: JSON + :param classifier_id: Unique document classifier name. Required. + :type classifier_id: str + :param copy_to_request: Copy to request parameters. Required. + :type copy_to_request: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -9493,55 +8607,45 @@ async def begin_build_classifier( # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to create this document classifier. - Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "sourceKind": "str" } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which the - classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document classifier will expire. + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } """ @overload - async def begin_build_classifier( - self, build_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + async def begin_copy_classifier_to( + self, classifier_id: str, copy_to_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DocumentClassifierDetails]: - # pylint: disable=line-too-long - """Builds a custom document classifier. + """Copies document classifier to the target resource, region, and classifierId. - :param build_request: Build request parameters. Required. - :type build_request: IO[bytes] + :param classifier_id: Unique document classifier name. Required. + :type classifier_id: str + :param copy_to_request: Copy to request parameters. Required. + :type copy_to_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -9556,56 +8660,49 @@ async def begin_build_classifier( # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to create this document classifier. - Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "sourceKind": "str" } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which the - classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document classifier will expire. + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } """ @distributed_trace_async - async def begin_build_classifier( - self, build_request: Union[_models.BuildDocumentClassifierRequest, JSON, IO[bytes]], **kwargs: Any + async def begin_copy_classifier_to( + self, + classifier_id: str, + copy_to_request: Union[_models.ClassifierCopyAuthorization, JSON, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.DocumentClassifierDetails]: - # pylint: disable=line-too-long - """Builds a custom document classifier. + """Copies document classifier to the target resource, region, and classifierId. - :param build_request: Build request parameters. Is one of the following types: - BuildDocumentClassifierRequest, JSON, IO[bytes] Required. - :type build_request: ~azure.ai.documentintelligence.models.BuildDocumentClassifierRequest or + :param classifier_id: Unique document classifier name. Required. + :type classifier_id: str + :param copy_to_request: Copy to request parameters. Is one of the following types: + ClassifierCopyAuthorization, JSON, IO[bytes] Required. + :type copy_to_request: ~azure.ai.documentintelligence.models.ClassifierCopyAuthorization or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns DocumentClassifierDetails. The DocumentClassifierDetails is compatible with MutableMapping @@ -9617,68 +8714,41 @@ async def begin_build_classifier( .. code-block:: python # JSON input template you can fill out and use as your body input. - build_request = { - "classifierId": "str", # Unique document classifier name. Required. - "docTypes": { - "str": { - "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. - }, - "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. - }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". - } - }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which to - train the classifier. - "description": "str" # Optional. Document classifier description. + copy_to_request = { + "accessToken": "str", + "expirationDateTime": "2020-02-20 00:00:00", + "targetClassifierId": "str", + "targetClassifierLocation": "str", + "targetResourceId": "str", + "targetResourceRegion": "str" } # response body for status code(s): 202 response == { - "apiVersion": "str", # API version used to create this document classifier. - Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "sourceKind": "str" } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which the - classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document classifier will expire. + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -9692,14 +8762,16 @@ async def begin_build_classifier( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._build_classifier_initial( # type: ignore - build_request=build_request, + raw_result = await self._copy_classifier_to_initial( + classifier_id=classifier_id, + copy_to_request=copy_to_request, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -9741,7 +8813,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_classifier(self, classifier_id: str, **kwargs: Any) -> _models.DocumentClassifierDetails: - # pylint: disable=line-too-long """Gets detailed document classifier information. :param classifier_id: Unique document classifier name. Required. @@ -9756,41 +8827,30 @@ async def get_classifier(self, classifier_id: str, **kwargs: Any) -> _models.Doc # response body for status code(s): 200 response == { - "apiVersion": "str", # API version used to create this document classifier. - Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "sourceKind": "str" } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which the - classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document classifier will expire. + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -9828,7 +8888,10 @@ async def get_classifier(self, classifier_id: str, **kwargs: Any) -> _models.Doc if response.status_code not in [200]: if _stream: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -9850,7 +8913,6 @@ async def get_classifier(self, classifier_id: str, **kwargs: Any) -> _models.Doc @distributed_trace def list_classifiers(self, **kwargs: Any) -> AsyncIterable["_models.DocumentClassifierDetails"]: - # pylint: disable=line-too-long """List all document classifiers. :return: An iterator like instance of DocumentClassifierDetails @@ -9863,41 +8925,30 @@ def list_classifiers(self, **kwargs: Any) -> AsyncIterable["_models.DocumentClas # response body for status code(s): 200 response == { - "apiVersion": "str", # API version used to create this document classifier. - Required. - "classifierId": "str", # Unique document classifier name. Required. - "createdDateTime": "2020-02-20 00:00:00", # Date and time (UTC) when the - document classifier was created. Required. + "apiVersion": "str", + "classifierId": "str", + "createdDateTime": "2020-02-20 00:00:00", "docTypes": { "str": { "azureBlobFileListSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "fileList": "str" # Path to a JSONL file within the - container specifying a subset of documents. Required. + "containerUrl": "str", + "fileList": "str" }, "azureBlobSource": { - "containerUrl": "str", # Azure Blob Storage - container URL. Required. - "prefix": "str" # Optional. Blob name prefix. + "containerUrl": "str", + "prefix": "str" }, - "sourceKind": "str" # Optional. Type of training data - source. Known values are: "url", "base64", "azureBlob", and - "azureBlobFileList". + "sourceKind": "str" } }, - "baseClassifierId": "str", # Optional. Base classifierId on top of which the - classifier was trained. - "description": "str", # Optional. Document classifier description. - "expirationDateTime": "2020-02-20 00:00:00", # Optional. Date and time (UTC) - when the document classifier will expire. + "baseClassifierId": "str", + "description": "str", + "expirationDateTime": "2020-02-20 00:00:00", "warnings": [ { - "code": "str", # One of a server-defined set of warning - codes. Required. - "message": "str", # A human-readable representation of the - warning. Required. - "target": "str" # Optional. The target of the error. + "code": "str", + "message": "str", + "target": "str" } ] } @@ -9969,8 +9020,6 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) @@ -10023,8 +9072,6 @@ async def delete_classifier( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error) diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_patch.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_patch.py index 3d539590a349d..0fd5d47bee95a 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_patch.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_patch.py @@ -27,7 +27,7 @@ class DocumentIntelligenceClient(DIClientGenerated): # pylint: disable=client-a :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-02-29-preview". Note that overriding this default value may result in unsupported + "2024-07-31-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -60,7 +60,7 @@ class DocumentIntelligenceAdministrationClient( :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-02-29-preview". Note that overriding this default value may result in unsupported + "2024-07-31-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/models/__init__.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/models/__init__.py index a00ce9aa8ddf6..1207ac80a628d 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/models/__init__.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/models/__init__.py @@ -7,18 +7,23 @@ # -------------------------------------------------------------------------- from ._models import AddressValue +from ._models import AnalyzeBatchDocumentsRequest +from ._models import AnalyzeBatchOperationDetail +from ._models import AnalyzeBatchResult +from ._models import AnalyzeBatchResultOperation from ._models import AnalyzeDocumentRequest from ._models import AnalyzeResult from ._models import AnalyzeResultOperation +from ._models import AuthorizeClassifierCopyRequest from ._models import AuthorizeCopyRequest from ._models import AzureBlobContentSource from ._models import AzureBlobFileListContentSource from ._models import BoundingRegion from ._models import BuildDocumentClassifierRequest from ._models import BuildDocumentModelRequest +from ._models import ClassifierCopyAuthorization from ._models import ClassifierDocumentTypeDetails from ._models import ClassifyDocumentRequest -from ._models import ComponentDocumentModelDetails from ._models import ComposeDocumentModelRequest from ._models import CopyAuthorization from ._models import CurrencyValue @@ -27,6 +32,7 @@ from ._models import DocumentBarcode from ._models import DocumentCaption from ._models import DocumentClassifierBuildOperationDetails +from ._models import DocumentClassifierCopyToOperationDetails from ._models import DocumentClassifierDetails from ._models import DocumentField from ._models import DocumentFieldSchema @@ -37,8 +43,6 @@ from ._models import DocumentKeyValuePair from ._models import DocumentLanguage from ._models import DocumentLine -from ._models import DocumentList -from ._models import DocumentListItem from ._models import DocumentModelBuildOperationDetails from ._models import DocumentModelComposeOperationDetails from ._models import DocumentModelCopyToOperationDetails @@ -57,10 +61,10 @@ from ._models import ErrorResponse from ._models import InnerError from ._models import OperationDetails -from ._models import QuotaDetails from ._models import ResourceDetails from ._models import Warning +from ._enums import AnalyzeOutputOption from ._enums import ContentFormat from ._enums import ContentSourceKind from ._enums import DocumentAnalysisFeature @@ -85,18 +89,23 @@ __all__ = [ "AddressValue", + "AnalyzeBatchDocumentsRequest", + "AnalyzeBatchOperationDetail", + "AnalyzeBatchResult", + "AnalyzeBatchResultOperation", "AnalyzeDocumentRequest", "AnalyzeResult", "AnalyzeResultOperation", + "AuthorizeClassifierCopyRequest", "AuthorizeCopyRequest", "AzureBlobContentSource", "AzureBlobFileListContentSource", "BoundingRegion", "BuildDocumentClassifierRequest", "BuildDocumentModelRequest", + "ClassifierCopyAuthorization", "ClassifierDocumentTypeDetails", "ClassifyDocumentRequest", - "ComponentDocumentModelDetails", "ComposeDocumentModelRequest", "CopyAuthorization", "CurrencyValue", @@ -105,6 +114,7 @@ "DocumentBarcode", "DocumentCaption", "DocumentClassifierBuildOperationDetails", + "DocumentClassifierCopyToOperationDetails", "DocumentClassifierDetails", "DocumentField", "DocumentFieldSchema", @@ -115,8 +125,6 @@ "DocumentKeyValuePair", "DocumentLanguage", "DocumentLine", - "DocumentList", - "DocumentListItem", "DocumentModelBuildOperationDetails", "DocumentModelComposeOperationDetails", "DocumentModelCopyToOperationDetails", @@ -135,9 +143,9 @@ "ErrorResponse", "InnerError", "OperationDetails", - "QuotaDetails", "ResourceDetails", "Warning", + "AnalyzeOutputOption", "ContentFormat", "ContentSourceKind", "DocumentAnalysisFeature", diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/models/_enums.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/models/_enums.py index 0f3a8b932af71..64c43bc8990c7 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/models/_enums.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/models/_enums.py @@ -10,6 +10,15 @@ from azure.core import CaseInsensitiveEnumMeta +class AnalyzeOutputOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Additional output to generate during analysis.""" + + PDF = "pdf" + """Generate searchable PDF output.""" + FIGURES = "figures" + """Generate cropped images of detected figures.""" + + class ContentFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Format of the content in analyzed result.""" @@ -98,6 +107,8 @@ class DocumentBuildMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Target documents with similar visual templates.""" NEURAL = "neural" """Support documents with diverse visual templates.""" + GENERATIVE = "generative" + """Enable documents of all types using generative AI techniques.""" class DocumentFieldType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -217,6 +228,9 @@ class OperationKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): DOCUMENT_MODEL_COPY_TO = "documentModelCopyTo" """Copy an existing document model to potentially a different resource, region, or subscription.""" + DOCUMENT_CLASSIFIER_COPY_TO = "documentClassifierCopyTo" + """Copy an existing document classifier to potentially a different resource, region, or + subscription.""" DOCUMENT_CLASSIFIER_BUILD = "documentClassifierBuild" """Build a new custom classifier model.""" diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/models/_models.py b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/models/_models.py index 220084e9648f3..ca357225b5aa9 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/models/_models.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/models/_models.py @@ -103,8 +103,212 @@ def __init__( suburb: Optional[str] = None, house: Optional[str] = None, level: Optional[str] = None, - ): - ... + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AnalyzeBatchDocumentsRequest(_model_base.Model): + """Batch document analysis parameters. + + All required parameters must be populated in order to send to server. + + :ivar azure_blob_source: Azure Blob Storage location containing the batch documents. Either + azureBlobSource or azureBlobFileListSource must be specified. + :vartype azure_blob_source: ~azure.ai.documentintelligence.models.AzureBlobContentSource + :ivar azure_blob_file_list_source: Azure Blob Storage file list specifying the batch documents. + Either + azureBlobSource or azureBlobFileListSource must be specified. + :vartype azure_blob_file_list_source: + ~azure.ai.documentintelligence.models.AzureBlobFileListContentSource + :ivar result_container_url: Azure Blob Storage container URL where analyze result files will be + stored. Required. + :vartype result_container_url: str + :ivar result_prefix: Blob name prefix of result files. + :vartype result_prefix: str + :ivar overwrite_existing: Overwrite existing analyze result files?. + :vartype overwrite_existing: bool + """ + + azure_blob_source: Optional["_models.AzureBlobContentSource"] = rest_field(name="azureBlobSource") + """Azure Blob Storage location containing the batch documents. Either + azureBlobSource or azureBlobFileListSource must be specified.""" + azure_blob_file_list_source: Optional["_models.AzureBlobFileListContentSource"] = rest_field( + name="azureBlobFileListSource" + ) + """Azure Blob Storage file list specifying the batch documents. Either + azureBlobSource or azureBlobFileListSource must be specified.""" + result_container_url: str = rest_field(name="resultContainerUrl") + """Azure Blob Storage container URL where analyze result files will be stored. Required.""" + result_prefix: Optional[str] = rest_field(name="resultPrefix") + """Blob name prefix of result files.""" + overwrite_existing: Optional[bool] = rest_field(name="overwriteExisting") + """Overwrite existing analyze result files?.""" + + @overload + def __init__( + self, + *, + result_container_url: str, + azure_blob_source: Optional["_models.AzureBlobContentSource"] = None, + azure_blob_file_list_source: Optional["_models.AzureBlobFileListContentSource"] = None, + result_prefix: Optional[str] = None, + overwrite_existing: Optional[bool] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AnalyzeBatchOperationDetail(_model_base.Model): + """Operation detail for a document in a batch analysis. + + + :ivar status: Analyze status. succeeded, failed, or skipped. Required. Known values are: + "notStarted", "running", "failed", "succeeded", "completed", and "canceled". + :vartype status: str or ~azure.ai.documentintelligence.models.OperationStatus + :ivar source_url: URL of the source document. Required. + :vartype source_url: str + :ivar result_url: URL of the analyze result JSON. + :vartype result_url: str + :ivar error: Encountered error. + :vartype error: ~azure.ai.documentintelligence.models.Error + """ + + status: Union[str, "_models.OperationStatus"] = rest_field() + """Analyze status. succeeded, failed, or skipped. Required. Known values are: \"notStarted\", + \"running\", \"failed\", \"succeeded\", \"completed\", and \"canceled\".""" + source_url: str = rest_field(name="sourceUrl") + """URL of the source document. Required.""" + result_url: Optional[str] = rest_field(name="resultUrl") + """URL of the analyze result JSON.""" + error: Optional["_models.Error"] = rest_field() + """Encountered error.""" + + @overload + def __init__( + self, + *, + status: Union[str, "_models.OperationStatus"], + source_url: str, + result_url: Optional[str] = None, + error: Optional["_models.Error"] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AnalyzeBatchResult(_model_base.Model): + """Batch document analysis result. + + + :ivar succeeded_count: Number of documents that completed with status succeeded. Required. + :vartype succeeded_count: int + :ivar failed_count: Number of documents that completed with status failed. Required. + :vartype failed_count: int + :ivar skipped_count: Number of documents that completed with status skipped. Required. + :vartype skipped_count: int + :ivar details: Operation detail for each document in the batch. Required. + :vartype details: list[~azure.ai.documentintelligence.models.AnalyzeBatchOperationDetail] + """ + + succeeded_count: int = rest_field(name="succeededCount") + """Number of documents that completed with status succeeded. Required.""" + failed_count: int = rest_field(name="failedCount") + """Number of documents that completed with status failed. Required.""" + skipped_count: int = rest_field(name="skippedCount") + """Number of documents that completed with status skipped. Required.""" + details: List["_models.AnalyzeBatchOperationDetail"] = rest_field() + """Operation detail for each document in the batch. Required.""" + + @overload + def __init__( + self, + *, + succeeded_count: int, + failed_count: int, + skipped_count: int, + details: List["_models.AnalyzeBatchOperationDetail"], + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AnalyzeBatchResultOperation(_model_base.Model): + """Status and result of the analyze batch operation. + + + :ivar status: Operation status. notStarted, running, completed, or failed. Required. Known + values are: "notStarted", "running", "failed", "succeeded", "completed", and "canceled". + :vartype status: str or ~azure.ai.documentintelligence.models.OperationStatus + :ivar created_date_time: Date and time (UTC) when the operation was submitted. Required. + :vartype created_date_time: ~datetime.datetime + :ivar last_updated_date_time: Date and time (UTC) when the status was last updated. Required. + :vartype last_updated_date_time: ~datetime.datetime + :ivar percent_completed: Operation progress (0-100). + :vartype percent_completed: int + :ivar error: Encountered error during batch document analysis. + :vartype error: ~azure.ai.documentintelligence.models.Error + :ivar result: Batch document analysis result. + :vartype result: ~azure.ai.documentintelligence.models.AnalyzeBatchResult + """ + + status: Union[str, "_models.OperationStatus"] = rest_field() + """Operation status. notStarted, running, completed, or failed. Required. Known values are: + \"notStarted\", \"running\", \"failed\", \"succeeded\", \"completed\", and \"canceled\".""" + created_date_time: datetime.datetime = rest_field(name="createdDateTime", format="rfc3339") + """Date and time (UTC) when the operation was submitted. Required.""" + last_updated_date_time: datetime.datetime = rest_field(name="lastUpdatedDateTime", format="rfc3339") + """Date and time (UTC) when the status was last updated. Required.""" + percent_completed: Optional[int] = rest_field(name="percentCompleted") + """Operation progress (0-100).""" + error: Optional["_models.Error"] = rest_field() + """Encountered error during batch document analysis.""" + result: Optional["_models.AnalyzeBatchResult"] = rest_field() + """Batch document analysis result.""" + + @overload + def __init__( + self, + *, + status: Union[str, "_models.OperationStatus"], + created_date_time: datetime.datetime, + last_updated_date_time: datetime.datetime, + percent_completed: Optional[int] = None, + error: Optional["_models.Error"] = None, + result: Optional["_models.AnalyzeBatchResult"] = None, + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -140,8 +344,7 @@ def __init__( *, url_source: Optional[str] = None, bytes_source: Optional[bytes] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -157,7 +360,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class AnalyzeResult(_model_base.Model): # pylint: disable=too-many-instance-attributes """Document analysis result. - All required parameters must be populated in order to send to server. :ivar api_version: API version used to produce this result. Required. :vartype api_version: str @@ -180,8 +382,6 @@ class AnalyzeResult(_model_base.Model): # pylint: disable=too-many-instance-att :vartype tables: list[~azure.ai.documentintelligence.models.DocumentTable] :ivar figures: Extracted figures. :vartype figures: list[~azure.ai.documentintelligence.models.DocumentFigure] - :ivar lists: Extracted lists. - :vartype lists: list[~azure.ai.documentintelligence.models.DocumentList] :ivar sections: Extracted sections. :vartype sections: list[~azure.ai.documentintelligence.models.DocumentSection] :ivar key_value_pairs: Extracted key-value pairs. @@ -192,6 +392,8 @@ class AnalyzeResult(_model_base.Model): # pylint: disable=too-many-instance-att :vartype languages: list[~azure.ai.documentintelligence.models.DocumentLanguage] :ivar documents: Extracted documents. :vartype documents: list[~azure.ai.documentintelligence.models.Document] + :ivar warnings: List of warnings encountered. + :vartype warnings: list[~azure.ai.documentintelligence.models.Warning] """ api_version: str = rest_field(name="apiVersion") @@ -214,8 +416,6 @@ class AnalyzeResult(_model_base.Model): # pylint: disable=too-many-instance-att """Extracted tables.""" figures: Optional[List["_models.DocumentFigure"]] = rest_field() """Extracted figures.""" - lists: Optional[List["_models.DocumentList"]] = rest_field() - """Extracted lists.""" sections: Optional[List["_models.DocumentSection"]] = rest_field() """Extracted sections.""" key_value_pairs: Optional[List["_models.DocumentKeyValuePair"]] = rest_field(name="keyValuePairs") @@ -226,6 +426,8 @@ class AnalyzeResult(_model_base.Model): # pylint: disable=too-many-instance-att """Detected languages.""" documents: Optional[List["_models.Document"]] = rest_field() """Extracted documents.""" + warnings: Optional[List["_models.Warning"]] = rest_field() + """List of warnings encountered.""" @overload def __init__( @@ -240,14 +442,13 @@ def __init__( paragraphs: Optional[List["_models.DocumentParagraph"]] = None, tables: Optional[List["_models.DocumentTable"]] = None, figures: Optional[List["_models.DocumentFigure"]] = None, - lists: Optional[List["_models.DocumentList"]] = None, sections: Optional[List["_models.DocumentSection"]] = None, key_value_pairs: Optional[List["_models.DocumentKeyValuePair"]] = None, styles: Optional[List["_models.DocumentStyle"]] = None, languages: Optional[List["_models.DocumentLanguage"]] = None, documents: Optional[List["_models.Document"]] = None, - ): - ... + warnings: Optional[List["_models.Warning"]] = None, + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -263,7 +464,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class AnalyzeResultOperation(_model_base.Model): """Status and result of the analyze operation. - All required parameters must be populated in order to send to server. :ivar status: Operation status. notStarted, running, succeeded, or failed. Required. Known values are: "notStarted", "running", "failed", "succeeded", "completed", and "canceled". @@ -300,8 +500,47 @@ def __init__( last_updated_date_time: datetime.datetime, error: Optional["_models.Error"] = None, analyze_result: Optional["_models.AnalyzeResult"] = None, - ): - ... + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class AuthorizeClassifierCopyRequest(_model_base.Model): + """Request body to authorize document classifier copy. + + All required parameters must be populated in order to send to server. + + :ivar classifier_id: Unique document classifier name. Required. + :vartype classifier_id: str + :ivar description: Document classifier description. + :vartype description: str + :ivar tags: List of key-value tag attributes associated with the document classifier. + :vartype tags: dict[str, str] + """ + + classifier_id: str = rest_field(name="classifierId") + """Unique document classifier name. Required.""" + description: Optional[str] = rest_field() + """Document classifier description.""" + tags: Optional[Dict[str, str]] = rest_field() + """List of key-value tag attributes associated with the document classifier.""" + + @overload + def __init__( + self, + *, + classifier_id: str, + description: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -341,8 +580,7 @@ def __init__( model_id: str, description: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -358,7 +596,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class AzureBlobContentSource(_model_base.Model): """Azure Blob Storage content. - All required parameters must be populated in order to send to server. :ivar container_url: Azure Blob Storage container URL. Required. :vartype container_url: str @@ -377,8 +614,7 @@ def __init__( *, container_url: str, prefix: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -394,7 +630,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class AzureBlobFileListContentSource(_model_base.Model): """File list in Azure Blob Storage. - All required parameters must be populated in order to send to server. :ivar container_url: Azure Blob Storage container URL. Required. :vartype container_url: str @@ -414,8 +649,7 @@ def __init__( *, container_url: str, file_list: str, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -431,7 +665,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class BoundingRegion(_model_base.Model): """Bounding polygon on a specific page of the input. - All required parameters must be populated in order to send to server. :ivar page_number: 1-based page number of page containing the bounding region. Required. :vartype page_number: int @@ -456,8 +689,7 @@ def __init__( *, page_number: int, polygon: List[float], - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -484,6 +716,8 @@ class BuildDocumentClassifierRequest(_model_base.Model): :ivar doc_types: List of document types to classify against. Required. :vartype doc_types: dict[str, ~azure.ai.documentintelligence.models.ClassifierDocumentTypeDetails] + :ivar allow_overwrite: Allow overwriting an existing classifier with the same name. + :vartype allow_overwrite: bool """ classifier_id: str = rest_field(name="classifierId") @@ -494,6 +728,8 @@ class BuildDocumentClassifierRequest(_model_base.Model): """Base classifierId on top of which to train the classifier.""" doc_types: Dict[str, "_models.ClassifierDocumentTypeDetails"] = rest_field(name="docTypes") """List of document types to classify against. Required.""" + allow_overwrite: Optional[bool] = rest_field(name="allowOverwrite") + """Allow overwriting an existing classifier with the same name.""" @overload def __init__( @@ -503,8 +739,8 @@ def __init__( doc_types: Dict[str, "_models.ClassifierDocumentTypeDetails"], description: Optional[str] = None, base_classifier_id: Optional[str] = None, - ): - ... + allow_overwrite: Optional[bool] = None, + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -526,8 +762,8 @@ class BuildDocumentModelRequest(_model_base.Model): :vartype model_id: str :ivar description: Document model description. :vartype description: str - :ivar build_mode: Custom document model build mode. Required. Known values are: "template" and - "neural". + :ivar build_mode: Custom document model build mode. Required. Known values are: "template", + "neural", and "generative". :vartype build_mode: str or ~azure.ai.documentintelligence.models.DocumentBuildMode :ivar azure_blob_source: Azure Blob Storage location containing the training data. Either azureBlobSource or azureBlobFileListSource must be specified. @@ -539,6 +775,11 @@ class BuildDocumentModelRequest(_model_base.Model): ~azure.ai.documentintelligence.models.AzureBlobFileListContentSource :ivar tags: List of key-value tag attributes associated with the document model. :vartype tags: dict[str, str] + :ivar max_training_hours: Max number of V100-equivalent GPU hours to use for model training. + Default=0.5. + :vartype max_training_hours: float + :ivar allow_overwrite: Allow overwriting an existing model with the same name. + :vartype allow_overwrite: bool """ model_id: str = rest_field(name="modelId") @@ -546,7 +787,8 @@ class BuildDocumentModelRequest(_model_base.Model): description: Optional[str] = rest_field() """Document model description.""" build_mode: Union[str, "_models.DocumentBuildMode"] = rest_field(name="buildMode") - """Custom document model build mode. Required. Known values are: \"template\" and \"neural\".""" + """Custom document model build mode. Required. Known values are: \"template\", \"neural\", and + \"generative\".""" azure_blob_source: Optional["_models.AzureBlobContentSource"] = rest_field(name="azureBlobSource") """Azure Blob Storage location containing the training data. Either azureBlobSource or azureBlobFileListSource must be specified.""" @@ -557,6 +799,10 @@ class BuildDocumentModelRequest(_model_base.Model): azureBlobSource or azureBlobFileListSource must be specified.""" tags: Optional[Dict[str, str]] = rest_field() """List of key-value tag attributes associated with the document model.""" + max_training_hours: Optional[float] = rest_field(name="maxTrainingHours") + """Max number of V100-equivalent GPU hours to use for model training. Default=0.5.""" + allow_overwrite: Optional[bool] = rest_field(name="allowOverwrite") + """Allow overwriting an existing model with the same name.""" @overload def __init__( @@ -568,8 +814,69 @@ def __init__( azure_blob_source: Optional["_models.AzureBlobContentSource"] = None, azure_blob_file_list_source: Optional["_models.AzureBlobFileListContentSource"] = None, tags: Optional[Dict[str, str]] = None, - ): - ... + max_training_hours: Optional[float] = None, + allow_overwrite: Optional[bool] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class ClassifierCopyAuthorization(_model_base.Model): + """Authorization to copy a document classifier to the specified target resource and + classifierId. + + + :ivar target_resource_id: ID of the target Azure resource where the document classifier should + be copied to. Required. + :vartype target_resource_id: str + :ivar target_resource_region: Location of the target Azure resource where the document + classifier should be copied + to. Required. + :vartype target_resource_region: str + :ivar target_classifier_id: Identifier of the target document classifier. Required. + :vartype target_classifier_id: str + :ivar target_classifier_location: URL of the copied document classifier in the target account. + Required. + :vartype target_classifier_location: str + :ivar access_token: Token used to authorize the request. Required. + :vartype access_token: str + :ivar expiration_date_time: Date/time when the access token expires. Required. + :vartype expiration_date_time: ~datetime.datetime + """ + + target_resource_id: str = rest_field(name="targetResourceId") + """ID of the target Azure resource where the document classifier should be copied to. Required.""" + target_resource_region: str = rest_field(name="targetResourceRegion") + """Location of the target Azure resource where the document classifier should be copied + to. Required.""" + target_classifier_id: str = rest_field(name="targetClassifierId") + """Identifier of the target document classifier. Required.""" + target_classifier_location: str = rest_field(name="targetClassifierLocation") + """URL of the copied document classifier in the target account. Required.""" + access_token: str = rest_field(name="accessToken") + """Token used to authorize the request. Required.""" + expiration_date_time: datetime.datetime = rest_field(name="expirationDateTime", format="rfc3339") + """Date/time when the access token expires. Required.""" + + @overload + def __init__( + self, + *, + target_resource_id: str, + target_resource_region: str, + target_classifier_id: str, + target_classifier_location: str, + access_token: str, + expiration_date_time: datetime.datetime, + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -622,8 +929,7 @@ def __init__( source_kind: Optional[Union[str, "_models.ContentSourceKind"]] = None, azure_blob_source: Optional["_models.AzureBlobContentSource"] = None, azure_blob_file_list_source: Optional["_models.AzureBlobFileListContentSource"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -660,39 +966,7 @@ def __init__( *, url_source: Optional[str] = None, bytes_source: Optional[bytes] = None, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class ComponentDocumentModelDetails(_model_base.Model): - """A component of a composed document model. - - All required parameters must be populated in order to send to server. - - :ivar model_id: Unique document model name. Required. - :vartype model_id: str - """ - - model_id: str = rest_field(name="modelId") - """Unique document model name. Required.""" - - @overload - def __init__( - self, - *, - model_id: str, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -714,9 +988,13 @@ class ComposeDocumentModelRequest(_model_base.Model): :vartype model_id: str :ivar description: Document model description. :vartype description: str - :ivar component_models: List of component document models to compose. Required. - :vartype component_models: - list[~azure.ai.documentintelligence.models.ComponentDocumentModelDetails] + :ivar classifier_id: Custom classifier to split and classify the input file. Required. + :vartype classifier_id: str + :ivar split: File splitting behavior. Known values are: "auto", "none", and "perPage". + :vartype split: str or ~azure.ai.documentintelligence.models.SplitMode + :ivar doc_types: Dictionary mapping supported docTypes to the corresponding document models. + Required. + :vartype doc_types: dict[str, ~azure.ai.documentintelligence.models.DocumentTypeDetails] :ivar tags: List of key-value tag attributes associated with the document model. :vartype tags: dict[str, str] """ @@ -725,8 +1003,12 @@ class ComposeDocumentModelRequest(_model_base.Model): """Unique document model name. Required.""" description: Optional[str] = rest_field() """Document model description.""" - component_models: List["_models.ComponentDocumentModelDetails"] = rest_field(name="componentModels") - """List of component document models to compose. Required.""" + classifier_id: str = rest_field(name="classifierId") + """Custom classifier to split and classify the input file. Required.""" + split: Optional[Union[str, "_models.SplitMode"]] = rest_field() + """File splitting behavior. Known values are: \"auto\", \"none\", and \"perPage\".""" + doc_types: Dict[str, "_models.DocumentTypeDetails"] = rest_field(name="docTypes") + """Dictionary mapping supported docTypes to the corresponding document models. Required.""" tags: Optional[Dict[str, str]] = rest_field() """List of key-value tag attributes associated with the document model.""" @@ -735,11 +1017,12 @@ def __init__( self, *, model_id: str, - component_models: List["_models.ComponentDocumentModelDetails"], + classifier_id: str, + doc_types: Dict[str, "_models.DocumentTypeDetails"], description: Optional[str] = None, + split: Optional[Union[str, "_models.SplitMode"]] = None, tags: Optional[Dict[str, str]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -756,7 +1039,6 @@ class CopyAuthorization(_model_base.Model): """Authorization to copy a document model to the specified target resource and modelId. - All required parameters must be populated in order to send to server. :ivar target_resource_id: ID of the target Azure resource where the document model should be copied to. Required. @@ -799,8 +1081,7 @@ def __init__( target_model_location: str, access_token: str, expiration_date_time: datetime.datetime, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -816,7 +1097,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class CurrencyValue(_model_base.Model): """Currency field value. - All required parameters must be populated in order to send to server. :ivar amount: Currency amount. Required. :vartype amount: float @@ -840,8 +1120,7 @@ def __init__( amount: float, currency_symbol: Optional[str] = None, currency_code: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -857,7 +1136,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class CustomDocumentModelsDetails(_model_base.Model): """Details regarding custom document models. - All required parameters must be populated in order to send to server. :ivar count: Number of custom document models in the current resource. Required. :vartype count: int @@ -877,8 +1155,7 @@ def __init__( *, count: int, limit: int, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -894,7 +1171,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class Document(_model_base.Model): """An object describing the location and semantic content of a document. - All required parameters must be populated in order to send to server. :ivar doc_type: Document type. Required. :vartype doc_type: str @@ -928,8 +1204,7 @@ def __init__( confidence: float, bounding_regions: Optional[List["_models.BoundingRegion"]] = None, fields: Optional[Dict[str, "_models.DocumentField"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -945,7 +1220,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentBarcode(_model_base.Model): """A barcode object. - All required parameters must be populated in order to send to server. :ivar kind: Barcode kind. Required. Known values are: "QRCode", "PDF417", "UPCA", "UPCE", "Code39", "Code128", "EAN8", "EAN13", "DataBar", "Code93", "Codabar", "DataBarExpanded", "ITF", @@ -989,8 +1263,7 @@ def __init__( span: "_models.DocumentSpan", confidence: float, polygon: Optional[List[float]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1006,7 +1279,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentCaption(_model_base.Model): """A caption object describing a table or figure. - All required parameters must be populated in order to send to server. :ivar content: Content of the caption. Required. :vartype content: str @@ -1035,8 +1307,7 @@ def __init__( spans: List["_models.DocumentSpan"], bounding_regions: Optional[List["_models.BoundingRegion"]] = None, elements: Optional[List[str]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1053,10 +1324,10 @@ class OperationDetails(_model_base.Model): """Operation info. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - DocumentClassifierBuildOperationDetails, DocumentModelComposeOperationDetails, + DocumentClassifierBuildOperationDetails, DocumentClassifierCopyToOperationDetails, + DocumentModelBuildOperationDetails, DocumentModelComposeOperationDetails, DocumentModelCopyToOperationDetails - All required parameters must be populated in order to send to server. :ivar operation_id: Operation ID. Required. :vartype operation_id: str @@ -1070,7 +1341,8 @@ class OperationDetails(_model_base.Model): :ivar last_updated_date_time: Date and time (UTC) when the status was last updated. Required. :vartype last_updated_date_time: ~datetime.datetime :ivar kind: Type of operation. Required. Known values are: "documentModelBuild", - "documentModelCompose", "documentModelCopyTo", and "documentClassifierBuild". + "documentModelCompose", "documentModelCopyTo", "documentClassifierCopyTo", and + "documentClassifierBuild". :vartype kind: str or ~azure.ai.documentintelligence.models.OperationKind :ivar resource_location: URL of the resource targeted by this operation. Required. :vartype resource_location: str @@ -1096,7 +1368,8 @@ class OperationDetails(_model_base.Model): """Date and time (UTC) when the status was last updated. Required.""" kind: str = rest_discriminator(name="kind") """Type of operation. Required. Known values are: \"documentModelBuild\", - \"documentModelCompose\", \"documentModelCopyTo\", and \"documentClassifierBuild\".""" + \"documentModelCompose\", \"documentModelCopyTo\", \"documentClassifierCopyTo\", and + \"documentClassifierBuild\".""" resource_location: str = rest_field(name="resourceLocation") """URL of the resource targeted by this operation. Required.""" api_version: Optional[str] = rest_field(name="apiVersion") @@ -1120,8 +1393,7 @@ def __init__( api_version: Optional[str] = None, tags: Optional[Dict[str, str]] = None, error: Optional["_models.Error"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1139,7 +1411,6 @@ class DocumentClassifierBuildOperationDetails( ): # pylint: disable=too-many-instance-attributes """Get Operation response object. - All required parameters must be populated in order to send to server. :ivar operation_id: Operation ID. Required. :vartype operation_id: str @@ -1185,8 +1456,7 @@ def __init__( tags: Optional[Dict[str, str]] = None, error: Optional["_models.Error"] = None, result: Optional["_models.DocumentClassifierDetails"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1199,10 +1469,76 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, kind=OperationKind.DOCUMENT_CLASSIFIER_BUILD, **kwargs) +class DocumentClassifierCopyToOperationDetails( + OperationDetails, discriminator="documentClassifierCopyTo" +): # pylint: disable=too-many-instance-attributes + """Get Operation response object. + + + :ivar operation_id: Operation ID. Required. + :vartype operation_id: str + :ivar status: Operation status. notStarted, running, completed, or failed. Required. Known + values are: "notStarted", "running", "failed", "succeeded", "completed", and "canceled". + :vartype status: str or ~azure.ai.documentintelligence.models.OperationStatus + :ivar percent_completed: Operation progress (0-100). + :vartype percent_completed: int + :ivar created_date_time: Date and time (UTC) when the operation was created. Required. + :vartype created_date_time: ~datetime.datetime + :ivar last_updated_date_time: Date and time (UTC) when the status was last updated. Required. + :vartype last_updated_date_time: ~datetime.datetime + :ivar resource_location: URL of the resource targeted by this operation. Required. + :vartype resource_location: str + :ivar api_version: API version used to create this operation. + :vartype api_version: str + :ivar tags: List of key-value tag attributes associated with the document model. + :vartype tags: dict[str, str] + :ivar error: Encountered error. + :vartype error: ~azure.ai.documentintelligence.models.Error + :ivar result: Operation result upon success. + :vartype result: ~azure.ai.documentintelligence.models.DocumentClassifierDetails + :ivar kind: Type of operation. Required. Copy an existing document classifier to potentially a + different resource, region, or + subscription. + :vartype kind: str or ~azure.ai.documentintelligence.models.DOCUMENT_CLASSIFIER_COPY_TO + """ + + result: Optional["_models.DocumentClassifierDetails"] = rest_field() + """Operation result upon success.""" + kind: Literal[OperationKind.DOCUMENT_CLASSIFIER_COPY_TO] = rest_discriminator(name="kind") # type: ignore + """Type of operation. Required. Copy an existing document classifier to potentially a different + resource, region, or + subscription.""" + + @overload + def __init__( + self, + *, + operation_id: str, + status: Union[str, "_models.OperationStatus"], + created_date_time: datetime.datetime, + last_updated_date_time: datetime.datetime, + resource_location: str, + percent_completed: Optional[int] = None, + api_version: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + error: Optional["_models.Error"] = None, + result: Optional["_models.DocumentClassifierDetails"] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, kind=OperationKind.DOCUMENT_CLASSIFIER_COPY_TO, **kwargs) + + class DocumentClassifierDetails(_model_base.Model): """Document classifier info. - All required parameters must be populated in order to send to server. :ivar classifier_id: Unique document classifier name. Required. :vartype classifier_id: str @@ -1253,8 +1589,7 @@ def __init__( expiration_date_time: Optional[datetime.datetime] = None, base_classifier_id: Optional[str] = None, warnings: Optional[List["_models.Warning"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1270,7 +1605,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentField(_model_base.Model): # pylint: disable=too-many-instance-attributes """An object representing the content and location of a field value. - All required parameters must be populated in order to send to server. :ivar type: Data type of the field value. Required. Known values are: "string", "date", "time", "phoneNumber", "number", "integer", "selectionMark", "countryRegion", "signature", "array", @@ -1387,8 +1721,7 @@ def __init__( bounding_regions: Optional[List["_models.BoundingRegion"]] = None, spans: Optional[List["_models.DocumentSpan"]] = None, confidence: Optional[float] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1404,7 +1737,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentFieldSchema(_model_base.Model): """Description of the field semantic schema using a JSON Schema style syntax. - All required parameters must be populated in order to send to server. :ivar type: Semantic data type of the field value. Required. Known values are: "string", "date", "time", "phoneNumber", "number", "integer", "selectionMark", "countryRegion", @@ -1443,8 +1775,7 @@ def __init__( example: Optional[str] = None, items_property: Optional["_models.DocumentFieldSchema"] = None, properties: Optional[Dict[str, "_models.DocumentFieldSchema"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1460,7 +1791,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentFigure(_model_base.Model): """An object representing a figure in the document. - All required parameters must be populated in order to send to server. :ivar bounding_regions: Bounding regions covering the figure. :vartype bounding_regions: list[~azure.ai.documentintelligence.models.BoundingRegion] @@ -1472,6 +1802,8 @@ class DocumentFigure(_model_base.Model): :vartype caption: ~azure.ai.documentintelligence.models.DocumentCaption :ivar footnotes: List of footnotes associated with the figure. :vartype footnotes: list[~azure.ai.documentintelligence.models.DocumentFootnote] + :ivar id: Figure ID. + :vartype id: str """ bounding_regions: Optional[List["_models.BoundingRegion"]] = rest_field(name="boundingRegions") @@ -1484,6 +1816,8 @@ class DocumentFigure(_model_base.Model): """Caption associated with the figure.""" footnotes: Optional[List["_models.DocumentFootnote"]] = rest_field() """List of footnotes associated with the figure.""" + id: Optional[str] = rest_field() + """Figure ID.""" @overload def __init__( @@ -1494,8 +1828,8 @@ def __init__( elements: Optional[List[str]] = None, caption: Optional["_models.DocumentCaption"] = None, footnotes: Optional[List["_models.DocumentFootnote"]] = None, - ): - ... + id: Optional[str] = None, # pylint: disable=redefined-builtin + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1511,7 +1845,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentFootnote(_model_base.Model): """A footnote object describing a table or figure. - All required parameters must be populated in order to send to server. :ivar content: Content of the footnote. Required. :vartype content: str @@ -1540,8 +1873,7 @@ def __init__( spans: List["_models.DocumentSpan"], bounding_regions: Optional[List["_models.BoundingRegion"]] = None, elements: Optional[List[str]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1557,7 +1889,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentFormula(_model_base.Model): """A formula object. - All required parameters must be populated in order to send to server. :ivar kind: Formula kind. Required. Known values are: "inline" and "display". :vartype kind: str or ~azure.ai.documentintelligence.models.DocumentFormulaKind @@ -1597,8 +1928,7 @@ def __init__( span: "_models.DocumentSpan", confidence: float, polygon: Optional[List[float]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1614,7 +1944,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentKeyValueElement(_model_base.Model): """An object representing the field key or value in a key-value pair. - All required parameters must be populated in order to send to server. :ivar content: Concatenated content of the key-value element in reading order. Required. :vartype content: str @@ -1639,8 +1968,7 @@ def __init__( content: str, spans: List["_models.DocumentSpan"], bounding_regions: Optional[List["_models.BoundingRegion"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1657,7 +1985,6 @@ class DocumentKeyValuePair(_model_base.Model): """An object representing a form field with distinct field label (key) and field value (may be empty). - All required parameters must be populated in order to send to server. :ivar key: Field label of the key-value pair. Required. :vartype key: ~azure.ai.documentintelligence.models.DocumentKeyValueElement @@ -1681,8 +2008,7 @@ def __init__( key: "_models.DocumentKeyValueElement", confidence: float, value: Optional["_models.DocumentKeyValueElement"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1698,7 +2024,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentLanguage(_model_base.Model): """An object representing the detected language for a given text span. - All required parameters must be populated in order to send to server. :ivar locale: Detected language. Value may an ISO 639-1 language code (ex. "en", "fr") or BCP 47 language tag (ex. "zh-Hans"). Required. @@ -1726,8 +2051,7 @@ def __init__( locale: str, spans: List["_models.DocumentSpan"], confidence: float, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1744,7 +2068,6 @@ class DocumentLine(_model_base.Model): """A content line object consisting of an adjacent sequence of content elements, such as words and selection marks. - All required parameters must be populated in order to send to server. :ivar content: Concatenated content of the contained elements in reading order. Required. :vartype content: str @@ -1774,95 +2097,7 @@ def __init__( content: str, spans: List["_models.DocumentSpan"], polygon: Optional[List[float]] = None, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class DocumentList(_model_base.Model): - """An object representing a list in the document. - - All required parameters must be populated in order to send to server. - - :ivar spans: Location of the list in the reading order concatenated content. Required. - :vartype spans: list[~azure.ai.documentintelligence.models.DocumentSpan] - :ivar items_property: Items in the list. Required. - :vartype items_property: list[~azure.ai.documentintelligence.models.DocumentListItem] - """ - - spans: List["_models.DocumentSpan"] = rest_field() - """Location of the list in the reading order concatenated content. Required.""" - items_property: List["_models.DocumentListItem"] = rest_field(name="items") - """Items in the list. Required.""" - - @overload - def __init__( - self, - *, - spans: List["_models.DocumentSpan"], - items_property: List["_models.DocumentListItem"], - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class DocumentListItem(_model_base.Model): - """An object representing a list item in the document. - - All required parameters must be populated in order to send to server. - - :ivar level: Level of the list item (1-indexed). Required. - :vartype level: int - :ivar content: Content of the list item. Required. - :vartype content: str - :ivar bounding_regions: Bounding regions covering the list item. - :vartype bounding_regions: list[~azure.ai.documentintelligence.models.BoundingRegion] - :ivar spans: Location of the list item in the reading order concatenated content. Required. - :vartype spans: list[~azure.ai.documentintelligence.models.DocumentSpan] - :ivar elements: Child elements of the list item. - :vartype elements: list[str] - """ - - level: int = rest_field() - """Level of the list item (1-indexed). Required.""" - content: str = rest_field() - """Content of the list item. Required.""" - bounding_regions: Optional[List["_models.BoundingRegion"]] = rest_field(name="boundingRegions") - """Bounding regions covering the list item.""" - spans: List["_models.DocumentSpan"] = rest_field() - """Location of the list item in the reading order concatenated content. Required.""" - elements: Optional[List[str]] = rest_field() - """Child elements of the list item.""" - - @overload - def __init__( - self, - *, - level: int, - content: str, - spans: List["_models.DocumentSpan"], - bounding_regions: Optional[List["_models.BoundingRegion"]] = None, - elements: Optional[List[str]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1875,10 +2110,11 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class DocumentModelBuildOperationDetails(OperationDetails): # pylint: disable=too-many-instance-attributes +class DocumentModelBuildOperationDetails( + OperationDetails, discriminator="documentModelBuild" +): # pylint: disable=too-many-instance-attributes """Get Operation response object. - All required parameters must be populated in order to send to server. :ivar operation_id: Operation ID. Required. :vartype operation_id: str @@ -1907,7 +2143,7 @@ class DocumentModelBuildOperationDetails(OperationDetails): # pylint: disable=t result: Optional["_models.DocumentModelDetails"] = rest_field() """Operation result upon success.""" - kind: Literal[OperationKind.DOCUMENT_MODEL_BUILD] = rest_field() + kind: Literal[OperationKind.DOCUMENT_MODEL_BUILD] = rest_discriminator(name="kind") # type: ignore """Type of operation. Required. Build a new custom document model.""" @overload @@ -1919,14 +2155,12 @@ def __init__( created_date_time: datetime.datetime, last_updated_date_time: datetime.datetime, resource_location: str, - kind: Literal[OperationKind.DOCUMENT_MODEL_BUILD], percent_completed: Optional[int] = None, api_version: Optional[str] = None, tags: Optional[Dict[str, str]] = None, error: Optional["_models.Error"] = None, result: Optional["_models.DocumentModelDetails"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1936,7 +2170,7 @@ def __init__(self, mapping: Mapping[str, Any]): """ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) + super().__init__(*args, kind=OperationKind.DOCUMENT_MODEL_BUILD, **kwargs) class DocumentModelComposeOperationDetails( @@ -1944,7 +2178,6 @@ class DocumentModelComposeOperationDetails( ): # pylint: disable=too-many-instance-attributes """Get Operation response object. - All required parameters must be populated in order to send to server. :ivar operation_id: Operation ID. Required. :vartype operation_id: str @@ -1991,8 +2224,7 @@ def __init__( tags: Optional[Dict[str, str]] = None, error: Optional["_models.Error"] = None, result: Optional["_models.DocumentModelDetails"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2010,7 +2242,6 @@ class DocumentModelCopyToOperationDetails( ): # pylint: disable=too-many-instance-attributes """Get Operation response object. - All required parameters must be populated in order to send to server. :ivar operation_id: Operation ID. Required. :vartype operation_id: str @@ -2060,8 +2291,7 @@ def __init__( tags: Optional[Dict[str, str]] = None, error: Optional["_models.Error"] = None, result: Optional["_models.DocumentModelDetails"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2077,7 +2307,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentModelDetails(_model_base.Model): # pylint: disable=too-many-instance-attributes """Document model info. - All required parameters must be populated in order to send to server. + Readonly variables are only populated by the server, and will be ignored when sending a request. + :ivar model_id: Unique document model name. Required. :vartype model_id: str @@ -2091,7 +2322,8 @@ class DocumentModelDetails(_model_base.Model): # pylint: disable=too-many-insta :vartype api_version: str :ivar tags: List of key-value tag attributes associated with the document model. :vartype tags: dict[str, str] - :ivar build_mode: Custom document model build mode. Known values are: "template" and "neural". + :ivar build_mode: Custom document model build mode. Known values are: "template", "neural", and + "generative". :vartype build_mode: str or ~azure.ai.documentintelligence.models.DocumentBuildMode :ivar azure_blob_source: Azure Blob Storage location containing the training data. Either azureBlobSource or azureBlobFileListSource must be specified. @@ -2101,56 +2333,69 @@ class DocumentModelDetails(_model_base.Model): # pylint: disable=too-many-insta azureBlobSource or azureBlobFileListSource must be specified. :vartype azure_blob_file_list_source: ~azure.ai.documentintelligence.models.AzureBlobFileListContentSource + :ivar classifier_id: For composed models, the custom classifier to split and classify the input + file. + :vartype classifier_id: str + :ivar split: For composed models, the file splitting behavior. Known values are: "auto", + "none", and "perPage". + :vartype split: str or ~azure.ai.documentintelligence.models.SplitMode :ivar doc_types: Supported document types. :vartype doc_types: dict[str, ~azure.ai.documentintelligence.models.DocumentTypeDetails] :ivar warnings: List of warnings encountered while building the model. :vartype warnings: list[~azure.ai.documentintelligence.models.Warning] + :ivar training_hours: Number of V100-equivalent GPU hours consumed for model training. + :vartype training_hours: float """ model_id: str = rest_field(name="modelId", visibility=["read", "create"]) """Unique document model name. Required.""" description: Optional[str] = rest_field() """Document model description.""" - created_date_time: datetime.datetime = rest_field(name="createdDateTime", format="rfc3339") + created_date_time: datetime.datetime = rest_field(name="createdDateTime", visibility=["read"], format="rfc3339") """Date and time (UTC) when the document model was created. Required.""" - expiration_date_time: Optional[datetime.datetime] = rest_field(name="expirationDateTime", format="rfc3339") + expiration_date_time: Optional[datetime.datetime] = rest_field( + name="expirationDateTime", visibility=["read"], format="rfc3339" + ) """Date and time (UTC) when the document model will expire.""" - api_version: Optional[str] = rest_field(name="apiVersion") + api_version: Optional[str] = rest_field(name="apiVersion", visibility=["read"]) """API version used to create this document model.""" tags: Optional[Dict[str, str]] = rest_field() """List of key-value tag attributes associated with the document model.""" - build_mode: Optional[Union[str, "_models.DocumentBuildMode"]] = rest_field(name="buildMode") - """Custom document model build mode. Known values are: \"template\" and \"neural\".""" - azure_blob_source: Optional["_models.AzureBlobContentSource"] = rest_field(name="azureBlobSource") + build_mode: Optional[Union[str, "_models.DocumentBuildMode"]] = rest_field(name="buildMode", visibility=["read"]) + """Custom document model build mode. Known values are: \"template\", \"neural\", and + \"generative\".""" + azure_blob_source: Optional["_models.AzureBlobContentSource"] = rest_field( + name="azureBlobSource", visibility=["read"] + ) """Azure Blob Storage location containing the training data. Either azureBlobSource or azureBlobFileListSource must be specified.""" azure_blob_file_list_source: Optional["_models.AzureBlobFileListContentSource"] = rest_field( - name="azureBlobFileListSource" + name="azureBlobFileListSource", visibility=["read"] ) """Azure Blob Storage file list specifying the training data. Either azureBlobSource or azureBlobFileListSource must be specified.""" - doc_types: Optional[Dict[str, "_models.DocumentTypeDetails"]] = rest_field(name="docTypes") + classifier_id: Optional[str] = rest_field(name="classifierId") + """For composed models, the custom classifier to split and classify the input file.""" + split: Optional[Union[str, "_models.SplitMode"]] = rest_field() + """For composed models, the file splitting behavior. Known values are: \"auto\", \"none\", and + \"perPage\".""" + doc_types: Optional[Dict[str, "_models.DocumentTypeDetails"]] = rest_field(name="docTypes", visibility=["read"]) """Supported document types.""" - warnings: Optional[List["_models.Warning"]] = rest_field() + warnings: Optional[List["_models.Warning"]] = rest_field(visibility=["read"]) """List of warnings encountered while building the model.""" + training_hours: Optional[float] = rest_field(name="trainingHours", visibility=["read"]) + """Number of V100-equivalent GPU hours consumed for model training.""" @overload def __init__( self, *, model_id: str, - created_date_time: datetime.datetime, description: Optional[str] = None, - expiration_date_time: Optional[datetime.datetime] = None, - api_version: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - build_mode: Optional[Union[str, "_models.DocumentBuildMode"]] = None, - azure_blob_source: Optional["_models.AzureBlobContentSource"] = None, - azure_blob_file_list_source: Optional["_models.AzureBlobFileListContentSource"] = None, - doc_types: Optional[Dict[str, "_models.DocumentTypeDetails"]] = None, - warnings: Optional[List["_models.Warning"]] = None, - ): - ... + classifier_id: Optional[str] = None, + split: Optional[Union[str, "_models.SplitMode"]] = None, + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2166,7 +2411,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentPage(_model_base.Model): # pylint: disable=too-many-instance-attributes """Content and layout elements extracted from a page from the input. - All required parameters must be populated in order to send to server. :ivar page_number: 1-based page number in the input document. Required. :vartype page_number: int @@ -2236,8 +2480,7 @@ def __init__( lines: Optional[List["_models.DocumentLine"]] = None, barcodes: Optional[List["_models.DocumentBarcode"]] = None, formulas: Optional[List["_models.DocumentFormula"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2254,7 +2497,6 @@ class DocumentParagraph(_model_base.Model): """A paragraph object consisting with contiguous lines generally with common alignment and spacing. - All required parameters must be populated in order to send to server. :ivar role: Semantic role of the paragraph. Known values are: "pageHeader", "pageFooter", "pageNumber", "title", "sectionHeading", "footnote", and "formulaBlock". @@ -2285,8 +2527,7 @@ def __init__( spans: List["_models.DocumentSpan"], role: Optional[Union[str, "_models.ParagraphRole"]] = None, bounding_regions: Optional[List["_models.BoundingRegion"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2302,7 +2543,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentSection(_model_base.Model): """An object representing a section in the document. - All required parameters must be populated in order to send to server. :ivar spans: Location of the section in the reading order concatenated content. Required. :vartype spans: list[~azure.ai.documentintelligence.models.DocumentSpan] @@ -2321,8 +2561,7 @@ def __init__( *, spans: List["_models.DocumentSpan"], elements: Optional[List[str]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2339,7 +2578,6 @@ class DocumentSelectionMark(_model_base.Model): """A selection mark object representing check boxes, radio buttons, and other elements indicating a selection. - All required parameters must be populated in order to send to server. :ivar state: State of the selection mark. Required. Known values are: "selected" and "unselected". @@ -2375,8 +2613,7 @@ def __init__( span: "_models.DocumentSpan", confidence: float, polygon: Optional[List[float]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2393,7 +2630,6 @@ class DocumentSpan(_model_base.Model): """Contiguous region of the concatenated content property, specified as an offset and length. - All required parameters must be populated in order to send to server. :ivar offset: Zero-based index of the content represented by the span. Required. :vartype offset: int @@ -2412,8 +2648,7 @@ def __init__( *, offset: int, length: int, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2429,7 +2664,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentStyle(_model_base.Model): """An object representing observed text styles. - All required parameters must be populated in order to send to server. :ivar is_handwritten: Is content handwritten?. :vartype is_handwritten: bool @@ -2482,8 +2716,7 @@ def __init__( font_weight: Optional[Union[str, "_models.FontWeight"]] = None, color: Optional[str] = None, background_color: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2499,7 +2732,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentTable(_model_base.Model): """A table object consisting table cells arranged in a rectangular layout. - All required parameters must be populated in order to send to server. :ivar row_count: Number of rows in the table. Required. :vartype row_count: int @@ -2543,8 +2775,7 @@ def __init__( bounding_regions: Optional[List["_models.BoundingRegion"]] = None, caption: Optional["_models.DocumentCaption"] = None, footnotes: Optional[List["_models.DocumentFootnote"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2560,7 +2791,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentTableCell(_model_base.Model): """An object representing the location and content of a table cell. - All required parameters must be populated in order to send to server. :ivar kind: Table cell kind. Known values are: "content", "rowHeader", "columnHeader", "stubHead", and "description". @@ -2616,8 +2846,7 @@ def __init__( column_span: Optional[int] = None, bounding_regions: Optional[List["_models.BoundingRegion"]] = None, elements: Optional[List[str]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2633,38 +2862,63 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DocumentTypeDetails(_model_base.Model): """Document type info. - All required parameters must be populated in order to send to server. - :ivar description: Document model description. :vartype description: str - :ivar build_mode: Custom document model build mode. Known values are: "template" and "neural". + :ivar build_mode: Custom document model build mode. Known values are: "template", "neural", and + "generative". :vartype build_mode: str or ~azure.ai.documentintelligence.models.DocumentBuildMode :ivar field_schema: Description of the document semantic schema using a JSON Schema style - syntax. Required. + syntax. :vartype field_schema: dict[str, ~azure.ai.documentintelligence.models.DocumentFieldSchema] :ivar field_confidence: Estimated confidence for each field. :vartype field_confidence: dict[str, float] + :ivar model_id: Document model to use for analyzing documents with specified type. + :vartype model_id: str + :ivar confidence_threshold: Only perform analysis if docType confidence is above threshold. + :vartype confidence_threshold: float + :ivar features: List of optional analysis features. + :vartype features: list[str or ~azure.ai.documentintelligence.models.DocumentAnalysisFeature] + :ivar query_fields: List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber". + :vartype query_fields: list[str] + :ivar max_documents_to_analyze: Maximum number of documents of specified type to analyze. + Default=all. + :vartype max_documents_to_analyze: int """ description: Optional[str] = rest_field() """Document model description.""" build_mode: Optional[Union[str, "_models.DocumentBuildMode"]] = rest_field(name="buildMode") - """Custom document model build mode. Known values are: \"template\" and \"neural\".""" - field_schema: Dict[str, "_models.DocumentFieldSchema"] = rest_field(name="fieldSchema") - """Description of the document semantic schema using a JSON Schema style syntax. Required.""" + """Custom document model build mode. Known values are: \"template\", \"neural\", and + \"generative\".""" + field_schema: Optional[Dict[str, "_models.DocumentFieldSchema"]] = rest_field(name="fieldSchema") + """Description of the document semantic schema using a JSON Schema style syntax.""" field_confidence: Optional[Dict[str, float]] = rest_field(name="fieldConfidence") """Estimated confidence for each field.""" + model_id: Optional[str] = rest_field(name="modelId") + """Document model to use for analyzing documents with specified type.""" + confidence_threshold: Optional[float] = rest_field(name="confidenceThreshold") + """Only perform analysis if docType confidence is above threshold.""" + features: Optional[List[Union[str, "_models.DocumentAnalysisFeature"]]] = rest_field() + """List of optional analysis features.""" + query_fields: Optional[List[str]] = rest_field(name="queryFields") + """List of additional fields to extract. Ex. \"NumberOfGuests,StoreNumber\".""" + max_documents_to_analyze: Optional[int] = rest_field(name="maxDocumentsToAnalyze") + """Maximum number of documents of specified type to analyze. Default=all.""" @overload def __init__( self, *, - field_schema: Dict[str, "_models.DocumentFieldSchema"], description: Optional[str] = None, build_mode: Optional[Union[str, "_models.DocumentBuildMode"]] = None, + field_schema: Optional[Dict[str, "_models.DocumentFieldSchema"]] = None, field_confidence: Optional[Dict[str, float]] = None, - ): - ... + model_id: Optional[str] = None, + confidence_threshold: Optional[float] = None, + features: Optional[List[Union[str, "_models.DocumentAnalysisFeature"]]] = None, + query_fields: Optional[List[str]] = None, + max_documents_to_analyze: Optional[int] = None, + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2682,7 +2936,6 @@ class DocumentWord(_model_base.Model): delimited languages, such as Chinese, Japanese, and Korean, each character is represented as its own word. - All required parameters must be populated in order to send to server. :ivar content: Text content of the word. Required. :vartype content: str @@ -2717,8 +2970,7 @@ def __init__( span: "_models.DocumentSpan", confidence: float, polygon: Optional[List[float]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2734,7 +2986,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class Error(_model_base.Model): """The error object. - All required parameters must be populated in order to send to server. :ivar code: One of a server-defined set of error codes. Required. :vartype code: str @@ -2769,8 +3020,7 @@ def __init__( target: Optional[str] = None, details: Optional[List["_models.Error"]] = None, innererror: Optional["_models.InnerError"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2786,7 +3036,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class ErrorResponse(_model_base.Model): """Error response object. - All required parameters must be populated in order to send to server. :ivar error: Error info. Required. :vartype error: ~azure.ai.documentintelligence.models.Error @@ -2800,8 +3049,7 @@ def __init__( self, *, error: "_models.Error", - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2839,49 +3087,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, innererror: Optional["_models.InnerError"] = None, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class QuotaDetails(_model_base.Model): - """Quota used, limit, and next reset date/time. - - All required parameters must be populated in order to send to server. - - :ivar used: Amount of the resource quota used. Required. - :vartype used: int - :ivar quota: Resource quota limit. Required. - :vartype quota: int - :ivar quota_reset_date_time: Date/time when the resource quota usage will be reset. Required. - :vartype quota_reset_date_time: ~datetime.datetime - """ - - used: int = rest_field() - """Amount of the resource quota used. Required.""" - quota: int = rest_field() - """Resource quota limit. Required.""" - quota_reset_date_time: datetime.datetime = rest_field(name="quotaResetDateTime", format="rfc3339") - """Date/time when the resource quota usage will be reset. Required.""" - - @overload - def __init__( - self, - *, - used: int, - quota: int, - quota_reset_date_time: datetime.datetime, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2897,30 +3103,21 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class ResourceDetails(_model_base.Model): """General information regarding the current resource. - All required parameters must be populated in order to send to server. :ivar custom_document_models: Details regarding custom document models. Required. :vartype custom_document_models: ~azure.ai.documentintelligence.models.CustomDocumentModelsDetails - :ivar custom_neural_document_model_builds: Quota used, limit, and next reset date/time. - Required. - :vartype custom_neural_document_model_builds: - ~azure.ai.documentintelligence.models.QuotaDetails """ custom_document_models: "_models.CustomDocumentModelsDetails" = rest_field(name="customDocumentModels") """Details regarding custom document models. Required.""" - custom_neural_document_model_builds: "_models.QuotaDetails" = rest_field(name="customNeuralDocumentModelBuilds") - """Quota used, limit, and next reset date/time. Required.""" @overload def __init__( self, *, custom_document_models: "_models.CustomDocumentModelsDetails", - custom_neural_document_model_builds: "_models.QuotaDetails", - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2936,7 +3133,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class Warning(_model_base.Model): """The error object. - All required parameters must be populated in order to send to server. :ivar code: One of a server-defined set of warning codes. Required. :vartype code: str @@ -2960,8 +3156,7 @@ def __init__( code: str, message: str, target: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_analyze_custom_documents_async.py b/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_analyze_custom_documents_async.py index d9ced054254e8..92d1325ed5ee6 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_analyze_custom_documents_async.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_analyze_custom_documents_async.py @@ -49,8 +49,8 @@ def print_table(header_names, table_data): async def analyze_custom_documents(custom_model_id): # For the Form_1.jpg, it should be the test file under the traning dataset which storage at the Azure Blob Storage path - # combined by DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL and DOCUMENTINTELLIGENCE_STORAGE_PREFIX, - # or it can also be a test file with the format similar to the training dataset. + # combined by DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL and DOCUMENTINTELLIGENCE_STORAGE_PREFIX, + # or it can also be a test file with the format similar to the training dataset. # Put it here locally just for presenting documents visually in sample. # Before analyzing a custom document, should upload the related training dataset into Azure Storage Blob and diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_compose_model_async.py b/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_compose_model_async.py index 41d8cabbeec73..07f6647ac8fa7 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_compose_model_async.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_compose_model_async.py @@ -29,14 +29,17 @@ Set the environment variables with your own values before running the sample: 1) DOCUMENTINTELLIGENCE_ENDPOINT - the endpoint to your Document Intelligence resource. 2) DOCUMENTINTELLIGENCE_API_KEY - your Document Intelligence API key. - 3) DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL - a container SAS URL to your Azure Storage blob container. + 3) CLASSIFIER_ID - the ID of your trained document classifier + -OR- + DOCUMENTINTELLIGENCE_TRAINING_DATA_CLASSIFIER_SAS_URL - The shared access signature (SAS) Url of your Azure Blob Storage container + with your training files. A document classifier will be built and used to run the sample. """ import asyncio import os -async def sample_compose_model(): +async def sample_compose_model(classifier_id): import uuid from azure.core.credentials import AzureKeyCredential from azure.ai.documentintelligence.aio import DocumentIntelligenceAdministrationClient @@ -44,9 +47,9 @@ async def sample_compose_model(): AzureBlobContentSource, BuildDocumentModelRequest, ComposeDocumentModelRequest, - ComponentDocumentModelDetails, DocumentBuildMode, DocumentModelDetails, + DocumentTypeDetails, ) endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"] @@ -97,12 +100,13 @@ async def sample_compose_model(): poller = await document_intelligence_admin_client.begin_compose_model( ComposeDocumentModelRequest( model_id=str(uuid.uuid4()), - component_models=[ - ComponentDocumentModelDetails(model_id=supplies_model.model_id), - ComponentDocumentModelDetails(model_id=equipment_model.model_id), - ComponentDocumentModelDetails(model_id=furniture_model.model_id), - ComponentDocumentModelDetails(model_id=cleaning_supplies_model.model_id), - ], + classifier_id=classifier_id, + doc_types={ + "formA": DocumentTypeDetails(model_id=supplies_model.model_id), + "formB": DocumentTypeDetails(model_id=equipment_model.model_id), + "formC": DocumentTypeDetails(model_id=furniture_model.model_id), + "formD": DocumentTypeDetails(model_id=cleaning_supplies_model.model_id), + }, description="Office Supplies Composed Model", ), ) @@ -117,7 +121,7 @@ async def sample_compose_model(): print("Doc types the model can recognize:") for name, doc_type in model.doc_types.items(): print(f"Doc Type: '{name}' which has the following fields:") - if doc_type.field_confidence: + if doc_type.field_confidence and doc_type.field_schema: for field_name, field in doc_type.field_schema.items(): print( f"Field: '{field_name}' has type '{field['type']}' and confidence score " @@ -130,7 +134,45 @@ async def sample_compose_model(): async def main(): - await sample_compose_model() + classifier_id = None + if os.getenv("DOCUMENTINTELLIGENCE_TRAINING_DATA_CLASSIFIER_SAS_URL") and not os.getenv("CUSTOM_BUILT_MODEL_ID"): + import uuid + from azure.core.credentials import AzureKeyCredential + from azure.ai.documentintelligence.aio import DocumentIntelligenceAdministrationClient + from azure.ai.documentintelligence.models import ( + AzureBlobContentSource, + ClassifierDocumentTypeDetails, + BuildDocumentClassifierRequest, + ) + + endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"] + key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"] + blob_container_sas_url = os.environ["DOCUMENTINTELLIGENCE_TRAINING_DATA_CLASSIFIER_SAS_URL"] + + document_intelligence_admin_client = DocumentIntelligenceAdministrationClient( + endpoint=endpoint, credential=AzureKeyCredential(key) + ) + async with document_intelligence_admin_client: + poller = await document_intelligence_admin_client.begin_build_classifier( + BuildDocumentClassifierRequest( + classifier_id=str(uuid.uuid4()), + doc_types={ + "IRS-1040-A": ClassifierDocumentTypeDetails( + azure_blob_source=AzureBlobContentSource( + container_url=blob_container_sas_url, prefix="IRS-1040-A/train" + ) + ), + "IRS-1040-B": ClassifierDocumentTypeDetails( + azure_blob_source=AzureBlobContentSource( + container_url=blob_container_sas_url, prefix="IRS-1040-B/train" + ) + ), + }, + ) + ) + classifier = await poller.result() + classifier_id = classifier.classifier_id + await sample_compose_model(classifier_id) if __name__ == "__main__": diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_copy_model_to_async.py b/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_copy_model_to_async.py index eeefb15d0c5cb..a110853fb47d2 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_copy_model_to_async.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_copy_model_to_async.py @@ -72,12 +72,13 @@ async def sample_copy_model_to(custom_model_id): if copied_over_model.doc_types: for name, doc_type in copied_over_model.doc_types.items(): print(f"Doc Type: '{name}' which has the following fields:") - for field_name, field in doc_type.field_schema.items(): - if doc_type.field_confidence: - print( - f"Field: '{field_name}' has type '{field['type']}' and confidence score " - f"{doc_type.field_confidence[field_name]}" - ) + if doc_type.field_schema: + for field_name, field in doc_type.field_schema.items(): + if doc_type.field_confidence: + print( + f"Field: '{field_name}' has type '{field['type']}' and confidence score " + f"{doc_type.field_confidence[field_name]}" + ) if copied_over_model.warnings: print("Warnings encountered while building the model:") for warning in copied_over_model.warnings: diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_manage_models_async.py b/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_manage_models_async.py index fd408cc72d437..da06075b31bfe 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_manage_models_async.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/samples/async_samples/sample_manage_models_async.py @@ -62,12 +62,13 @@ async def sample_manage_models(): print("Doc types the model can recognize:") for name, doc_type in model.doc_types.items(): print(f"Doc Type: '{name}' built with '{doc_type.build_mode}' mode which has the following fields:") - for field_name, field in doc_type.field_schema.items(): - if doc_type.field_confidence: - print( - f"Field: '{field_name}' has type '{field['type']}' and confidence score " - f"{doc_type.field_confidence[field_name]}" - ) + if doc_type.field_schema: + for field_name, field in doc_type.field_schema.items(): + if doc_type.field_confidence: + print( + f"Field: '{field_name}' has type '{field['type']}' and confidence score " + f"{doc_type.field_confidence[field_name]}" + ) if model.warnings: print("Warnings encountered while building the model:") for warning in model.warnings: @@ -80,11 +81,6 @@ async def sample_manage_models(): f"Our resource has {account_details.custom_document_models.count} custom models, " f"and we can have at most {account_details.custom_document_models.limit} custom models" ) - neural_models = account_details.custom_neural_document_model_builds - print( - f"The quota limit for custom neural document models is {neural_models.quota} and the resource has" - f"used {neural_models.used}. The resource quota will reset on {neural_models.quota_reset_date_time}" - ) # Next, we get a paged list of all of our custom models models = document_intelligence_admin_client.list_models() diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_analyze_custom_documents.py b/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_analyze_custom_documents.py index 5e523dccdc5ba..bc072a55bbe36 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_analyze_custom_documents.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_analyze_custom_documents.py @@ -33,8 +33,8 @@ def analyze_custom_documents(custom_model_id): # For the Form_1.jpg, it should be the test file under the traning dataset which storage at the Azure Blob Storage path - # combined by DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL and DOCUMENTINTELLIGENCE_STORAGE_PREFIX, - # or it can also be a test file with the format similar to the training dataset. + # combined by DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL and DOCUMENTINTELLIGENCE_STORAGE_PREFIX, + # or it can also be a test file with the format similar to the training dataset. # Put it here locally just for presenting documents visually in sample. # Before analyzing a custom document, should upload the related training dataset into Azure Storage Blob and @@ -161,7 +161,9 @@ def _print_table(header_names, table_data): try: load_dotenv(find_dotenv()) model_id = None - if os.getenv("DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL") and not os.getenv("CUSTOM_BUILT_MODEL_ID"): + if os.getenv("DOCUMENTINTELLIGENCE_STORAGE_ADVANCED_CONTAINER_SAS_URL") and not os.getenv( + "CUSTOM_BUILT_MODEL_ID" + ): import uuid from azure.core.credentials import AzureKeyCredential from azure.ai.documentintelligence import DocumentIntelligenceAdministrationClient diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_compose_model.py b/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_compose_model.py index 383cfee8eff48..b06258510624d 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_compose_model.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_compose_model.py @@ -29,13 +29,16 @@ Set the environment variables with your own values before running the sample: 1) DOCUMENTINTELLIGENCE_ENDPOINT - the endpoint to your Document Intelligence resource. 2) DOCUMENTINTELLIGENCE_API_KEY - your Document Intelligence API key. - 3) DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL - a container SAS URL to your Azure Storage blob container. + 3) CLASSIFIER_ID - the ID of your trained document classifier + -OR- + DOCUMENTINTELLIGENCE_TRAINING_DATA_CLASSIFIER_SAS_URL - The shared access signature (SAS) Url of your Azure Blob Storage container + with your training files. A document classifier will be built and used to run the sample. """ import os -def sample_compose_model(): +def sample_compose_model(classifier_id): # [START composed_model] import uuid from azure.core.credentials import AzureKeyCredential @@ -44,14 +47,15 @@ def sample_compose_model(): AzureBlobContentSource, BuildDocumentModelRequest, ComposeDocumentModelRequest, - ComponentDocumentModelDetails, DocumentBuildMode, DocumentModelDetails, + DocumentTypeDetails, ) endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"] key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"] container_sas_url = os.environ["DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL"] + classifier_id = os.getenv("CLASSIFIER_ID", classifier_id) document_intelligence_admin_client = DocumentIntelligenceAdministrationClient( endpoint=endpoint, credential=AzureKeyCredential(key) @@ -96,12 +100,13 @@ def sample_compose_model(): poller = document_intelligence_admin_client.begin_compose_model( ComposeDocumentModelRequest( model_id=str(uuid.uuid4()), - component_models=[ - ComponentDocumentModelDetails(model_id=supplies_model.model_id), - ComponentDocumentModelDetails(model_id=equipment_model.model_id), - ComponentDocumentModelDetails(model_id=furniture_model.model_id), - ComponentDocumentModelDetails(model_id=cleaning_supplies_model.model_id), - ], + classifier_id=classifier_id, + doc_types={ + "formA": DocumentTypeDetails(model_id=supplies_model.model_id), + "formB": DocumentTypeDetails(model_id=equipment_model.model_id), + "formC": DocumentTypeDetails(model_id=furniture_model.model_id), + "formD": DocumentTypeDetails(model_id=cleaning_supplies_model.model_id), + }, description="Office Supplies Composed Model", ), ) @@ -116,7 +121,7 @@ def sample_compose_model(): print("Doc types the model can recognize:") for name, doc_type in model.doc_types.items(): print(f"Doc Type: '{name}' which has the following fields:") - if doc_type.field_confidence: + if doc_type.field_confidence and doc_type.field_schema: for field_name, field in doc_type.field_schema.items(): print( f"Field: '{field_name}' has type '{field['type']}' and confidence score " @@ -130,12 +135,50 @@ def sample_compose_model(): if __name__ == "__main__": + import uuid from azure.core.exceptions import HttpResponseError from dotenv import find_dotenv, load_dotenv try: load_dotenv(find_dotenv()) - sample_compose_model() + classifier_id = None + if os.getenv("DOCUMENTINTELLIGENCE_TRAINING_DATA_CLASSIFIER_SAS_URL") and not os.getenv("CLASSIFIER_ID"): + from azure.core.credentials import AzureKeyCredential + from azure.ai.documentintelligence import DocumentIntelligenceAdministrationClient + from azure.ai.documentintelligence.models import ( + AzureBlobContentSource, + ClassifierDocumentTypeDetails, + BuildDocumentClassifierRequest, + ) + + endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"] + key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"] + blob_container_sas_url = os.environ["DOCUMENTINTELLIGENCE_TRAINING_DATA_CLASSIFIER_SAS_URL"] + + document_intelligence_admin_client = DocumentIntelligenceAdministrationClient( + endpoint=endpoint, credential=AzureKeyCredential(key) + ) + + poller = document_intelligence_admin_client.begin_build_classifier( + BuildDocumentClassifierRequest( + classifier_id=str(uuid.uuid4()), + doc_types={ + "IRS-1040-A": ClassifierDocumentTypeDetails( + azure_blob_source=AzureBlobContentSource( + container_url=blob_container_sas_url, prefix="IRS-1040-A/train" + ) + ), + "IRS-1040-B": ClassifierDocumentTypeDetails( + azure_blob_source=AzureBlobContentSource( + container_url=blob_container_sas_url, prefix="IRS-1040-B/train" + ) + ), + }, + ) + ) + classifier = poller.result() + classifier_id = classifier.classifier_id + sample_compose_model(classifier_id) except HttpResponseError as error: # Examples of how to check an HttpResponseError # Check by error code: diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_copy_model_to.py b/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_copy_model_to.py index e73a9b3a7af97..2053900eaeab6 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_copy_model_to.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_copy_model_to.py @@ -70,12 +70,13 @@ def sample_copy_model_to(custom_model_id): print("Doc types the model can recognize:") for name, doc_type in copied_over_model.doc_types.items(): print(f"Doc Type: '{name}' which has the following fields:") - for field_name, field in doc_type.field_schema.items(): - if doc_type.field_confidence: - print( - f"Field: '{field_name}' has type '{field['type']}' and confidence score " - f"{doc_type.field_confidence[field_name]}" - ) + if doc_type.field_schema: + for field_name, field in doc_type.field_schema.items(): + if doc_type.field_confidence: + print( + f"Field: '{field_name}' has type '{field['type']}' and confidence score " + f"{doc_type.field_confidence[field_name]}" + ) if copied_over_model.warnings: print("Warnings encountered while building the model:") for warning in copied_over_model.warnings: diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_manage_models.py b/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_manage_models.py index c8b37a67bdd68..09f791476e5af 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_manage_models.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_manage_models.py @@ -61,12 +61,13 @@ def sample_manage_models(): print("Doc types the model can recognize:") for name, doc_type in model.doc_types.items(): print(f"Doc Type: '{name}' built with '{doc_type.build_mode}' mode which has the following fields:") - for field_name, field in doc_type.field_schema.items(): - if doc_type.field_confidence: - print( - f"Field: '{field_name}' has type '{field['type']}' and confidence score " - f"{doc_type.field_confidence[field_name]}" - ) + if doc_type.field_schema: + for field_name, field in doc_type.field_schema.items(): + if doc_type.field_confidence: + print( + f"Field: '{field_name}' has type '{field['type']}' and confidence score " + f"{doc_type.field_confidence[field_name]}" + ) # [END build_model] # [START get_resource_info] @@ -75,11 +76,6 @@ def sample_manage_models(): f"Our resource has {account_details.custom_document_models.count} custom models, " f"and we can have at most {account_details.custom_document_models.limit} custom models" ) - neural_models = account_details.custom_neural_document_model_builds - print( - f"The quota limit for custom neural document models is {neural_models.quota} and the resource has" - f"used {neural_models.used}. The resource quota will reset on {neural_models.quota_reset_date_time}" - ) # [END get_resource_info] # [START list_models] diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tests/preparers.py b/sdk/documentintelligence/azure-ai-documentintelligence/tests/preparers.py index 1802929b9f97d..99c1ca01671d8 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tests/preparers.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tests/preparers.py @@ -49,6 +49,7 @@ def create_resource(self, name, **kwargs): kwargs.update({"client": client}) return kwargs + class GlobalClientPreparerAsync(AzureMgmtPreparer): def __init__(self, client_cls, client_kwargs={}, **kwargs): super(GlobalClientPreparerAsync, self).__init__(name_prefix="", random_name_length=42) diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_custom_model.py b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_custom_model.py index 98c6a8e752e9c..4d35d6861fc66 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_custom_model.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_custom_model.py @@ -23,9 +23,7 @@ class TestDACAnalyzeCustomModel(DocumentIntelligenceTest): @DocumentIntelligencePreparer() def test_analyze_document_none_model_id(self, **kwargs): documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") - client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential() - ) + client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential()) with pytest.raises(ValueError) as e: client.begin_analyze_document(model_id=None, analyze_request=b"xx") assert "No value for given attribute" in str(e.value) @@ -33,9 +31,7 @@ def test_analyze_document_none_model_id(self, **kwargs): @DocumentIntelligencePreparer() def test_analyze_document_none_model_id_from_url(self, **kwargs): documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") - client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential() - ) + client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential()) with pytest.raises(ValueError) as e: client.begin_analyze_document( model_id=None, analyze_request=AnalyzeDocumentRequest(url_source="https://badurl.jpg") @@ -46,9 +42,7 @@ def test_analyze_document_none_model_id_from_url(self, **kwargs): @recorded_by_proxy def test_analyze_document_empty_model_id(self, **kwargs): documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") - client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential() - ) + client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential()) with pytest.raises(ResourceNotFoundError) as e: client.begin_analyze_document(model_id="", analyze_request=b"xx") assert "Resource not found" in str(e.value) @@ -58,9 +52,7 @@ def test_analyze_document_empty_model_id(self, **kwargs): @recorded_by_proxy def test_analyze_document_empty_model_id_from_url(self, **kwargs): documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") - client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential() - ) + client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential()) with pytest.raises(ResourceNotFoundError) as e: client.begin_analyze_document( model_id="", analyze_request=AnalyzeDocumentRequest(url_source="https://badurl.jpg") @@ -73,12 +65,8 @@ def test_analyze_document_empty_model_id_from_url(self, **kwargs): def test_custom_document_transform(self, documentintelligence_storage_container_sas_url, **kwargs): set_bodiless_matcher() documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") - di_admin_client = DocumentIntelligenceAdministrationClient( - documentintelligence_endpoint, get_credential() - ) - di_client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential() - ) + di_admin_client = DocumentIntelligenceAdministrationClient(documentintelligence_endpoint, get_credential()) + di_client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential()) recorded_variables = kwargs.pop("variables", {}) recorded_variables.setdefault("model_id", str(uuid.uuid4())) @@ -98,7 +86,46 @@ def test_custom_document_transform(self, documentintelligence_storage_container_ assert document.model_id == model.model_id assert len(document.pages) == 1 assert len(document.tables) == 2 - assert document.paragraphs is None + assert len(document.paragraphs) == 52 + assert len(document.styles) == 1 + assert document.string_index_type == "textElements" + assert document.content_format == "text" + + return recorded_variables + + @skip_flaky_test + @DocumentIntelligencePreparer() + @recorded_by_proxy + def test_custom_document_transform_with_continuation_token(self, documentintelligence_storage_container_sas_url, **kwargs): + set_bodiless_matcher() + documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") + di_admin_client = DocumentIntelligenceAdministrationClient(documentintelligence_endpoint, get_credential()) + di_client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential()) + + recorded_variables = kwargs.pop("variables", {}) + recorded_variables.setdefault("model_id", str(uuid.uuid4())) + request = BuildDocumentModelRequest( + model_id=recorded_variables.get("model_id"), + build_mode="template", + azure_blob_source=AzureBlobContentSource(container_url=documentintelligence_storage_container_sas_url), + ) + poller = di_admin_client.begin_build_document_model(request) + continuation_token = poller.continuation_token() + poller2 = di_admin_client.begin_build_document_model(request, continuation_token=continuation_token) + model = poller2.result() + assert model + + with open(self.form_jpg, "rb") as fd: + my_file = fd.read() + poller = di_client.begin_analyze_document(model.model_id, my_file, content_type="application/octet-stream") + continuation_token = poller.continuation_token() + di_client2 = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential()) + poller2 = di_client2.begin_analyze_document(None, None, continuation_token=continuation_token) + document = poller2.result() + assert document.model_id == model.model_id + assert len(document.pages) == 1 + assert len(document.tables) == 2 + assert len(document.paragraphs) == 52 assert len(document.styles) == 1 assert document.string_index_type == "textElements" assert document.content_format == "text" diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_custom_model_async.py b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_custom_model_async.py index 205f589d42221..e4c11bbaad76f 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_custom_model_async.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_custom_model_async.py @@ -25,9 +25,7 @@ class TestDACAnalyzeCustomModelAsync(AsyncDocumentIntelligenceTest): @recorded_by_proxy_async async def test_analyze_document_none_model_id(self, **kwargs): documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") - client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential(is_async=True) - ) + client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential(is_async=True)) with pytest.raises(ValueError) as e: async with client: await client.begin_analyze_document( @@ -39,9 +37,7 @@ async def test_analyze_document_none_model_id(self, **kwargs): @recorded_by_proxy_async async def test_analyze_document_none_model_id_from_url(self, **kwargs): documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") - client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential(is_async=True) - ) + client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential(is_async=True)) with pytest.raises(ValueError) as e: async with client: await client.begin_analyze_document( @@ -53,9 +49,7 @@ async def test_analyze_document_none_model_id_from_url(self, **kwargs): @recorded_by_proxy_async async def test_analyze_document_empty_model_id(self, **kwargs): documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") - client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential(is_async=True) - ) + client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential(is_async=True)) with pytest.raises(ResourceNotFoundError) as e: async with client: await client.begin_analyze_document( @@ -68,9 +62,7 @@ async def test_analyze_document_empty_model_id(self, **kwargs): @recorded_by_proxy_async async def test_analyze_document_empty_model_id_from_url(self, **kwargs): documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") - client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential(is_async=True) - ) + client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential(is_async=True)) with pytest.raises(ResourceNotFoundError) as e: async with client: await client.begin_analyze_document( @@ -87,9 +79,7 @@ async def test_custom_document_transform(self, documentintelligence_storage_cont di_admin_client = DocumentIntelligenceAdministrationClient( documentintelligence_endpoint, get_credential(is_async=True) ) - di_client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential(is_async=True) - ) + di_client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential(is_async=True)) recorded_variables = kwargs.pop("variables", {}) recorded_variables.setdefault("model_id", str(uuid.uuid4())) @@ -113,7 +103,53 @@ async def test_custom_document_transform(self, documentintelligence_storage_cont assert document.model_id == model.model_id assert len(document.pages) == 1 assert len(document.tables) == 2 - assert document.paragraphs is None + assert len(document.paragraphs) == 52 + assert len(document.styles) == 1 + assert document.string_index_type == "textElements" + assert document.content_format == "text" + + return recorded_variables + + @skip_flaky_test + @DocumentIntelligencePreparer() + @recorded_by_proxy_async + async def test_custom_document_transform_with_continuation_token(self, documentintelligence_storage_container_sas_url, **kwargs): + set_bodiless_matcher() + documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") + di_admin_client = DocumentIntelligenceAdministrationClient( + documentintelligence_endpoint, get_credential(is_async=True) + ) + di_client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential(is_async=True)) + + recorded_variables = kwargs.pop("variables", {}) + recorded_variables.setdefault("model_id", str(uuid.uuid4())) + request = BuildDocumentModelRequest( + model_id=recorded_variables.get("model_id"), + build_mode="template", + azure_blob_source=AzureBlobContentSource(container_url=documentintelligence_storage_container_sas_url), + ) + async with di_admin_client: + build_poller = await di_admin_client.begin_build_document_model(request) + continuation_token = build_poller.continuation_token() + new_build_poller = await di_admin_client.begin_build_document_model(request, continuation_token=continuation_token) + model = await new_build_poller.result() + assert model + + with open(self.form_jpg, "rb") as fd: + my_file = fd.read() + async with di_client: + poller = await di_client.begin_analyze_document( + model.model_id, my_file, content_type="application/octet-stream" + ) + continuation_token = poller.continuation_token() + + di_client2 = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential(is_async=True)) + async with di_client2: + document = await (await di_client2.begin_analyze_document(None, None, continuation_token=continuation_token)).result() + assert document.model_id == model.model_id + assert len(document.pages) == 1 + assert len(document.tables) == 2 + assert len(document.paragraphs) == 52 assert len(document.styles) == 1 assert document.string_index_type == "textElements" assert document.content_format == "text" diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_layout.py b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_layout.py index d576006e09401..4b3f9ff67e8f4 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_layout.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_layout.py @@ -194,6 +194,29 @@ def test_layout_multipage_table_span_pdf(self, client): assert layout.tables[1].column_count == 5 assert layout.tables[2].row_count == 24 assert layout.tables[2].column_count == 5 + + @pytest.mark.live_test_only + @skip_flaky_test + @DocumentIntelligencePreparer() + @DocumentIntelligenceClientPreparer() + @recorded_by_proxy + def test_layout_multipage_table_span_pdf_with_continuation_token(self, client): + with open(self.multipage_table_pdf, "rb") as fd: + document = fd.read() + poller = client.begin_analyze_document( + "prebuilt-layout", + document, + content_type="application/octet-stream", + ) + continuation_token = poller.continuation_token() + layout = client.begin_analyze_document(None, None, continuation_token=continuation_token).result() + assert len(layout.tables) == 3 + assert layout.tables[0].row_count == 30 + assert layout.tables[0].column_count == 5 + assert layout.tables[1].row_count == 6 + assert layout.tables[1].column_count == 5 + assert layout.tables[2].row_count == 24 + assert layout.tables[2].column_count == 5 @pytest.mark.live_test_only @skip_flaky_test @@ -217,14 +240,10 @@ def test_layout_url_barcode(self, client): @DocumentIntelligencePreparer() @recorded_by_proxy def test_polling_interval(self, documentintelligence_endpoint, **kwargs): - client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential() - ) + client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential()) assert client._config.polling_interval == 1 - client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential(), polling_interval=7 - ) + client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential(), polling_interval=7) assert client._config.polling_interval == 7 poller = client.begin_analyze_document( "prebuilt-receipt", AnalyzeDocumentRequest(url_source=self.receipt_url_jpg), polling_interval=6 diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_layout_async.py b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_layout_async.py index 7e0cfdc88d3b3..a6147a8499259 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_layout_async.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_analyze_layout_async.py @@ -205,6 +205,30 @@ async def test_layout_multipage_table_span_pdf(self, client): assert layout.tables[1].column_count == 5 assert layout.tables[2].row_count == 24 assert layout.tables[2].column_count == 5 + + @pytest.mark.live_test_only + @skip_flaky_test + @DocumentIntelligencePreparer() + @DocumentIntelligenceClientPreparer() + @recorded_by_proxy_async + async def test_layout_multipage_table_span_pdf_continuation_token(self, client): + with open(self.multipage_table_pdf, "rb") as fd: + document = fd.read() + async with client: + poller = await client.begin_analyze_document( + "prebuilt-layout", + document, + content_type="application/octet-stream", + ) + continuation_token = poller.continuation_token() + layout = await (await client.begin_analyze_document(None, None, continuation_token=continuation_token)).result() + assert len(layout.tables) == 3 + assert layout.tables[0].row_count == 30 + assert layout.tables[0].column_count == 5 + assert layout.tables[1].row_count == 6 + assert layout.tables[1].column_count == 5 + assert layout.tables[2].row_count == 24 + assert layout.tables[2].column_count == 5 @pytest.mark.live_test_only @skip_flaky_test @@ -229,9 +253,7 @@ async def test_layout_url_barcodes(self, client): @DocumentIntelligencePreparer() @recorded_by_proxy_async async def test_polling_interval(self, documentintelligence_endpoint, **kwargs): - client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential(is_async=True) - ) + client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential(is_async=True)) assert client._config.polling_interval == 1 client = DocumentIntelligenceClient( diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_classify_document.py b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_classify_document.py index 5fbecb7f3e213..d7c63503ab3f3 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_classify_document.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_classify_document.py @@ -31,12 +31,8 @@ class TestDACClassifyDocumentAsync(DocumentIntelligenceTest): def test_classify_document(self, documentintelligence_training_data_classifier_sas_url, **kwargs): set_bodiless_matcher() documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") - di_client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential() - ) - di_admin_client = DocumentIntelligenceAdministrationClient( - documentintelligence_endpoint, get_credential() - ) + di_client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential()) + di_admin_client = DocumentIntelligenceAdministrationClient(documentintelligence_endpoint, get_credential()) recorded_variables = kwargs.pop("variables", {}) recorded_variables.setdefault("classifier_id", str(uuid.uuid4())) diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_classify_document_async.py b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_classify_document_async.py index 2cb39190b467d..c54d27c8e02f9 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_classify_document_async.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dac_classify_document_async.py @@ -32,9 +32,7 @@ class TestDACClassifyDocumentAsync(AsyncDocumentIntelligenceTest): async def test_classify_document(self, documentintelligence_training_data_classifier_sas_url, **kwargs): set_bodiless_matcher() documentintelligence_endpoint = kwargs.pop("documentintelligence_endpoint") - di_client = DocumentIntelligenceClient( - documentintelligence_endpoint, get_credential(is_async=True) - ) + di_client = DocumentIntelligenceClient(documentintelligence_endpoint, get_credential(is_async=True)) di_admin_client = DocumentIntelligenceAdministrationClient( documentintelligence_endpoint, get_credential(is_async=True) ) diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_compose_model.py b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_compose_model.py index e4e12a70419f7..006a36c2dd18d 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_compose_model.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_compose_model.py @@ -9,10 +9,12 @@ from devtools_testutils import recorded_by_proxy, set_bodiless_matcher from azure.ai.documentintelligence import DocumentIntelligenceAdministrationClient from azure.ai.documentintelligence.models import ( - BuildDocumentModelRequest, AzureBlobContentSource, + BuildDocumentModelRequest, + BuildDocumentClassifierRequest, ComposeDocumentModelRequest, - ComponentDocumentModelDetails, + ClassifierDocumentTypeDetails, + DocumentTypeDetails, ) from testcase import DocumentIntelligenceTest from conftest import skip_flaky_test @@ -28,7 +30,7 @@ class TestTrainingAsync(DocumentIntelligenceTest): @DocumentIntelligencePreparer() @DocumentModelAdministrationClientPreparer() @recorded_by_proxy - def test_compose_model(self, client, documentintelligence_storage_container_sas_url, **kwargs): + def test_compose_model(self, client, documentintelligence_training_data_classifier_sas_url, **kwargs): set_bodiless_matcher() recorded_variables = kwargs.pop("variables", {}) recorded_variables.setdefault("model_id1", str(uuid.uuid4())) @@ -39,7 +41,9 @@ def test_compose_model(self, client, documentintelligence_storage_container_sas_ model_id=recorded_variables.get("model_id1"), description="model1", build_mode="template", - azure_blob_source=AzureBlobContentSource(container_url=documentintelligence_storage_container_sas_url), + azure_blob_source=AzureBlobContentSource( + container_url=documentintelligence_training_data_classifier_sas_url + ), ) poller = client.begin_build_document_model(request) model_1 = poller.result() @@ -48,19 +52,42 @@ def test_compose_model(self, client, documentintelligence_storage_container_sas_ model_id=recorded_variables.get("model_id2"), description="model2", build_mode="template", - azure_blob_source=AzureBlobContentSource(container_url=documentintelligence_storage_container_sas_url), + azure_blob_source=AzureBlobContentSource( + container_url=documentintelligence_training_data_classifier_sas_url + ), ) poller = client.begin_build_document_model(request) model_2 = poller.result() + request = BuildDocumentClassifierRequest( + classifier_id=classifier.classifier_id, + description="IRS document classifier", + doc_types={ + "IRS-1040-A": ClassifierDocumentTypeDetails( + azure_blob_source=AzureBlobContentSource( + container_url=documentintelligence_training_data_classifier_sas_url, prefix="IRS-1040-A/train" + ) + ), + "IRS-1040-B": ClassifierDocumentTypeDetails( + azure_blob_source=AzureBlobContentSource( + container_url=documentintelligence_training_data_classifier_sas_url, prefix="IRS-1040-B/train" + ) + ), + }, + ) + poller = client.begin_build_classifier(request) + classifier = poller.result() + classifier_id = classifier.classifier_id + request = ComposeDocumentModelRequest( model_id=recorded_variables.get("composed_id"), + classifier_id=classifier_id, description="my composed model", tags={"testkey": "testvalue"}, - component_models=[ - ComponentDocumentModelDetails(model_id=model_1.model_id), - ComponentDocumentModelDetails(model_id=model_2.model_id), - ], + doc_types={ + "formA": DocumentTypeDetails(model_id=model_1.model_id), + "formA": DocumentTypeDetails(model_id=model_2.model_id), + }, ) poller = client.begin_compose_model(request) composed_model = poller.result() diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_compose_model_async.py b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_compose_model_async.py index 4f9c9593f4f97..377c3f32c31b8 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_compose_model_async.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_compose_model_async.py @@ -10,10 +10,12 @@ from devtools_testutils import set_bodiless_matcher from azure.ai.documentintelligence.aio import DocumentIntelligenceAdministrationClient from azure.ai.documentintelligence.models import ( - BuildDocumentModelRequest, AzureBlobContentSource, + BuildDocumentModelRequest, + BuildDocumentClassifierRequest, ComposeDocumentModelRequest, - ComponentDocumentModelDetails, + ClassifierDocumentTypeDetails, + DocumentTypeDetails, ) from asynctestcase import AsyncDocumentIntelligenceTest from conftest import skip_flaky_test @@ -29,18 +31,21 @@ class TestTrainingAsync(AsyncDocumentIntelligenceTest): @DocumentIntelligencePreparer() @DocumentModelAdministrationClientPreparer() @recorded_by_proxy_async - async def test_compose_model(self, client, documentintelligence_storage_container_sas_url, **kwargs): + async def test_compose_model(self, client, documentintelligence_training_data_classifier_sas_url, **kwargs): set_bodiless_matcher() recorded_variables = kwargs.pop("variables", {}) recorded_variables.setdefault("model_id1", str(uuid.uuid4())) recorded_variables.setdefault("model_id2", str(uuid.uuid4())) recorded_variables.setdefault("composed_id", str(uuid.uuid4())) + async with client: request = BuildDocumentModelRequest( model_id=recorded_variables.get("model_id1"), description="model1", build_mode="template", - azure_blob_source=AzureBlobContentSource(container_url=documentintelligence_storage_container_sas_url), + azure_blob_source=AzureBlobContentSource( + container_url=documentintelligence_training_data_classifier_sas_url + ), ) poller = await client.begin_build_document_model(request) model_1 = await poller.result() @@ -49,19 +54,44 @@ async def test_compose_model(self, client, documentintelligence_storage_containe model_id=recorded_variables.get("model_id2"), description="model2", build_mode="template", - azure_blob_source=AzureBlobContentSource(container_url=documentintelligence_storage_container_sas_url), + azure_blob_source=AzureBlobContentSource( + container_url=documentintelligence_training_data_classifier_sas_url + ), ) poller = await client.begin_build_document_model(request) model_2 = await poller.result() + request = BuildDocumentClassifierRequest( + classifier_id=classifier.classifier_id, + description="IRS document classifier", + doc_types={ + "IRS-1040-A": ClassifierDocumentTypeDetails( + azure_blob_source=AzureBlobContentSource( + container_url=documentintelligence_training_data_classifier_sas_url, + prefix="IRS-1040-A/train", + ) + ), + "IRS-1040-B": ClassifierDocumentTypeDetails( + azure_blob_source=AzureBlobContentSource( + container_url=documentintelligence_training_data_classifier_sas_url, + prefix="IRS-1040-B/train", + ) + ), + }, + ) + poller = await client.begin_build_classifier(request) + classifier = await poller.result() + classifier_id = classifier.classifier_id + request = ComposeDocumentModelRequest( model_id=recorded_variables.get("composed_id"), + classifier_id=classifier_id, description="my composed model", tags={"testkey": "testvalue"}, - component_models=[ - ComponentDocumentModelDetails(model_id=model_1.model_id), - ComponentDocumentModelDetails(model_id=model_2.model_id), - ], + doc_types={ + "formA": DocumentTypeDetails(model_id=model_1.model_id), + "formA": DocumentTypeDetails(model_id=model_2.model_id), + }, ) poller = await client.begin_compose_model(request) composed_model = await poller.result() diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_copy_model.py b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_copy_model.py index 10f70eac68270..aed9f5830927f 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_copy_model.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_copy_model.py @@ -67,13 +67,12 @@ def test_copy_model_successful(self, client, documentintelligence_storage_contai assert copy.api_version == model.api_version assert copy.model_id != model.model_id + assert copy.model_id == copy_auth["targetModelId"] assert copy.description == model.description - assert copy.created_date_time == model.created_date_time - assert copy.expiration_date_time == model.expiration_date_time assert copy.tags == {"testkey": "testvalue"} assert model.tags is None for name, doc_type in copy.doc_types.items(): - assert name + assert name == copy_auth["targetModelId"] for key, field in doc_type.field_schema.items(): assert key assert field["type"] diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_copy_model_async.py b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_copy_model_async.py index aba9ec8a4e151..36cc21187aa56 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_copy_model_async.py +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tests/test_dmac_copy_model_async.py @@ -71,13 +71,12 @@ async def test_copy_model_successful(self, client, documentintelligence_storage_ assert copy.api_version == model.api_version assert copy.model_id != model.model_id + assert copy.model_id == copy_auth["targetModelId"] assert copy.description == model.description - assert copy.created_date_time == model.created_date_time - assert copy.expiration_date_time == model.expiration_date_time assert copy.tags == {"testkey": "testvalue"} assert model.tags is None for name, doc_type in copy.doc_types.items(): - assert name + assert name == copy_auth["targetModelId"] for key, field in doc_type.field_schema.items(): assert key assert field["type"] diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/tsp-location.yaml b/sdk/documentintelligence/azure-ai-documentintelligence/tsp-location.yaml index 69a71b61fd720..34ff74614a297 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/tsp-location.yaml +++ b/sdk/documentintelligence/azure-ai-documentintelligence/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/ai/DocumentIntelligence -commit: ed482bb7c159f1ff85eb598b1fd557bdc4145034 +commit: ec2a81edaecf3970e5938936e8256759905163e6 additionalDirectories: [] repo: Azure/azure-rest-api-specs diff --git a/sdk/dynatrace/azure-mgmt-dynatrace/pyproject.toml b/sdk/dynatrace/azure-mgmt-dynatrace/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/dynatrace/azure-mgmt-dynatrace/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/edgegateway/azure-mgmt-edgegateway/pyproject.toml b/sdk/edgegateway/azure-mgmt-edgegateway/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/edgegateway/azure-mgmt-edgegateway/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/edgemarketplace/azure-mgmt-edgemarketplace/pyproject.toml b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/edgemarketplace/azure-mgmt-edgemarketplace/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/edgeorder/azure-mgmt-edgeorder/pyproject.toml b/sdk/edgeorder/azure-mgmt-edgeorder/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/edgeorder/azure-mgmt-edgeorder/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/edgezones/azure-mgmt-edgezones/pyproject.toml b/sdk/edgezones/azure-mgmt-edgezones/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/edgezones/azure-mgmt-edgezones/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/education/azure-mgmt-education/pyproject.toml b/sdk/education/azure-mgmt-education/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/education/azure-mgmt-education/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/elastic/azure-mgmt-elastic/pyproject.toml b/sdk/elastic/azure-mgmt-elastic/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/elastic/azure-mgmt-elastic/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/pyproject.toml b/sdk/elasticsan/azure-mgmt-elasticsan/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/elasticsan/azure-mgmt-elasticsan/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/eventgrid/azure-eventgrid/pyproject.toml b/sdk/eventgrid/azure-eventgrid/pyproject.toml index 381c0d9346e58..e003619129699 100644 --- a/sdk/eventgrid/azure-eventgrid/pyproject.toml +++ b/sdk/eventgrid/azure-eventgrid/pyproject.toml @@ -1,3 +1,2 @@ [tool.azure-sdk-build] pyright = false -verifytypes = false diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/pyproject.toml b/sdk/eventgrid/azure-mgmt-eventgrid/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/eventgrid/azure-mgmt-eventgrid/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/eventhub/azure-eventhub/CHANGELOG.md b/sdk/eventhub/azure-eventhub/CHANGELOG.md index 7a2a6f6d990ef..8bd41497be882 100644 --- a/sdk/eventhub/azure-eventhub/CHANGELOG.md +++ b/sdk/eventhub/azure-eventhub/CHANGELOG.md @@ -8,6 +8,8 @@ ### Bugs Fixed +- Fixed a bug where the consumer waited indefinitely when the primary key was rotated while receiving, rather than raising an authentication error. ([#33926](https://github.com/Azure/azure-sdk-for-python/issues/33926)) + ### Other Changes ## 5.12.1 (2024-06-11) diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py index 877175ca7057d..ea1859ba28c76 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py @@ -46,6 +46,7 @@ USER_AGENT_PREFIX = "azsdk-python-eventhubs" UAMQP_LIBRARY = "uamqp" PYAMQP_LIBRARY = "pyamqp" +MAX_BUFFER_LENGTH = 300 NO_RETRY_ERRORS = [ b"com.microsoft:argument-out-of-range", diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer.py index 49a992caab56d..d59cd811e918a 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer.py @@ -236,6 +236,11 @@ def receive(self, batch=False, max_batch_size=300, max_wait_time=None): # If optional dependency is not installed, do not retry. if isinstance(exception, ImportError): raise exception + + # If authentication exception, do not retry. + if isinstance(exception, self._amqp_transport.AUTHENTICATION_EXCEPTION): + raise self._handle_exception(exception, is_consumer=True) + self._amqp_transport.check_link_stolen(self, exception) # TODO: below block hangs when retry_total > 0 # need to remove/refactor, issue #27137 diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/_message_backcompat.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/_message_backcompat.py index 85a99d932bfbb..0220b554aa21d 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/_message_backcompat.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/_message_backcompat.py @@ -31,6 +31,7 @@ class Settler(Protocol): def settle_messages( self, delivery_id: Optional[int], + delivery_tag: Optional[bytes], outcome: str, *, error: Optional[AMQPError] = None, @@ -85,7 +86,7 @@ def __init__( self._settler: Optional["Settler"] = kwargs.pop("settler", None) self._encoding = kwargs.get("encoding") self.delivery_no: Optional[int] = kwargs.get("delivery_no") - self.delivery_tag: Optional[str] = kwargs.get("delivery_tag") or None + self.delivery_tag: Optional[bytes] = kwargs.get("delivery_tag") or None self.on_send_complete: Optional[Callable] = None self.properties: Optional[LegacyMessageProperties] = ( LegacyMessageProperties(self._message.properties) @@ -159,7 +160,7 @@ def get_message(self) -> "Message": def accept(self) -> bool: if self._can_settle_message() and self._settler: - self._settler.settle_messages(self.delivery_no, "accepted") + self._settler.settle_messages(self.delivery_no, self.delivery_tag, "accepted") self.state = MessageState.ReceivedSettled return True return False @@ -173,6 +174,7 @@ def reject( if self._can_settle_message() and self._settler: self._settler.settle_messages( self.delivery_no, + self.delivery_tag, "rejected", error=AMQPError( condition=condition, description=description, info=info @@ -184,7 +186,7 @@ def reject( def release(self) -> bool: if self._can_settle_message() and self._settler: - self._settler.settle_messages(self.delivery_no, "released") + self._settler.settle_messages(self.delivery_no, self.delivery_tag, "released") self.state = MessageState.ReceivedSettled return True return False @@ -198,6 +200,7 @@ def modify( if self._can_settle_message() and self._settler: self._settler.settle_messages( self.delivery_no, + self.delivery_tag, "modified", delivery_failed=failed, undeliverable_here=deliverable, diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_client_async.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_client_async.py index 28656cc7c51e3..334cd89ac44f8 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_client_async.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_client_async.py @@ -931,6 +931,7 @@ async def _message_generator_async(self, timeout=None): async def settle_messages_async( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["accepted"], *, batchable: Optional[bool] = None @@ -941,6 +942,7 @@ async def settle_messages_async( async def settle_messages_async( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["released"], *, batchable: Optional[bool] = None @@ -951,6 +953,7 @@ async def settle_messages_async( async def settle_messages_async( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["rejected"], *, error: Optional[AMQPError] = None, @@ -962,6 +965,7 @@ async def settle_messages_async( async def settle_messages_async( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["modified"], *, delivery_failed: Optional[bool] = None, @@ -975,6 +979,7 @@ async def settle_messages_async( async def settle_messages_async( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["received"], *, section_number: int, @@ -983,7 +988,13 @@ async def settle_messages_async( ): ... - async def settle_messages_async(self, delivery_id: Union[int, Tuple[int, int]], outcome: str, **kwargs): + async def settle_messages_async( + self, + delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, + outcome: str, + **kwargs + ): batchable = kwargs.pop('batchable', None) if outcome.lower() == 'accepted': state: Outcomes = Accepted() @@ -1005,6 +1016,7 @@ async def settle_messages_async(self, delivery_id: Union[int, Tuple[int, int]], await self._link.send_disposition( first_delivery_id=first, last_delivery_id=last, + delivery_tag=delivery_tag, settled=True, delivery_state=state, batchable=batchable, diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_receiver_async.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_receiver_async.py index 18afe14e14200..ffd462de6bdf7 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_receiver_async.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_receiver_async.py @@ -16,6 +16,7 @@ DispositionFrame, ) from ..outcomes import Received, Accepted, Rejected, Released, Modified +from ..error import AMQPLinkError, ErrorCondition _LOGGER = logging.getLogger(__name__) @@ -31,6 +32,7 @@ def __init__(self, session, handle, source_address, **kwargs): self._on_transfer = kwargs.pop("on_transfer") self._received_payload = bytearray() self._first_frame = None + self._received_delivery_tags = set() @classmethod def from_incoming_frame(cls, session, handle, frame): @@ -69,6 +71,7 @@ async def _incoming_transfer(self, frame): if self._received_payload or frame[5]: # more self._received_payload.extend(frame[11]) if not frame[5]: + self._received_delivery_tags.add(self._first_frame[2]) if self._received_payload: message = decode_payload(memoryview(self._received_payload)) self._received_payload = bytearray() @@ -79,6 +82,7 @@ async def _incoming_transfer(self, frame): await self._outgoing_disposition( first=self._first_frame[1], last=self._first_frame[1], + delivery_tag=self._first_frame[2], settled=True, state=delivery_state, batchable=None @@ -100,6 +104,7 @@ async def _outgoing_disposition( self, first: int, last: Optional[int], + delivery_tag: bytes, settled: Optional[bool], state: Optional[Union[Received, Accepted, Rejected, Released, Modified]], batchable: Optional[bool], @@ -107,9 +112,13 @@ async def _outgoing_disposition( disposition_frame = DispositionFrame( role=self.role, first=first, last=last, settled=settled, state=state, batchable=batchable ) + if delivery_tag not in self._received_delivery_tags: + raise AMQPLinkError(condition=ErrorCondition.InternalError, description = "Delivery tag not found.") + if self.network_trace: _LOGGER.debug("-> %r", DispositionFrame(*disposition_frame), extra=self.network_trace_params) await self._session._outgoing_disposition(disposition_frame) # pylint: disable=protected-access + self._received_delivery_tags.remove(delivery_tag) async def attach(self): await super().attach() @@ -121,12 +130,20 @@ async def send_disposition( wait: Union[bool, float] = False, first_delivery_id: int, last_delivery_id: Optional[int] = None, + delivery_tag: bytes, settled: Optional[bool] = None, delivery_state: Optional[Union[Received, Accepted, Rejected, Released, Modified]] = None, batchable: Optional[bool] = None ): if self._is_closed: raise ValueError("Link already closed.") - await self._outgoing_disposition(first_delivery_id, last_delivery_id, settled, delivery_state, batchable) + await self._outgoing_disposition( + first_delivery_id, + last_delivery_id, + delivery_tag, + settled, + delivery_state, + batchable + ) if not settled: await self._wait_for_response(wait) diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/client.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/client.py index eae6750c77737..6a0bde6dc9046 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/client.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/client.py @@ -1031,6 +1031,7 @@ def _message_generator(self, timeout=None): def settle_messages( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["accepted"], *, batchable: Optional[bool] = None @@ -1041,6 +1042,7 @@ def settle_messages( def settle_messages( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["released"], *, batchable: Optional[bool] = None @@ -1051,6 +1053,7 @@ def settle_messages( def settle_messages( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["rejected"], *, error: Optional[AMQPError] = None, @@ -1062,6 +1065,7 @@ def settle_messages( def settle_messages( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["modified"], *, delivery_failed: Optional[bool] = None, @@ -1075,6 +1079,7 @@ def settle_messages( def settle_messages( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["received"], *, section_number: int, @@ -1084,7 +1089,7 @@ def settle_messages( ... def settle_messages( - self, delivery_id: Union[int, Tuple[int, int]], outcome: str, **kwargs + self, delivery_id: Union[int, Tuple[int, int]], delivery_tag: bytes, outcome: str, **kwargs ): batchable = kwargs.pop("batchable", None) if outcome.lower() == "accepted": @@ -1107,6 +1112,7 @@ def settle_messages( self._link.send_disposition( first_delivery_id=first, last_delivery_id=last, + delivery_tag=delivery_tag, settled=True, delivery_state=state, batchable=batchable, diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/receiver.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/receiver.py index 99095379a28bc..37a5e0e79fa6a 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/receiver.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/receiver.py @@ -13,6 +13,7 @@ from .constants import LinkState, Role from .performatives import TransferFrame, DispositionFrame from .outcomes import Received, Accepted, Rejected, Released, Modified +from .error import AMQPLinkError, ErrorCondition _LOGGER = logging.getLogger(__name__) @@ -28,6 +29,7 @@ def __init__(self, session, handle, source_address, **kwargs): self._on_transfer = kwargs.pop("on_transfer") self._received_payload = bytearray() self._first_frame = None + self._received_delivery_tags = set() @classmethod def from_incoming_frame(cls, session, handle, frame): @@ -54,6 +56,7 @@ def _incoming_attach(self, frame): def _incoming_transfer(self, frame): if self.network_trace: _LOGGER.debug("<- %r", TransferFrame(payload=b"***", *frame[:-1]), extra=self.network_trace_params) + # If more is false --> this is the last frame of the message if not frame[5]: self.current_link_credit -= 1 @@ -66,16 +69,19 @@ def _incoming_transfer(self, frame): if self._received_payload or frame[5]: # more self._received_payload.extend(frame[11]) if not frame[5]: + self._received_delivery_tags.add(self._first_frame[2]) if self._received_payload: message = decode_payload(memoryview(self._received_payload)) self._received_payload = bytearray() else: message = decode_payload(frame[11]) delivery_state = self._process_incoming_message(self._first_frame, message) + if not frame[4] and delivery_state: # settled self._outgoing_disposition( first=self._first_frame[1], last=self._first_frame[1], + delivery_tag=self._first_frame[2], settled=True, state=delivery_state, batchable=None @@ -97,16 +103,21 @@ def _outgoing_disposition( self, first: int, last: Optional[int], + delivery_tag: bytes, settled: Optional[bool], state: Optional[Union[Received, Accepted, Rejected, Released, Modified]], batchable: Optional[bool], ): + if delivery_tag not in self._received_delivery_tags: + raise AMQPLinkError(condition=ErrorCondition.InternalError, description = "Delivery tag not found.") + disposition_frame = DispositionFrame( role=self.role, first=first, last=last, settled=settled, state=state, batchable=batchable ) if self.network_trace: _LOGGER.debug("-> %r", DispositionFrame(*disposition_frame), extra=self.network_trace_params) self._session._outgoing_disposition(disposition_frame) # pylint: disable=protected-access + self._received_delivery_tags.remove(delivery_tag) def attach(self): super().attach() @@ -118,12 +129,20 @@ def send_disposition( wait: Union[bool, float] = False, first_delivery_id: int, last_delivery_id: Optional[int] = None, + delivery_tag: bytes, settled: Optional[bool] = None, delivery_state: Optional[Union[Received, Accepted, Rejected, Released, Modified]] = None, batchable: Optional[bool] = None ): if self._is_closed: raise ValueError("Link already closed.") - self._outgoing_disposition(first_delivery_id, last_delivery_id, settled, delivery_state, batchable) + self._outgoing_disposition( + first_delivery_id, + last_delivery_id, + delivery_tag, + settled, + delivery_state, + batchable + ) if not settled: self._wait_for_response(wait) diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_base.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_base.py index 9a0dcdc9aa238..0fe3ab70c67c8 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_base.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_base.py @@ -30,6 +30,7 @@ ReceiveClient as uamqp_ReceiveClient, ) from uamqp.authentication import JWTTokenAuth as uamqp_JWTTokenAuth + from uamqp.errors import AuthenticationException as uamqp_AuthenticationException except ImportError: pass @@ -48,6 +49,7 @@ from .._pyamqp.constants import ( ConnectionState as pyamqp_ConnectionState ) + from .._pyamqp.error import AuthenticationException as pyamqp_AuthenticationException class AmqpTransport(ABC): # pylint: disable=too-many-public-methods """ @@ -76,6 +78,9 @@ class AmqpTransport(ABC): # pylint: disable=too-many-public-methods USER_AGENT_SYMBOL: Union[uamqp_Types_AMQPSymbol, str, bytes] PROP_PARTITION_KEY_AMQP_SYMBOL: Union[uamqp_Types_AMQPSymbol, str, bytes] + # exceptions + AUTHENTICATION_EXCEPTION: Union["uamqp_AuthenticationException", "pyamqp_AuthenticationException"] + @staticmethod @abstractmethod def build_message(**kwargs: Any) -> Union["uamqp_Message", "pyamqp_Message"]: diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_pyamqp_transport.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_pyamqp_transport.py index 457a711ec79a1..68db8c361a9f3 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_pyamqp_transport.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_pyamqp_transport.py @@ -72,6 +72,9 @@ class PyamqpTransport(AmqpTransport): # pylint: disable=too-many-public-method ERROR_CONDITIONS = [condition.value for condition in errors.ErrorCondition] + # define exceptions + AUTHENTICATION_EXCEPTION = errors.AuthenticationException + @staticmethod def build_message(**kwargs): """ diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_uamqp_transport.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_uamqp_transport.py index 81798a10c4fc0..de543ccaed8e4 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_uamqp_transport.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_uamqp_transport.py @@ -122,6 +122,9 @@ class UamqpTransport(AmqpTransport): # pylint: disable=too-many-public-method USER_AGENT_SYMBOL = types.AMQPSymbol("user-agent") PROP_PARTITION_KEY_AMQP_SYMBOL = types.AMQPSymbol(PROP_PARTITION_KEY) + # define exceptions + AUTHENTICATION_EXCEPTION = errors.AuthenticationException + @staticmethod def build_message(**kwargs): """ diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_connection_manager_async.py b/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_connection_manager_async.py index c4da39b918f34..a8b7dc9fb1819 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_connection_manager_async.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_connection_manager_async.py @@ -62,7 +62,7 @@ def __init__( **kwargs: Any ) -> None: self._loop = kwargs.get("loop") - self._lock = Lock(loop=self._loop) + self._lock = Lock(loop=self._loop) # pylint: disable=unexpected-keyword-arg self._conn: Optional[Union[uamqp_ConnectionAsync, ConnectionAsync]] = None self._container_id = container_id diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_base_async.py b/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_base_async.py index 8d115f027b0a0..cd1ce5e4f7028 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_base_async.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_base_async.py @@ -79,7 +79,6 @@ class AmqpTransportAsync(ABC): # pylint: disable=too-many-public-methods USER_AGENT_SYMBOL: Union[uamqp_Types_AMQPSymbol, Literal["user-agent"]] PROP_PARTITION_KEY_AMQP_SYMBOL: Union[uamqp_Types_AMQPSymbol, Literal[b'x-opt-partition-key']] - @staticmethod @abstractmethod def build_message(**kwargs: Any) -> Union["uamqp_Message", "pyamqp_Message"]: diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_pyamqp_transport_async.py b/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_pyamqp_transport_async.py index 678c577003569..106636640bff3 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_pyamqp_transport_async.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_pyamqp_transport_async.py @@ -22,6 +22,7 @@ EventDataSendError, OperationTimeoutError ) +from ..._constants import MAX_BUFFER_LENGTH if TYPE_CHECKING: @@ -253,7 +254,7 @@ async def _callback_task(consumer, batch, max_batch_size, max_wait_time): await asyncio.sleep(0.05) @staticmethod - async def _receive_task(consumer): + async def _receive_task(consumer, max_batch_size): # pylint:disable=protected-access max_retries = consumer._client._config.max_retries retried_times = 0 @@ -261,14 +262,25 @@ async def _receive_task(consumer): try: while retried_times <= max_retries and running and consumer._callback_task_run: try: + # set a default value of consumer._prefetch for buffer length + buff_length = MAX_BUFFER_LENGTH await consumer._open() # pylint: disable=protected-access - running = await cast(ReceiveClientAsync, consumer._handler).do_work_async(batch=consumer._prefetch) + async with consumer._message_buffer_lock: + buff_length = len(consumer._message_buffer) + if buff_length <= max_batch_size: + running = await cast(ReceiveClientAsync, consumer._handler).do_work_async( + batch=consumer._prefetch + ) + await asyncio.sleep(0.05) except asyncio.CancelledError: # pylint: disable=try-except-raise raise except Exception as exception: # pylint: disable=broad-except # If optional dependency is not installed, do not retry. if isinstance(exception, ImportError): raise exception + # If authentication exception, do not retry. + if isinstance(exception, errors.AuthenticationException): + raise await consumer._handle_exception(exception) if ( isinstance(exception, errors.AMQPLinkError) and exception.condition == errors.ErrorCondition.LinkStolen # pylint: disable=no-member @@ -311,7 +323,7 @@ async def receive_messages_async(consumer, batch, max_batch_size, max_wait_time) callback_task = asyncio.create_task( PyamqpTransportAsync._callback_task(consumer, batch, max_batch_size, max_wait_time) ) - receive_task = asyncio.create_task(PyamqpTransportAsync._receive_task(consumer)) + receive_task = asyncio.create_task(PyamqpTransportAsync._receive_task(consumer, max_batch_size)) tasks = [callback_task, receive_task] try: diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_uamqp_transport_async.py b/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_uamqp_transport_async.py index 652c176c28d69..f2f9609047c9f 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_uamqp_transport_async.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_uamqp_transport_async.py @@ -283,6 +283,9 @@ async def receive_messages_async( except asyncio.CancelledError: # pylint: disable=try-except-raise raise except Exception as exception: # pylint: disable=broad-except + # If authentication exception, do not retry. + if isinstance(exception, errors.AuthenticationException): + raise await consumer._handle_exception(exception) if ( isinstance(exception, errors.LinkDetach) and exception.condition == constants.ErrorCodes.LinkStolen # pylint: disable=no-member diff --git a/sdk/eventhub/azure-eventhub/stress/stress-test-resources.bicep b/sdk/eventhub/azure-eventhub/stress/stress-test-resources.bicep index 84ef59ed45e9e..f198ea26c37c9 100644 --- a/sdk/eventhub/azure-eventhub/stress/stress-test-resources.bicep +++ b/sdk/eventhub/azure-eventhub/stress/stress-test-resources.bicep @@ -11,8 +11,6 @@ param location string = resourceGroup().location param storageEndpointSuffix string = 'core.windows.net' var ehVersion = '2017-04-01' -var contributorRoleId = 'b24988ac-6180-42a0-ab88-20f7382dd24c' -var eventHubsDataOwnerRoleId = 'f526a384-b230-433a-b45c-95f59c4a2dec' var eventHubsNamespace_var = 'eh-${baseName}' var eventHubName = 'eh-${baseName}-hub' var eventHubAuthRuleName = 'eh-${baseName}-hub-auth-rule' @@ -78,24 +76,6 @@ resource storageAccount_default_containerName 'Microsoft.Storage/storageAccounts ] } -resource id_name_baseName_eventHubsDataOwnerRoleId_testApplicationOid 'Microsoft.Authorization/roleAssignments@2019-04-01-preview' = { - name: guid(resourceGroup().id, deployment().name, baseName, eventHubsDataOwnerRoleId, testApplicationOid) - properties: { - roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', eventHubsDataOwnerRoleId) - principalId: testApplicationOid - scope: resourceGroup().id - } -} - -resource id_name_baseName_contributorRoleId_testApplicationOid 'Microsoft.Authorization/roleAssignments@2019-04-01-preview' = { - name: guid(resourceGroup().id, deployment().name, baseName, contributorRoleId, testApplicationOid) - properties: { - roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', contributorRoleId) - principalId: testApplicationOid - scope: resourceGroup().id - } -} - output EVENT_HUB_NAMESPACE string = eventHubsNamespace_var output EVENT_HUB_HOSTNAME string = '${eventHubsNamespace_var}.servicebus.windows.net' output EVENT_HUB_NAME string = eventHubName diff --git a/sdk/eventhub/azure-eventhub/tests/livetest/asynctests/test_consumer_client_async.py b/sdk/eventhub/azure-eventhub/tests/livetest/asynctests/test_consumer_client_async.py index fa823afed6294..4447633e5435e 100644 --- a/sdk/eventhub/azure-eventhub/tests/livetest/asynctests/test_consumer_client_async.py +++ b/sdk/eventhub/azure-eventhub/tests/livetest/asynctests/test_consumer_client_async.py @@ -460,3 +460,32 @@ async def on_event(partition_context, event): await asyncio.sleep(10) assert on_event.received == 1 await task + +@pytest.mark.liveTest +@pytest.mark.asyncio +async def test_receive_mimic_processing_async(auth_credential_senders_async, uamqp_transport): + fully_qualified_namespace, eventhub_name, credential, senders = auth_credential_senders_async + for i in range(305): + senders[0].send(EventData("A")) + client = EventHubConsumerClient( + fully_qualified_namespace=fully_qualified_namespace, + eventhub_name=eventhub_name, + credential=credential(), + consumer_group="$default", + uamqp_transport=uamqp_transport + ) + async def on_event(partition_context, event): + assert partition_context.partition_id == "0" + assert partition_context.consumer_group == "$default" + assert partition_context.eventhub_name == senders[0]._client.eventhub_name + on_event.received += 1 + # Mimic processing of event + await asyncio.sleep(20) + assert client._event_processors[0]._consumers[0]._message_buffer <=300 + + on_event.received = 0 + async with client: + task = asyncio.ensure_future( + client.receive(on_event, partition_id="0", starting_position="-1", prefetch=2)) + await asyncio.sleep(10) + await task diff --git a/sdk/eventhub/azure-mgmt-eventhub/pyproject.toml b/sdk/eventhub/azure-mgmt-eventhub/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/extendedlocation/azure-mgmt-extendedlocation/pyproject.toml b/sdk/extendedlocation/azure-mgmt-extendedlocation/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/extendedlocation/azure-mgmt-extendedlocation/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/face/tests.yml b/sdk/face/tests.yml new file mode 100644 index 0000000000000..3b518a7e021a4 --- /dev/null +++ b/sdk/face/tests.yml @@ -0,0 +1,7 @@ +trigger: none + +# NOTE: Service live tests are NOT enabled. This file only enables the analyze stage currently. +extends: + template: /eng/pipelines/templates/stages/python-analyze-weekly-standalone.yml + parameters: + ServiceDirectory: face diff --git a/sdk/fluidrelay/azure-mgmt-fluidrelay/pyproject.toml b/sdk/fluidrelay/azure-mgmt-fluidrelay/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/fluidrelay/azure-mgmt-fluidrelay/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/graphservices/azure-mgmt-graphservices/pyproject.toml b/sdk/graphservices/azure-mgmt-graphservices/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/graphservices/azure-mgmt-graphservices/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/hanaonazure/azure-mgmt-hanaonazure/pyproject.toml b/sdk/hanaonazure/azure-mgmt-hanaonazure/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/hanaonazure/azure-mgmt-hanaonazure/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/pyproject.toml b/sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-mgmt-hardwaresecuritymodules/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/CHANGELOG.md b/sdk/hdinsight/azure-mgmt-hdinsight/CHANGELOG.md index b65b5db5a2969..b02110ccb0d57 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/CHANGELOG.md +++ b/sdk/hdinsight/azure-mgmt-hdinsight/CHANGELOG.md @@ -1,5 +1,22 @@ # Release History +## 9.0.0b3 (2024-08-21) + +### Features Added + + - The 'azure.mgmt.hdinsight.operations.ExtensionsOperations' method 'begin_disable_azure_monitor_agent' was added in the current version + - The 'azure.mgmt.hdinsight.operations.ExtensionsOperations' method 'begin_enable_azure_monitor_agent' was added in the current version + - The 'azure.mgmt.hdinsight.operations.ExtensionsOperations' method 'get_azure_monitor_agent_status' was added in the current version + - The 'azure.mgmt.hdinsight.aio.operations.ExtensionsOperations' method 'begin_disable_azure_monitor_agent' was added in the current version + - The 'azure.mgmt.hdinsight.aio.operations.ExtensionsOperations' method 'begin_enable_azure_monitor_agent' was added in the current version + - The 'azure.mgmt.hdinsight.aio.operations.ExtensionsOperations' method 'get_azure_monitor_agent_status' was added in the current version + - The model or publicly exposed class 'azure.mgmt.hdinsight.models.ClusterPatchParameters' had property 'identity' added in the current version + - The model or publicly exposed class 'azure.mgmt.hdinsight.models.NetworkProperties' had property 'outbound_dependencies_managed_type' added in the current version + - The model or publicly exposed class 'azure.mgmt.hdinsight.models.NetworkProperties' had property 'public_ip_tag' added in the current version + - The model or publicly exposed class 'azure.mgmt.hdinsight.models.StorageAccount' had property 'enable_secure_channel' added in the current version + - The model or publicly exposed class 'azure.mgmt.hdinsight.models.IpTag' was added in the current version + - The model or publicly exposed class 'azure.mgmt.hdinsight.models.OutboundDependenciesManagedType' was added in the current version + ## 9.0.0b2 (2023-07-21) ### Features Added diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/README.md b/sdk/hdinsight/azure-mgmt-hdinsight/README.md index a9ed631567b76..6c465c7dfc06b 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/README.md +++ b/sdk/hdinsight/azure-mgmt-hdinsight/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure HDInsight Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -59,6 +59,3 @@ Code samples for this package can be found at: If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-hdinsight%2FREADME.png) diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/_meta.json b/sdk/hdinsight/azure-mgmt-hdinsight/_meta.json index b3161ca4c669f..59b739162240c 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/_meta.json +++ b/sdk/hdinsight/azure-mgmt-hdinsight/_meta.json @@ -1,11 +1,11 @@ { - "commit": "237afa17929313c909f72f2fea59f4437e305c99", + "commit": "21c2852d62ccc3abe9cc3800c989c6826f8363dc", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.6.0", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.17.0", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/hdinsight/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/python@6.6.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/hdinsight/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.17.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/hdinsight/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_configuration.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_configuration.py index abe1a06400061..01a69aee0e4fe 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_configuration.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class HDInsightManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class HDInsightManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for HDInsightManagementClient. Note that all parameters used to create this instance are saved as instance @@ -30,14 +29,13 @@ class HDInsightManagementClientConfiguration(Configuration): # pylint: disable= :param subscription_id: The subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-08-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(HDInsightManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-04-15-preview") + api_version: str = kwargs.pop("api_version", "2024-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -49,6 +47,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-hdinsight/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -57,9 +56,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_hd_insight_management_client.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_hd_insight_management_client.py index 760b58de23f24..2c90357481102 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_hd_insight_management_client.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_hd_insight_management_client.py @@ -8,9 +8,12 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import HDInsightManagementClientConfiguration @@ -68,7 +71,7 @@ class HDInsightManagementClient: # pylint: disable=client-accepts-api-version-k :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-08-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -85,7 +88,25 @@ def __init__( self._config = HDInsightManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -111,7 +132,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -131,12 +152,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "HDInsightManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_serialization.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_serialization.py index 842ae727fbbce..8139854b97bb8 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_serialization.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,9 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +172,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +290,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +335,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +346,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +385,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +410,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +440,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +556,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +644,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -662,12 +657,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -709,7 +705,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -729,6 +725,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -741,7 +738,9 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. - :rtype: str + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -749,10 +748,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -803,7 +800,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -823,7 +820,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -891,6 +888,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -903,9 +902,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -950,7 +954,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -983,7 +989,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1160,10 +1166,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1199,7 +1205,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1220,7 +1225,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1361,7 +1365,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1381,7 +1385,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1434,12 +1438,12 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore @@ -1471,7 +1475,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1505,14 +1509,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1568,7 +1572,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1642,7 +1646,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1690,7 +1694,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1747,7 +1751,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1798,7 +1802,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1852,10 +1855,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1883,7 +1886,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1900,7 +1903,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1935,7 +1938,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1972,7 +1975,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1988,9 +1991,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_vendor.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_vendor.py deleted file mode 100644 index bd0df84f5319f..0000000000000 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_vendor.py +++ /dev/null @@ -1,30 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 typing import List, cast - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_version.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_version.py index e25f4fc7373bd..f83579060b89c 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_version.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.0.0b2" +VERSION = "9.0.0b3" diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_configuration.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_configuration.py index c4be1c6560c12..d12124cd2533d 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_configuration.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_configuration.py @@ -8,7 +8,6 @@ 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, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class HDInsightManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class HDInsightManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for HDInsightManagementClient. Note that all parameters used to create this instance are saved as instance @@ -30,14 +29,13 @@ class HDInsightManagementClientConfiguration(Configuration): # pylint: disable= :param subscription_id: The subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-08-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(HDInsightManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-04-15-preview") + api_version: str = kwargs.pop("api_version", "2024-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -49,6 +47,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-hdinsight/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -57,9 +56,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_hd_insight_management_client.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_hd_insight_management_client.py index f50238aed6b1a..3624ddf8c7e2c 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_hd_insight_management_client.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_hd_insight_management_client.py @@ -8,9 +8,12 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -69,7 +72,7 @@ class HDInsightManagementClient: # pylint: disable=client-accepts-api-version-k :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-08-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -86,7 +89,25 @@ def __init__( self._config = HDInsightManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -112,7 +133,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -132,12 +155,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "HDInsightManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_applications_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_applications_operations.py index 43845927c00c9..4c66a3daa883d 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_applications_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_applications_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._applications_operations import ( build_create_request, build_delete_request, @@ -39,6 +40,10 @@ build_list_by_cluster_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +77,6 @@ def list_by_cluster( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Application or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.Application] :raises ~azure.core.exceptions.HttpResponseError: @@ -83,7 +87,7 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,17 +98,15 @@ def list_by_cluster( def prepare_request(next_link=None): if not next_link: - request = build_list_by_cluster_request( + _request = build_list_by_cluster_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_cluster.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -116,13 +118,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationListResult", pipeline_response) @@ -132,11 +133,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,10 +150,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications" - } - @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any @@ -165,12 +162,11 @@ async def get( :type cluster_name: str :param application_name: The constant value for the application name. Required. :type application_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.Application :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,22 +180,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Application] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -209,26 +203,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" - } + return deserialized # type: ignore async def _create_initial( self, resource_group_name: str, cluster_name: str, application_name: str, - parameters: Union[_models.Application, IO], + parameters: Union[_models.Application, IO[bytes]], **kwargs: Any - ) -> _models.Application: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -241,7 +231,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Application] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -251,7 +241,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "Application") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, @@ -260,35 +250,34 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Application", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" - } + return deserialized # type: ignore @overload async def begin_create( @@ -314,14 +303,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Application or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsight.models.Application] @@ -334,7 +315,7 @@ async def begin_create( resource_group_name: str, cluster_name: str, application_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -348,18 +329,10 @@ async def begin_create( :param application_name: The constant value for the application name. Required. :type application_name: str :param parameters: The application create request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Application or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsight.models.Application] @@ -372,7 +345,7 @@ async def begin_create( resource_group_name: str, cluster_name: str, application_name: str, - parameters: Union[_models.Application, IO], + parameters: Union[_models.Application, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Application]: """Creates applications for the HDInsight cluster. @@ -383,20 +356,9 @@ async def begin_create( :type cluster_name: str :param application_name: The constant value for the application name. Required. :type application_name: str - :param parameters: The application create request. Is either a Application type or a IO type. - Required. - :type parameters: ~azure.mgmt.hdinsight.models.Application or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: The application create request. Is either a Application type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.Application or IO[bytes] :return: An instance of AsyncLROPoller that returns either Application or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsight.models.Application] @@ -424,12 +386,13 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -441,22 +404,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Application].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" - } + return AsyncLROPoller[_models.Application]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -468,39 +429,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -514,14 +478,6 @@ async def begin_delete( :type cluster_name: str :param application_name: The constant value for the application name. Required. :type application_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -535,7 +491,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, @@ -545,11 +501,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -560,17 +517,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_azure_async_operation_status( @@ -586,12 +539,11 @@ async def get_azure_async_operation_status( :type application_name: str :param operation_id: The long running operation id. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -605,23 +557,21 @@ async def get_azure_async_operation_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) - request = build_get_azure_async_operation_status_request( + _request = build_get_azure_async_operation_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_azure_async_operation_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -631,13 +581,9 @@ async def get_azure_async_operation_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AsyncOperationResult", pipeline_response) + deserialized = self._deserialize("AsyncOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_azure_async_operation_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}/azureasyncoperations/{operationId}" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_clusters_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_clusters_operations.py index 1652070556740..fcd379d37efd1 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_clusters_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_clusters_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._clusters_operations import ( build_create_request, build_delete_request, @@ -48,6 +49,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,10 +80,10 @@ async def _create_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterCreateParametersExtended, IO], + parameters: Union[_models.ClusterCreateParametersExtended, IO[bytes]], **kwargs: Any - ) -> _models.Cluster: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +96,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -101,7 +106,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "ClusterCreateParametersExtended") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -109,35 +114,34 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Cluster", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" - } + return deserialized # type: ignore @overload async def begin_create( @@ -160,14 +164,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsight.models.Cluster] @@ -179,7 +175,7 @@ async def begin_create( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -191,18 +187,10 @@ async def begin_create( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster create request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsight.models.Cluster] @@ -214,7 +202,7 @@ async def begin_create( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterCreateParametersExtended, IO], + parameters: Union[_models.ClusterCreateParametersExtended, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Cluster]: """Creates a new HDInsight cluster with the specified parameters. @@ -224,19 +212,8 @@ async def begin_create( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster create request. Is either a ClusterCreateParametersExtended type - or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.ClusterCreateParametersExtended or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ClusterCreateParametersExtended or IO[bytes] :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsight.models.Cluster] @@ -263,12 +240,13 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Cluster", pipeline_response) + deserialized = self._deserialize("Cluster", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -280,17 +258,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Cluster].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" - } + return AsyncLROPoller[_models.Cluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update( @@ -313,7 +289,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Cluster or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.Cluster :raises ~azure.core.exceptions.HttpResponseError: @@ -324,7 +299,7 @@ async def update( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -336,11 +311,10 @@ async def update( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster patch request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Cluster or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.Cluster :raises ~azure.core.exceptions.HttpResponseError: @@ -351,7 +325,7 @@ async def update( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterPatchParameters, IO], + parameters: Union[_models.ClusterPatchParameters, IO[bytes]], **kwargs: Any ) -> _models.Cluster: """Patch HDInsight cluster with the specified parameters. @@ -360,18 +334,14 @@ async def update( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :param parameters: The cluster patch request. Is either a ClusterPatchParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.ClusterPatchParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: The cluster patch request. Is either a ClusterPatchParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ClusterPatchParameters or IO[bytes] :return: Cluster or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.Cluster :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -394,7 +364,7 @@ async def update( else: _json = self._serialize.body(parameters, "ClusterPatchParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -402,16 +372,14 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -421,21 +389,15 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Cluster", pipeline_response) + deserialized = self._deserialize("Cluster", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" - } + return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,38 +409,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -488,14 +453,6 @@ async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwar :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -509,7 +466,7 @@ async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwar lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, @@ -518,11 +475,12 @@ async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwar params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -533,17 +491,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.Cluster: @@ -553,12 +507,11 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Cluster or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.Cluster :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,21 +525,19 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -596,16 +547,12 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Cluster", pipeline_response) + deserialized = self._deserialize("Cluster", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: @@ -613,7 +560,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Cluster or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -624,7 +570,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -635,16 +581,14 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -656,13 +600,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ClusterListResult", pipeline_response) @@ -672,11 +615,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -689,19 +632,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters" - } - - async def _resize_initial( # pylint: disable=inconsistent-return-statements + async def _resize_initial( self, resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], - parameters: Union[_models.ClusterResizeParameters, IO], + parameters: Union[_models.ClusterResizeParameters, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -714,7 +653,7 @@ async def _resize_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -724,7 +663,7 @@ async def _resize_initial( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(parameters, "ClusterResizeParameters") - request = build_resize_request( + _request = build_resize_request( resource_group_name=resource_group_name, cluster_name=cluster_name, role_name=role_name, @@ -733,31 +672,34 @@ async def _resize_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._resize_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _resize_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize" - } + return deserialized # type: ignore @overload async def begin_resize( @@ -783,14 +725,6 @@ async def begin_resize( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -802,7 +736,7 @@ async def begin_resize( resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -816,18 +750,10 @@ async def begin_resize( :param role_name: The constant value for the roleName. "workernode" Required. :type role_name: str or ~azure.mgmt.hdinsight.models.RoleName :param parameters: The parameters for the resize operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -839,7 +765,7 @@ async def begin_resize( resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], - parameters: Union[_models.ClusterResizeParameters, IO], + parameters: Union[_models.ClusterResizeParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Resizes the specified HDInsight cluster to the specified size. @@ -851,19 +777,8 @@ async def begin_resize( :param role_name: The constant value for the roleName. "workernode" Required. :type role_name: str or ~azure.mgmt.hdinsight.models.RoleName :param parameters: The parameters for the resize operation. Is either a ClusterResizeParameters - type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.ClusterResizeParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ClusterResizeParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -878,7 +793,7 @@ async def begin_resize( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._resize_initial( # type: ignore + raw_result = await self._resize_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, role_name=role_name, @@ -890,11 +805,12 @@ async def begin_resize( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -905,27 +821,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_resize.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _update_auto_scale_configuration_initial( # pylint: disable=inconsistent-return-statements + async def _update_auto_scale_configuration_initial( self, resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], - parameters: Union[_models.AutoscaleConfigurationUpdateParameter, IO], + parameters: Union[_models.AutoscaleConfigurationUpdateParameter, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -938,7 +850,7 @@ async def _update_auto_scale_configuration_initial( # pylint: disable=inconsist api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -948,7 +860,7 @@ async def _update_auto_scale_configuration_initial( # pylint: disable=inconsist else: _json = self._serialize.body(parameters, "AutoscaleConfigurationUpdateParameter") - request = build_update_auto_scale_configuration_request( + _request = build_update_auto_scale_configuration_request( resource_group_name=resource_group_name, cluster_name=cluster_name, role_name=role_name, @@ -957,31 +869,34 @@ async def _update_auto_scale_configuration_initial( # pylint: disable=inconsist content_type=content_type, json=_json, content=_content, - template_url=self._update_auto_scale_configuration_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_auto_scale_configuration_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale" - } + return deserialized # type: ignore @overload async def begin_update_auto_scale_configuration( @@ -1007,14 +922,6 @@ async def begin_update_auto_scale_configuration( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1026,7 +933,7 @@ async def begin_update_auto_scale_configuration( resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1040,18 +947,10 @@ async def begin_update_auto_scale_configuration( :param role_name: The constant value for the roleName. "workernode" Required. :type role_name: str or ~azure.mgmt.hdinsight.models.RoleName :param parameters: The parameters for the update autoscale configuration operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1063,7 +962,7 @@ async def begin_update_auto_scale_configuration( resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], - parameters: Union[_models.AutoscaleConfigurationUpdateParameter, IO], + parameters: Union[_models.AutoscaleConfigurationUpdateParameter, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the Autoscale Configuration for HDInsight cluster. @@ -1075,19 +974,9 @@ async def begin_update_auto_scale_configuration( :param role_name: The constant value for the roleName. "workernode" Required. :type role_name: str or ~azure.mgmt.hdinsight.models.RoleName :param parameters: The parameters for the update autoscale configuration operation. Is either a - AutoscaleConfigurationUpdateParameter type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.AutoscaleConfigurationUpdateParameter or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + AutoscaleConfigurationUpdateParameter type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.AutoscaleConfigurationUpdateParameter or + IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1102,7 +991,7 @@ async def begin_update_auto_scale_configuration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_auto_scale_configuration_initial( # type: ignore + raw_result = await self._update_auto_scale_configuration_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, role_name=role_name, @@ -1114,11 +1003,12 @@ async def begin_update_auto_scale_configuration( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -1129,23 +1019,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_auto_scale_configuration.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: """Lists all the HDInsight clusters under the subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Cluster or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -1156,7 +1041,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1167,15 +1052,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1187,13 +1070,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ClusterListResult", pipeline_response) @@ -1203,11 +1085,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1220,16 +1102,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters"} - - async def _rotate_disk_encryption_key_initial( # pylint: disable=inconsistent-return-statements + async def _rotate_disk_encryption_key_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterDiskEncryptionParameters, IO], + parameters: Union[_models.ClusterDiskEncryptionParameters, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1242,7 +1122,7 @@ async def _rotate_disk_encryption_key_initial( # pylint: disable=inconsistent-r api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1252,7 +1132,7 @@ async def _rotate_disk_encryption_key_initial( # pylint: disable=inconsistent-r else: _json = self._serialize.body(parameters, "ClusterDiskEncryptionParameters") - request = build_rotate_disk_encryption_key_request( + _request = build_rotate_disk_encryption_key_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -1260,31 +1140,34 @@ async def _rotate_disk_encryption_key_initial( # pylint: disable=inconsistent-r content_type=content_type, json=_json, content=_content, - template_url=self._rotate_disk_encryption_key_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _rotate_disk_encryption_key_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey" - } + return deserialized # type: ignore @overload async def begin_rotate_disk_encryption_key( @@ -1307,14 +1190,6 @@ async def begin_rotate_disk_encryption_key( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1325,7 +1200,7 @@ async def begin_rotate_disk_encryption_key( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1337,18 +1212,10 @@ async def begin_rotate_disk_encryption_key( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The parameters for the disk encryption operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1359,7 +1226,7 @@ async def begin_rotate_disk_encryption_key( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterDiskEncryptionParameters, IO], + parameters: Union[_models.ClusterDiskEncryptionParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate disk encryption key of the specified HDInsight cluster. @@ -1369,19 +1236,8 @@ async def begin_rotate_disk_encryption_key( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The parameters for the disk encryption operation. Is either a - ClusterDiskEncryptionParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.ClusterDiskEncryptionParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ClusterDiskEncryptionParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ClusterDiskEncryptionParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1396,7 +1252,7 @@ async def begin_rotate_disk_encryption_key( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._rotate_disk_encryption_key_initial( # type: ignore + raw_result = await self._rotate_disk_encryption_key_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, @@ -1407,11 +1263,12 @@ async def begin_rotate_disk_encryption_key( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -1422,17 +1279,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_rotate_disk_encryption_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_gateway_settings( @@ -1444,12 +1297,11 @@ async def get_gateway_settings( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewaySettings or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.GatewaySettings :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1463,21 +1315,19 @@ async def get_gateway_settings( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GatewaySettings] = kwargs.pop("cls", None) - request = build_get_gateway_settings_request( + _request = build_get_gateway_settings_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_gateway_settings.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1487,25 +1337,21 @@ async def get_gateway_settings( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GatewaySettings", pipeline_response) + deserialized = self._deserialize("GatewaySettings", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get_gateway_settings.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/getGatewaySettings" - } - - async def _update_gateway_settings_initial( # pylint: disable=inconsistent-return-statements + async def _update_gateway_settings_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.UpdateGatewaySettingsParameters, IO], + parameters: Union[_models.UpdateGatewaySettingsParameters, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1518,7 +1364,7 @@ async def _update_gateway_settings_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1528,7 +1374,7 @@ async def _update_gateway_settings_initial( # pylint: disable=inconsistent-retu else: _json = self._serialize.body(parameters, "UpdateGatewaySettingsParameters") - request = build_update_gateway_settings_request( + _request = build_update_gateway_settings_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -1536,31 +1382,34 @@ async def _update_gateway_settings_initial( # pylint: disable=inconsistent-retu content_type=content_type, json=_json, content=_content, - template_url=self._update_gateway_settings_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_gateway_settings_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings" - } + return deserialized # type: ignore @overload async def begin_update_gateway_settings( @@ -1583,14 +1432,6 @@ async def begin_update_gateway_settings( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1601,7 +1442,7 @@ async def begin_update_gateway_settings( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1613,18 +1454,10 @@ async def begin_update_gateway_settings( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster configurations. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1635,7 +1468,7 @@ async def begin_update_gateway_settings( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.UpdateGatewaySettingsParameters, IO], + parameters: Union[_models.UpdateGatewaySettingsParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Configures the gateway settings on the specified cluster. @@ -1645,19 +1478,8 @@ async def begin_update_gateway_settings( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster configurations. Is either a UpdateGatewaySettingsParameters type - or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.UpdateGatewaySettingsParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.UpdateGatewaySettingsParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1672,7 +1494,7 @@ async def begin_update_gateway_settings( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_gateway_settings_initial( # type: ignore + raw_result = await self._update_gateway_settings_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, @@ -1683,11 +1505,12 @@ async def begin_update_gateway_settings( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -1698,17 +1521,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_gateway_settings.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_azure_async_operation_status( @@ -1722,12 +1541,11 @@ async def get_azure_async_operation_status( :type cluster_name: str :param operation_id: The long running operation id. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1741,22 +1559,20 @@ async def get_azure_async_operation_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) - request = build_get_azure_async_operation_status_request( + _request = build_get_azure_async_operation_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_azure_async_operation_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1766,25 +1582,21 @@ async def get_azure_async_operation_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AsyncOperationResult", pipeline_response) + deserialized = self._deserialize("AsyncOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get_azure_async_operation_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/azureasyncoperations/{operationId}" - } - - async def _update_identity_certificate_initial( # pylint: disable=inconsistent-return-statements + async def _update_identity_certificate_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.UpdateClusterIdentityCertificateParameters, IO], + parameters: Union[_models.UpdateClusterIdentityCertificateParameters, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1797,7 +1609,7 @@ async def _update_identity_certificate_initial( # pylint: disable=inconsistent- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1807,7 +1619,7 @@ async def _update_identity_certificate_initial( # pylint: disable=inconsistent- else: _json = self._serialize.body(parameters, "UpdateClusterIdentityCertificateParameters") - request = build_update_identity_certificate_request( + _request = build_update_identity_certificate_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -1815,31 +1627,34 @@ async def _update_identity_certificate_initial( # pylint: disable=inconsistent- content_type=content_type, json=_json, content=_content, - template_url=self._update_identity_certificate_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_identity_certificate_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate" - } + return deserialized # type: ignore @overload async def begin_update_identity_certificate( @@ -1862,14 +1677,6 @@ async def begin_update_identity_certificate( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1880,7 +1687,7 @@ async def begin_update_identity_certificate( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1892,18 +1699,10 @@ async def begin_update_identity_certificate( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster configurations. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1914,7 +1713,7 @@ async def begin_update_identity_certificate( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.UpdateClusterIdentityCertificateParameters, IO], + parameters: Union[_models.UpdateClusterIdentityCertificateParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the cluster identity certificate. @@ -1924,19 +1723,9 @@ async def begin_update_identity_certificate( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster configurations. Is either a - UpdateClusterIdentityCertificateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.UpdateClusterIdentityCertificateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + UpdateClusterIdentityCertificateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.UpdateClusterIdentityCertificateParameters or + IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1951,7 +1740,7 @@ async def begin_update_identity_certificate( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_identity_certificate_initial( # type: ignore + raw_result = await self._update_identity_certificate_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, @@ -1962,11 +1751,12 @@ async def begin_update_identity_certificate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -1977,30 +1767,29 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_identity_certificate.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _execute_script_actions_initial( # pylint: disable=inconsistent-return-statements + async def _execute_script_actions_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ExecuteScriptActionParameters, IO], + parameters: Union[_models.ExecuteScriptActionParameters, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -2009,7 +1798,7 @@ async def _execute_script_actions_initial( # pylint: disable=inconsistent-retur api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2019,7 +1808,7 @@ async def _execute_script_actions_initial( # pylint: disable=inconsistent-retur else: _json = self._serialize.body(parameters, "ExecuteScriptActionParameters") - request = build_execute_script_actions_request( + _request = build_execute_script_actions_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -2027,31 +1816,34 @@ async def _execute_script_actions_initial( # pylint: disable=inconsistent-retur content_type=content_type, json=_json, content=_content, - template_url=self._execute_script_actions_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _execute_script_actions_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions" - } + return deserialized # type: ignore @overload async def begin_execute_script_actions( @@ -2074,14 +1866,6 @@ async def begin_execute_script_actions( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2092,7 +1876,7 @@ async def begin_execute_script_actions( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -2104,18 +1888,10 @@ async def begin_execute_script_actions( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The parameters for executing script actions. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2126,7 +1902,7 @@ async def begin_execute_script_actions( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ExecuteScriptActionParameters, IO], + parameters: Union[_models.ExecuteScriptActionParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Executes script actions on the specified HDInsight cluster. @@ -2136,19 +1912,8 @@ async def begin_execute_script_actions( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The parameters for executing script actions. Is either a - ExecuteScriptActionParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.ExecuteScriptActionParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ExecuteScriptActionParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ExecuteScriptActionParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2163,7 +1928,7 @@ async def begin_execute_script_actions( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._execute_script_actions_initial( # type: ignore + raw_result = await self._execute_script_actions_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, @@ -2174,11 +1939,12 @@ async def begin_execute_script_actions( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -2189,14 +1955,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_execute_script_actions.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_configurations_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_configurations_operations.py index 1414ce5fc1dbe..5bd4f9ed92521 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_configurations_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_configurations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,21 +16,25 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._configurations_operations import build_get_request, build_list_request, build_update_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,12 +66,11 @@ async def list(self, resource_group_name: str, cluster_name: str, **kwargs: Any) :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterConfigurations or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.ClusterConfigurations :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -80,21 +84,19 @@ async def list(self, resource_group_name: str, cluster_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterConfigurations] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -104,26 +106,22 @@ async def list(self, resource_group_name: str, cluster_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ClusterConfigurations", pipeline_response) + deserialized = self._deserialize("ClusterConfigurations", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations" - } - - async def _update_initial( # pylint: disable=inconsistent-return-statements + async def _update_initial( self, resource_group_name: str, cluster_name: str, configuration_name: str, - parameters: Union[Dict[str, str], IO], + parameters: Union[Dict[str, str], IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -136,7 +134,7 @@ async def _update_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -146,7 +144,7 @@ async def _update_initial( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(parameters, "{str}") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, cluster_name=cluster_name, configuration_name=configuration_name, @@ -155,31 +153,34 @@ async def _update_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -206,14 +207,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -225,7 +218,7 @@ async def begin_update( resource_group_name: str, cluster_name: str, configuration_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -240,18 +233,10 @@ async def begin_update( :param configuration_name: The name of the cluster configuration. Required. :type configuration_name: str :param parameters: The cluster configurations. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -263,7 +248,7 @@ async def begin_update( resource_group_name: str, cluster_name: str, configuration_name: str, - parameters: Union[Dict[str, str], IO], + parameters: Union[Dict[str, str], IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Configures the HTTP settings on the specified cluster. This API is deprecated, please use @@ -275,20 +260,9 @@ async def begin_update( :type cluster_name: str :param configuration_name: The name of the cluster configuration. Required. :type configuration_name: str - :param parameters: The cluster configurations. Is either a {str: str} type or a IO type. + :param parameters: The cluster configurations. Is either a {str: str} type or a IO[bytes] type. Required. - :type parameters: dict[str, str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :type parameters: dict[str, str] or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -303,7 +277,7 @@ async def begin_update( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, configuration_name=configuration_name, @@ -315,11 +289,12 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -330,17 +305,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -355,12 +326,11 @@ async def get( :type cluster_name: str :param configuration_name: The name of the cluster configuration. Required. :type configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: dict mapping str to str or the result of cls(response) :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -374,22 +344,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cluster_name=cluster_name, configuration_name=configuration_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -399,13 +367,9 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize("{str}", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_extensions_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_extensions_operations.py index 3dd717f7584db..dafb39fb3500d 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_extensions_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_extensions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,37 +16,44 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._extensions_operations import ( build_create_request, build_delete_request, + build_disable_azure_monitor_agent_request, build_disable_azure_monitor_request, build_disable_monitoring_request, + build_enable_azure_monitor_agent_request, build_enable_azure_monitor_request, build_enable_monitoring_request, build_get_azure_async_operation_status_request, + build_get_azure_monitor_agent_status_request, build_get_azure_monitor_status_request, build_get_monitoring_status_request, build_get_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ExtensionsOperations: +class ExtensionsOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -64,14 +72,14 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - async def _enable_monitoring_initial( # pylint: disable=inconsistent-return-statements + async def _enable_monitoring_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterMonitoringRequest, IO], + parameters: Union[_models.ClusterMonitoringRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,7 +92,7 @@ async def _enable_monitoring_initial( # pylint: disable=inconsistent-return-sta api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -94,7 +102,7 @@ async def _enable_monitoring_initial( # pylint: disable=inconsistent-return-sta else: _json = self._serialize.body(parameters, "ClusterMonitoringRequest") - request = build_enable_monitoring_request( + _request = build_enable_monitoring_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -102,31 +110,34 @@ async def _enable_monitoring_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, content=_content, - template_url=self._enable_monitoring_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _enable_monitoring_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" - } + return deserialized # type: ignore @overload async def begin_enable_monitoring( @@ -149,14 +160,6 @@ async def begin_enable_monitoring( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -167,7 +170,7 @@ async def begin_enable_monitoring( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -179,18 +182,10 @@ async def begin_enable_monitoring( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The Operations Management Suite (OMS) workspace parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -201,7 +196,7 @@ async def begin_enable_monitoring( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterMonitoringRequest, IO], + parameters: Union[_models.ClusterMonitoringRequest, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Enables the Operations Management Suite (OMS) on the HDInsight cluster. @@ -211,19 +206,8 @@ async def begin_enable_monitoring( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The Operations Management Suite (OMS) workspace parameters. Is either a - ClusterMonitoringRequest type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.ClusterMonitoringRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ClusterMonitoringRequest type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ClusterMonitoringRequest or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -238,7 +222,7 @@ async def begin_enable_monitoring( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._enable_monitoring_initial( # type: ignore + raw_result = await self._enable_monitoring_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, @@ -249,11 +233,12 @@ async def begin_enable_monitoring( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -264,17 +249,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_enable_monitoring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_monitoring_status( @@ -286,12 +267,11 @@ async def get_monitoring_status( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterMonitoringResponse or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.ClusterMonitoringResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -305,21 +285,19 @@ async def get_monitoring_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterMonitoringResponse] = kwargs.pop("cls", None) - request = build_get_monitoring_status_request( + _request = build_get_monitoring_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_monitoring_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -329,21 +307,17 @@ async def get_monitoring_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ClusterMonitoringResponse", pipeline_response) + deserialized = self._deserialize("ClusterMonitoringResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get_monitoring_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" - } - - async def _disable_monitoring_initial( # pylint: disable=inconsistent-return-statements + async def _disable_monitoring_initial( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -355,38 +329,41 @@ async def _disable_monitoring_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_disable_monitoring_request( + _request = build_disable_monitoring_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._disable_monitoring_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _disable_monitoring_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" - } + return deserialized # type: ignore @distributed_trace_async async def begin_disable_monitoring( @@ -398,14 +375,6 @@ async def begin_disable_monitoring( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -419,7 +388,7 @@ async def begin_disable_monitoring( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._disable_monitoring_initial( # type: ignore + raw_result = await self._disable_monitoring_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, @@ -428,11 +397,12 @@ async def begin_disable_monitoring( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -443,26 +413,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_disable_monitoring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _enable_azure_monitor_initial( # pylint: disable=inconsistent-return-statements + async def _enable_azure_monitor_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.AzureMonitorRequest, IO], + parameters: Union[_models.AzureMonitorRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -475,7 +441,7 @@ async def _enable_azure_monitor_initial( # pylint: disable=inconsistent-return- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -485,7 +451,7 @@ async def _enable_azure_monitor_initial( # pylint: disable=inconsistent-return- else: _json = self._serialize.body(parameters, "AzureMonitorRequest") - request = build_enable_azure_monitor_request( + _request = build_enable_azure_monitor_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -493,31 +459,34 @@ async def _enable_azure_monitor_initial( # pylint: disable=inconsistent-return- content_type=content_type, json=_json, content=_content, - template_url=self._enable_azure_monitor_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _enable_azure_monitor_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" - } + return deserialized # type: ignore @overload async def begin_enable_azure_monitor( @@ -540,14 +509,6 @@ async def begin_enable_azure_monitor( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -558,7 +519,7 @@ async def begin_enable_azure_monitor( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -570,18 +531,10 @@ async def begin_enable_azure_monitor( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The Log Analytics workspace parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -592,7 +545,7 @@ async def begin_enable_azure_monitor( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.AzureMonitorRequest, IO], + parameters: Union[_models.AzureMonitorRequest, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Enables the Azure Monitor on the HDInsight cluster. @@ -602,19 +555,8 @@ async def begin_enable_azure_monitor( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The Log Analytics workspace parameters. Is either a AzureMonitorRequest type - or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.AzureMonitorRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.AzureMonitorRequest or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -629,7 +571,7 @@ async def begin_enable_azure_monitor( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._enable_azure_monitor_initial( # type: ignore + raw_result = await self._enable_azure_monitor_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, @@ -640,11 +582,12 @@ async def begin_enable_azure_monitor( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -655,17 +598,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_enable_azure_monitor.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_azure_monitor_status( @@ -677,12 +616,11 @@ async def get_azure_monitor_status( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AzureMonitorResponse or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AzureMonitorResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -696,21 +634,19 @@ async def get_azure_monitor_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureMonitorResponse] = kwargs.pop("cls", None) - request = build_get_azure_monitor_status_request( + _request = build_get_azure_monitor_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_azure_monitor_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -720,21 +656,17 @@ async def get_azure_monitor_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureMonitorResponse", pipeline_response) + deserialized = self._deserialize("AzureMonitorResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get_azure_monitor_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" - } - - async def _disable_azure_monitor_initial( # pylint: disable=inconsistent-return-statements + async def _disable_azure_monitor_initial( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -746,38 +678,41 @@ async def _disable_azure_monitor_initial( # pylint: disable=inconsistent-return _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_disable_azure_monitor_request( + _request = build_disable_azure_monitor_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._disable_azure_monitor_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _disable_azure_monitor_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" - } + return deserialized # type: ignore @distributed_trace_async async def begin_disable_azure_monitor( @@ -789,14 +724,6 @@ async def begin_disable_azure_monitor( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -810,7 +737,7 @@ async def begin_disable_azure_monitor( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._disable_azure_monitor_initial( # type: ignore + raw_result = await self._disable_azure_monitor_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, @@ -819,11 +746,12 @@ async def begin_disable_azure_monitor( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -834,27 +762,372 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _enable_azure_monitor_agent_initial( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.AzureMonitorRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - begin_disable_azure_monitor.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" - } + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - async def _create_initial( # pylint: disable=inconsistent-return-statements + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AzureMonitorRequest") + + _request = build_enable_azure_monitor_agent_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_enable_azure_monitor_agent( + self, + resource_group_name: str, + cluster_name: str, + parameters: _models.AzureMonitorRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Enables the Azure Monitor Agent on the HDInsight cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param parameters: The Log Analytics workspace parameters. Required. + :type parameters: ~azure.mgmt.hdinsight.models.AzureMonitorRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_enable_azure_monitor_agent( + self, + resource_group_name: str, + cluster_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Enables the Azure Monitor Agent on the HDInsight cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param parameters: The Log Analytics workspace parameters. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_enable_azure_monitor_agent( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.AzureMonitorRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Enables the Azure Monitor Agent on the HDInsight cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param parameters: The Log Analytics workspace parameters. Is either a AzureMonitorRequest type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.AzureMonitorRequest or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._enable_azure_monitor_agent_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get_azure_monitor_agent_status( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> _models.AzureMonitorResponse: + """Gets the status of Azure Monitor Agent on the HDInsight cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :return: AzureMonitorResponse or the result of cls(response) + :rtype: ~azure.mgmt.hdinsight.models.AzureMonitorResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AzureMonitorResponse] = kwargs.pop("cls", None) + + _request = build_get_azure_monitor_agent_status_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AzureMonitorResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _disable_azure_monitor_agent_initial( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disable_azure_monitor_agent_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_disable_azure_monitor_agent( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disables the Azure Monitor Agent on the HDInsight cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._disable_azure_monitor_agent_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _create_initial( self, resource_group_name: str, cluster_name: str, extension_name: str, - parameters: Union[_models.Extension, IO], + parameters: Union[_models.Extension, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -867,7 +1140,7 @@ async def _create_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -877,7 +1150,7 @@ async def _create_initial( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(parameters, "Extension") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, @@ -886,31 +1159,34 @@ async def _create_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" - } + return deserialized # type: ignore @overload async def begin_create( @@ -936,14 +1212,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -955,7 +1223,7 @@ async def begin_create( resource_group_name: str, cluster_name: str, extension_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -969,18 +1237,10 @@ async def begin_create( :param extension_name: The name of the cluster extension. Required. :type extension_name: str :param parameters: The cluster extensions create request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -992,7 +1252,7 @@ async def begin_create( resource_group_name: str, cluster_name: str, extension_name: str, - parameters: Union[_models.Extension, IO], + parameters: Union[_models.Extension, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Creates an HDInsight cluster extension. @@ -1003,20 +1263,9 @@ async def begin_create( :type cluster_name: str :param extension_name: The name of the cluster extension. Required. :type extension_name: str - :param parameters: The cluster extensions create request. Is either a Extension type or a IO - type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.Extension or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: The cluster extensions create request. Is either a Extension type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.Extension or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1031,7 +1280,7 @@ async def begin_create( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, @@ -1043,11 +1292,12 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -1058,17 +1308,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -1082,12 +1328,11 @@ async def get( :type cluster_name: str :param extension_name: The name of the cluster extension. Required. :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterMonitoringResponse or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.ClusterMonitoringResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1101,22 +1346,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterMonitoringResponse] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1126,21 +1369,17 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ClusterMonitoringResponse", pipeline_response) + deserialized = self._deserialize("ClusterMonitoringResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, cluster_name: str, extension_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1152,39 +1391,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -1198,14 +1440,6 @@ async def begin_delete( :type cluster_name: str :param extension_name: The name of the cluster extension. Required. :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1219,7 +1453,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, @@ -1229,11 +1463,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -1244,17 +1479,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_azure_async_operation_status( @@ -1270,12 +1501,11 @@ async def get_azure_async_operation_status( :type extension_name: str :param operation_id: The long running operation id. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1289,23 +1519,21 @@ async def get_azure_async_operation_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) - request = build_get_azure_async_operation_status_request( + _request = build_get_azure_async_operation_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_azure_async_operation_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1315,13 +1543,9 @@ async def get_azure_async_operation_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AsyncOperationResult", pipeline_response) + deserialized = self._deserialize("AsyncOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_azure_async_operation_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}/azureAsyncOperations/{operationId}" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_locations_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_locations_operations.py index 89305635543b2..b26410a0ae800 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_locations_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_locations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._locations_operations import ( build_check_name_availability_request, build_get_azure_async_operation_status_request, @@ -35,6 +34,10 @@ build_validate_cluster_create_request_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,12 +67,11 @@ async def get_capabilities(self, location: str, **kwargs: Any) -> _models.Capabi :param location: The Azure location (region) for which to make the request. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CapabilitiesResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.CapabilitiesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -83,20 +85,18 @@ async def get_capabilities(self, location: str, **kwargs: Any) -> _models.Capabi api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CapabilitiesResult] = kwargs.pop("cls", None) - request = build_get_capabilities_request( + _request = build_get_capabilities_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_capabilities.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -106,16 +106,12 @@ async def get_capabilities(self, location: str, **kwargs: Any) -> _models.Capabi error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CapabilitiesResult", pipeline_response) + deserialized = self._deserialize("CapabilitiesResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_capabilities.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities" - } + return deserialized # type: ignore @distributed_trace_async async def list_usages(self, location: str, **kwargs: Any) -> _models.UsagesListResult: @@ -123,12 +119,11 @@ async def list_usages(self, location: str, **kwargs: Any) -> _models.UsagesListR :param location: The Azure location (region) for which to make the request. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UsagesListResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.UsagesListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -142,20 +137,18 @@ async def list_usages(self, location: str, **kwargs: Any) -> _models.UsagesListR api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsagesListResult] = kwargs.pop("cls", None) - request = build_list_usages_request( + _request = build_list_usages_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_usages.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,16 +158,12 @@ async def list_usages(self, location: str, **kwargs: Any) -> _models.UsagesListR error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("UsagesListResult", pipeline_response) + deserialized = self._deserialize("UsagesListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_usages.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages" - } + return deserialized # type: ignore @distributed_trace_async async def list_billing_specs(self, location: str, **kwargs: Any) -> _models.BillingResponseListResult: @@ -182,12 +171,11 @@ async def list_billing_specs(self, location: str, **kwargs: Any) -> _models.Bill :param location: The Azure location (region) for which to make the request. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BillingResponseListResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.BillingResponseListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,20 +189,18 @@ async def list_billing_specs(self, location: str, **kwargs: Any) -> _models.Bill api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BillingResponseListResult] = kwargs.pop("cls", None) - request = build_list_billing_specs_request( + _request = build_list_billing_specs_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_billing_specs.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,16 +210,12 @@ async def list_billing_specs(self, location: str, **kwargs: Any) -> _models.Bill error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BillingResponseListResult", pipeline_response) + deserialized = self._deserialize("BillingResponseListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_billing_specs.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs" - } + return deserialized # type: ignore @distributed_trace_async async def get_azure_async_operation_status( @@ -245,12 +227,11 @@ async def get_azure_async_operation_status( :type location: str :param operation_id: The long running operation id. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -264,21 +245,19 @@ async def get_azure_async_operation_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) - request = build_get_azure_async_operation_status_request( + _request = build_get_azure_async_operation_status_request( location=location, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_azure_async_operation_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -288,16 +267,12 @@ async def get_azure_async_operation_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AsyncOperationResult", pipeline_response) + deserialized = self._deserialize("AsyncOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_azure_async_operation_status.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/azureasyncoperations/{operationId}" - } + return deserialized # type: ignore @overload async def check_name_availability( @@ -317,7 +292,6 @@ async def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailabilityCheckResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.NameAvailabilityCheckResult :raises ~azure.core.exceptions.HttpResponseError: @@ -325,18 +299,17 @@ async def check_name_availability( @overload async def check_name_availability( - self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailabilityCheckResult: """Check the cluster name is available or not. :param location: The Azure location (region) for which to make the request. Required. :type location: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailabilityCheckResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.NameAvailabilityCheckResult :raises ~azure.core.exceptions.HttpResponseError: @@ -344,24 +317,21 @@ async def check_name_availability( @distributed_trace_async async def check_name_availability( - self, location: str, parameters: Union[_models.NameAvailabilityCheckRequestParameters, IO], **kwargs: Any + self, location: str, parameters: Union[_models.NameAvailabilityCheckRequestParameters, IO[bytes]], **kwargs: Any ) -> _models.NameAvailabilityCheckResult: """Check the cluster name is available or not. :param location: The Azure location (region) for which to make the request. Required. :type location: str - :param parameters: Is either a NameAvailabilityCheckRequestParameters type or a IO type. + :param parameters: Is either a NameAvailabilityCheckRequestParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.NameAvailabilityCheckRequestParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :type parameters: ~azure.mgmt.hdinsight.models.NameAvailabilityCheckRequestParameters or + IO[bytes] :return: NameAvailabilityCheckResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.NameAvailabilityCheckResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -384,23 +354,21 @@ async def check_name_availability( else: _json = self._serialize.body(parameters, "NameAvailabilityCheckRequestParameters") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -410,16 +378,12 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("NameAvailabilityCheckResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability" - } + return deserialized # type: ignore @overload async def validate_cluster_create_request( @@ -439,7 +403,6 @@ async def validate_cluster_create_request( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterCreateValidationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.ClusterCreateValidationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -447,18 +410,17 @@ async def validate_cluster_create_request( @overload async def validate_cluster_create_request( - self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.ClusterCreateValidationResult: """Validate the cluster create request spec is valid or not. :param location: The Azure location (region) for which to make the request. Required. :type location: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterCreateValidationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.ClusterCreateValidationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -466,24 +428,24 @@ async def validate_cluster_create_request( @distributed_trace_async async def validate_cluster_create_request( - self, location: str, parameters: Union[_models.ClusterCreateRequestValidationParameters, IO], **kwargs: Any + self, + location: str, + parameters: Union[_models.ClusterCreateRequestValidationParameters, IO[bytes]], + **kwargs: Any ) -> _models.ClusterCreateValidationResult: """Validate the cluster create request spec is valid or not. :param location: The Azure location (region) for which to make the request. Required. :type location: str - :param parameters: Is either a ClusterCreateRequestValidationParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.hdinsight.models.ClusterCreateRequestValidationParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Is either a ClusterCreateRequestValidationParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ClusterCreateRequestValidationParameters or + IO[bytes] :return: ClusterCreateValidationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.ClusterCreateValidationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -506,23 +468,21 @@ async def validate_cluster_create_request( else: _json = self._serialize.body(parameters, "ClusterCreateRequestValidationParameters") - request = build_validate_cluster_create_request_request( + _request = build_validate_cluster_create_request_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.validate_cluster_create_request.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -532,13 +492,9 @@ async def validate_cluster_create_request( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ClusterCreateValidationResult", pipeline_response) + deserialized = self._deserialize("ClusterCreateValidationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - validate_cluster_create_request.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/validateCreateRequest" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_operations.py index a13974f466ff4..4df08d1bc2147 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,16 +20,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +59,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists all of the available HDInsight REST API operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -67,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -78,14 +80,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -97,13 +97,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -113,11 +112,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,5 +128,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.HDInsight/operations"} diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_endpoint_connections_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_endpoint_connections_operations.py index 781da753a7599..a5094e5d6baae 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +39,10 @@ build_list_by_cluster_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,6 @@ def list_by_cluster( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -84,7 +88,7 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,17 +99,15 @@ def list_by_cluster( def prepare_request(next_link=None): if not next_link: - request = build_list_by_cluster_request( + _request = build_list_by_cluster_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_cluster.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -117,13 +119,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -133,11 +134,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,19 +151,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections" - } - async def _create_or_update_initial( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnection: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +172,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -185,7 +182,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -194,40 +191,35 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - @overload async def begin_create_or_update( self, @@ -252,14 +244,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -273,7 +257,7 @@ async def begin_create_or_update( resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -287,18 +271,10 @@ async def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: The private endpoint connection create or update request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -312,7 +288,7 @@ async def begin_create_or_update( resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Approve or reject a private endpoint connection manually. @@ -324,19 +300,8 @@ async def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: The private endpoint connection create or update request. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.PrivateEndpointConnection or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -365,12 +330,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -383,17 +349,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def get( @@ -407,12 +371,11 @@ async def get( :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -426,22 +389,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -451,21 +412,17 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -477,39 +434,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -523,14 +483,6 @@ async def begin_delete( :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -544,7 +496,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -554,11 +506,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -570,14 +523,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_link_resources_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_link_resources_operations.py index d7ea84f38296a..7e82f45745b9a 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_link_resources_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request, build_list_by_cluster_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,12 +63,11 @@ async def list_by_cluster( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceListResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,21 +81,19 @@ async def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - request = build_list_by_cluster_request( + _request = build_list_by_cluster_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_cluster.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -103,16 +103,12 @@ async def list_by_cluster( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources" - } + return deserialized # type: ignore @distributed_trace_async async def get( @@ -126,12 +122,11 @@ async def get( :type cluster_name: str :param private_link_resource_name: The name of the private link resource. Required. :type private_link_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -145,22 +140,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cluster_name=cluster_name, private_link_resource_name=private_link_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,13 +163,9 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_actions_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_actions_operations.py index 32dee98bd3dc6..b3d39bc86670f 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_actions_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_actions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._script_actions_operations import ( build_delete_request, build_get_execution_async_operation_status_request, @@ -35,6 +34,10 @@ build_list_by_cluster_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,12 +73,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type cluster_name: str :param script_name: The name of the script. Required. :type script_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,22 +91,20 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, cluster_name=cluster_name, script_name=script_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -115,11 +115,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_cluster( @@ -131,7 +127,6 @@ def list_by_cluster( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RuntimeScriptActionDetail or the result of cls(response) :rtype: @@ -144,7 +139,7 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptActionsList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -155,17 +150,15 @@ def list_by_cluster( def prepare_request(next_link=None): if not next_link: - request = build_list_by_cluster_request( + _request = build_list_by_cluster_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_cluster.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -177,13 +170,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScriptActionsList", pipeline_response) @@ -193,11 +185,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -210,10 +202,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions" - } - @distributed_trace_async async def get_execution_detail( self, resource_group_name: str, cluster_name: str, script_execution_id: str, **kwargs: Any @@ -226,12 +214,11 @@ async def get_execution_detail( :type cluster_name: str :param script_execution_id: The script execution Id. Required. :type script_execution_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuntimeScriptActionDetail or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.RuntimeScriptActionDetail :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -245,22 +232,20 @@ async def get_execution_detail( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuntimeScriptActionDetail] = kwargs.pop("cls", None) - request = build_get_execution_detail_request( + _request = build_get_execution_detail_request( resource_group_name=resource_group_name, cluster_name=cluster_name, script_execution_id=script_execution_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_execution_detail.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -270,16 +255,12 @@ async def get_execution_detail( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuntimeScriptActionDetail", pipeline_response) + deserialized = self._deserialize("RuntimeScriptActionDetail", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_execution_detail.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}" - } + return deserialized # type: ignore @distributed_trace_async async def get_execution_async_operation_status( @@ -293,12 +274,11 @@ async def get_execution_async_operation_status( :type cluster_name: str :param operation_id: The long running operation id. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -312,22 +292,20 @@ async def get_execution_async_operation_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) - request = build_get_execution_async_operation_status_request( + _request = build_get_execution_async_operation_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_execution_async_operation_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -337,13 +315,9 @@ async def get_execution_async_operation_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AsyncOperationResult", pipeline_response) + deserialized = self._deserialize("AsyncOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_execution_async_operation_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions/azureasyncoperations/{operationId}" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_execution_history_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_execution_history_operations.py index 68ea6a3262451..b7f5ab7527284 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_execution_history_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_execution_history_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._script_execution_history_operations import build_list_by_cluster_request, build_promote_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +66,6 @@ def list_by_cluster( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RuntimeScriptActionDetail or the result of cls(response) :rtype: @@ -76,7 +78,7 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptActionExecutionHistoryList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -87,17 +89,15 @@ def list_by_cluster( def prepare_request(next_link=None): if not next_link: - request = build_list_by_cluster_request( + _request = build_list_by_cluster_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_cluster.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -109,13 +109,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScriptActionExecutionHistoryList", pipeline_response) @@ -125,11 +124,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -142,10 +141,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory" - } - @distributed_trace_async async def promote( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, script_execution_id: str, **kwargs: Any @@ -158,12 +153,11 @@ async def promote( # pylint: disable=inconsistent-return-statements :type cluster_name: str :param script_execution_id: The script execution Id. Required. :type script_execution_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,22 +171,20 @@ async def promote( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_promote_request( + _request = build_promote_request( resource_group_name=resource_group_name, cluster_name=cluster_name, script_execution_id=script_execution_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.promote.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -203,8 +195,4 @@ async def promote( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - promote.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_virtual_machines_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_virtual_machines_operations.py index e5e1818ddac3c..dd937d0fa9747 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_virtual_machines_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_virtual_machines_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,25 +16,29 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._virtual_machines_operations import ( build_get_async_operation_status_request, build_list_hosts_request, build_restart_hosts_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,12 +70,11 @@ async def list_hosts(self, resource_group_name: str, cluster_name: str, **kwargs :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: list of HostInfo or the result of cls(response) :rtype: list[~azure.mgmt.hdinsight.models.HostInfo] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,21 +88,19 @@ async def list_hosts(self, resource_group_name: str, cluster_name: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.HostInfo]] = kwargs.pop("cls", None) - request = build_list_hosts_request( + _request = build_list_hosts_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_hosts.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -108,21 +110,17 @@ async def list_hosts(self, resource_group_name: str, cluster_name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostInfo]", pipeline_response) + deserialized = self._deserialize("[HostInfo]", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - list_hosts.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/listHosts" - } - - async def _restart_hosts_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cluster_name: str, hosts: Union[List[str], IO], **kwargs: Any - ) -> None: - error_map = { + async def _restart_hosts_initial( + self, resource_group_name: str, cluster_name: str, hosts: Union[List[str], IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -135,7 +133,7 @@ async def _restart_hosts_initial( # pylint: disable=inconsistent-return-stateme api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -145,7 +143,7 @@ async def _restart_hosts_initial( # pylint: disable=inconsistent-return-stateme else: _json = self._serialize.body(hosts, "[str]") - request = build_restart_hosts_request( + _request = build_restart_hosts_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -153,31 +151,34 @@ async def _restart_hosts_initial( # pylint: disable=inconsistent-return-stateme content_type=content_type, json=_json, content=_content, - template_url=self._restart_hosts_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _restart_hosts_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts" - } + return deserialized # type: ignore @overload async def begin_restart_hosts( @@ -200,14 +201,6 @@ async def begin_restart_hosts( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -218,7 +211,7 @@ async def begin_restart_hosts( self, resource_group_name: str, cluster_name: str, - hosts: IO, + hosts: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -230,18 +223,10 @@ async def begin_restart_hosts( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param hosts: The list of hosts to restart. Required. - :type hosts: IO + :type hosts: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -249,7 +234,7 @@ async def begin_restart_hosts( @distributed_trace_async async def begin_restart_hosts( - self, resource_group_name: str, cluster_name: str, hosts: Union[List[str], IO], **kwargs: Any + self, resource_group_name: str, cluster_name: str, hosts: Union[List[str], IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Restarts the specified HDInsight cluster hosts. @@ -257,19 +242,9 @@ async def begin_restart_hosts( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :param hosts: The list of hosts to restart. Is either a [str] type or a IO type. Required. - :type hosts: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param hosts: The list of hosts to restart. Is either a [str] type or a IO[bytes] type. + Required. + :type hosts: list[str] or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -284,7 +259,7 @@ async def begin_restart_hosts( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restart_hosts_initial( # type: ignore + raw_result = await self._restart_hosts_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, hosts=hosts, @@ -295,11 +270,12 @@ async def begin_restart_hosts( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -310,17 +286,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_restart_hosts.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_async_operation_status( @@ -334,12 +306,11 @@ async def get_async_operation_status( :type cluster_name: str :param operation_id: The long running operation id. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,22 +324,20 @@ async def get_async_operation_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) - request = build_get_async_operation_status_request( + _request = build_get_async_operation_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_async_operation_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -378,13 +347,9 @@ async def get_async_operation_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AsyncOperationResult", pipeline_response) + deserialized = self._deserialize("AsyncOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_async_operation_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts/azureasyncoperations/{operationId}" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py index e7d0640d390db..bbbd93cacbffe 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py @@ -61,6 +61,7 @@ from ._models_py3 import HardwareProfile from ._models_py3 import HostInfo from ._models_py3 import IPConfiguration +from ._models_py3 import IpTag from ._models_py3 import KafkaRestProperties from ._models_py3 import LinuxOperatingSystemProfile from ._models_py3 import LocalizedName @@ -124,6 +125,7 @@ from ._hd_insight_management_client_enums import HDInsightClusterProvisioningState from ._hd_insight_management_client_enums import JsonWebKeyEncryptionAlgorithm from ._hd_insight_management_client_enums import OSType +from ._hd_insight_management_client_enums import OutboundDependenciesManagedType from ._hd_insight_management_client_enums import PrivateEndpointConnectionProvisioningState from ._hd_insight_management_client_enums import PrivateIPAllocationMethod from ._hd_insight_management_client_enums import PrivateLink @@ -193,6 +195,7 @@ "HardwareProfile", "HostInfo", "IPConfiguration", + "IpTag", "KafkaRestProperties", "LinuxOperatingSystemProfile", "LocalizedName", @@ -255,6 +258,7 @@ "HDInsightClusterProvisioningState", "JsonWebKeyEncryptionAlgorithm", "OSType", + "OutboundDependenciesManagedType", "PrivateEndpointConnectionProvisioningState", "PrivateIPAllocationMethod", "PrivateLink", diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_hd_insight_management_client_enums.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_hd_insight_management_client_enums.py index 15a659d438f2f..c4ecadf1c41b6 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_hd_insight_management_client_enums.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_hd_insight_management_client_enums.py @@ -81,6 +81,16 @@ class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): LINUX = "Linux" +class OutboundDependenciesManagedType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A value to describe how the outbound dependencies of a HDInsight cluster are managed. 'Managed' + means that the outbound dependencies are managed by the HDInsight service. 'External' means + that the outbound dependencies are managed by a customer specific solution. + """ + + MANAGED = "Managed" + EXTERNAL = "External" + + class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state, which only appears in the response.""" diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models_py3.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models_py3.py index 718cd6152ef28..7e1aefd378260 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models_py3.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models_py3.py @@ -98,7 +98,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -134,7 +134,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -143,22 +143,6 @@ class ProxyResource(Resource): :vartype type: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class Application(ProxyResource): """The HDInsight cluster application. @@ -166,7 +150,7 @@ class Application(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1045,7 +1029,7 @@ class ResourceAutoGenerated(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1080,10 +1064,10 @@ class TrackedResource(ResourceAutoGenerated): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1128,10 +1112,10 @@ class Cluster(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1621,7 +1605,7 @@ class ClusterGetProperties(_serialization.Model): # pylint: disable=too-many-in Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar cluster_version: The version of the cluster. :vartype cluster_version: str @@ -1838,7 +1822,7 @@ class ClusterIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.hdinsight.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the cluster. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long :vartype user_assigned_identities: dict[str, ~azure.mgmt.hdinsight.models.UserAssignedIdentity] """ @@ -1869,7 +1853,7 @@ def __init__( :paramtype type: str or ~azure.mgmt.hdinsight.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the cluster. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long :paramtype user_assigned_identities: dict[str, ~azure.mgmt.hdinsight.models.UserAssignedIdentity] """ @@ -1999,19 +1983,31 @@ class ClusterPatchParameters(_serialization.Model): :ivar tags: The resource tags. :vartype tags: dict[str, str] + :ivar identity: The identity of the cluster, if configured. + :vartype identity: ~azure.mgmt.hdinsight.models.ClusterIdentity """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ClusterIdentity"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ClusterIdentity"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The resource tags. :paramtype tags: dict[str, str] + :keyword identity: The identity of the cluster, if configured. + :paramtype identity: ~azure.mgmt.hdinsight.models.ClusterIdentity """ super().__init__(**kwargs) self.tags = tags + self.identity = identity class ClusterResizeParameters(_serialization.Model): @@ -2434,7 +2430,7 @@ def __init__( class ExecuteScriptActionParameters(_serialization.Model): """The parameters for the script actions to execute on a running cluster. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar script_actions: The list of run time script actions. :vartype script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] @@ -2595,7 +2591,7 @@ class IPConfiguration(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: The private link IP configuration id. :vartype id: str @@ -2673,6 +2669,41 @@ def __init__( self.subnet = subnet +class IpTag(_serialization.Model): + """Contains the IpTag associated with the public IP address. + + All required parameters must be populated in order to send to server. + + :ivar ip_tag_type: Gets or sets the ipTag type: Example FirstPartyUsage. Required. + :vartype ip_tag_type: str + :ivar tag: Gets or sets value of the IpTag associated with the public IP. Example HDInsight, + SQL, Storage etc. Required. + :vartype tag: str + """ + + _validation = { + "ip_tag_type": {"required": True}, + "tag": {"required": True}, + } + + _attribute_map = { + "ip_tag_type": {"key": "ipTagType", "type": "str"}, + "tag": {"key": "tag", "type": "str"}, + } + + def __init__(self, *, ip_tag_type: str, tag: str, **kwargs: Any) -> None: + """ + :keyword ip_tag_type: Gets or sets the ipTag type: Example FirstPartyUsage. Required. + :paramtype ip_tag_type: str + :keyword tag: Gets or sets value of the IpTag associated with the public IP. Example HDInsight, + SQL, Storage etc. Required. + :paramtype tag: str + """ + super().__init__(**kwargs) + self.ip_tag_type = ip_tag_type + self.tag = tag + + class KafkaRestProperties(_serialization.Model): """The kafka rest proxy configuration which contains AAD security group information. @@ -2975,6 +3006,12 @@ def __init__(self, *, name_available: Optional[bool] = None, **kwargs: Any) -> N class NetworkProperties(_serialization.Model): """The network properties. + :ivar outbound_dependencies_managed_type: A value to describe how the outbound dependencies of + a HDInsight cluster are managed. 'Managed' means that the outbound dependencies are managed by + the HDInsight service. 'External' means that the outbound dependencies are managed by a + customer specific solution. Known values are: "Managed" and "External". + :vartype outbound_dependencies_managed_type: str or + ~azure.mgmt.hdinsight.models.OutboundDependenciesManagedType :ivar resource_provider_connection: The direction for the resource provider connection. Known values are: "Inbound" and "Outbound". :vartype resource_provider_connection: str or @@ -2982,21 +3019,34 @@ class NetworkProperties(_serialization.Model): :ivar private_link: Indicates whether or not private link is enabled. Known values are: "Disabled" and "Enabled". :vartype private_link: str or ~azure.mgmt.hdinsight.models.PrivateLink + :ivar public_ip_tag: Gets or sets the IP tag for the public IPs created along with the + HDInsight Clusters. + :vartype public_ip_tag: ~azure.mgmt.hdinsight.models.IpTag """ _attribute_map = { + "outbound_dependencies_managed_type": {"key": "outboundDependenciesManagedType", "type": "str"}, "resource_provider_connection": {"key": "resourceProviderConnection", "type": "str"}, "private_link": {"key": "privateLink", "type": "str"}, + "public_ip_tag": {"key": "publicIpTag", "type": "IpTag"}, } def __init__( self, *, + outbound_dependencies_managed_type: Optional[Union[str, "_models.OutboundDependenciesManagedType"]] = None, resource_provider_connection: Optional[Union[str, "_models.ResourceProviderConnection"]] = None, private_link: Optional[Union[str, "_models.PrivateLink"]] = None, + public_ip_tag: Optional["_models.IpTag"] = None, **kwargs: Any ) -> None: """ + :keyword outbound_dependencies_managed_type: A value to describe how the outbound dependencies + of a HDInsight cluster are managed. 'Managed' means that the outbound dependencies are managed + by the HDInsight service. 'External' means that the outbound dependencies are managed by a + customer specific solution. Known values are: "Managed" and "External". + :paramtype outbound_dependencies_managed_type: str or + ~azure.mgmt.hdinsight.models.OutboundDependenciesManagedType :keyword resource_provider_connection: The direction for the resource provider connection. Known values are: "Inbound" and "Outbound". :paramtype resource_provider_connection: str or @@ -3004,10 +3054,15 @@ def __init__( :keyword private_link: Indicates whether or not private link is enabled. Known values are: "Disabled" and "Enabled". :paramtype private_link: str or ~azure.mgmt.hdinsight.models.PrivateLink + :keyword public_ip_tag: Gets or sets the IP tag for the public IPs created along with the + HDInsight Clusters. + :paramtype public_ip_tag: ~azure.mgmt.hdinsight.models.IpTag """ super().__init__(**kwargs) + self.outbound_dependencies_managed_type = outbound_dependencies_managed_type self.resource_provider_connection = resource_provider_connection self.private_link = private_link + self.public_ip_tag = public_ip_tag class Operation(_serialization.Model): @@ -3196,10 +3251,10 @@ class PrivateEndpointConnection(Resource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3299,7 +3354,7 @@ class PrivateLinkConfiguration(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: The private link configuration id. :vartype id: str @@ -3364,7 +3419,7 @@ class PrivateLinkResource(ResourceAutoGenerated): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3435,7 +3490,7 @@ def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = Non class PrivateLinkServiceConnectionState(_serialization.Model): """The private link service connection state. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar status: The concrete private link service connection. Required. Known values are: "Approved", "Rejected", "Pending", and "Removed". @@ -3717,7 +3772,7 @@ class RuntimeScriptAction(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The name of the script action. Required. :vartype name: str @@ -3772,7 +3827,7 @@ class RuntimeScriptActionDetail(RuntimeScriptAction): # pylint: disable=too-man Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The name of the script action. Required. :vartype name: str @@ -3855,7 +3910,7 @@ def __init__( class ScriptAction(_serialization.Model): """Describes a script action on role on the cluster. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The name of the script action. Required. :vartype name: str @@ -4360,7 +4415,7 @@ def __init__( self.last_modified_at = last_modified_at -class UpdateClusterIdentityCertificateParameters(_serialization.Model): +class UpdateClusterIdentityCertificateParameters(_serialization.Model): # pylint: disable=name-too-long """The update cluster identity certificate request parameters. :ivar application_id: The application id. diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_applications_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_applications_operations.py index 4c08428ef1acb..3e22e0de8995b 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_applications_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_applications_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_by_cluster_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +64,7 @@ def build_list_by_cluster_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +81,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +96,7 @@ def build_get_request( "applicationName": _SERIALIZER.url("application_name", application_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,7 +113,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +129,7 @@ def build_create_request( "applicationName": _SERIALIZER.url("application_name", application_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +163,7 @@ def build_delete_request( "applicationName": _SERIALIZER.url("application_name", application_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,7 +174,7 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_azure_async_operation_status_request( +def build_get_azure_async_operation_status_request( # pylint: disable=name-too-long resource_group_name: str, cluster_name: str, application_name: str, @@ -180,7 +185,7 @@ def build_get_azure_async_operation_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +201,7 @@ def build_get_azure_async_operation_status_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -236,7 +241,6 @@ def list_by_cluster( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Application or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.Application] :raises ~azure.core.exceptions.HttpResponseError: @@ -247,7 +251,7 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,17 +262,15 @@ def list_by_cluster( def prepare_request(next_link=None): if not next_link: - request = build_list_by_cluster_request( + _request = build_list_by_cluster_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_cluster.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -280,13 +282,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ApplicationListResult", pipeline_response) @@ -296,11 +297,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -313,10 +314,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications" - } - @distributed_trace def get( self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any @@ -329,12 +326,11 @@ def get( :type cluster_name: str :param application_name: The constant value for the application name. Required. :type application_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Application or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.Application :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,22 +344,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Application] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -373,26 +367,22 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" - } + return deserialized # type: ignore def _create_initial( self, resource_group_name: str, cluster_name: str, application_name: str, - parameters: Union[_models.Application, IO], + parameters: Union[_models.Application, IO[bytes]], **kwargs: Any - ) -> _models.Application: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,7 +395,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Application] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -415,7 +405,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "Application") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, @@ -424,35 +414,34 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Application", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" - } + return deserialized # type: ignore @overload def begin_create( @@ -478,14 +467,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Application or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsight.models.Application] @@ -498,7 +479,7 @@ def begin_create( resource_group_name: str, cluster_name: str, application_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -512,18 +493,10 @@ def begin_create( :param application_name: The constant value for the application name. Required. :type application_name: str :param parameters: The application create request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Application or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsight.models.Application] @@ -536,7 +509,7 @@ def begin_create( resource_group_name: str, cluster_name: str, application_name: str, - parameters: Union[_models.Application, IO], + parameters: Union[_models.Application, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Application]: """Creates applications for the HDInsight cluster. @@ -547,20 +520,9 @@ def begin_create( :type cluster_name: str :param application_name: The constant value for the application name. Required. :type application_name: str - :param parameters: The application create request. Is either a Application type or a IO type. - Required. - :type parameters: ~azure.mgmt.hdinsight.models.Application or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: The application create request. Is either a Application type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.Application or IO[bytes] :return: An instance of LROPoller that returns either Application or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsight.models.Application] @@ -588,12 +550,13 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -605,22 +568,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Application].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" - } + return LROPoller[_models.Application]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -632,39 +593,42 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -678,14 +642,6 @@ def begin_delete( :type cluster_name: str :param application_name: The constant value for the application name. Required. :type application_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -699,7 +655,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, @@ -709,11 +665,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -724,17 +681,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_azure_async_operation_status( @@ -750,12 +703,11 @@ def get_azure_async_operation_status( :type application_name: str :param operation_id: The long running operation id. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -769,23 +721,21 @@ def get_azure_async_operation_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) - request = build_get_azure_async_operation_status_request( + _request = build_get_azure_async_operation_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_azure_async_operation_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -795,13 +745,9 @@ def get_azure_async_operation_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AsyncOperationResult", pipeline_response) + deserialized = self._deserialize("AsyncOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_azure_async_operation_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}/azureasyncoperations/{operationId}" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_clusters_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_clusters_operations.py index d984fd0ac0dfe..af76a8b7657fa 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_clusters_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_clusters_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -60,7 +65,7 @@ def build_create_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +84,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -94,7 +99,7 @@ def build_update_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +118,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +132,7 @@ def build_delete_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +147,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +161,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +176,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +189,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -205,7 +210,7 @@ def build_resize_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -221,7 +226,7 @@ def build_resize_request( "roleName": _SERIALIZER.url("role_name", role_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -234,7 +239,7 @@ def build_resize_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_auto_scale_configuration_request( +def build_update_auto_scale_configuration_request( # pylint: disable=name-too-long resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], @@ -244,7 +249,7 @@ def build_update_auto_scale_configuration_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -260,7 +265,7 @@ def build_update_auto_scale_configuration_request( "roleName": _SERIALIZER.url("role_name", role_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -277,7 +282,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,7 +291,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -303,7 +308,7 @@ def build_rotate_disk_encryption_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -318,7 +323,7 @@ def build_rotate_disk_encryption_key_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -337,7 +342,7 @@ def build_get_gateway_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -351,7 +356,7 @@ def build_get_gateway_settings_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -368,7 +373,7 @@ def build_update_gateway_settings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -383,7 +388,7 @@ def build_update_gateway_settings_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -396,13 +401,13 @@ def build_update_gateway_settings_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_azure_async_operation_status_request( +def build_get_azure_async_operation_status_request( # pylint: disable=name-too-long resource_group_name: str, cluster_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -417,7 +422,7 @@ def build_get_azure_async_operation_status_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -428,13 +433,13 @@ def build_get_azure_async_operation_status_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_identity_certificate_request( +def build_update_identity_certificate_request( # pylint: disable=name-too-long resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -449,7 +454,7 @@ def build_update_identity_certificate_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -468,7 +473,7 @@ def build_execute_script_actions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -483,7 +488,7 @@ def build_execute_script_actions_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -519,10 +524,10 @@ def _create_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterCreateParametersExtended, IO], + parameters: Union[_models.ClusterCreateParametersExtended, IO[bytes]], **kwargs: Any - ) -> _models.Cluster: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -535,7 +540,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -545,7 +550,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "ClusterCreateParametersExtended") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -553,35 +558,34 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Cluster", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" - } + return deserialized # type: ignore @overload def begin_create( @@ -604,14 +608,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsight.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -622,7 +618,7 @@ def begin_create( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -634,18 +630,10 @@ def begin_create( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster create request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsight.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -656,7 +644,7 @@ def begin_create( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterCreateParametersExtended, IO], + parameters: Union[_models.ClusterCreateParametersExtended, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Cluster]: """Creates a new HDInsight cluster with the specified parameters. @@ -666,19 +654,8 @@ def begin_create( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster create request. Is either a ClusterCreateParametersExtended type - or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.ClusterCreateParametersExtended or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ClusterCreateParametersExtended or IO[bytes] :return: An instance of LROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsight.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -704,12 +681,13 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Cluster", pipeline_response) + deserialized = self._deserialize("Cluster", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -721,17 +699,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Cluster].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" - } + return LROPoller[_models.Cluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update( @@ -754,7 +730,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Cluster or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.Cluster :raises ~azure.core.exceptions.HttpResponseError: @@ -765,7 +740,7 @@ def update( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -777,11 +752,10 @@ def update( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster patch request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Cluster or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.Cluster :raises ~azure.core.exceptions.HttpResponseError: @@ -792,7 +766,7 @@ def update( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterPatchParameters, IO], + parameters: Union[_models.ClusterPatchParameters, IO[bytes]], **kwargs: Any ) -> _models.Cluster: """Patch HDInsight cluster with the specified parameters. @@ -801,18 +775,14 @@ def update( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :param parameters: The cluster patch request. Is either a ClusterPatchParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.ClusterPatchParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: The cluster patch request. Is either a ClusterPatchParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ClusterPatchParameters or IO[bytes] :return: Cluster or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.Cluster :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -835,7 +805,7 @@ def update( else: _json = self._serialize.body(parameters, "ClusterPatchParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -843,16 +813,14 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -862,21 +830,15 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Cluster", pipeline_response) + deserialized = self._deserialize("Cluster", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" - } + return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -888,38 +850,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: @@ -929,14 +894,6 @@ def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: An :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -950,7 +907,7 @@ def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: An lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, @@ -959,11 +916,12 @@ def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: An params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -974,17 +932,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.Cluster: @@ -994,12 +948,11 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Cluster or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.Cluster :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1013,21 +966,19 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1037,16 +988,12 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Cluster", pipeline_response) + deserialized = self._deserialize("Cluster", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Cluster"]: @@ -1054,7 +1001,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Cluster or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -1065,7 +1011,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1076,16 +1022,14 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1097,13 +1041,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ClusterListResult", pipeline_response) @@ -1113,11 +1056,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1130,19 +1073,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters" - } - - def _resize_initial( # pylint: disable=inconsistent-return-statements + def _resize_initial( self, resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], - parameters: Union[_models.ClusterResizeParameters, IO], + parameters: Union[_models.ClusterResizeParameters, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1155,7 +1094,7 @@ def _resize_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1165,7 +1104,7 @@ def _resize_initial( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(parameters, "ClusterResizeParameters") - request = build_resize_request( + _request = build_resize_request( resource_group_name=resource_group_name, cluster_name=cluster_name, role_name=role_name, @@ -1174,31 +1113,34 @@ def _resize_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._resize_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _resize_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize" - } + return deserialized # type: ignore @overload def begin_resize( @@ -1224,14 +1166,6 @@ def begin_resize( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1243,7 +1177,7 @@ def begin_resize( resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1257,18 +1191,10 @@ def begin_resize( :param role_name: The constant value for the roleName. "workernode" Required. :type role_name: str or ~azure.mgmt.hdinsight.models.RoleName :param parameters: The parameters for the resize operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1280,7 +1206,7 @@ def begin_resize( resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], - parameters: Union[_models.ClusterResizeParameters, IO], + parameters: Union[_models.ClusterResizeParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Resizes the specified HDInsight cluster to the specified size. @@ -1292,19 +1218,8 @@ def begin_resize( :param role_name: The constant value for the roleName. "workernode" Required. :type role_name: str or ~azure.mgmt.hdinsight.models.RoleName :param parameters: The parameters for the resize operation. Is either a ClusterResizeParameters - type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.ClusterResizeParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ClusterResizeParameters or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1319,7 +1234,7 @@ def begin_resize( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._resize_initial( # type: ignore + raw_result = self._resize_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, role_name=role_name, @@ -1331,11 +1246,12 @@ def begin_resize( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1346,27 +1262,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_resize.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _update_auto_scale_configuration_initial( # pylint: disable=inconsistent-return-statements + def _update_auto_scale_configuration_initial( self, resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], - parameters: Union[_models.AutoscaleConfigurationUpdateParameter, IO], + parameters: Union[_models.AutoscaleConfigurationUpdateParameter, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1379,7 +1291,7 @@ def _update_auto_scale_configuration_initial( # pylint: disable=inconsistent-re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1389,7 +1301,7 @@ def _update_auto_scale_configuration_initial( # pylint: disable=inconsistent-re else: _json = self._serialize.body(parameters, "AutoscaleConfigurationUpdateParameter") - request = build_update_auto_scale_configuration_request( + _request = build_update_auto_scale_configuration_request( resource_group_name=resource_group_name, cluster_name=cluster_name, role_name=role_name, @@ -1398,31 +1310,34 @@ def _update_auto_scale_configuration_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, content=_content, - template_url=self._update_auto_scale_configuration_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_auto_scale_configuration_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale" - } + return deserialized # type: ignore @overload def begin_update_auto_scale_configuration( @@ -1448,14 +1363,6 @@ def begin_update_auto_scale_configuration( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1467,7 +1374,7 @@ def begin_update_auto_scale_configuration( resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1481,18 +1388,10 @@ def begin_update_auto_scale_configuration( :param role_name: The constant value for the roleName. "workernode" Required. :type role_name: str or ~azure.mgmt.hdinsight.models.RoleName :param parameters: The parameters for the update autoscale configuration operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1504,7 +1403,7 @@ def begin_update_auto_scale_configuration( resource_group_name: str, cluster_name: str, role_name: Union[str, _models.RoleName], - parameters: Union[_models.AutoscaleConfigurationUpdateParameter, IO], + parameters: Union[_models.AutoscaleConfigurationUpdateParameter, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Updates the Autoscale Configuration for HDInsight cluster. @@ -1516,19 +1415,9 @@ def begin_update_auto_scale_configuration( :param role_name: The constant value for the roleName. "workernode" Required. :type role_name: str or ~azure.mgmt.hdinsight.models.RoleName :param parameters: The parameters for the update autoscale configuration operation. Is either a - AutoscaleConfigurationUpdateParameter type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.AutoscaleConfigurationUpdateParameter or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + AutoscaleConfigurationUpdateParameter type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.AutoscaleConfigurationUpdateParameter or + IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1543,7 +1432,7 @@ def begin_update_auto_scale_configuration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_auto_scale_configuration_initial( # type: ignore + raw_result = self._update_auto_scale_configuration_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, role_name=role_name, @@ -1555,11 +1444,12 @@ def begin_update_auto_scale_configuration( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1570,23 +1460,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_auto_scale_configuration.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Cluster"]: """Lists all the HDInsight clusters under the subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Cluster or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.Cluster] :raises ~azure.core.exceptions.HttpResponseError: @@ -1597,7 +1482,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Cluster"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1608,15 +1493,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Cluster"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1628,13 +1511,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ClusterListResult", pipeline_response) @@ -1644,11 +1526,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1661,16 +1543,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters"} - - def _rotate_disk_encryption_key_initial( # pylint: disable=inconsistent-return-statements + def _rotate_disk_encryption_key_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterDiskEncryptionParameters, IO], + parameters: Union[_models.ClusterDiskEncryptionParameters, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1683,7 +1563,7 @@ def _rotate_disk_encryption_key_initial( # pylint: disable=inconsistent-return- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1693,7 +1573,7 @@ def _rotate_disk_encryption_key_initial( # pylint: disable=inconsistent-return- else: _json = self._serialize.body(parameters, "ClusterDiskEncryptionParameters") - request = build_rotate_disk_encryption_key_request( + _request = build_rotate_disk_encryption_key_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -1701,31 +1581,34 @@ def _rotate_disk_encryption_key_initial( # pylint: disable=inconsistent-return- content_type=content_type, json=_json, content=_content, - template_url=self._rotate_disk_encryption_key_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _rotate_disk_encryption_key_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey" - } + return deserialized # type: ignore @overload def begin_rotate_disk_encryption_key( @@ -1748,14 +1631,6 @@ def begin_rotate_disk_encryption_key( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1766,7 +1641,7 @@ def begin_rotate_disk_encryption_key( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1778,18 +1653,10 @@ def begin_rotate_disk_encryption_key( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The parameters for the disk encryption operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1800,7 +1667,7 @@ def begin_rotate_disk_encryption_key( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterDiskEncryptionParameters, IO], + parameters: Union[_models.ClusterDiskEncryptionParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Rotate disk encryption key of the specified HDInsight cluster. @@ -1810,19 +1677,8 @@ def begin_rotate_disk_encryption_key( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The parameters for the disk encryption operation. Is either a - ClusterDiskEncryptionParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.ClusterDiskEncryptionParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ClusterDiskEncryptionParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ClusterDiskEncryptionParameters or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1837,7 +1693,7 @@ def begin_rotate_disk_encryption_key( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._rotate_disk_encryption_key_initial( # type: ignore + raw_result = self._rotate_disk_encryption_key_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, @@ -1848,11 +1704,12 @@ def begin_rotate_disk_encryption_key( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1863,17 +1720,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_rotate_disk_encryption_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_gateway_settings( @@ -1885,12 +1738,11 @@ def get_gateway_settings( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GatewaySettings or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.GatewaySettings :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1904,21 +1756,19 @@ def get_gateway_settings( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GatewaySettings] = kwargs.pop("cls", None) - request = build_get_gateway_settings_request( + _request = build_get_gateway_settings_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_gateway_settings.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1928,25 +1778,21 @@ def get_gateway_settings( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GatewaySettings", pipeline_response) + deserialized = self._deserialize("GatewaySettings", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get_gateway_settings.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/getGatewaySettings" - } - - def _update_gateway_settings_initial( # pylint: disable=inconsistent-return-statements + def _update_gateway_settings_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.UpdateGatewaySettingsParameters, IO], + parameters: Union[_models.UpdateGatewaySettingsParameters, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1959,7 +1805,7 @@ def _update_gateway_settings_initial( # pylint: disable=inconsistent-return-sta api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1969,7 +1815,7 @@ def _update_gateway_settings_initial( # pylint: disable=inconsistent-return-sta else: _json = self._serialize.body(parameters, "UpdateGatewaySettingsParameters") - request = build_update_gateway_settings_request( + _request = build_update_gateway_settings_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -1977,31 +1823,34 @@ def _update_gateway_settings_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, content=_content, - template_url=self._update_gateway_settings_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_gateway_settings_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings" - } + return deserialized # type: ignore @overload def begin_update_gateway_settings( @@ -2024,14 +1873,6 @@ def begin_update_gateway_settings( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2042,7 +1883,7 @@ def begin_update_gateway_settings( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -2054,18 +1895,10 @@ def begin_update_gateway_settings( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster configurations. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2076,7 +1909,7 @@ def begin_update_gateway_settings( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.UpdateGatewaySettingsParameters, IO], + parameters: Union[_models.UpdateGatewaySettingsParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Configures the gateway settings on the specified cluster. @@ -2086,19 +1919,8 @@ def begin_update_gateway_settings( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster configurations. Is either a UpdateGatewaySettingsParameters type - or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.UpdateGatewaySettingsParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.UpdateGatewaySettingsParameters or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2113,7 +1935,7 @@ def begin_update_gateway_settings( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_gateway_settings_initial( # type: ignore + raw_result = self._update_gateway_settings_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, @@ -2124,11 +1946,12 @@ def begin_update_gateway_settings( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -2139,17 +1962,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_gateway_settings.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_azure_async_operation_status( @@ -2163,12 +1982,11 @@ def get_azure_async_operation_status( :type cluster_name: str :param operation_id: The long running operation id. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2182,22 +2000,20 @@ def get_azure_async_operation_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) - request = build_get_azure_async_operation_status_request( + _request = build_get_azure_async_operation_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_azure_async_operation_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2207,25 +2023,21 @@ def get_azure_async_operation_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AsyncOperationResult", pipeline_response) + deserialized = self._deserialize("AsyncOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get_azure_async_operation_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/azureasyncoperations/{operationId}" - } - - def _update_identity_certificate_initial( # pylint: disable=inconsistent-return-statements + def _update_identity_certificate_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.UpdateClusterIdentityCertificateParameters, IO], + parameters: Union[_models.UpdateClusterIdentityCertificateParameters, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2238,7 +2050,7 @@ def _update_identity_certificate_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2248,7 +2060,7 @@ def _update_identity_certificate_initial( # pylint: disable=inconsistent-return else: _json = self._serialize.body(parameters, "UpdateClusterIdentityCertificateParameters") - request = build_update_identity_certificate_request( + _request = build_update_identity_certificate_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -2256,31 +2068,34 @@ def _update_identity_certificate_initial( # pylint: disable=inconsistent-return content_type=content_type, json=_json, content=_content, - template_url=self._update_identity_certificate_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_identity_certificate_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate" - } + return deserialized # type: ignore @overload def begin_update_identity_certificate( @@ -2303,14 +2118,6 @@ def begin_update_identity_certificate( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2321,7 +2128,7 @@ def begin_update_identity_certificate( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -2333,18 +2140,10 @@ def begin_update_identity_certificate( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster configurations. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2355,7 +2154,7 @@ def begin_update_identity_certificate( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.UpdateClusterIdentityCertificateParameters, IO], + parameters: Union[_models.UpdateClusterIdentityCertificateParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Updates the cluster identity certificate. @@ -2365,19 +2164,9 @@ def begin_update_identity_certificate( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The cluster configurations. Is either a - UpdateClusterIdentityCertificateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.UpdateClusterIdentityCertificateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + UpdateClusterIdentityCertificateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.UpdateClusterIdentityCertificateParameters or + IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2392,7 +2181,7 @@ def begin_update_identity_certificate( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_identity_certificate_initial( # type: ignore + raw_result = self._update_identity_certificate_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, @@ -2403,11 +2192,12 @@ def begin_update_identity_certificate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -2418,30 +2208,29 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_identity_certificate.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _execute_script_actions_initial( # pylint: disable=inconsistent-return-statements + def _execute_script_actions_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ExecuteScriptActionParameters, IO], + parameters: Union[_models.ExecuteScriptActionParameters, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -2450,7 +2239,7 @@ def _execute_script_actions_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2460,7 +2249,7 @@ def _execute_script_actions_initial( # pylint: disable=inconsistent-return-stat else: _json = self._serialize.body(parameters, "ExecuteScriptActionParameters") - request = build_execute_script_actions_request( + _request = build_execute_script_actions_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -2468,31 +2257,34 @@ def _execute_script_actions_initial( # pylint: disable=inconsistent-return-stat content_type=content_type, json=_json, content=_content, - template_url=self._execute_script_actions_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _execute_script_actions_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions" - } + return deserialized # type: ignore @overload def begin_execute_script_actions( @@ -2515,14 +2307,6 @@ def begin_execute_script_actions( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2533,7 +2317,7 @@ def begin_execute_script_actions( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -2545,18 +2329,10 @@ def begin_execute_script_actions( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The parameters for executing script actions. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2567,7 +2343,7 @@ def begin_execute_script_actions( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ExecuteScriptActionParameters, IO], + parameters: Union[_models.ExecuteScriptActionParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Executes script actions on the specified HDInsight cluster. @@ -2577,19 +2353,8 @@ def begin_execute_script_actions( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The parameters for executing script actions. Is either a - ExecuteScriptActionParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.ExecuteScriptActionParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ExecuteScriptActionParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ExecuteScriptActionParameters or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2604,7 +2369,7 @@ def begin_execute_script_actions( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._execute_script_actions_initial( # type: ignore + raw_result = self._execute_script_actions_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, @@ -2615,11 +2380,12 @@ def begin_execute_script_actions( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -2630,14 +2396,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_execute_script_actions.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_configurations_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_configurations_operations.py index 07bc063e0ab9f..9fcd028049da7 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_configurations_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_configurations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +30,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +60,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,7 +77,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -88,7 +93,7 @@ def build_update_request( "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,7 +112,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +127,7 @@ def build_get_request( "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,12 +165,11 @@ def list(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _m :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterConfigurations or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.ClusterConfigurations :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -179,21 +183,19 @@ def list(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _m api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterConfigurations] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -203,26 +205,22 @@ def list(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ClusterConfigurations", pipeline_response) + deserialized = self._deserialize("ClusterConfigurations", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations" - } - - def _update_initial( # pylint: disable=inconsistent-return-statements + def _update_initial( self, resource_group_name: str, cluster_name: str, configuration_name: str, - parameters: Union[Dict[str, str], IO], + parameters: Union[Dict[str, str], IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -235,7 +233,7 @@ def _update_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -245,7 +243,7 @@ def _update_initial( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(parameters, "{str}") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, cluster_name=cluster_name, configuration_name=configuration_name, @@ -254,31 +252,34 @@ def _update_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -305,14 +306,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -324,7 +317,7 @@ def begin_update( resource_group_name: str, cluster_name: str, configuration_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -339,18 +332,10 @@ def begin_update( :param configuration_name: The name of the cluster configuration. Required. :type configuration_name: str :param parameters: The cluster configurations. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -362,7 +347,7 @@ def begin_update( resource_group_name: str, cluster_name: str, configuration_name: str, - parameters: Union[Dict[str, str], IO], + parameters: Union[Dict[str, str], IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Configures the HTTP settings on the specified cluster. This API is deprecated, please use @@ -374,20 +359,9 @@ def begin_update( :type cluster_name: str :param configuration_name: The name of the cluster configuration. Required. :type configuration_name: str - :param parameters: The cluster configurations. Is either a {str: str} type or a IO type. + :param parameters: The cluster configurations. Is either a {str: str} type or a IO[bytes] type. Required. - :type parameters: dict[str, str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :type parameters: dict[str, str] or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -402,7 +376,7 @@ def begin_update( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, configuration_name=configuration_name, @@ -414,11 +388,12 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -429,17 +404,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -454,12 +425,11 @@ def get( :type cluster_name: str :param configuration_name: The name of the cluster configuration. Required. :type configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: dict mapping str to str or the result of cls(response) :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -473,22 +443,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Dict[str, str]] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cluster_name=cluster_name, configuration_name=configuration_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -498,13 +466,9 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize("{str}", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_extensions_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_extensions_operations.py index 14ede121e6e56..533ed7f07f8ed 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_extensions_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_extensions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +30,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_enable_monitoring_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -58,7 +63,7 @@ def build_enable_monitoring_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,7 +82,7 @@ def build_get_monitoring_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +96,7 @@ def build_get_monitoring_status_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,7 +113,7 @@ def build_disable_monitoring_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +127,7 @@ def build_disable_monitoring_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +144,7 @@ def build_enable_azure_monitor_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -154,7 +159,7 @@ def build_enable_azure_monitor_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +178,7 @@ def build_get_azure_monitor_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -187,7 +192,7 @@ def build_get_azure_monitor_status_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -204,7 +209,7 @@ def build_disable_azure_monitor_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +223,103 @@ def build_disable_azure_monitor_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_enable_azure_monitor_agent_request( + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitorAgent", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_azure_monitor_agent_status_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitorAgent", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_disable_azure_monitor_agent_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitorAgent", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,7 +336,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -251,7 +352,7 @@ def build_create_request( "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -270,7 +371,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -285,7 +386,7 @@ def build_get_request( "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -302,7 +403,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -317,7 +418,7 @@ def build_delete_request( "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -328,7 +429,7 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_azure_async_operation_status_request( +def build_get_azure_async_operation_status_request( # pylint: disable=name-too-long resource_group_name: str, cluster_name: str, extension_name: str, @@ -339,7 +440,7 @@ def build_get_azure_async_operation_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -355,7 +456,7 @@ def build_get_azure_async_operation_status_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -366,7 +467,7 @@ def build_get_azure_async_operation_status_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class ExtensionsOperations: +class ExtensionsOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -385,14 +486,14 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - def _enable_monitoring_initial( # pylint: disable=inconsistent-return-statements + def _enable_monitoring_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterMonitoringRequest, IO], + parameters: Union[_models.ClusterMonitoringRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,7 +506,7 @@ def _enable_monitoring_initial( # pylint: disable=inconsistent-return-statement api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -415,7 +516,7 @@ def _enable_monitoring_initial( # pylint: disable=inconsistent-return-statement else: _json = self._serialize.body(parameters, "ClusterMonitoringRequest") - request = build_enable_monitoring_request( + _request = build_enable_monitoring_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -423,31 +524,34 @@ def _enable_monitoring_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, content=_content, - template_url=self._enable_monitoring_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _enable_monitoring_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" - } + return deserialized # type: ignore @overload def begin_enable_monitoring( @@ -470,14 +574,6 @@ def begin_enable_monitoring( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -488,7 +584,7 @@ def begin_enable_monitoring( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -500,18 +596,10 @@ def begin_enable_monitoring( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The Operations Management Suite (OMS) workspace parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -522,7 +610,7 @@ def begin_enable_monitoring( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.ClusterMonitoringRequest, IO], + parameters: Union[_models.ClusterMonitoringRequest, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Enables the Operations Management Suite (OMS) on the HDInsight cluster. @@ -532,19 +620,8 @@ def begin_enable_monitoring( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The Operations Management Suite (OMS) workspace parameters. Is either a - ClusterMonitoringRequest type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.ClusterMonitoringRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ClusterMonitoringRequest type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ClusterMonitoringRequest or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -559,7 +636,7 @@ def begin_enable_monitoring( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._enable_monitoring_initial( # type: ignore + raw_result = self._enable_monitoring_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, @@ -570,11 +647,12 @@ def begin_enable_monitoring( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -585,17 +663,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_enable_monitoring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_monitoring_status( @@ -607,12 +681,11 @@ def get_monitoring_status( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterMonitoringResponse or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.ClusterMonitoringResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -626,21 +699,19 @@ def get_monitoring_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterMonitoringResponse] = kwargs.pop("cls", None) - request = build_get_monitoring_status_request( + _request = build_get_monitoring_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_monitoring_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -650,21 +721,17 @@ def get_monitoring_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ClusterMonitoringResponse", pipeline_response) + deserialized = self._deserialize("ClusterMonitoringResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get_monitoring_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" - } - - def _disable_monitoring_initial( # pylint: disable=inconsistent-return-statements + def _disable_monitoring_initial( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -676,38 +743,41 @@ def _disable_monitoring_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_disable_monitoring_request( + _request = build_disable_monitoring_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._disable_monitoring_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _disable_monitoring_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" - } + return deserialized # type: ignore @distributed_trace def begin_disable_monitoring(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: @@ -717,14 +787,6 @@ def begin_disable_monitoring(self, resource_group_name: str, cluster_name: str, :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -738,7 +800,7 @@ def begin_disable_monitoring(self, resource_group_name: str, cluster_name: str, lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._disable_monitoring_initial( # type: ignore + raw_result = self._disable_monitoring_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, @@ -747,11 +809,12 @@ def begin_disable_monitoring(self, resource_group_name: str, cluster_name: str, params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -762,26 +825,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_disable_monitoring.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" - } - - def _enable_azure_monitor_initial( # pylint: disable=inconsistent-return-statements + def _enable_azure_monitor_initial( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.AzureMonitorRequest, IO], + parameters: Union[_models.AzureMonitorRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -794,7 +853,7 @@ def _enable_azure_monitor_initial( # pylint: disable=inconsistent-return-statem api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -804,7 +863,7 @@ def _enable_azure_monitor_initial( # pylint: disable=inconsistent-return-statem else: _json = self._serialize.body(parameters, "AzureMonitorRequest") - request = build_enable_azure_monitor_request( + _request = build_enable_azure_monitor_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -812,31 +871,34 @@ def _enable_azure_monitor_initial( # pylint: disable=inconsistent-return-statem content_type=content_type, json=_json, content=_content, - template_url=self._enable_azure_monitor_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _enable_azure_monitor_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" - } + return deserialized # type: ignore @overload def begin_enable_azure_monitor( @@ -859,14 +921,6 @@ def begin_enable_azure_monitor( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -877,7 +931,7 @@ def begin_enable_azure_monitor( self, resource_group_name: str, cluster_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -889,18 +943,10 @@ def begin_enable_azure_monitor( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The Log Analytics workspace parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -911,7 +957,7 @@ def begin_enable_azure_monitor( self, resource_group_name: str, cluster_name: str, - parameters: Union[_models.AzureMonitorRequest, IO], + parameters: Union[_models.AzureMonitorRequest, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Enables the Azure Monitor on the HDInsight cluster. @@ -921,19 +967,8 @@ def begin_enable_azure_monitor( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param parameters: The Log Analytics workspace parameters. Is either a AzureMonitorRequest type - or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.AzureMonitorRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.AzureMonitorRequest or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -948,7 +983,7 @@ def begin_enable_azure_monitor( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._enable_azure_monitor_initial( # type: ignore + raw_result = self._enable_azure_monitor_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, @@ -959,11 +994,12 @@ def begin_enable_azure_monitor( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -974,17 +1010,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_enable_azure_monitor.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_azure_monitor_status( @@ -996,12 +1028,11 @@ def get_azure_monitor_status( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AzureMonitorResponse or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AzureMonitorResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1015,21 +1046,19 @@ def get_azure_monitor_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AzureMonitorResponse] = kwargs.pop("cls", None) - request = build_get_azure_monitor_status_request( + _request = build_get_azure_monitor_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_azure_monitor_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1039,21 +1068,17 @@ def get_azure_monitor_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureMonitorResponse", pipeline_response) + deserialized = self._deserialize("AzureMonitorResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_azure_monitor_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" - } + return deserialized # type: ignore - def _disable_azure_monitor_initial( # pylint: disable=inconsistent-return-statements + def _disable_azure_monitor_initial( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1065,38 +1090,41 @@ def _disable_azure_monitor_initial( # pylint: disable=inconsistent-return-state _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_disable_azure_monitor_request( + _request = build_disable_azure_monitor_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._disable_azure_monitor_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _disable_azure_monitor_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" - } + return deserialized # type: ignore @distributed_trace def begin_disable_azure_monitor( @@ -1108,14 +1136,6 @@ def begin_disable_azure_monitor( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1129,7 +1149,7 @@ def begin_disable_azure_monitor( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._disable_azure_monitor_initial( # type: ignore + raw_result = self._disable_azure_monitor_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, api_version=api_version, @@ -1138,11 +1158,12 @@ def begin_disable_azure_monitor( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1153,27 +1174,372 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_disable_azure_monitor.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" - } + def _enable_azure_monitor_agent_initial( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.AzureMonitorRequest, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AzureMonitorRequest") + + _request = build_enable_azure_monitor_agent_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - def _create_initial( # pylint: disable=inconsistent-return-statements + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_enable_azure_monitor_agent( + self, + resource_group_name: str, + cluster_name: str, + parameters: _models.AzureMonitorRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Enables the Azure Monitor Agent on the HDInsight cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param parameters: The Log Analytics workspace parameters. Required. + :type parameters: ~azure.mgmt.hdinsight.models.AzureMonitorRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_enable_azure_monitor_agent( + self, + resource_group_name: str, + cluster_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Enables the Azure Monitor Agent on the HDInsight cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param parameters: The Log Analytics workspace parameters. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_enable_azure_monitor_agent( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.AzureMonitorRequest, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Enables the Azure Monitor Agent on the HDInsight cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :param parameters: The Log Analytics workspace parameters. Is either a AzureMonitorRequest type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.AzureMonitorRequest or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._enable_azure_monitor_agent_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_azure_monitor_agent_status( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> _models.AzureMonitorResponse: + """Gets the status of Azure Monitor Agent on the HDInsight cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :return: AzureMonitorResponse or the result of cls(response) + :rtype: ~azure.mgmt.hdinsight.models.AzureMonitorResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AzureMonitorResponse] = kwargs.pop("cls", None) + + _request = build_get_azure_monitor_agent_status_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AzureMonitorResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _disable_azure_monitor_agent_initial( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disable_azure_monitor_agent_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_disable_azure_monitor_agent( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Disables the Azure Monitor Agent on the HDInsight cluster. + + :param resource_group_name: The name of the resource group. Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster. Required. + :type cluster_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._disable_azure_monitor_agent_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _create_initial( self, resource_group_name: str, cluster_name: str, extension_name: str, - parameters: Union[_models.Extension, IO], + parameters: Union[_models.Extension, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1186,7 +1552,7 @@ def _create_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1196,7 +1562,7 @@ def _create_initial( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(parameters, "Extension") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, @@ -1205,31 +1571,34 @@ def _create_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" - } + return deserialized # type: ignore @overload def begin_create( @@ -1255,14 +1624,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1274,7 +1635,7 @@ def begin_create( resource_group_name: str, cluster_name: str, extension_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1288,18 +1649,10 @@ def begin_create( :param extension_name: The name of the cluster extension. Required. :type extension_name: str :param parameters: The cluster extensions create request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1311,7 +1664,7 @@ def begin_create( resource_group_name: str, cluster_name: str, extension_name: str, - parameters: Union[_models.Extension, IO], + parameters: Union[_models.Extension, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Creates an HDInsight cluster extension. @@ -1322,20 +1675,9 @@ def begin_create( :type cluster_name: str :param extension_name: The name of the cluster extension. Required. :type extension_name: str - :param parameters: The cluster extensions create request. Is either a Extension type or a IO - type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.Extension or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: The cluster extensions create request. Is either a Extension type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.Extension or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1350,7 +1692,7 @@ def begin_create( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, @@ -1362,11 +1704,12 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1377,17 +1720,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -1401,12 +1740,11 @@ def get( :type cluster_name: str :param extension_name: The name of the cluster extension. Required. :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterMonitoringResponse or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.ClusterMonitoringResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1420,22 +1758,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterMonitoringResponse] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1445,21 +1781,17 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ClusterMonitoringResponse", pipeline_response) + deserialized = self._deserialize("ClusterMonitoringResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" - } + return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, cluster_name: str, extension_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1471,39 +1803,42 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -1517,14 +1852,6 @@ def begin_delete( :type cluster_name: str :param extension_name: The name of the cluster extension. Required. :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1538,7 +1865,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, @@ -1548,11 +1875,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1563,17 +1891,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_azure_async_operation_status( @@ -1589,12 +1913,11 @@ def get_azure_async_operation_status( :type extension_name: str :param operation_id: The long running operation id. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1608,23 +1931,21 @@ def get_azure_async_operation_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) - request = build_get_azure_async_operation_status_request( + _request = build_get_azure_async_operation_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_azure_async_operation_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1634,13 +1955,9 @@ def get_azure_async_operation_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AsyncOperationResult", pipeline_response) + deserialized = self._deserialize("AsyncOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_azure_async_operation_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}/azureAsyncOperations/{operationId}" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_locations_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_locations_operations.py index df02fb8b0d95e..f8f3d8cfbb25d 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_locations_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_locations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +42,7 @@ def build_get_capabilities_request(location: str, subscription_id: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +55,7 @@ def build_get_capabilities_request(location: str, subscription_id: str, **kwargs "location": _SERIALIZER.url("location", location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,7 +70,7 @@ def build_list_usages_request(location: str, subscription_id: str, **kwargs: Any _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +82,7 @@ def build_list_usages_request(location: str, subscription_id: str, **kwargs: Any "location": _SERIALIZER.url("location", location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -94,7 +97,7 @@ def build_list_billing_specs_request(location: str, subscription_id: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +110,7 @@ def build_list_billing_specs_request(location: str, subscription_id: str, **kwar "location": _SERIALIZER.url("location", location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,13 +121,13 @@ def build_list_billing_specs_request(location: str, subscription_id: str, **kwar return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_azure_async_operation_status_request( +def build_get_azure_async_operation_status_request( # pylint: disable=name-too-long location: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,7 +141,7 @@ def build_get_azure_async_operation_status_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -153,7 +156,7 @@ def build_check_name_availability_request(location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -167,7 +170,7 @@ def build_check_name_availability_request(location: str, subscription_id: str, * "location": _SERIALIZER.url("location", location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -180,11 +183,13 @@ def build_check_name_availability_request(location: str, subscription_id: str, * return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_validate_cluster_create_request_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_validate_cluster_create_request_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -198,7 +203,7 @@ def build_validate_cluster_create_request_request(location: str, subscription_id "location": _SERIALIZER.url("location", location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -236,12 +241,11 @@ def get_capabilities(self, location: str, **kwargs: Any) -> _models.Capabilities :param location: The Azure location (region) for which to make the request. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CapabilitiesResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.CapabilitiesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -255,20 +259,18 @@ def get_capabilities(self, location: str, **kwargs: Any) -> _models.Capabilities api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CapabilitiesResult] = kwargs.pop("cls", None) - request = build_get_capabilities_request( + _request = build_get_capabilities_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_capabilities.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -278,16 +280,12 @@ def get_capabilities(self, location: str, **kwargs: Any) -> _models.Capabilities error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CapabilitiesResult", pipeline_response) + deserialized = self._deserialize("CapabilitiesResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_capabilities.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities" - } + return deserialized # type: ignore @distributed_trace def list_usages(self, location: str, **kwargs: Any) -> _models.UsagesListResult: @@ -295,12 +293,11 @@ def list_usages(self, location: str, **kwargs: Any) -> _models.UsagesListResult: :param location: The Azure location (region) for which to make the request. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: UsagesListResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.UsagesListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,20 +311,18 @@ def list_usages(self, location: str, **kwargs: Any) -> _models.UsagesListResult: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsagesListResult] = kwargs.pop("cls", None) - request = build_list_usages_request( + _request = build_list_usages_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_usages.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -337,16 +332,12 @@ def list_usages(self, location: str, **kwargs: Any) -> _models.UsagesListResult: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("UsagesListResult", pipeline_response) + deserialized = self._deserialize("UsagesListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_usages.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages" - } + return deserialized # type: ignore @distributed_trace def list_billing_specs(self, location: str, **kwargs: Any) -> _models.BillingResponseListResult: @@ -354,12 +345,11 @@ def list_billing_specs(self, location: str, **kwargs: Any) -> _models.BillingRes :param location: The Azure location (region) for which to make the request. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BillingResponseListResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.BillingResponseListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,20 +363,18 @@ def list_billing_specs(self, location: str, **kwargs: Any) -> _models.BillingRes api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BillingResponseListResult] = kwargs.pop("cls", None) - request = build_list_billing_specs_request( + _request = build_list_billing_specs_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_billing_specs.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,16 +384,12 @@ def list_billing_specs(self, location: str, **kwargs: Any) -> _models.BillingRes error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BillingResponseListResult", pipeline_response) + deserialized = self._deserialize("BillingResponseListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_billing_specs.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs" - } + return deserialized # type: ignore @distributed_trace def get_azure_async_operation_status( @@ -417,12 +401,11 @@ def get_azure_async_operation_status( :type location: str :param operation_id: The long running operation id. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -436,21 +419,19 @@ def get_azure_async_operation_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) - request = build_get_azure_async_operation_status_request( + _request = build_get_azure_async_operation_status_request( location=location, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_azure_async_operation_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -460,16 +441,12 @@ def get_azure_async_operation_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AsyncOperationResult", pipeline_response) + deserialized = self._deserialize("AsyncOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_azure_async_operation_status.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/azureasyncoperations/{operationId}" - } + return deserialized # type: ignore @overload def check_name_availability( @@ -489,7 +466,6 @@ def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailabilityCheckResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.NameAvailabilityCheckResult :raises ~azure.core.exceptions.HttpResponseError: @@ -497,18 +473,17 @@ def check_name_availability( @overload def check_name_availability( - self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailabilityCheckResult: """Check the cluster name is available or not. :param location: The Azure location (region) for which to make the request. Required. :type location: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailabilityCheckResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.NameAvailabilityCheckResult :raises ~azure.core.exceptions.HttpResponseError: @@ -516,24 +491,21 @@ def check_name_availability( @distributed_trace def check_name_availability( - self, location: str, parameters: Union[_models.NameAvailabilityCheckRequestParameters, IO], **kwargs: Any + self, location: str, parameters: Union[_models.NameAvailabilityCheckRequestParameters, IO[bytes]], **kwargs: Any ) -> _models.NameAvailabilityCheckResult: """Check the cluster name is available or not. :param location: The Azure location (region) for which to make the request. Required. :type location: str - :param parameters: Is either a NameAvailabilityCheckRequestParameters type or a IO type. + :param parameters: Is either a NameAvailabilityCheckRequestParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.NameAvailabilityCheckRequestParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :type parameters: ~azure.mgmt.hdinsight.models.NameAvailabilityCheckRequestParameters or + IO[bytes] :return: NameAvailabilityCheckResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.NameAvailabilityCheckResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,23 +528,21 @@ def check_name_availability( else: _json = self._serialize.body(parameters, "NameAvailabilityCheckRequestParameters") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -582,16 +552,12 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailabilityCheckResult", pipeline_response) + deserialized = self._deserialize("NameAvailabilityCheckResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability" - } + return deserialized # type: ignore @overload def validate_cluster_create_request( @@ -611,7 +577,6 @@ def validate_cluster_create_request( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterCreateValidationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.ClusterCreateValidationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -619,18 +584,17 @@ def validate_cluster_create_request( @overload def validate_cluster_create_request( - self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.ClusterCreateValidationResult: """Validate the cluster create request spec is valid or not. :param location: The Azure location (region) for which to make the request. Required. :type location: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterCreateValidationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.ClusterCreateValidationResult :raises ~azure.core.exceptions.HttpResponseError: @@ -638,24 +602,24 @@ def validate_cluster_create_request( @distributed_trace def validate_cluster_create_request( - self, location: str, parameters: Union[_models.ClusterCreateRequestValidationParameters, IO], **kwargs: Any + self, + location: str, + parameters: Union[_models.ClusterCreateRequestValidationParameters, IO[bytes]], + **kwargs: Any ) -> _models.ClusterCreateValidationResult: """Validate the cluster create request spec is valid or not. :param location: The Azure location (region) for which to make the request. Required. :type location: str - :param parameters: Is either a ClusterCreateRequestValidationParameters type or a IO type. - Required. - :type parameters: ~azure.mgmt.hdinsight.models.ClusterCreateRequestValidationParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: Is either a ClusterCreateRequestValidationParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.ClusterCreateRequestValidationParameters or + IO[bytes] :return: ClusterCreateValidationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.ClusterCreateValidationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -678,23 +642,21 @@ def validate_cluster_create_request( else: _json = self._serialize.body(parameters, "ClusterCreateRequestValidationParameters") - request = build_validate_cluster_create_request_request( + _request = build_validate_cluster_create_request_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.validate_cluster_create_request.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -704,13 +666,9 @@ def validate_cluster_create_request( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ClusterCreateValidationResult", pipeline_response) + deserialized = self._deserialize("ClusterCreateValidationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - validate_cluster_create_request.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/validateCreateRequest" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_operations.py index 233944e34b961..4f92958babbaf 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +81,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists all of the available HDInsight REST API operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -89,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,14 +102,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +119,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -135,11 +134,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +150,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.HDInsight/operations"} diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_endpoint_connections_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_endpoint_connections_operations.py index 00c02d6b8d7de..6a02b3002b08f 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_endpoint_connections_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_by_cluster_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +64,7 @@ def build_list_by_cluster_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +85,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -98,7 +103,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -121,7 +126,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,7 +143,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,7 +164,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -176,7 +181,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,7 +221,6 @@ def list_by_cluster( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] @@ -228,7 +232,7 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,17 +243,15 @@ def list_by_cluster( def prepare_request(next_link=None): if not next_link: - request = build_list_by_cluster_request( + _request = build_list_by_cluster_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_cluster.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -261,13 +263,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -277,11 +278,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -294,19 +295,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections" - } - def _create_or_update_initial( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnection: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +316,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -329,7 +326,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -338,40 +335,35 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - @overload def begin_create_or_update( self, @@ -396,14 +388,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] @@ -416,7 +400,7 @@ def begin_create_or_update( resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -430,18 +414,10 @@ def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: The private endpoint connection create or update request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] @@ -454,7 +430,7 @@ def begin_create_or_update( resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: """Approve or reject a private endpoint connection manually. @@ -466,19 +442,8 @@ def begin_create_or_update( :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: The private endpoint connection create or update request. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type parameters: ~azure.mgmt.hdinsight.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.hdinsight.models.PrivateEndpointConnection or IO[bytes] :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] @@ -506,12 +471,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -523,17 +489,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def get( @@ -547,12 +511,11 @@ def get( :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,22 +529,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -591,21 +552,17 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -617,39 +574,42 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -663,14 +623,6 @@ def begin_delete( :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -684,7 +636,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -694,11 +646,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -709,14 +662,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_link_resources_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_link_resources_operations.py index ef1f9906bc507..8beef1bd13409 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_link_resources_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +43,7 @@ def build_list_by_cluster_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +57,7 @@ def build_list_by_cluster_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -71,7 +74,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +89,7 @@ def build_get_request( "privateLinkResourceName": _SERIALIZER.url("private_link_resource_name", private_link_resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,12 +129,11 @@ def list_by_cluster( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceListResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -145,21 +147,19 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - request = build_list_by_cluster_request( + _request = build_list_by_cluster_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_cluster.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -169,16 +169,12 @@ def list_by_cluster( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources" - } + return deserialized # type: ignore @distributed_trace def get( @@ -192,12 +188,11 @@ def get( :type cluster_name: str :param private_link_resource_name: The name of the private link resource. Required. :type private_link_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -211,22 +206,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cluster_name=cluster_name, private_link_resource_name=private_link_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,13 +229,9 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_actions_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_actions_operations.py index 57e693bcd87d4..c49991b2ac164 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_actions_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_actions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +45,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +60,7 @@ def build_delete_request( "scriptName": _SERIALIZER.url("script_name", script_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,7 +77,7 @@ def build_list_by_cluster_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +91,7 @@ def build_list_by_cluster_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,7 +108,7 @@ def build_get_execution_detail_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +123,7 @@ def build_get_execution_detail_request( "scriptExecutionId": _SERIALIZER.url("script_execution_id", script_execution_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,13 +134,13 @@ def build_get_execution_detail_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_execution_async_operation_status_request( +def build_get_execution_async_operation_status_request( # pylint: disable=name-too-long resource_group_name: str, cluster_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +155,7 @@ def build_get_execution_async_operation_status_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -194,12 +197,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type cluster_name: str :param script_name: The name of the script. Required. :type script_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,22 +215,20 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, cluster_name=cluster_name, script_name=script_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,11 +239,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_cluster( @@ -255,7 +251,6 @@ def list_by_cluster( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RuntimeScriptActionDetail or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.RuntimeScriptActionDetail] @@ -267,7 +262,7 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptActionsList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,17 +273,15 @@ def list_by_cluster( def prepare_request(next_link=None): if not next_link: - request = build_list_by_cluster_request( + _request = build_list_by_cluster_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_cluster.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -300,13 +293,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScriptActionsList", pipeline_response) @@ -316,11 +308,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -333,10 +325,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions" - } - @distributed_trace def get_execution_detail( self, resource_group_name: str, cluster_name: str, script_execution_id: str, **kwargs: Any @@ -349,12 +337,11 @@ def get_execution_detail( :type cluster_name: str :param script_execution_id: The script execution Id. Required. :type script_execution_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuntimeScriptActionDetail or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.RuntimeScriptActionDetail :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,22 +355,20 @@ def get_execution_detail( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuntimeScriptActionDetail] = kwargs.pop("cls", None) - request = build_get_execution_detail_request( + _request = build_get_execution_detail_request( resource_group_name=resource_group_name, cluster_name=cluster_name, script_execution_id=script_execution_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_execution_detail.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -393,16 +378,12 @@ def get_execution_detail( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuntimeScriptActionDetail", pipeline_response) + deserialized = self._deserialize("RuntimeScriptActionDetail", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_execution_detail.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}" - } + return deserialized # type: ignore @distributed_trace def get_execution_async_operation_status( @@ -416,12 +397,11 @@ def get_execution_async_operation_status( :type cluster_name: str :param operation_id: The long running operation id. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,22 +415,20 @@ def get_execution_async_operation_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) - request = build_get_execution_async_operation_status_request( + _request = build_get_execution_async_operation_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_execution_async_operation_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -460,13 +438,9 @@ def get_execution_async_operation_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AsyncOperationResult", pipeline_response) + deserialized = self._deserialize("AsyncOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_execution_async_operation_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions/azureasyncoperations/{operationId}" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_execution_history_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_execution_history_operations.py index 7e76a1f0d12a0..7a36e07f58609 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_execution_history_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_execution_history_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +45,7 @@ def build_list_by_cluster_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +59,7 @@ def build_list_by_cluster_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +76,7 @@ def build_promote_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +91,7 @@ def build_promote_request( "scriptExecutionId": _SERIALIZER.url("script_execution_id", script_execution_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,7 +131,6 @@ def list_by_cluster( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RuntimeScriptActionDetail or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.RuntimeScriptActionDetail] @@ -140,7 +142,7 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScriptActionExecutionHistoryList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,17 +153,15 @@ def list_by_cluster( def prepare_request(next_link=None): if not next_link: - request = build_list_by_cluster_request( + _request = build_list_by_cluster_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_cluster.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -173,13 +173,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScriptActionExecutionHistoryList", pipeline_response) @@ -189,11 +188,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -206,10 +205,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory" - } - @distributed_trace def promote( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, script_execution_id: str, **kwargs: Any @@ -222,12 +217,11 @@ def promote( # pylint: disable=inconsistent-return-statements :type cluster_name: str :param script_execution_id: The script execution Id. Required. :type script_execution_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -241,22 +235,20 @@ def promote( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_promote_request( + _request = build_promote_request( resource_group_name=resource_group_name, cluster_name=cluster_name, script_execution_id=script_execution_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.promote.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,8 +259,4 @@ def promote( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - promote.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_virtual_machines_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_virtual_machines_operations.py index e930d779ae2fd..32fa3c0c4d81f 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_virtual_machines_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_virtual_machines_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +30,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_list_hosts_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +62,7 @@ def build_list_hosts_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,7 +79,7 @@ def build_restart_hosts_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -89,7 +94,7 @@ def build_restart_hosts_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,7 +113,7 @@ def build_get_async_operation_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +128,7 @@ def build_get_async_operation_status_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,12 +166,11 @@ def list_hosts(self, resource_group_name: str, cluster_name: str, **kwargs: Any) :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: list of HostInfo or the result of cls(response) :rtype: list[~azure.mgmt.hdinsight.models.HostInfo] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,21 +184,19 @@ def list_hosts(self, resource_group_name: str, cluster_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.HostInfo]] = kwargs.pop("cls", None) - request = build_list_hosts_request( + _request = build_list_hosts_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_hosts.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -204,21 +206,17 @@ def list_hosts(self, resource_group_name: str, cluster_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[HostInfo]", pipeline_response) + deserialized = self._deserialize("[HostInfo]", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - list_hosts.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/listHosts" - } - - def _restart_hosts_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cluster_name: str, hosts: Union[List[str], IO], **kwargs: Any - ) -> None: - error_map = { + def _restart_hosts_initial( + self, resource_group_name: str, cluster_name: str, hosts: Union[List[str], IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +229,7 @@ def _restart_hosts_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -241,7 +239,7 @@ def _restart_hosts_initial( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(hosts, "[str]") - request = build_restart_hosts_request( + _request = build_restart_hosts_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, @@ -249,31 +247,34 @@ def _restart_hosts_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._restart_hosts_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _restart_hosts_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts" - } + return deserialized # type: ignore @overload def begin_restart_hosts( @@ -296,14 +297,6 @@ def begin_restart_hosts( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -314,7 +307,7 @@ def begin_restart_hosts( self, resource_group_name: str, cluster_name: str, - hosts: IO, + hosts: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -326,18 +319,10 @@ def begin_restart_hosts( :param cluster_name: The name of the cluster. Required. :type cluster_name: str :param hosts: The list of hosts to restart. Required. - :type hosts: IO + :type hosts: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -345,7 +330,7 @@ def begin_restart_hosts( @distributed_trace def begin_restart_hosts( - self, resource_group_name: str, cluster_name: str, hosts: Union[List[str], IO], **kwargs: Any + self, resource_group_name: str, cluster_name: str, hosts: Union[List[str], IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Restarts the specified HDInsight cluster hosts. @@ -353,19 +338,9 @@ def begin_restart_hosts( :type resource_group_name: str :param cluster_name: The name of the cluster. Required. :type cluster_name: str - :param hosts: The list of hosts to restart. Is either a [str] type or a IO type. Required. - :type hosts: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param hosts: The list of hosts to restart. Is either a [str] type or a IO[bytes] type. + Required. + :type hosts: list[str] or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -380,7 +355,7 @@ def begin_restart_hosts( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restart_hosts_initial( # type: ignore + raw_result = self._restart_hosts_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, hosts=hosts, @@ -391,11 +366,12 @@ def begin_restart_hosts( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -406,17 +382,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_restart_hosts.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_async_operation_status( @@ -430,12 +402,11 @@ def get_async_operation_status( :type cluster_name: str :param operation_id: The long running operation id. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AsyncOperationResult or the result of cls(response) :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,22 +420,20 @@ def get_async_operation_status( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) - request = build_get_async_operation_status_request( + _request = build_get_async_operation_status_request( resource_group_name=resource_group_name, cluster_name=cluster_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_async_operation_status.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -474,13 +443,9 @@ def get_async_operation_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AsyncOperationResult", pipeline_response) + deserialized = self._deserialize("AsyncOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_async_operation_status.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts/azureasyncoperations/{operationId}" - } + return deserialized # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/dev_requirements.txt b/sdk/hdinsight/azure-mgmt-hdinsight/dev_requirements.txt index 43dea0eb21837..871cccbb62a79 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/dev_requirements.txt +++ b/sdk/hdinsight/azure-mgmt-hdinsight/dev_requirements.txt @@ -5,4 +5,5 @@ -e ../../resources/azure-mgmt-resource -e ../../storage/azure-mgmt-storage azure-mgmt-loganalytics==2.0.0 --e ../../resources/azure-mgmt-msi/ \ No newline at end of file +-e ../../resources/azure-mgmt-msi/ +aiohttp \ No newline at end of file diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/approve_private_endpoint_connection.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/approve_private_endpoint_connection.py index e053be4388576..b5f3889243be1 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/approve_private_endpoint_connection.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/approve_private_endpoint_connection.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -46,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/ApprovePrivateEndpointConnection.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/ApprovePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/change_http_connectivity_disable.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/change_http_connectivity_disable.py index a952430894bbb..ede3135d690ab 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/change_http_connectivity_disable.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/change_http_connectivity_disable.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Dict, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +40,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/ChangeHttpConnectivityDisable.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/ChangeHttpConnectivityDisable.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/change_http_connectivity_enable.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/change_http_connectivity_enable.py index ad1c914c5d00c..6d6962c1eba03 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/change_http_connectivity_enable.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/change_http_connectivity_enable.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Dict, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -41,6 +44,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/ChangeHttpConnectivityEnable.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/ChangeHttpConnectivityEnable.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_application.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_application.py index 3ea68203b5bb3..c62a6f1cfba8b 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_application.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_application.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -58,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateApplication.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateApplication.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_extension.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_extension.py index df58150c19a61..41dc2200620a9 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_extension.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_extension.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +40,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateExtension.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateExtension.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_autoscale_config.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_autoscale_config.py index 9dd8cdf752e27..99b6386652cda 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_autoscale_config.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_autoscale_config.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -120,6 +123,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithAutoscaleConfig.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithAutoscaleConfig.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_availability_zones.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_availability_zones.py index 8beea49387324..6b0bd50c8b693 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_availability_zones.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_availability_zones.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -135,6 +138,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithAvailabilityZones.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithAvailabilityZones.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_compute_isolation_properties.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_compute_isolation_properties.py index dc367b2ee5df9..305bac00f67eb 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_compute_isolation_properties.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_compute_isolation_properties.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -92,6 +95,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithComputeIsolationProperties.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithComputeIsolationProperties.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_custom_network_properties.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_custom_network_properties.py index 0b6af2c85a653..1904328488a08 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_custom_network_properties.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_custom_network_properties.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -81,7 +84,11 @@ def main(): }, ] }, - "networkProperties": {"privateLink": "Enabled", "resourceProviderConnection": "Outbound"}, + "networkProperties": { + "privateLink": "Enabled", + "publicIpTag": {"ipTagType": "FirstPartyUsage", "tag": "/"}, + "resourceProviderConnection": "Outbound", + }, "osType": "Linux", "storageProfile": { "storageaccounts": [ @@ -100,6 +107,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithCustomNetworkProperties.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithCustomNetworkProperties.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_encryption_at_host.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_encryption_at_host.py index e5bea5d0f45bb..cdbb8b69ce4e7 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_encryption_at_host.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_encryption_at_host.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -93,6 +96,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithEncryptionAtHost.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithEncryptionAtHost.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_encryption_in_transit.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_encryption_in_transit.py index 1e7e9ca58b987..78ba33c1551af 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_encryption_in_transit.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_encryption_in_transit.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -93,6 +96,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithEncryptionInTransit.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithEncryptionInTransit.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_tls12.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_tls12.py index 091a270a1f145..69a684b6b3c48 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_tls12.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_hd_insight_cluster_with_tls12.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -93,6 +96,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithTLS12.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithTLS12.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_kafka_cluster_with_kafka_rest_proxy.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_kafka_cluster_with_kafka_rest_proxy.py index 05751be2eac9f..46c7a39f5e483 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_kafka_cluster_with_kafka_rest_proxy.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_kafka_cluster_with_kafka_rest_proxy.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -108,6 +111,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateKafkaClusterWithKafkaRestProxy.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateKafkaClusterWithKafkaRestProxy.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_adls_gen2.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_adls_gen2.py index d04e5a6d315dd..ff1c3a2b654d4 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_adls_gen2.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_adls_gen2.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -96,6 +99,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateLinuxHadoopAdlsGen2.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateLinuxHadoopAdlsGen2.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_secure_hadoop.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_secure_hadoop.py index 29ec96b38652a..092bf98192d39 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_secure_hadoop.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_secure_hadoop.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -132,6 +135,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateLinuxHadoopSecureHadoop.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateLinuxHadoopSecureHadoop.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_ssh_password.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_ssh_password.py index 877687e424e67..734ee123ecbd8 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_ssh_password.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_ssh_password.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -96,6 +99,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateLinuxHadoopSshPassword.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateLinuxHadoopSshPassword.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_ssh_public_key.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_ssh_public_key.py index 9dd724490d11b..8104ded34e89a 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_ssh_public_key.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_hadoop_ssh_public_key.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -99,6 +102,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateLinuxHadoopSshPublicKey.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateLinuxHadoopSshPublicKey.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_spark_ssh_password.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_spark_ssh_password.py index bc9a4c7998373..5a7c8bc657b06 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_spark_ssh_password.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/create_linux_spark_ssh_password.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -88,6 +91,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateLinuxSparkSshPassword.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateLinuxSparkSshPassword.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_application.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_application.py index a62a8352b40e2..c5acad15e5c63 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_application.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_application.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DeleteApplication.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DeleteApplication.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_extension.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_extension.py index 6b4db919d654a..b6b2c4ebeac49 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_extension.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_extension.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DeleteExtension.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DeleteExtension.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_linux_hadoop_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_linux_hadoop_cluster.py index 66a08f7b11c6d..86ca2cd602545 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_linux_hadoop_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_linux_hadoop_cluster.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DeleteLinuxHadoopCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DeleteLinuxHadoopCluster.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_private_endpoint_connection.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_private_endpoint_connection.py index f6deabce7ffc2..9485ade36fd19 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_private_endpoint_connection.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_private_endpoint_connection.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DeletePrivateEndpointConnection.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_script_action.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_script_action.py index 448987b5b94eb..fd732f0377595 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_script_action.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/delete_script_action.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DeleteScriptAction.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DeleteScriptAction.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/disable_linux_cluster_azure_monitor.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/disable_linux_cluster_azure_monitor.py index 917a1fe68e64f..6f50e663d0851 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/disable_linux_cluster_azure_monitor.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/disable_linux_cluster_azure_monitor.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DisableLinuxClusterAzureMonitor.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DisableLinuxClusterAzureMonitor.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/disable_linux_cluster_azure_monitor_agent.py similarity index 67% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py rename to sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/disable_linux_cluster_azure_monitor_agent.py index 0cd6d19d5c57f..e41c13eadb053 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/disable_linux_cluster_azure_monitor_agent.py @@ -8,14 +8,14 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.appcontainers import ContainerAppsAPIClient +from azure.mgmt.hdinsight import HDInsightManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-appcontainers + pip install azure-mgmt-hdinsight # USAGE - python builds_delete.py + python disable_linux_cluster_azure_monitor_agent.py Before run the sample, please 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, @@ -25,18 +25,17 @@ def main(): - client = ContainerAppsAPIClient( + client = HDInsightManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) - client.builds.begin_delete( - resource_group_name="rg", - builder_name="testBuilder", - build_name="testBuild", + client.extensions.begin_disable_azure_monitor_agent( + resource_group_name="rg1", + cluster_name="cluster1", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_Delete.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DisableLinuxClusterAzureMonitorAgent.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/disable_linux_cluster_monitoring.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/disable_linux_cluster_monitoring.py index 4c92352d3ecd7..fee12284b0d33 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/disable_linux_cluster_monitoring.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/disable_linux_cluster_monitoring.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DisableLinuxClusterMonitoring.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DisableLinuxClusterMonitoring.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_linux_cluster_azure_monitor.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_linux_cluster_azure_monitor.py index 6dda91e1cf45c..1f9e785cbad5f 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_linux_cluster_azure_monitor.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_linux_cluster_azure_monitor.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/EnableLinuxClusterAzureMonitor.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/EnableLinuxClusterAzureMonitor.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_linux_cluster_azure_monitor_agent.py similarity index 62% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py rename to sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_linux_cluster_azure_monitor_agent.py index 8f767c38f83f0..b561cbf5e4f8b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_linux_cluster_azure_monitor_agent.py @@ -6,16 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential -from azure.mgmt.appcontainers import ContainerAppsAPIClient +from azure.mgmt.hdinsight import HDInsightManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-appcontainers + pip install azure-mgmt-hdinsight # USAGE - python dot_net_components_delete.py + python enable_linux_cluster_azure_monitor_agent.py Before run the sample, please 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, @@ -25,18 +27,18 @@ def main(): - client = ContainerAppsAPIClient( + client = HDInsightManagementClient( credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + subscription_id="subid", ) - client.dot_net_components.begin_delete( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mydotnetcomponent", + client.extensions.begin_enable_azure_monitor_agent( + resource_group_name="rg1", + cluster_name="cluster1", + parameters={"primaryKey": "**********", "workspaceId": "a2090ead-8c9f-4fba-b70e-533e3e003163"}, ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Delete.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/EnableLinuxClusterAzureMonitorAgent.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_linux_cluster_monitoring.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_linux_cluster_monitoring.py index 111d73b688d5c..6787063a0e318 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_linux_cluster_monitoring.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_linux_cluster_monitoring.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/EnableLinuxClusterMonitoring.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/EnableLinuxClusterMonitoring.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_or_update_auto_scale_with_load_based_configuration.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_or_update_auto_scale_with_load_based_configuration.py index 7489e77d397ae..50ba597e06618 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_or_update_auto_scale_with_load_based_configuration.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_or_update_auto_scale_with_load_based_configuration.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -37,6 +43,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/EnableOrUpdateAutoScaleWithLoadBasedConfiguration.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/EnableOrUpdateAutoScaleWithLoadBasedConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_or_update_auto_scale_with_schedule_based_configuration.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_or_update_auto_scale_with_schedule_based_configuration.py index 8ec0cb2c39f30..c4832c9c291f6 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_or_update_auto_scale_with_schedule_based_configuration.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/enable_or_update_auto_scale_with_schedule_based_configuration.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -49,6 +55,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/EnableOrUpdateAutoScaleWithScheduleBasedConfiguration.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/EnableOrUpdateAutoScaleWithScheduleBasedConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_all_applications.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_all_applications.py index 70c94754a21a4..42ffc9ff5aff9 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_all_applications.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_all_applications.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetAllApplications.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetAllApplications.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_all_private_endpoint_connections_in_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_all_private_endpoint_connections_in_cluster.py index 27805f5509ef3..2aa1b911421f7 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_all_private_endpoint_connections_in_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_all_private_endpoint_connections_in_cluster.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetAllPrivateEndpointConnectionsInCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetAllPrivateEndpointConnectionsInCluster.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_all_private_link_resources_in_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_all_private_link_resources_in_cluster.py index ce65c9f85eb64..909179d0f95aa 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_all_private_link_resources_in_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_all_private_link_resources_in_cluster.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetAllPrivateLinkResourcesInCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetAllPrivateLinkResourcesInCluster.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_application_created.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_application_created.py index 6939b0e4ac479..86e8f82c9a558 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_application_created.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_application_created.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetApplicationCreated.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetApplicationCreated.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_application_creation_async_operation_status.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_application_creation_async_operation_status.py index 75087f8f0aab1..0d33fc55de796 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_application_creation_async_operation_status.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_application_creation_async_operation_status.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetApplicationCreationAsyncOperationStatus.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetApplicationCreationAsyncOperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_application_in_progress.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_application_in_progress.py index 882718425b0bb..42243a48a1c57 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_application_in_progress.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_application_in_progress.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetApplicationInProgress.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetApplicationInProgress.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_cluster_creating_async_operation_status.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_cluster_creating_async_operation_status.py index fb9d75e1949cd..d2d927f668042 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_cluster_creating_async_operation_status.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_cluster_creating_async_operation_status.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetClusterCreatingAsyncOperationStatus.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetClusterCreatingAsyncOperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_cluster_virtual_machines.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_cluster_virtual_machines.py index ede765c8dcde3..179d044998aed 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_cluster_virtual_machines.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_cluster_virtual_machines.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetClusterVirtualMachines.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetClusterVirtualMachines.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_extension.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_extension.py index fe85a1afa49d7..d10f8f6797645 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_extension.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_extension.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetExtension.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetExtension.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_extension_creation_async_operation_status.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_extension_creation_async_operation_status.py index cf2f87066d119..c56ccb3d8fc3b 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_extension_creation_async_operation_status.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_extension_creation_async_operation_status.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetExtensionCreationAsyncOperationStatus.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetExtensionCreationAsyncOperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_hd_insight_capabilities.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_hd_insight_capabilities.py index e5656a28881f4..e155bedf59c43 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_hd_insight_capabilities.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_hd_insight_capabilities.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetHDInsightCapabilities.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetHDInsightCapabilities.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_hd_insight_usages.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_hd_insight_usages.py index fbbed06933a3d..cc6287a9fe5df 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_hd_insight_usages.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_hd_insight_usages.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetHDInsightUsages.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetHDInsightUsages.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_cluster_azure_monitor_agent_status.py similarity index 67% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py rename to sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_cluster_azure_monitor_agent_status.py index 26b4f027f9c54..ad9ed65b78a3e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_cluster_azure_monitor_agent_status.py @@ -8,14 +8,14 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.appcontainers import ContainerAppsAPIClient +from azure.mgmt.hdinsight import HDInsightManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-appcontainers + pip install azure-mgmt-hdinsight # USAGE - python app_resiliency_get.py + python get_linux_cluster_azure_monitor_agent_status.py Before run the sample, please 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, @@ -25,19 +25,18 @@ def main(): - client = ContainerAppsAPIClient( + client = HDInsightManagementClient( credential=DefaultAzureCredential(), - subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + subscription_id="subid", ) - response = client.app_resiliency.get( - resource_group_name="rg", - app_name="testcontainerApp0", - name="resiliency-policy-1", + response = client.extensions.get_azure_monitor_agent_status( + resource_group_name="rg1", + cluster_name="cluster1", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_Get.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxClusterAzureMonitorAgentStatus.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_cluster_azure_monitor_status.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_cluster_azure_monitor_status.py index c08cb7ede7bd9..be450da73889f 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_cluster_azure_monitor_status.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_cluster_azure_monitor_status.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxClusterAzureMonitorStatus.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxClusterAzureMonitorStatus.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_cluster_monitoring_status.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_cluster_monitoring_status.py index e9c0b842c13f7..35a0274f12fb8 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_cluster_monitoring_status.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_cluster_monitoring_status.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxClusterMonitoringStatus.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxClusterMonitoringStatus.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_all_clusters.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_all_clusters.py index 8fd9fb448ff88..807954d0cfd8b 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_all_clusters.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_all_clusters.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxHadoopAllClusters.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxHadoopAllClusters.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_all_clusters_in_resource_group.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_all_clusters_in_resource_group.py index 213652722d9bb..528416ee19169 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_all_clusters_in_resource_group.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_all_clusters_in_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxHadoopAllClustersInResourceGroup.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxHadoopAllClustersInResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_cluster.py index aa2ebcdd15fb2..5874452aab24a 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_cluster.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxHadoopCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxHadoopCluster.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_script_action.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_script_action.py index 38b659b04355f..5a129edd80fca 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_script_action.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_hadoop_script_action.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxHadoopScriptAction.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxHadoopScriptAction.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_spark_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_spark_cluster.py index 2c25bdcb54afc..7892f90155ac4 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_spark_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_linux_spark_cluster.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxSparkCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxSparkCluster.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_private_endpoint_connection.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_private_endpoint_connection.py index 2439a00753965..26cddeb92bb1d 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_private_endpoint_connection.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_private_endpoint_connection.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetPrivateEndpointConnection.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_private_link_resource.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_private_link_resource.py index 0a51dbf3d76e6..0c17e3f2c3236 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_private_link_resource.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_private_link_resource.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetPrivateLinkResource.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetPrivateLinkResource.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_restart_hosts_async_operation_status.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_restart_hosts_async_operation_status.py index 48ffb6e9a66c2..cd8ff91326564 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_restart_hosts_async_operation_status.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_restart_hosts_async_operation_status.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetRestartHostsAsyncOperationStatus.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetRestartHostsAsyncOperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_script_action_by_id.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_script_action_by_id.py index 5a544d3bd40c8..0493bfbeda8f1 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_script_action_by_id.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_script_action_by_id.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetScriptActionById.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetScriptActionById.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_script_execution_async_operation_status.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_script_execution_async_operation_status.py index 7d76168d48fe5..91e51aa808467 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_script_execution_async_operation_status.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_script_execution_async_operation_status.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetScriptExecutionAsyncOperationStatus.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetScriptExecutionAsyncOperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_script_execution_history.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_script_execution_history.py index b3cd7fcb40a86..30650105a2b4a 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_script_execution_history.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/get_script_execution_history.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetScriptExecutionHistory.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetScriptExecutionHistory.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_clusters_get_gateway_settings.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_clusters_get_gateway_settings.py index 1d3dc36593da6..2e7d5adf0b245 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_clusters_get_gateway_settings.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_clusters_get_gateway_settings.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Clusters_GetGatewaySettings.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Clusters_GetGatewaySettings.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_clusters_update_cluster_identity_certificate.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_clusters_update_cluster_identity_certificate.py index 01eea546cf1db..c3c020752b429 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_clusters_update_cluster_identity_certificate.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_clusters_update_cluster_identity_certificate.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -40,6 +43,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Clusters_UpdateClusterIdentityCertificate.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Clusters_UpdateClusterIdentityCertificate.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_clusters_update_gateway_settings_enable.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_clusters_update_gateway_settings_enable.py index 281d02bf5d6c4..c0762ece2df92 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_clusters_update_gateway_settings_enable.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_clusters_update_gateway_settings_enable.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -40,6 +43,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Clusters_UpdateGatewaySettings_Enable.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Clusters_UpdateGatewaySettings_Enable.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_configurations_get.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_configurations_get.py index 4ba5a77191f01..c4f9c99b80ff9 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_configurations_get.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_configurations_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Configurations_Get.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Configurations_Get.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_configurations_list.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_configurations_list.py index ad1e87d7a6ca3..f576fb66c1ca1 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_configurations_list.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_configurations_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Configurations_List.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Configurations_List.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_check_cluster_name_availability.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_check_cluster_name_availability.py index b885e70d2d548..ba31df9abf33b 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_check_cluster_name_availability.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_check_cluster_name_availability.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Locations_CheckClusterNameAvailability.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Locations_CheckClusterNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_get_async_operation_status.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_get_async_operation_status.py index eadac13e158f0..4539f8cec98b8 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_get_async_operation_status.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_get_async_operation_status.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Locations_GetAsyncOperationStatus.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Locations_GetAsyncOperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_list_billing_specs.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_list_billing_specs.py index 877b2be52e059..956444f6a6c60 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_list_billing_specs.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_list_billing_specs.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Locations_ListBillingSpecs.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Locations_ListBillingSpecs.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_validate_cluster_create_request.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_validate_cluster_create_request.py index 554891c3bbbab..b8494d2ca7a77 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_validate_cluster_create_request.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/hdi_locations_validate_cluster_create_request.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -114,6 +117,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Locations_ValidateClusterCreateRequest.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Locations_ValidateClusterCreateRequest.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/list_hd_insight_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/list_hd_insight_operations.py index 1ada2b806f7e4..b1306d4eb0c99 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/list_hd_insight_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/list_hd_insight_operations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/ListHDInsightOperations.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/ListHDInsightOperations.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/patch_linux_hadoop_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/patch_linux_hadoop_cluster.py index 96a40d4ad6669..0af91ccff79c9 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/patch_linux_hadoop_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/patch_linux_hadoop_cluster.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -37,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/PatchLinuxHadoopCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/PatchLinuxHadoopCluster.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/patch_linux_hadoop_cluster_with_system_msi.py similarity index 64% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py rename to sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/patch_linux_hadoop_cluster_with_system_msi.py index f5e123b1badb7..f37c1b6c8b7e5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/patch_linux_hadoop_cluster_with_system_msi.py @@ -10,14 +10,14 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.appcontainers import ContainerAppsAPIClient +from azure.mgmt.hdinsight import HDInsightManagementClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-appcontainers + pip install azure-mgmt-hdinsight # USAGE - python builders_update.py + python patch_linux_hadoop_cluster_with_system_msi.py Before run the sample, please 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, @@ -27,19 +27,19 @@ def main(): - client = ContainerAppsAPIClient( + client = HDInsightManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="subid", ) - response = client.builders.begin_update( - resource_group_name="rg", - builder_name="testBuilder", - builder_envelope={"tags": {"mytag1": "myvalue1"}}, - ).result() + response = client.clusters.update( + resource_group_name="rg1", + cluster_name="cluster1", + parameters={"identity": {"type": "SystemAssigned"}, "tags": {"key1": "val1", "key2": "val2"}}, + ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_Update.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/PatchLinuxHadoopClusterWithSystemMSI.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/post_execute_script_action.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/post_execute_script_action.py index de63760b2c519..58880cf3a28ec 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/post_execute_script_action.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/post_execute_script_action.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -46,6 +49,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/PostExecuteScriptAction.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/PostExecuteScriptAction.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/promote_linux_hadoop_script_action.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/promote_linux_hadoop_script_action.py index 3d4ecab6a9e2e..2f0cac56b5147 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/promote_linux_hadoop_script_action.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/promote_linux_hadoop_script_action.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/PromoteLinuxHadoopScriptAction.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/PromoteLinuxHadoopScriptAction.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/resize_linux_hadoop_cluster.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/resize_linux_hadoop_cluster.py index a38a57c2cf0ed..fe7f583088736 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/resize_linux_hadoop_cluster.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/resize_linux_hadoop_cluster.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -37,6 +43,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/ResizeLinuxHadoopCluster.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/ResizeLinuxHadoopCluster.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/restart_virtual_machines_operation.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/restart_virtual_machines_operation.py index 8be081fbdb858..8b6031cd9d6ed 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/restart_virtual_machines_operation.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/restart_virtual_machines_operation.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import IO, List, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -36,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/RestartVirtualMachinesOperation.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/RestartVirtualMachinesOperation.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/rotate_linux_hadoop_cluster_disk_encryption_key.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/rotate_linux_hadoop_cluster_disk_encryption_key.py index 5dd32bd066160..a63d537e7123e 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/rotate_linux_hadoop_cluster_disk_encryption_key.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_samples/rotate_linux_hadoop_cluster_disk_encryption_key.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.hdinsight import HDInsightManagementClient """ @@ -40,6 +43,6 @@ def main(): ).result() -# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/RotateLinuxHadoopClusterDiskEncryptionKey.json +# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/RotateLinuxHadoopClusterDiskEncryptionKey.json if __name__ == "__main__": main() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/conftest.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/conftest.py new file mode 100644 index 0000000000000..c5bd5cac311d6 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/conftest.py @@ -0,0 +1,37 @@ +# 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. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + hdinsightmanagement_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + hdinsightmanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + hdinsightmanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + hdinsightmanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=hdinsightmanagement_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=hdinsightmanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=hdinsightmanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=hdinsightmanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_applications_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_applications_operations.py new file mode 100644 index 0000000000000..f453922db5f27 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_applications_operations.py @@ -0,0 +1,186 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementApplicationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_cluster(self, resource_group): + response = self.client.applications.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.applications.get( + resource_group_name=resource_group.name, + cluster_name="str", + application_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.applications.begin_create( + resource_group_name=resource_group.name, + cluster_name="str", + application_name="str", + parameters={ + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "applicationState": "str", + "applicationType": "str", + "computeProfile": { + "roles": [ + { + "VMGroupName": "str", + "autoscale": { + "capacity": {"maxInstanceCount": 0, "minInstanceCount": 0}, + "recurrence": { + "schedule": [ + { + "days": ["str"], + "timeAndCapacity": { + "maxInstanceCount": 0, + "minInstanceCount": 0, + "time": "str", + }, + } + ], + "timeZone": "str", + }, + }, + "dataDisksGroups": [{"diskSizeGB": 0, "disksPerNode": 0, "storageAccountType": "str"}], + "encryptDataDisks": False, + "hardwareProfile": {"vmSize": "str"}, + "minInstanceCount": 0, + "name": "str", + "osProfile": { + "linuxOperatingSystemProfile": { + "password": "str", + "sshProfile": {"publicKeys": [{"certificateData": "str"}]}, + "username": "str", + } + }, + "scriptActions": [{"name": "str", "parameters": "str", "uri": "str"}], + "targetInstanceCount": 0, + "virtualNetworkProfile": {"id": "str", "subnet": "str"}, + } + ] + }, + "createdDate": "str", + "errors": [{"code": "str", "message": "str"}], + "httpsEndpoints": [ + { + "accessModes": ["str"], + "destinationPort": 0, + "disableGatewayAuth": bool, + "location": "str", + "privateIPAddress": "str", + "publicPort": 0, + "subDomainSuffix": "str", + } + ], + "installScriptActions": [ + {"name": "str", "roles": ["str"], "uri": "str", "applicationName": "str", "parameters": "str"} + ], + "marketplaceIdentifier": "str", + "privateLinkConfigurations": [ + { + "groupId": "str", + "ipConfigurations": [ + { + "name": "str", + "id": "str", + "primary": bool, + "privateIPAddress": "str", + "privateIPAllocationMethod": "str", + "provisioningState": "str", + "subnet": {"id": "str"}, + "type": "str", + } + ], + "name": "str", + "id": "str", + "provisioningState": "str", + "type": "str", + } + ], + "provisioningState": "str", + "sshEndpoints": [ + {"destinationPort": 0, "location": "str", "privateIPAddress": "str", "publicPort": 0} + ], + "uninstallScriptActions": [ + {"name": "str", "roles": ["str"], "uri": "str", "applicationName": "str", "parameters": "str"} + ], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.applications.begin_delete( + resource_group_name=resource_group.name, + cluster_name="str", + application_name="str", + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_azure_async_operation_status(self, resource_group): + response = self.client.applications.get_azure_async_operation_status( + resource_group_name=resource_group.name, + cluster_name="str", + application_name="str", + operation_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_applications_operations_async.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_applications_operations_async.py new file mode 100644 index 0000000000000..d2195e1615e2c --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_applications_operations_async.py @@ -0,0 +1,205 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementApplicationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_cluster(self, resource_group): + response = self.client.applications.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.applications.get( + resource_group_name=resource_group.name, + cluster_name="str", + application_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.applications.begin_create( + resource_group_name=resource_group.name, + cluster_name="str", + application_name="str", + parameters={ + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "applicationState": "str", + "applicationType": "str", + "computeProfile": { + "roles": [ + { + "VMGroupName": "str", + "autoscale": { + "capacity": {"maxInstanceCount": 0, "minInstanceCount": 0}, + "recurrence": { + "schedule": [ + { + "days": ["str"], + "timeAndCapacity": { + "maxInstanceCount": 0, + "minInstanceCount": 0, + "time": "str", + }, + } + ], + "timeZone": "str", + }, + }, + "dataDisksGroups": [ + {"diskSizeGB": 0, "disksPerNode": 0, "storageAccountType": "str"} + ], + "encryptDataDisks": False, + "hardwareProfile": {"vmSize": "str"}, + "minInstanceCount": 0, + "name": "str", + "osProfile": { + "linuxOperatingSystemProfile": { + "password": "str", + "sshProfile": {"publicKeys": [{"certificateData": "str"}]}, + "username": "str", + } + }, + "scriptActions": [{"name": "str", "parameters": "str", "uri": "str"}], + "targetInstanceCount": 0, + "virtualNetworkProfile": {"id": "str", "subnet": "str"}, + } + ] + }, + "createdDate": "str", + "errors": [{"code": "str", "message": "str"}], + "httpsEndpoints": [ + { + "accessModes": ["str"], + "destinationPort": 0, + "disableGatewayAuth": bool, + "location": "str", + "privateIPAddress": "str", + "publicPort": 0, + "subDomainSuffix": "str", + } + ], + "installScriptActions": [ + { + "name": "str", + "roles": ["str"], + "uri": "str", + "applicationName": "str", + "parameters": "str", + } + ], + "marketplaceIdentifier": "str", + "privateLinkConfigurations": [ + { + "groupId": "str", + "ipConfigurations": [ + { + "name": "str", + "id": "str", + "primary": bool, + "privateIPAddress": "str", + "privateIPAllocationMethod": "str", + "provisioningState": "str", + "subnet": {"id": "str"}, + "type": "str", + } + ], + "name": "str", + "id": "str", + "provisioningState": "str", + "type": "str", + } + ], + "provisioningState": "str", + "sshEndpoints": [ + {"destinationPort": 0, "location": "str", "privateIPAddress": "str", "publicPort": 0} + ], + "uninstallScriptActions": [ + { + "name": "str", + "roles": ["str"], + "uri": "str", + "applicationName": "str", + "parameters": "str", + } + ], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.applications.begin_delete( + resource_group_name=resource_group.name, + cluster_name="str", + application_name="str", + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_azure_async_operation_status(self, resource_group): + response = await self.client.applications.get_azure_async_operation_status( + resource_group_name=resource_group.name, + cluster_name="str", + application_name="str", + operation_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_clusters_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_clusters_operations.py new file mode 100644 index 0000000000000..6ddc7e1797312 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_clusters_operations.py @@ -0,0 +1,353 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementClustersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.clusters.begin_create( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str", "tenantId": "str"}}, + }, + "location": "str", + "properties": { + "clusterDefinition": { + "blueprint": "str", + "componentVersion": {"str": "str"}, + "configurations": {}, + "kind": "str", + }, + "clusterVersion": "str", + "computeIsolationProperties": {"enableComputeIsolation": False, "hostSku": "str"}, + "computeProfile": { + "roles": [ + { + "VMGroupName": "str", + "autoscale": { + "capacity": {"maxInstanceCount": 0, "minInstanceCount": 0}, + "recurrence": { + "schedule": [ + { + "days": ["str"], + "timeAndCapacity": { + "maxInstanceCount": 0, + "minInstanceCount": 0, + "time": "str", + }, + } + ], + "timeZone": "str", + }, + }, + "dataDisksGroups": [{"diskSizeGB": 0, "disksPerNode": 0, "storageAccountType": "str"}], + "encryptDataDisks": False, + "hardwareProfile": {"vmSize": "str"}, + "minInstanceCount": 0, + "name": "str", + "osProfile": { + "linuxOperatingSystemProfile": { + "password": "str", + "sshProfile": {"publicKeys": [{"certificateData": "str"}]}, + "username": "str", + } + }, + "scriptActions": [{"name": "str", "parameters": "str", "uri": "str"}], + "targetInstanceCount": 0, + "virtualNetworkProfile": {"id": "str", "subnet": "str"}, + } + ] + }, + "diskEncryptionProperties": { + "encryptionAlgorithm": "str", + "encryptionAtHost": False, + "keyName": "str", + "keyVersion": "str", + "msiResourceId": "str", + "vaultUri": "str", + }, + "encryptionInTransitProperties": {"isEncryptionInTransitEnabled": False}, + "kafkaRestProperties": { + "clientGroupInfo": {"groupId": "str", "groupName": "str"}, + "configurationOverride": {"str": "str"}, + }, + "minSupportedTlsVersion": "str", + "networkProperties": { + "outboundDependenciesManagedType": "str", + "privateLink": "str", + "publicIpTag": {"ipTagType": "str", "tag": "str"}, + "resourceProviderConnection": "str", + }, + "osType": "str", + "privateLinkConfigurations": [ + { + "groupId": "str", + "ipConfigurations": [ + { + "name": "str", + "id": "str", + "primary": bool, + "privateIPAddress": "str", + "privateIPAllocationMethod": "str", + "provisioningState": "str", + "subnet": {"id": "str"}, + "type": "str", + } + ], + "name": "str", + "id": "str", + "provisioningState": "str", + "type": "str", + } + ], + "securityProfile": { + "aaddsResourceId": "str", + "clusterUsersGroupDNs": ["str"], + "directoryType": "str", + "domain": "str", + "domainUserPassword": "str", + "domainUsername": "str", + "ldapsUrls": ["str"], + "msiResourceId": "str", + "organizationalUnitDN": "str", + }, + "storageProfile": { + "storageaccounts": [ + { + "container": "str", + "enableSecureChannel": bool, + "fileSystem": "str", + "fileshare": "str", + "isDefault": bool, + "key": "str", + "msiResourceId": "str", + "name": "str", + "resourceId": "str", + "saskey": "str", + } + ] + }, + "tier": "str", + }, + "tags": {"str": "str"}, + "zones": ["str"], + }, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.clusters.update( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str", "tenantId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.clusters.begin_delete( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.clusters.get( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.clusters.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_resize(self, resource_group): + response = self.client.clusters.begin_resize( + resource_group_name=resource_group.name, + cluster_name="str", + role_name="str", + parameters={"targetInstanceCount": 0}, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update_auto_scale_configuration(self, resource_group): + response = self.client.clusters.begin_update_auto_scale_configuration( + resource_group_name=resource_group.name, + cluster_name="str", + role_name="str", + parameters={ + "autoscale": { + "capacity": {"maxInstanceCount": 0, "minInstanceCount": 0}, + "recurrence": { + "schedule": [ + { + "days": ["str"], + "timeAndCapacity": {"maxInstanceCount": 0, "minInstanceCount": 0, "time": "str"}, + } + ], + "timeZone": "str", + }, + } + }, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.clusters.list( + api_version="2024-08-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_rotate_disk_encryption_key(self, resource_group): + response = self.client.clusters.begin_rotate_disk_encryption_key( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={"keyName": "str", "keyVersion": "str", "vaultUri": "str"}, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_gateway_settings(self, resource_group): + response = self.client.clusters.get_gateway_settings( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update_gateway_settings(self, resource_group): + response = self.client.clusters.begin_update_gateway_settings( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={ + "restAuthCredential.isEnabled": True, + "restAuthCredential.password": "str", + "restAuthCredential.username": "str", + }, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_azure_async_operation_status(self, resource_group): + response = self.client.clusters.get_azure_async_operation_status( + resource_group_name=resource_group.name, + cluster_name="str", + operation_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update_identity_certificate(self, resource_group): + response = self.client.clusters.begin_update_identity_certificate( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={"applicationId": "str", "certificate": "str", "certificatePassword": "str"}, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_execute_script_actions(self, resource_group): + response = self.client.clusters.begin_execute_script_actions( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={ + "persistOnSuccess": bool, + "scriptActions": [ + {"name": "str", "roles": ["str"], "uri": "str", "applicationName": "str", "parameters": "str"} + ], + }, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_clusters_operations_async.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_clusters_operations_async.py new file mode 100644 index 0000000000000..2417baaae7815 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_clusters_operations_async.py @@ -0,0 +1,372 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementClustersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.clusters.begin_create( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str", "tenantId": "str"}}, + }, + "location": "str", + "properties": { + "clusterDefinition": { + "blueprint": "str", + "componentVersion": {"str": "str"}, + "configurations": {}, + "kind": "str", + }, + "clusterVersion": "str", + "computeIsolationProperties": {"enableComputeIsolation": False, "hostSku": "str"}, + "computeProfile": { + "roles": [ + { + "VMGroupName": "str", + "autoscale": { + "capacity": {"maxInstanceCount": 0, "minInstanceCount": 0}, + "recurrence": { + "schedule": [ + { + "days": ["str"], + "timeAndCapacity": { + "maxInstanceCount": 0, + "minInstanceCount": 0, + "time": "str", + }, + } + ], + "timeZone": "str", + }, + }, + "dataDisksGroups": [ + {"diskSizeGB": 0, "disksPerNode": 0, "storageAccountType": "str"} + ], + "encryptDataDisks": False, + "hardwareProfile": {"vmSize": "str"}, + "minInstanceCount": 0, + "name": "str", + "osProfile": { + "linuxOperatingSystemProfile": { + "password": "str", + "sshProfile": {"publicKeys": [{"certificateData": "str"}]}, + "username": "str", + } + }, + "scriptActions": [{"name": "str", "parameters": "str", "uri": "str"}], + "targetInstanceCount": 0, + "virtualNetworkProfile": {"id": "str", "subnet": "str"}, + } + ] + }, + "diskEncryptionProperties": { + "encryptionAlgorithm": "str", + "encryptionAtHost": False, + "keyName": "str", + "keyVersion": "str", + "msiResourceId": "str", + "vaultUri": "str", + }, + "encryptionInTransitProperties": {"isEncryptionInTransitEnabled": False}, + "kafkaRestProperties": { + "clientGroupInfo": {"groupId": "str", "groupName": "str"}, + "configurationOverride": {"str": "str"}, + }, + "minSupportedTlsVersion": "str", + "networkProperties": { + "outboundDependenciesManagedType": "str", + "privateLink": "str", + "publicIpTag": {"ipTagType": "str", "tag": "str"}, + "resourceProviderConnection": "str", + }, + "osType": "str", + "privateLinkConfigurations": [ + { + "groupId": "str", + "ipConfigurations": [ + { + "name": "str", + "id": "str", + "primary": bool, + "privateIPAddress": "str", + "privateIPAllocationMethod": "str", + "provisioningState": "str", + "subnet": {"id": "str"}, + "type": "str", + } + ], + "name": "str", + "id": "str", + "provisioningState": "str", + "type": "str", + } + ], + "securityProfile": { + "aaddsResourceId": "str", + "clusterUsersGroupDNs": ["str"], + "directoryType": "str", + "domain": "str", + "domainUserPassword": "str", + "domainUsername": "str", + "ldapsUrls": ["str"], + "msiResourceId": "str", + "organizationalUnitDN": "str", + }, + "storageProfile": { + "storageaccounts": [ + { + "container": "str", + "enableSecureChannel": bool, + "fileSystem": "str", + "fileshare": "str", + "isDefault": bool, + "key": "str", + "msiResourceId": "str", + "name": "str", + "resourceId": "str", + "saskey": "str", + } + ] + }, + "tier": "str", + }, + "tags": {"str": "str"}, + "zones": ["str"], + }, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.clusters.update( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str", "tenantId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.clusters.begin_delete( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.clusters.get( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.clusters.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_resize(self, resource_group): + response = await ( + await self.client.clusters.begin_resize( + resource_group_name=resource_group.name, + cluster_name="str", + role_name="str", + parameters={"targetInstanceCount": 0}, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update_auto_scale_configuration(self, resource_group): + response = await ( + await self.client.clusters.begin_update_auto_scale_configuration( + resource_group_name=resource_group.name, + cluster_name="str", + role_name="str", + parameters={ + "autoscale": { + "capacity": {"maxInstanceCount": 0, "minInstanceCount": 0}, + "recurrence": { + "schedule": [ + { + "days": ["str"], + "timeAndCapacity": {"maxInstanceCount": 0, "minInstanceCount": 0, "time": "str"}, + } + ], + "timeZone": "str", + }, + } + }, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.clusters.list( + api_version="2024-08-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_rotate_disk_encryption_key(self, resource_group): + response = await ( + await self.client.clusters.begin_rotate_disk_encryption_key( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={"keyName": "str", "keyVersion": "str", "vaultUri": "str"}, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_gateway_settings(self, resource_group): + response = await self.client.clusters.get_gateway_settings( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update_gateway_settings(self, resource_group): + response = await ( + await self.client.clusters.begin_update_gateway_settings( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={ + "restAuthCredential.isEnabled": True, + "restAuthCredential.password": "str", + "restAuthCredential.username": "str", + }, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_azure_async_operation_status(self, resource_group): + response = await self.client.clusters.get_azure_async_operation_status( + resource_group_name=resource_group.name, + cluster_name="str", + operation_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update_identity_certificate(self, resource_group): + response = await ( + await self.client.clusters.begin_update_identity_certificate( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={"applicationId": "str", "certificate": "str", "certificatePassword": "str"}, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_execute_script_actions(self, resource_group): + response = await ( + await self.client.clusters.begin_execute_script_actions( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={ + "persistOnSuccess": bool, + "scriptActions": [ + {"name": "str", "roles": ["str"], "uri": "str", "applicationName": "str", "parameters": "str"} + ], + }, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_configurations_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_configurations_operations.py new file mode 100644 index 0000000000000..c3efaa4050b17 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_configurations_operations.py @@ -0,0 +1,58 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.configurations.list( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.configurations.begin_update( + resource_group_name=resource_group.name, + cluster_name="str", + configuration_name="str", + parameters={"str": "str"}, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.configurations.get( + resource_group_name=resource_group.name, + cluster_name="str", + configuration_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_configurations_operations_async.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_configurations_operations_async.py new file mode 100644 index 0000000000000..4bcfeea895845 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_configurations_operations_async.py @@ -0,0 +1,61 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = await self.client.configurations.list( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.configurations.begin_update( + resource_group_name=resource_group.name, + cluster_name="str", + configuration_name="str", + parameters={"str": "str"}, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.configurations.get( + resource_group_name=resource_group.name, + cluster_name="str", + configuration_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_extensions_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_extensions_operations.py new file mode 100644 index 0000000000000..9a2cdfc79f5a5 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_extensions_operations.py @@ -0,0 +1,200 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementExtensionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_enable_monitoring(self, resource_group): + response = self.client.extensions.begin_enable_monitoring( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={"primaryKey": "str", "workspaceId": "str"}, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_monitoring_status(self, resource_group): + response = self.client.extensions.get_monitoring_status( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_disable_monitoring(self, resource_group): + response = self.client.extensions.begin_disable_monitoring( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_enable_azure_monitor(self, resource_group): + response = self.client.extensions.begin_enable_azure_monitor( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={ + "primaryKey": "str", + "selectedConfigurations": { + "configurationVersion": "str", + "globalConfigurations": {"str": "str"}, + "tableList": [{"name": "str"}], + }, + "workspaceId": "str", + }, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_azure_monitor_status(self, resource_group): + response = self.client.extensions.get_azure_monitor_status( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_disable_azure_monitor(self, resource_group): + response = self.client.extensions.begin_disable_azure_monitor( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_enable_azure_monitor_agent(self, resource_group): + response = self.client.extensions.begin_enable_azure_monitor_agent( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={ + "primaryKey": "str", + "selectedConfigurations": { + "configurationVersion": "str", + "globalConfigurations": {"str": "str"}, + "tableList": [{"name": "str"}], + }, + "workspaceId": "str", + }, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_azure_monitor_agent_status(self, resource_group): + response = self.client.extensions.get_azure_monitor_agent_status( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_disable_azure_monitor_agent(self, resource_group): + response = self.client.extensions.begin_disable_azure_monitor_agent( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.extensions.begin_create( + resource_group_name=resource_group.name, + cluster_name="str", + extension_name="str", + parameters={"primaryKey": "str", "workspaceId": "str"}, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.extensions.get( + resource_group_name=resource_group.name, + cluster_name="str", + extension_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.extensions.begin_delete( + resource_group_name=resource_group.name, + cluster_name="str", + extension_name="str", + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_azure_async_operation_status(self, resource_group): + response = self.client.extensions.get_azure_async_operation_status( + resource_group_name=resource_group.name, + cluster_name="str", + extension_name="str", + operation_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_extensions_operations_async.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_extensions_operations_async.py new file mode 100644 index 0000000000000..a033103ed22ce --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_extensions_operations_async.py @@ -0,0 +1,217 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementExtensionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_enable_monitoring(self, resource_group): + response = await ( + await self.client.extensions.begin_enable_monitoring( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={"primaryKey": "str", "workspaceId": "str"}, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_monitoring_status(self, resource_group): + response = await self.client.extensions.get_monitoring_status( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_disable_monitoring(self, resource_group): + response = await ( + await self.client.extensions.begin_disable_monitoring( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_enable_azure_monitor(self, resource_group): + response = await ( + await self.client.extensions.begin_enable_azure_monitor( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={ + "primaryKey": "str", + "selectedConfigurations": { + "configurationVersion": "str", + "globalConfigurations": {"str": "str"}, + "tableList": [{"name": "str"}], + }, + "workspaceId": "str", + }, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_azure_monitor_status(self, resource_group): + response = await self.client.extensions.get_azure_monitor_status( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_disable_azure_monitor(self, resource_group): + response = await ( + await self.client.extensions.begin_disable_azure_monitor( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_enable_azure_monitor_agent(self, resource_group): + response = await ( + await self.client.extensions.begin_enable_azure_monitor_agent( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={ + "primaryKey": "str", + "selectedConfigurations": { + "configurationVersion": "str", + "globalConfigurations": {"str": "str"}, + "tableList": [{"name": "str"}], + }, + "workspaceId": "str", + }, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_azure_monitor_agent_status(self, resource_group): + response = await self.client.extensions.get_azure_monitor_agent_status( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_disable_azure_monitor_agent(self, resource_group): + response = await ( + await self.client.extensions.begin_disable_azure_monitor_agent( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.extensions.begin_create( + resource_group_name=resource_group.name, + cluster_name="str", + extension_name="str", + parameters={"primaryKey": "str", "workspaceId": "str"}, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.extensions.get( + resource_group_name=resource_group.name, + cluster_name="str", + extension_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.extensions.begin_delete( + resource_group_name=resource_group.name, + cluster_name="str", + extension_name="str", + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_azure_async_operation_status(self, resource_group): + response = await self.client.extensions.get_azure_async_operation_status( + resource_group_name=resource_group.name, + cluster_name="str", + extension_name="str", + operation_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_locations_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_locations_operations.py new file mode 100644 index 0000000000000..545166fff59af --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_locations_operations.py @@ -0,0 +1,220 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementLocationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_capabilities(self, resource_group): + response = self.client.locations.get_capabilities( + location="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_usages(self, resource_group): + response = self.client.locations.list_usages( + location="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_billing_specs(self, resource_group): + response = self.client.locations.list_billing_specs( + location="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_azure_async_operation_status(self, resource_group): + response = self.client.locations.get_azure_async_operation_status( + location="str", + operation_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_name_availability(self, resource_group): + response = self.client.locations.check_name_availability( + location="str", + parameters={"name": "str", "type": "str"}, + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_validate_cluster_create_request(self, resource_group): + response = self.client.locations.validate_cluster_create_request( + location="str", + parameters={ + "fetchAaddsResource": bool, + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str", "tenantId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "clusterDefinition": { + "blueprint": "str", + "componentVersion": {"str": "str"}, + "configurations": {}, + "kind": "str", + }, + "clusterVersion": "str", + "computeIsolationProperties": {"enableComputeIsolation": False, "hostSku": "str"}, + "computeProfile": { + "roles": [ + { + "VMGroupName": "str", + "autoscale": { + "capacity": {"maxInstanceCount": 0, "minInstanceCount": 0}, + "recurrence": { + "schedule": [ + { + "days": ["str"], + "timeAndCapacity": { + "maxInstanceCount": 0, + "minInstanceCount": 0, + "time": "str", + }, + } + ], + "timeZone": "str", + }, + }, + "dataDisksGroups": [{"diskSizeGB": 0, "disksPerNode": 0, "storageAccountType": "str"}], + "encryptDataDisks": False, + "hardwareProfile": {"vmSize": "str"}, + "minInstanceCount": 0, + "name": "str", + "osProfile": { + "linuxOperatingSystemProfile": { + "password": "str", + "sshProfile": {"publicKeys": [{"certificateData": "str"}]}, + "username": "str", + } + }, + "scriptActions": [{"name": "str", "parameters": "str", "uri": "str"}], + "targetInstanceCount": 0, + "virtualNetworkProfile": {"id": "str", "subnet": "str"}, + } + ] + }, + "diskEncryptionProperties": { + "encryptionAlgorithm": "str", + "encryptionAtHost": False, + "keyName": "str", + "keyVersion": "str", + "msiResourceId": "str", + "vaultUri": "str", + }, + "encryptionInTransitProperties": {"isEncryptionInTransitEnabled": False}, + "kafkaRestProperties": { + "clientGroupInfo": {"groupId": "str", "groupName": "str"}, + "configurationOverride": {"str": "str"}, + }, + "minSupportedTlsVersion": "str", + "networkProperties": { + "outboundDependenciesManagedType": "str", + "privateLink": "str", + "publicIpTag": {"ipTagType": "str", "tag": "str"}, + "resourceProviderConnection": "str", + }, + "osType": "str", + "privateLinkConfigurations": [ + { + "groupId": "str", + "ipConfigurations": [ + { + "name": "str", + "id": "str", + "primary": bool, + "privateIPAddress": "str", + "privateIPAllocationMethod": "str", + "provisioningState": "str", + "subnet": {"id": "str"}, + "type": "str", + } + ], + "name": "str", + "id": "str", + "provisioningState": "str", + "type": "str", + } + ], + "securityProfile": { + "aaddsResourceId": "str", + "clusterUsersGroupDNs": ["str"], + "directoryType": "str", + "domain": "str", + "domainUserPassword": "str", + "domainUsername": "str", + "ldapsUrls": ["str"], + "msiResourceId": "str", + "organizationalUnitDN": "str", + }, + "storageProfile": { + "storageaccounts": [ + { + "container": "str", + "enableSecureChannel": bool, + "fileSystem": "str", + "fileshare": "str", + "isDefault": bool, + "key": "str", + "msiResourceId": "str", + "name": "str", + "resourceId": "str", + "saskey": "str", + } + ] + }, + "tier": "str", + }, + "tags": {"str": "str"}, + "tenantId": "str", + "type": "str", + "zones": ["str"], + }, + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_locations_operations_async.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_locations_operations_async.py new file mode 100644 index 0000000000000..d27fbeb59acf6 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_locations_operations_async.py @@ -0,0 +1,221 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementLocationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_capabilities(self, resource_group): + response = await self.client.locations.get_capabilities( + location="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_usages(self, resource_group): + response = await self.client.locations.list_usages( + location="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_billing_specs(self, resource_group): + response = await self.client.locations.list_billing_specs( + location="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_azure_async_operation_status(self, resource_group): + response = await self.client.locations.get_azure_async_operation_status( + location="str", + operation_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_name_availability(self, resource_group): + response = await self.client.locations.check_name_availability( + location="str", + parameters={"name": "str", "type": "str"}, + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_validate_cluster_create_request(self, resource_group): + response = await self.client.locations.validate_cluster_create_request( + location="str", + parameters={ + "fetchAaddsResource": bool, + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str", "tenantId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "clusterDefinition": { + "blueprint": "str", + "componentVersion": {"str": "str"}, + "configurations": {}, + "kind": "str", + }, + "clusterVersion": "str", + "computeIsolationProperties": {"enableComputeIsolation": False, "hostSku": "str"}, + "computeProfile": { + "roles": [ + { + "VMGroupName": "str", + "autoscale": { + "capacity": {"maxInstanceCount": 0, "minInstanceCount": 0}, + "recurrence": { + "schedule": [ + { + "days": ["str"], + "timeAndCapacity": { + "maxInstanceCount": 0, + "minInstanceCount": 0, + "time": "str", + }, + } + ], + "timeZone": "str", + }, + }, + "dataDisksGroups": [{"diskSizeGB": 0, "disksPerNode": 0, "storageAccountType": "str"}], + "encryptDataDisks": False, + "hardwareProfile": {"vmSize": "str"}, + "minInstanceCount": 0, + "name": "str", + "osProfile": { + "linuxOperatingSystemProfile": { + "password": "str", + "sshProfile": {"publicKeys": [{"certificateData": "str"}]}, + "username": "str", + } + }, + "scriptActions": [{"name": "str", "parameters": "str", "uri": "str"}], + "targetInstanceCount": 0, + "virtualNetworkProfile": {"id": "str", "subnet": "str"}, + } + ] + }, + "diskEncryptionProperties": { + "encryptionAlgorithm": "str", + "encryptionAtHost": False, + "keyName": "str", + "keyVersion": "str", + "msiResourceId": "str", + "vaultUri": "str", + }, + "encryptionInTransitProperties": {"isEncryptionInTransitEnabled": False}, + "kafkaRestProperties": { + "clientGroupInfo": {"groupId": "str", "groupName": "str"}, + "configurationOverride": {"str": "str"}, + }, + "minSupportedTlsVersion": "str", + "networkProperties": { + "outboundDependenciesManagedType": "str", + "privateLink": "str", + "publicIpTag": {"ipTagType": "str", "tag": "str"}, + "resourceProviderConnection": "str", + }, + "osType": "str", + "privateLinkConfigurations": [ + { + "groupId": "str", + "ipConfigurations": [ + { + "name": "str", + "id": "str", + "primary": bool, + "privateIPAddress": "str", + "privateIPAllocationMethod": "str", + "provisioningState": "str", + "subnet": {"id": "str"}, + "type": "str", + } + ], + "name": "str", + "id": "str", + "provisioningState": "str", + "type": "str", + } + ], + "securityProfile": { + "aaddsResourceId": "str", + "clusterUsersGroupDNs": ["str"], + "directoryType": "str", + "domain": "str", + "domainUserPassword": "str", + "domainUsername": "str", + "ldapsUrls": ["str"], + "msiResourceId": "str", + "organizationalUnitDN": "str", + }, + "storageProfile": { + "storageaccounts": [ + { + "container": "str", + "enableSecureChannel": bool, + "fileSystem": "str", + "fileshare": "str", + "isDefault": bool, + "key": "str", + "msiResourceId": "str", + "name": "str", + "resourceId": "str", + "saskey": "str", + } + ] + }, + "tier": "str", + }, + "tags": {"str": "str"}, + "tenantId": "str", + "type": "str", + "zones": ["str"], + }, + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_operations.py new file mode 100644 index 0000000000000..379c683799478 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_operations.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-08-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_operations_async.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_operations_async.py new file mode 100644 index 0000000000000..7656af187c5a2 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_operations_async.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-08-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_private_endpoint_connections_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_private_endpoint_connections_operations.py new file mode 100644 index 0000000000000..8f8830955c46d --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_private_endpoint_connections_operations.py @@ -0,0 +1,87 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_cluster(self, resource_group): + response = self.client.private_endpoint_connections.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.private_endpoint_connections.begin_create_or_update( + resource_group_name=resource_group.name, + cluster_name="str", + private_endpoint_connection_name="str", + parameters={ + "privateLinkServiceConnectionState": {"status": "str", "actionsRequired": "str", "description": "str"}, + "id": "str", + "linkIdentifier": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + cluster_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + cluster_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_private_endpoint_connections_operations_async.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_private_endpoint_connections_operations_async.py new file mode 100644 index 0000000000000..b769aa8db5187 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_private_endpoint_connections_operations_async.py @@ -0,0 +1,96 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_cluster(self, resource_group): + response = self.client.private_endpoint_connections.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.private_endpoint_connections.begin_create_or_update( + resource_group_name=resource_group.name, + cluster_name="str", + private_endpoint_connection_name="str", + parameters={ + "privateLinkServiceConnectionState": { + "status": "str", + "actionsRequired": "str", + "description": "str", + }, + "id": "str", + "linkIdentifier": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + cluster_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + cluster_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_private_link_resources_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_private_link_resources_operations.py new file mode 100644 index 0000000000000..d3cdff6d9f0b8 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_private_link_resources_operations.py @@ -0,0 +1,44 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_cluster(self, resource_group): + response = self.client.private_link_resources.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.private_link_resources.get( + resource_group_name=resource_group.name, + cluster_name="str", + private_link_resource_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_private_link_resources_operations_async.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_private_link_resources_operations_async.py new file mode 100644 index 0000000000000..fbd358103d4e8 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_private_link_resources_operations_async.py @@ -0,0 +1,45 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_cluster(self, resource_group): + response = await self.client.private_link_resources.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.private_link_resources.get( + resource_group_name=resource_group.name, + cluster_name="str", + private_link_resource_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_script_actions_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_script_actions_operations.py new file mode 100644 index 0000000000000..169215dad2d1a --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_script_actions_operations.py @@ -0,0 +1,70 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementScriptActionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.script_actions.delete( + resource_group_name=resource_group.name, + cluster_name="str", + script_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_cluster(self, resource_group): + response = self.client.script_actions.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_execution_detail(self, resource_group): + response = self.client.script_actions.get_execution_detail( + resource_group_name=resource_group.name, + cluster_name="str", + script_execution_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_execution_async_operation_status(self, resource_group): + response = self.client.script_actions.get_execution_async_operation_status( + resource_group_name=resource_group.name, + cluster_name="str", + operation_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_script_actions_operations_async.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_script_actions_operations_async.py new file mode 100644 index 0000000000000..99b4a3c23e1b9 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_script_actions_operations_async.py @@ -0,0 +1,71 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementScriptActionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.script_actions.delete( + resource_group_name=resource_group.name, + cluster_name="str", + script_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_cluster(self, resource_group): + response = self.client.script_actions.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_execution_detail(self, resource_group): + response = await self.client.script_actions.get_execution_detail( + resource_group_name=resource_group.name, + cluster_name="str", + script_execution_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_execution_async_operation_status(self, resource_group): + response = await self.client.script_actions.get_execution_async_operation_status( + resource_group_name=resource_group.name, + cluster_name="str", + operation_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_script_execution_history_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_script_execution_history_operations.py new file mode 100644 index 0000000000000..27f4a899fea30 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_script_execution_history_operations.py @@ -0,0 +1,44 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementScriptExecutionHistoryOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_cluster(self, resource_group): + response = self.client.script_execution_history.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_promote(self, resource_group): + response = self.client.script_execution_history.promote( + resource_group_name=resource_group.name, + cluster_name="str", + script_execution_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_script_execution_history_operations_async.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_script_execution_history_operations_async.py new file mode 100644 index 0000000000000..96969c375bd61 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_script_execution_history_operations_async.py @@ -0,0 +1,45 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementScriptExecutionHistoryOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_cluster(self, resource_group): + response = self.client.script_execution_history.list_by_cluster( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_promote(self, resource_group): + response = await self.client.script_execution_history.promote( + resource_group_name=resource_group.name, + cluster_name="str", + script_execution_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_virtual_machines_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_virtual_machines_operations.py new file mode 100644 index 0000000000000..80a61c04fb34a --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_virtual_machines_operations.py @@ -0,0 +1,57 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementVirtualMachinesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_hosts(self, resource_group): + response = self.client.virtual_machines.list_hosts( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restart_hosts(self, resource_group): + response = self.client.virtual_machines.begin_restart_hosts( + resource_group_name=resource_group.name, + cluster_name="str", + hosts=["str"], + api_version="2024-08-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_async_operation_status(self, resource_group): + response = self.client.virtual_machines.get_async_operation_status( + resource_group_name=resource_group.name, + cluster_name="str", + operation_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_virtual_machines_operations_async.py b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_virtual_machines_operations_async.py new file mode 100644 index 0000000000000..bd50207677002 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/generated_tests/test_hd_insight_management_virtual_machines_operations_async.py @@ -0,0 +1,60 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHDInsightManagementVirtualMachinesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_hosts(self, resource_group): + response = await self.client.virtual_machines.list_hosts( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restart_hosts(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_restart_hosts( + resource_group_name=resource_group.name, + cluster_name="str", + hosts=["str"], + api_version="2024-08-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_async_operation_status(self, resource_group): + response = await self.client.virtual_machines.get_async_operation_status( + resource_group_name=resource_group.name, + cluster_name="str", + operation_id="str", + api_version="2024-08-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/pyproject.toml b/sdk/hdinsight/azure-mgmt-hdinsight/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/setup.py b/sdk/hdinsight/azure-mgmt-hdinsight/setup.py index e1406a1c08943..122c3d56ea1e4 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/setup.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/setup.py @@ -53,11 +53,11 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -74,10 +74,10 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "typing-extensions>=4.6.0", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7", + python_requires=">=3.8", ) diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/tests/conftest.py b/sdk/hdinsight/azure-mgmt-hdinsight/tests/conftest.py new file mode 100644 index 0000000000000..c5bd5cac311d6 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/tests/conftest.py @@ -0,0 +1,37 @@ +# 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. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + hdinsightmanagement_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + hdinsightmanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + hdinsightmanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + hdinsightmanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=hdinsightmanagement_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=hdinsightmanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=hdinsightmanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=hdinsightmanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/tests/test_hd_insight_management_clusters_operations_async_test.py b/sdk/hdinsight/azure-mgmt-hdinsight/tests/test_hd_insight_management_clusters_operations_async_test.py new file mode 100644 index 0000000000000..8a70955d6fecb --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/tests/test_hd_insight_management_clusters_operations_async_test.py @@ -0,0 +1,31 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestHDInsightManagementClustersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.clusters.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-01-preview", + ) + result = [r async for r in response] + assert result == [] + \ No newline at end of file diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/tests/test_hd_insight_management_clusters_operations_test.py b/sdk/hdinsight/azure-mgmt-hdinsight/tests/test_hd_insight_management_clusters_operations_test.py new file mode 100644 index 0000000000000..bd8dd017e78b7 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/tests/test_hd_insight_management_clusters_operations_test.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestHDInsightManagementClustersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.clusters.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-01-preview", + ) + result = [r for r in response] + assert result == [] diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/tests/test_hd_insight_management_operations_async_test.py b/sdk/hdinsight/azure-mgmt-hdinsight/tests/test_hd_insight_management_operations_async_test.py new file mode 100644 index 0000000000000..95c8d71bf8d38 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/tests/test_hd_insight_management_operations_async_test.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight.aio import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestHDInsightManagementOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-08-01-preview", + ) + result = [r async for r in response] + assert result + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/tests/test_hd_insight_management_operations_test.py b/sdk/hdinsight/azure-mgmt-hdinsight/tests/test_hd_insight_management_operations_test.py new file mode 100644 index 0000000000000..9ebc0a5fe01f1 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/tests/test_hd_insight_management_operations_test.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.hdinsight import HDInsightManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestHDInsightManagementOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HDInsightManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-08-01-preview", + ) + result = [r for r in response] + assert result + diff --git a/sdk/hdinsight/azure-mgmt-hdinsightcontainers/pyproject.toml b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsightcontainers/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/hdinsight/ci.yml b/sdk/hdinsight/ci.yml index 4425641e63419..fac6d9deb5e04 100644 --- a/sdk/hdinsight/ci.yml +++ b/sdk/hdinsight/ci.yml @@ -27,6 +27,7 @@ extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: hdinsight + TestProxy: true Artifacts: - name: azure-mgmt-hdinsight safeName: azuremgmthdinsight diff --git a/sdk/healthbot/azure-mgmt-healthbot/pyproject.toml b/sdk/healthbot/azure-mgmt-healthbot/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/healthbot/azure-mgmt-healthbot/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/pyproject.toml b/sdk/healthcareapis/azure-mgmt-healthcareapis/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/healthdataaiservices/azure-health-deidentification/CHANGELOG.md b/sdk/healthdataaiservices/azure-health-deidentification/CHANGELOG.md index c3a7dc4187fdf..be2efaec75db2 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/CHANGELOG.md +++ b/sdk/healthdataaiservices/azure-health-deidentification/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0b2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.0.0b1 (2024-08-15) - Azure Health Deidentification client library diff --git a/sdk/healthdataaiservices/azure-health-deidentification/azure/health/deidentification/_version.py b/sdk/healthdataaiservices/azure-health-deidentification/azure/health/deidentification/_version.py index be71c81bd2821..bbcd28b4aa67e 100644 --- a/sdk/healthdataaiservices/azure-health-deidentification/azure/health/deidentification/_version.py +++ b/sdk/healthdataaiservices/azure-health-deidentification/azure/health/deidentification/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "1.0.0b2" diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/CHANGELOG.md b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/CHANGELOG.md new file mode 100644 index 0000000000000..6bfbcc2df58d8 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 1.0.0b1 (2024-08-15) + +### Other Changes + + - Initial version diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/LICENSE b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/LICENSE new file mode 100644 index 0000000000000..b2f52a2bad4e2 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/LICENSE @@ -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. diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/MANIFEST.in b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/MANIFEST.in new file mode 100644 index 0000000000000..0b103a4ac9737 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/healthdataaiservices/py.typed diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/README.md b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/README.md new file mode 100644 index 0000000000000..ad26f9a780a4f --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/README.md @@ -0,0 +1,61 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Healthdataaiservices Management Client Library. +This package has been tested with Python 3.8+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.8+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-healthdataaiservices +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = HealthDataAIServicesMgmtClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search Healthdataaiservices Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/_meta.json b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/_meta.json new file mode 100644 index 0000000000000..0212c35fd262b --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/_meta.json @@ -0,0 +1,6 @@ +{ + "commit": "cac34a4eb170a1fb08635573362a8923f106421d", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/healthdataaiservices/HealthDataAIServices.Management", + "@azure-tools/typespec-python": "0.28.0" +} \ No newline at end of file diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/__init__.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/__init__.py new file mode 100644 index 0000000000000..8db66d3d0f0f2 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/__init__.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/__init__.py new file mode 100644 index 0000000000000..8db66d3d0f0f2 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/__init__.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/__init__.py similarity index 54% rename from sdk/maps/azure-maps-search/azure/maps/search/_generated/__init__.py rename to sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/__init__.py index 0697d1ca3e8a9..25cac473cdf48 100644 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/__init__.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/__init__.py @@ -2,18 +2,25 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._search_client import SearchClient +from ._client import HealthDataAIServicesMgmtClient from ._version import VERSION __version__ = VERSION -__all__ = ['SearchClient'] try: - from ._patch import patch_sdk # type: ignore - patch_sdk() + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: - pass + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "HealthDataAIServicesMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_client.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_client.py new file mode 100644 index 0000000000000..1fe8f46d85da2 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_client.py @@ -0,0 +1,128 @@ +# 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) Python 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 typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy + +from ._configuration import HealthDataAIServicesMgmtClientConfiguration +from ._serialization import Deserializer, Serializer +from .operations import DeidServicesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinksOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class HealthDataAIServicesMgmtClient: # pylint: disable=client-accepts-api-version-keyword + """HealthDataAIServicesMgmtClient. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.healthdataaiservices.operations.Operations + :ivar deid_services: DeidServicesOperations operations + :vartype deid_services: azure.mgmt.healthdataaiservices.operations.DeidServicesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.healthdataaiservices.operations.PrivateEndpointConnectionsOperations + :ivar private_links: PrivateLinksOperations operations + :vartype private_links: azure.mgmt.healthdataaiservices.operations.PrivateLinksOperations + :param credential: Credential used to authenticate requests to the service. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is + "2024-02-28-preview". Note that overriding this default value may result in unsupported + behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + _endpoint = "{endpoint}" + self._config = HealthDataAIServicesMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs + ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.deid_services = DeidServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_links = PrivateLinksOperations(self._client, self._config, self._serialize, self._deserialize) + + def send_request(self, request: HttpRequest, *, stream: bool = False, **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/") + + >>> response = client.send_request(request) + + + 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.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_configuration.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_configuration.py new file mode 100644 index 0000000000000..168c12029dceb --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_configuration.py @@ -0,0 +1,75 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class HealthDataAIServicesMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for HealthDataAIServicesMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential used to authenticate requests to the service. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is + "2024-02-28-preview". Note that overriding this default value may result in unsupported + behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2024-02-28-preview") + + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.base_url = base_url + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-healthdataaiservices/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_model_base.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_model_base.py new file mode 100644 index 0000000000000..7d82ac3456cbb --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_model_base.py @@ -0,0 +1,889 @@ +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] # pylint: disable=protected-access + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object + def __init__(self, data: typing.Dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> typing.Tuple[str, typing.Any]: + return self._data.popitem() + + def clear(self) -> None: + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field( + attr_to_rest_field: typing.Dict[str, "_RestField"], rest_name: str +) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: disable=unused-argument + # we know the last three classes in mro are going to be 'Model', 'dict', and 'object' + mros = cls.__mro__[:-3][::-1] # ignore model, dict, and object parents, and reverse the mro order + attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") # pylint: disable=no-member + for k, v in mro_class.__annotations__.items() # pylint: disable=no-member + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + + return super().__new__(cls) # pylint: disable=no-value-for-parameter + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): # pylint: disable=no-member + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore # pylint: disable=no-member + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional[str]: + for v in cls.__dict__.values(): + if ( + isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators + ): # pylint: disable=protected-access + return v._rest_name # pylint: disable=protected-access + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): # pylint: disable=no-member + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + exist_discriminators.append(discriminator) + mapped_cls = cls.__mapping__.get(data.get(discriminator), cls) # pyright: ignore # pylint: disable=no-member + if mapped_cls == cls: + return cls(data) + return mapped_cls._deserialize(data, exist_discriminators) # pylint: disable=protected-access + + def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: + """Return a dict that can be JSONify using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: typing.Dict[typing.Any, typing.Any], +): + if obj is None: + return obj + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: typing.List[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912 + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation or annotation in [int, float]: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + if annotation._name == "Dict": # pyright: ignore + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore + if len(annotation.__args__) > 1: # pyright: ignore + + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): + try: + if value is None or isinstance(value, _Null): + return None + if deserializer is None: + return value + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility) diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_patch.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_serialization.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_serialization.py new file mode 100644 index 0000000000000..8139854b97bb8 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_serialization.py @@ -0,0 +1,2000 @@ +# -------------------------------------------------------------------------- +# +# 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. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[Dict[str, Any]] = {} + for k in kwargs: + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str, list + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + else: + return date_obj diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/_version.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_version.py similarity index 83% rename from sdk/maps/azure-maps-search/azure/maps/search/_generated/_version.py rename to sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_version.py index b9995fb385b07..be71c81bd2821 100644 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/_version.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/_version.py @@ -2,8 +2,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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0-preview" +VERSION = "1.0.0b1" diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/__init__.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/__init__.py new file mode 100644 index 0000000000000..2fa0142b86885 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/__init__.py @@ -0,0 +1,23 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._client import HealthDataAIServicesMgmtClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "HealthDataAIServicesMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_client.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_client.py new file mode 100644 index 0000000000000..3d2a958ee18b1 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_client.py @@ -0,0 +1,130 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy + +from .._serialization import Deserializer, Serializer +from ._configuration import HealthDataAIServicesMgmtClientConfiguration +from .operations import DeidServicesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinksOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class HealthDataAIServicesMgmtClient: # pylint: disable=client-accepts-api-version-keyword + """HealthDataAIServicesMgmtClient. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.healthdataaiservices.aio.operations.Operations + :ivar deid_services: DeidServicesOperations operations + :vartype deid_services: azure.mgmt.healthdataaiservices.aio.operations.DeidServicesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.healthdataaiservices.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_links: PrivateLinksOperations operations + :vartype private_links: azure.mgmt.healthdataaiservices.aio.operations.PrivateLinksOperations + :param credential: Credential used to authenticate requests to the service. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is + "2024-02-28-preview". Note that overriding this default value may result in unsupported + behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + _endpoint = "{endpoint}" + self._config = HealthDataAIServicesMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs + ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.deid_services = DeidServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_links = PrivateLinksOperations(self._client, self._config, self._serialize, self._deserialize) + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + 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.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_configuration.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_configuration.py new file mode 100644 index 0000000000000..e90f7b77f93c3 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_configuration.py @@ -0,0 +1,75 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class HealthDataAIServicesMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for HealthDataAIServicesMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential used to authenticate requests to the service. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is + "2024-02-28-preview". Note that overriding this default value may result in unsupported + behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2024-02-28-preview") + + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.base_url = base_url + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-healthdataaiservices/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_patch.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/__init__.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/__init__.py new file mode 100644 index 0000000000000..c955323b1f1a0 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._operations import DeidServicesOperations +from ._operations import PrivateEndpointConnectionsOperations +from ._operations import PrivateLinksOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "DeidServicesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinksOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_operations.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_operations.py new file mode 100644 index 0000000000000..f48c2edccbd36 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_operations.py @@ -0,0 +1,2881 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._model_base import SdkJSONEncoder, _deserialize +from ...operations._operations import ( + build_deid_services_create_request, + build_deid_services_delete_request, + build_deid_services_get_request, + build_deid_services_list_by_resource_group_request, + build_deid_services_list_by_subscription_request, + build_deid_services_update_request, + build_operations_list_request, + build_private_endpoint_connections_create_request, + build_private_endpoint_connections_delete_request, + build_private_endpoint_connections_get_request, + build_private_endpoint_connections_list_by_deid_service_request, + build_private_links_list_by_deid_service_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.healthdataaiservices.aio.HealthDataAIServicesMgmtClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthdataaiservices.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "actionType": "str", + "display": { + "description": "str", + "operation": "str", + "provider": "str", + "resource": "str" + }, + "isDataAction": bool, + "name": "str", + "origin": "str" + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DeidServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.healthdataaiservices.aio.HealthDataAIServicesMgmtClient`'s + :attr:`deid_services` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, deid_service_name: str, **kwargs: Any) -> _models.DeidService: + """Get a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :return: DeidService. The DeidService is compatible with MutableMapping + :rtype: ~azure.mgmt.healthdataaiservices.models.DeidService + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeidService] = kwargs.pop("cls", None) + + _request = build_deid_services_get_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeidService, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.DeidService"]: + """List DeidService resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of DeidService + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeidService]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deid_services_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeidService], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DeidService"]: + """List DeidService resources by subscription ID. + + :return: An iterator like instance of DeidService + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeidService]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deid_services_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeidService], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _create_initial( + self, + resource_group_name: str, + deid_service_name: str, + resource: Union[_models.DeidService, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_deid_services_create_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + resource: _models.DeidService, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeidService]: + """Create a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.healthdataaiservices.models.DeidService + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DeidService. The DeidService is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource = { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + + # response body for status code(s): 200, 201 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeidService]: + """Create a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DeidService. The DeidService is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeidService]: + """Create a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DeidService. The DeidService is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + resource: Union[_models.DeidService, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DeidService]: + """Create a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param resource: Resource create parameters. Is one of the following types: DeidService, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.healthdataaiservices.models.DeidService or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DeidService. The DeidService is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource = { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + + # response body for status code(s): 200, 201 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeidService] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DeidService, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeidService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeidService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + deid_service_name: str, + properties: Union[_models.DeidUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_deid_services_update_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + deid_service_name: str, + properties: _models.DeidUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeidService]: + """Update a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.healthdataaiservices.models.DeidUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DeidService. The DeidService is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + properties = { + "identity": { + "type": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "properties": { + "publicNetworkAccess": "str" + }, + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200, 202 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + deid_service_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeidService]: + """Update a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DeidService. The DeidService is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + deid_service_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeidService]: + """Update a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns DeidService. The DeidService is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + deid_service_name: str, + properties: Union[_models.DeidUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DeidService]: + """Update a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param properties: The resource properties to be updated. Is one of the following types: + DeidUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.healthdataaiservices.models.DeidUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DeidService. The DeidService is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + properties = { + "identity": { + "type": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "properties": { + "publicNetworkAccess": "str" + }, + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200, 202 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeidService] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DeidService, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeidService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeidService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, deid_service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deid_services_delete_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, deid_service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.healthdataaiservices.aio.HealthDataAIServicesMgmtClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, deid_service_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnectionResource: + """Get a specific private connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnectionResource. The PrivateEndpointConnectionResource is compatible + with MutableMapping + :rtype: ~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnectionResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnectionResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + resource: _models.PrivateEndpointConnectionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnectionResource]: + """Create a Private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnectionResource. The + PrivateEndpointConnectionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + + # response body for status code(s): 200, 201 + response == { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnectionResource]: + """Create a Private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnectionResource. The + PrivateEndpointConnectionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnectionResource]: + """Create a Private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnectionResource. The + PrivateEndpointConnectionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnectionResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnectionResource]: + """Create a Private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Is one of the following types: + PrivateEndpointConnectionResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnectionResource. The + PrivateEndpointConnectionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + + # response body for status code(s): 200, 201 + response == { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnectionResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrivateEndpointConnectionResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrivateEndpointConnectionResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, deid_service_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, deid_service_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_deid_service( + self, resource_group_name: str, deid_service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionResource"]: + """List private endpoint connections on the given resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :return: An iterator like instance of PrivateEndpointConnectionResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnectionResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_list_by_deid_service_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateEndpointConnectionResource], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PrivateLinksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.healthdataaiservices.aio.HealthDataAIServicesMgmtClient`'s + :attr:`private_links` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_deid_service( + self, resource_group_name: str, deid_service_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResource"]: + """List private links on the given resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthdataaiservices.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "requiredMembers": [ + "str" + ], + "requiredZoneNames": [ + "str" + ] + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_links_list_by_deid_service_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateLinkResource], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_patch.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/__init__.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/__init__.py new file mode 100644 index 0000000000000..57d5c4d379736 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/__init__.py @@ -0,0 +1,79 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models import DeidPropertiesUpdate +from ._models import DeidService +from ._models import DeidServiceProperties +from ._models import DeidUpdate +from ._models import ErrorAdditionalInfo +from ._models import ErrorDetail +from ._models import ErrorResponse +from ._models import ManagedServiceIdentity +from ._models import ManagedServiceIdentityUpdate +from ._models import Operation +from ._models import OperationDisplay +from ._models import PrivateEndpoint +from ._models import PrivateEndpointConnection +from ._models import PrivateEndpointConnectionProperties +from ._models import PrivateEndpointConnectionResource +from ._models import PrivateLinkResource +from ._models import PrivateLinkResourceProperties +from ._models import PrivateLinkServiceConnectionState +from ._models import ProxyResource +from ._models import Resource +from ._models import SystemData +from ._models import TrackedResource +from ._models import UserAssignedIdentity + +from ._enums import ActionType +from ._enums import CreatedByType +from ._enums import ManagedServiceIdentityType +from ._enums import Origin +from ._enums import PrivateEndpointConnectionProvisioningState +from ._enums import PrivateEndpointServiceConnectionStatus +from ._enums import ProvisioningState +from ._enums import PublicNetworkAccess +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DeidPropertiesUpdate", + "DeidService", + "DeidServiceProperties", + "DeidUpdate", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "ManagedServiceIdentity", + "ManagedServiceIdentityUpdate", + "Operation", + "OperationDisplay", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionProperties", + "PrivateEndpointConnectionResource", + "PrivateLinkResource", + "PrivateLinkResourceProperties", + "PrivateLinkServiceConnectionState", + "ProxyResource", + "Resource", + "SystemData", + "TrackedResource", + "UserAssignedIdentity", + "ActionType", + "CreatedByType", + "ManagedServiceIdentityType", + "Origin", + "PrivateEndpointConnectionProvisioningState", + "PrivateEndpointServiceConnectionStatus", + "ProvisioningState", + "PublicNetworkAccess", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_enums.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_enums.py new file mode 100644 index 0000000000000..ae242e83e840a --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_enums.py @@ -0,0 +1,112 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ + + INTERNAL = "Internal" + """Actions are for internal-only APIs.""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of entity that created the resource.""" + + USER = "User" + """The entity was created by a user.""" + APPLICATION = "Application" + """The entity was created by an application.""" + MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" + KEY = "Key" + """The entity was created by a key.""" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + """No managed identity.""" + SYSTEM_ASSIGNED = "SystemAssigned" + """System assigned managed identity.""" + USER_ASSIGNED = "UserAssigned" + """User assigned managed identity.""" + SYSTEM_AND_USER_ASSIGNED = "SystemAssigned,UserAssigned" + """System and user assigned managed identity.""" + + +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". + """ + + USER = "user" + """Indicates the operation is initiated by a user.""" + SYSTEM = "system" + """Indicates the operation is initiated by a system.""" + USER_SYSTEM = "user,system" + """Indicates the operation is initiated by a user or system.""" + + +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + """Connection has been provisioned""" + CREATING = "Creating" + """Connection is being created""" + DELETING = "Deleting" + """Connection is being deleted""" + FAILED = "Failed" + """Connection provisioning has failed""" + + +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private endpoint connection status.""" + + PENDING = "Pending" + """Connectionaiting for approval or rejection""" + APPROVED = "Approved" + """Connection approved""" + REJECTED = "Rejected" + """Connection Rejected""" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the current operation.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + PROVISIONING = "Provisioning" + """The resource is being provisioned.""" + UPDATING = "Updating" + """The resource is being updated.""" + DELETING = "Deleting" + """The resource is being deleted.""" + ACCEPTED = "Accepted" + """The resource provisioning request has been accepted.""" + + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the public network access.""" + + ENABLED = "Enabled" + """The public network access is enabled""" + DISABLED = "Disabled" + """The public network access is disabled""" diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_models.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_models.py new file mode 100644 index 0000000000000..08a42ffd5c79b --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_models.py @@ -0,0 +1,895 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .. import _model_base +from .._model_base import rest_field + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class DeidPropertiesUpdate(_model_base.Model): + """The template for adding optional properties. + + :ivar public_network_access: Gets or sets allow or disallow public network access to resource. + Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.healthdataaiservices.models.PublicNetworkAccess + """ + + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field(name="publicNetworkAccess") + """Gets or sets allow or disallow public network access to resource. Known values are: \"Enabled\" + and \"Disabled\".""" + + @overload + def __init__( + self, + *, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class Resource(_model_base.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.healthdataaiservices.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.healthdataaiservices.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[Dict[str, str]] = rest_field() + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class DeidService(TrackedResource): + """A HealthDataAIServicesProviderHub resource. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.healthdataaiservices.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.healthdataaiservices.models.DeidServiceProperties + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.healthdataaiservices.models.ManagedServiceIdentity + """ + + properties: Optional["_models.DeidServiceProperties"] = rest_field() + """The resource-specific properties for this resource.""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field() + """The managed service identities assigned to this resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.DeidServiceProperties"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class DeidServiceProperties(_model_base.Model): + """Details of the HealthDataAIServices DeidService. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.healthdataaiservices.models.ProvisioningState + :ivar service_url: Deid service url. + :vartype service_url: str + :ivar private_endpoint_connections: List of private endpoint connections. + :vartype private_endpoint_connections: + list[~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnection] + :ivar public_network_access: Gets or sets allow or disallow public network access to resource. + Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.healthdataaiservices.models.PublicNetworkAccess + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The status of the last operation. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", + \"Provisioning\", \"Updating\", \"Deleting\", and \"Accepted\".""" + service_url: Optional[str] = rest_field(name="serviceUrl", visibility=["read"]) + """Deid service url.""" + private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """List of private endpoint connections.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field(name="publicNetworkAccess") + """Gets or sets allow or disallow public network access to resource. Known values are: \"Enabled\" + and \"Disabled\".""" + + @overload + def __init__( + self, + *, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class DeidUpdate(_model_base.Model): + """Patch request body for DeidService. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Updatable managed service identity. + :vartype identity: ~azure.mgmt.healthdataaiservices.models.ManagedServiceIdentityUpdate + :ivar properties: RP-specific properties. + :vartype properties: ~azure.mgmt.healthdataaiservices.models.DeidPropertiesUpdate + """ + + tags: Optional[Dict[str, str]] = rest_field() + """Resource tags.""" + identity: Optional["_models.ManagedServiceIdentityUpdate"] = rest_field() + """Updatable managed service identity.""" + properties: Optional["_models.DeidPropertiesUpdate"] = rest_field() + """RP-specific properties.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentityUpdate"] = None, + properties: Optional["_models.DeidPropertiesUpdate"] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_model_base.Model): + """The resource management error additional info. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_model_base.Model): + """The error detail. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.healthdataaiservices.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.healthdataaiservices.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[List["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_model_base.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.healthdataaiservices.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field() + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class ManagedServiceIdentity(_model_base.Model): + """Managed service identity (system assigned and/or user assigned identities). + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: The type of managed identity assigned to this resource. Required. Known values are: + "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.healthdataaiservices.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.healthdataaiservices.models.UserAssignedIdentity] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The service principal ID of the system assigned identity. This property will only be provided + for a system assigned identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant ID of the system assigned identity. This property will only be provided for a system + assigned identity.""" + type: Union[str, "_models.ManagedServiceIdentityType"] = rest_field() + """The type of managed identity assigned to this resource. Required. Known values are: \"None\", + \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities" + ) + """The identities assigned to this resource by the user.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class ManagedServiceIdentityUpdate(_model_base.Model): + """The template for adding optional properties. + + :ivar type: The type of managed identity assigned to this resource. Known values are: "None", + "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.healthdataaiservices.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.healthdataaiservices.models.UserAssignedIdentity] + """ + + type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = rest_field() + """The type of managed identity assigned to this resource. Known values are: \"None\", + \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities" + ) + """The identities assigned to this resource by the user.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class Operation(_model_base.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.healthdataaiservices.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.healthdataaiservices.models.Origin + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.healthdataaiservices.models.ActionType + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field(visibility=["read"]) + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType") + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + @overload + def __init__( + self, + *, + action_type: Optional[Union[str, "_models.ActionType"]] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class OperationDisplay(_model_base.Model): + """Localized display information for and operation. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class PrivateEndpoint(_model_base.Model): + """The Private Endpoint resource. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier for private endpoint. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The resource identifier for private endpoint.""" + + +class PrivateEndpointConnection(Resource): + """The private endpoint connection resource. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.healthdataaiservices.models.SystemData + :ivar properties: The private endpoint connection properties. + :vartype properties: + ~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field() + """The private endpoint connection properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class PrivateEndpointConnectionProperties(_model_base.Model): + """Properties of the private endpoint connection. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + + :ivar group_ids: The group ids for the private endpoint resource. + :vartype group_ids: list[str] + :ivar private_endpoint: The private endpoint resource. + :vartype private_endpoint: ~azure.mgmt.healthdataaiservices.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. Required. + :vartype private_link_service_connection_state: + ~azure.mgmt.healthdataaiservices.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Known values are: "Succeeded", "Creating", "Deleting", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionProvisioningState + """ + + group_ids: Optional[List[str]] = rest_field(name="groupIds", visibility=["read"]) + """The group ids for the private endpoint resource.""" + private_endpoint: Optional["_models.PrivateEndpoint"] = rest_field(name="privateEndpoint") + """The private endpoint resource.""" + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState" = rest_field( + name="privateLinkServiceConnectionState" + ) + """A collection of information about the state of the connection between service consumer and + provider. Required.""" + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the private endpoint connection resource. Known values are: + \"Succeeded\", \"Creating\", \"Deleting\", and \"Failed\".""" + + @overload + def __init__( + self, + *, + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.healthdataaiservices.models.SystemData + """ + + +class PrivateEndpointConnectionResource(ProxyResource): + """Holder for private endpoint connections. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.healthdataaiservices.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field() + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class PrivateLinkResource(ProxyResource): + """Private Links for DeidService resource. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.healthdataaiservices.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.healthdataaiservices.models.PrivateLinkResourceProperties + """ + + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field() + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateLinkResourceProperties"] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class PrivateLinkResourceProperties(_model_base.Model): + """Properties of a private link resource. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource private link DNS zone name. + :vartype required_zone_names: list[str] + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """The private link resource group id.""" + required_members: Optional[List[str]] = rest_field(name="requiredMembers", visibility=["read"]) + """The private link resource required member names.""" + required_zone_names: Optional[List[str]] = rest_field(name="requiredZoneNames") + """The private link resource private link DNS zone name.""" + + @overload + def __init__( + self, + *, + required_zone_names: Optional[List[str]] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class PrivateLinkServiceConnectionState(_model_base.Model): + """A collection of information about the state of the connection between service consumer and + provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", and "Rejected". + :vartype status: str or + ~azure.mgmt.healthdataaiservices.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = rest_field() + """Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + service. Known values are: \"Pending\", \"Approved\", and \"Rejected\".""" + description: Optional[str] = rest_field() + """The reason for approval/rejection of the connection.""" + actions_required: Optional[str] = rest_field(name="actionsRequired") + """A message indicating if changes on the service provider require any updates on the consumer.""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class SystemData(_model_base.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.healthdataaiservices.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.healthdataaiservices.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy") + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="createdByType") + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field(name="createdAt", format="rfc3339") + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field(name="lastModifiedBy") + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="lastModifiedByType") + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field(name="lastModifiedAt", format="rfc3339") + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class UserAssignedIdentity(_model_base.Model): + """User assigned identity properties. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client ID of the assigned identity.""" diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_patch.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/__init__.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/__init__.py new file mode 100644 index 0000000000000..c955323b1f1a0 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/__init__.py @@ -0,0 +1,25 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._operations import DeidServicesOperations +from ._operations import PrivateEndpointConnectionsOperations +from ._operations import PrivateLinksOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "DeidServicesOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinksOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_operations.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_operations.py new file mode 100644 index 0000000000000..78354d4640a93 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_operations.py @@ -0,0 +1,3203 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._model_base import SdkJSONEncoder, _deserialize +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_operations_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-28-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.HealthDataAIServices/operations" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deid_services_get_request( + resource_group_name: str, deid_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-28-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deidServiceName": _SERIALIZER.url("deid_service_name", deid_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deid_services_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-28-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deid_services_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-28-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.HealthDataAIServices/deidServices" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deid_services_create_request( + resource_group_name: str, deid_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-28-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deidServiceName": _SERIALIZER.url("deid_service_name", deid_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deid_services_update_request( + resource_group_name: str, deid_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-28-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deidServiceName": _SERIALIZER.url("deid_service_name", deid_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deid_services_delete_request( + resource_group_name: str, deid_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-28-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deidServiceName": _SERIALIZER.url("deid_service_name", deid_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_get_request( # pylint: disable=name-too-long + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-28-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deidServiceName": _SERIALIZER.url("deid_service_name", deid_service_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_create_request( # pylint: disable=name-too-long + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-28-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deidServiceName": _SERIALIZER.url("deid_service_name", deid_service_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-28-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deidServiceName": _SERIALIZER.url("deid_service_name", deid_service_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_list_by_deid_service_request( # pylint: disable=name-too-long + resource_group_name: str, deid_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-28-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deidServiceName": _SERIALIZER.url("deid_service_name", deid_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_links_list_by_deid_service_request( # pylint: disable=name-too-long + resource_group_name: str, deid_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-28-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateLinkResources" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "deidServiceName": _SERIALIZER.url("deid_service_name", deid_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthdataaiservices.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "actionType": "str", + "display": { + "description": "str", + "operation": "str", + "provider": "str", + "resource": "str" + }, + "isDataAction": bool, + "name": "str", + "origin": "str" + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DeidServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient`'s + :attr:`deid_services` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, deid_service_name: str, **kwargs: Any) -> _models.DeidService: + """Get a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :return: DeidService. The DeidService is compatible with MutableMapping + :rtype: ~azure.mgmt.healthdataaiservices.models.DeidService + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeidService] = kwargs.pop("cls", None) + + _request = build_deid_services_get_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeidService, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.DeidService"]: + """List DeidService resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of DeidService + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeidService]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deid_services_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeidService], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DeidService"]: + """List DeidService resources by subscription ID. + + :return: An iterator like instance of DeidService + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeidService]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deid_services_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeidService], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _create_initial( + self, + resource_group_name: str, + deid_service_name: str, + resource: Union[_models.DeidService, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_deid_services_create_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + resource: _models.DeidService, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeidService]: + """Create a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.healthdataaiservices.models.DeidService + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DeidService. The DeidService is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource = { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + + # response body for status code(s): 200, 201 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + + @overload + def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeidService]: + """Create a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DeidService. The DeidService is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + + @overload + def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeidService]: + """Create a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DeidService. The DeidService is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + resource: Union[_models.DeidService, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DeidService]: + """Create a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param resource: Resource create parameters. Is one of the following types: DeidService, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.healthdataaiservices.models.DeidService or JSON or IO[bytes] + :return: An instance of LROPoller that returns DeidService. The DeidService is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource = { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + + # response body for status code(s): 200, 201 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeidService] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DeidService, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeidService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeidService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + deid_service_name: str, + properties: Union[_models.DeidUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_deid_services_update_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + deid_service_name: str, + properties: _models.DeidUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeidService]: + """Update a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.healthdataaiservices.models.DeidUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DeidService. The DeidService is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + properties = { + "identity": { + "type": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "properties": { + "publicNetworkAccess": "str" + }, + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200, 202 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + + @overload + def begin_update( + self, + resource_group_name: str, + deid_service_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeidService]: + """Update a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DeidService. The DeidService is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + + @overload + def begin_update( + self, + resource_group_name: str, + deid_service_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeidService]: + """Update a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns DeidService. The DeidService is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + deid_service_name: str, + properties: Union[_models.DeidUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DeidService]: + """Update a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param properties: The resource properties to be updated. Is one of the following types: + DeidUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.healthdataaiservices.models.DeidUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns DeidService. The DeidService is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthdataaiservices.models.DeidService] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + properties = { + "identity": { + "type": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "properties": { + "publicNetworkAccess": "str" + }, + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200, 202 + response == { + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": { + "str": { + "clientId": "str", + "principalId": "str" + } + } + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "tags": { + "str": "str" + }, + "type": "str" + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeidService] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DeidService, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeidService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeidService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, deid_service_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deid_services_delete_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, deid_service_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a DeidService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, deid_service_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnectionResource: + """Get a specific private connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnectionResource. The PrivateEndpointConnectionResource is compatible + with MutableMapping + :rtype: ~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnectionResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnectionResource, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + resource: _models.PrivateEndpointConnectionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnectionResource]: + """Create a Private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnectionResource. The + PrivateEndpointConnectionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + + # response body for status code(s): 200, 201 + response == { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + + @overload + def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnectionResource]: + """Create a Private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnectionResource. The + PrivateEndpointConnectionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + + @overload + def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnectionResource]: + """Create a Private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnectionResource. The + PrivateEndpointConnectionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + deid_service_name: str, + private_endpoint_connection_name: str, + resource: Union[_models.PrivateEndpointConnectionResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnectionResource]: + """Create a Private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param resource: Resource create parameters. Is one of the following types: + PrivateEndpointConnectionResource, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource or + JSON or IO[bytes] + :return: An instance of LROPoller that returns PrivateEndpointConnectionResource. The + PrivateEndpointConnectionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + + # response body for status code(s): 200, 201 + response == { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnectionResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrivateEndpointConnectionResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrivateEndpointConnectionResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, deid_service_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, deid_service_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete the private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_deid_service( + self, resource_group_name: str, deid_service_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionResource"]: + """List private endpoint connections on the given resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :return: An iterator like instance of PrivateEndpointConnectionResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.healthdataaiservices.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str" + }, + "groupIds": [ + "str" + ], + "privateEndpoint": { + "id": "str" + }, + "provisioningState": "str" + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnectionResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_list_by_deid_service_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateEndpointConnectionResource], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PrivateLinksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.healthdataaiservices.HealthDataAIServicesMgmtClient`'s + :attr:`private_links` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_deid_service( + self, resource_group_name: str, deid_service_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateLinkResource"]: + """List private links on the given resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deid_service_name: The name of the deid service. Required. + :type deid_service_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.healthdataaiservices.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "requiredMembers": [ + "str" + ], + "requiredZoneNames": [ + "str" + ] + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str" + }, + "type": "str" + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_links_list_by_deid_service_request( + resource_group_name=resource_group_name, + deid_service_name=deid_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateLinkResource], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_patch.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/py.typed b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/py.typed similarity index 100% rename from sdk/maps/azure-maps-search/azure/maps/search/_generated/py.typed rename to sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/azure/mgmt/healthdataaiservices/py.typed diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/dev_requirements.txt b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/dev_requirements.txt new file mode 100644 index 0000000000000..474b9228b93c6 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/dev_requirements.txt @@ -0,0 +1,6 @@ +-e ../../../tools/azure-sdk-tools +-e ../../resources/azure-mgmt-resource +../../core/azure-core +../../identity/azure-identity +../../core/azure-mgmt-core +aiohttp \ No newline at end of file diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_create_maximum_set_gen.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_create_maximum_set_gen.py new file mode 100644 index 0000000000000..01d1c5ec95d11 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_create_maximum_set_gen.py @@ -0,0 +1,47 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-healthdataaiservices +# USAGE + python deid_services_create_maximum_set_gen.py + + Before run the sample, please 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. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HealthDataAIServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="F21BB31B-C214-42C0-ACF0-DACCA05D3011", + ) + + response = client.deid_services.begin_create( + resource_group_name="rgopenapi", + deid_service_name="deidTest", + resource={ + "identity": {"type": "None", "userAssignedIdentities": {}}, + "location": "qwyhvdwcsjulggagdqxlmazcl", + "properties": {"publicNetworkAccess": "Enabled"}, + "tags": {}, + }, + ).result() + print(response) + + +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_delete_maximum_set_gen.py similarity index 65% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py rename to sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_delete_maximum_set_gen.py index f014b49a43393..577141f73788f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_delete_maximum_set_gen.py @@ -2,20 +2,20 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.appcontainers import ContainerAppsAPIClient +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-appcontainers + pip install azure-mgmt-healthdataaiservices # USAGE - python builders_delete.py + python deid_services_delete_maximum_set_gen.py Before run the sample, please 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, @@ -25,17 +25,16 @@ def main(): - client = ContainerAppsAPIClient( + client = HealthDataAIServicesMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="F21BB31B-C214-42C0-ACF0-DACCA05D3011", ) - client.builders.begin_delete( - resource_group_name="rg", - builder_name="testBuilder", + client.deid_services.begin_delete( + resource_group_name="rgopenapi", + deid_service_name="deidTest", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_get_maximum_set_gen.py similarity index 66% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py rename to sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_get_maximum_set_gen.py index e48ce3a5ca80c..6c430210720bd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_get_maximum_set_gen.py @@ -2,20 +2,20 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.appcontainers import ContainerAppsAPIClient +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-appcontainers + pip install azure-mgmt-healthdataaiservices # USAGE - python builders_get.py + python deid_services_get_maximum_set_gen.py Before run the sample, please 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, @@ -25,18 +25,17 @@ def main(): - client = ContainerAppsAPIClient( + client = HealthDataAIServicesMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="F21BB31B-C214-42C0-ACF0-DACCA05D3011", ) - response = client.builders.get( - resource_group_name="rg", - builder_name="testBuilder", + response = client.deid_services.get( + resource_group_name="rgopenapi", + deid_service_name="deidTest", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_list_by_resource_group_maximum_set_gen.py similarity index 67% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py rename to sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_list_by_resource_group_maximum_set_gen.py index 67032bc436ba1..b5d4a1109d051 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_list_by_resource_group_maximum_set_gen.py @@ -2,20 +2,20 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.appcontainers import ContainerAppsAPIClient +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-appcontainers + pip install azure-mgmt-healthdataaiservices # USAGE - python builders_list_by_subscription.py + python deid_services_list_by_resource_group_maximum_set_gen.py Before run the sample, please 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, @@ -25,16 +25,17 @@ def main(): - client = ContainerAppsAPIClient( + client = HealthDataAIServicesMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="F21BB31B-C214-42C0-ACF0-DACCA05D3011", ) - response = client.builders.list_by_subscription() + response = client.deid_services.list_by_resource_group( + resource_group_name="rgopenapi", + ) for item in response: print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_list_by_subscription_maximum_set_gen.py similarity index 64% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py rename to sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_list_by_subscription_maximum_set_gen.py index 0fb2ce7d5a593..0db354c7f5521 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_list_by_subscription_maximum_set_gen.py @@ -2,20 +2,20 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.appcontainers import ContainerAppsAPIClient +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-appcontainers + pip install azure-mgmt-healthdataaiservices # USAGE - python java_components_list.py + python deid_services_list_by_subscription_maximum_set_gen.py Before run the sample, please 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, @@ -25,19 +25,15 @@ def main(): - client = ContainerAppsAPIClient( + client = HealthDataAIServicesMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + subscription_id="F21BB31B-C214-42C0-ACF0-DACCA05D3011", ) - response = client.java_components.list( - resource_group_name="examplerg", - environment_name="myenvironment", - ) + response = client.deid_services.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_update_maximum_set_gen.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_update_maximum_set_gen.py new file mode 100644 index 0000000000000..9e59976b7522d --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/deid_services_update_maximum_set_gen.py @@ -0,0 +1,46 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-healthdataaiservices +# USAGE + python deid_services_update_maximum_set_gen.py + + Before run the sample, please 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. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HealthDataAIServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="F21BB31B-C214-42C0-ACF0-DACCA05D3011", + ) + + response = client.deid_services.begin_update( + resource_group_name="rgopenapi", + deid_service_name="deidTest", + properties={ + "identity": {"type": "None", "userAssignedIdentities": {}}, + "properties": {"publicNetworkAccess": "Enabled"}, + "tags": {}, + }, + ).result() + print(response) + + +if __name__ == "__main__": + main() diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/operations_list_maximum_set_gen.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/operations_list_maximum_set_gen.py new file mode 100644 index 0000000000000..436d6ac2e0576 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/operations_list_maximum_set_gen.py @@ -0,0 +1,39 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-healthdataaiservices +# USAGE + python operations_list_maximum_set_gen.py + + Before run the sample, please 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. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HealthDataAIServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +if __name__ == "__main__": + main() diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/operations_list_minimum_set_gen.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/operations_list_minimum_set_gen.py new file mode 100644 index 0000000000000..800522c2d39cf --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/operations_list_minimum_set_gen.py @@ -0,0 +1,39 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-healthdataaiservices +# USAGE + python operations_list_minimum_set_gen.py + + Before run the sample, please 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. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HealthDataAIServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_endpoint_connections_create_maximum_set_gen.py similarity index 56% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py rename to sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_endpoint_connections_create_maximum_set_gen.py index 6dd065b5ee1bf..949bb5fadfeb2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_endpoint_connections_create_maximum_set_gen.py @@ -2,22 +2,20 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.appcontainers import ContainerAppsAPIClient +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-appcontainers + pip install azure-mgmt-healthdataaiservices # USAGE - python dot_net_components_patch.py + python private_endpoint_connections_create_maximum_set_gen.py Before run the sample, please 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, @@ -27,25 +25,28 @@ def main(): - client = ContainerAppsAPIClient( + client = HealthDataAIServicesMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + subscription_id="F21BB31B-C214-42C0-ACF0-DACCA05D3011", ) - response = client.dot_net_components.begin_update( - resource_group_name="examplerg", - environment_name="myenvironment", - name="mydotnetcomponent", - dot_net_component_envelope={ + response = client.private_endpoint_connections.begin_create( + resource_group_name="rgopenapi", + deid_service_name="deidTest", + private_endpoint_connection_name="kgwgrrpabvrsrrvpcgcnfmyfgyrl", + resource={ "properties": { - "componentType": "AspireDashboard", - "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + "privateEndpoint": {}, + "privateLinkServiceConnectionState": { + "actionsRequired": "ulb", + "description": "xr", + "status": "Pending", + }, } }, ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Patch.json if __name__ == "__main__": main() diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_endpoint_connections_delete_maximum_set_gen.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_endpoint_connections_delete_maximum_set_gen.py new file mode 100644 index 0000000000000..f3af1467bf335 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_endpoint_connections_delete_maximum_set_gen.py @@ -0,0 +1,41 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-healthdataaiservices +# USAGE + python private_endpoint_connections_delete_maximum_set_gen.py + + Before run the sample, please 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. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HealthDataAIServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="F21BB31B-C214-42C0-ACF0-DACCA05D3011", + ) + + client.private_endpoint_connections.begin_delete( + resource_group_name="rgopenapi", + deid_service_name="deidTest", + private_endpoint_connection_name="kgwgrrpabvrsrrvpcgcnfmyfgyrl", + ).result() + + +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_endpoint_connections_get_maximum_set_gen.py similarity index 64% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py rename to sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_endpoint_connections_get_maximum_set_gen.py index 7c6dda4f0e386..92aeac29926a2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_endpoint_connections_get_maximum_set_gen.py @@ -2,20 +2,20 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.appcontainers import ContainerAppsAPIClient +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-appcontainers + pip install azure-mgmt-healthdataaiservices # USAGE - python builds_get.py + python private_endpoint_connections_get_maximum_set_gen.py Before run the sample, please 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, @@ -25,19 +25,18 @@ def main(): - client = ContainerAppsAPIClient( + client = HealthDataAIServicesMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="F21BB31B-C214-42C0-ACF0-DACCA05D3011", ) - response = client.builds.get( - resource_group_name="rg", - builder_name="testBuilder", - build_name="testBuild", + response = client.private_endpoint_connections.get( + resource_group_name="rgopenapi", + deid_service_name="deidTest", + private_endpoint_connection_name="kgwgrrpabvrsrrvpcgcnfmyfgyrl", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_endpoint_connections_list_by_deid_service_maximum_set_gen.py similarity index 66% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py rename to sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_endpoint_connections_list_by_deid_service_maximum_set_gen.py index 812800c9de41c..fbccd98a510f1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_endpoint_connections_list_by_deid_service_maximum_set_gen.py @@ -2,20 +2,20 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.appcontainers import ContainerAppsAPIClient +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-appcontainers + pip install azure-mgmt-healthdataaiservices # USAGE - python builders_list_by_resource_group.py + python private_endpoint_connections_list_by_deid_service_maximum_set_gen.py Before run the sample, please 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, @@ -25,18 +25,18 @@ def main(): - client = ContainerAppsAPIClient( + client = HealthDataAIServicesMgmtClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="F21BB31B-C214-42C0-ACF0-DACCA05D3011", ) - response = client.builders.list_by_resource_group( - resource_group_name="rg", + response = client.private_endpoint_connections.list_by_deid_service( + resource_group_name="rgopenapi", + deid_service_name="deidTest", ) for item in response: print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_links_list_by_deid_service_maximum_set_gen.py similarity index 65% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py rename to sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_links_list_by_deid_service_maximum_set_gen.py index 2ff4b5bb74038..55e3fc7fd25f5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_samples/20240228preview/private_links_list_by_deid_service_maximum_set_gen.py @@ -2,20 +2,20 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.appcontainers import ContainerAppsAPIClient +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient """ # PREREQUISITES pip install azure-identity - pip install azure-mgmt-appcontainers + pip install azure-mgmt-healthdataaiservices # USAGE - python app_resiliency_list.py + python private_links_list_by_deid_service_maximum_set_gen.py Before run the sample, please 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, @@ -25,19 +25,18 @@ def main(): - client = ContainerAppsAPIClient( + client = HealthDataAIServicesMgmtClient( credential=DefaultAzureCredential(), - subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + subscription_id="F21BB31B-C214-42C0-ACF0-DACCA05D3011", ) - response = client.app_resiliency.list( - resource_group_name="rg", - app_name="testcontainerApp0", + response = client.private_links.list_by_deid_service( + resource_group_name="rgopenapi", + deid_service_name="deidTest", ) for item in response: print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_List.json if __name__ == "__main__": main() diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/conftest.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/conftest.py new file mode 100644 index 0000000000000..9980bf30571ce --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/conftest.py @@ -0,0 +1,43 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + healthdataaiservicesmgmt_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + healthdataaiservicesmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + healthdataaiservicesmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + healthdataaiservicesmgmt_client_secret = os.environ.get( + "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=healthdataaiservicesmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=healthdataaiservicesmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=healthdataaiservicesmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=healthdataaiservicesmgmt_client_secret, value="00000000-0000-0000-0000-000000000000" + ) + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_deid_services_operations.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_deid_services_operations.py new file mode 100644 index 0000000000000..e3d10b2e098b3 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_deid_services_operations.py @@ -0,0 +1,140 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHealthDataAIServicesMgmtDeidServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HealthDataAIServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.deid_services.get( + resource_group_name=resource_group.name, + deid_service_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.deid_services.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.deid_services.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.deid_services.begin_create( + resource_group_name=resource_group.name, + deid_service_name="str", + resource={ + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.deid_services.begin_update( + resource_group_name=resource_group.name, + deid_service_name="str", + properties={ + "identity": { + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": {"publicNetworkAccess": "str"}, + "tags": {"str": "str"}, + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.deid_services.begin_delete( + resource_group_name=resource_group.name, + deid_service_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_deid_services_operations_async.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_deid_services_operations_async.py new file mode 100644 index 0000000000000..35caefa3ec341 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_deid_services_operations_async.py @@ -0,0 +1,147 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.healthdataaiservices.aio import HealthDataAIServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHealthDataAIServicesMgmtDeidServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HealthDataAIServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.deid_services.get( + resource_group_name=resource_group.name, + deid_service_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.deid_services.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.deid_services.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.deid_services.begin_create( + resource_group_name=resource_group.name, + deid_service_name="str", + resource={ + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "properties": { + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "serviceUrl": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.deid_services.begin_update( + resource_group_name=resource_group.name, + deid_service_name="str", + properties={ + "identity": { + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": {"publicNetworkAccess": "str"}, + "tags": {"str": "str"}, + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.deid_services.begin_delete( + resource_group_name=resource_group.name, + deid_service_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_operations.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_operations.py new file mode 100644 index 0000000000000..035ad06adea9b --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_operations.py @@ -0,0 +1,27 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHealthDataAIServicesMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HealthDataAIServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_operations_async.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_operations_async.py new file mode 100644 index 0000000000000..199d623e6c415 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_operations_async.py @@ -0,0 +1,28 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.healthdataaiservices.aio import HealthDataAIServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHealthDataAIServicesMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HealthDataAIServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_private_endpoint_connections_operations.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_private_endpoint_connections_operations.py new file mode 100644 index 0000000000000..0b9597e9a246a --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_private_endpoint_connections_operations.py @@ -0,0 +1,89 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHealthDataAIServicesMgmtPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HealthDataAIServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + deid_service_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.private_endpoint_connections.begin_create( + resource_group_name=resource_group.name, + deid_service_name="str", + private_endpoint_connection_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + deid_service_name="str", + private_endpoint_connection_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_deid_service(self, resource_group): + response = self.client.private_endpoint_connections.list_by_deid_service( + resource_group_name=resource_group.name, + deid_service_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_private_endpoint_connections_operations_async.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_private_endpoint_connections_operations_async.py new file mode 100644 index 0000000000000..5cfa38332c16c --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_private_endpoint_connections_operations_async.py @@ -0,0 +1,94 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.healthdataaiservices.aio import HealthDataAIServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHealthDataAIServicesMgmtPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HealthDataAIServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + deid_service_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.private_endpoint_connections.begin_create( + resource_group_name=resource_group.name, + deid_service_name="str", + private_endpoint_connection_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + deid_service_name="str", + private_endpoint_connection_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_deid_service(self, resource_group): + response = self.client.private_endpoint_connections.list_by_deid_service( + resource_group_name=resource_group.name, + deid_service_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_private_links_operations.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_private_links_operations.py new file mode 100644 index 0000000000000..bdf9ab29a4e2b --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_private_links_operations.py @@ -0,0 +1,30 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHealthDataAIServicesMgmtPrivateLinksOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HealthDataAIServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_deid_service(self, resource_group): + response = self.client.private_links.list_by_deid_service( + resource_group_name=resource_group.name, + deid_service_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_private_links_operations_async.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_private_links_operations_async.py new file mode 100644 index 0000000000000..3d23e6f91395e --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/generated_tests/test_health_data_ai_services_mgmt_private_links_operations_async.py @@ -0,0 +1,31 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.healthdataaiservices.aio import HealthDataAIServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestHealthDataAIServicesMgmtPrivateLinksOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HealthDataAIServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_deid_service(self, resource_group): + response = self.client.private_links.list_by_deid_service( + resource_group_name=resource_group.name, + deid_service_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/pyproject.toml b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/sdk_packaging.toml b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/sdk_packaging.toml new file mode 100644 index 0000000000000..97f7edb88713f --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/sdk_packaging.toml @@ -0,0 +1,12 @@ +[packaging] +package_name = "azure-mgmt-healthdataaiservices" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Healthdataaiservices Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" +title = "HealthDataAIServicesMgmtClient" diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/setup.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/setup.py new file mode 100644 index 0000000000000..8e98bda90d7ff --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/setup.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-healthdataaiservices" +PACKAGE_PPRINT_NAME = "Healthdataaiservices Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace("-", ".") + +# Version extraction inspired from 'requests' +with open( + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), + "r", +) as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +with open("CHANGELOG.md", encoding="utf-8") as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python", + keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product + classifiers=[ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", + ], + zip_safe=False, + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.mgmt", + ] + ), + include_package_data=True, + package_data={ + "pytyped": ["py.typed"], + }, + install_requires=[ + "isodate>=0.6.1", + "typing-extensions>=4.6.0", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", + ], + python_requires=">=3.8", +) diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/conftest.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/conftest.py new file mode 100644 index 0000000000000..9980bf30571ce --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/conftest.py @@ -0,0 +1,43 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + healthdataaiservicesmgmt_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + healthdataaiservicesmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + healthdataaiservicesmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + healthdataaiservicesmgmt_client_secret = os.environ.get( + "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=healthdataaiservicesmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=healthdataaiservicesmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=healthdataaiservicesmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=healthdataaiservicesmgmt_client_secret, value="00000000-0000-0000-0000-000000000000" + ) + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/test_health_data_ai_services_mgmt_deid_services_operations_async_test.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/test_health_data_ai_services_mgmt_deid_services_operations_async_test.py new file mode 100644 index 0000000000000..a11da4423bd49 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/test_health_data_ai_services_mgmt_deid_services_operations_async_test.py @@ -0,0 +1,36 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.healthdataaiservices.aio import HealthDataAIServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestHealthDataAIServicesMgmtDeidServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HealthDataAIServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.deid_services.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + assert result == [] + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.deid_services.list_by_subscription() + result = [r async for r in response] + assert response diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/test_health_data_ai_services_mgmt_deid_services_operations_test.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/test_health_data_ai_services_mgmt_deid_services_operations_test.py new file mode 100644 index 0000000000000..2f7821a79c86f --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/test_health_data_ai_services_mgmt_deid_services_operations_test.py @@ -0,0 +1,35 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestHealthDataAIServicesMgmtDeidServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HealthDataAIServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.deid_services.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + assert result == [] + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.deid_services.list_by_subscription() + result = [r for r in response] + assert response diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/test_health_data_ai_services_mgmt_operations_async_test.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/test_health_data_ai_services_mgmt_operations_async_test.py new file mode 100644 index 0000000000000..b0ed1b9ef7228 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/test_health_data_ai_services_mgmt_operations_async_test.py @@ -0,0 +1,27 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.healthdataaiservices.aio import HealthDataAIServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestHealthDataAIServicesMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HealthDataAIServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list() + result = [r async for r in response] + assert result diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/test_health_data_ai_services_mgmt_operations_test.py b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/test_health_data_ai_services_mgmt_operations_test.py new file mode 100644 index 0000000000000..96c1de70a24fc --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tests/test_health_data_ai_services_mgmt_operations_test.py @@ -0,0 +1,26 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.healthdataaiservices import HealthDataAIServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestHealthDataAIServicesMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(HealthDataAIServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list() + result = [r for r in response] + assert result diff --git a/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tsp-location.yaml b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tsp-location.yaml new file mode 100644 index 0000000000000..fe623f9090480 --- /dev/null +++ b/sdk/healthdataaiservices/azure-mgmt-healthdataaiservices/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/healthdataaiservices/HealthDataAIServices.Management +commit: cac34a4eb170a1fb08635573362a8923f106421d +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/healthdataaiservices/ci.yml b/sdk/healthdataaiservices/ci.yml index 7e269fbb14737..3b0a3df6838a1 100644 --- a/sdk/healthdataaiservices/ci.yml +++ b/sdk/healthdataaiservices/ci.yml @@ -37,5 +37,7 @@ extends: ServiceDirectory: healthdataaiservices TestProxy: true Artifacts: - - name: azure-health-deidentification - safeName: azurehealthdeidentification + - name: azure-health-deidentification + safeName: azurehealthdeidentification + - name: azure-mgmt-healthdataaiservices + safeName: azuremgmthealthdataaiservices diff --git a/sdk/healthinsights/azure-healthinsights-cancerprofiling/assets.json b/sdk/healthinsights/azure-healthinsights-cancerprofiling/assets.json index c000819acf114..172c27f895226 100644 --- a/sdk/healthinsights/azure-healthinsights-cancerprofiling/assets.json +++ b/sdk/healthinsights/azure-healthinsights-cancerprofiling/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/healthinsights/azure-healthinsights-cancerprofiling", - "Tag": "python/healthinsights/azure-healthinsights-cancerprofiling_9de1430315" + "Tag": "python/healthinsights/azure-healthinsights-cancerprofiling_4b8e4bf3ad" } diff --git a/sdk/healthinsights/azure-healthinsights-cancerprofiling/tests/test_cancer_profiling.py b/sdk/healthinsights/azure-healthinsights-cancerprofiling/tests/test_cancer_profiling.py index 27aefb6357e10..ca5d27e500448 100644 --- a/sdk/healthinsights/azure-healthinsights-cancerprofiling/tests/test_cancer_profiling.py +++ b/sdk/healthinsights/azure-healthinsights-cancerprofiling/tests/test_cancer_profiling.py @@ -1,6 +1,7 @@ import functools import json import os +import pytest from azure.core.credentials import AzureKeyCredential from azure.healthinsights.cancerprofiling import CancerProfilingClient @@ -14,13 +15,13 @@ HealthInsightsEnvPreparer = functools.partial( PowerShellPreparer, "healthinsights", - healthinsights_endpoint="https://fake_ad_resource.cognitiveservices.azure.com/", + healthinsights_endpoint="https://fake_ad_resource.cognitiveservices.azure.com", healthinsights_key="00000000000000000000000000000000", ) class TestCancerProfiling(AzureRecordedTestCase): - + @pytest.mark.skip @HealthInsightsEnvPreparer() @recorded_by_proxy def test_cancer_profiling(self, healthinsights_endpoint, healthinsights_key): diff --git a/sdk/healthinsights/azure-healthinsights-clinicalmatching/assets.json b/sdk/healthinsights/azure-healthinsights-clinicalmatching/assets.json index 903f93c5a9de8..4bbf9b7bb00be 100644 --- a/sdk/healthinsights/azure-healthinsights-clinicalmatching/assets.json +++ b/sdk/healthinsights/azure-healthinsights-clinicalmatching/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/healthinsights/azure-healthinsights-clinicalmatching", - "Tag": "python/healthinsights/azure-healthinsights-clinicalmatching_6b8e9da1f0" + "Tag": "python/healthinsights/azure-healthinsights-clinicalmatching_76071d27f8" } diff --git a/sdk/healthinsights/azure-healthinsights-clinicalmatching/tests/conftest.py b/sdk/healthinsights/azure-healthinsights-clinicalmatching/tests/conftest.py index ce09206dd2994..068f1b873303b 100644 --- a/sdk/healthinsights/azure-healthinsights-clinicalmatching/tests/conftest.py +++ b/sdk/healthinsights/azure-healthinsights-clinicalmatching/tests/conftest.py @@ -41,7 +41,7 @@ @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): healthinsights_endpoint = os.environ.get( - "HEALTHINSIGHTS_ENDPOINT", "https://fake_ad_resource.cognitiveservices.azure.com/" + "HEALTHINSIGHTS_ENDPOINT", "https://fake_ad_resource.cognitiveservices.azure.com" ) healthinsights_key = os.environ.get("HEALTHINSIGHTS_KEY", "00000000000000000000000000000000") add_general_regex_sanitizer( diff --git a/sdk/healthinsights/azure-healthinsights-clinicalmatching/tests/test_match_trials.py b/sdk/healthinsights/azure-healthinsights-clinicalmatching/tests/test_match_trials.py index 24da4826c1d3b..88e1b323409ca 100644 --- a/sdk/healthinsights/azure-healthinsights-clinicalmatching/tests/test_match_trials.py +++ b/sdk/healthinsights/azure-healthinsights-clinicalmatching/tests/test_match_trials.py @@ -1,5 +1,7 @@ import functools import json +import pytest + from azure.core.credentials import AzureKeyCredential from azure.healthinsights.clinicalmatching import ClinicalMatchingClient @@ -13,13 +15,13 @@ HealthInsightsEnvPreparer = functools.partial( PowerShellPreparer, "healthinsights", - healthinsights_endpoint="https://fake_ad_resource.cognitiveservices.azure.com/", + healthinsights_endpoint="https://fake_ad_resource.cognitiveservices.azure.com", healthinsights_key="00000000000000000000000000000000", ) class TestMatchTrials(AzureRecordedTestCase): - + @pytest.mark.skip @HealthInsightsEnvPreparer() @recorded_by_proxy def test_match_trials(self, healthinsights_endpoint, healthinsights_key): diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/CHANGELOG.md b/sdk/healthinsights/azure-healthinsights-radiologyinsights/CHANGELOG.md index 7ef384efd84b3..4d3c216252723 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/CHANGELOG.md +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/CHANGELOG.md @@ -1,14 +1,18 @@ # Release History -## 1.0.0b2 (Unreleased) +## 1.0.0 (Unreleased) -### Features Added +- GA release ### Breaking Changes -### Bugs Fixed - -### Other Changes +- Unique ID required to be added in the request parameters +- models.PatientInfo renamed into models.PatientDetails +- models.Encounter renamed into models.PatientEncounter +- models.RadiologyInsightsResult renamed into models.RadiologyInsightsJob +- PatientDocument.created_date_time renamed into PatientDocument.created_at +- FollowupCommunication.datetime renamed into FollowupCommunication.communicated_at +- FollowupRecommendation.effective_date_time renamed into FollowupRecommendation.effective_at ## 1.0.0b1 (2024-03-01) diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/README.md b/sdk/healthinsights/azure-healthinsights-radiologyinsights/README.md index e941e5d6224f3..8983c60784723 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/README.md +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/README.md @@ -7,7 +7,7 @@ ### Prequisites -- Python 3.8 or later is required to use this package. +- [Python 3.8+][python] is required to use this package. - You need an [Azure subscription][azure_sub] to use this package. - An existing Cognitive Services Health Insights instance. @@ -22,7 +22,7 @@ This table shows the relationship between SDK versions and supported API version | SDK version | Supported API version of service | |-------------|----------------------------------| -| 1.0.0b1 | 2023-09-01-preview | +| 1.0.0 | 2024-04-01 | ### Authenticate the client @@ -37,31 +37,22 @@ You can find the endpoint for your Health Insights service resource using the [A az cognitiveservices account show --name "resource-name" --resource-group "resource-group-name" --query "properties.endpoint" ``` -#### Get the API Key +#### Create a RadiologyInsightsClient with DefaultAzureCredential -You can get the **API Key** from the Health Insights service resource in the Azure Portal. -Alternatively, you can use **Azure CLI** snippet below to get the API key of your resource. +DefaultAzureCredential provides different ways to authenticate with the service. Documentation about this can be found [here][azure_credential] -```PowerShell -az cognitiveservices account keys list --resource-group --name -``` - -#### Create a RadiologyInsightsClient with an API Key Credential - -Once you have the value for the API key, you can pass it as a string into an instance of **AzureKeyCredential**. Use the key as the credential parameter to authenticate the client: - - -```python + +```Python import os -from azure.core.credentials import AzureKeyCredential +from azure.identity import DefaultAzureCredential from azure.healthinsights.radiologyinsights import RadiologyInsightsClient -KEY = os.environ["AZURE_HEALTH_INSIGHTS_API_KEY"] +credential = DefaultAzureCredential() ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] - -radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential=AzureKeyCredential(KEY)) +radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential=credential) ``` - + + ### Long-Running Operations @@ -76,30 +67,225 @@ Sample code snippets are provided to illustrate using long-running operations [b ## Key concepts -Radiology Insights currently supports one document from one patient. Please take a look [here][inferences] for more detailed information about the inferences this service produces. +Once you've initialized a 'RadiologyInsightsClient', you can use it to analyse document text by displaying inferences found within the text. +* Age Mismatch +* Laterality Discrepancy +* Sex Mismatch +* Complete Order Discrepancy +* Limited Order Discrepancy +* Finding +* Critical Result +* Follow-up Recommendation +* Communication +* Radiology Procedure -## Examples +Radiology Insights currently supports one document from one patient. Please take a look [here][inferences] for more detailed information about the inferences this service produces. -### Create a RadiologyInsights request and get the result using an asynchronous client +## Examples +For each inference samples are available that show how to retrieve the information either in a synchronous (block until operation is complete, slower) or in an asynchronous way (non-blocking, faster). For an example how to create a client, a request and get the result see the example in the [sample folder][sample_folder]. +* [Age Mismatch](#get-age-mismatch-inference-information) +* [Complete Order Discrepancy](#get-complete-order-discrepancy-inference-information) +* [Critical Result](#get-critical-result-inference-information) +* [Finding](#get-finding-inference-information) +* [Follow-up Communication](#get-follow-up-communication-information) +* [Follow-up Recommendation](#get-follow-up-recommendation-information) +* [Laterality Discrepancy](#get-laterality-discrepancy-information) +* [Limited Order Discrepancy](#get-limited-order-discrepancy-information) +* [Radiology Procedure](#get-radiology-procedure-information) +* [Sex Mismatch](#get-sex-mismatch-information) + +### Running the samples + +1. Open a terminal window and `cd` to the directory that the samples are saved in. +2. Set the environment variables specified in the sample file you wish to run. +3. Run the sample. Example: `python .py` + +### Create a request for the RadiologyInsights service + + +```Python +doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob(job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration)) +``` + + +### Get Age Mismatch Inference information + + +```Python +for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.AGE_MISMATCH: + print(f"Age Mismatch Inference found") +``` + + +### Get Complete Order Discrepancy Inference information + + +```Python +for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.COMPLETE_ORDER_DISCREPANCY: + print(f"Complete Order Discrepancy Inference found") +``` + + ### Get Critical Result Inference information - -```python + +```Python for patient_result in radiology_insights_result.patient_results: for ri_inference in patient_result.inferences: - if ( - ri_inference.kind - == models.RadiologyInsightsInferenceType.CRITICAL_RESULT - ): + if ri_inference.kind == models.RadiologyInsightsInferenceType.CRITICAL_RESULT: critical_result = ri_inference.result - print( - f"Critical Result Inference found: {critical_result.description}" - ) + print( + f"Critical Result Inference found: {critical_result.description}") +``` + + +### Get Finding Inference information + + +```Python +for patient_result in radiology_insights_result.patient_results: + counter = 0 + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.FINDING: + counter += 1 + print(f"Finding Inference found") +``` + + +### Get Follow-up Communication information + + +```Python +for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.FOLLOWUP_COMMUNICATION: + print(f"Follow-up Communication Inference found") +``` + + +### Get Follow-up Recommendation information + + +```Python +for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.FOLLOWUP_RECOMMENDATION: + print(f"Follow-up Recommendation Inference found") +``` + + +### Get Laterality Discrepancy information + + +```Python +for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.LATERALITY_DISCREPANCY: + print(f"Laterality Discrepancy Inference found") +``` + + +### Get Limited Order Discrepancy information + + +```Python +for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.LIMITED_ORDER_DISCREPANCY: + print(f"Limited Order Discrepancy Inference found") +``` + + +### Get Radiology Procedure information + + +```Python +for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.RADIOLOGY_PROCEDURE: + print(f"Radiology Procedure Inference found") +``` + + +### Get Sex Mismatch information + + +```Python +for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.SEX_MISMATCH: + print(f"Sex Mismatch Inference found") ``` - + For detailed conceptual information of this and other inferences please read more [here][inferences]. @@ -140,12 +326,15 @@ see the Code of Conduct FAQ or contact with any additional questions or comments. +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_portal]: https://portal.azure.com +[azure_core]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html#module-azure.core.exceptions [health_insights]: https://learn.microsoft.com/azure/azure-health-insights/overview [radiology_insights_docs]: https://learn.microsoft.com/azure/azure-health-insights/radiology-insights/ [azure_sub]: https://azure.microsoft.com/free/ [cognitive_resource_cli]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli -[azure_portal]: https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesHealthInsights -[azure_cli]: https://learn.microsoft.com/cli/azure/ [inferences]: https://learn.microsoft.com/azure/azure-health-insights/radiology-insights/inferences [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ -[sample_folder]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples \ No newline at end of file +[python]: https://www.python.org/downloads/ +[sample_folder]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples +[azure_credential]: https://learn.microsoft.com/python/api/overview/azure/identity-readme \ No newline at end of file diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/assets.json b/sdk/healthinsights/azure-healthinsights-radiologyinsights/assets.json index 982a6347614a7..c0c71fab6263c 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/assets.json +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/healthinsights/azure-healthinsights-radiologyinsights", - "Tag": "python/healthinsights/azure-healthinsights-radiologyinsights_d1fac89a24" + "Tag": "python/healthinsights/azure-healthinsights-radiologyinsights_9381678d4d" } diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_client.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_client.py index bc35db4ec225c..a5fd81a14c71c 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_client.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any +from typing import Any, TYPE_CHECKING, Union from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -18,6 +18,10 @@ from ._operations import RadiologyInsightsClientOperationsMixin from ._serialization import Deserializer, Serializer +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + class RadiologyInsightsClient( RadiologyInsightsClientOperationsMixin @@ -27,17 +31,18 @@ class RadiologyInsightsClient( :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com). Required. :type endpoint: str - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential - :keyword api_version: The API version to use for this operation. Default value is - "2023-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :param credential: Credential used to authenticate requests to the service. Is either a + AzureKeyCredential type or a TokenCredential type. Required. + :type credential: ~azure.core.credentials.AzureKeyCredential or + ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: + def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: _endpoint = "{endpoint}/health-insights" self._config = RadiologyInsightsClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) _policies = kwargs.pop("policies", None) diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_configuration.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_configuration.py index 25010ae540657..209906a0759ee 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_configuration.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_configuration.py @@ -6,13 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING, Union from azure.core.credentials import AzureKeyCredential from azure.core.pipeline import policies from ._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + class RadiologyInsightsClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for RadiologyInsightsClient. @@ -23,16 +27,17 @@ class RadiologyInsightsClientConfiguration: # pylint: disable=too-many-instance :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com). Required. :type endpoint: str - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential - :keyword api_version: The API version to use for this operation. Default value is - "2023-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :param credential: Credential used to authenticate requests to the service. Is either a + AzureKeyCredential type or a TokenCredential type. Required. + :type credential: ~azure.core.credentials.AzureKeyCredential or + ~azure.core.credentials.TokenCredential + :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-09-01-preview") + def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2024-04-01") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -42,10 +47,18 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) self.endpoint = endpoint self.credential = credential self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "healthinsights-radiologyinsights/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) + def _infer_policy(self, **kwargs): + if isinstance(self.credential, AzureKeyCredential): + return policies.AzureKeyCredentialPolicy(self.credential, "Ocp-Apim-Subscription-Key", **kwargs) + if hasattr(self.credential, "get_token"): + return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + raise TypeError(f"Unsupported credential: {self.credential}") + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) @@ -57,6 +70,4 @@ def _configure(self, **kwargs: Any) -> None: self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AzureKeyCredentialPolicy( - self.credential, "Ocp-Apim-Subscription-Key", **kwargs - ) + self.authentication_policy = self._infer_policy(**kwargs) diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_model_base.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_model_base.py index 1ddc071517d69..5cf70733404de 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_model_base.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_model_base.py @@ -6,6 +6,7 @@ # -------------------------------------------------------------------------- # pylint: disable=protected-access, arguments-differ, signature-differs, broad-except +import copy import calendar import decimal import functools @@ -13,7 +14,6 @@ import logging import base64 import re -import copy import typing import enum import email.utils @@ -339,7 +339,7 @@ def _get_model(module_name: str, model_name: str): class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object def __init__(self, data: typing.Dict[str, typing.Any]) -> None: - self._data = copy.deepcopy(data) + self._data = data def __contains__(self, key: typing.Any) -> bool: return key in self._data @@ -378,16 +378,13 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any: return default @typing.overload - def pop(self, key: str) -> typing.Any: - ... + def pop(self, key: str) -> typing.Any: ... @typing.overload - def pop(self, key: str, default: _T) -> _T: - ... + def pop(self, key: str, default: _T) -> _T: ... @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: - ... + def pop(self, key: str, default: typing.Any) -> typing.Any: ... def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: if default is _UNSET: @@ -404,12 +401,10 @@ def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: self._data.update(*args, **kwargs) @typing.overload - def setdefault(self, key: str, default: None = None) -> None: - ... + def setdefault(self, key: str, default: None = None) -> None: ... @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: - ... + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: if default is _UNSET: @@ -594,6 +589,64 @@ def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: typing.Dict[typing.Any, typing.Any], +): + if obj is None: + return obj + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: typing.List[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912 annotation: typing.Any, module: typing.Optional[str], @@ -621,11 +674,6 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, if rf: rf._is_model = True - def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): - if _is_model(obj): - return obj - return _deserialize(model_deserializer, obj) - return functools.partial(_deserialize_model, annotation) # pyright: ignore except Exception: pass @@ -640,36 +688,27 @@ def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj # is it optional? try: if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore - if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore - ) - - def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): - if obj is None: - return obj - return _deserialize_with_callable(if_obj_deserializer, obj) - - return functools.partial(_deserialize_with_optional, if_obj_deserializer) + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) except AttributeError: pass + # is it union? if getattr(annotation, "__origin__", None) is typing.Union: # initial ordering is we make `string` the last deserialization option, because it is often them most generic deserializers = [ _get_deserialize_callable_from_annotation(arg, module, rf) - for arg in sorted( - annotation.__args__, key=lambda x: hasattr(x, "__name__") and x.__name__ == "str" # pyright: ignore - ) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore ] - def _deserialize_with_union(deserializers, obj): - for deserializer in deserializers: - try: - return _deserialize(deserializer, obj) - except DeserializationError: - pass - raise DeserializationError() - return functools.partial(_deserialize_with_union, deserializers) try: @@ -678,17 +717,10 @@ def _deserialize_with_union(deserializers, obj): annotation.__args__[1], module, rf # pyright: ignore ) - def _deserialize_dict( - value_deserializer: typing.Optional[typing.Callable], - obj: typing.Dict[typing.Any, typing.Any], - ): - if obj is None: - return obj - return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} - return functools.partial( _deserialize_dict, value_deserializer, + module, ) except (AttributeError, IndexError): pass @@ -696,35 +728,16 @@ def _deserialize_dict( if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore if len(annotation.__args__) > 1: # pyright: ignore - def _deserialize_multiple_sequence( - entry_deserializers: typing.List[typing.Optional[typing.Callable]], - obj, - ): - if obj is None: - return obj - return type(obj)( - _deserialize(deserializer, entry, module) - for entry, deserializer in zip(obj, entry_deserializers) - ) - entry_deserializers = [ _get_deserialize_callable_from_annotation(dt, module, rf) for dt in annotation.__args__ # pyright: ignore ] - return functools.partial(_deserialize_multiple_sequence, entry_deserializers) + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) deserializer = _get_deserialize_callable_from_annotation( annotation.__args__[0], module, rf # pyright: ignore ) - def _deserialize_sequence( - deserializer: typing.Optional[typing.Callable], - obj, - ): - if obj is None: - return obj - return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) - - return functools.partial(_deserialize_sequence, deserializer) + return functools.partial(_deserialize_sequence, deserializer, module) except (TypeError, IndexError, AttributeError, SyntaxError): pass diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/__init__.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/__init__.py index 24be3b0c64fce..548300f399583 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/__init__.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/__init__.py @@ -6,14 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import RadiologyInsightsClientOperationsMixin +from ._patch import RadiologyInsightsClientOperationsMixin + -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ "RadiologyInsightsClientOperationsMixin", ] -__all__.extend([p for p in _patch_all if p not in __all__]) + _patch_sdk() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/_operations.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/_operations.py index 36592c0f12cdc..ef217cacc841f 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/_operations.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/_operations.py @@ -6,12 +6,10 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import uuid +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -46,40 +44,47 @@ def build_radiology_insights_infer_radiology_insights_request( # pylint: disable=name-too-long - **kwargs: Any, + id: str, *, expand: Optional[List[str]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/radiology-insights/jobs" + _url = "/radiology-insights/jobs/{id}" + path_format_arguments = { + "id": _SERIALIZER.url("id", id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["expand"] = [_SERIALIZER.query("expand", q, "str") if q is not None else "" for q in expand] # Construct headers - if "Repeatability-Request-ID" not in _headers: - _headers["Repeatability-Request-ID"] = str(uuid.uuid4()) - if "Repeatability-First-Sent" not in _headers: - _headers["Repeatability-First-Sent"] = _SERIALIZER.serialize_data( - datetime.datetime.now(datetime.timezone.utc), "rfc-1123" - ) - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) class RadiologyInsightsClientOperationsMixin(RadiologyInsightsClientMixinABC): + def _infer_radiology_insights_initial( - self, body: Union[_models.RadiologyInsightsData, JSON, IO[bytes]], **kwargs: Any + self, + id: str, + resource: Union[_models.RadiologyInsightsJob, JSON, IO[bytes]], + *, + expand: Optional[List[str]] = None, + **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,12 +100,14 @@ def _infer_radiology_insights_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(resource, (IOBase, bytes)): + _content = resource else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_radiology_insights_infer_radiology_insights_request( + id=id, + expand=expand, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -119,20 +126,29 @@ def _infer_radiology_insights_initial( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 201]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _deserialize(_models.HealthInsightsErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - response_headers["Repeatability-Result"] = self._deserialize( - "str", response.headers.get("Repeatability-Result") - ) + if response.status_code == 200: + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 201: + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) - deserialized = _deserialize(JSON, response.json()) + deserialized = _deserialize(JSON, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -141,122 +157,128 @@ def _infer_radiology_insights_initial( @overload def begin_infer_radiology_insights( - self, body: _models.RadiologyInsightsData, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: + self, + id: str, + resource: _models.RadiologyInsightsJob, + *, + expand: Optional[List[str]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RadiologyInsightsJob]: # pylint: disable=line-too-long """Create Radiology Insights job. Creates a Radiology Insights job with the given request body. - :param body: Required. - :type body: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsData + :param id: The unique ID of the job. Required. + :type id: str + :param resource: The resource instance. Required. + :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The - RadiologyInsightsInferenceResult is compatible with MutableMapping + :return: An instance of LROPoller that returns RadiologyInsightsJob. The RadiologyInsightsJob + is compatible with MutableMapping :rtype: - ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] + ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - body = { - "patients": [ - { - "id": "str", # A given identifier for the patient. Has to be - unique across all patients in a single request. Required. - "encounters": [ - { - "id": "str", # The id of the visit. - Required. - "class": "str", # Optional. The class of the - encounter. Known values are: "inpatient", "ambulatory", - "observation", "emergency", "virtual", and "healthHome". - "period": { - "end": "2020-02-20 00:00:00", # - Optional. End time with inclusive boundary, if not ongoing. - "start": "2020-02-20 00:00:00" # - Optional. Starting time with inclusive boundary. - } - } - ], - "info": { - "birthDate": "2020-02-20", # Optional. The patient's - date of birth. - "clinicalInfo": [ - { - "resourceType": "str", # The type of - resource. Required. - "id": "str", # Optional. Resource - Id. - "implicitRules": "str", # Optional. - A set of rules under which this content was created. - "language": "str", # Optional. - Language of the resource content. - "meta": { - "lastUpdated": "str", # - Optional. When the resource last changed - e.g. when the - version changed. - "profile": [ - "str" # Optional. A - list of profiles (references to `StructureDefinition - `_ - resources) that this resource claims to conform to. - The URL is a reference to `StructureDefinition.url - `_. - ], - "security": [ - { - "code": - "str", # Optional. Symbol in syntax defined by - the system. - "display": - "str", # Optional. Representation defined by the - system. - "extension": - [ - { - "url": "str", # Source of the definition - for the extension code - a logical name - or a URL. Required. - "valueBoolean": bool, # Optional. Value - as boolean. + resource = { + "id": "str", # The unique ID of the job. Required. + "status": "str", # The status of the job. Required. Known values are: + "notStarted", "running", "succeeded", "failed", and "canceled". + "createdAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job was created. + "error": { + "code": "str", # One of a server-defined set of error codes. + Required. + "message": "str", # A human-readable representation of the error. + Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a server-defined set of + error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "expiresAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job is set to expire. + "jobData": { + "patients": [ + { + "id": "str", # A given identifier for the patient. + Has to be unique across all patients in a single request. Required. + "details": { + "birthDate": "2020-02-20", # Optional. The + patient's date of birth. + "clinicalInfo": [ + { + "resourceType": "str", # The + type of resource. Required. + "id": "str", # Optional. + Resource Id. + "implicitRules": "str", # + Optional. A set of rules under which this content was + created. + "language": "str", # + Optional. Language of the resource content. + "meta": { + "lastUpdated": "str", + # Optional. When the resource last changed - e.g. + when the version changed. + "profile": [ + "str" # + Optional. A list of profiles (references to + `StructureDefinition + `_ + resources) that this resource claims to conform + to. The URL is a reference to + `StructureDefinition.url + `_. + ], + "security": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. "valueCodeableConcept": { "coding": [ ... ], - "text": "str" # Optional. Plain text - representation of the concept. + "text": "str" # Optional. Plain + text representation of the + concept. }, "valueDateTime": "str", # Optional. - Value as dateTime. - "valueInteger": 0, # Optional. Value as - integer. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. "valuePeriod": { - "end": "str", # Optional. End time - with inclusive boundary, if not - ongoing. - "start": "str" # Optional. Starting - time with inclusive boundary. + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. }, "valueQuantity": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - }, - "valueRange": { - "high": { "code": "str", # Optional. Coded form of the unit. "comparator": "str", # Optional. @@ -271,193 +293,199 @@ def begin_infer_radiology_insights( Numerical value (with implicit precision). }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, "low": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). } }, "valueRatio": { "denominator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). }, "numerator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). } }, "valueReference": { - "display": "str", # Optional. Text - alternative for the resource. + "display": "str", # Optional. + Text alternative for the + resource. "identifier": { "assigner": ..., "period": { - "end": "str", # Optional. - End time with inclusive - boundary, if not ongoing. - "start": "str" # Optional. - Starting time with inclusive - boundary. + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. }, - "system": "str", # Optional. The - namespace for the identifier - value. + "system": "str", # Optional. + The namespace for the + identifier value. "type": { "coding": [ ... ], - "text": "str" # Optional. - Plain text representation of - the concept. + "text": "str" # + Optional. Plain text + representation of the + concept. }, - "use": "str", # Optional. usual - | official | temp | secondary | - old (If known). - "value": "str" # Optional. The - value that is unique. + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. }, "reference": "str", # Optional. - Literal reference, Relative, internal - or absolute URL. - "type": "str" # Optional. Type the - reference refers to (e.g. "Patient"). + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). }, "valueSampledData": { - "dimensions": 0, # Number of sample - points at each time point. Required. + "dimensions": 0, # Number of + sample points at each time point. + Required. "origin": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). }, "period": 0.0, # Number of - milliseconds between samples. - Required. - "data": "str", # Optional. Decimal - values with spaces, or "E" | "U" | - "L". - "factor": 0.0, # Optional. Multiply - data by this before adding to origin. - "lowerLimit": 0.0, # Optional. Lower - limit of detection. - "upperLimit": 0.0 # Optional. Upper - limit of detection. + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. }, - "valueString": "str", # Optional. Value - as string. + "valueString": "str", # Optional. + Value as string. "valueTime": "12:30:00" # Optional. - Value as time (hh:mm:ss). - } - ], - "id": "str", - # Optional. Unique id for inter-element - referencing. - "system": - "str", # Optional. Identity of the terminology - system. - "version": - "str" # Optional. Version of the system - if - relevant. - } - ], - "source": "str", # Optional. - A uri that identifies the source system of the resource. - This provides a minimal amount of Provenance information - that can be used to track or differentiate the source of - information in the resource. The source may identify - another FHIR server, document, message, database, etc. - "tag": [ - { - "code": - "str", # Optional. Symbol in syntax defined by - the system. - "display": - "str", # Optional. Representation defined by the - system. - "extension": - [ - { - "url": "str", # Source of the definition - for the extension code - a logical name - or a URL. Required. - "valueBoolean": bool, # Optional. Value - as boolean. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "source": "str", # + Optional. A uri that identifies the source system of + the resource. This provides a minimal amount of + Provenance information that can be used to track or + differentiate the source of information in the + resource. The source may identify another FHIR + server, document, message, database, etc. + "tag": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. "valueCodeableConcept": { "coding": [ ... ], - "text": "str" # Optional. Plain text - representation of the concept. + "text": "str" # Optional. Plain + text representation of the + concept. }, "valueDateTime": "str", # Optional. - Value as dateTime. - "valueInteger": 0, # Optional. Value as - integer. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. "valuePeriod": { - "end": "str", # Optional. End time - with inclusive boundary, if not - ongoing. - "start": "str" # Optional. Starting - time with inclusive boundary. + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. }, "valueQuantity": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - }, - "valueRange": { - "high": { "code": "str", # Optional. Coded form of the unit. "comparator": "str", # Optional. @@ -472,217 +500,243 @@ def begin_infer_radiology_insights( Numerical value (with implicit precision). }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, "low": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). } }, "valueRatio": { "denominator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). }, "numerator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). } }, "valueReference": { - "display": "str", # Optional. Text - alternative for the resource. + "display": "str", # Optional. + Text alternative for the + resource. "identifier": { "assigner": ..., "period": { - "end": "str", # Optional. - End time with inclusive - boundary, if not ongoing. - "start": "str" # Optional. - Starting time with inclusive - boundary. + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. }, - "system": "str", # Optional. The - namespace for the identifier - value. + "system": "str", # Optional. + The namespace for the + identifier value. "type": { "coding": [ ... ], - "text": "str" # Optional. - Plain text representation of - the concept. + "text": "str" # + Optional. Plain text + representation of the + concept. }, - "use": "str", # Optional. usual - | official | temp | secondary | - old (If known). - "value": "str" # Optional. The - value that is unique. + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. }, "reference": "str", # Optional. - Literal reference, Relative, internal - or absolute URL. - "type": "str" # Optional. Type the - reference refers to (e.g. "Patient"). + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). }, "valueSampledData": { - "dimensions": 0, # Number of sample - points at each time point. Required. + "dimensions": 0, # Number of + sample points at each time point. + Required. "origin": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). }, "period": 0.0, # Number of - milliseconds between samples. - Required. - "data": "str", # Optional. Decimal - values with spaces, or "E" | "U" | - "L". - "factor": 0.0, # Optional. Multiply - data by this before adding to origin. - "lowerLimit": 0.0, # Optional. Lower - limit of detection. - "upperLimit": 0.0 # Optional. Upper - limit of detection. + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. }, - "valueString": "str", # Optional. Value - as string. + "valueString": "str", # Optional. + Value as string. "valueTime": "12:30:00" # Optional. - Value as time (hh:mm:ss). - } - ], - "id": "str", - # Optional. Unique id for inter-element - referencing. - "system": - "str", # Optional. Identity of the terminology - system. - "version": - "str" # Optional. Version of the system - if - relevant. - } - ], - "versionId": "str" # - Optional. The version specific identifier, as it appears - in the version portion of the URL. This value changes - when the resource is created, updated, or deleted. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "versionId": "str" # + Optional. The version specific identifier, as it + appears in the version portion of the URL. This value + changes when the resource is created, updated, or + deleted. + } + } + ], + "sex": "str" # Optional. The patient's sex. + Known values are: "female", "male", and "unspecified". + }, + "encounters": [ + { + "id": "str", # The id of the visit. + Required. + "class": "str", # Optional. The + class of the encounter. Known values are: "inpatient", + "ambulatory", "observation", "emergency", "virtual", and + "healthHome". + "period": { + "end": "2020-02-20 00:00:00", + # Optional. End time with inclusive boundary, if not + ongoing. + "start": "2020-02-20 + 00:00:00" # Optional. Starting time with inclusive + boundary. } } ], - "sex": "str" # Optional. The patient's sex. Known - values are: "female", "male", and "unspecified". - }, - "patientDocuments": [ - { - "content": { - "sourceType": "str", # The type of - the content's source. In case the source type is 'inline', - the content is given as a string (for instance, text). In - case the source type is 'reference', the content is given as - a URI. Required. Known values are: "inline" and "reference". - "value": "str" # The content of the - document, given either inline (as a string) or as a reference - (URI). Required. - }, - "id": "str", # A given identifier for the - document. Has to be unique across all documents for a single - patient. Required. - "type": "str", # The type of the patient - document, such as 'note' (text document) or 'fhirBundle' (FHIR - JSON document). Required. Known values are: "note", "fhirBundle", - "dicom", and "genomicSequencing". - "administrativeMetadata": { - "encounterId": "str", # Optional. - Reference to the encounter associated with the document. - "orderedProcedures": [ - { - "code": { - "coding": [ - { + "patientDocuments": [ + { + "content": { + "sourceType": "str", # The + type of the content's source. In case the source type is + 'inline', the content is given as a string (for instance, + text). In case the source type is 'reference', the + content is given as a URI. Required. Known values are: + "inline" and "reference". + "value": "str" # The content + of the document, given either inline (as a string) or as + a reference (URI). Required. + }, + "id": "str", # A given identifier + for the document. Has to be unique across all documents for a + single patient. Required. + "type": "str", # The type of the + patient document, such as 'note' (text document) or + 'fhirBundle' (FHIR JSON document). Required. Known values + are: "note", "fhirBundle", "dicom", and "genomicSequencing". + "administrativeMetadata": { + "encounterId": "str", # + Optional. Reference to the encounter associated with the + document. + "orderedProcedures": [ + { + "code": { + "coding": [ + { "code": "str", # Optional. Symbol in - syntax defined by the system. + syntax defined by the system. "display": "str", # Optional. - Representation defined by the system. + Representation defined by the system. "extension": [ { - "url": "str", # Source of the - definition for the extension code - - a logical name or a URL. - Required. + "url": "str", # Source of + the definition for the + extension code - a logical + name or a URL. Required. "valueBoolean": bool, # - Optional. Value as boolean. + Optional. Value as boolean. "valueCodeableConcept": ..., "valueDateTime": "str", # - Optional. Value as dateTime. - "valueInteger": 0, # Optional. - Value as integer. + Optional. Value as dateTime. + "valueInteger": 0, # + Optional. Value as integer. "valuePeriod": { - "end": "str", # Optional. - End time with inclusive - boundary, if not ongoing. - "start": "str" # Optional. - Starting time with inclusive - boundary. + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. }, "valueQuantity": { - "code": "str", # Optional. - Coded form of the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the value. - "system": "str", # Optional. - System that defines coded - unit form. - "unit": "str", # Optional. - Unit representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). - }, - "valueRange": { - "high": { "code": "str", # Optional. Coded form of the unit. @@ -700,589 +754,196 @@ def begin_infer_radiology_insights( Numerical value (with implicit precision). }, + "valueRange": { + "high": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, "low": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). } }, "valueRatio": { "denominator": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). }, "numerator": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). } }, "valueReference": { "display": "str", # - Optional. Text alternative - for the resource. + Optional. Text + alternative for the + resource. "identifier": { "assigner": ..., "period": { "end": "str", # - Optional. End time - with inclusive - boundary, if not - ongoing. + Optional. End + time with + inclusive + boundary, if not + ongoing. "start": "str" # - Optional. Starting - time with inclusive - boundary. + Optional. + Starting time + with inclusive + boundary. }, "system": "str", # - Optional. The namespace - for the identifier value. + Optional. The + namespace for the + identifier value. "type": ..., "use": "str", # - Optional. usual | - official | temp | - secondary | old (If - known). + Optional. usual | + official | temp | + secondary | old (If + known). "value": "str" # - Optional. The value that - is unique. + Optional. The value + that is unique. }, "reference": "str", # - Optional. Literal reference, - Relative, internal or - absolute URL. - "type": "str" # Optional. - Type the reference refers to - (e.g. "Patient"). + Optional. Literal + reference, Relative, + internal or absolute URL. + "type": "str" # + Optional. Type the + reference refers to (e.g. + "Patient"). }, "valueSampledData": { - "dimensions": 0, # Number of - sample points at each time - point. Required. + "dimensions": 0, # + Number of sample points + at each time point. + Required. "origin": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). }, - "period": 0.0, # Number of - milliseconds between samples. - Required. - "data": "str", # Optional. - Decimal values with spaces, - or "E" | "U" | "L". - "factor": 0.0, # Optional. - Multiply data by this before - adding to origin. + "period": 0.0, # Number + of milliseconds between + samples. Required. + "data": "str", # + Optional. Decimal values + with spaces, or "E" | "U" + | "L". + "factor": 0.0, # + Optional. Multiply data + by this before adding to + origin. "lowerLimit": 0.0, # - Optional. Lower limit of - detection. + Optional. Lower limit of + detection. "upperLimit": 0.0 # - Optional. Upper limit of - detection. + Optional. Upper limit of + detection. }, "valueString": "str", # - Optional. Value as string. + Optional. Value as string. "valueTime": "12:30:00" # - Optional. Value as time - (hh:mm:ss). + Optional. Value as time + (hh:mm:ss). } ], - "id": "str", # Optional. Unique id for - inter-element referencing. - "system": "str", # Optional. Identity of - the terminology system. - "version": "str" # Optional. Version of - the system - if relevant. - } - ], - "text": "str" - # Optional. Plain text representation of the - concept. - }, - "description": "str", - # Optional. Procedure description. - "extension": [ - { - "url": "str", # Source of the definition for - the extension code - a logical name or a URL. - Required. - "valueBoolean": bool, # Optional. Value as - boolean. - "valueCodeableConcept": { - "coding": [ - { - "code": "str", # Optional. - Symbol in syntax defined by the - system. - "display": "str", # Optional. - Representation defined by the - system. - "extension": [ - ... - ], - "id": "str", # Optional. Unique - id for inter-element referencing. + "id": "str", # Optional. Unique id + for inter-element referencing. "system": "str", # Optional. - Identity of the terminology - system. - "version": "str" # Optional. - Version of the system - if - relevant. + Identity of the terminology system. + "version": "str" # Optional. Version + of the system - if relevant. } - ], + ], "text": "str" # Optional. Plain text - representation of the concept. - }, - "valueDateTime": "str", # Optional. Value as - dateTime. - "valueInteger": 0, # Optional. Value as - integer. - "valuePeriod": { - "end": "str", # Optional. End time with - inclusive boundary, if not ongoing. - "start": "str" # Optional. Starting time - with inclusive boundary. - }, - "valueQuantity": { - "code": "str", # Optional. Coded form of - the unit. - "comparator": "str", # Optional. < | <= - | >= | > - how to understand the value. - "system": "str", # Optional. System that - defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical value - (with implicit precision). - }, - "valueRange": { - "high": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - }, - "low": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - } - }, - "valueRatio": { - "denominator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - }, - "numerator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - } - }, - "valueReference": { - "display": "str", # Optional. Text - alternative for the resource. - "identifier": { - "assigner": ..., - "period": { - "end": "str", # Optional. End - time with inclusive boundary, if - not ongoing. - "start": "str" # Optional. - Starting time with inclusive - boundary. - }, - "system": "str", # Optional. The - namespace for the identifier value. - "type": { - "coding": [ - { - "code": "str", # - Optional. Symbol in - syntax defined by the - system. - "display": "str", # - Optional. Representation - defined by the system. - "extension": [ - ... - ], - "id": "str", # Optional. - Unique id for - inter-element - referencing. - "system": "str", # - Optional. Identity of the - terminology system. - "version": "str" # - Optional. Version of the - system - if relevant. - } - ], - "text": "str" # Optional. Plain - text representation of the - concept. - }, - "use": "str", # Optional. usual | - official | temp | secondary | old (If - known). - "value": "str" # Optional. The value - that is unique. - }, - "reference": "str", # Optional. Literal - reference, Relative, internal or absolute - URL. - "type": "str" # Optional. Type the - reference refers to (e.g. "Patient"). - }, - "valueSampledData": { - "dimensions": 0, # Number of sample - points at each time point. Required. - "origin": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - }, - "period": 0.0, # Number of milliseconds - between samples. Required. - "data": "str", # Optional. Decimal - values with spaces, or "E" | "U" | "L". - "factor": 0.0, # Optional. Multiply data - by this before adding to origin. - "lowerLimit": 0.0, # Optional. Lower - limit of detection. - "upperLimit": 0.0 # Optional. Upper - limit of detection. - }, - "valueString": "str", # Optional. Value as - string. - "valueTime": "12:30:00" # Optional. Value as - time (hh:mm:ss). - } - ] - } - ] - }, - "authors": [ - { - "fullName": "str", # - Optional. Text representation of the full name. - "id": "str" # Optional. - author id. - } - ], - "clinicalType": "str", # Optional. The type - of the clinical document. Known values are: "consultation", - "dischargeSummary", "historyAndPhysical", "radiologyReport", - "procedure", "progress", "laboratory", and "pathologyReport". - "createdDateTime": "2020-02-20 00:00:00", # - Optional. The date and time when the document was created. - "language": "str", # Optional. A 2 letter - ISO 639-1 representation of the language of the document. - "specialtyType": "str" # Optional. specialty - type the document. Known values are: "pathology" and "radiology". - } - ] - } - ], - "configuration": { - "includeEvidence": bool, # Optional. An indication whether the - model's output should include evidence for the inferences. - "inferenceOptions": { - "findingOptions": { - "provideFocusedSentenceEvidence": bool # Optional. - If this is true, provide the sentence that contains the first token - of the finding's clinical indicator (i.e. the medical problem), if - there is one. This sentence is provided as an extension with url - 'ci_sentence', next to the token evidence. Default is false. - }, - "followupRecommendationOptions": { - "includeRecommendationsInReferences": bool, # - Optional. Include/Exclude follow-up recommendations in references to - a guideline or article. Default is false. - "includeRecommendationsWithNoSpecifiedModality": - bool, # Optional. Include/Exclude follow-up recommendations without - a specific radiology procedure. Default is false. - "provideFocusedSentenceEvidence": bool # Optional. - If this is true, provide one or more sentences as evidence for the - recommendation, next to the token evidence. The start and end - positions of these sentences will be put in an extension with url - 'modality_sentences'. Default is false. - } - }, - "inferenceTypes": [ - "str" # Optional. This is a list of inference types to be - inferred for the current request. It could be used if only part of the - Radiology Insights inferences are required. If this list is omitted or - empty, the model will return all the inference types. - ], - "locale": "str", # Optional. Local for the model to use. If not - specified, the model will use the default locale. - "verbose": bool # Optional. An indication whether the model should - produce verbose output. - } - } - - # response body for status code(s): 202 - response == { - "modelVersion": "str", # The version of the model used for inference, - expressed as the model date. Required. - "patientResults": [ - { - "inferences": [ - radiology_insights_inference - ], - "patientId": "str" # Identifier given for the patient in the - request. Required. - } - ] - } - """ - - @overload - def begin_infer_radiology_insights( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: - """Create Radiology Insights job. - - Creates a Radiology Insights job with the given request body. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The - RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 202 - response == { - "modelVersion": "str", # The version of the model used for inference, - expressed as the model date. Required. - "patientResults": [ - { - "inferences": [ - radiology_insights_inference - ], - "patientId": "str" # Identifier given for the patient in the - request. Required. - } - ] - } - """ - - @overload - def begin_infer_radiology_insights( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: - """Create Radiology Insights job. - - Creates a Radiology Insights job with the given request body. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The - RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 202 - response == { - "modelVersion": "str", # The version of the model used for inference, - expressed as the model date. Required. - "patientResults": [ - { - "inferences": [ - radiology_insights_inference - ], - "patientId": "str" # Identifier given for the patient in the - request. Required. - } - ] - } - """ - - @distributed_trace - def begin_infer_radiology_insights( - self, body: Union[_models.RadiologyInsightsData, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: - # pylint: disable=line-too-long - """Create Radiology Insights job. - - Creates a Radiology Insights job with the given request body. - - :param body: Is one of the following types: RadiologyInsightsData, JSON, IO[bytes] Required. - :type body: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsData or JSON or - IO[bytes] - :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The - RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "patients": [ - { - "id": "str", # A given identifier for the patient. Has to be - unique across all patients in a single request. Required. - "encounters": [ - { - "id": "str", # The id of the visit. - Required. - "class": "str", # Optional. The class of the - encounter. Known values are: "inpatient", "ambulatory", - "observation", "emergency", "virtual", and "healthHome". - "period": { - "end": "2020-02-20 00:00:00", # - Optional. End time with inclusive boundary, if not ongoing. - "start": "2020-02-20 00:00:00" # - Optional. Starting time with inclusive boundary. - } - } - ], - "info": { - "birthDate": "2020-02-20", # Optional. The patient's - date of birth. - "clinicalInfo": [ - { - "resourceType": "str", # The type of - resource. Required. - "id": "str", # Optional. Resource - Id. - "implicitRules": "str", # Optional. - A set of rules under which this content was created. - "language": "str", # Optional. - Language of the resource content. - "meta": { - "lastUpdated": "str", # - Optional. When the resource last changed - e.g. when the - version changed. - "profile": [ - "str" # Optional. A - list of profiles (references to `StructureDefinition - `_ - resources) that this resource claims to conform to. - The URL is a reference to `StructureDefinition.url - `_. - ], - "security": [ - { - "code": - "str", # Optional. Symbol in syntax defined by - the system. - "display": - "str", # Optional. Representation defined by the - system. + representation of the concept. + }, + "description": "str", # Optional. Procedure + description. "extension": [ { @@ -1293,8 +954,27 @@ def begin_infer_radiology_insights( as boolean. "valueCodeableConcept": { "coding": [ + { + "code": "str", # Optional. + Symbol in syntax defined by + the system. + "display": "str", # + Optional. Representation + defined by the system. + "extension": [ ... ], + "id": "str", # Optional. + Unique id for inter-element + referencing. + "system": "str", # Optional. + Identity of the terminology + system. + "version": "str" # Optional. + Version of the system - if + relevant. + } + ], "text": "str" # Optional. Plain text representation of the concept. }, @@ -1404,8 +1084,33 @@ def begin_infer_radiology_insights( value. "type": { "coding": [ + { + "code": "str", # + Optional. Symbol in + syntax defined by the + system. + "display": "str", # + Optional. + Representation + defined by the + system. + "extension": [ ... ], + "id": "str", # + Optional. Unique id + for inter-element + referencing. + "system": "str", # + Optional. Identity of + the terminology + system. + "version": "str" # + Optional. Version of + the system - if + relevant. + } + ], "text": "str" # Optional. Plain text representation of the concept. @@ -1458,73 +1163,181 @@ def begin_infer_radiology_insights( "valueTime": "12:30:00" # Optional. Value as time (hh:mm:ss). } - ], - "id": "str", - # Optional. Unique id for inter-element - referencing. - "system": - "str", # Optional. Identity of the terminology - system. - "version": - "str" # Optional. Version of the system - if - relevant. + ] } - ], - "source": "str", # Optional. - A uri that identifies the source system of the resource. - This provides a minimal amount of Provenance information - that can be used to track or differentiate the source of - information in the resource. The source may identify - another FHIR server, document, message, database, etc. - "tag": [ - { - "code": - "str", # Optional. Symbol in syntax defined by - the system. - "display": - "str", # Optional. Representation defined by the - system. - "extension": - [ - { - "url": "str", # Source of the definition - for the extension code - a logical name - or a URL. Required. - "valueBoolean": bool, # Optional. Value - as boolean. - "valueCodeableConcept": { - "coding": [ - ... - ], - "text": "str" # Optional. Plain text - representation of the concept. - }, - "valueDateTime": "str", # Optional. - Value as dateTime. - "valueInteger": 0, # Optional. Value as - integer. - "valuePeriod": { - "end": "str", # Optional. End time - with inclusive boundary, if not - ongoing. - "start": "str" # Optional. Starting - time with inclusive boundary. + ] + }, + "authors": [ + { + "fullName": "str", # + Optional. Text representation of the full name. + "id": "str" # + Optional. author id. + } + ], + "clinicalType": "str", # Optional. + The type of the clinical document. Known values are: + "consultation", "dischargeSummary", "historyAndPhysical", + "radiologyReport", "procedure", "progress", "laboratory", and + "pathologyReport". + "createdAt": "2020-02-20 00:00:00", + # Optional. The date and time when the document was created. + "language": "str", # Optional. A 2 + letter ISO 639-1 representation of the language of the + document. + "specialtyType": "str" # Optional. + specialty type the document. Known values are: "pathology" + and "radiology". + } + ] + } + ], + "configuration": { + "includeEvidence": bool, # Optional. An indication whether + the model's output should include evidence for the inferences. + "inferenceOptions": { + "findingOptions": { + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide the sentence that contains the + first token of the finding's clinical indicator (i.e. the medical + problem), if there is one. This sentence is provided as an + extension with url 'ci_sentence', next to the token evidence. + Default is false. + }, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + # Optional. Include/Exclude follow-up recommendations in + references to a guideline or article. Default is false. + "includeRecommendationsWithNoSpecifiedModality": bool, # + Optional. Include/Exclude follow-up recommendations without a + specific radiology procedure. Default is false. + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide one or more sentences as + evidence for the recommendation, next to the token evidence. The + start and end positions of these sentences will be put in an + extension with url 'modality_sentences'. Default is false. + } + }, + "inferenceTypes": [ + "str" # Optional. This is a list of inference types + to be inferred for the current request. It could be used if only part + of the Radiology Insights inferences are required. If this list is + omitted or empty, the model will return all the inference types. + ], + "locale": "str", # Optional. Local for the model to use. If + not specified, the model will use the default locale. + "verbose": bool # Optional. An indication whether the model + should produce verbose output. + } + }, + "result": { + "modelVersion": "str", # The version of the model used for + inference, expressed as the model date. Required. + "patientResults": [ + { + "inferences": [ + radiology_insights_inference + ], + "patientId": "str" # Identifier given for the + patient in the request. Required. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. The date and time when the + processing job was last updated. + } + + # response body for status code(s): 201, 200 + response == { + "id": "str", # The unique ID of the job. Required. + "status": "str", # The status of the job. Required. Known values are: + "notStarted", "running", "succeeded", "failed", and "canceled". + "createdAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job was created. + "error": { + "code": "str", # One of a server-defined set of error codes. + Required. + "message": "str", # A human-readable representation of the error. + Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a server-defined set of + error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "expiresAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job is set to expire. + "jobData": { + "patients": [ + { + "id": "str", # A given identifier for the patient. + Has to be unique across all patients in a single request. Required. + "details": { + "birthDate": "2020-02-20", # Optional. The + patient's date of birth. + "clinicalInfo": [ + { + "resourceType": "str", # The + type of resource. Required. + "id": "str", # Optional. + Resource Id. + "implicitRules": "str", # + Optional. A set of rules under which this content was + created. + "language": "str", # + Optional. Language of the resource content. + "meta": { + "lastUpdated": "str", + # Optional. When the resource last changed - e.g. + when the version changed. + "profile": [ + "str" # + Optional. A list of profiles (references to + `StructureDefinition + `_ + resources) that this resource claims to conform + to. The URL is a reference to + `StructureDefinition.url + `_. + ], + "security": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. }, - "valueQuantity": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. }, - "valueRange": { - "high": { + "valueQuantity": { "code": "str", # Optional. Coded form of the unit. "comparator": "str", # Optional. @@ -1539,94 +1352,199 @@ def begin_infer_radiology_insights( Numerical value (with implicit precision). }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, "low": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). } }, "valueRatio": { "denominator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). }, "numerator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). } }, "valueReference": { - "display": "str", # Optional. Text - alternative for the resource. + "display": "str", # Optional. + Text alternative for the + resource. "identifier": { "assigner": ..., "period": { - "end": "str", # Optional. - End time with inclusive - boundary, if not ongoing. - "start": "str" # Optional. - Starting time with inclusive - boundary. + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. }, - "system": "str", # Optional. The - namespace for the identifier - value. + "system": "str", # Optional. + The namespace for the + identifier value. "type": { "coding": [ ... ], - "text": "str" # Optional. - Plain text representation of - the concept. + "text": "str" # + Optional. Plain text + representation of the + concept. }, - "use": "str", # Optional. usual - | official | temp | secondary | - old (If known). - "value": "str" # Optional. The - value that is unique. + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. }, "reference": "str", # Optional. - Literal reference, Relative, internal - or absolute URL. - "type": "str" # Optional. Type the - reference refers to (e.g. "Patient"). + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). }, "valueSampledData": { - "dimensions": 0, # Number of sample - points at each time point. Required. + "dimensions": 0, # Number of + sample points at each time point. + Required. "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "source": "str", # + Optional. A uri that identifies the source system of + the resource. This provides a minimal amount of + Provenance information that can be used to track or + differentiate the source of information in the + resource. The source may identify another FHIR + server, document, message, database, etc. + "tag": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { "code": "str", # Optional. Coded form of the unit. "comparator": "str", # Optional. @@ -1641,99 +1559,8 @@ def begin_infer_radiology_insights( Numerical value (with implicit precision). }, - "period": 0.0, # Number of - milliseconds between samples. - Required. - "data": "str", # Optional. Decimal - values with spaces, or "E" | "U" | - "L". - "factor": 0.0, # Optional. Multiply - data by this before adding to origin. - "lowerLimit": 0.0, # Optional. Lower - limit of detection. - "upperLimit": 0.0 # Optional. Upper - limit of detection. - }, - "valueString": "str", # Optional. Value - as string. - "valueTime": "12:30:00" # Optional. - Value as time (hh:mm:ss). - } - ], - "id": "str", - # Optional. Unique id for inter-element - referencing. - "system": - "str", # Optional. Identity of the terminology - system. - "version": - "str" # Optional. Version of the system - if - relevant. - } - ], - "versionId": "str" # - Optional. The version specific identifier, as it appears - in the version portion of the URL. This value changes - when the resource is created, updated, or deleted. - } - } - ], - "sex": "str" # Optional. The patient's sex. Known - values are: "female", "male", and "unspecified". - }, - "patientDocuments": [ - { - "content": { - "sourceType": "str", # The type of - the content's source. In case the source type is 'inline', - the content is given as a string (for instance, text). In - case the source type is 'reference', the content is given as - a URI. Required. Known values are: "inline" and "reference". - "value": "str" # The content of the - document, given either inline (as a string) or as a reference - (URI). Required. - }, - "id": "str", # A given identifier for the - document. Has to be unique across all documents for a single - patient. Required. - "type": "str", # The type of the patient - document, such as 'note' (text document) or 'fhirBundle' (FHIR - JSON document). Required. Known values are: "note", "fhirBundle", - "dicom", and "genomicSequencing". - "administrativeMetadata": { - "encounterId": "str", # Optional. - Reference to the encounter associated with the document. - "orderedProcedures": [ - { - "code": { - "coding": [ - { - "code": "str", # Optional. Symbol in - syntax defined by the system. - "display": "str", # Optional. - Representation defined by the system. - "extension": [ - { - "url": "str", # Source of the - definition for the extension code - - a logical name or a URL. - Required. - "valueBoolean": bool, # - Optional. Value as boolean. - "valueCodeableConcept": ..., - "valueDateTime": "str", # - Optional. Value as dateTime. - "valueInteger": 0, # Optional. - Value as integer. - "valuePeriod": { - "end": "str", # Optional. - End time with inclusive - boundary, if not ongoing. - "start": "str" # Optional. - Starting time with inclusive - boundary. - }, - "valueQuantity": { + "valueRange": { + "high": { "code": "str", # Optional. Coded form of the unit. "comparator": "str", # @@ -1748,8 +1575,4563 @@ def begin_infer_radiology_insights( Numerical value (with implicit precision). }, - "valueRange": { - "high": { + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "versionId": "str" # + Optional. The version specific identifier, as it + appears in the version portion of the URL. This value + changes when the resource is created, updated, or + deleted. + } + } + ], + "sex": "str" # Optional. The patient's sex. + Known values are: "female", "male", and "unspecified". + }, + "encounters": [ + { + "id": "str", # The id of the visit. + Required. + "class": "str", # Optional. The + class of the encounter. Known values are: "inpatient", + "ambulatory", "observation", "emergency", "virtual", and + "healthHome". + "period": { + "end": "2020-02-20 00:00:00", + # Optional. End time with inclusive boundary, if not + ongoing. + "start": "2020-02-20 + 00:00:00" # Optional. Starting time with inclusive + boundary. + } + } + ], + "patientDocuments": [ + { + "content": { + "sourceType": "str", # The + type of the content's source. In case the source type is + 'inline', the content is given as a string (for instance, + text). In case the source type is 'reference', the + content is given as a URI. Required. Known values are: + "inline" and "reference". + "value": "str" # The content + of the document, given either inline (as a string) or as + a reference (URI). Required. + }, + "id": "str", # A given identifier + for the document. Has to be unique across all documents for a + single patient. Required. + "type": "str", # The type of the + patient document, such as 'note' (text document) or + 'fhirBundle' (FHIR JSON document). Required. Known values + are: "note", "fhirBundle", "dicom", and "genomicSequencing". + "administrativeMetadata": { + "encounterId": "str", # + Optional. Reference to the encounter associated with the + document. + "orderedProcedures": [ + { + "code": { + "coding": [ + { + "code": "str", # Optional. Symbol in + syntax defined by the system. + "display": "str", # Optional. + Representation defined by the system. + "extension": [ + { + "url": "str", # Source of + the definition for the + extension code - a logical + name or a URL. Required. + "valueBoolean": bool, # + Optional. Value as boolean. + "valueCodeableConcept": ..., + "valueDateTime": "str", # + Optional. Value as dateTime. + "valueInteger": 0, # + Optional. Value as integer. + "valuePeriod": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # + Optional. Coded form of + the unit. + "comparator": "str", # + Optional. < | <= | >= | > + - how to understand the + value. + "system": "str", # + Optional. System that + defines coded unit form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "low": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "numerator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # + Optional. Text + alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End + time with + inclusive + boundary, if not + ongoing. + "start": "str" # + Optional. + Starting time + with inclusive + boundary. + }, + "system": "str", # + Optional. The + namespace for the + identifier value. + "type": ..., + "use": "str", # + Optional. usual | + official | temp | + secondary | old (If + known). + "value": "str" # + Optional. The value + that is unique. + }, + "reference": "str", # + Optional. Literal + reference, Relative, + internal or absolute URL. + "type": "str" # + Optional. Type the + reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # + Number of sample points + at each time point. + Required. + "origin": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "period": 0.0, # Number + of milliseconds between + samples. Required. + "data": "str", # + Optional. Decimal values + with spaces, or "E" | "U" + | "L". + "factor": 0.0, # + Optional. Multiply data + by this before adding to + origin. + "lowerLimit": 0.0, # + Optional. Lower limit of + detection. + "upperLimit": 0.0 # + Optional. Upper limit of + detection. + }, + "valueString": "str", # + Optional. Value as string. + "valueTime": "12:30:00" # + Optional. Value as time + (hh:mm:ss). + } + ], + "id": "str", # Optional. Unique id + for inter-element referencing. + "system": "str", # Optional. + Identity of the terminology system. + "version": "str" # Optional. Version + of the system - if relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "description": "str", # Optional. Procedure + description. + "extension": + [ + { + "url": "str", # Source of the definition + for the extension code - a logical name + or a URL. Required. + "valueBoolean": bool, # Optional. Value + as boolean. + "valueCodeableConcept": { + "coding": [ + { + "code": "str", # Optional. + Symbol in syntax defined by + the system. + "display": "str", # + Optional. Representation + defined by the system. + "extension": [ + ... + ], + "id": "str", # Optional. + Unique id for inter-element + referencing. + "system": "str", # Optional. + Identity of the terminology + system. + "version": "str" # Optional. + Version of the system - if + relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value as + integer. + "valuePeriod": { + "end": "str", # Optional. End time + with inclusive boundary, if not + ongoing. + "start": "str" # Optional. Starting + time with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. < | + <= | >= | > - how to understand the + value. + "system": "str", # Optional. System + that defines coded unit form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. Numerical + value (with implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "low": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "numerator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # Optional. Text + alternative for the resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # Optional. + End time with inclusive + boundary, if not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "system": "str", # Optional. The + namespace for the identifier + value. + "type": { + "coding": [ + { + "code": "str", # + Optional. Symbol in + syntax defined by the + system. + "display": "str", # + Optional. + Representation + defined by the + system. + "extension": [ + ... + ], + "id": "str", # + Optional. Unique id + for inter-element + referencing. + "system": "str", # + Optional. Identity of + the terminology + system. + "version": "str" # + Optional. Version of + the system - if + relevant. + } + ], + "text": "str" # Optional. + Plain text representation of + the concept. + }, + "use": "str", # Optional. usual + | official | temp | secondary | + old (If known). + "value": "str" # Optional. The + value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, internal + or absolute URL. + "type": "str" # Optional. Type the + reference refers to (e.g. "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of sample + points at each time point. Required. + "origin": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. Decimal + values with spaces, or "E" | "U" | + "L". + "factor": 0.0, # Optional. Multiply + data by this before adding to origin. + "lowerLimit": 0.0, # Optional. Lower + limit of detection. + "upperLimit": 0.0 # Optional. Upper + limit of detection. + }, + "valueString": "str", # Optional. Value + as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ] + } + ] + }, + "authors": [ + { + "fullName": "str", # + Optional. Text representation of the full name. + "id": "str" # + Optional. author id. + } + ], + "clinicalType": "str", # Optional. + The type of the clinical document. Known values are: + "consultation", "dischargeSummary", "historyAndPhysical", + "radiologyReport", "procedure", "progress", "laboratory", and + "pathologyReport". + "createdAt": "2020-02-20 00:00:00", + # Optional. The date and time when the document was created. + "language": "str", # Optional. A 2 + letter ISO 639-1 representation of the language of the + document. + "specialtyType": "str" # Optional. + specialty type the document. Known values are: "pathology" + and "radiology". + } + ] + } + ], + "configuration": { + "includeEvidence": bool, # Optional. An indication whether + the model's output should include evidence for the inferences. + "inferenceOptions": { + "findingOptions": { + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide the sentence that contains the + first token of the finding's clinical indicator (i.e. the medical + problem), if there is one. This sentence is provided as an + extension with url 'ci_sentence', next to the token evidence. + Default is false. + }, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + # Optional. Include/Exclude follow-up recommendations in + references to a guideline or article. Default is false. + "includeRecommendationsWithNoSpecifiedModality": bool, # + Optional. Include/Exclude follow-up recommendations without a + specific radiology procedure. Default is false. + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide one or more sentences as + evidence for the recommendation, next to the token evidence. The + start and end positions of these sentences will be put in an + extension with url 'modality_sentences'. Default is false. + } + }, + "inferenceTypes": [ + "str" # Optional. This is a list of inference types + to be inferred for the current request. It could be used if only part + of the Radiology Insights inferences are required. If this list is + omitted or empty, the model will return all the inference types. + ], + "locale": "str", # Optional. Local for the model to use. If + not specified, the model will use the default locale. + "verbose": bool # Optional. An indication whether the model + should produce verbose output. + } + }, + "result": { + "modelVersion": "str", # The version of the model used for + inference, expressed as the model date. Required. + "patientResults": [ + { + "inferences": [ + radiology_insights_inference + ], + "patientId": "str" # Identifier given for the + patient in the request. Required. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. The date and time when the + processing job was last updated. + } + """ + + @overload + def begin_infer_radiology_insights( + self, + id: str, + resource: JSON, + *, + expand: Optional[List[str]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RadiologyInsightsJob]: + # pylint: disable=line-too-long + """Create Radiology Insights job. + + Creates a Radiology Insights job with the given request body. + + :param id: The unique ID of the job. Required. + :type id: str + :param resource: The resource instance. Required. + :type resource: JSON + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RadiologyInsightsJob. The RadiologyInsightsJob + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 201, 200 + response == { + "id": "str", # The unique ID of the job. Required. + "status": "str", # The status of the job. Required. Known values are: + "notStarted", "running", "succeeded", "failed", and "canceled". + "createdAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job was created. + "error": { + "code": "str", # One of a server-defined set of error codes. + Required. + "message": "str", # A human-readable representation of the error. + Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a server-defined set of + error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "expiresAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job is set to expire. + "jobData": { + "patients": [ + { + "id": "str", # A given identifier for the patient. + Has to be unique across all patients in a single request. Required. + "details": { + "birthDate": "2020-02-20", # Optional. The + patient's date of birth. + "clinicalInfo": [ + { + "resourceType": "str", # The + type of resource. Required. + "id": "str", # Optional. + Resource Id. + "implicitRules": "str", # + Optional. A set of rules under which this content was + created. + "language": "str", # + Optional. Language of the resource content. + "meta": { + "lastUpdated": "str", + # Optional. When the resource last changed - e.g. + when the version changed. + "profile": [ + "str" # + Optional. A list of profiles (references to + `StructureDefinition + `_ + resources) that this resource claims to conform + to. The URL is a reference to + `StructureDefinition.url + `_. + ], + "security": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "source": "str", # + Optional. A uri that identifies the source system of + the resource. This provides a minimal amount of + Provenance information that can be used to track or + differentiate the source of information in the + resource. The source may identify another FHIR + server, document, message, database, etc. + "tag": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "versionId": "str" # + Optional. The version specific identifier, as it + appears in the version portion of the URL. This value + changes when the resource is created, updated, or + deleted. + } + } + ], + "sex": "str" # Optional. The patient's sex. + Known values are: "female", "male", and "unspecified". + }, + "encounters": [ + { + "id": "str", # The id of the visit. + Required. + "class": "str", # Optional. The + class of the encounter. Known values are: "inpatient", + "ambulatory", "observation", "emergency", "virtual", and + "healthHome". + "period": { + "end": "2020-02-20 00:00:00", + # Optional. End time with inclusive boundary, if not + ongoing. + "start": "2020-02-20 + 00:00:00" # Optional. Starting time with inclusive + boundary. + } + } + ], + "patientDocuments": [ + { + "content": { + "sourceType": "str", # The + type of the content's source. In case the source type is + 'inline', the content is given as a string (for instance, + text). In case the source type is 'reference', the + content is given as a URI. Required. Known values are: + "inline" and "reference". + "value": "str" # The content + of the document, given either inline (as a string) or as + a reference (URI). Required. + }, + "id": "str", # A given identifier + for the document. Has to be unique across all documents for a + single patient. Required. + "type": "str", # The type of the + patient document, such as 'note' (text document) or + 'fhirBundle' (FHIR JSON document). Required. Known values + are: "note", "fhirBundle", "dicom", and "genomicSequencing". + "administrativeMetadata": { + "encounterId": "str", # + Optional. Reference to the encounter associated with the + document. + "orderedProcedures": [ + { + "code": { + "coding": [ + { + "code": "str", # Optional. Symbol in + syntax defined by the system. + "display": "str", # Optional. + Representation defined by the system. + "extension": [ + { + "url": "str", # Source of + the definition for the + extension code - a logical + name or a URL. Required. + "valueBoolean": bool, # + Optional. Value as boolean. + "valueCodeableConcept": ..., + "valueDateTime": "str", # + Optional. Value as dateTime. + "valueInteger": 0, # + Optional. Value as integer. + "valuePeriod": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # + Optional. Coded form of + the unit. + "comparator": "str", # + Optional. < | <= | >= | > + - how to understand the + value. + "system": "str", # + Optional. System that + defines coded unit form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "low": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "numerator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # + Optional. Text + alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End + time with + inclusive + boundary, if not + ongoing. + "start": "str" # + Optional. + Starting time + with inclusive + boundary. + }, + "system": "str", # + Optional. The + namespace for the + identifier value. + "type": ..., + "use": "str", # + Optional. usual | + official | temp | + secondary | old (If + known). + "value": "str" # + Optional. The value + that is unique. + }, + "reference": "str", # + Optional. Literal + reference, Relative, + internal or absolute URL. + "type": "str" # + Optional. Type the + reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # + Number of sample points + at each time point. + Required. + "origin": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "period": 0.0, # Number + of milliseconds between + samples. Required. + "data": "str", # + Optional. Decimal values + with spaces, or "E" | "U" + | "L". + "factor": 0.0, # + Optional. Multiply data + by this before adding to + origin. + "lowerLimit": 0.0, # + Optional. Lower limit of + detection. + "upperLimit": 0.0 # + Optional. Upper limit of + detection. + }, + "valueString": "str", # + Optional. Value as string. + "valueTime": "12:30:00" # + Optional. Value as time + (hh:mm:ss). + } + ], + "id": "str", # Optional. Unique id + for inter-element referencing. + "system": "str", # Optional. + Identity of the terminology system. + "version": "str" # Optional. Version + of the system - if relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "description": "str", # Optional. Procedure + description. + "extension": + [ + { + "url": "str", # Source of the definition + for the extension code - a logical name + or a URL. Required. + "valueBoolean": bool, # Optional. Value + as boolean. + "valueCodeableConcept": { + "coding": [ + { + "code": "str", # Optional. + Symbol in syntax defined by + the system. + "display": "str", # + Optional. Representation + defined by the system. + "extension": [ + ... + ], + "id": "str", # Optional. + Unique id for inter-element + referencing. + "system": "str", # Optional. + Identity of the terminology + system. + "version": "str" # Optional. + Version of the system - if + relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value as + integer. + "valuePeriod": { + "end": "str", # Optional. End time + with inclusive boundary, if not + ongoing. + "start": "str" # Optional. Starting + time with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. < | + <= | >= | > - how to understand the + value. + "system": "str", # Optional. System + that defines coded unit form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. Numerical + value (with implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "low": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "numerator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # Optional. Text + alternative for the resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # Optional. + End time with inclusive + boundary, if not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "system": "str", # Optional. The + namespace for the identifier + value. + "type": { + "coding": [ + { + "code": "str", # + Optional. Symbol in + syntax defined by the + system. + "display": "str", # + Optional. + Representation + defined by the + system. + "extension": [ + ... + ], + "id": "str", # + Optional. Unique id + for inter-element + referencing. + "system": "str", # + Optional. Identity of + the terminology + system. + "version": "str" # + Optional. Version of + the system - if + relevant. + } + ], + "text": "str" # Optional. + Plain text representation of + the concept. + }, + "use": "str", # Optional. usual + | official | temp | secondary | + old (If known). + "value": "str" # Optional. The + value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, internal + or absolute URL. + "type": "str" # Optional. Type the + reference refers to (e.g. "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of sample + points at each time point. Required. + "origin": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. Decimal + values with spaces, or "E" | "U" | + "L". + "factor": 0.0, # Optional. Multiply + data by this before adding to origin. + "lowerLimit": 0.0, # Optional. Lower + limit of detection. + "upperLimit": 0.0 # Optional. Upper + limit of detection. + }, + "valueString": "str", # Optional. Value + as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ] + } + ] + }, + "authors": [ + { + "fullName": "str", # + Optional. Text representation of the full name. + "id": "str" # + Optional. author id. + } + ], + "clinicalType": "str", # Optional. + The type of the clinical document. Known values are: + "consultation", "dischargeSummary", "historyAndPhysical", + "radiologyReport", "procedure", "progress", "laboratory", and + "pathologyReport". + "createdAt": "2020-02-20 00:00:00", + # Optional. The date and time when the document was created. + "language": "str", # Optional. A 2 + letter ISO 639-1 representation of the language of the + document. + "specialtyType": "str" # Optional. + specialty type the document. Known values are: "pathology" + and "radiology". + } + ] + } + ], + "configuration": { + "includeEvidence": bool, # Optional. An indication whether + the model's output should include evidence for the inferences. + "inferenceOptions": { + "findingOptions": { + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide the sentence that contains the + first token of the finding's clinical indicator (i.e. the medical + problem), if there is one. This sentence is provided as an + extension with url 'ci_sentence', next to the token evidence. + Default is false. + }, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + # Optional. Include/Exclude follow-up recommendations in + references to a guideline or article. Default is false. + "includeRecommendationsWithNoSpecifiedModality": bool, # + Optional. Include/Exclude follow-up recommendations without a + specific radiology procedure. Default is false. + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide one or more sentences as + evidence for the recommendation, next to the token evidence. The + start and end positions of these sentences will be put in an + extension with url 'modality_sentences'. Default is false. + } + }, + "inferenceTypes": [ + "str" # Optional. This is a list of inference types + to be inferred for the current request. It could be used if only part + of the Radiology Insights inferences are required. If this list is + omitted or empty, the model will return all the inference types. + ], + "locale": "str", # Optional. Local for the model to use. If + not specified, the model will use the default locale. + "verbose": bool # Optional. An indication whether the model + should produce verbose output. + } + }, + "result": { + "modelVersion": "str", # The version of the model used for + inference, expressed as the model date. Required. + "patientResults": [ + { + "inferences": [ + radiology_insights_inference + ], + "patientId": "str" # Identifier given for the + patient in the request. Required. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. The date and time when the + processing job was last updated. + } + """ + + @overload + def begin_infer_radiology_insights( + self, + id: str, + resource: IO[bytes], + *, + expand: Optional[List[str]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RadiologyInsightsJob]: + # pylint: disable=line-too-long + """Create Radiology Insights job. + + Creates a Radiology Insights job with the given request body. + + :param id: The unique ID of the job. Required. + :type id: str + :param resource: The resource instance. Required. + :type resource: IO[bytes] + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RadiologyInsightsJob. The RadiologyInsightsJob + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 201, 200 + response == { + "id": "str", # The unique ID of the job. Required. + "status": "str", # The status of the job. Required. Known values are: + "notStarted", "running", "succeeded", "failed", and "canceled". + "createdAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job was created. + "error": { + "code": "str", # One of a server-defined set of error codes. + Required. + "message": "str", # A human-readable representation of the error. + Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a server-defined set of + error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "expiresAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job is set to expire. + "jobData": { + "patients": [ + { + "id": "str", # A given identifier for the patient. + Has to be unique across all patients in a single request. Required. + "details": { + "birthDate": "2020-02-20", # Optional. The + patient's date of birth. + "clinicalInfo": [ + { + "resourceType": "str", # The + type of resource. Required. + "id": "str", # Optional. + Resource Id. + "implicitRules": "str", # + Optional. A set of rules under which this content was + created. + "language": "str", # + Optional. Language of the resource content. + "meta": { + "lastUpdated": "str", + # Optional. When the resource last changed - e.g. + when the version changed. + "profile": [ + "str" # + Optional. A list of profiles (references to + `StructureDefinition + `_ + resources) that this resource claims to conform + to. The URL is a reference to + `StructureDefinition.url + `_. + ], + "security": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "source": "str", # + Optional. A uri that identifies the source system of + the resource. This provides a minimal amount of + Provenance information that can be used to track or + differentiate the source of information in the + resource. The source may identify another FHIR + server, document, message, database, etc. + "tag": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "versionId": "str" # + Optional. The version specific identifier, as it + appears in the version portion of the URL. This value + changes when the resource is created, updated, or + deleted. + } + } + ], + "sex": "str" # Optional. The patient's sex. + Known values are: "female", "male", and "unspecified". + }, + "encounters": [ + { + "id": "str", # The id of the visit. + Required. + "class": "str", # Optional. The + class of the encounter. Known values are: "inpatient", + "ambulatory", "observation", "emergency", "virtual", and + "healthHome". + "period": { + "end": "2020-02-20 00:00:00", + # Optional. End time with inclusive boundary, if not + ongoing. + "start": "2020-02-20 + 00:00:00" # Optional. Starting time with inclusive + boundary. + } + } + ], + "patientDocuments": [ + { + "content": { + "sourceType": "str", # The + type of the content's source. In case the source type is + 'inline', the content is given as a string (for instance, + text). In case the source type is 'reference', the + content is given as a URI. Required. Known values are: + "inline" and "reference". + "value": "str" # The content + of the document, given either inline (as a string) or as + a reference (URI). Required. + }, + "id": "str", # A given identifier + for the document. Has to be unique across all documents for a + single patient. Required. + "type": "str", # The type of the + patient document, such as 'note' (text document) or + 'fhirBundle' (FHIR JSON document). Required. Known values + are: "note", "fhirBundle", "dicom", and "genomicSequencing". + "administrativeMetadata": { + "encounterId": "str", # + Optional. Reference to the encounter associated with the + document. + "orderedProcedures": [ + { + "code": { + "coding": [ + { + "code": "str", # Optional. Symbol in + syntax defined by the system. + "display": "str", # Optional. + Representation defined by the system. + "extension": [ + { + "url": "str", # Source of + the definition for the + extension code - a logical + name or a URL. Required. + "valueBoolean": bool, # + Optional. Value as boolean. + "valueCodeableConcept": ..., + "valueDateTime": "str", # + Optional. Value as dateTime. + "valueInteger": 0, # + Optional. Value as integer. + "valuePeriod": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # + Optional. Coded form of + the unit. + "comparator": "str", # + Optional. < | <= | >= | > + - how to understand the + value. + "system": "str", # + Optional. System that + defines coded unit form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "low": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "numerator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # + Optional. Text + alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End + time with + inclusive + boundary, if not + ongoing. + "start": "str" # + Optional. + Starting time + with inclusive + boundary. + }, + "system": "str", # + Optional. The + namespace for the + identifier value. + "type": ..., + "use": "str", # + Optional. usual | + official | temp | + secondary | old (If + known). + "value": "str" # + Optional. The value + that is unique. + }, + "reference": "str", # + Optional. Literal + reference, Relative, + internal or absolute URL. + "type": "str" # + Optional. Type the + reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # + Number of sample points + at each time point. + Required. + "origin": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "period": 0.0, # Number + of milliseconds between + samples. Required. + "data": "str", # + Optional. Decimal values + with spaces, or "E" | "U" + | "L". + "factor": 0.0, # + Optional. Multiply data + by this before adding to + origin. + "lowerLimit": 0.0, # + Optional. Lower limit of + detection. + "upperLimit": 0.0 # + Optional. Upper limit of + detection. + }, + "valueString": "str", # + Optional. Value as string. + "valueTime": "12:30:00" # + Optional. Value as time + (hh:mm:ss). + } + ], + "id": "str", # Optional. Unique id + for inter-element referencing. + "system": "str", # Optional. + Identity of the terminology system. + "version": "str" # Optional. Version + of the system - if relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "description": "str", # Optional. Procedure + description. + "extension": + [ + { + "url": "str", # Source of the definition + for the extension code - a logical name + or a URL. Required. + "valueBoolean": bool, # Optional. Value + as boolean. + "valueCodeableConcept": { + "coding": [ + { + "code": "str", # Optional. + Symbol in syntax defined by + the system. + "display": "str", # + Optional. Representation + defined by the system. + "extension": [ + ... + ], + "id": "str", # Optional. + Unique id for inter-element + referencing. + "system": "str", # Optional. + Identity of the terminology + system. + "version": "str" # Optional. + Version of the system - if + relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value as + integer. + "valuePeriod": { + "end": "str", # Optional. End time + with inclusive boundary, if not + ongoing. + "start": "str" # Optional. Starting + time with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. < | + <= | >= | > - how to understand the + value. + "system": "str", # Optional. System + that defines coded unit form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. Numerical + value (with implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "low": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "numerator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # Optional. Text + alternative for the resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # Optional. + End time with inclusive + boundary, if not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "system": "str", # Optional. The + namespace for the identifier + value. + "type": { + "coding": [ + { + "code": "str", # + Optional. Symbol in + syntax defined by the + system. + "display": "str", # + Optional. + Representation + defined by the + system. + "extension": [ + ... + ], + "id": "str", # + Optional. Unique id + for inter-element + referencing. + "system": "str", # + Optional. Identity of + the terminology + system. + "version": "str" # + Optional. Version of + the system - if + relevant. + } + ], + "text": "str" # Optional. + Plain text representation of + the concept. + }, + "use": "str", # Optional. usual + | official | temp | secondary | + old (If known). + "value": "str" # Optional. The + value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, internal + or absolute URL. + "type": "str" # Optional. Type the + reference refers to (e.g. "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of sample + points at each time point. Required. + "origin": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. Decimal + values with spaces, or "E" | "U" | + "L". + "factor": 0.0, # Optional. Multiply + data by this before adding to origin. + "lowerLimit": 0.0, # Optional. Lower + limit of detection. + "upperLimit": 0.0 # Optional. Upper + limit of detection. + }, + "valueString": "str", # Optional. Value + as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ] + } + ] + }, + "authors": [ + { + "fullName": "str", # + Optional. Text representation of the full name. + "id": "str" # + Optional. author id. + } + ], + "clinicalType": "str", # Optional. + The type of the clinical document. Known values are: + "consultation", "dischargeSummary", "historyAndPhysical", + "radiologyReport", "procedure", "progress", "laboratory", and + "pathologyReport". + "createdAt": "2020-02-20 00:00:00", + # Optional. The date and time when the document was created. + "language": "str", # Optional. A 2 + letter ISO 639-1 representation of the language of the + document. + "specialtyType": "str" # Optional. + specialty type the document. Known values are: "pathology" + and "radiology". + } + ] + } + ], + "configuration": { + "includeEvidence": bool, # Optional. An indication whether + the model's output should include evidence for the inferences. + "inferenceOptions": { + "findingOptions": { + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide the sentence that contains the + first token of the finding's clinical indicator (i.e. the medical + problem), if there is one. This sentence is provided as an + extension with url 'ci_sentence', next to the token evidence. + Default is false. + }, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + # Optional. Include/Exclude follow-up recommendations in + references to a guideline or article. Default is false. + "includeRecommendationsWithNoSpecifiedModality": bool, # + Optional. Include/Exclude follow-up recommendations without a + specific radiology procedure. Default is false. + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide one or more sentences as + evidence for the recommendation, next to the token evidence. The + start and end positions of these sentences will be put in an + extension with url 'modality_sentences'. Default is false. + } + }, + "inferenceTypes": [ + "str" # Optional. This is a list of inference types + to be inferred for the current request. It could be used if only part + of the Radiology Insights inferences are required. If this list is + omitted or empty, the model will return all the inference types. + ], + "locale": "str", # Optional. Local for the model to use. If + not specified, the model will use the default locale. + "verbose": bool # Optional. An indication whether the model + should produce verbose output. + } + }, + "result": { + "modelVersion": "str", # The version of the model used for + inference, expressed as the model date. Required. + "patientResults": [ + { + "inferences": [ + radiology_insights_inference + ], + "patientId": "str" # Identifier given for the + patient in the request. Required. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. The date and time when the + processing job was last updated. + } + """ + + @distributed_trace + def begin_infer_radiology_insights( + self, + id: str, + resource: Union[_models.RadiologyInsightsJob, JSON, IO[bytes]], + *, + expand: Optional[List[str]] = None, + **kwargs: Any + ) -> LROPoller[_models.RadiologyInsightsJob]: + # pylint: disable=line-too-long + """Create Radiology Insights job. + + Creates a Radiology Insights job with the given request body. + + :param id: The unique ID of the job. Required. + :type id: str + :param resource: The resource instance. Is one of the following types: RadiologyInsightsJob, + JSON, IO[bytes] Required. + :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob or JSON or + IO[bytes] + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :return: An instance of LROPoller that returns RadiologyInsightsJob. The RadiologyInsightsJob + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # The unique ID of the job. Required. + "status": "str", # The status of the job. Required. Known values are: + "notStarted", "running", "succeeded", "failed", and "canceled". + "createdAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job was created. + "error": { + "code": "str", # One of a server-defined set of error codes. + Required. + "message": "str", # A human-readable representation of the error. + Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a server-defined set of + error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "expiresAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job is set to expire. + "jobData": { + "patients": [ + { + "id": "str", # A given identifier for the patient. + Has to be unique across all patients in a single request. Required. + "details": { + "birthDate": "2020-02-20", # Optional. The + patient's date of birth. + "clinicalInfo": [ + { + "resourceType": "str", # The + type of resource. Required. + "id": "str", # Optional. + Resource Id. + "implicitRules": "str", # + Optional. A set of rules under which this content was + created. + "language": "str", # + Optional. Language of the resource content. + "meta": { + "lastUpdated": "str", + # Optional. When the resource last changed - e.g. + when the version changed. + "profile": [ + "str" # + Optional. A list of profiles (references to + `StructureDefinition + `_ + resources) that this resource claims to conform + to. The URL is a reference to + `StructureDefinition.url + `_. + ], + "security": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "source": "str", # + Optional. A uri that identifies the source system of + the resource. This provides a minimal amount of + Provenance information that can be used to track or + differentiate the source of information in the + resource. The source may identify another FHIR + server, document, message, database, etc. + "tag": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "versionId": "str" # + Optional. The version specific identifier, as it + appears in the version portion of the URL. This value + changes when the resource is created, updated, or + deleted. + } + } + ], + "sex": "str" # Optional. The patient's sex. + Known values are: "female", "male", and "unspecified". + }, + "encounters": [ + { + "id": "str", # The id of the visit. + Required. + "class": "str", # Optional. The + class of the encounter. Known values are: "inpatient", + "ambulatory", "observation", "emergency", "virtual", and + "healthHome". + "period": { + "end": "2020-02-20 00:00:00", + # Optional. End time with inclusive boundary, if not + ongoing. + "start": "2020-02-20 + 00:00:00" # Optional. Starting time with inclusive + boundary. + } + } + ], + "patientDocuments": [ + { + "content": { + "sourceType": "str", # The + type of the content's source. In case the source type is + 'inline', the content is given as a string (for instance, + text). In case the source type is 'reference', the + content is given as a URI. Required. Known values are: + "inline" and "reference". + "value": "str" # The content + of the document, given either inline (as a string) or as + a reference (URI). Required. + }, + "id": "str", # A given identifier + for the document. Has to be unique across all documents for a + single patient. Required. + "type": "str", # The type of the + patient document, such as 'note' (text document) or + 'fhirBundle' (FHIR JSON document). Required. Known values + are: "note", "fhirBundle", "dicom", and "genomicSequencing". + "administrativeMetadata": { + "encounterId": "str", # + Optional. Reference to the encounter associated with the + document. + "orderedProcedures": [ + { + "code": { + "coding": [ + { + "code": "str", # Optional. Symbol in + syntax defined by the system. + "display": "str", # Optional. + Representation defined by the system. + "extension": [ + { + "url": "str", # Source of + the definition for the + extension code - a logical + name or a URL. Required. + "valueBoolean": bool, # + Optional. Value as boolean. + "valueCodeableConcept": ..., + "valueDateTime": "str", # + Optional. Value as dateTime. + "valueInteger": 0, # + Optional. Value as integer. + "valuePeriod": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # + Optional. Coded form of + the unit. + "comparator": "str", # + Optional. < | <= | >= | > + - how to understand the + value. + "system": "str", # + Optional. System that + defines coded unit form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "low": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "numerator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # + Optional. Text + alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End + time with + inclusive + boundary, if not + ongoing. + "start": "str" # + Optional. + Starting time + with inclusive + boundary. + }, + "system": "str", # + Optional. The + namespace for the + identifier value. + "type": ..., + "use": "str", # + Optional. usual | + official | temp | + secondary | old (If + known). + "value": "str" # + Optional. The value + that is unique. + }, + "reference": "str", # + Optional. Literal + reference, Relative, + internal or absolute URL. + "type": "str" # + Optional. Type the + reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # + Number of sample points + at each time point. + Required. + "origin": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "period": 0.0, # Number + of milliseconds between + samples. Required. + "data": "str", # + Optional. Decimal values + with spaces, or "E" | "U" + | "L". + "factor": 0.0, # + Optional. Multiply data + by this before adding to + origin. + "lowerLimit": 0.0, # + Optional. Lower limit of + detection. + "upperLimit": 0.0 # + Optional. Upper limit of + detection. + }, + "valueString": "str", # + Optional. Value as string. + "valueTime": "12:30:00" # + Optional. Value as time + (hh:mm:ss). + } + ], + "id": "str", # Optional. Unique id + for inter-element referencing. + "system": "str", # Optional. + Identity of the terminology system. + "version": "str" # Optional. Version + of the system - if relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "description": "str", # Optional. Procedure + description. + "extension": + [ + { + "url": "str", # Source of the definition + for the extension code - a logical name + or a URL. Required. + "valueBoolean": bool, # Optional. Value + as boolean. + "valueCodeableConcept": { + "coding": [ + { + "code": "str", # Optional. + Symbol in syntax defined by + the system. + "display": "str", # + Optional. Representation + defined by the system. + "extension": [ + ... + ], + "id": "str", # Optional. + Unique id for inter-element + referencing. + "system": "str", # Optional. + Identity of the terminology + system. + "version": "str" # Optional. + Version of the system - if + relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value as + integer. + "valuePeriod": { + "end": "str", # Optional. End time + with inclusive boundary, if not + ongoing. + "start": "str" # Optional. Starting + time with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. < | + <= | >= | > - how to understand the + value. + "system": "str", # Optional. System + that defines coded unit form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. Numerical + value (with implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "low": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "numerator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # Optional. Text + alternative for the resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # Optional. + End time with inclusive + boundary, if not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "system": "str", # Optional. The + namespace for the identifier + value. + "type": { + "coding": [ + { + "code": "str", # + Optional. Symbol in + syntax defined by the + system. + "display": "str", # + Optional. + Representation + defined by the + system. + "extension": [ + ... + ], + "id": "str", # + Optional. Unique id + for inter-element + referencing. + "system": "str", # + Optional. Identity of + the terminology + system. + "version": "str" # + Optional. Version of + the system - if + relevant. + } + ], + "text": "str" # Optional. + Plain text representation of + the concept. + }, + "use": "str", # Optional. usual + | official | temp | secondary | + old (If known). + "value": "str" # Optional. The + value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, internal + or absolute URL. + "type": "str" # Optional. Type the + reference refers to (e.g. "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of sample + points at each time point. Required. + "origin": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. Decimal + values with spaces, or "E" | "U" | + "L". + "factor": 0.0, # Optional. Multiply + data by this before adding to origin. + "lowerLimit": 0.0, # Optional. Lower + limit of detection. + "upperLimit": 0.0 # Optional. Upper + limit of detection. + }, + "valueString": "str", # Optional. Value + as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ] + } + ] + }, + "authors": [ + { + "fullName": "str", # + Optional. Text representation of the full name. + "id": "str" # + Optional. author id. + } + ], + "clinicalType": "str", # Optional. + The type of the clinical document. Known values are: + "consultation", "dischargeSummary", "historyAndPhysical", + "radiologyReport", "procedure", "progress", "laboratory", and + "pathologyReport". + "createdAt": "2020-02-20 00:00:00", + # Optional. The date and time when the document was created. + "language": "str", # Optional. A 2 + letter ISO 639-1 representation of the language of the + document. + "specialtyType": "str" # Optional. + specialty type the document. Known values are: "pathology" + and "radiology". + } + ] + } + ], + "configuration": { + "includeEvidence": bool, # Optional. An indication whether + the model's output should include evidence for the inferences. + "inferenceOptions": { + "findingOptions": { + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide the sentence that contains the + first token of the finding's clinical indicator (i.e. the medical + problem), if there is one. This sentence is provided as an + extension with url 'ci_sentence', next to the token evidence. + Default is false. + }, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + # Optional. Include/Exclude follow-up recommendations in + references to a guideline or article. Default is false. + "includeRecommendationsWithNoSpecifiedModality": bool, # + Optional. Include/Exclude follow-up recommendations without a + specific radiology procedure. Default is false. + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide one or more sentences as + evidence for the recommendation, next to the token evidence. The + start and end positions of these sentences will be put in an + extension with url 'modality_sentences'. Default is false. + } + }, + "inferenceTypes": [ + "str" # Optional. This is a list of inference types + to be inferred for the current request. It could be used if only part + of the Radiology Insights inferences are required. If this list is + omitted or empty, the model will return all the inference types. + ], + "locale": "str", # Optional. Local for the model to use. If + not specified, the model will use the default locale. + "verbose": bool # Optional. An indication whether the model + should produce verbose output. + } + }, + "result": { + "modelVersion": "str", # The version of the model used for + inference, expressed as the model date. Required. + "patientResults": [ + { + "inferences": [ + radiology_insights_inference + ], + "patientId": "str" # Identifier given for the + patient in the request. Required. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. The date and time when the + processing job was last updated. + } + + # response body for status code(s): 201, 200 + response == { + "id": "str", # The unique ID of the job. Required. + "status": "str", # The status of the job. Required. Known values are: + "notStarted", "running", "succeeded", "failed", and "canceled". + "createdAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job was created. + "error": { + "code": "str", # One of a server-defined set of error codes. + Required. + "message": "str", # A human-readable representation of the error. + Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a server-defined set of + error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "expiresAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job is set to expire. + "jobData": { + "patients": [ + { + "id": "str", # A given identifier for the patient. + Has to be unique across all patients in a single request. Required. + "details": { + "birthDate": "2020-02-20", # Optional. The + patient's date of birth. + "clinicalInfo": [ + { + "resourceType": "str", # The + type of resource. Required. + "id": "str", # Optional. + Resource Id. + "implicitRules": "str", # + Optional. A set of rules under which this content was + created. + "language": "str", # + Optional. Language of the resource content. + "meta": { + "lastUpdated": "str", + # Optional. When the resource last changed - e.g. + when the version changed. + "profile": [ + "str" # + Optional. A list of profiles (references to + `StructureDefinition + `_ + resources) that this resource claims to conform + to. The URL is a reference to + `StructureDefinition.url + `_. + ], + "security": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "source": "str", # + Optional. A uri that identifies the source system of + the resource. This provides a minimal amount of + Provenance information that can be used to track or + differentiate the source of information in the + resource. The source may identify another FHIR + server, document, message, database, etc. + "tag": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "versionId": "str" # + Optional. The version specific identifier, as it + appears in the version portion of the URL. This value + changes when the resource is created, updated, or + deleted. + } + } + ], + "sex": "str" # Optional. The patient's sex. + Known values are: "female", "male", and "unspecified". + }, + "encounters": [ + { + "id": "str", # The id of the visit. + Required. + "class": "str", # Optional. The + class of the encounter. Known values are: "inpatient", + "ambulatory", "observation", "emergency", "virtual", and + "healthHome". + "period": { + "end": "2020-02-20 00:00:00", + # Optional. End time with inclusive boundary, if not + ongoing. + "start": "2020-02-20 + 00:00:00" # Optional. Starting time with inclusive + boundary. + } + } + ], + "patientDocuments": [ + { + "content": { + "sourceType": "str", # The + type of the content's source. In case the source type is + 'inline', the content is given as a string (for instance, + text). In case the source type is 'reference', the + content is given as a URI. Required. Known values are: + "inline" and "reference". + "value": "str" # The content + of the document, given either inline (as a string) or as + a reference (URI). Required. + }, + "id": "str", # A given identifier + for the document. Has to be unique across all documents for a + single patient. Required. + "type": "str", # The type of the + patient document, such as 'note' (text document) or + 'fhirBundle' (FHIR JSON document). Required. Known values + are: "note", "fhirBundle", "dicom", and "genomicSequencing". + "administrativeMetadata": { + "encounterId": "str", # + Optional. Reference to the encounter associated with the + document. + "orderedProcedures": [ + { + "code": { + "coding": [ + { + "code": "str", # Optional. Symbol in + syntax defined by the system. + "display": "str", # Optional. + Representation defined by the system. + "extension": [ + { + "url": "str", # Source of + the definition for the + extension code - a logical + name or a URL. Required. + "valueBoolean": bool, # + Optional. Value as boolean. + "valueCodeableConcept": ..., + "valueDateTime": "str", # + Optional. Value as dateTime. + "valueInteger": 0, # + Optional. Value as integer. + "valuePeriod": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "valueQuantity": { "code": "str", # Optional. Coded form of the unit. @@ -1767,216 +6149,242 @@ def begin_infer_radiology_insights( Numerical value (with implicit precision). }, + "valueRange": { + "high": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, "low": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). } }, "valueRatio": { "denominator": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). }, "numerator": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). } }, "valueReference": { "display": "str", # - Optional. Text alternative - for the resource. + Optional. Text + alternative for the + resource. "identifier": { "assigner": ..., "period": { "end": "str", # - Optional. End time - with inclusive - boundary, if not - ongoing. + Optional. End + time with + inclusive + boundary, if not + ongoing. "start": "str" # - Optional. Starting - time with inclusive - boundary. + Optional. + Starting time + with inclusive + boundary. }, "system": "str", # - Optional. The namespace - for the identifier value. + Optional. The + namespace for the + identifier value. "type": ..., "use": "str", # - Optional. usual | - official | temp | - secondary | old (If - known). + Optional. usual | + official | temp | + secondary | old (If + known). "value": "str" # - Optional. The value that - is unique. + Optional. The value + that is unique. }, "reference": "str", # - Optional. Literal reference, - Relative, internal or - absolute URL. - "type": "str" # Optional. - Type the reference refers to - (e.g. "Patient"). + Optional. Literal + reference, Relative, + internal or absolute URL. + "type": "str" # + Optional. Type the + reference refers to (e.g. + "Patient"). }, "valueSampledData": { - "dimensions": 0, # Number of - sample points at each time - point. Required. + "dimensions": 0, # + Number of sample points + at each time point. + Required. "origin": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). }, - "period": 0.0, # Number of - milliseconds between samples. - Required. - "data": "str", # Optional. - Decimal values with spaces, - or "E" | "U" | "L". - "factor": 0.0, # Optional. - Multiply data by this before - adding to origin. + "period": 0.0, # Number + of milliseconds between + samples. Required. + "data": "str", # + Optional. Decimal values + with spaces, or "E" | "U" + | "L". + "factor": 0.0, # + Optional. Multiply data + by this before adding to + origin. "lowerLimit": 0.0, # - Optional. Lower limit of - detection. + Optional. Lower limit of + detection. "upperLimit": 0.0 # - Optional. Upper limit of - detection. + Optional. Upper limit of + detection. }, "valueString": "str", # - Optional. Value as string. + Optional. Value as string. "valueTime": "12:30:00" # - Optional. Value as time - (hh:mm:ss). + Optional. Value as time + (hh:mm:ss). } ], - "id": "str", # Optional. Unique id for - inter-element referencing. - "system": "str", # Optional. Identity of - the terminology system. - "version": "str" # Optional. Version of - the system - if relevant. - } - ], - "text": "str" - # Optional. Plain text representation of the - concept. - }, - "description": "str", - # Optional. Procedure description. - "extension": [ - { - "url": "str", # Source of the definition for - the extension code - a logical name or a URL. - Required. - "valueBoolean": bool, # Optional. Value as - boolean. + "id": "str", # Optional. Unique id + for inter-element referencing. + "system": "str", # Optional. + Identity of the terminology system. + "version": "str" # Optional. Version + of the system - if relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "description": "str", # Optional. Procedure + description. + "extension": + [ + { + "url": "str", # Source of the definition + for the extension code - a logical name + or a URL. Required. + "valueBoolean": bool, # Optional. Value + as boolean. "valueCodeableConcept": { "coding": [ { "code": "str", # Optional. - Symbol in syntax defined by the - system. - "display": "str", # Optional. - Representation defined by the - system. + Symbol in syntax defined by + the system. + "display": "str", # + Optional. Representation + defined by the system. "extension": [ ... ], - "id": "str", # Optional. Unique - id for inter-element referencing. + "id": "str", # Optional. + Unique id for inter-element + referencing. "system": "str", # Optional. - Identity of the terminology - system. + Identity of the terminology + system. "version": "str" # Optional. - Version of the system - if - relevant. + Version of the system - if + relevant. } ], "text": "str" # Optional. Plain text - representation of the concept. - }, - "valueDateTime": "str", # Optional. Value as - dateTime. + representation of the concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. "valueInteger": 0, # Optional. Value as - integer. + integer. "valuePeriod": { - "end": "str", # Optional. End time with - inclusive boundary, if not ongoing. - "start": "str" # Optional. Starting time - with inclusive boundary. - }, + "end": "str", # Optional. End time + with inclusive boundary, if not + ongoing. + "start": "str" # Optional. Starting + time with inclusive boundary. + }, "valueQuantity": { - "code": "str", # Optional. Coded form of - the unit. - "comparator": "str", # Optional. < | <= - | >= | > - how to understand the value. - "system": "str", # Optional. System that - defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical value - (with implicit precision). - }, - "valueRange": { - "high": { "code": "str", # Optional. Coded form of the unit. "comparator": "str", # Optional. < | @@ -1989,239 +6397,279 @@ def begin_infer_radiology_insights( "value": 0.0 # Optional. Numerical value (with implicit precision). }, + "valueRange": { + "high": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, "low": { "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). } - }, + }, "valueRatio": { "denominator": { "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). }, "numerator": { "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). } - }, + }, "valueReference": { "display": "str", # Optional. Text - alternative for the resource. + alternative for the resource. "identifier": { "assigner": ..., "period": { - "end": "str", # Optional. End - time with inclusive boundary, if - not ongoing. + "end": "str", # Optional. + End time with inclusive + boundary, if not ongoing. "start": "str" # Optional. - Starting time with inclusive - boundary. + Starting time with inclusive + boundary. }, "system": "str", # Optional. The - namespace for the identifier value. + namespace for the identifier + value. "type": { "coding": [ { "code": "str", # - Optional. Symbol in - syntax defined by the - system. + Optional. Symbol in + syntax defined by the + system. "display": "str", # - Optional. Representation - defined by the system. + Optional. + Representation + defined by the + system. "extension": [ ... ], - "id": "str", # Optional. - Unique id for - inter-element - referencing. + "id": "str", # + Optional. Unique id + for inter-element + referencing. "system": "str", # - Optional. Identity of the - terminology system. + Optional. Identity of + the terminology + system. "version": "str" # - Optional. Version of the - system - if relevant. + Optional. Version of + the system - if + relevant. } ], - "text": "str" # Optional. Plain - text representation of the - concept. + "text": "str" # Optional. + Plain text representation of + the concept. }, - "use": "str", # Optional. usual | - official | temp | secondary | old (If - known). - "value": "str" # Optional. The value - that is unique. + "use": "str", # Optional. usual + | official | temp | secondary | + old (If known). + "value": "str" # Optional. The + value that is unique. }, - "reference": "str", # Optional. Literal - reference, Relative, internal or absolute - URL. + "reference": "str", # Optional. + Literal reference, Relative, internal + or absolute URL. "type": "str" # Optional. Type the - reference refers to (e.g. "Patient"). - }, + reference refers to (e.g. "Patient"). + }, "valueSampledData": { "dimensions": 0, # Number of sample - points at each time point. Required. + points at each time point. Required. "origin": { "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). }, - "period": 0.0, # Number of milliseconds - between samples. Required. + "period": 0.0, # Number of + milliseconds between samples. + Required. "data": "str", # Optional. Decimal - values with spaces, or "E" | "U" | "L". - "factor": 0.0, # Optional. Multiply data - by this before adding to origin. + values with spaces, or "E" | "U" | + "L". + "factor": 0.0, # Optional. Multiply + data by this before adding to origin. "lowerLimit": 0.0, # Optional. Lower - limit of detection. + limit of detection. "upperLimit": 0.0 # Optional. Upper - limit of detection. - }, - "valueString": "str", # Optional. Value as - string. - "valueTime": "12:30:00" # Optional. Value as - time (hh:mm:ss). - } - ] + limit of detection. + }, + "valueString": "str", # Optional. Value + as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ] + } + ] + }, + "authors": [ + { + "fullName": "str", # + Optional. Text representation of the full name. + "id": "str" # + Optional. author id. } - ] - }, - "authors": [ - { - "fullName": "str", # - Optional. Text representation of the full name. - "id": "str" # Optional. - author id. - } - ], - "clinicalType": "str", # Optional. The type - of the clinical document. Known values are: "consultation", - "dischargeSummary", "historyAndPhysical", "radiologyReport", - "procedure", "progress", "laboratory", and "pathologyReport". - "createdDateTime": "2020-02-20 00:00:00", # - Optional. The date and time when the document was created. - "language": "str", # Optional. A 2 letter - ISO 639-1 representation of the language of the document. - "specialtyType": "str" # Optional. specialty - type the document. Known values are: "pathology" and "radiology". - } - ] - } - ], - "configuration": { - "includeEvidence": bool, # Optional. An indication whether the - model's output should include evidence for the inferences. - "inferenceOptions": { - "findingOptions": { - "provideFocusedSentenceEvidence": bool # Optional. - If this is true, provide the sentence that contains the first token - of the finding's clinical indicator (i.e. the medical problem), if - there is one. This sentence is provided as an extension with url - 'ci_sentence', next to the token evidence. Default is false. - }, - "followupRecommendationOptions": { - "includeRecommendationsInReferences": bool, # - Optional. Include/Exclude follow-up recommendations in references to - a guideline or article. Default is false. - "includeRecommendationsWithNoSpecifiedModality": - bool, # Optional. Include/Exclude follow-up recommendations without - a specific radiology procedure. Default is false. - "provideFocusedSentenceEvidence": bool # Optional. - If this is true, provide one or more sentences as evidence for the - recommendation, next to the token evidence. The start and end - positions of these sentences will be put in an extension with url - 'modality_sentences'. Default is false. + ], + "clinicalType": "str", # Optional. + The type of the clinical document. Known values are: + "consultation", "dischargeSummary", "historyAndPhysical", + "radiologyReport", "procedure", "progress", "laboratory", and + "pathologyReport". + "createdAt": "2020-02-20 00:00:00", + # Optional. The date and time when the document was created. + "language": "str", # Optional. A 2 + letter ISO 639-1 representation of the language of the + document. + "specialtyType": "str" # Optional. + specialty type the document. Known values are: "pathology" + and "radiology". + } + ] } - }, - "inferenceTypes": [ - "str" # Optional. This is a list of inference types to be - inferred for the current request. It could be used if only part of the - Radiology Insights inferences are required. If this list is omitted or - empty, the model will return all the inference types. ], - "locale": "str", # Optional. Local for the model to use. If not - specified, the model will use the default locale. - "verbose": bool # Optional. An indication whether the model should - produce verbose output. - } - } - - # response body for status code(s): 202 - response == { - "modelVersion": "str", # The version of the model used for inference, - expressed as the model date. Required. - "patientResults": [ - { - "inferences": [ - radiology_insights_inference + "configuration": { + "includeEvidence": bool, # Optional. An indication whether + the model's output should include evidence for the inferences. + "inferenceOptions": { + "findingOptions": { + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide the sentence that contains the + first token of the finding's clinical indicator (i.e. the medical + problem), if there is one. This sentence is provided as an + extension with url 'ci_sentence', next to the token evidence. + Default is false. + }, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + # Optional. Include/Exclude follow-up recommendations in + references to a guideline or article. Default is false. + "includeRecommendationsWithNoSpecifiedModality": bool, # + Optional. Include/Exclude follow-up recommendations without a + specific radiology procedure. Default is false. + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide one or more sentences as + evidence for the recommendation, next to the token evidence. The + start and end positions of these sentences will be put in an + extension with url 'modality_sentences'. Default is false. + } + }, + "inferenceTypes": [ + "str" # Optional. This is a list of inference types + to be inferred for the current request. It could be used if only part + of the Radiology Insights inferences are required. If this list is + omitted or empty, the model will return all the inference types. ], - "patientId": "str" # Identifier given for the patient in the - request. Required. + "locale": "str", # Optional. Local for the model to use. If + not specified, the model will use the default locale. + "verbose": bool # Optional. An indication whether the model + should produce verbose output. } - ] + }, + "result": { + "modelVersion": "str", # The version of the model used for + inference, expressed as the model date. Required. + "patientResults": [ + { + "inferences": [ + radiology_insights_inference + ], + "patientId": "str" # Identifier given for the + patient in the request. Required. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. The date and time when the + processing job was last updated. } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RadiologyInsightsInferenceResult] = kwargs.pop("cls", None) + cls: ClsType[_models.RadiologyInsightsJob] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._infer_radiology_insights_initial( - body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + id=id, + resource=resource, + expand=expand, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) response_headers["Operation-Location"] = self._deserialize( "str", response.headers.get("Operation-Location") ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - response_headers["Repeatability-Result"] = self._deserialize( - "str", response.headers.get("Repeatability-Result") - ) deserialized = _deserialize(_models.RadiologyInsightsInferenceResult, response.json().get("result")) if cls: @@ -2241,12 +6689,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.RadiologyInsightsInferenceResult].from_continuation_token( + return LROPoller[_models.RadiologyInsightsJob].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.RadiologyInsightsInferenceResult]( + return LROPoller[_models.RadiologyInsightsJob]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/_patch.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/_patch.py index f7dd32510333d..fb837de55f98b 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/_patch.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_operations/_patch.py @@ -6,11 +6,203 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload, List, MutableMapping -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: List[str] = [ + "RadiologyInsightsClientOperationsMixin" +] # Add all objects you want publicly available to users at this package level +# pylint: disable=too-many-lines,too-many-statements +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from .. import models as _models +from .._model_base import _deserialize +from ._operations import RadiologyInsightsClientOperationsMixin as GeneratedRadiologyInsightsClientOperationsMixin + +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RadiologyInsightsClientOperationsMixin(GeneratedRadiologyInsightsClientOperationsMixin): + + @overload # type: ignore[override] + def begin_infer_radiology_insights( + self, + id: str, + resource: _models.RadiologyInsightsJob, + *, + expand: Optional[List[str]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: + # pylint: disable=line-too-long + """Create Radiology Insights inference result. + + Creates a Radiology Insights inference result with the given request body. + + :param id: The unique ID of the inference result. Required. + :type id: str + :param resource: The resource instance. Required. + :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsResult] + :raises ~azure.core.exceptions.HttpResponseError:""" + + @overload # type: ignore[override] + def begin_infer_radiology_insights( + self, + id: str, + resource: JSON, + *, + expand: Optional[List[str]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: + # pylint: disable=line-too-long + """Create Radiology Insights inference result. + + Creates a Radiology Insights inference result with the given request body. + + :param id: The unique ID of the inference result. Required. + :type id: str + :param resource: The resource instance. Required. + :type resource: JSON + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] + :raises ~azure.core.exceptions.HttpResponseError:""" + + @overload # type: ignore[override] + def begin_infer_radiology_insights( + self, + id: str, + resource: IO[bytes], + *, + expand: Optional[List[str]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: + # pylint: disable=line-too-long + """Create Radiology Insights inference result. + + Creates a Radiology Insights inference result with the given request body. + + :param id: The unique ID of the inference result. Required. + :type id: str + :param resource: The resource instance. Required. + :type resource: IO[bytes] + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] + :raises ~azure.core.exceptions.HttpResponseError:""" + + @distributed_trace # type: ignore[override] + def begin_infer_radiology_insights( + self, + id: str, + resource: Union[_models.RadiologyInsightsJob, JSON, IO[bytes]], + *, + expand: Optional[List[str]] = None, + **kwargs: Any + ) -> LROPoller[_models.RadiologyInsightsInferenceResult]: + # pylint: disable=line-too-long + """Create Radiology Insights inference result. + + Creates a Radiology Insights inference result with the given request body. + + :param id: The unique ID of the inference result. Required. + :type id: str + :param resource: The resource instance. Is one of the following types: RadiologyInsightsJob, JSON, IO[bytes] Required. + :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob or JSON or IO[bytes] + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] + :raises ~azure.core.exceptions.HttpResponseError:""" + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RadiologyInsightsJob] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._infer_radiology_insights_initial( + id=id, + resource=resource, + expand=expand, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + deserialized = _deserialize( + _models.RadiologyInsightsInferenceResult, + response.json().get("result") + ) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.RadiologyInsightsInferenceResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller[_models.RadiologyInsightsInferenceResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + def patch_sdk(): """Do not remove from this file. diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_serialization.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_serialization.py index 2f781d740827a..f0c6180722c89 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_serialization.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_serialization.py @@ -1441,7 +1441,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_version.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_version.py index bbcd28b4aa67e..0ec13ea52bbf5 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_version.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0" diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_client.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_client.py index 20e5e0ec1799c..a75ee8710359c 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_client.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, TYPE_CHECKING, Union from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -18,6 +18,10 @@ from ._configuration import RadiologyInsightsClientConfiguration from ._operations import RadiologyInsightsClientOperationsMixin +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class RadiologyInsightsClient( RadiologyInsightsClientOperationsMixin @@ -27,17 +31,20 @@ class RadiologyInsightsClient( :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com). Required. :type endpoint: str - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential - :keyword api_version: The API version to use for this operation. Default value is - "2023-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :param credential: Credential used to authenticate requests to the service. Is either a + AzureKeyCredential type or a TokenCredential type. Required. + :type credential: ~azure.core.credentials.AzureKeyCredential or + ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: + def __init__( + self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any + ) -> None: _endpoint = "{endpoint}/health-insights" self._config = RadiologyInsightsClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) _policies = kwargs.pop("policies", None) diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_configuration.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_configuration.py index 928142f56c335..b42d868a8896d 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_configuration.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_configuration.py @@ -6,13 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING, Union from azure.core.credentials import AzureKeyCredential from azure.core.pipeline import policies from .._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class RadiologyInsightsClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for RadiologyInsightsClient. @@ -23,16 +27,19 @@ class RadiologyInsightsClientConfiguration: # pylint: disable=too-many-instance :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com). Required. :type endpoint: str - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential - :keyword api_version: The API version to use for this operation. Default value is - "2023-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :param credential: Credential used to authenticate requests to the service. Is either a + AzureKeyCredential type or a TokenCredential type. Required. + :type credential: ~azure.core.credentials.AzureKeyCredential or + ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: The API version to use for this operation. Default value is "2024-04-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-09-01-preview") + def __init__( + self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2024-04-01") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -42,10 +49,18 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) self.endpoint = endpoint self.credential = credential self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "healthinsights-radiologyinsights/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) + def _infer_policy(self, **kwargs): + if isinstance(self.credential, AzureKeyCredential): + return policies.AzureKeyCredentialPolicy(self.credential, "Ocp-Apim-Subscription-Key", **kwargs) + if hasattr(self.credential, "get_token"): + return policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + raise TypeError(f"Unsupported credential: {self.credential}") + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) @@ -57,6 +72,4 @@ def _configure(self, **kwargs: Any) -> None: self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AzureKeyCredentialPolicy( - self.credential, "Ocp-Apim-Subscription-Key", **kwargs - ) + self.authentication_policy = self._infer_policy(**kwargs) diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/__init__.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/__init__.py index 24be3b0c64fce..548300f399583 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/__init__.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/__init__.py @@ -6,14 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import RadiologyInsightsClientOperationsMixin +from ._patch import RadiologyInsightsClientOperationsMixin + -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ "RadiologyInsightsClientOperationsMixin", ] -__all__.extend([p for p in _patch_all if p not in __all__]) + _patch_sdk() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/_operations.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/_operations.py index 530866e1f8a91..610519bd13d26 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/_operations.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements, line-too-long +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -41,10 +41,16 @@ class RadiologyInsightsClientOperationsMixin(RadiologyInsightsClientMixinABC): + async def _infer_radiology_insights_initial( - self, body: Union[_models.RadiologyInsightsData, JSON, IO[bytes]], **kwargs: Any + self, + id: str, + resource: Union[_models.RadiologyInsightsJob, JSON, IO[bytes]], + *, + expand: Optional[List[str]] = None, + **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -60,12 +66,14 @@ async def _infer_radiology_insights_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(resource, (IOBase, bytes)): + _content = resource else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_radiology_insights_infer_radiology_insights_request( + id=id, + expand=expand, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -84,20 +92,29 @@ async def _infer_radiology_insights_initial( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 201]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _deserialize(_models.HealthInsightsErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - response_headers["Repeatability-Result"] = self._deserialize( - "str", response.headers.get("Repeatability-Result") - ) + if response.status_code == 200: + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 201: + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) - deserialized = _deserialize(JSON, response.json()) + deserialized = _deserialize(JSON, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -106,122 +123,128 @@ async def _infer_radiology_insights_initial( @overload async def begin_infer_radiology_insights( - self, body: _models.RadiologyInsightsData, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RadiologyInsightsInferenceResult]: + self, + id: str, + resource: _models.RadiologyInsightsJob, + *, + expand: Optional[List[str]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RadiologyInsightsJob]: # pylint: disable=line-too-long """Create Radiology Insights job. Creates a Radiology Insights job with the given request body. - :param body: Required. - :type body: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsData + :param id: The unique ID of the job. Required. + :type id: str + :param resource: The resource instance. Required. + :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns RadiologyInsightsInferenceResult. The - RadiologyInsightsInferenceResult is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns RadiologyInsightsJob. The + RadiologyInsightsJob is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] + ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - body = { - "patients": [ - { - "id": "str", # A given identifier for the patient. Has to be - unique across all patients in a single request. Required. - "encounters": [ - { - "id": "str", # The id of the visit. - Required. - "class": "str", # Optional. The class of the - encounter. Known values are: "inpatient", "ambulatory", - "observation", "emergency", "virtual", and "healthHome". - "period": { - "end": "2020-02-20 00:00:00", # - Optional. End time with inclusive boundary, if not ongoing. - "start": "2020-02-20 00:00:00" # - Optional. Starting time with inclusive boundary. - } - } - ], - "info": { - "birthDate": "2020-02-20", # Optional. The patient's - date of birth. - "clinicalInfo": [ - { - "resourceType": "str", # The type of - resource. Required. - "id": "str", # Optional. Resource - Id. - "implicitRules": "str", # Optional. - A set of rules under which this content was created. - "language": "str", # Optional. - Language of the resource content. - "meta": { - "lastUpdated": "str", # - Optional. When the resource last changed - e.g. when the - version changed. - "profile": [ - "str" # Optional. A - list of profiles (references to `StructureDefinition - `_ - resources) that this resource claims to conform to. - The URL is a reference to `StructureDefinition.url - `_. - ], - "security": [ - { - "code": - "str", # Optional. Symbol in syntax defined by - the system. - "display": - "str", # Optional. Representation defined by the - system. - "extension": - [ - { - "url": "str", # Source of the definition - for the extension code - a logical name - or a URL. Required. - "valueBoolean": bool, # Optional. Value - as boolean. + resource = { + "id": "str", # The unique ID of the job. Required. + "status": "str", # The status of the job. Required. Known values are: + "notStarted", "running", "succeeded", "failed", and "canceled". + "createdAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job was created. + "error": { + "code": "str", # One of a server-defined set of error codes. + Required. + "message": "str", # A human-readable representation of the error. + Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a server-defined set of + error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "expiresAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job is set to expire. + "jobData": { + "patients": [ + { + "id": "str", # A given identifier for the patient. + Has to be unique across all patients in a single request. Required. + "details": { + "birthDate": "2020-02-20", # Optional. The + patient's date of birth. + "clinicalInfo": [ + { + "resourceType": "str", # The + type of resource. Required. + "id": "str", # Optional. + Resource Id. + "implicitRules": "str", # + Optional. A set of rules under which this content was + created. + "language": "str", # + Optional. Language of the resource content. + "meta": { + "lastUpdated": "str", + # Optional. When the resource last changed - e.g. + when the version changed. + "profile": [ + "str" # + Optional. A list of profiles (references to + `StructureDefinition + `_ + resources) that this resource claims to conform + to. The URL is a reference to + `StructureDefinition.url + `_. + ], + "security": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. "valueCodeableConcept": { "coding": [ ... ], - "text": "str" # Optional. Plain text - representation of the concept. + "text": "str" # Optional. Plain + text representation of the + concept. }, "valueDateTime": "str", # Optional. - Value as dateTime. - "valueInteger": 0, # Optional. Value as - integer. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. "valuePeriod": { - "end": "str", # Optional. End time - with inclusive boundary, if not - ongoing. - "start": "str" # Optional. Starting - time with inclusive boundary. + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. }, "valueQuantity": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - }, - "valueRange": { - "high": { "code": "str", # Optional. Coded form of the unit. "comparator": "str", # Optional. @@ -236,193 +259,199 @@ async def begin_infer_radiology_insights( Numerical value (with implicit precision). }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, "low": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). } }, "valueRatio": { "denominator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). }, "numerator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). } }, "valueReference": { - "display": "str", # Optional. Text - alternative for the resource. + "display": "str", # Optional. + Text alternative for the + resource. "identifier": { "assigner": ..., "period": { - "end": "str", # Optional. - End time with inclusive - boundary, if not ongoing. - "start": "str" # Optional. - Starting time with inclusive - boundary. + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. }, - "system": "str", # Optional. The - namespace for the identifier - value. + "system": "str", # Optional. + The namespace for the + identifier value. "type": { "coding": [ ... ], - "text": "str" # Optional. - Plain text representation of - the concept. + "text": "str" # + Optional. Plain text + representation of the + concept. }, - "use": "str", # Optional. usual - | official | temp | secondary | - old (If known). - "value": "str" # Optional. The - value that is unique. + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. }, "reference": "str", # Optional. - Literal reference, Relative, internal - or absolute URL. - "type": "str" # Optional. Type the - reference refers to (e.g. "Patient"). + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). }, "valueSampledData": { - "dimensions": 0, # Number of sample - points at each time point. Required. + "dimensions": 0, # Number of + sample points at each time point. + Required. "origin": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). }, "period": 0.0, # Number of - milliseconds between samples. - Required. - "data": "str", # Optional. Decimal - values with spaces, or "E" | "U" | - "L". - "factor": 0.0, # Optional. Multiply - data by this before adding to origin. - "lowerLimit": 0.0, # Optional. Lower - limit of detection. - "upperLimit": 0.0 # Optional. Upper - limit of detection. + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. }, - "valueString": "str", # Optional. Value - as string. + "valueString": "str", # Optional. + Value as string. "valueTime": "12:30:00" # Optional. - Value as time (hh:mm:ss). - } - ], - "id": "str", - # Optional. Unique id for inter-element - referencing. - "system": - "str", # Optional. Identity of the terminology - system. - "version": - "str" # Optional. Version of the system - if - relevant. - } - ], - "source": "str", # Optional. - A uri that identifies the source system of the resource. - This provides a minimal amount of Provenance information - that can be used to track or differentiate the source of - information in the resource. The source may identify - another FHIR server, document, message, database, etc. - "tag": [ - { - "code": - "str", # Optional. Symbol in syntax defined by - the system. - "display": - "str", # Optional. Representation defined by the - system. - "extension": - [ - { - "url": "str", # Source of the definition - for the extension code - a logical name - or a URL. Required. - "valueBoolean": bool, # Optional. Value - as boolean. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "source": "str", # + Optional. A uri that identifies the source system of + the resource. This provides a minimal amount of + Provenance information that can be used to track or + differentiate the source of information in the + resource. The source may identify another FHIR + server, document, message, database, etc. + "tag": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. "valueCodeableConcept": { "coding": [ ... ], - "text": "str" # Optional. Plain text - representation of the concept. + "text": "str" # Optional. Plain + text representation of the + concept. }, "valueDateTime": "str", # Optional. - Value as dateTime. - "valueInteger": 0, # Optional. Value as - integer. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. "valuePeriod": { - "end": "str", # Optional. End time - with inclusive boundary, if not - ongoing. - "start": "str" # Optional. Starting - time with inclusive boundary. + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. }, "valueQuantity": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - }, - "valueRange": { - "high": { "code": "str", # Optional. Coded form of the unit. "comparator": "str", # Optional. @@ -437,217 +466,243 @@ async def begin_infer_radiology_insights( Numerical value (with implicit precision). }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, "low": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). } }, "valueRatio": { "denominator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). }, "numerator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). } }, "valueReference": { - "display": "str", # Optional. Text - alternative for the resource. + "display": "str", # Optional. + Text alternative for the + resource. "identifier": { "assigner": ..., "period": { - "end": "str", # Optional. - End time with inclusive - boundary, if not ongoing. - "start": "str" # Optional. - Starting time with inclusive - boundary. + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. }, - "system": "str", # Optional. The - namespace for the identifier - value. + "system": "str", # Optional. + The namespace for the + identifier value. "type": { "coding": [ ... ], - "text": "str" # Optional. - Plain text representation of - the concept. + "text": "str" # + Optional. Plain text + representation of the + concept. }, - "use": "str", # Optional. usual - | official | temp | secondary | - old (If known). - "value": "str" # Optional. The - value that is unique. + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. }, "reference": "str", # Optional. - Literal reference, Relative, internal - or absolute URL. - "type": "str" # Optional. Type the - reference refers to (e.g. "Patient"). + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). }, "valueSampledData": { - "dimensions": 0, # Number of sample - points at each time point. Required. + "dimensions": 0, # Number of + sample points at each time point. + Required. "origin": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). }, "period": 0.0, # Number of - milliseconds between samples. - Required. - "data": "str", # Optional. Decimal - values with spaces, or "E" | "U" | - "L". - "factor": 0.0, # Optional. Multiply - data by this before adding to origin. - "lowerLimit": 0.0, # Optional. Lower - limit of detection. - "upperLimit": 0.0 # Optional. Upper - limit of detection. + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. }, - "valueString": "str", # Optional. Value - as string. + "valueString": "str", # Optional. + Value as string. "valueTime": "12:30:00" # Optional. - Value as time (hh:mm:ss). - } - ], - "id": "str", - # Optional. Unique id for inter-element - referencing. - "system": - "str", # Optional. Identity of the terminology - system. - "version": - "str" # Optional. Version of the system - if - relevant. - } - ], - "versionId": "str" # - Optional. The version specific identifier, as it appears - in the version portion of the URL. This value changes - when the resource is created, updated, or deleted. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "versionId": "str" # + Optional. The version specific identifier, as it + appears in the version portion of the URL. This value + changes when the resource is created, updated, or + deleted. + } + } + ], + "sex": "str" # Optional. The patient's sex. + Known values are: "female", "male", and "unspecified". + }, + "encounters": [ + { + "id": "str", # The id of the visit. + Required. + "class": "str", # Optional. The + class of the encounter. Known values are: "inpatient", + "ambulatory", "observation", "emergency", "virtual", and + "healthHome". + "period": { + "end": "2020-02-20 00:00:00", + # Optional. End time with inclusive boundary, if not + ongoing. + "start": "2020-02-20 + 00:00:00" # Optional. Starting time with inclusive + boundary. } } ], - "sex": "str" # Optional. The patient's sex. Known - values are: "female", "male", and "unspecified". - }, - "patientDocuments": [ - { - "content": { - "sourceType": "str", # The type of - the content's source. In case the source type is 'inline', - the content is given as a string (for instance, text). In - case the source type is 'reference', the content is given as - a URI. Required. Known values are: "inline" and "reference". - "value": "str" # The content of the - document, given either inline (as a string) or as a reference - (URI). Required. - }, - "id": "str", # A given identifier for the - document. Has to be unique across all documents for a single - patient. Required. - "type": "str", # The type of the patient - document, such as 'note' (text document) or 'fhirBundle' (FHIR - JSON document). Required. Known values are: "note", "fhirBundle", - "dicom", and "genomicSequencing". - "administrativeMetadata": { - "encounterId": "str", # Optional. - Reference to the encounter associated with the document. - "orderedProcedures": [ - { - "code": { - "coding": [ - { + "patientDocuments": [ + { + "content": { + "sourceType": "str", # The + type of the content's source. In case the source type is + 'inline', the content is given as a string (for instance, + text). In case the source type is 'reference', the + content is given as a URI. Required. Known values are: + "inline" and "reference". + "value": "str" # The content + of the document, given either inline (as a string) or as + a reference (URI). Required. + }, + "id": "str", # A given identifier + for the document. Has to be unique across all documents for a + single patient. Required. + "type": "str", # The type of the + patient document, such as 'note' (text document) or + 'fhirBundle' (FHIR JSON document). Required. Known values + are: "note", "fhirBundle", "dicom", and "genomicSequencing". + "administrativeMetadata": { + "encounterId": "str", # + Optional. Reference to the encounter associated with the + document. + "orderedProcedures": [ + { + "code": { + "coding": [ + { "code": "str", # Optional. Symbol in - syntax defined by the system. + syntax defined by the system. "display": "str", # Optional. - Representation defined by the system. + Representation defined by the system. "extension": [ { - "url": "str", # Source of the - definition for the extension code - - a logical name or a URL. - Required. + "url": "str", # Source of + the definition for the + extension code - a logical + name or a URL. Required. "valueBoolean": bool, # - Optional. Value as boolean. + Optional. Value as boolean. "valueCodeableConcept": ..., "valueDateTime": "str", # - Optional. Value as dateTime. - "valueInteger": 0, # Optional. - Value as integer. + Optional. Value as dateTime. + "valueInteger": 0, # + Optional. Value as integer. "valuePeriod": { - "end": "str", # Optional. - End time with inclusive - boundary, if not ongoing. - "start": "str" # Optional. - Starting time with inclusive - boundary. + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. }, "valueQuantity": { - "code": "str", # Optional. - Coded form of the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the value. - "system": "str", # Optional. - System that defines coded - unit form. - "unit": "str", # Optional. - Unit representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). - }, - "valueRange": { - "high": { "code": "str", # Optional. Coded form of the unit. @@ -665,589 +720,196 @@ async def begin_infer_radiology_insights( Numerical value (with implicit precision). }, + "valueRange": { + "high": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, "low": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). } }, "valueRatio": { "denominator": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). }, "numerator": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). } }, "valueReference": { "display": "str", # - Optional. Text alternative - for the resource. + Optional. Text + alternative for the + resource. "identifier": { "assigner": ..., "period": { "end": "str", # - Optional. End time - with inclusive - boundary, if not - ongoing. + Optional. End + time with + inclusive + boundary, if not + ongoing. "start": "str" # - Optional. Starting - time with inclusive - boundary. + Optional. + Starting time + with inclusive + boundary. }, "system": "str", # - Optional. The namespace - for the identifier value. + Optional. The + namespace for the + identifier value. "type": ..., "use": "str", # - Optional. usual | - official | temp | - secondary | old (If - known). + Optional. usual | + official | temp | + secondary | old (If + known). "value": "str" # - Optional. The value that - is unique. + Optional. The value + that is unique. }, "reference": "str", # - Optional. Literal reference, - Relative, internal or - absolute URL. - "type": "str" # Optional. - Type the reference refers to - (e.g. "Patient"). + Optional. Literal + reference, Relative, + internal or absolute URL. + "type": "str" # + Optional. Type the + reference refers to (e.g. + "Patient"). }, "valueSampledData": { - "dimensions": 0, # Number of - sample points at each time - point. Required. + "dimensions": 0, # + Number of sample points + at each time point. + Required. "origin": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). }, - "period": 0.0, # Number of - milliseconds between samples. - Required. - "data": "str", # Optional. - Decimal values with spaces, - or "E" | "U" | "L". - "factor": 0.0, # Optional. - Multiply data by this before - adding to origin. + "period": 0.0, # Number + of milliseconds between + samples. Required. + "data": "str", # + Optional. Decimal values + with spaces, or "E" | "U" + | "L". + "factor": 0.0, # + Optional. Multiply data + by this before adding to + origin. "lowerLimit": 0.0, # - Optional. Lower limit of - detection. + Optional. Lower limit of + detection. "upperLimit": 0.0 # - Optional. Upper limit of - detection. + Optional. Upper limit of + detection. }, "valueString": "str", # - Optional. Value as string. + Optional. Value as string. "valueTime": "12:30:00" # - Optional. Value as time - (hh:mm:ss). + Optional. Value as time + (hh:mm:ss). } ], - "id": "str", # Optional. Unique id for - inter-element referencing. - "system": "str", # Optional. Identity of - the terminology system. - "version": "str" # Optional. Version of - the system - if relevant. - } - ], - "text": "str" - # Optional. Plain text representation of the - concept. - }, - "description": "str", - # Optional. Procedure description. - "extension": [ - { - "url": "str", # Source of the definition for - the extension code - a logical name or a URL. - Required. - "valueBoolean": bool, # Optional. Value as - boolean. - "valueCodeableConcept": { - "coding": [ - { - "code": "str", # Optional. - Symbol in syntax defined by the - system. - "display": "str", # Optional. - Representation defined by the - system. - "extension": [ - ... - ], - "id": "str", # Optional. Unique - id for inter-element referencing. + "id": "str", # Optional. Unique id + for inter-element referencing. "system": "str", # Optional. - Identity of the terminology - system. - "version": "str" # Optional. - Version of the system - if - relevant. + Identity of the terminology system. + "version": "str" # Optional. Version + of the system - if relevant. } - ], + ], "text": "str" # Optional. Plain text - representation of the concept. - }, - "valueDateTime": "str", # Optional. Value as - dateTime. - "valueInteger": 0, # Optional. Value as - integer. - "valuePeriod": { - "end": "str", # Optional. End time with - inclusive boundary, if not ongoing. - "start": "str" # Optional. Starting time - with inclusive boundary. - }, - "valueQuantity": { - "code": "str", # Optional. Coded form of - the unit. - "comparator": "str", # Optional. < | <= - | >= | > - how to understand the value. - "system": "str", # Optional. System that - defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical value - (with implicit precision). - }, - "valueRange": { - "high": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - }, - "low": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - } - }, - "valueRatio": { - "denominator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - }, - "numerator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - } - }, - "valueReference": { - "display": "str", # Optional. Text - alternative for the resource. - "identifier": { - "assigner": ..., - "period": { - "end": "str", # Optional. End - time with inclusive boundary, if - not ongoing. - "start": "str" # Optional. - Starting time with inclusive - boundary. - }, - "system": "str", # Optional. The - namespace for the identifier value. - "type": { - "coding": [ - { - "code": "str", # - Optional. Symbol in - syntax defined by the - system. - "display": "str", # - Optional. Representation - defined by the system. - "extension": [ - ... - ], - "id": "str", # Optional. - Unique id for - inter-element - referencing. - "system": "str", # - Optional. Identity of the - terminology system. - "version": "str" # - Optional. Version of the - system - if relevant. - } - ], - "text": "str" # Optional. Plain - text representation of the - concept. - }, - "use": "str", # Optional. usual | - official | temp | secondary | old (If - known). - "value": "str" # Optional. The value - that is unique. - }, - "reference": "str", # Optional. Literal - reference, Relative, internal or absolute - URL. - "type": "str" # Optional. Type the - reference refers to (e.g. "Patient"). - }, - "valueSampledData": { - "dimensions": 0, # Number of sample - points at each time point. Required. - "origin": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - }, - "period": 0.0, # Number of milliseconds - between samples. Required. - "data": "str", # Optional. Decimal - values with spaces, or "E" | "U" | "L". - "factor": 0.0, # Optional. Multiply data - by this before adding to origin. - "lowerLimit": 0.0, # Optional. Lower - limit of detection. - "upperLimit": 0.0 # Optional. Upper - limit of detection. - }, - "valueString": "str", # Optional. Value as - string. - "valueTime": "12:30:00" # Optional. Value as - time (hh:mm:ss). - } - ] - } - ] - }, - "authors": [ - { - "fullName": "str", # - Optional. Text representation of the full name. - "id": "str" # Optional. - author id. - } - ], - "clinicalType": "str", # Optional. The type - of the clinical document. Known values are: "consultation", - "dischargeSummary", "historyAndPhysical", "radiologyReport", - "procedure", "progress", "laboratory", and "pathologyReport". - "createdDateTime": "2020-02-20 00:00:00", # - Optional. The date and time when the document was created. - "language": "str", # Optional. A 2 letter - ISO 639-1 representation of the language of the document. - "specialtyType": "str" # Optional. specialty - type the document. Known values are: "pathology" and "radiology". - } - ] - } - ], - "configuration": { - "includeEvidence": bool, # Optional. An indication whether the - model's output should include evidence for the inferences. - "inferenceOptions": { - "findingOptions": { - "provideFocusedSentenceEvidence": bool # Optional. - If this is true, provide the sentence that contains the first token - of the finding's clinical indicator (i.e. the medical problem), if - there is one. This sentence is provided as an extension with url - 'ci_sentence', next to the token evidence. Default is false. - }, - "followupRecommendationOptions": { - "includeRecommendationsInReferences": bool, # - Optional. Include/Exclude follow-up recommendations in references to - a guideline or article. Default is false. - "includeRecommendationsWithNoSpecifiedModality": - bool, # Optional. Include/Exclude follow-up recommendations without - a specific radiology procedure. Default is false. - "provideFocusedSentenceEvidence": bool # Optional. - If this is true, provide one or more sentences as evidence for the - recommendation, next to the token evidence. The start and end - positions of these sentences will be put in an extension with url - 'modality_sentences'. Default is false. - } - }, - "inferenceTypes": [ - "str" # Optional. This is a list of inference types to be - inferred for the current request. It could be used if only part of the - Radiology Insights inferences are required. If this list is omitted or - empty, the model will return all the inference types. - ], - "locale": "str", # Optional. Local for the model to use. If not - specified, the model will use the default locale. - "verbose": bool # Optional. An indication whether the model should - produce verbose output. - } - } - - # response body for status code(s): 202 - response == { - "modelVersion": "str", # The version of the model used for inference, - expressed as the model date. Required. - "patientResults": [ - { - "inferences": [ - radiology_insights_inference - ], - "patientId": "str" # Identifier given for the patient in the - request. Required. - } - ] - } - """ - - @overload - async def begin_infer_radiology_insights( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RadiologyInsightsInferenceResult]: - """Create Radiology Insights job. - - Creates a Radiology Insights job with the given request body. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns RadiologyInsightsInferenceResult. The - RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 202 - response == { - "modelVersion": "str", # The version of the model used for inference, - expressed as the model date. Required. - "patientResults": [ - { - "inferences": [ - radiology_insights_inference - ], - "patientId": "str" # Identifier given for the patient in the - request. Required. - } - ] - } - """ - - @overload - async def begin_infer_radiology_insights( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RadiologyInsightsInferenceResult]: - """Create Radiology Insights job. - - Creates a Radiology Insights job with the given request body. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns RadiologyInsightsInferenceResult. The - RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 202 - response == { - "modelVersion": "str", # The version of the model used for inference, - expressed as the model date. Required. - "patientResults": [ - { - "inferences": [ - radiology_insights_inference - ], - "patientId": "str" # Identifier given for the patient in the - request. Required. - } - ] - } - """ - - @distributed_trace_async - async def begin_infer_radiology_insights( - self, body: Union[_models.RadiologyInsightsData, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.RadiologyInsightsInferenceResult]: - # pylint: disable=line-too-long - """Create Radiology Insights job. - - Creates a Radiology Insights job with the given request body. - - :param body: Is one of the following types: RadiologyInsightsData, JSON, IO[bytes] Required. - :type body: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsData or JSON or - IO[bytes] - :return: An instance of AsyncLROPoller that returns RadiologyInsightsInferenceResult. The - RadiologyInsightsInferenceResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "patients": [ - { - "id": "str", # A given identifier for the patient. Has to be - unique across all patients in a single request. Required. - "encounters": [ - { - "id": "str", # The id of the visit. - Required. - "class": "str", # Optional. The class of the - encounter. Known values are: "inpatient", "ambulatory", - "observation", "emergency", "virtual", and "healthHome". - "period": { - "end": "2020-02-20 00:00:00", # - Optional. End time with inclusive boundary, if not ongoing. - "start": "2020-02-20 00:00:00" # - Optional. Starting time with inclusive boundary. - } - } - ], - "info": { - "birthDate": "2020-02-20", # Optional. The patient's - date of birth. - "clinicalInfo": [ - { - "resourceType": "str", # The type of - resource. Required. - "id": "str", # Optional. Resource - Id. - "implicitRules": "str", # Optional. - A set of rules under which this content was created. - "language": "str", # Optional. - Language of the resource content. - "meta": { - "lastUpdated": "str", # - Optional. When the resource last changed - e.g. when the - version changed. - "profile": [ - "str" # Optional. A - list of profiles (references to `StructureDefinition - `_ - resources) that this resource claims to conform to. - The URL is a reference to `StructureDefinition.url - `_. - ], - "security": [ - { - "code": - "str", # Optional. Symbol in syntax defined by - the system. - "display": - "str", # Optional. Representation defined by the - system. + representation of the concept. + }, + "description": "str", # Optional. Procedure + description. "extension": [ { @@ -1258,8 +920,27 @@ async def begin_infer_radiology_insights( as boolean. "valueCodeableConcept": { "coding": [ + { + "code": "str", # Optional. + Symbol in syntax defined by + the system. + "display": "str", # + Optional. Representation + defined by the system. + "extension": [ ... ], + "id": "str", # Optional. + Unique id for inter-element + referencing. + "system": "str", # Optional. + Identity of the terminology + system. + "version": "str" # Optional. + Version of the system - if + relevant. + } + ], "text": "str" # Optional. Plain text representation of the concept. }, @@ -1369,8 +1050,33 @@ async def begin_infer_radiology_insights( value. "type": { "coding": [ + { + "code": "str", # + Optional. Symbol in + syntax defined by the + system. + "display": "str", # + Optional. + Representation + defined by the + system. + "extension": [ ... ], + "id": "str", # + Optional. Unique id + for inter-element + referencing. + "system": "str", # + Optional. Identity of + the terminology + system. + "version": "str" # + Optional. Version of + the system - if + relevant. + } + ], "text": "str" # Optional. Plain text representation of the concept. @@ -1423,73 +1129,181 @@ async def begin_infer_radiology_insights( "valueTime": "12:30:00" # Optional. Value as time (hh:mm:ss). } - ], - "id": "str", - # Optional. Unique id for inter-element - referencing. - "system": - "str", # Optional. Identity of the terminology - system. - "version": - "str" # Optional. Version of the system - if - relevant. + ] } - ], - "source": "str", # Optional. - A uri that identifies the source system of the resource. - This provides a minimal amount of Provenance information - that can be used to track or differentiate the source of - information in the resource. The source may identify - another FHIR server, document, message, database, etc. - "tag": [ - { - "code": - "str", # Optional. Symbol in syntax defined by - the system. - "display": - "str", # Optional. Representation defined by the - system. - "extension": - [ - { - "url": "str", # Source of the definition - for the extension code - a logical name - or a URL. Required. - "valueBoolean": bool, # Optional. Value - as boolean. + ] + }, + "authors": [ + { + "fullName": "str", # + Optional. Text representation of the full name. + "id": "str" # + Optional. author id. + } + ], + "clinicalType": "str", # Optional. + The type of the clinical document. Known values are: + "consultation", "dischargeSummary", "historyAndPhysical", + "radiologyReport", "procedure", "progress", "laboratory", and + "pathologyReport". + "createdAt": "2020-02-20 00:00:00", + # Optional. The date and time when the document was created. + "language": "str", # Optional. A 2 + letter ISO 639-1 representation of the language of the + document. + "specialtyType": "str" # Optional. + specialty type the document. Known values are: "pathology" + and "radiology". + } + ] + } + ], + "configuration": { + "includeEvidence": bool, # Optional. An indication whether + the model's output should include evidence for the inferences. + "inferenceOptions": { + "findingOptions": { + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide the sentence that contains the + first token of the finding's clinical indicator (i.e. the medical + problem), if there is one. This sentence is provided as an + extension with url 'ci_sentence', next to the token evidence. + Default is false. + }, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + # Optional. Include/Exclude follow-up recommendations in + references to a guideline or article. Default is false. + "includeRecommendationsWithNoSpecifiedModality": bool, # + Optional. Include/Exclude follow-up recommendations without a + specific radiology procedure. Default is false. + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide one or more sentences as + evidence for the recommendation, next to the token evidence. The + start and end positions of these sentences will be put in an + extension with url 'modality_sentences'. Default is false. + } + }, + "inferenceTypes": [ + "str" # Optional. This is a list of inference types + to be inferred for the current request. It could be used if only part + of the Radiology Insights inferences are required. If this list is + omitted or empty, the model will return all the inference types. + ], + "locale": "str", # Optional. Local for the model to use. If + not specified, the model will use the default locale. + "verbose": bool # Optional. An indication whether the model + should produce verbose output. + } + }, + "result": { + "modelVersion": "str", # The version of the model used for + inference, expressed as the model date. Required. + "patientResults": [ + { + "inferences": [ + radiology_insights_inference + ], + "patientId": "str" # Identifier given for the + patient in the request. Required. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. The date and time when the + processing job was last updated. + } + + # response body for status code(s): 201, 200 + response == { + "id": "str", # The unique ID of the job. Required. + "status": "str", # The status of the job. Required. Known values are: + "notStarted", "running", "succeeded", "failed", and "canceled". + "createdAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job was created. + "error": { + "code": "str", # One of a server-defined set of error codes. + Required. + "message": "str", # A human-readable representation of the error. + Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a server-defined set of + error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "expiresAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job is set to expire. + "jobData": { + "patients": [ + { + "id": "str", # A given identifier for the patient. + Has to be unique across all patients in a single request. Required. + "details": { + "birthDate": "2020-02-20", # Optional. The + patient's date of birth. + "clinicalInfo": [ + { + "resourceType": "str", # The + type of resource. Required. + "id": "str", # Optional. + Resource Id. + "implicitRules": "str", # + Optional. A set of rules under which this content was + created. + "language": "str", # + Optional. Language of the resource content. + "meta": { + "lastUpdated": "str", + # Optional. When the resource last changed - e.g. + when the version changed. + "profile": [ + "str" # + Optional. A list of profiles (references to + `StructureDefinition + `_ + resources) that this resource claims to conform + to. The URL is a reference to + `StructureDefinition.url + `_. + ], + "security": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. "valueCodeableConcept": { "coding": [ ... ], - "text": "str" # Optional. Plain text - representation of the concept. + "text": "str" # Optional. Plain + text representation of the + concept. }, "valueDateTime": "str", # Optional. - Value as dateTime. - "valueInteger": 0, # Optional. Value as - integer. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. "valuePeriod": { - "end": "str", # Optional. End time - with inclusive boundary, if not - ongoing. - "start": "str" # Optional. Starting - time with inclusive boundary. + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. }, "valueQuantity": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). - }, - "valueRange": { - "high": { "code": "str", # Optional. Coded form of the unit. "comparator": "str", # Optional. @@ -1504,94 +1318,199 @@ async def begin_infer_radiology_insights( Numerical value (with implicit precision). }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, "low": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). } }, "valueRatio": { "denominator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). }, "numerator": { - "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. - < | <= | >= | > - how to - understand the value. + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. "system": "str", # Optional. - System that defines coded unit - form. - "unit": "str", # Optional. Unit - representation. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. "value": 0.0 # Optional. - Numerical value (with implicit - precision). + Numerical value (with + implicit precision). } }, "valueReference": { - "display": "str", # Optional. Text - alternative for the resource. + "display": "str", # Optional. + Text alternative for the + resource. "identifier": { "assigner": ..., "period": { - "end": "str", # Optional. - End time with inclusive - boundary, if not ongoing. - "start": "str" # Optional. - Starting time with inclusive - boundary. + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. }, - "system": "str", # Optional. The - namespace for the identifier - value. + "system": "str", # Optional. + The namespace for the + identifier value. "type": { "coding": [ ... ], - "text": "str" # Optional. - Plain text representation of - the concept. + "text": "str" # + Optional. Plain text + representation of the + concept. }, - "use": "str", # Optional. usual - | official | temp | secondary | - old (If known). - "value": "str" # Optional. The - value that is unique. + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. }, "reference": "str", # Optional. - Literal reference, Relative, internal - or absolute URL. - "type": "str" # Optional. Type the - reference refers to (e.g. "Patient"). + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). }, "valueSampledData": { - "dimensions": 0, # Number of sample - points at each time point. Required. + "dimensions": 0, # Number of + sample points at each time point. + Required. "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "source": "str", # + Optional. A uri that identifies the source system of + the resource. This provides a minimal amount of + Provenance information that can be used to track or + differentiate the source of information in the + resource. The source may identify another FHIR + server, document, message, database, etc. + "tag": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { "code": "str", # Optional. Coded form of the unit. "comparator": "str", # Optional. @@ -1606,99 +1525,23 @@ async def begin_infer_radiology_insights( Numerical value (with implicit precision). }, - "period": 0.0, # Number of - milliseconds between samples. - Required. - "data": "str", # Optional. Decimal - values with spaces, or "E" | "U" | - "L". - "factor": 0.0, # Optional. Multiply - data by this before adding to origin. - "lowerLimit": 0.0, # Optional. Lower - limit of detection. - "upperLimit": 0.0 # Optional. Upper - limit of detection. - }, - "valueString": "str", # Optional. Value - as string. - "valueTime": "12:30:00" # Optional. - Value as time (hh:mm:ss). - } - ], - "id": "str", - # Optional. Unique id for inter-element - referencing. - "system": - "str", # Optional. Identity of the terminology - system. - "version": - "str" # Optional. Version of the system - if - relevant. - } - ], - "versionId": "str" # - Optional. The version specific identifier, as it appears - in the version portion of the URL. This value changes - when the resource is created, updated, or deleted. - } - } - ], - "sex": "str" # Optional. The patient's sex. Known - values are: "female", "male", and "unspecified". - }, - "patientDocuments": [ - { - "content": { - "sourceType": "str", # The type of - the content's source. In case the source type is 'inline', - the content is given as a string (for instance, text). In - case the source type is 'reference', the content is given as - a URI. Required. Known values are: "inline" and "reference". - "value": "str" # The content of the - document, given either inline (as a string) or as a reference - (URI). Required. - }, - "id": "str", # A given identifier for the - document. Has to be unique across all documents for a single - patient. Required. - "type": "str", # The type of the patient - document, such as 'note' (text document) or 'fhirBundle' (FHIR - JSON document). Required. Known values are: "note", "fhirBundle", - "dicom", and "genomicSequencing". - "administrativeMetadata": { - "encounterId": "str", # Optional. - Reference to the encounter associated with the document. - "orderedProcedures": [ - { - "code": { - "coding": [ - { - "code": "str", # Optional. Symbol in - syntax defined by the system. - "display": "str", # Optional. - Representation defined by the system. - "extension": [ - { - "url": "str", # Source of the - definition for the extension code - - a logical name or a URL. - Required. - "valueBoolean": bool, # - Optional. Value as boolean. - "valueCodeableConcept": ..., - "valueDateTime": "str", # - Optional. Value as dateTime. - "valueInteger": 0, # Optional. - Value as integer. - "valuePeriod": { - "end": "str", # Optional. - End time with inclusive - boundary, if not ongoing. - "start": "str" # Optional. - Starting time with inclusive - boundary. + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). }, - "valueQuantity": { + "low": { "code": "str", # Optional. Coded form of the unit. "comparator": "str", # @@ -1712,9 +1555,4549 @@ async def begin_infer_radiology_insights( "value": 0.0 # Optional. Numerical value (with implicit precision). + } }, - "valueRange": { - "high": { + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "versionId": "str" # + Optional. The version specific identifier, as it + appears in the version portion of the URL. This value + changes when the resource is created, updated, or + deleted. + } + } + ], + "sex": "str" # Optional. The patient's sex. + Known values are: "female", "male", and "unspecified". + }, + "encounters": [ + { + "id": "str", # The id of the visit. + Required. + "class": "str", # Optional. The + class of the encounter. Known values are: "inpatient", + "ambulatory", "observation", "emergency", "virtual", and + "healthHome". + "period": { + "end": "2020-02-20 00:00:00", + # Optional. End time with inclusive boundary, if not + ongoing. + "start": "2020-02-20 + 00:00:00" # Optional. Starting time with inclusive + boundary. + } + } + ], + "patientDocuments": [ + { + "content": { + "sourceType": "str", # The + type of the content's source. In case the source type is + 'inline', the content is given as a string (for instance, + text). In case the source type is 'reference', the + content is given as a URI. Required. Known values are: + "inline" and "reference". + "value": "str" # The content + of the document, given either inline (as a string) or as + a reference (URI). Required. + }, + "id": "str", # A given identifier + for the document. Has to be unique across all documents for a + single patient. Required. + "type": "str", # The type of the + patient document, such as 'note' (text document) or + 'fhirBundle' (FHIR JSON document). Required. Known values + are: "note", "fhirBundle", "dicom", and "genomicSequencing". + "administrativeMetadata": { + "encounterId": "str", # + Optional. Reference to the encounter associated with the + document. + "orderedProcedures": [ + { + "code": { + "coding": [ + { + "code": "str", # Optional. Symbol in + syntax defined by the system. + "display": "str", # Optional. + Representation defined by the system. + "extension": [ + { + "url": "str", # Source of + the definition for the + extension code - a logical + name or a URL. Required. + "valueBoolean": bool, # + Optional. Value as boolean. + "valueCodeableConcept": ..., + "valueDateTime": "str", # + Optional. Value as dateTime. + "valueInteger": 0, # + Optional. Value as integer. + "valuePeriod": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # + Optional. Coded form of + the unit. + "comparator": "str", # + Optional. < | <= | >= | > + - how to understand the + value. + "system": "str", # + Optional. System that + defines coded unit form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "low": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "numerator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # + Optional. Text + alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End + time with + inclusive + boundary, if not + ongoing. + "start": "str" # + Optional. + Starting time + with inclusive + boundary. + }, + "system": "str", # + Optional. The + namespace for the + identifier value. + "type": ..., + "use": "str", # + Optional. usual | + official | temp | + secondary | old (If + known). + "value": "str" # + Optional. The value + that is unique. + }, + "reference": "str", # + Optional. Literal + reference, Relative, + internal or absolute URL. + "type": "str" # + Optional. Type the + reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # + Number of sample points + at each time point. + Required. + "origin": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "period": 0.0, # Number + of milliseconds between + samples. Required. + "data": "str", # + Optional. Decimal values + with spaces, or "E" | "U" + | "L". + "factor": 0.0, # + Optional. Multiply data + by this before adding to + origin. + "lowerLimit": 0.0, # + Optional. Lower limit of + detection. + "upperLimit": 0.0 # + Optional. Upper limit of + detection. + }, + "valueString": "str", # + Optional. Value as string. + "valueTime": "12:30:00" # + Optional. Value as time + (hh:mm:ss). + } + ], + "id": "str", # Optional. Unique id + for inter-element referencing. + "system": "str", # Optional. + Identity of the terminology system. + "version": "str" # Optional. Version + of the system - if relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "description": "str", # Optional. Procedure + description. + "extension": + [ + { + "url": "str", # Source of the definition + for the extension code - a logical name + or a URL. Required. + "valueBoolean": bool, # Optional. Value + as boolean. + "valueCodeableConcept": { + "coding": [ + { + "code": "str", # Optional. + Symbol in syntax defined by + the system. + "display": "str", # + Optional. Representation + defined by the system. + "extension": [ + ... + ], + "id": "str", # Optional. + Unique id for inter-element + referencing. + "system": "str", # Optional. + Identity of the terminology + system. + "version": "str" # Optional. + Version of the system - if + relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value as + integer. + "valuePeriod": { + "end": "str", # Optional. End time + with inclusive boundary, if not + ongoing. + "start": "str" # Optional. Starting + time with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. < | + <= | >= | > - how to understand the + value. + "system": "str", # Optional. System + that defines coded unit form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. Numerical + value (with implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "low": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "numerator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # Optional. Text + alternative for the resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # Optional. + End time with inclusive + boundary, if not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "system": "str", # Optional. The + namespace for the identifier + value. + "type": { + "coding": [ + { + "code": "str", # + Optional. Symbol in + syntax defined by the + system. + "display": "str", # + Optional. + Representation + defined by the + system. + "extension": [ + ... + ], + "id": "str", # + Optional. Unique id + for inter-element + referencing. + "system": "str", # + Optional. Identity of + the terminology + system. + "version": "str" # + Optional. Version of + the system - if + relevant. + } + ], + "text": "str" # Optional. + Plain text representation of + the concept. + }, + "use": "str", # Optional. usual + | official | temp | secondary | + old (If known). + "value": "str" # Optional. The + value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, internal + or absolute URL. + "type": "str" # Optional. Type the + reference refers to (e.g. "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of sample + points at each time point. Required. + "origin": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. Decimal + values with spaces, or "E" | "U" | + "L". + "factor": 0.0, # Optional. Multiply + data by this before adding to origin. + "lowerLimit": 0.0, # Optional. Lower + limit of detection. + "upperLimit": 0.0 # Optional. Upper + limit of detection. + }, + "valueString": "str", # Optional. Value + as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ] + } + ] + }, + "authors": [ + { + "fullName": "str", # + Optional. Text representation of the full name. + "id": "str" # + Optional. author id. + } + ], + "clinicalType": "str", # Optional. + The type of the clinical document. Known values are: + "consultation", "dischargeSummary", "historyAndPhysical", + "radiologyReport", "procedure", "progress", "laboratory", and + "pathologyReport". + "createdAt": "2020-02-20 00:00:00", + # Optional. The date and time when the document was created. + "language": "str", # Optional. A 2 + letter ISO 639-1 representation of the language of the + document. + "specialtyType": "str" # Optional. + specialty type the document. Known values are: "pathology" + and "radiology". + } + ] + } + ], + "configuration": { + "includeEvidence": bool, # Optional. An indication whether + the model's output should include evidence for the inferences. + "inferenceOptions": { + "findingOptions": { + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide the sentence that contains the + first token of the finding's clinical indicator (i.e. the medical + problem), if there is one. This sentence is provided as an + extension with url 'ci_sentence', next to the token evidence. + Default is false. + }, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + # Optional. Include/Exclude follow-up recommendations in + references to a guideline or article. Default is false. + "includeRecommendationsWithNoSpecifiedModality": bool, # + Optional. Include/Exclude follow-up recommendations without a + specific radiology procedure. Default is false. + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide one or more sentences as + evidence for the recommendation, next to the token evidence. The + start and end positions of these sentences will be put in an + extension with url 'modality_sentences'. Default is false. + } + }, + "inferenceTypes": [ + "str" # Optional. This is a list of inference types + to be inferred for the current request. It could be used if only part + of the Radiology Insights inferences are required. If this list is + omitted or empty, the model will return all the inference types. + ], + "locale": "str", # Optional. Local for the model to use. If + not specified, the model will use the default locale. + "verbose": bool # Optional. An indication whether the model + should produce verbose output. + } + }, + "result": { + "modelVersion": "str", # The version of the model used for + inference, expressed as the model date. Required. + "patientResults": [ + { + "inferences": [ + radiology_insights_inference + ], + "patientId": "str" # Identifier given for the + patient in the request. Required. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. The date and time when the + processing job was last updated. + } + """ + + @overload + async def begin_infer_radiology_insights( + self, + id: str, + resource: JSON, + *, + expand: Optional[List[str]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RadiologyInsightsJob]: + # pylint: disable=line-too-long + """Create Radiology Insights job. + + Creates a Radiology Insights job with the given request body. + + :param id: The unique ID of the job. Required. + :type id: str + :param resource: The resource instance. Required. + :type resource: JSON + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RadiologyInsightsJob. The + RadiologyInsightsJob is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 201, 200 + response == { + "id": "str", # The unique ID of the job. Required. + "status": "str", # The status of the job. Required. Known values are: + "notStarted", "running", "succeeded", "failed", and "canceled". + "createdAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job was created. + "error": { + "code": "str", # One of a server-defined set of error codes. + Required. + "message": "str", # A human-readable representation of the error. + Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a server-defined set of + error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "expiresAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job is set to expire. + "jobData": { + "patients": [ + { + "id": "str", # A given identifier for the patient. + Has to be unique across all patients in a single request. Required. + "details": { + "birthDate": "2020-02-20", # Optional. The + patient's date of birth. + "clinicalInfo": [ + { + "resourceType": "str", # The + type of resource. Required. + "id": "str", # Optional. + Resource Id. + "implicitRules": "str", # + Optional. A set of rules under which this content was + created. + "language": "str", # + Optional. Language of the resource content. + "meta": { + "lastUpdated": "str", + # Optional. When the resource last changed - e.g. + when the version changed. + "profile": [ + "str" # + Optional. A list of profiles (references to + `StructureDefinition + `_ + resources) that this resource claims to conform + to. The URL is a reference to + `StructureDefinition.url + `_. + ], + "security": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "source": "str", # + Optional. A uri that identifies the source system of + the resource. This provides a minimal amount of + Provenance information that can be used to track or + differentiate the source of information in the + resource. The source may identify another FHIR + server, document, message, database, etc. + "tag": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "versionId": "str" # + Optional. The version specific identifier, as it + appears in the version portion of the URL. This value + changes when the resource is created, updated, or + deleted. + } + } + ], + "sex": "str" # Optional. The patient's sex. + Known values are: "female", "male", and "unspecified". + }, + "encounters": [ + { + "id": "str", # The id of the visit. + Required. + "class": "str", # Optional. The + class of the encounter. Known values are: "inpatient", + "ambulatory", "observation", "emergency", "virtual", and + "healthHome". + "period": { + "end": "2020-02-20 00:00:00", + # Optional. End time with inclusive boundary, if not + ongoing. + "start": "2020-02-20 + 00:00:00" # Optional. Starting time with inclusive + boundary. + } + } + ], + "patientDocuments": [ + { + "content": { + "sourceType": "str", # The + type of the content's source. In case the source type is + 'inline', the content is given as a string (for instance, + text). In case the source type is 'reference', the + content is given as a URI. Required. Known values are: + "inline" and "reference". + "value": "str" # The content + of the document, given either inline (as a string) or as + a reference (URI). Required. + }, + "id": "str", # A given identifier + for the document. Has to be unique across all documents for a + single patient. Required. + "type": "str", # The type of the + patient document, such as 'note' (text document) or + 'fhirBundle' (FHIR JSON document). Required. Known values + are: "note", "fhirBundle", "dicom", and "genomicSequencing". + "administrativeMetadata": { + "encounterId": "str", # + Optional. Reference to the encounter associated with the + document. + "orderedProcedures": [ + { + "code": { + "coding": [ + { + "code": "str", # Optional. Symbol in + syntax defined by the system. + "display": "str", # Optional. + Representation defined by the system. + "extension": [ + { + "url": "str", # Source of + the definition for the + extension code - a logical + name or a URL. Required. + "valueBoolean": bool, # + Optional. Value as boolean. + "valueCodeableConcept": ..., + "valueDateTime": "str", # + Optional. Value as dateTime. + "valueInteger": 0, # + Optional. Value as integer. + "valuePeriod": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # + Optional. Coded form of + the unit. + "comparator": "str", # + Optional. < | <= | >= | > + - how to understand the + value. + "system": "str", # + Optional. System that + defines coded unit form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "low": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "numerator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # + Optional. Text + alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End + time with + inclusive + boundary, if not + ongoing. + "start": "str" # + Optional. + Starting time + with inclusive + boundary. + }, + "system": "str", # + Optional. The + namespace for the + identifier value. + "type": ..., + "use": "str", # + Optional. usual | + official | temp | + secondary | old (If + known). + "value": "str" # + Optional. The value + that is unique. + }, + "reference": "str", # + Optional. Literal + reference, Relative, + internal or absolute URL. + "type": "str" # + Optional. Type the + reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # + Number of sample points + at each time point. + Required. + "origin": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "period": 0.0, # Number + of milliseconds between + samples. Required. + "data": "str", # + Optional. Decimal values + with spaces, or "E" | "U" + | "L". + "factor": 0.0, # + Optional. Multiply data + by this before adding to + origin. + "lowerLimit": 0.0, # + Optional. Lower limit of + detection. + "upperLimit": 0.0 # + Optional. Upper limit of + detection. + }, + "valueString": "str", # + Optional. Value as string. + "valueTime": "12:30:00" # + Optional. Value as time + (hh:mm:ss). + } + ], + "id": "str", # Optional. Unique id + for inter-element referencing. + "system": "str", # Optional. + Identity of the terminology system. + "version": "str" # Optional. Version + of the system - if relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "description": "str", # Optional. Procedure + description. + "extension": + [ + { + "url": "str", # Source of the definition + for the extension code - a logical name + or a URL. Required. + "valueBoolean": bool, # Optional. Value + as boolean. + "valueCodeableConcept": { + "coding": [ + { + "code": "str", # Optional. + Symbol in syntax defined by + the system. + "display": "str", # + Optional. Representation + defined by the system. + "extension": [ + ... + ], + "id": "str", # Optional. + Unique id for inter-element + referencing. + "system": "str", # Optional. + Identity of the terminology + system. + "version": "str" # Optional. + Version of the system - if + relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value as + integer. + "valuePeriod": { + "end": "str", # Optional. End time + with inclusive boundary, if not + ongoing. + "start": "str" # Optional. Starting + time with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. < | + <= | >= | > - how to understand the + value. + "system": "str", # Optional. System + that defines coded unit form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. Numerical + value (with implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "low": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "numerator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # Optional. Text + alternative for the resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # Optional. + End time with inclusive + boundary, if not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "system": "str", # Optional. The + namespace for the identifier + value. + "type": { + "coding": [ + { + "code": "str", # + Optional. Symbol in + syntax defined by the + system. + "display": "str", # + Optional. + Representation + defined by the + system. + "extension": [ + ... + ], + "id": "str", # + Optional. Unique id + for inter-element + referencing. + "system": "str", # + Optional. Identity of + the terminology + system. + "version": "str" # + Optional. Version of + the system - if + relevant. + } + ], + "text": "str" # Optional. + Plain text representation of + the concept. + }, + "use": "str", # Optional. usual + | official | temp | secondary | + old (If known). + "value": "str" # Optional. The + value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, internal + or absolute URL. + "type": "str" # Optional. Type the + reference refers to (e.g. "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of sample + points at each time point. Required. + "origin": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. Decimal + values with spaces, or "E" | "U" | + "L". + "factor": 0.0, # Optional. Multiply + data by this before adding to origin. + "lowerLimit": 0.0, # Optional. Lower + limit of detection. + "upperLimit": 0.0 # Optional. Upper + limit of detection. + }, + "valueString": "str", # Optional. Value + as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ] + } + ] + }, + "authors": [ + { + "fullName": "str", # + Optional. Text representation of the full name. + "id": "str" # + Optional. author id. + } + ], + "clinicalType": "str", # Optional. + The type of the clinical document. Known values are: + "consultation", "dischargeSummary", "historyAndPhysical", + "radiologyReport", "procedure", "progress", "laboratory", and + "pathologyReport". + "createdAt": "2020-02-20 00:00:00", + # Optional. The date and time when the document was created. + "language": "str", # Optional. A 2 + letter ISO 639-1 representation of the language of the + document. + "specialtyType": "str" # Optional. + specialty type the document. Known values are: "pathology" + and "radiology". + } + ] + } + ], + "configuration": { + "includeEvidence": bool, # Optional. An indication whether + the model's output should include evidence for the inferences. + "inferenceOptions": { + "findingOptions": { + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide the sentence that contains the + first token of the finding's clinical indicator (i.e. the medical + problem), if there is one. This sentence is provided as an + extension with url 'ci_sentence', next to the token evidence. + Default is false. + }, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + # Optional. Include/Exclude follow-up recommendations in + references to a guideline or article. Default is false. + "includeRecommendationsWithNoSpecifiedModality": bool, # + Optional. Include/Exclude follow-up recommendations without a + specific radiology procedure. Default is false. + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide one or more sentences as + evidence for the recommendation, next to the token evidence. The + start and end positions of these sentences will be put in an + extension with url 'modality_sentences'. Default is false. + } + }, + "inferenceTypes": [ + "str" # Optional. This is a list of inference types + to be inferred for the current request. It could be used if only part + of the Radiology Insights inferences are required. If this list is + omitted or empty, the model will return all the inference types. + ], + "locale": "str", # Optional. Local for the model to use. If + not specified, the model will use the default locale. + "verbose": bool # Optional. An indication whether the model + should produce verbose output. + } + }, + "result": { + "modelVersion": "str", # The version of the model used for + inference, expressed as the model date. Required. + "patientResults": [ + { + "inferences": [ + radiology_insights_inference + ], + "patientId": "str" # Identifier given for the + patient in the request. Required. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. The date and time when the + processing job was last updated. + } + """ + + @overload + async def begin_infer_radiology_insights( + self, + id: str, + resource: IO[bytes], + *, + expand: Optional[List[str]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RadiologyInsightsJob]: + # pylint: disable=line-too-long + """Create Radiology Insights job. + + Creates a Radiology Insights job with the given request body. + + :param id: The unique ID of the job. Required. + :type id: str + :param resource: The resource instance. Required. + :type resource: IO[bytes] + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RadiologyInsightsJob. The + RadiologyInsightsJob is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 201, 200 + response == { + "id": "str", # The unique ID of the job. Required. + "status": "str", # The status of the job. Required. Known values are: + "notStarted", "running", "succeeded", "failed", and "canceled". + "createdAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job was created. + "error": { + "code": "str", # One of a server-defined set of error codes. + Required. + "message": "str", # A human-readable representation of the error. + Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a server-defined set of + error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "expiresAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job is set to expire. + "jobData": { + "patients": [ + { + "id": "str", # A given identifier for the patient. + Has to be unique across all patients in a single request. Required. + "details": { + "birthDate": "2020-02-20", # Optional. The + patient's date of birth. + "clinicalInfo": [ + { + "resourceType": "str", # The + type of resource. Required. + "id": "str", # Optional. + Resource Id. + "implicitRules": "str", # + Optional. A set of rules under which this content was + created. + "language": "str", # + Optional. Language of the resource content. + "meta": { + "lastUpdated": "str", + # Optional. When the resource last changed - e.g. + when the version changed. + "profile": [ + "str" # + Optional. A list of profiles (references to + `StructureDefinition + `_ + resources) that this resource claims to conform + to. The URL is a reference to + `StructureDefinition.url + `_. + ], + "security": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "source": "str", # + Optional. A uri that identifies the source system of + the resource. This provides a minimal amount of + Provenance information that can be used to track or + differentiate the source of information in the + resource. The source may identify another FHIR + server, document, message, database, etc. + "tag": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "versionId": "str" # + Optional. The version specific identifier, as it + appears in the version portion of the URL. This value + changes when the resource is created, updated, or + deleted. + } + } + ], + "sex": "str" # Optional. The patient's sex. + Known values are: "female", "male", and "unspecified". + }, + "encounters": [ + { + "id": "str", # The id of the visit. + Required. + "class": "str", # Optional. The + class of the encounter. Known values are: "inpatient", + "ambulatory", "observation", "emergency", "virtual", and + "healthHome". + "period": { + "end": "2020-02-20 00:00:00", + # Optional. End time with inclusive boundary, if not + ongoing. + "start": "2020-02-20 + 00:00:00" # Optional. Starting time with inclusive + boundary. + } + } + ], + "patientDocuments": [ + { + "content": { + "sourceType": "str", # The + type of the content's source. In case the source type is + 'inline', the content is given as a string (for instance, + text). In case the source type is 'reference', the + content is given as a URI. Required. Known values are: + "inline" and "reference". + "value": "str" # The content + of the document, given either inline (as a string) or as + a reference (URI). Required. + }, + "id": "str", # A given identifier + for the document. Has to be unique across all documents for a + single patient. Required. + "type": "str", # The type of the + patient document, such as 'note' (text document) or + 'fhirBundle' (FHIR JSON document). Required. Known values + are: "note", "fhirBundle", "dicom", and "genomicSequencing". + "administrativeMetadata": { + "encounterId": "str", # + Optional. Reference to the encounter associated with the + document. + "orderedProcedures": [ + { + "code": { + "coding": [ + { + "code": "str", # Optional. Symbol in + syntax defined by the system. + "display": "str", # Optional. + Representation defined by the system. + "extension": [ + { + "url": "str", # Source of + the definition for the + extension code - a logical + name or a URL. Required. + "valueBoolean": bool, # + Optional. Value as boolean. + "valueCodeableConcept": ..., + "valueDateTime": "str", # + Optional. Value as dateTime. + "valueInteger": 0, # + Optional. Value as integer. + "valuePeriod": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # + Optional. Coded form of + the unit. + "comparator": "str", # + Optional. < | <= | >= | > + - how to understand the + value. + "system": "str", # + Optional. System that + defines coded unit form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "low": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "numerator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # + Optional. Text + alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End + time with + inclusive + boundary, if not + ongoing. + "start": "str" # + Optional. + Starting time + with inclusive + boundary. + }, + "system": "str", # + Optional. The + namespace for the + identifier value. + "type": ..., + "use": "str", # + Optional. usual | + official | temp | + secondary | old (If + known). + "value": "str" # + Optional. The value + that is unique. + }, + "reference": "str", # + Optional. Literal + reference, Relative, + internal or absolute URL. + "type": "str" # + Optional. Type the + reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # + Number of sample points + at each time point. + Required. + "origin": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "period": 0.0, # Number + of milliseconds between + samples. Required. + "data": "str", # + Optional. Decimal values + with spaces, or "E" | "U" + | "L". + "factor": 0.0, # + Optional. Multiply data + by this before adding to + origin. + "lowerLimit": 0.0, # + Optional. Lower limit of + detection. + "upperLimit": 0.0 # + Optional. Upper limit of + detection. + }, + "valueString": "str", # + Optional. Value as string. + "valueTime": "12:30:00" # + Optional. Value as time + (hh:mm:ss). + } + ], + "id": "str", # Optional. Unique id + for inter-element referencing. + "system": "str", # Optional. + Identity of the terminology system. + "version": "str" # Optional. Version + of the system - if relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "description": "str", # Optional. Procedure + description. + "extension": + [ + { + "url": "str", # Source of the definition + for the extension code - a logical name + or a URL. Required. + "valueBoolean": bool, # Optional. Value + as boolean. + "valueCodeableConcept": { + "coding": [ + { + "code": "str", # Optional. + Symbol in syntax defined by + the system. + "display": "str", # + Optional. Representation + defined by the system. + "extension": [ + ... + ], + "id": "str", # Optional. + Unique id for inter-element + referencing. + "system": "str", # Optional. + Identity of the terminology + system. + "version": "str" # Optional. + Version of the system - if + relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value as + integer. + "valuePeriod": { + "end": "str", # Optional. End time + with inclusive boundary, if not + ongoing. + "start": "str" # Optional. Starting + time with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. < | + <= | >= | > - how to understand the + value. + "system": "str", # Optional. System + that defines coded unit form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. Numerical + value (with implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "low": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "numerator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # Optional. Text + alternative for the resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # Optional. + End time with inclusive + boundary, if not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "system": "str", # Optional. The + namespace for the identifier + value. + "type": { + "coding": [ + { + "code": "str", # + Optional. Symbol in + syntax defined by the + system. + "display": "str", # + Optional. + Representation + defined by the + system. + "extension": [ + ... + ], + "id": "str", # + Optional. Unique id + for inter-element + referencing. + "system": "str", # + Optional. Identity of + the terminology + system. + "version": "str" # + Optional. Version of + the system - if + relevant. + } + ], + "text": "str" # Optional. + Plain text representation of + the concept. + }, + "use": "str", # Optional. usual + | official | temp | secondary | + old (If known). + "value": "str" # Optional. The + value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, internal + or absolute URL. + "type": "str" # Optional. Type the + reference refers to (e.g. "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of sample + points at each time point. Required. + "origin": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. Decimal + values with spaces, or "E" | "U" | + "L". + "factor": 0.0, # Optional. Multiply + data by this before adding to origin. + "lowerLimit": 0.0, # Optional. Lower + limit of detection. + "upperLimit": 0.0 # Optional. Upper + limit of detection. + }, + "valueString": "str", # Optional. Value + as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ] + } + ] + }, + "authors": [ + { + "fullName": "str", # + Optional. Text representation of the full name. + "id": "str" # + Optional. author id. + } + ], + "clinicalType": "str", # Optional. + The type of the clinical document. Known values are: + "consultation", "dischargeSummary", "historyAndPhysical", + "radiologyReport", "procedure", "progress", "laboratory", and + "pathologyReport". + "createdAt": "2020-02-20 00:00:00", + # Optional. The date and time when the document was created. + "language": "str", # Optional. A 2 + letter ISO 639-1 representation of the language of the + document. + "specialtyType": "str" # Optional. + specialty type the document. Known values are: "pathology" + and "radiology". + } + ] + } + ], + "configuration": { + "includeEvidence": bool, # Optional. An indication whether + the model's output should include evidence for the inferences. + "inferenceOptions": { + "findingOptions": { + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide the sentence that contains the + first token of the finding's clinical indicator (i.e. the medical + problem), if there is one. This sentence is provided as an + extension with url 'ci_sentence', next to the token evidence. + Default is false. + }, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + # Optional. Include/Exclude follow-up recommendations in + references to a guideline or article. Default is false. + "includeRecommendationsWithNoSpecifiedModality": bool, # + Optional. Include/Exclude follow-up recommendations without a + specific radiology procedure. Default is false. + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide one or more sentences as + evidence for the recommendation, next to the token evidence. The + start and end positions of these sentences will be put in an + extension with url 'modality_sentences'. Default is false. + } + }, + "inferenceTypes": [ + "str" # Optional. This is a list of inference types + to be inferred for the current request. It could be used if only part + of the Radiology Insights inferences are required. If this list is + omitted or empty, the model will return all the inference types. + ], + "locale": "str", # Optional. Local for the model to use. If + not specified, the model will use the default locale. + "verbose": bool # Optional. An indication whether the model + should produce verbose output. + } + }, + "result": { + "modelVersion": "str", # The version of the model used for + inference, expressed as the model date. Required. + "patientResults": [ + { + "inferences": [ + radiology_insights_inference + ], + "patientId": "str" # Identifier given for the + patient in the request. Required. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. The date and time when the + processing job was last updated. + } + """ + + @distributed_trace_async + async def begin_infer_radiology_insights( + self, + id: str, + resource: Union[_models.RadiologyInsightsJob, JSON, IO[bytes]], + *, + expand: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.RadiologyInsightsJob]: + # pylint: disable=line-too-long + """Create Radiology Insights job. + + Creates a Radiology Insights job with the given request body. + + :param id: The unique ID of the job. Required. + :type id: str + :param resource: The resource instance. Is one of the following types: RadiologyInsightsJob, + JSON, IO[bytes] Required. + :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob or JSON or + IO[bytes] + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :return: An instance of AsyncLROPoller that returns RadiologyInsightsJob. The + RadiologyInsightsJob is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # The unique ID of the job. Required. + "status": "str", # The status of the job. Required. Known values are: + "notStarted", "running", "succeeded", "failed", and "canceled". + "createdAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job was created. + "error": { + "code": "str", # One of a server-defined set of error codes. + Required. + "message": "str", # A human-readable representation of the error. + Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a server-defined set of + error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "expiresAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job is set to expire. + "jobData": { + "patients": [ + { + "id": "str", # A given identifier for the patient. + Has to be unique across all patients in a single request. Required. + "details": { + "birthDate": "2020-02-20", # Optional. The + patient's date of birth. + "clinicalInfo": [ + { + "resourceType": "str", # The + type of resource. Required. + "id": "str", # Optional. + Resource Id. + "implicitRules": "str", # + Optional. A set of rules under which this content was + created. + "language": "str", # + Optional. Language of the resource content. + "meta": { + "lastUpdated": "str", + # Optional. When the resource last changed - e.g. + when the version changed. + "profile": [ + "str" # + Optional. A list of profiles (references to + `StructureDefinition + `_ + resources) that this resource claims to conform + to. The URL is a reference to + `StructureDefinition.url + `_. + ], + "security": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "source": "str", # + Optional. A uri that identifies the source system of + the resource. This provides a minimal amount of + Provenance information that can be used to track or + differentiate the source of information in the + resource. The source may identify another FHIR + server, document, message, database, etc. + "tag": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "versionId": "str" # + Optional. The version specific identifier, as it + appears in the version portion of the URL. This value + changes when the resource is created, updated, or + deleted. + } + } + ], + "sex": "str" # Optional. The patient's sex. + Known values are: "female", "male", and "unspecified". + }, + "encounters": [ + { + "id": "str", # The id of the visit. + Required. + "class": "str", # Optional. The + class of the encounter. Known values are: "inpatient", + "ambulatory", "observation", "emergency", "virtual", and + "healthHome". + "period": { + "end": "2020-02-20 00:00:00", + # Optional. End time with inclusive boundary, if not + ongoing. + "start": "2020-02-20 + 00:00:00" # Optional. Starting time with inclusive + boundary. + } + } + ], + "patientDocuments": [ + { + "content": { + "sourceType": "str", # The + type of the content's source. In case the source type is + 'inline', the content is given as a string (for instance, + text). In case the source type is 'reference', the + content is given as a URI. Required. Known values are: + "inline" and "reference". + "value": "str" # The content + of the document, given either inline (as a string) or as + a reference (URI). Required. + }, + "id": "str", # A given identifier + for the document. Has to be unique across all documents for a + single patient. Required. + "type": "str", # The type of the + patient document, such as 'note' (text document) or + 'fhirBundle' (FHIR JSON document). Required. Known values + are: "note", "fhirBundle", "dicom", and "genomicSequencing". + "administrativeMetadata": { + "encounterId": "str", # + Optional. Reference to the encounter associated with the + document. + "orderedProcedures": [ + { + "code": { + "coding": [ + { + "code": "str", # Optional. Symbol in + syntax defined by the system. + "display": "str", # Optional. + Representation defined by the system. + "extension": [ + { + "url": "str", # Source of + the definition for the + extension code - a logical + name or a URL. Required. + "valueBoolean": bool, # + Optional. Value as boolean. + "valueCodeableConcept": ..., + "valueDateTime": "str", # + Optional. Value as dateTime. + "valueInteger": 0, # + Optional. Value as integer. + "valuePeriod": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # + Optional. Coded form of + the unit. + "comparator": "str", # + Optional. < | <= | >= | > + - how to understand the + value. + "system": "str", # + Optional. System that + defines coded unit form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "low": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "numerator": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # + Optional. Text + alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End + time with + inclusive + boundary, if not + ongoing. + "start": "str" # + Optional. + Starting time + with inclusive + boundary. + }, + "system": "str", # + Optional. The + namespace for the + identifier value. + "type": ..., + "use": "str", # + Optional. usual | + official | temp | + secondary | old (If + known). + "value": "str" # + Optional. The value + that is unique. + }, + "reference": "str", # + Optional. Literal + reference, Relative, + internal or absolute URL. + "type": "str" # + Optional. Type the + reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # + Number of sample points + at each time point. + Required. + "origin": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, + "period": 0.0, # Number + of milliseconds between + samples. Required. + "data": "str", # + Optional. Decimal values + with spaces, or "E" | "U" + | "L". + "factor": 0.0, # + Optional. Multiply data + by this before adding to + origin. + "lowerLimit": 0.0, # + Optional. Lower limit of + detection. + "upperLimit": 0.0 # + Optional. Upper limit of + detection. + }, + "valueString": "str", # + Optional. Value as string. + "valueTime": "12:30:00" # + Optional. Value as time + (hh:mm:ss). + } + ], + "id": "str", # Optional. Unique id + for inter-element referencing. + "system": "str", # Optional. + Identity of the terminology system. + "version": "str" # Optional. Version + of the system - if relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "description": "str", # Optional. Procedure + description. + "extension": + [ + { + "url": "str", # Source of the definition + for the extension code - a logical name + or a URL. Required. + "valueBoolean": bool, # Optional. Value + as boolean. + "valueCodeableConcept": { + "coding": [ + { + "code": "str", # Optional. + Symbol in syntax defined by + the system. + "display": "str", # + Optional. Representation + defined by the system. + "extension": [ + ... + ], + "id": "str", # Optional. + Unique id for inter-element + referencing. + "system": "str", # Optional. + Identity of the terminology + system. + "version": "str" # Optional. + Version of the system - if + relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value as + integer. + "valuePeriod": { + "end": "str", # Optional. End time + with inclusive boundary, if not + ongoing. + "start": "str" # Optional. Starting + time with inclusive boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. < | + <= | >= | > - how to understand the + value. + "system": "str", # Optional. System + that defines coded unit form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. Numerical + value (with implicit precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "low": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "numerator": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + } + }, + "valueReference": { + "display": "str", # Optional. Text + alternative for the resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # Optional. + End time with inclusive + boundary, if not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "system": "str", # Optional. The + namespace for the identifier + value. + "type": { + "coding": [ + { + "code": "str", # + Optional. Symbol in + syntax defined by the + system. + "display": "str", # + Optional. + Representation + defined by the + system. + "extension": [ + ... + ], + "id": "str", # + Optional. Unique id + for inter-element + referencing. + "system": "str", # + Optional. Identity of + the terminology + system. + "version": "str" # + Optional. Version of + the system - if + relevant. + } + ], + "text": "str" # Optional. + Plain text representation of + the concept. + }, + "use": "str", # Optional. usual + | official | temp | secondary | + old (If known). + "value": "str" # Optional. The + value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, internal + or absolute URL. + "type": "str" # Optional. Type the + reference refers to (e.g. "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of sample + points at each time point. Required. + "origin": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. Decimal + values with spaces, or "E" | "U" | + "L". + "factor": 0.0, # Optional. Multiply + data by this before adding to origin. + "lowerLimit": 0.0, # Optional. Lower + limit of detection. + "upperLimit": 0.0 # Optional. Upper + limit of detection. + }, + "valueString": "str", # Optional. Value + as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ] + } + ] + }, + "authors": [ + { + "fullName": "str", # + Optional. Text representation of the full name. + "id": "str" # + Optional. author id. + } + ], + "clinicalType": "str", # Optional. + The type of the clinical document. Known values are: + "consultation", "dischargeSummary", "historyAndPhysical", + "radiologyReport", "procedure", "progress", "laboratory", and + "pathologyReport". + "createdAt": "2020-02-20 00:00:00", + # Optional. The date and time when the document was created. + "language": "str", # Optional. A 2 + letter ISO 639-1 representation of the language of the + document. + "specialtyType": "str" # Optional. + specialty type the document. Known values are: "pathology" + and "radiology". + } + ] + } + ], + "configuration": { + "includeEvidence": bool, # Optional. An indication whether + the model's output should include evidence for the inferences. + "inferenceOptions": { + "findingOptions": { + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide the sentence that contains the + first token of the finding's clinical indicator (i.e. the medical + problem), if there is one. This sentence is provided as an + extension with url 'ci_sentence', next to the token evidence. + Default is false. + }, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + # Optional. Include/Exclude follow-up recommendations in + references to a guideline or article. Default is false. + "includeRecommendationsWithNoSpecifiedModality": bool, # + Optional. Include/Exclude follow-up recommendations without a + specific radiology procedure. Default is false. + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide one or more sentences as + evidence for the recommendation, next to the token evidence. The + start and end positions of these sentences will be put in an + extension with url 'modality_sentences'. Default is false. + } + }, + "inferenceTypes": [ + "str" # Optional. This is a list of inference types + to be inferred for the current request. It could be used if only part + of the Radiology Insights inferences are required. If this list is + omitted or empty, the model will return all the inference types. + ], + "locale": "str", # Optional. Local for the model to use. If + not specified, the model will use the default locale. + "verbose": bool # Optional. An indication whether the model + should produce verbose output. + } + }, + "result": { + "modelVersion": "str", # The version of the model used for + inference, expressed as the model date. Required. + "patientResults": [ + { + "inferences": [ + radiology_insights_inference + ], + "patientId": "str" # Identifier given for the + patient in the request. Required. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. The date and time when the + processing job was last updated. + } + + # response body for status code(s): 201, 200 + response == { + "id": "str", # The unique ID of the job. Required. + "status": "str", # The status of the job. Required. Known values are: + "notStarted", "running", "succeeded", "failed", and "canceled". + "createdAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job was created. + "error": { + "code": "str", # One of a server-defined set of error codes. + Required. + "message": "str", # A human-readable representation of the error. + Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a server-defined set of + error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "expiresAt": "2020-02-20 00:00:00", # Optional. The date and time when the + processing job is set to expire. + "jobData": { + "patients": [ + { + "id": "str", # A given identifier for the patient. + Has to be unique across all patients in a single request. Required. + "details": { + "birthDate": "2020-02-20", # Optional. The + patient's date of birth. + "clinicalInfo": [ + { + "resourceType": "str", # The + type of resource. Required. + "id": "str", # Optional. + Resource Id. + "implicitRules": "str", # + Optional. A set of rules under which this content was + created. + "language": "str", # + Optional. Language of the resource content. + "meta": { + "lastUpdated": "str", + # Optional. When the resource last changed - e.g. + when the version changed. + "profile": [ + "str" # + Optional. A list of profiles (references to + `StructureDefinition + `_ + resources) that this resource claims to conform + to. The URL is a reference to + `StructureDefinition.url + `_. + ], + "security": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "source": "str", # + Optional. A uri that identifies the source system of + the resource. This provides a minimal amount of + Provenance information that can be used to track or + differentiate the source of information in the + resource. The source may identify another FHIR + server, document, message, database, etc. + "tag": [ + { + "code": "str", # Optional. Symbol in syntax + defined by the system. + "display": "str", # Optional. Representation + defined by the system. + "extension": [ + { + "url": "str", # Source of the + definition for the extension code - a + logical name or a URL. Required. + "valueBoolean": bool, # Optional. + Value as boolean. + "valueCodeableConcept": { + "coding": [ + ... + ], + "text": "str" # Optional. Plain + text representation of the + concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. + "valueInteger": 0, # Optional. Value + as integer. + "valuePeriod": { + "end": "str", # Optional. End + time with inclusive boundary, if + not ongoing. + "start": "str" # Optional. + Starting time with inclusive + boundary. + }, + "valueQuantity": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, + "valueRange": { + "high": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "low": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueRatio": { + "denominator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "numerator": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + } + }, + "valueReference": { + "display": "str", # Optional. + Text alternative for the + resource. + "identifier": { + "assigner": ..., + "period": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "system": "str", # Optional. + The namespace for the + identifier value. + "type": { + "coding": [ + ... + ], + "text": "str" # + Optional. Plain text + representation of the + concept. + }, + "use": "str", # Optional. + usual | official | temp | + secondary | old (If known). + "value": "str" # Optional. + The value that is unique. + }, + "reference": "str", # Optional. + Literal reference, Relative, + internal or absolute URL. + "type": "str" # Optional. Type + the reference refers to (e.g. + "Patient"). + }, + "valueSampledData": { + "dimensions": 0, # Number of + sample points at each time point. + Required. + "origin": { + "code": "str", # Optional. + Coded form of the unit. + "comparator": "str", # + Optional. < | <= | >= | > - + how to understand the value. + "system": "str", # Optional. + System that defines coded + unit form. + "unit": "str", # Optional. + Unit representation. + "value": 0.0 # Optional. + Numerical value (with + implicit precision). + }, + "period": 0.0, # Number of + milliseconds between samples. + Required. + "data": "str", # Optional. + Decimal values with spaces, or + "E" | "U" | "L". + "factor": 0.0, # Optional. + Multiply data by this before + adding to origin. + "lowerLimit": 0.0, # Optional. + Lower limit of detection. + "upperLimit": 0.0 # Optional. + Upper limit of detection. + }, + "valueString": "str", # Optional. + Value as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ], + "id": + "str", # Optional. Unique id for + inter-element referencing. + "system": "str", # Optional. Identity of the + terminology system. + "version": "str" # Optional. Version of the + system - if relevant. + } + ], + "versionId": "str" # + Optional. The version specific identifier, as it + appears in the version portion of the URL. This value + changes when the resource is created, updated, or + deleted. + } + } + ], + "sex": "str" # Optional. The patient's sex. + Known values are: "female", "male", and "unspecified". + }, + "encounters": [ + { + "id": "str", # The id of the visit. + Required. + "class": "str", # Optional. The + class of the encounter. Known values are: "inpatient", + "ambulatory", "observation", "emergency", "virtual", and + "healthHome". + "period": { + "end": "2020-02-20 00:00:00", + # Optional. End time with inclusive boundary, if not + ongoing. + "start": "2020-02-20 + 00:00:00" # Optional. Starting time with inclusive + boundary. + } + } + ], + "patientDocuments": [ + { + "content": { + "sourceType": "str", # The + type of the content's source. In case the source type is + 'inline', the content is given as a string (for instance, + text). In case the source type is 'reference', the + content is given as a URI. Required. Known values are: + "inline" and "reference". + "value": "str" # The content + of the document, given either inline (as a string) or as + a reference (URI). Required. + }, + "id": "str", # A given identifier + for the document. Has to be unique across all documents for a + single patient. Required. + "type": "str", # The type of the + patient document, such as 'note' (text document) or + 'fhirBundle' (FHIR JSON document). Required. Known values + are: "note", "fhirBundle", "dicom", and "genomicSequencing". + "administrativeMetadata": { + "encounterId": "str", # + Optional. Reference to the encounter associated with the + document. + "orderedProcedures": [ + { + "code": { + "coding": [ + { + "code": "str", # Optional. Symbol in + syntax defined by the system. + "display": "str", # Optional. + Representation defined by the system. + "extension": [ + { + "url": "str", # Source of + the definition for the + extension code - a logical + name or a URL. Required. + "valueBoolean": bool, # + Optional. Value as boolean. + "valueCodeableConcept": ..., + "valueDateTime": "str", # + Optional. Value as dateTime. + "valueInteger": 0, # + Optional. Value as integer. + "valuePeriod": { + "end": "str", # + Optional. End time with + inclusive boundary, if + not ongoing. + "start": "str" # + Optional. Starting time + with inclusive boundary. + }, + "valueQuantity": { "code": "str", # Optional. Coded form of the unit. @@ -1732,216 +6115,242 @@ async def begin_infer_radiology_insights( Numerical value (with implicit precision). }, + "valueRange": { + "high": { + "code": "str", # + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. + "system": "str", # + Optional. System that + defines coded unit + form. + "unit": "str", # + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). + }, "low": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). } }, "valueRatio": { "denominator": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). }, "numerator": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). } }, "valueReference": { "display": "str", # - Optional. Text alternative - for the resource. + Optional. Text + alternative for the + resource. "identifier": { "assigner": ..., "period": { "end": "str", # - Optional. End time - with inclusive - boundary, if not - ongoing. + Optional. End + time with + inclusive + boundary, if not + ongoing. "start": "str" # - Optional. Starting - time with inclusive - boundary. + Optional. + Starting time + with inclusive + boundary. }, "system": "str", # - Optional. The namespace - for the identifier value. + Optional. The + namespace for the + identifier value. "type": ..., "use": "str", # - Optional. usual | - official | temp | - secondary | old (If - known). + Optional. usual | + official | temp | + secondary | old (If + known). "value": "str" # - Optional. The value that - is unique. + Optional. The value + that is unique. }, "reference": "str", # - Optional. Literal reference, - Relative, internal or - absolute URL. - "type": "str" # Optional. - Type the reference refers to - (e.g. "Patient"). + Optional. Literal + reference, Relative, + internal or absolute URL. + "type": "str" # + Optional. Type the + reference refers to (e.g. + "Patient"). }, "valueSampledData": { - "dimensions": 0, # Number of - sample points at each time - point. Required. + "dimensions": 0, # + Number of sample points + at each time point. + Required. "origin": { "code": "str", # - Optional. Coded form of - the unit. - "comparator": "str", # - Optional. < | <= | >= | > - - how to understand the - value. + Optional. Coded form + of the unit. + "comparator": "str", + # Optional. < | <= | + >= | > - how to + understand the value. "system": "str", # - Optional. System that - defines coded unit form. + Optional. System that + defines coded unit + form. "unit": "str", # - Optional. Unit - representation. - "value": 0.0 # Optional. - Numerical value (with - implicit precision). + Optional. Unit + representation. + "value": 0.0 # + Optional. Numerical + value (with implicit + precision). }, - "period": 0.0, # Number of - milliseconds between samples. - Required. - "data": "str", # Optional. - Decimal values with spaces, - or "E" | "U" | "L". - "factor": 0.0, # Optional. - Multiply data by this before - adding to origin. + "period": 0.0, # Number + of milliseconds between + samples. Required. + "data": "str", # + Optional. Decimal values + with spaces, or "E" | "U" + | "L". + "factor": 0.0, # + Optional. Multiply data + by this before adding to + origin. "lowerLimit": 0.0, # - Optional. Lower limit of - detection. + Optional. Lower limit of + detection. "upperLimit": 0.0 # - Optional. Upper limit of - detection. + Optional. Upper limit of + detection. }, "valueString": "str", # - Optional. Value as string. + Optional. Value as string. "valueTime": "12:30:00" # - Optional. Value as time - (hh:mm:ss). + Optional. Value as time + (hh:mm:ss). } ], - "id": "str", # Optional. Unique id for - inter-element referencing. - "system": "str", # Optional. Identity of - the terminology system. - "version": "str" # Optional. Version of - the system - if relevant. - } - ], - "text": "str" - # Optional. Plain text representation of the - concept. - }, - "description": "str", - # Optional. Procedure description. - "extension": [ - { - "url": "str", # Source of the definition for - the extension code - a logical name or a URL. - Required. - "valueBoolean": bool, # Optional. Value as - boolean. + "id": "str", # Optional. Unique id + for inter-element referencing. + "system": "str", # Optional. + Identity of the terminology system. + "version": "str" # Optional. Version + of the system - if relevant. + } + ], + "text": "str" # Optional. Plain text + representation of the concept. + }, + "description": "str", # Optional. Procedure + description. + "extension": + [ + { + "url": "str", # Source of the definition + for the extension code - a logical name + or a URL. Required. + "valueBoolean": bool, # Optional. Value + as boolean. "valueCodeableConcept": { "coding": [ { "code": "str", # Optional. - Symbol in syntax defined by the - system. - "display": "str", # Optional. - Representation defined by the - system. + Symbol in syntax defined by + the system. + "display": "str", # + Optional. Representation + defined by the system. "extension": [ ... ], - "id": "str", # Optional. Unique - id for inter-element referencing. + "id": "str", # Optional. + Unique id for inter-element + referencing. "system": "str", # Optional. - Identity of the terminology - system. + Identity of the terminology + system. "version": "str" # Optional. - Version of the system - if - relevant. + Version of the system - if + relevant. } ], "text": "str" # Optional. Plain text - representation of the concept. - }, - "valueDateTime": "str", # Optional. Value as - dateTime. + representation of the concept. + }, + "valueDateTime": "str", # Optional. + Value as dateTime. "valueInteger": 0, # Optional. Value as - integer. + integer. "valuePeriod": { - "end": "str", # Optional. End time with - inclusive boundary, if not ongoing. - "start": "str" # Optional. Starting time - with inclusive boundary. - }, + "end": "str", # Optional. End time + with inclusive boundary, if not + ongoing. + "start": "str" # Optional. Starting + time with inclusive boundary. + }, "valueQuantity": { - "code": "str", # Optional. Coded form of - the unit. - "comparator": "str", # Optional. < | <= - | >= | > - how to understand the value. - "system": "str", # Optional. System that - defines coded unit form. - "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical value - (with implicit precision). - }, - "valueRange": { - "high": { "code": "str", # Optional. Coded form of the unit. "comparator": "str", # Optional. < | @@ -1954,239 +6363,279 @@ async def begin_infer_radiology_insights( "value": 0.0 # Optional. Numerical value (with implicit precision). }, + "valueRange": { + "high": { + "code": "str", # Optional. Coded + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. + "unit": "str", # Optional. Unit + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). + }, "low": { "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). } - }, + }, "valueRatio": { "denominator": { "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). }, "numerator": { "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). } - }, + }, "valueReference": { "display": "str", # Optional. Text - alternative for the resource. + alternative for the resource. "identifier": { "assigner": ..., "period": { - "end": "str", # Optional. End - time with inclusive boundary, if - not ongoing. + "end": "str", # Optional. + End time with inclusive + boundary, if not ongoing. "start": "str" # Optional. - Starting time with inclusive - boundary. + Starting time with inclusive + boundary. }, "system": "str", # Optional. The - namespace for the identifier value. + namespace for the identifier + value. "type": { "coding": [ { "code": "str", # - Optional. Symbol in - syntax defined by the - system. + Optional. Symbol in + syntax defined by the + system. "display": "str", # - Optional. Representation - defined by the system. + Optional. + Representation + defined by the + system. "extension": [ ... ], - "id": "str", # Optional. - Unique id for - inter-element - referencing. + "id": "str", # + Optional. Unique id + for inter-element + referencing. "system": "str", # - Optional. Identity of the - terminology system. + Optional. Identity of + the terminology + system. "version": "str" # - Optional. Version of the - system - if relevant. + Optional. Version of + the system - if + relevant. } ], - "text": "str" # Optional. Plain - text representation of the - concept. + "text": "str" # Optional. + Plain text representation of + the concept. }, - "use": "str", # Optional. usual | - official | temp | secondary | old (If - known). - "value": "str" # Optional. The value - that is unique. + "use": "str", # Optional. usual + | official | temp | secondary | + old (If known). + "value": "str" # Optional. The + value that is unique. }, - "reference": "str", # Optional. Literal - reference, Relative, internal or absolute - URL. + "reference": "str", # Optional. + Literal reference, Relative, internal + or absolute URL. "type": "str" # Optional. Type the - reference refers to (e.g. "Patient"). - }, + reference refers to (e.g. "Patient"). + }, "valueSampledData": { "dimensions": 0, # Number of sample - points at each time point. Required. + points at each time point. Required. "origin": { "code": "str", # Optional. Coded - form of the unit. - "comparator": "str", # Optional. < | - <= | >= | > - how to understand the - value. - "system": "str", # Optional. System - that defines coded unit form. + form of the unit. + "comparator": "str", # Optional. + < | <= | >= | > - how to + understand the value. + "system": "str", # Optional. + System that defines coded unit + form. "unit": "str", # Optional. Unit - representation. - "value": 0.0 # Optional. Numerical - value (with implicit precision). + representation. + "value": 0.0 # Optional. + Numerical value (with implicit + precision). }, - "period": 0.0, # Number of milliseconds - between samples. Required. + "period": 0.0, # Number of + milliseconds between samples. + Required. "data": "str", # Optional. Decimal - values with spaces, or "E" | "U" | "L". - "factor": 0.0, # Optional. Multiply data - by this before adding to origin. + values with spaces, or "E" | "U" | + "L". + "factor": 0.0, # Optional. Multiply + data by this before adding to origin. "lowerLimit": 0.0, # Optional. Lower - limit of detection. + limit of detection. "upperLimit": 0.0 # Optional. Upper - limit of detection. - }, - "valueString": "str", # Optional. Value as - string. - "valueTime": "12:30:00" # Optional. Value as - time (hh:mm:ss). - } - ] + limit of detection. + }, + "valueString": "str", # Optional. Value + as string. + "valueTime": "12:30:00" # Optional. + Value as time (hh:mm:ss). + } + ] + } + ] + }, + "authors": [ + { + "fullName": "str", # + Optional. Text representation of the full name. + "id": "str" # + Optional. author id. } - ] - }, - "authors": [ - { - "fullName": "str", # - Optional. Text representation of the full name. - "id": "str" # Optional. - author id. - } - ], - "clinicalType": "str", # Optional. The type - of the clinical document. Known values are: "consultation", - "dischargeSummary", "historyAndPhysical", "radiologyReport", - "procedure", "progress", "laboratory", and "pathologyReport". - "createdDateTime": "2020-02-20 00:00:00", # - Optional. The date and time when the document was created. - "language": "str", # Optional. A 2 letter - ISO 639-1 representation of the language of the document. - "specialtyType": "str" # Optional. specialty - type the document. Known values are: "pathology" and "radiology". - } - ] - } - ], - "configuration": { - "includeEvidence": bool, # Optional. An indication whether the - model's output should include evidence for the inferences. - "inferenceOptions": { - "findingOptions": { - "provideFocusedSentenceEvidence": bool # Optional. - If this is true, provide the sentence that contains the first token - of the finding's clinical indicator (i.e. the medical problem), if - there is one. This sentence is provided as an extension with url - 'ci_sentence', next to the token evidence. Default is false. - }, - "followupRecommendationOptions": { - "includeRecommendationsInReferences": bool, # - Optional. Include/Exclude follow-up recommendations in references to - a guideline or article. Default is false. - "includeRecommendationsWithNoSpecifiedModality": - bool, # Optional. Include/Exclude follow-up recommendations without - a specific radiology procedure. Default is false. - "provideFocusedSentenceEvidence": bool # Optional. - If this is true, provide one or more sentences as evidence for the - recommendation, next to the token evidence. The start and end - positions of these sentences will be put in an extension with url - 'modality_sentences'. Default is false. + ], + "clinicalType": "str", # Optional. + The type of the clinical document. Known values are: + "consultation", "dischargeSummary", "historyAndPhysical", + "radiologyReport", "procedure", "progress", "laboratory", and + "pathologyReport". + "createdAt": "2020-02-20 00:00:00", + # Optional. The date and time when the document was created. + "language": "str", # Optional. A 2 + letter ISO 639-1 representation of the language of the + document. + "specialtyType": "str" # Optional. + specialty type the document. Known values are: "pathology" + and "radiology". + } + ] } - }, - "inferenceTypes": [ - "str" # Optional. This is a list of inference types to be - inferred for the current request. It could be used if only part of the - Radiology Insights inferences are required. If this list is omitted or - empty, the model will return all the inference types. ], - "locale": "str", # Optional. Local for the model to use. If not - specified, the model will use the default locale. - "verbose": bool # Optional. An indication whether the model should - produce verbose output. - } - } - - # response body for status code(s): 202 - response == { - "modelVersion": "str", # The version of the model used for inference, - expressed as the model date. Required. - "patientResults": [ - { - "inferences": [ - radiology_insights_inference + "configuration": { + "includeEvidence": bool, # Optional. An indication whether + the model's output should include evidence for the inferences. + "inferenceOptions": { + "findingOptions": { + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide the sentence that contains the + first token of the finding's clinical indicator (i.e. the medical + problem), if there is one. This sentence is provided as an + extension with url 'ci_sentence', next to the token evidence. + Default is false. + }, + "followupRecommendationOptions": { + "includeRecommendationsInReferences": bool, + # Optional. Include/Exclude follow-up recommendations in + references to a guideline or article. Default is false. + "includeRecommendationsWithNoSpecifiedModality": bool, # + Optional. Include/Exclude follow-up recommendations without a + specific radiology procedure. Default is false. + "provideFocusedSentenceEvidence": bool # + Optional. If this is true, provide one or more sentences as + evidence for the recommendation, next to the token evidence. The + start and end positions of these sentences will be put in an + extension with url 'modality_sentences'. Default is false. + } + }, + "inferenceTypes": [ + "str" # Optional. This is a list of inference types + to be inferred for the current request. It could be used if only part + of the Radiology Insights inferences are required. If this list is + omitted or empty, the model will return all the inference types. ], - "patientId": "str" # Identifier given for the patient in the - request. Required. + "locale": "str", # Optional. Local for the model to use. If + not specified, the model will use the default locale. + "verbose": bool # Optional. An indication whether the model + should produce verbose output. } - ] + }, + "result": { + "modelVersion": "str", # The version of the model used for + inference, expressed as the model date. Required. + "patientResults": [ + { + "inferences": [ + radiology_insights_inference + ], + "patientId": "str" # Identifier given for the + patient in the request. Required. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. The date and time when the + processing job was last updated. } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RadiologyInsightsInferenceResult] = kwargs.pop("cls", None) + cls: ClsType[_models.RadiologyInsightsJob] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._infer_radiology_insights_initial( - body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + id=id, + resource=resource, + expand=expand, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) response_headers["Operation-Location"] = self._deserialize( "str", response.headers.get("Operation-Location") ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - response_headers["Repeatability-Result"] = self._deserialize( - "str", response.headers.get("Repeatability-Result") - ) deserialized = _deserialize(_models.RadiologyInsightsInferenceResult, response.json().get("result")) if cls: @@ -2207,12 +6656,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.RadiologyInsightsInferenceResult].from_continuation_token( + return AsyncLROPoller[_models.RadiologyInsightsJob].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.RadiologyInsightsInferenceResult]( + return AsyncLROPoller[_models.RadiologyInsightsJob]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/_patch.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/_patch.py index f7dd32510333d..bea194113765d 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/_patch.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/aio/_operations/_patch.py @@ -6,10 +6,192 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload, MutableMapping +__all__: List[str] = [ + "RadiologyInsightsClientOperationsMixin" +] # Add all objects you want publicly available to users at this package level + +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict + +from ... import models as _models +from ..._model_base import _deserialize +from ._operations import RadiologyInsightsClientOperationsMixin as GeneratedRadiologyInsightsClientOperationsMixin + +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +class RadiologyInsightsClientOperationsMixin(GeneratedRadiologyInsightsClientOperationsMixin): + + @overload # type: ignore[override] + async def begin_infer_radiology_insights( + self, + id: str, + resource: _models.RadiologyInsightsJob, + *, + expand: Optional[List[str]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RadiologyInsightsInferenceResult]: + # pylint: disable=line-too-long + """Create Radiology Insights inference result. + + Creates a Radiology Insights inference result with the given request body. + + :param id: The unique ID of the inference result. Required. + :type id: str + :param resource: The resource instance. Required. + :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] + :raises ~azure.core.exceptions.HttpResponseError:""" + + @overload # type: ignore[override] + async def begin_infer_radiology_insights( + self, + id: str, + resource: JSON, + *, + expand: Optional[List[str]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RadiologyInsightsInferenceResult]: + # pylint: disable=line-too-long + """Create Radiology Insights inference result. + + Creates a Radiology Insights inference result with the given request body. + + :param id: The unique ID of the inference result. Required. + :type id: str + :param resource: The resource instance. Required. + :type resource: JSON + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] + :raises ~azure.core.exceptions.HttpResponseError:""" + + @overload # type: ignore[override] + async def begin_infer_radiology_insights( + self, + id: str, + resource: IO[bytes], + *, + expand: Optional[List[str]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RadiologyInsightsInferenceResult]: + # pylint: disable=line-too-long + """Create Radiology Insights inference result. + + Creates a Radiology Insights inference result with the given request body. + + :param id: The unique ID of the inference result. Required. + :type id: str + :param resource: The resource instance. Required. + :type resource: IO[bytes] + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] + :raises ~azure.core.exceptions.HttpResponseError:""" + + @distributed_trace_async # type: ignore[override] + async def begin_infer_radiology_insights( + self, + id: str, + resource: Union[_models.RadiologyInsightsJob, JSON, IO[bytes]], + *, + expand: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.RadiologyInsightsInferenceResult]: + # pylint: disable=line-too-long + """Create Radiology Insights inference result. + + Creates a Radiology Insights inference result with the given request body. + + :param id: The unique ID of the inference result. Required. + :type id: str + :param resource: The resource instance. Is one of the following types: RadiologyInsightsJob, JSON, IO[bytes] Required. + :type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob or JSON or IO[bytes] + :keyword expand: Expand the indicated resources into the response. Default value is None. + :paramtype expand: list[str] + :return: An instance of AsyncLROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult] + :raises ~azure.core.exceptions.HttpResponseError:""" + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RadiologyInsightsJob] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._infer_radiology_insights_initial( + id=id, + resource=resource, + expand=expand, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + )# type: ignore + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = _deserialize(_models.RadiologyInsightsInferenceResult, response.json().get("result")) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.RadiologyInsightsInferenceResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller[_models.RadiologyInsightsInferenceResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def patch_sdk(): """Do not remove from this file. diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/__init__.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/__init__.py index 92be83c71ea11..7cece9451f9a9 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/__init__.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/__init__.py @@ -22,7 +22,6 @@ from ._models import DocumentContent from ._models import DomainResource from ._models import Element -from ._models import Encounter from ._models import Error from ._models import Extension from ._models import FindingInference @@ -31,7 +30,7 @@ from ._models import FollowupRecommendationInference from ._models import FollowupRecommendationOptions from ._models import GenericProcedureRecommendation -from ._models import HealthInsightsOperationStatus +from ._models import HealthInsightsErrorResponse from ._models import Identifier from ._models import ImagingProcedure from ._models import ImagingProcedureRecommendation @@ -46,6 +45,7 @@ from ._models import OrderedProcedure from ._models import PatientDetails from ._models import PatientDocument +from ._models import PatientEncounter from ._models import PatientRecord from ._models import Period from ._models import ProcedureRecommendation @@ -55,9 +55,9 @@ from ._models import RadiologyInsightsInference from ._models import RadiologyInsightsInferenceOptions from ._models import RadiologyInsightsInferenceResult +from ._models import RadiologyInsightsJob from ._models import RadiologyInsightsModelConfiguration from ._models import RadiologyInsightsPatientResult -from ._models import RadiologyInsightsResult from ._models import RadiologyProcedureInference from ._models import Range from ._models import Ratio @@ -84,7 +84,6 @@ from ._enums import PatientSex from ._enums import RadiologyInsightsInferenceType from ._enums import RecommendationFindingStatusType -from ._enums import RepeatabilityResult from ._enums import ResearchStudyStatusCodeType from ._enums import SpecialtyType from ._patch import __all__ as _patch_all @@ -108,7 +107,6 @@ "DocumentContent", "DomainResource", "Element", - "Encounter", "Error", "Extension", "FindingInference", @@ -117,7 +115,7 @@ "FollowupRecommendationInference", "FollowupRecommendationOptions", "GenericProcedureRecommendation", - "HealthInsightsOperationStatus", + "HealthInsightsErrorResponse", "Identifier", "ImagingProcedure", "ImagingProcedureRecommendation", @@ -132,6 +130,7 @@ "OrderedProcedure", "PatientDetails", "PatientDocument", + "PatientEncounter", "PatientRecord", "Period", "ProcedureRecommendation", @@ -141,9 +140,9 @@ "RadiologyInsightsInference", "RadiologyInsightsInferenceOptions", "RadiologyInsightsInferenceResult", + "RadiologyInsightsJob", "RadiologyInsightsModelConfiguration", "RadiologyInsightsPatientResult", - "RadiologyInsightsResult", "RadiologyProcedureInference", "Range", "Ratio", @@ -169,7 +168,6 @@ "PatientSex", "RadiologyInsightsInferenceType", "RecommendationFindingStatusType", - "RepeatabilityResult", "ResearchStudyStatusCodeType", "SpecialtyType", ] diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/_enums.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/_enums.py index b8c0850bdbd67..b0d874d8dc4e1 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/_enums.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/_enums.py @@ -223,19 +223,6 @@ class RecommendationFindingStatusType(str, Enum, metaclass=CaseInsensitiveEnumMe """Conditional finding status""" -class RepeatabilityResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Repeatability Result header options.""" - - ACCEPTED = "accepted" - """If the request was accepted and the server guarantees that the server state reflects a single - execution of the operation.""" - REJECTED = "rejected" - """If the request was rejected because the combination of Repeatability-First-Sent and - Repeatability-Request-ID were invalid - or because the Repeatability-First-Sent value was outside the range of values held by the - server.""" - - class ResearchStudyStatusCodeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """https://www.hl7.org/fhir/R4/codesystem-research-study-status.html.""" diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/_models.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/_models.py index 3f0ab07911ad4..cbaa0c66168bd 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/_models.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/azure/healthinsights/radiologyinsights/models/_models.py @@ -42,22 +42,22 @@ class RadiologyInsightsInference(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar extension: Additional Content defined by implementations. - :vartype extension: list[~azure.healthinsights.radiologyinsights.models.Extension] :ivar kind: Required. Known values are: "ageMismatch", "lateralityDiscrepancy", "sexMismatch", "completeOrderDiscrepancy", "limitedOrderDiscrepancy", "finding", "criticalResult", "followupRecommendation", "followupCommunication", and "radiologyProcedure". :vartype kind: str or ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceType + :ivar extension: Additional Content defined by implementations. + :vartype extension: list[~azure.healthinsights.radiologyinsights.models.Extension] """ __mapping__: Dict[str, _model_base.Model] = {} - extension: Optional[List["_models.Extension"]] = rest_field() - """Additional Content defined by implementations.""" kind: str = rest_discriminator(name="kind") """Required. Known values are: \"ageMismatch\", \"lateralityDiscrepancy\", \"sexMismatch\", \"completeOrderDiscrepancy\", \"limitedOrderDiscrepancy\", \"finding\", \"criticalResult\", \"followupRecommendation\", \"followupCommunication\", and \"radiologyProcedure\".""" + extension: Optional[List["_models.Extension"]] = rest_field() + """Additional Content defined by implementations.""" @overload def __init__( @@ -65,8 +65,7 @@ def __init__( *, kind: str, extension: Optional[List["_models.Extension"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -99,8 +98,7 @@ def __init__( self, *, extension: Optional[List["_models.Extension"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -115,7 +113,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class Element(_model_base.Model): """The base definition for all elements contained inside a resource. - Based on `FHIR Element `_. + Based on `FHIR Element `_. :ivar id: Unique id for inter-element referencing. :vartype id: str @@ -134,8 +132,7 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin extension: Optional[List["_models.Extension"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -182,8 +179,7 @@ def __init__( extension: Optional[List["_models.Extension"]] = None, author_string: Optional[str] = None, time: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -217,8 +213,7 @@ def __init__( *, coding: Optional[List["_models.Coding"]] = None, text: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -268,8 +263,7 @@ def __init__( version: Optional[str] = None, code: Optional[str] = None, display: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -325,8 +319,7 @@ def __init__( extension: Optional[List["_models.Extension"]] = None, missing_body_parts: Optional[List["_models.CodeableConcept"]] = None, missing_body_part_measurements: Optional[List["_models.CodeableConcept"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -378,8 +371,7 @@ def __init__( meta: Optional["_models.Meta"] = None, implicit_rules: Optional[str] = None, language: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -397,7 +389,7 @@ class DomainResource(Resource): Based on `FHIR DomainResource `_. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - Condition, ResearchStudy + Condition, Observation, ResearchStudy All required parameters must be populated in order to send to server. @@ -409,6 +401,8 @@ class DomainResource(Resource): :vartype implicit_rules: str :ivar language: Language of the resource content. :vartype language: str + :ivar resource_type: Required. Default value is None. + :vartype resource_type: str :ivar text: Text summary of the resource, for human interpretation. :vartype text: ~azure.healthinsights.radiologyinsights.models.Narrative :ivar contained: Contained, inline Resources. @@ -417,11 +411,11 @@ class DomainResource(Resource): :vartype extension: list[~azure.healthinsights.radiologyinsights.models.Extension] :ivar modifier_extension: Extensions that cannot be ignored. :vartype modifier_extension: list[~azure.healthinsights.radiologyinsights.models.Extension] - :ivar resource_type: Required. Default value is None. - :vartype resource_type: str """ __mapping__: Dict[str, _model_base.Model] = {} + resource_type: str = rest_discriminator(name="resourceType") + """Required. Default value is None.""" text: Optional["_models.Narrative"] = rest_field() """Text summary of the resource, for human interpretation.""" contained: Optional[List["_models.Resource"]] = rest_field() @@ -430,8 +424,6 @@ class DomainResource(Resource): """Additional Content defined by implementations.""" modifier_extension: Optional[List["_models.Extension"]] = rest_field(name="modifierExtension") """Extensions that cannot be ignored.""" - resource_type: str = rest_discriminator(name="resourceType") - """Required. Default value is None.""" @overload def __init__( @@ -446,8 +438,7 @@ def __init__( contained: Optional[List["_models.Resource"]] = None, extension: Optional[List["_models.Extension"]] = None, modifier_extension: Optional[List["_models.Extension"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -607,8 +598,7 @@ def __init__( recorded_date: Optional[str] = None, stage: Optional[List["_models.ConditionStage"]] = None, note: Optional[List["_models.Annotation"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -642,8 +632,7 @@ def __init__( *, summary: Optional["_models.CodeableConcept"] = None, type: Optional["_models.CodeableConcept"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -682,8 +671,7 @@ def __init__( extension: Optional[List["_models.Extension"]] = None, name: Optional[str] = None, telecom: Optional[List["_models.ContactPoint"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -737,8 +725,7 @@ def __init__( use: Optional[Union[str, "_models.ContactPointUse"]] = None, rank: Optional[int] = None, period: Optional["_models.Period"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -773,8 +760,7 @@ def __init__( *, description: str, finding: Optional["_models.Observation"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -814,8 +800,7 @@ def __init__( *, result: "_models.CriticalResult", extension: Optional[List["_models.Extension"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -849,8 +834,7 @@ def __init__( *, ordered_procedures: Optional[List["_models.OrderedProcedure"]] = None, encounter_id: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -883,8 +867,7 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin full_name: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -928,55 +911,7 @@ def __init__( *, source_type: Union[str, "_models.DocumentContentSourceType"], value: str, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class Encounter(_model_base.Model): - """visit/encounter information. - - All required parameters must be populated in order to send to server. - - :ivar id: The id of the visit. Required. - :vartype id: str - :ivar period: Time period of the visit. - In case of admission, use timePeriod.start to indicate the admission time and timePeriod.end - to indicate the discharge time. - :vartype period: ~azure.healthinsights.radiologyinsights.models.TimePeriod - :ivar class_property: The class of the encounter. Known values are: "inpatient", "ambulatory", - "observation", "emergency", "virtual", and "healthHome". - :vartype class_property: str or ~azure.healthinsights.radiologyinsights.models.EncounterClass - """ - - id: str = rest_field() - """The id of the visit. Required.""" - period: Optional["_models.TimePeriod"] = rest_field() - """Time period of the visit. - In case of admission, use timePeriod.start to indicate the admission time and timePeriod.end to - indicate the discharge time.""" - class_property: Optional[Union[str, "_models.EncounterClass"]] = rest_field(name="class") - """The class of the encounter. Known values are: \"inpatient\", \"ambulatory\", \"observation\", - \"emergency\", \"virtual\", and \"healthHome\".""" - - @overload - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - period: Optional["_models.TimePeriod"] = None, - class_property: Optional[Union[str, "_models.EncounterClass"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1027,8 +962,7 @@ def __init__( target: Optional[str] = None, details: Optional[List["_models.Error"]] = None, innererror: Optional["_models.InnerError"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1119,8 +1053,7 @@ def __init__( value_date_time: Optional[str] = None, value_period: Optional["_models.Period"] = None, value_reference: Optional["_models.Reference"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1159,8 +1092,7 @@ def __init__( *, finding: "_models.Observation", extension: Optional[List["_models.Extension"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1193,8 +1125,7 @@ def __init__( self, *, provide_focused_sentence_evidence: Optional[bool] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1217,8 +1148,8 @@ class FollowupCommunicationInference(RadiologyInsightsInference, discriminator=" :vartype extension: list[~azure.healthinsights.radiologyinsights.models.Extension] :ivar kind: Inference type. Required. Followup Communication inference type :vartype kind: str or ~azure.healthinsights.radiologyinsights.models.FOLLOWUP_COMMUNICATION - :ivar date_time: Communication date and time. - :vartype date_time: list[~datetime.datetime] + :ivar communicated_at: Communication date and time. + :vartype communicated_at: list[~datetime.datetime] :ivar recipient: Recipient of the communication. :vartype recipient: list[str or ~azure.healthinsights.radiologyinsights.models.MedicalProfessionalType] @@ -1228,7 +1159,7 @@ class FollowupCommunicationInference(RadiologyInsightsInference, discriminator=" kind: Literal[RadiologyInsightsInferenceType.FOLLOWUP_COMMUNICATION] = rest_discriminator(name="kind") # type: ignore """Inference type. Required. Followup Communication inference type""" - date_time: Optional[List[datetime.datetime]] = rest_field(name="dateTime", format="rfc3339") + communicated_at: Optional[List[datetime.datetime]] = rest_field(name="communicatedAt", format="rfc3339") """Communication date and time.""" recipient: Optional[List[Union[str, "_models.MedicalProfessionalType"]]] = rest_field() """Recipient of the communication.""" @@ -1241,10 +1172,9 @@ def __init__( *, was_acknowledged: bool, extension: Optional[List["_models.Extension"]] = None, - date_time: Optional[List[datetime.datetime]] = None, + communicated_at: Optional[List[datetime.datetime]] = None, recipient: Optional[List[Union[str, "_models.MedicalProfessionalType"]]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1267,9 +1197,9 @@ class FollowupRecommendationInference(RadiologyInsightsInference, discriminator= :vartype extension: list[~azure.healthinsights.radiologyinsights.models.Extension] :ivar kind: Inference type. Required. Recommendation inference type :vartype kind: str or ~azure.healthinsights.radiologyinsights.models.FOLLOWUP_RECOMMENDATION - :ivar effective_date_time: Date and time are displayed when the procedure is recommended to be - done at a specific point in time. - :vartype effective_date_time: str + :ivar effective_at: Date and time are displayed when the procedure is recommended to be done at + a specific point in time. + :vartype effective_at: str :ivar effective_period: The period is shown if a specific period is mentioned, with a start and end date-time. :vartype effective_period: ~azure.healthinsights.radiologyinsights.models.Period @@ -1297,7 +1227,7 @@ class FollowupRecommendationInference(RadiologyInsightsInference, discriminator= kind: Literal[RadiologyInsightsInferenceType.FOLLOWUP_RECOMMENDATION] = rest_discriminator(name="kind") # type: ignore """Inference type. Required. Recommendation inference type""" - effective_date_time: Optional[str] = rest_field(name="effectiveDateTime") + effective_at: Optional[str] = rest_field(name="effectiveAt") """Date and time are displayed when the procedure is recommended to be done at a specific point in time.""" effective_period: Optional["_models.Period"] = rest_field(name="effectivePeriod") @@ -1331,11 +1261,10 @@ def __init__( is_hedging: bool, recommended_procedure: "_models.ProcedureRecommendation", extension: Optional[List["_models.Extension"]] = None, - effective_date_time: Optional[str] = None, + effective_at: Optional[str] = None, effective_period: Optional["_models.Period"] = None, findings: Optional[List["_models.RecommendationFinding"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1383,8 +1312,7 @@ def __init__( include_recommendations_with_no_specified_modality: Optional[bool] = None, include_recommendations_in_references: Optional[bool] = None, provide_focused_sentence_evidence: Optional[bool] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1407,19 +1335,23 @@ class ProcedureRecommendation(_model_base.Model): :ivar kind: Required. Default value is None. :vartype kind: str + :ivar extension: Additional Content defined by implementations. + :vartype extension: list[~azure.healthinsights.radiologyinsights.models.Extension] """ __mapping__: Dict[str, _model_base.Model] = {} kind: str = rest_discriminator(name="kind") """Required. Default value is None.""" + extension: Optional[List["_models.Extension"]] = rest_field() + """Additional Content defined by implementations.""" @overload def __init__( self, *, kind: str, - ): - ... + extension: Optional[List["_models.Extension"]] = None, + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1437,6 +1369,8 @@ class GenericProcedureRecommendation(ProcedureRecommendation, discriminator="gen All required parameters must be populated in order to send to server. + :ivar extension: Additional Content defined by implementations. + :vartype extension: list[~azure.healthinsights.radiologyinsights.models.Extension] :ivar kind: Procedure type : generic. Required. Default value is "genericProcedureRecommendation". :vartype kind: str @@ -1460,9 +1394,9 @@ def __init__( self, *, code: "_models.CodeableConcept", + extension: Optional[List["_models.Extension"]] = None, description: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1475,61 +1409,24 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, kind="genericProcedureRecommendation", **kwargs) -class HealthInsightsOperationStatus(_model_base.Model): - """Provides status details for long running operations. - - Readonly variables are only populated by the server, and will be ignored when sending a request. +class HealthInsightsErrorResponse(_model_base.Model): + """A response containing error details. All required parameters must be populated in order to send to server. - :ivar id: The unique ID of the operation. Required. - :vartype id: str - :ivar status: The status of the operation. Required. Known values are: "notStarted", "running", - "succeeded", "failed", and "canceled". - :vartype status: str or ~azure.healthinsights.radiologyinsights.models.JobStatus - :ivar created_date_time: The date and time when the processing job was created. - :vartype created_date_time: ~datetime.datetime - :ivar expiration_date_time: The date and time when the processing job is set to expire. - :vartype expiration_date_time: ~datetime.datetime - :ivar last_update_date_time: The date and time when the processing job was last updated. - :vartype last_update_date_time: ~datetime.datetime - :ivar error: Error object that describes the error when status is "Failed". + :ivar error: The error object. Required. :vartype error: ~azure.healthinsights.radiologyinsights.models.Error - :ivar result: The result of the operation. - :vartype result: - ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult """ - id: str = rest_field(visibility=["read"]) - """The unique ID of the operation. Required.""" - status: Union[str, "_models.JobStatus"] = rest_field(visibility=["read"]) - """The status of the operation. Required. Known values are: \"notStarted\", \"running\", - \"succeeded\", \"failed\", and \"canceled\".""" - created_date_time: Optional[datetime.datetime] = rest_field( - name="createdDateTime", visibility=["read"], format="rfc3339" - ) - """The date and time when the processing job was created.""" - expiration_date_time: Optional[datetime.datetime] = rest_field( - name="expirationDateTime", visibility=["read"], format="rfc3339" - ) - """The date and time when the processing job is set to expire.""" - last_update_date_time: Optional[datetime.datetime] = rest_field( - name="lastUpdateDateTime", visibility=["read"], format="rfc3339" - ) - """The date and time when the processing job was last updated.""" - error: Optional["_models.Error"] = rest_field() - """Error object that describes the error when status is \"Failed\".""" - result: Optional["_models.RadiologyInsightsInferenceResult"] = rest_field() - """The result of the operation.""" + error: "_models.Error" = rest_field() + """The error object. Required.""" @overload def __init__( self, *, - error: Optional["_models.Error"] = None, - result: Optional["_models.RadiologyInsightsInferenceResult"] = None, - ): - ... + error: "_models.Error", + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1583,8 +1480,7 @@ def __init__( value: Optional[str] = None, period: Optional["_models.Period"] = None, assigner: Optional["_models.Reference"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1634,8 +1530,7 @@ def __init__( laterality: Optional["_models.CodeableConcept"] = None, contrast: Optional["_models.RadiologyCodeWithTypes"] = None, view: Optional["_models.RadiologyCodeWithTypes"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1653,6 +1548,8 @@ class ImagingProcedureRecommendation(ProcedureRecommendation, discriminator="ima All required parameters must be populated in order to send to server. + :ivar extension: Additional Content defined by implementations. + :vartype extension: list[~azure.healthinsights.radiologyinsights.models.Extension] :ivar kind: Procedure type : imaging. Required. Default value is "imagingProcedureRecommendation". :vartype kind: str @@ -1675,9 +1572,9 @@ def __init__( self, *, imaging_procedures: List["_models.ImagingProcedure"], + extension: Optional[List["_models.Extension"]] = None, procedure_codes: Optional[List["_models.CodeableConcept"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1712,8 +1609,7 @@ def __init__( *, code: Optional[str] = None, innererror: Optional["_models.InnerError"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1763,8 +1659,7 @@ def __init__( discrepancy_type: Union[str, "_models.LateralityDiscrepancyType"], extension: Optional[List["_models.Extension"]] = None, laterality_indication: Optional["_models.CodeableConcept"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1819,8 +1714,7 @@ def __init__( extension: Optional[List["_models.Extension"]] = None, present_body_parts: Optional[List["_models.CodeableConcept"]] = None, present_body_part_measurements: Optional[List["_models.CodeableConcept"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1893,8 +1787,7 @@ def __init__( profile: Optional[List[str]] = None, security: Optional[List["_models.Coding"]] = None, tag: Optional[List["_models.Coding"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1938,8 +1831,7 @@ def __init__( div: str, id: Optional[str] = None, # pylint: disable=redefined-builtin extension: Optional[List["_models.Extension"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -1952,12 +1844,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class Observation(DomainResource): # pylint: disable=too-many-instance-attributes +class Observation(DomainResource, discriminator="Observation"): # pylint: disable=too-many-instance-attributes """Detailed information about observations Based on `FHIR Observation `_. - Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. :ivar id: Resource Id. @@ -2044,7 +1934,7 @@ class Observation(DomainResource): # pylint: disable=too-many-instance-attribut :vartype component: list[~azure.healthinsights.radiologyinsights.models.ObservationComponent] """ - resource_type: Literal["Observation"] = rest_field(name="resourceType") + resource_type: Literal["Observation"] = rest_discriminator(name="resourceType") # type: ignore """resourceType. Required. Default value is \"Observation\".""" identifier: Optional[List["_models.Identifier"]] = rest_field() """Business Identifier for observation.""" @@ -2151,8 +2041,7 @@ def __init__( has_member: Optional[List["_models.Reference"]] = None, derived_from: Optional[List["_models.Reference"]] = None, component: Optional[List["_models.ObservationComponent"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2161,9 +2050,8 @@ def __init__(self, mapping: Mapping[str, Any]): :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.resource_type: Literal["Observation"] = "Observation" + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, resource_type="Observation", **kwargs) class ObservationComponent(Element): # pylint: disable=too-many-instance-attributes @@ -2266,8 +2154,7 @@ def __init__( data_absent_reason: Optional["_models.CodeableConcept"] = None, interpretation: Optional[List["_models.CodeableConcept"]] = None, reference_range: Optional[List["_models.ObservationReferenceRange"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2321,8 +2208,7 @@ def __init__( applies_to: Optional[List["_models.CodeableConcept"]] = None, age: Optional["_models.Range"] = None, text: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2338,30 +2224,29 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class OrderedProcedure(_model_base.Model): """Procedure information. - :ivar extension: Additional Content defined by implementations. - :vartype extension: list[~azure.healthinsights.radiologyinsights.models.Extension] :ivar code: Procedure code. :vartype code: ~azure.healthinsights.radiologyinsights.models.CodeableConcept :ivar description: Procedure description. :vartype description: str + :ivar extension: Additional Content defined by implementations. + :vartype extension: list[~azure.healthinsights.radiologyinsights.models.Extension] """ - extension: Optional[List["_models.Extension"]] = rest_field() - """Additional Content defined by implementations.""" code: Optional["_models.CodeableConcept"] = rest_field() """Procedure code.""" description: Optional[str] = rest_field() """Procedure description.""" + extension: Optional[List["_models.Extension"]] = rest_field() + """Additional Content defined by implementations.""" @overload def __init__( self, *, - extension: Optional[List["_models.Extension"]] = None, code: Optional["_models.CodeableConcept"] = None, description: Optional[str] = None, - ): - ... + extension: Optional[List["_models.Extension"]] = None, + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2400,8 +2285,7 @@ def __init__( sex: Optional[Union[str, "_models.PatientSex"]] = None, birth_date: Optional[datetime.date] = None, clinical_info: Optional[List["_models.Resource"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2434,8 +2318,8 @@ class PatientDocument(_model_base.Model): :vartype id: str :ivar language: A 2 letter ISO 639-1 representation of the language of the document. :vartype language: str - :ivar created_date_time: The date and time when the document was created. - :vartype created_date_time: ~datetime.datetime + :ivar created_at: The date and time when the document was created. + :vartype created_at: ~datetime.datetime :ivar authors: Document author(s). :vartype authors: list[~azure.healthinsights.radiologyinsights.models.DocumentAuthor] :ivar specialty_type: specialty type the document. Known values are: "pathology" and @@ -2461,7 +2345,7 @@ class PatientDocument(_model_base.Model): patient. Required.""" language: Optional[str] = rest_field() """A 2 letter ISO 639-1 representation of the language of the document.""" - created_date_time: Optional[datetime.datetime] = rest_field(name="createdDateTime", format="rfc3339") + created_at: Optional[datetime.datetime] = rest_field(name="createdAt", format="rfc3339") """The date and time when the document was created.""" authors: Optional[List["_models.DocumentAuthor"]] = rest_field() """Document author(s).""" @@ -2483,12 +2367,57 @@ def __init__( content: "_models.DocumentContent", clinical_type: Optional[Union[str, "_models.ClinicalDocumentType"]] = None, language: Optional[str] = None, - created_date_time: Optional[datetime.datetime] = None, + created_at: Optional[datetime.datetime] = None, authors: Optional[List["_models.DocumentAuthor"]] = None, specialty_type: Optional[Union[str, "_models.SpecialtyType"]] = None, administrative_metadata: Optional["_models.DocumentAdministrativeMetadata"] = None, - ): - ... + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class PatientEncounter(_model_base.Model): + """visit/encounter information. + + All required parameters must be populated in order to send to server. + + :ivar id: The id of the visit. Required. + :vartype id: str + :ivar period: Time period of the visit. + In case of admission, use timePeriod.start to indicate the admission time and timePeriod.end + to indicate the discharge time. + :vartype period: ~azure.healthinsights.radiologyinsights.models.TimePeriod + :ivar class_property: The class of the encounter. Known values are: "inpatient", "ambulatory", + "observation", "emergency", "virtual", and "healthHome". + :vartype class_property: str or ~azure.healthinsights.radiologyinsights.models.EncounterClass + """ + + id: str = rest_field() + """The id of the visit. Required.""" + period: Optional["_models.TimePeriod"] = rest_field() + """Time period of the visit. + In case of admission, use timePeriod.start to indicate the admission time and timePeriod.end to + indicate the discharge time.""" + class_property: Optional[Union[str, "_models.EncounterClass"]] = rest_field(name="class") + """The class of the encounter. Known values are: \"inpatient\", \"ambulatory\", \"observation\", + \"emergency\", \"virtual\", and \"healthHome\".""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + period: Optional["_models.TimePeriod"] = None, + class_property: Optional[Union[str, "_models.EncounterClass"]] = None, + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2509,11 +2438,11 @@ class PatientRecord(_model_base.Model): :ivar id: A given identifier for the patient. Has to be unique across all patients in a single request. Required. :vartype id: str - :ivar info: Patient structured information, including demographics and known structured + :ivar details: Patient structured information, including demographics and known structured clinical information. - :vartype info: ~azure.healthinsights.radiologyinsights.models.PatientDetails + :vartype details: ~azure.healthinsights.radiologyinsights.models.PatientDetails :ivar encounters: Patient encounters/visits. - :vartype encounters: list[~azure.healthinsights.radiologyinsights.models.Encounter] + :vartype encounters: list[~azure.healthinsights.radiologyinsights.models.PatientEncounter] :ivar patient_documents: Patient unstructured clinical data, given as documents. :vartype patient_documents: list[~azure.healthinsights.radiologyinsights.models.PatientDocument] @@ -2522,10 +2451,10 @@ class PatientRecord(_model_base.Model): id: str = rest_field() """A given identifier for the patient. Has to be unique across all patients in a single request. Required.""" - info: Optional["_models.PatientDetails"] = rest_field() + details: Optional["_models.PatientDetails"] = rest_field() """Patient structured information, including demographics and known structured clinical information.""" - encounters: Optional[List["_models.Encounter"]] = rest_field() + encounters: Optional[List["_models.PatientEncounter"]] = rest_field() """Patient encounters/visits.""" patient_documents: Optional[List["_models.PatientDocument"]] = rest_field(name="patientDocuments") """Patient unstructured clinical data, given as documents.""" @@ -2535,11 +2464,10 @@ def __init__( self, *, id: str, # pylint: disable=redefined-builtin - info: Optional["_models.PatientDetails"] = None, - encounters: Optional[List["_models.Encounter"]] = None, + details: Optional["_models.PatientDetails"] = None, + encounters: Optional[List["_models.PatientEncounter"]] = None, patient_documents: Optional[List["_models.PatientDocument"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2573,8 +2501,7 @@ def __init__( *, start: Optional[str] = None, end: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2623,8 +2550,7 @@ def __init__( unit: Optional[str] = None, system: Optional[str] = None, code: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2665,8 +2591,7 @@ def __init__( *, code: "_models.CodeableConcept", types: List["_models.CodeableConcept"], - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2702,8 +2627,7 @@ def __init__( *, patients: List["_models.PatientRecord"], configuration: Optional["_models.RadiologyInsightsModelConfiguration"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2739,8 +2663,7 @@ def __init__( *, followup_recommendation_options: Optional["_models.FollowupRecommendationOptions"] = None, finding_options: Optional["_models.FindingOptions"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2778,8 +2701,70 @@ def __init__( *, patient_results: List["_models.RadiologyInsightsPatientResult"], model_version: str, - ): - ... + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + +class RadiologyInsightsJob(_model_base.Model): + """Response for the Radiology Insights request. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar job_data: The request data for the operation. + :vartype job_data: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsData + :ivar result: The result of the operation. + :vartype result: + ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult + :ivar id: The unique ID of the job. Required. + :vartype id: str + :ivar status: The status of the job. Required. Known values are: "notStarted", "running", + "succeeded", "failed", and "canceled". + :vartype status: str or ~azure.healthinsights.radiologyinsights.models.JobStatus + :ivar created_at: The date and time when the processing job was created. + :vartype created_at: ~datetime.datetime + :ivar expires_at: The date and time when the processing job is set to expire. + :vartype expires_at: ~datetime.datetime + :ivar updated_at: The date and time when the processing job was last updated. + :vartype updated_at: ~datetime.datetime + :ivar error: Error object that describes the error when status is "Failed". + :vartype error: ~azure.healthinsights.radiologyinsights.models.Error + """ + + job_data: Optional["_models.RadiologyInsightsData"] = rest_field(name="jobData", visibility=["read", "create"]) + """The request data for the operation.""" + result: Optional["_models.RadiologyInsightsInferenceResult"] = rest_field(visibility=["read"]) + """The result of the operation.""" + id: str = rest_field(visibility=["read"]) + """The unique ID of the job. Required.""" + status: Union[str, "_models.JobStatus"] = rest_field(visibility=["read"]) + """The status of the job. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", + \"failed\", and \"canceled\".""" + created_at: Optional[datetime.datetime] = rest_field(name="createdAt", visibility=["read"], format="rfc3339") + """The date and time when the processing job was created.""" + expires_at: Optional[datetime.datetime] = rest_field(name="expiresAt", visibility=["read"], format="rfc3339") + """The date and time when the processing job is set to expire.""" + updated_at: Optional[datetime.datetime] = rest_field(name="updatedAt", visibility=["read"], format="rfc3339") + """The date and time when the processing job was last updated.""" + error: Optional["_models.Error"] = rest_field(visibility=["read"]) + """Error object that describes the error when status is \"Failed\".""" + + @overload + def __init__( + self, + *, + job_data: Optional["_models.RadiologyInsightsData"] = None, + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2838,8 +2823,7 @@ def __init__( inference_types: Optional[List[Union[str, "_models.RadiologyInsightsInferenceType"]]] = None, inference_options: Optional["_models.RadiologyInsightsInferenceOptions"] = None, locale: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2875,75 +2859,7 @@ def __init__( *, patient_id: str, inferences: List["_models.RadiologyInsightsInference"], - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class RadiologyInsightsResult(_model_base.Model): - """Response for the Radiology Insights request. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: The unique ID of the operation. Required. - :vartype id: str - :ivar status: The status of the operation. Required. Known values are: "notStarted", "running", - "succeeded", "failed", and "canceled". - :vartype status: str or ~azure.healthinsights.radiologyinsights.models.JobStatus - :ivar created_date_time: The date and time when the processing job was created. - :vartype created_date_time: ~datetime.datetime - :ivar expiration_date_time: The date and time when the processing job is set to expire. - :vartype expiration_date_time: ~datetime.datetime - :ivar last_update_date_time: The date and time when the processing job was last updated. - :vartype last_update_date_time: ~datetime.datetime - :ivar error: Error object that describes the error when status is "Failed". - :vartype error: ~azure.healthinsights.radiologyinsights.models.Error - :ivar result: The result of the operation. - :vartype result: - ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult - """ - - id: str = rest_field(visibility=["read"]) - """The unique ID of the operation. Required.""" - status: Union[str, "_models.JobStatus"] = rest_field(visibility=["read"]) - """The status of the operation. Required. Known values are: \"notStarted\", \"running\", - \"succeeded\", \"failed\", and \"canceled\".""" - created_date_time: Optional[datetime.datetime] = rest_field( - name="createdDateTime", visibility=["read"], format="rfc3339" - ) - """The date and time when the processing job was created.""" - expiration_date_time: Optional[datetime.datetime] = rest_field( - name="expirationDateTime", visibility=["read"], format="rfc3339" - ) - """The date and time when the processing job is set to expire.""" - last_update_date_time: Optional[datetime.datetime] = rest_field( - name="lastUpdateDateTime", visibility=["read"], format="rfc3339" - ) - """The date and time when the processing job was last updated.""" - error: Optional["_models.Error"] = rest_field() - """Error object that describes the error when status is \"Failed\".""" - result: Optional["_models.RadiologyInsightsInferenceResult"] = rest_field() - """The result of the operation.""" - - @overload - def __init__( - self, - *, - error: Optional["_models.Error"] = None, - result: Optional["_models.RadiologyInsightsInferenceResult"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -2993,8 +2909,7 @@ def __init__( ordered_procedure: "_models.OrderedProcedure", extension: Optional[List["_models.Extension"]] = None, procedure_codes: Optional[List["_models.CodeableConcept"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -3028,8 +2943,7 @@ def __init__( *, low: Optional["_models.Quantity"] = None, high: Optional["_models.Quantity"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -3063,8 +2977,7 @@ def __init__( *, numerator: Optional["_models.Quantity"] = None, denominator: Optional["_models.Quantity"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -3082,8 +2995,6 @@ class RecommendationFinding(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar extension: Additional Content defined by implementations. - :vartype extension: list[~azure.healthinsights.radiologyinsights.models.Extension] :ivar finding: Finding linked to a recommendation. :vartype finding: ~azure.healthinsights.radiologyinsights.models.Observation :ivar critical_finding: Critical result linked to a recommendation. @@ -3092,10 +3003,10 @@ class RecommendationFinding(_model_base.Model): "present", "differential", "ruleOut", and "conditional". :vartype recommendation_finding_status: str or ~azure.healthinsights.radiologyinsights.models.RecommendationFindingStatusType + :ivar extension: Additional Content defined by implementations. + :vartype extension: list[~azure.healthinsights.radiologyinsights.models.Extension] """ - extension: Optional[List["_models.Extension"]] = rest_field() - """Additional Content defined by implementations.""" finding: Optional["_models.Observation"] = rest_field() """Finding linked to a recommendation.""" critical_finding: Optional["_models.CriticalResult"] = rest_field(name="criticalFinding") @@ -3105,17 +3016,18 @@ class RecommendationFinding(_model_base.Model): ) """Recommendation finding status. Required. Known values are: \"present\", \"differential\", \"ruleOut\", and \"conditional\".""" + extension: Optional[List["_models.Extension"]] = rest_field() + """Additional Content defined by implementations.""" @overload def __init__( self, *, recommendation_finding_status: Union[str, "_models.RecommendationFindingStatusType"], - extension: Optional[List["_models.Extension"]] = None, finding: Optional["_models.Observation"] = None, critical_finding: Optional["_models.CriticalResult"] = None, - ): - ... + extension: Optional[List["_models.Extension"]] = None, + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -3159,8 +3071,7 @@ def __init__( type: Optional[str] = None, identifier: Optional["_models.Identifier"] = None, display: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -3348,8 +3259,7 @@ def __init__( note: Optional[List["_models.Annotation"]] = None, arm: Optional[List["_models.ResearchStudyArm"]] = None, objective: Optional[List["_models.ResearchStudyObjective"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -3389,8 +3299,7 @@ def __init__( name: str, type: Optional["_models.CodeableConcept"] = None, description: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -3425,8 +3334,7 @@ def __init__( *, name: str, type: Optional["_models.CodeableConcept"] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -3487,8 +3395,7 @@ def __init__( lower_limit: Optional[float] = None, upper_limit: Optional[float] = None, data: Optional[str] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -3528,8 +3435,7 @@ def __init__( *, sex_indication: "_models.CodeableConcept", extension: Optional[List["_models.Extension"]] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): @@ -3562,8 +3468,7 @@ def __init__( *, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None, - ): - ... + ): ... @overload def __init__(self, mapping: Mapping[str, Any]): diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/dev_requirements.txt b/sdk/healthinsights/azure-healthinsights-radiologyinsights/dev_requirements.txt index 1054864714443..bbf9950db8518 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/dev_requirements.txt +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/dev_requirements.txt @@ -1,3 +1,4 @@ -e ../../../tools/azure-sdk-tools ../../core/azure-core -aiohttp \ No newline at end of file +aiohttp +azure-identity \ No newline at end of file diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_age_mismatch_inference.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_age_mismatch_inference.py new file mode 100644 index 0000000000000..cf7a31f6905a3 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_age_mismatch_inference.py @@ -0,0 +1,149 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_age_mismatch_inference.py + +DESCRIPTION: +The sample_age_mismatch_inference.py module processes a sample radiology document with the Radiology Insights service. +It will initialize a RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display +-the Age Mismatch patient ID, +-the Age Mismatch url extension, +-the Age Mismatch offset extension, +-the Age Mismatch length extension, and +-the Age Mismatch evidence + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_age_mismatch_inference.py + +""" +import datetime +import os +import uuid + + +from azure.identity import DefaultAzureCredential +from azure.healthinsights.radiologyinsights import RadiologyInsightsClient +from azure.healthinsights.radiologyinsights import models + +def radiology_insights_sync() -> None: + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + # Health Insights Radiology Insights + try: + poller = radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = poller.result() + display_age_mismatch(radiology_insights_result, doc_content1) + except Exception as ex: + raise ex + +def display_age_mismatch(radiology_insights_result, doc_content1): + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.AGE_MISMATCH: + print(f"Age Mismatch Inference found") + print(f"Age Mismatch: Patient ID: {patient_result.patient_id}") + Tokens = "" + for extension in ri_inference.extension: + for attribute in dir(extension): + if attribute == "extension": + offset = -1 + length = -1 + for sub_extension in extension.extension: + for sub_attribute in dir(sub_extension): + if sub_attribute == "url": + if sub_extension.url.startswith("http"): + continue + elif sub_extension.url == "offset": + offset = sub_extension.value_integer + elif sub_extension.url == "length": + length = sub_extension.value_integer + if offset > 0 and length > 0: + evidence = doc_content1[offset : offset + length] + if not evidence in Tokens: + Tokens = Tokens + " " + evidence + print(f"Age Mismatch: Evidence: {Tokens}") + +if __name__ == "__main__": + radiology_insights_sync() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_age_mismatch_inference_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_age_mismatch_inference_async.py new file mode 100644 index 0000000000000..ba861c06ad678 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_age_mismatch_inference_async.py @@ -0,0 +1,161 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_age_mismatch_inference_async.py + +DESCRIPTION: +The sample_age_mismatch_inference_async.py module processes a sample radiology document with the Radiology Insights service. +It will initialize an asynchronous RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display +-the Age Mismatch patient ID, +-the Age Mismatch url extension, +-the Age Mismatch offset extension, +-the Age Mismatch length extension, and +-the Age Mismatch evidence + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_age_mismatch_inference_async.py +""" + +import asyncio +import datetime +import os +import uuid +from azure.healthinsights.radiologyinsights import models + +async def radiology_insights_async() -> None: + + from azure.identity.aio import DefaultAzureCredential + from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient + + # [START create_radiology_insights_client] + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential=credential) + # [END create_radiology_insights_client] + + # [START create_radiology_insights_request] + doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + # [END create_radiology_insights_request] + + try: + async with radiology_insights_client: + poller = await radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = await poller.result() + display_age_mismatch(radiology_insights_result, doc_content1) + except Exception as ex: + raise ex + + +def display_age_mismatch(radiology_insights_result, doc_content1): + # [START display_age_mismatch] + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.AGE_MISMATCH: + print(f"Age Mismatch Inference found") + print(f"Age Mismatch: Patient ID: {patient_result.patient_id}") + Tokens = "" + for extension in ri_inference.extension: + for attribute in dir(extension): + if attribute == "extension": + offset = -1 + length = -1 + for sub_extension in extension.extension: + for sub_attribute in dir(sub_extension): + if sub_attribute == "url": + if sub_extension.url.startswith("http"): + continue + elif sub_extension.url == "offset": + offset = sub_extension.value_integer + elif sub_extension.url == "length": + length = sub_extension.value_integer + if offset > 0 and length > 0: + evidence = doc_content1[offset : offset + length] + if not evidence in Tokens: + Tokens = Tokens + " " + evidence + print(f"Age Mismatch: Evidence: {Tokens}") + +# [END display_age_mismatch] + +if __name__ == "__main__": + try: + asyncio.run(radiology_insights_async()) + except Exception as ex: + raise ex diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_complete_order_discrepancy_inference.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_complete_order_discrepancy_inference.py new file mode 100644 index 0000000000000..90156e77a2486 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_complete_order_discrepancy_inference.py @@ -0,0 +1,145 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + + +""" +FILE: sample_complete_order_discrepancy_inference.py + +DESCRIPTION: +The sample_complete_order_discrepancy_inference.py module processes a sample radiology document with the Radiology Insights service. +It will initialize a RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display +-the Complete Order Discrepancy order type, +-the missing body parts, and +-the missing body part measurements + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_complete_order_discrepancy_inference.py + +""" +import datetime +import os +import uuid + +from azure.identity import DefaultAzureCredential +from azure.healthinsights.radiologyinsights import RadiologyInsightsClient +from azure.healthinsights.radiologyinsights import models + +def radiology_insights_sync() -> None: + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + # Health Insights Radiology Insights + try: + poller = radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = poller.result() + display_complete_order_discrepancy(radiology_insights_result) + except Exception as ex: + raise ex + +def display_complete_order_discrepancy(radiology_insights_result): + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.COMPLETE_ORDER_DISCREPANCY: + print(f"Complete Order Discrepancy Inference found") + ordertype = ri_inference.order_type + for coding in ordertype.coding: + print(f"Complete Order Discrepancy: Order Type: {coding.system} {coding.code} {coding.display}") + if not ri_inference.missing_body_parts: + print(f"Complete Order Discrepancy: Missing Body Parts: empty list") + else: + for missingbodypart in ri_inference.missing_body_parts: + for coding in missingbodypart.coding: + print( + f"Complete Order Discrepancy: Missing Body Part: {coding.system} {coding.code} {coding.display}" + ) + if not ri_inference.missing_body_part_measurements: + print(f"Complete Order Discrepancy: Missing Body Part Measurements: empty list") + else: + for missingbodypartmeasurement in ri_inference.missing_body_part_measurements: + for coding in missingbodypartmeasurement.coding: + print( + f"Complete Order Discrepancy: Missing Body Part Measurement: {coding.system} {coding.code} {coding.display}" + ) + +if __name__ == "__main__": + radiology_insights_sync() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_complete_order_discrepancy_inference_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_complete_order_discrepancy_inference_async.py new file mode 100644 index 0000000000000..d48d99bd92263 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_complete_order_discrepancy_inference_async.py @@ -0,0 +1,158 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + + +""" +FILE: sample_complete_order_discrepancy_inference_async.py + +DESCRIPTION: +The sample_complete_order_discrepancy_inference_async.py module processes a sample radiology document with the Radiology Insights service. +It will initialize an asynchronous RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display +-the Complete Order Discrepancy order type, +-the missing body parts, and +-the missing body part measurements + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_complete_order_discrepancy_inference_async.py + +""" + +import asyncio +import datetime +import os +import uuid + +from azure.healthinsights.radiologyinsights import models + +async def radiology_insights_async() -> None: + + from azure.identity.aio import DefaultAzureCredential + from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient + + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + try: + async with radiology_insights_client: + poller = await radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = await poller.result() + + display_complete_order_discrepancy(radiology_insights_result) + except Exception as ex: + raise ex + + +def display_complete_order_discrepancy(radiology_insights_result): + # [START display_complete_order_discrepancy] + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.COMPLETE_ORDER_DISCREPANCY: + print(f"Complete Order Discrepancy Inference found") + ordertype = ri_inference.order_type + for coding in ordertype.coding: + print(f"Complete Order Discrepancy: Order Type: {coding.system} {coding.code} {coding.display}") + if not ri_inference.missing_body_parts: + print(f"Complete Order Discrepancy: Missing Body Parts: empty list") + else: + for missingbodypart in ri_inference.missing_body_parts: + for coding in missingbodypart.coding: + print( + f"Complete Order Discrepancy: Missing Body Part: {coding.system} {coding.code} {coding.display}" + ) + if not ri_inference.missing_body_part_measurements: + print(f"Complete Order Discrepancy: Missing Body Part Measurements: empty list") + else: + for missingbodypartmeasurement in ri_inference.missing_body_part_measurements: + for coding in missingbodypartmeasurement.coding: + print( + f"Complete Order Discrepancy: Missing Body Part Measurement: {coding.system} {coding.code} {coding.display}" + ) + + # [END display_complete_order_discrepancy] + + +if __name__ == "__main__": + try: + asyncio.run(radiology_insights_async()) + except Exception as ex: + raise ex diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_critical_result_inference.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_critical_result_inference.py index 0fc939d5d75b1..6ef5f271db05f 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_critical_result_inference.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_critical_result_inference.py @@ -1,122 +1,124 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -import datetime -import os - -from azure.core.credentials import AzureKeyCredential -from azure.healthinsights.radiologyinsights import RadiologyInsightsClient -from azure.healthinsights.radiologyinsights import models - """ FILE: sample_critical_result_inference.py DESCRIPTION: The sample_critical_result_inference.py module processes a sample radiology document with the Radiology Insights service. It will initialize a RadiologyInsightsClient, build a Radiology Insights request with the sample document, -submit it to the client, RadiologyInsightsClient, build a Radiology Insights job request with the sample document, -submit it to the client and display the Critical Results description extracted by the Radiology Insights service. +submit it to the client, RadiologyInsightsClient, and display the Critical Results description. USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_critical_result_inference.py """ +import datetime +import os +import uuid -class HealthInsightsSyncSamples: - def radiology_insights_sync(self) -> None: - KEY = os.environ["AZURE_HEALTH_INSIGHTS_API_KEY"] - ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] - - radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential=AzureKeyCredential(KEY)) - - doc_content1 = """CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. - FINDINGS: - The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" - - # Create ordered procedure - procedure_coding = models.Coding( - system="Http://hl7.org/fhir/ValueSet/cpt-all", - code="USPELVIS", - display="US PELVIS COMPLETE", - ) - procedure_code = models.CodeableConcept(coding=[procedure_coding]) - ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) - # Create encounter - start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) - end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) - encounter = models.Encounter( - id="encounter2", - class_property=models.EncounterClass.IN_PATIENT, - period=models.TimePeriod(start=start, end=end), - ) - # Create patient info - birth_date = datetime.date(1959, 11, 11) - patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) - # Create author - author = models.DocumentAuthor(id="author2", full_name="authorName2") - - create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) - patient_document1 = models.PatientDocument( - type=models.DocumentType.NOTE, - clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, - id="doc2", - content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), - created_date_time=create_date_time, - specialty_type=models.SpecialtyType.RADIOLOGY, - administrative_metadata=models.DocumentAdministrativeMetadata( - ordered_procedures=[ordered_procedure], encounter_id="encounter2" - ), - authors=[author], - language="en", - ) +from azure.identity import DefaultAzureCredential +from azure.healthinsights.radiologyinsights import RadiologyInsightsClient +from azure.healthinsights.radiologyinsights import models - # Construct patient - patient1 = models.PatientRecord( - id="patient_id2", - info=patient_info, - encounters=[encounter], - patient_documents=[patient_document1], +def radiology_insights_sync() -> None: + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + # Health Insights Radiology Insights + try: + poller = radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, ) - - # Create a configuration - configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") - - # Construct the request with the patient and configuration - radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration) - - # Health Insights Radiology Insights - try: - poller = radiology_insights_client.begin_infer_radiology_insights( - radiology_insights_data, - ) - radiology_insights_result = poller.result() - self.display_critical_results(radiology_insights_result) - except Exception as ex: - print(str(ex)) - return - - def display_critical_results(self, radiology_insights_result): - for patient_result in radiology_insights_result.patient_results: - for ri_inference in patient_result.inferences: - if ri_inference.kind == models.RadiologyInsightsInferenceType.CRITICAL_RESULT: - critical_result = ri_inference.result - print(f"Critical Result Inference found: {critical_result.description}") - - -def main(): - sample = HealthInsightsSyncSamples() - sample.radiology_insights_sync() - + radiology_insights_result = poller.result() + display_critical_results(radiology_insights_result) + except Exception as ex: + raise ex + +def display_critical_results(radiology_insights_result): + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.CRITICAL_RESULT: + critical_result = ri_inference.result + print(f"Critical Result Inference found: {critical_result.description}") if __name__ == "__main__": - main() + radiology_insights_sync() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_critical_result_inference_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_critical_result_inference_async.py index 18d66cf70a538..23feb382ac1cb 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_critical_result_inference_async.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_critical_result_inference_async.py @@ -1,127 +1,137 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -import asyncio -import datetime -import os - - -from azure.core.credentials import AzureKeyCredential -from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient -from azure.healthinsights.radiologyinsights import models - """ FILE: sample_critical_result_inference_async.py DESCRIPTION: The sample_critical_result_inference_async.py module processes a sample radiology document with the Radiology Insights service. It will initialize an asynchronous RadiologyInsightsClient, build a Radiology Insights request with the sample document, -submit it to the client, RadiologyInsightsClient, build a Radiology Insights job request with the sample document, -submit it to the client and display the Critical Results description extracted by the Radiology Insights service. +submit it to the client, RadiologyInsightsClient, and display the Critical Result description. USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_critical_result_inference_async.py """ +import asyncio +import datetime +import os +import uuid + +from azure.healthinsights.radiologyinsights import models -class HealthInsightsSamples: - async def radiology_insights_async(self) -> None: - # [START create_radiology_insights_client] - KEY = os.environ["AZURE_HEALTH_INSIGHTS_API_KEY"] - ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] - - radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential=AzureKeyCredential(KEY)) - # [END create_radiology_insights_client] - doc_content1 = """CLINICAL HISTORY: - 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. - COMPARISON: - Right upper quadrant sonographic performed 1 day prior. - TECHNIQUE: - Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. - FINDINGS: - The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. - IMPRESSION: - 1. Normal pelvic sonography. Findings of testicular torsion. - A new US pelvis within the next 6 months is recommended. - These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" - - # Create ordered procedure - procedure_coding = models.Coding( - system="Http://hl7.org/fhir/ValueSet/cpt-all", - code="USPELVIS", - display="US PELVIS COMPLETE", - ) - procedure_code = models.CodeableConcept(coding=[procedure_coding]) - ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) - # Create encounter - start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) - end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) - encounter = models.Encounter( - id="encounter2", - class_property=models.EncounterClass.IN_PATIENT, - period=models.TimePeriod(start=start, end=end), - ) - # Create patient info - birth_date = datetime.date(1959, 11, 11) - patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) - # Create author - author = models.DocumentAuthor(id="author2", full_name="authorName2") - - create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) - patient_document1 = models.PatientDocument( - type=models.DocumentType.NOTE, - clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, - id="doc2", - content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), - created_date_time=create_date_time, - specialty_type=models.SpecialtyType.RADIOLOGY, - administrative_metadata=models.DocumentAdministrativeMetadata( - ordered_procedures=[ordered_procedure], encounter_id="encounter2" - ), - authors=[author], - language="en", - ) - - # Construct patient - patient1 = models.PatientRecord( - id="patient_id2", - info=patient_info, - encounters=[encounter], - patient_documents=[patient_document1], - ) - - # Create a configuration - configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") - - # Construct the request with the patient and configuration - radiology_insights_data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration) - - try: +async def radiology_insights_async() -> None: + + from azure.identity.aio import DefaultAzureCredential + from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient + + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + try: + async with radiology_insights_client: poller = await radiology_insights_client.begin_infer_radiology_insights( - radiology_insights_data, + id=job_id, + resource=patient_data, ) radiology_insights_result = await poller.result() - self.display_critical_results(radiology_insights_result) - except Exception as ex: - print(str(ex)) - return + + display_critical_results(radiology_insights_result) + except Exception as ex: + raise ex - def display_critical_results(self, radiology_insights_result): - # [START display_critical_results] - for patient_result in radiology_insights_result.patient_results: - for ri_inference in patient_result.inferences: - if ri_inference.kind == models.RadiologyInsightsInferenceType.CRITICAL_RESULT: - critical_result = ri_inference.result - print(f"Critical Result Inference found: {critical_result.description}") - # [END display_critical_results] +def display_critical_results(radiology_insights_result): + # [START display_critical_result] + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.CRITICAL_RESULT: + critical_result = ri_inference.result + print(f"Critical Result Inference found: {critical_result.description}") -async def main(): - sample = HealthInsightsSamples() - await sample.radiology_insights_async() +# [END display_critical_result] if __name__ == "__main__": - asyncio.run(main()) + try: + asyncio.run(radiology_insights_async()) + except Exception as ex: + raise ex diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_finding_inference.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_finding_inference.py new file mode 100644 index 0000000000000..59511ec186279 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_finding_inference.py @@ -0,0 +1,241 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_finding_inference.py + +DESCRIPTION: +The sample_finding_inference.py module processes a sample radiology document with the Radiology Insights service. +It will initialize a RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display +-the Finding resource type, +-the Finding ID, +-the Finding status, +-the Finding category code, +-the Finding code, +-the Finding interpretation, +-the Finding components, +-the Finding component code, +-the Finding component value codeable concept, +-the Finding component value coding, +-the Finding component value boolean, +-the Finding component value quantity, +-the Inference extensions, +-the Inference extension URL, +-the Inference extension value string, +-the Inference extension section + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_finding_inference.py + +""" + +import datetime +import os +import uuid + + +from azure.identity import DefaultAzureCredential +from azure.healthinsights.radiologyinsights import RadiologyInsightsClient +from azure.healthinsights.radiologyinsights import models + +def radiology_insights_sync() -> None: + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """FINDINGS: + In the right upper lobe, there is a new mass measuring 5.6 x 4.5 x 3.4 cm. + A lobulated soft tissue mass is identified in the superior right lower lobe abutting the major fissure measuring 5.4 x 4.3 x 3.7 cm (series 3 image 94, coronal image 110). + A 4 mm nodule in the right lower lobe (series 3, image 72) is increased dating back to 6/29/2012. This may represent lower lobe metastasis. + IMPRESSION: 4 cm pulmonary nodule posterior aspect of the right upper lobe necessitating additional imaging as described.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Https://loinc.org", + code="24627-2", + display="CT CHEST", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="CT CHEST", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + # Health Insights Radiology Insights + try: + poller = radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = poller.result() + display_finding(radiology_insights_result) + except Exception as ex: + raise ex + +def display_finding(radiology_insights_result): + for patient_result in radiology_insights_result.patient_results: + counter = 0 + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.FINDING: + counter += 1 + print(f"Finding {counter} Inference found") + fin = ri_inference.finding + for attribute in dir(fin): + if attribute.startswith("_") or callable(getattr(fin, attribute)): + continue + elif attribute == "resource_type" and fin.resource_type is not None: + print(f"Finding {counter}: Resource Type: {fin.resource_type}") + elif attribute == "id" and fin.id is not None: + print(f"Finding {counter}: ID: {fin.id}") + elif attribute == "status" and fin.status is not None: + print(f"Finding {counter}: Status: {fin.status}") + elif attribute == "category" and fin.category is not None: + for cat in fin.category: + if cat.coding is not None: + for code in cat.coding: + if code.code is not None and code.display is not None: + print( + f"Finding {counter}: Category Code: {code.system} {code.code} {code.display}" + ) + elif attribute == "code" and fin.code is not None: + for code in fin.code.coding: + if code.code is not None and code.display is not None: + print(f"Finding {counter}: Code: {code.system} {code.code} {code.display}") + elif attribute == "interpretation" and fin.interpretation is not None: + for interpretation in fin.interpretation: + for code in interpretation.coding: + if code.code is not None and code.display is not None: + print( + f"Finding {counter}: Interpretation: {code.system} {code.code} {code.display}" + ) + elif attribute == "component" and fin.component is not None: + print(f"Finding {counter}: COMPONENTS:") + for component in fin.component: + for attribute in dir(component): + if attribute.startswith("_") or callable(getattr(component, attribute)): + continue + if attribute == "code" and component.code is not None: + for code in component.code.coding: + if code.code is not None and code.display is not None: + print( + f"Finding {counter}: COMPONENTS: Code: {code.system} {code.code} {code.display}" + ) + elif ( + attribute == "value_codeable_concept" + and component.value_codeable_concept is not None + ): + for code in component.value_codeable_concept.coding: + if code.code is not None and code.display is not None: + print( + f"Finding {counter}: COMPONENTS: Value Codeable Concept: {code.system} {code.code} {code.display}" + ) + elif attribute == "value_coding" and component.value_coding is not None: + for code in component.value_coding.coding: + if code.code is not None and code.display is not None: + print( + f"Finding {counter}: COMPONENTS: Value Coding: {code.system} {code.code} {code.display}" + ) + elif attribute == "value_boolean" and component.value_boolean is not None: + print( + f"Finding {counter}: COMPONENTS: Value Boolean: {component.value_boolean}" + ) + elif attribute == "value_quantity" and component.value_quantity is not None: + for attribute in dir(component.value_quantity): + if ( + not attribute.startswith("_") + and not callable(getattr(component.value_quantity, attribute)) + and getattr(component.value_quantity, attribute) is not None + ): + print( + f"Finding {counter}: COMPONENTS: Value Quantity: {attribute.capitalize()}: {getattr(component.value_quantity, attribute)}" + ) + inference_extension = ri_inference.extension + if inference_extension is not None: + print(f"Finding {counter}: INFERENCE EXTENSIONS:") + for extension in inference_extension: + for attribute in dir(extension): + if attribute.startswith("_") or callable(getattr(extension, attribute)): + continue + elif attribute == "extension" and extension.extension is not None: + for sub_extension in extension.extension: + for sub_attribute in dir(sub_extension): + if sub_attribute.startswith("_") or callable( + getattr(sub_extension, sub_attribute) + ): + continue + elif sub_attribute == "url": + if ( + sub_extension.url == "code" + or sub_extension.url == "codingSystem" + or sub_extension.url == "codeSystemName" + or sub_extension.url == "displayName" + ): + print( + f"Finding {counter}: INFERENCE EXTENSIONS: EXTENSION: {sub_attribute.capitalize()}: {sub_extension.url}" + ) + elif ( + sub_attribute == "value_string" + and sub_extension.value_string is not None + ): + print( + f"Finding {counter}: INFERENCE EXTENSIONS: EXTENSION: {sub_attribute.capitalize()}: {sub_extension.value_string}" + ) + elif attribute == "url" and extension.url is not None: + if extension.url == "section": + print( + f"Finding {counter}: INFERENCE EXTENSIONS: {attribute.capitalize()}: {extension.url}" + ) + +if __name__ == "__main__": + radiology_insights_sync() \ No newline at end of file diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_finding_inference_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_finding_inference_async.py new file mode 100644 index 0000000000000..9357c37c0af6f --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_finding_inference_async.py @@ -0,0 +1,247 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_finding_inference_async.py + +DESCRIPTION: +The sample_finding_inference_async.py module processes a sample radiology document with the Radiology Insights service. +It will initialize an asynchronous RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display +-the Finding resource type, +-the Finding ID, +-the Finding status, +-the Finding category code, +-the Finding code, +-the Finding interpretation, +-the Finding components, +-the Finding component code, +-the Finding component value codeable concept, +-the Finding component value coding, +-the Finding component value boolean, +-the Finding component value quantity, +-the Inference extensions, +-the Inference extension URL, +-the Inference extension value string, +-the Inference extension section + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_finding_inference_async.py + +""" + +import asyncio +import datetime +import os +import uuid + +from azure.healthinsights.radiologyinsights import models + +async def radiology_insights_async() -> None: + + from azure.identity.aio import DefaultAzureCredential + from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient + + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """FINDINGS: + In the right upper lobe, there is a new mass measuring 5.6 x 4.5 x 3.4 cm. + A lobulated soft tissue mass is identified in the superior right lower lobe abutting the major fissure measuring 5.4 x 4.3 x 3.7 cm (series 3 image 94, coronal image 110). + A 4 mm nodule in the right lower lobe (series 3, image 72) is increased dating back to 6/29/2012. This may represent lower lobe metastasis. + IMPRESSION: 4 cm pulmonary nodule posterior aspect of the right upper lobe necessitating additional imaging as described.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Https://loinc.org", + code="24627-2", + display="CT CHEST", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="CT CHEST", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + try: + async with radiology_insights_client: + poller = await radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = await poller.result() + + display_finding(radiology_insights_result) + except Exception as ex: + raise ex + + +def display_finding(radiology_insights_result): + # [START display_finding] + for patient_result in radiology_insights_result.patient_results: + counter = 0 + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.FINDING: + counter += 1 + print(f"Finding {counter} Inference found") + fin = ri_inference.finding + for attribute in dir(fin): + if attribute.startswith("_") or callable(getattr(fin, attribute)): + continue + elif attribute == "resource_type" and fin.resource_type is not None: + print(f"Finding {counter}: Resource Type: {fin.resource_type}") + elif attribute == "id" and fin.id is not None: + print(f"Finding {counter}: ID: {fin.id}") + elif attribute == "status" and fin.status is not None: + print(f"Finding {counter}: Status: {fin.status}") + elif attribute == "category" and fin.category is not None: + for cat in fin.category: + if cat.coding is not None: + for code in cat.coding: + if code.code is not None and code.display is not None: + print( + f"Finding {counter}: Category Code: {code.system} {code.code} {code.display}" + ) + elif attribute == "code" and fin.code is not None: + for code in fin.code.coding: + if code.code is not None and code.display is not None: + print(f"Finding {counter}: Code: {code.system} {code.code} {code.display}") + elif attribute == "interpretation" and fin.interpretation is not None: + for interpretation in fin.interpretation: + for code in interpretation.coding: + if code.code is not None and code.display is not None: + print( + f"Finding {counter}: Interpretation: {code.system} {code.code} {code.display}" + ) + elif attribute == "component" and fin.component is not None: + print(f"Finding {counter}: COMPONENTS:") + for component in fin.component: + for attribute in dir(component): + if attribute.startswith("_") or callable(getattr(component, attribute)): + continue + if attribute == "code" and component.code is not None: + for code in component.code.coding: + if code.code is not None and code.display is not None: + print( + f"Finding {counter}: COMPONENTS: Code: {code.system} {code.code} {code.display}" + ) + elif ( + attribute == "value_codeable_concept" + and component.value_codeable_concept is not None + ): + for code in component.value_codeable_concept.coding: + if code.code is not None and code.display is not None: + print( + f"Finding {counter}: COMPONENTS: Value Codeable Concept: {code.system} {code.code} {code.display}" + ) + elif attribute == "value_coding" and component.value_coding is not None: + for code in component.value_coding.coding: + if code.code is not None and code.display is not None: + print( + f"Finding {counter}: COMPONENTS: Value Coding: {code.system} {code.code} {code.display}" + ) + elif attribute == "value_boolean" and component.value_boolean is not None: + print(f"Finding {counter}: COMPONENTS: Value Boolean: {component.value_boolean}") + elif attribute == "value_quantity" and component.value_quantity is not None: + for attribute in dir(component.value_quantity): + if ( + not attribute.startswith("_") + and not callable(getattr(component.value_quantity, attribute)) + and getattr(component.value_quantity, attribute) is not None + ): + print( + f"Finding {counter}: COMPONENTS: Value Quantity: {attribute.capitalize()}: {getattr(component.value_quantity, attribute)}" + ) + inference_extension = ri_inference.extension + if inference_extension is not None: + print(f"Finding {counter}: INFERENCE EXTENSIONS:") + for extension in inference_extension: + for attribute in dir(extension): + if attribute.startswith("_") or callable(getattr(extension, attribute)): + continue + elif attribute == "extension" and extension.extension is not None: + for sub_extension in extension.extension: + for sub_attribute in dir(sub_extension): + if sub_attribute.startswith("_") or callable( + getattr(sub_extension, sub_attribute) + ): + continue + elif sub_attribute == "url": + if ( + sub_extension.url == "code" + or sub_extension.url == "codingSystem" + or sub_extension.url == "codeSystemName" + or sub_extension.url == "displayName" + ): + print( + f"Finding {counter}: INFERENCE EXTENSIONS: EXTENSION: {sub_attribute.capitalize()}: {sub_extension.url}" + ) + elif sub_attribute == "value_string" and sub_extension.value_string is not None: + print( + f"Finding {counter}: INFERENCE EXTENSIONS: EXTENSION: {sub_attribute.capitalize()}: {sub_extension.value_string}" + ) + elif attribute == "url" and extension.url is not None: + if extension.url == "section": + print( + f"Finding {counter}: INFERENCE EXTENSIONS: {attribute.capitalize()}: {extension.url}" + ) + + # [END display_finding] + + +if __name__ == "__main__": + try: + asyncio.run(radiology_insights_async()) + except Exception as ex: + raise ex diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_communication_inference.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_communication_inference.py new file mode 100644 index 0000000000000..e5b6ae4f7e7f7 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_communication_inference.py @@ -0,0 +1,137 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_followup_communication_inference.py + +DESCRIPTION: +The sample_followup_communication_inference.py module processes a sample radiology document with the Radiology Insights service. +It will initialize a RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display +-the date and time of the follow-up communication, +-the recipient of the follow-up communication, and +-whether the follow-up communication was acknowledged + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_followup_communication_inference.py + +""" +import datetime +import os +import uuid + + +from azure.identity import DefaultAzureCredential +from azure.healthinsights.radiologyinsights import RadiologyInsightsClient +from azure.healthinsights.radiologyinsights import models + +def radiology_insights_sync() -> None: + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + # Health Insights Radiology Insights + try: + poller = radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = poller.result() + display_followup_communication(radiology_insights_result) + except Exception as ex: + raise ex + +def display_followup_communication(radiology_insights_result): + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.FOLLOWUP_COMMUNICATION: + print(f"Follow-up Communication Inference found") + if ri_inference.communicated_at is not None: + for communicatedat in ri_inference.communicated_at: + print(f"Follow-up Communication: Date Time: {communicatedat}") + else: + print(f"Follow-up Communication: Date Time: Unknown") + if ri_inference.recipient is not None: + for recipient in ri_inference.recipient: + print(f"Follow-up Communication: Recipient: {recipient}") + else: + print(f"Follow-up Communication: Recipient: Unknown") + print(f"Follow-up Communication: Was Acknowledged: {ri_inference.was_acknowledged}") + +if __name__ == "__main__": + radiology_insights_sync() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_communication_inference_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_communication_inference_async.py new file mode 100644 index 0000000000000..b9e0127680b48 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_communication_inference_async.py @@ -0,0 +1,148 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + + +""" +FILE: sample_followup_communication_inference_async.py + +DESCRIPTION: +The sample_followup_communication_inference_async.py module processes a sample radiology document with the Radiology Insights service. +It will initialize an asynchronous RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display +-the date and time of the follow-up communication, +-the recipient of the follow-up communication, and +-whether the follow-up communication was acknowledged + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_followup_communication_inference_async.py + +""" + +import asyncio +import datetime +import os +import uuid + +from azure.healthinsights.radiologyinsights import models + +async def radiology_insights_async() -> None: + + from azure.identity.aio import DefaultAzureCredential + from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient + + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + try: + async with radiology_insights_client: + poller = await radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = await poller.result() + + display_followup_communication(radiology_insights_result) + except Exception as ex: + raise ex + +def display_followup_communication(radiology_insights_result): + # [START display_followup_communication] + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.FOLLOWUP_COMMUNICATION: + print(f"Follow-up Communication Inference found") + if ri_inference.communicated_at is not None: + for communicatedat in ri_inference.communicated_at: + print(f"Follow-up Communication: Date Time: {communicatedat}") + else: + print(f"Follow-up Communication: Date Time: Unknown") + if ri_inference.recipient is not None: + for recipient in ri_inference.recipient: + print(f"Follow-up Communication: Recipient: {recipient}") + else: + print(f"Follow-up Communication: Recipient: Unknown") + print(f"Follow-up Communication: Was Acknowledged: {ri_inference.was_acknowledged}") + + # [END display_followup_communication] + +if __name__ == "__main__": + try: + asyncio.run(radiology_insights_async()) + except Exception as ex: + raise ex diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_recommendation_inference.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_recommendation_inference.py new file mode 100644 index 0000000000000..29751878dee8d --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_recommendation_inference.py @@ -0,0 +1,247 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_followup_recommendation_inference.py + +DESCRIPTION: +The sample_followup_recommendation_inference.py module processes a sample radiology document with the Radiology Insights service. +It will initialize a RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display +- the Finding category code +- the Finding code +- the Finding ID +- the Finding resource type +- the Finding boolean is_conditional +- the Finding boolean is_guideline +- the Finding boolean is_hedging +- the Finding boolean is_option +- the Recommended Procedure code +- the Imaging procedure anatomy code +- the Imaging procedure anatomy extension url +- the Imaging procedure anatomy extension reference +- the Imaging procedure anatomy extension offset +- the Imaging procedure anatomy extension length +- the Imaging procedure modality code +- the Imaging procedure modality extension url +- the Imaging procedure modality extension reference +- the Imaging procedure modality extension offset +- the Imaging procedure modality extension length + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_followup_recommendation_inference.py + +""" +import datetime +import os +import uuid + + +from azure.identity import DefaultAzureCredential +from azure.healthinsights.radiologyinsights import RadiologyInsightsClient +from azure.healthinsights.radiologyinsights import models + +def radiology_insights_sync() -> None: + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + # Health Insights Radiology Insights + try: + poller = radiology_insights_client.begin_infer_radiology_insights(id=job_id, resource=patient_data) + radiology_insights_result = poller.result() + display_followup_recommendation(radiology_insights_result) + except Exception as ex: + raise ex + +def display_followup_recommendation(radiology_insights_result): + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.FOLLOWUP_RECOMMENDATION: + print(f"Follow-up Recommendation Inference found") + for finding in ri_inference.findings: + for attribute in dir(finding): + if ( + hasattr(finding, attribute) + and not attribute.startswith("_") + and not callable(getattr(finding, attribute)) + ): + if attribute == "finding": + print(f"\nFollow-up Recommendation: FINDING :") + find = finding.finding + for attr in dir(find): + if ( + hasattr(find, attr) + and not attr.startswith("_") + and not callable(getattr(find, attr)) + ): + if getattr(find, attr) is not None: + if attr == "category": + for category in find.category: + for code in category.coding: + print( + f"Follow-up Recommendation: FINDING: Category: {code.system} {code.code} {code.display}" + ) + elif attr == "code": + for code in find.code.coding: + print( + f"Follow-up Recommendation: FINDING: Code: {code.system} {code.code} {code.display}" + ) + elif attr == "id": + print(f"Follow-up Recommendation: FINDING: ID: {find.id}") + elif attr == "resource_type": + print( + f"Follow-up Recommendation: FINDING: Resource Type: {find.resource_type}" + ) + print(f"\nFollow-up Recommendation: BOOLEANS:") + condition = ri_inference.is_conditional + print(f"Follow-up Recommendation: BOOLEANS: is_conditional: {condition}") + guideline = ri_inference.is_guideline + print(f"Follow-up Recommendation: BOOLEANS: is_guideline: {guideline}") + hedging = ri_inference.is_hedging + print(f"Follow-up Recommendation: BOOLEANS: is_hedging: {hedging}") + option = ri_inference.is_option + print(f"Follow-up Recommendation: BOOLEANS: is_option: {option}") + recproc = ri_inference.recommended_procedure + for proccod in recproc.procedure_codes: + print(f"\nFollow-up Recommendation: PROCEDURE CODES:") + for coding in proccod.coding: + print( + f"Follow-up Recommendation: PROCEDURE CODES: {coding.system} {coding.code} {coding.display}" + ) + for improc in recproc.imaging_procedures: + print(f"\nFollow-up Recommendation: IMAGING PROCEDURE:") + for attribute in improc: + if ( + hasattr(improc, attribute) + and not attribute.startswith("_") + and not callable(getattr(improc, attribute)) + ): + if attribute == "anatomy": + if improc.anatomy is not None: + for coding in improc.anatomy.coding: + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Anatomy Code: {coding.system} {coding.code} {coding.display}" + ) + for extension in improc.anatomy.extension: + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Anatomy Url: {extension.url}" + ) + for subext in extension.extension: + if subext.url == "reference": + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Anatomy Url: {subext.url} {subext.value_reference}" + ) + elif subext.url == "offset": + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Anatomy Url: {subext.url} {subext.value_integer}" + ) + elif subext.url == "length": + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Anatomy Url: {subext.url} {subext.value_integer}" + ) + else: + print(f"Follow-up Recommendation: IMAGING PROCEDURE: Anatomy: none") + elif attribute == "modality": + if improc.modality is not None: + for coding in improc.modality.coding: + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Modality Code: {coding.system} {coding.code} {coding.display}" + ) + for extension in improc.modality.extension: + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Modality Url: {extension.url}" + ) + for subext in extension.extension: + if subext.url == "reference": + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Modality Url: {subext.url} {subext.value_reference}" + ) + elif subext.url == "offset": + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Modality Url: {subext.url} {subext.value_integer}" + ) + elif subext.url == "length": + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Modality Url: {subext.url} {subext.value_integer}" + ) + else: + print(f"Follow-up Recommendation: IMAGING PROCEDURE: Modality: none") + +if __name__ == "__main__": + radiology_insights_sync() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_recommendation_inference_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_recommendation_inference_async.py new file mode 100644 index 0000000000000..18b3a60a02005 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_followup_recommendation_inference_async.py @@ -0,0 +1,262 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_followup_recommendation_inference_async.py + +DESCRIPTION: +The sample_followup_recommendation_inference_async.py module processes a sample radiology document with the Radiology Insights service. +It will initialize an asynchronous RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display +- the Finding category code +- the Finding code +- the Finding ID +- the Finding resource type +- the Finding boolean is_conditional +- the Finding boolean is_guideline +- the Finding boolean is_hedging +- the Finding boolean is_option +- the Recommended Procedure code +- the Imaging procedure anatomy code +- the Imaging procedure anatomy extension url +- the Imaging procedure anatomy extension reference +- the Imaging procedure anatomy extension offset +- the Imaging procedure anatomy extension length +- the Imaging procedure modality code +- the Imaging procedure modality extension url +- the Imaging procedure modality extension reference +- the Imaging procedure modality extension offset +- the Imaging procedure modality extension length + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_followup_recommendation_inference_async.py + +""" + +import asyncio +import datetime +import os +import uuid + +from azure.healthinsights.radiologyinsights import models + +async def radiology_insights_async() -> None: + + from azure.identity.aio import DefaultAzureCredential + from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient + + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + try: + async with radiology_insights_client: + poller = await radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = await poller.result() + + display_followup_recommendation(radiology_insights_result) + except Exception as ex: + raise ex + + +def display_followup_recommendation(radiology_insights_result): + # [START display_followup_recommendation] + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.FOLLOWUP_RECOMMENDATION: + print(f"Follow-up Recommendation Inference found") + for finding in ri_inference.findings: + for attribute in dir(finding): + if ( + hasattr(finding, attribute) + and not attribute.startswith("_") + and not callable(getattr(finding, attribute)) + ): + if attribute == "finding": + print(f"\nFollow-up Recommendation: FINDING :") + find = finding.finding + for attr in dir(find): + if ( + hasattr(find, attr) + and not attr.startswith("_") + and not callable(getattr(find, attr)) + ): + if getattr(find, attr) is not None: + if attr == "category": + for category in find.category: + for code in category.coding: + print( + f"Follow-up Recommendation: FINDING: Category: {code.system} {code.code} {code.display}" + ) + elif attr == "code": + for code in find.code.coding: + print( + f"Follow-up Recommendation: FINDING: Code: {code.system} {code.code} {code.display}" + ) + elif attr == "id": + print(f"Follow-up Recommendation: FINDING: ID: {find.id}") + elif attr == "resource_type": + print( + f"Follow-up Recommendation: FINDING: Resource Type: {find.resource_type}" + ) + print(f"\nFollow-up Recommendation: BOOLEANS:") + condition = ri_inference.is_conditional + print(f"Follow-up Recommendation: BOOLEANS: is_conditional: {condition}") + guideline = ri_inference.is_guideline + print(f"Follow-up Recommendation: BOOLEANS: is_guideline: {guideline}") + hedging = ri_inference.is_hedging + print(f"Follow-up Recommendation: BOOLEANS: is_hedging: {hedging}") + option = ri_inference.is_option + print(f"Follow-up Recommendation: BOOLEANS: is_option: {option}") + recproc = ri_inference.recommended_procedure + for proccod in recproc.procedure_codes: + print(f"\nFollow-up Recommendation: PROCEDURE CODES:") + for coding in proccod.coding: + print( + f"Follow-up Recommendation: PROCEDURE CODES: {coding.system} {coding.code} {coding.display}" + ) + for improc in recproc.imaging_procedures: + print(f"\nFollow-up Recommendation: IMAGING PROCEDURE:") + for attribute in improc: + if ( + hasattr(improc, attribute) + and not attribute.startswith("_") + and not callable(getattr(improc, attribute)) + ): + if attribute == "anatomy": + if improc.anatomy is not None: + for coding in improc.anatomy.coding: + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Anatomy Code: {coding.system} {coding.code} {coding.display}" + ) + for extension in improc.anatomy.extension: + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Anatomy Url: {extension.url}" + ) + for subext in extension.extension: + if subext.url == "reference": + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Anatomy Url: {subext.url} {subext.value_reference}" + ) + elif subext.url == "offset": + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Anatomy Url: {subext.url} {subext.value_integer}" + ) + elif subext.url == "length": + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Anatomy Url: {subext.url} {subext.value_integer}" + ) + else: + print(f"Follow-up Recommendation: IMAGING PROCEDURE: Anatomy: none") + elif attribute == "modality": + if improc.modality is not None: + for coding in improc.modality.coding: + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Modality Code: {coding.system} {coding.code} {coding.display}" + ) + for extension in improc.modality.extension: + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Modality Url: {extension.url}" + ) + for subext in extension.extension: + if subext.url == "reference": + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Modality Url: {subext.url} {subext.value_reference}" + ) + elif subext.url == "offset": + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Modality Url: {subext.url} {subext.value_integer}" + ) + elif subext.url == "length": + print( + f"Follow-up Recommendation: IMAGING PROCEDURE: Modality Url: {subext.url} {subext.value_integer}" + ) + else: + print(f"Follow-up Recommendation: IMAGING PROCEDURE: Modality: none") + + # [END display_followup_recommendation] + + +if __name__ == "__main__": + try: + asyncio.run(radiology_insights_async()) + except Exception as ex: + raise ex diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_laterality_discrepancy_inference.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_laterality_discrepancy_inference.py new file mode 100644 index 0000000000000..80f71e2e52de7 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_laterality_discrepancy_inference.py @@ -0,0 +1,123 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_laterality_discrepancy_inference.py + +DESCRIPTION: +The sample_laterality_discrepancy_inference.py module processes a sample radiology document with the Radiology Insights service. +It will initialize a RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display the Laterality Mismatch indication and discrepancy type. + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_laterality_discrepancy_inference.py + +""" +import datetime +import os +import uuid + + +from azure.identity import DefaultAzureCredential +from azure.healthinsights.radiologyinsights import RadiologyInsightsClient +from azure.healthinsights.radiologyinsights import models + +def radiology_insights_sync() -> None: + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """Exam: US LT BREAST TARGETED + Technique: Targeted imaging of the right breast is performed. + Findings: + Targeted imaging of the left breast is performed from the 6:00 to the 9:00 position. + At the 6:00 position, 5 cm from the nipple, there is a 3 x 2 x 4 mm minimally hypoechoic mass with a peripheral calcification. + This may correspond to the mammographic finding. No other cystic or solid masses visualized.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Https://loinc.org", + code="26688-1", + display="US BREAST - LEFT LIMITED", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US BREAST - LEFT LIMITED", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + # Health Insights Radiology Insights + try: + poller = radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = poller.result() + display_laterality_discrepancy(radiology_insights_result) + except Exception as ex: + raise ex + +def display_laterality_discrepancy(radiology_insights_result): + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.LATERALITY_DISCREPANCY: + print(f"Laterality Discrepancy Inference found") + indication = ri_inference.laterality_indication + for code in indication.coding: + print( + f"Laterality Discrepancy: Laterality Indication: {code.system} {code.code} {code.display}" + ) + print(f"Laterality Discrepancy: Discrepancy Type: {ri_inference.discrepancy_type}") + +if __name__ == "__main__": + radiology_insights_sync() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_laterality_discrepancy_inference_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_laterality_discrepancy_inference_async.py new file mode 100644 index 0000000000000..839129f84c502 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_laterality_discrepancy_inference_async.py @@ -0,0 +1,130 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_laterality_discrepancy_inference_async.py + +DESCRIPTION: +The sample_laterality_discrepancy_inference_async.py module processes a sample radiology document with the Radiology Insights service. +It will initialize an asynchronous RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display the Laterality Mismatch indication and discrepancy type. + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_laterality_discrepancy_inference_async.py + +""" +import asyncio +import datetime +import os +import uuid + + +from azure.identity.aio import DefaultAzureCredential +from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient +from azure.healthinsights.radiologyinsights import models + +async def radiology_insights_async() -> None: + + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """Exam: US LT BREAST TARGETED + Technique: Targeted imaging of the right breast is performed. + Findings: + Targeted imaging of the left breast is performed from the 6:00 to the 9:00 position. + At the 6:00 position, 5 cm from the nipple, there is a 3 x 2 x 4 mm minimally hypoechoic mass with a peripheral calcification. + This may correspond to the mammographic finding. No other cystic or solid masses visualized.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Https://loinc.org", + code="26688-1", + display="US BREAST - LEFT LIMITED", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US BREAST - LEFT LIMITED", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + try: + async with radiology_insights_client: + poller = await radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = await poller.result() + + display_laterality_discrepancy(radiology_insights_result) + except Exception as ex: + raise ex + +def display_laterality_discrepancy(radiology_insights_result): + # [START display_laterality_discrepancy] + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.LATERALITY_DISCREPANCY: + print(f"Laterality Discrepancy Inference found") + indication = ri_inference.laterality_indication + for code in indication.coding: + print(f"Laterality Discrepancy: Laterality Indication: {code.system} {code.code} {code.display}") + print(f"Laterality Discrepancy: Discrepancy Type: {ri_inference.discrepancy_type}") + + # [END display_laterality_discrepancy] + +if __name__ == "__main__": + try: + asyncio.run(radiology_insights_async()) + except Exception as ex: + raise ex diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_limited_order_discrepancy_inference.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_limited_order_discrepancy_inference.py new file mode 100644 index 0000000000000..47332e22d9768 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_limited_order_discrepancy_inference.py @@ -0,0 +1,143 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_limited_order_discrepancy_inference.py + +DESCRIPTION: +The sample_limited_order_discrepancy_inference.py module processes a sample radiology document with the Radiology Insights service. +It will initialize a RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display the Order Type code, Present Body Part code and measurement. + + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_limited_order_discrepancy_inference.py + +""" +import datetime +import os +import uuid + + +from azure.identity import DefaultAzureCredential +from azure.healthinsights.radiologyinsights import RadiologyInsightsClient +from azure.healthinsights.radiologyinsights import models + +def radiology_insights_sync() -> None: + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """HISTORY: 49-year-old male with a history of tuberous sclerosis presenting with epigastric pain and diffuse tenderness. The patient was found to have pericholecystic haziness on CT; evaluation for acute cholecystitis. + TECHNIQUE: Ultrasound evaluation of the abdomen was performed. Comparison is made to the prior abdominal ultrasound (2004) and to the enhanced CT of the abdomen and pelvis (2014). + FINDINGS: + The liver is elongated, measuring 19.3 cm craniocaudally, and is homogeneous in echotexture without evidence of focal mass lesion. The liver contour is smooth on high resolution images. There is no appreciable intra- or extrahepatic biliary ductal dilatation, with the visualized extrahepatic bile duct measuring up to 6 mm. There are multiple shadowing gallstones, including within the gallbladder neck, which do not appear particularly mobile. In addition, there is thickening of the gallbladder wall up to approximately 7 mm with probable mild mural edema. There is no pericholecystic fluid. No sonographic Murphy's sign was elicited; however the patient reportedly received pain medications in the emergency department. + The pancreatic head, body and visualized portions of the tail are unremarkable. The spleen is normal in size, measuring 9.9 cm in length. + The kidneys are normal in size. The right kidney measures 11.5 x 5.2 x 4.3 cm and the left kidney measuring 11.8 x 5.3 x 5.1 cm. There are again multiple bilateral echogenic renal masses consistent with angiomyolipomas, in keeping with the patient's history of tuberous sclerosis. The largest echogenic mass on the right is located in the upper pole and measures 1.2 x 1.3 x 1.3 cm. The largest echogenic mass on the left is located within the renal sinus and measures approximately 2.6 x 2.7 x 4.6 cm. Additional indeterminate renal lesions are present bilaterally and are better characterized on CT. There is no hydronephrosis. + No ascites is identified within the upper abdomen. + The visualized portions of the upper abdominal aorta and IVC are normal in caliber. + IMPRESSION: + 1. Numerous gallstones associated with gallbladder wall thickening and probable gallbladder mural edema, highly suspicious for acute cholecystitis in this patient presenting with epigastric pain and pericholecystic hazy density identified on CT. Although no sonographic Murphy sign was elicited, evaluation is limited secondary to reported prior administration of pain medication. Thus, clinical correlation is required. No evidence of biliary ductal dilation. + 2. There are again multiple bilateral echogenic renal masses consistent with angiomyolipomas, in keeping with the patient's history of tuberous sclerosis. Additional indeterminate renal lesions are present bilaterally and are better characterized on CT and MR. + These findings were discussed with Dr. Doe at 5:05 p.m. on 1/1/15.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Https://loinc.org", + code="30704-1", + display="US ABDOMEN LIMITED", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US ABDOMEN LIMITED", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + # Health Insights Radiology Insights + try: + poller = radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = poller.result() + display_limited_order_discrepancy(radiology_insights_result) + except Exception as ex: + raise ex + +def display_limited_order_discrepancy(radiology_insights_result): + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.LIMITED_ORDER_DISCREPANCY: + print(f"Limited Order Discrepancy Inference found") + ordertype = ri_inference.order_type + for coding in ordertype.coding: + print(f"Limited Order Discrepancy: Order Type: {coding.system} {coding.code} {coding.display}") + if not ri_inference.present_body_parts: + print(f"Limited Order Discrepancy: Present Body Parts: empty list") + else: + for presentbodypart in ri_inference.present_body_parts: + for coding in presentbodypart.coding: + print( + f"Limited Order Discrepancy: Present Body Part: {coding.system} {coding.code} {coding.display}" + ) + if not ri_inference.present_body_part_measurements: + print(f"Limited Order Discrepancy: Present Body Part Measurements: empty list") + else: + for presentbodypartmeasurement in ri_inference.present_body_part_measurements: + for coding in presentbodypartmeasurement.coding: + print( + f"Limited Order Discrepancy: Present Body Part Measurement: {coding.system} {coding.code} {coding.display}" + ) + +if __name__ == "__main__": + radiology_insights_sync() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_limited_order_discrepancy_inference_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_limited_order_discrepancy_inference_async.py new file mode 100644 index 0000000000000..f1284e526bf14 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_limited_order_discrepancy_inference_async.py @@ -0,0 +1,152 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_limited_order_discrepancy_inference_async.py + +DESCRIPTION: +The sample_limited_order_discrepancy_inference_async.py module processes a sample radiology document with the Radiology Insights service. +It will initialize an asynchronous RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display the Order Type code, Present Body Part code and measurement. + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_limited_order_discrepancy_inference_async.py + +""" + +import asyncio +import datetime +import os +import uuid + +from azure.healthinsights.radiologyinsights import models + +async def radiology_insights_async() -> None: + + from azure.identity.aio import DefaultAzureCredential + from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient + + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """HISTORY: 49-year-old male with a history of tuberous sclerosis presenting with epigastric pain and diffuse tenderness. The patient was found to have pericholecystic haziness on CT; evaluation for acute cholecystitis. + TECHNIQUE: Ultrasound evaluation of the abdomen was performed. Comparison is made to the prior abdominal ultrasound (2004) and to the enhanced CT of the abdomen and pelvis (2014). + FINDINGS: + The liver is elongated, measuring 19.3 cm craniocaudally, and is homogeneous in echotexture without evidence of focal mass lesion. The liver contour is smooth on high resolution images. There is no appreciable intra- or extrahepatic biliary ductal dilatation, with the visualized extrahepatic bile duct measuring up to 6 mm. There are multiple shadowing gallstones, including within the gallbladder neck, which do not appear particularly mobile. In addition, there is thickening of the gallbladder wall up to approximately 7 mm with probable mild mural edema. There is no pericholecystic fluid. No sonographic Murphy's sign was elicited; however the patient reportedly received pain medications in the emergency department. + The pancreatic head, body and visualized portions of the tail are unremarkable. The spleen is normal in size, measuring 9.9 cm in length. + The kidneys are normal in size. The right kidney measures 11.5 x 5.2 x 4.3 cm and the left kidney measuring 11.8 x 5.3 x 5.1 cm. There are again multiple bilateral echogenic renal masses consistent with angiomyolipomas, in keeping with the patient's history of tuberous sclerosis. The largest echogenic mass on the right is located in the upper pole and measures 1.2 x 1.3 x 1.3 cm. The largest echogenic mass on the left is located within the renal sinus and measures approximately 2.6 x 2.7 x 4.6 cm. Additional indeterminate renal lesions are present bilaterally and are better characterized on CT. There is no hydronephrosis. + No ascites is identified within the upper abdomen. + The visualized portions of the upper abdominal aorta and IVC are normal in caliber. + IMPRESSION: + 1. Numerous gallstones associated with gallbladder wall thickening and probable gallbladder mural edema, highly suspicious for acute cholecystitis in this patient presenting with epigastric pain and pericholecystic hazy density identified on CT. Although no sonographic Murphy sign was elicited, evaluation is limited secondary to reported prior administration of pain medication. Thus, clinical correlation is required. No evidence of biliary ductal dilation. + 2. There are again multiple bilateral echogenic renal masses consistent with angiomyolipomas, in keeping with the patient's history of tuberous sclerosis. Additional indeterminate renal lesions are present bilaterally and are better characterized on CT and MR. + These findings were discussed with Dr. Doe at 5:05 p.m. on 1/1/15.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Https://loinc.org", + code="30704-1", + display="US ABDOMEN LIMITED", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US ABDOMEN LIMITED", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + try: + async with radiology_insights_client: + poller = await radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = await poller.result() + + display_limited_order_discrepancy(radiology_insights_result) + except Exception as ex: + raise ex + +def display_limited_order_discrepancy(radiology_insights_result): + # [START display_limited_order_discrepancy] + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.LIMITED_ORDER_DISCREPANCY: + print(f"Limited Order Discrepancy Inference found") + ordertype = ri_inference.order_type + for coding in ordertype.coding: + print(f"Limited Order Discrepancy: Order Type: {coding.system} {coding.code} {coding.display}") + if not ri_inference.present_body_parts: + print(f"Limited Order Discrepancy: Present Body Parts: empty list") + else: + for presentbodypart in ri_inference.present_body_parts: + for coding in presentbodypart.coding: + print( + f"Limited Order Discrepancy: Present Body Part: {coding.system} {coding.code} {coding.display}" + ) + if not ri_inference.present_body_part_measurements: + print(f"Limited Order Discrepancy: Present Body Part Measurements: empty list") + else: + for presentbodypartmeasurement in ri_inference.present_body_part_measurements: + for coding in presentbodypartmeasurement.coding: + print( + f"Limited Order Discrepancy: Present Body Part Measurement: {coding.system} {coding.code} {coding.display}" + ) + + # [END display_limited_order_discrepancy] + +if __name__ == "__main__": + try: + asyncio.run(radiology_insights_async()) + except Exception as ex: + raise ex diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_radiology_procedure_inference.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_radiology_procedure_inference.py new file mode 100644 index 0000000000000..5eb629e78f80a --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_radiology_procedure_inference.py @@ -0,0 +1,163 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_radiology_procedure_inference.py + +DESCRIPTION: +The sample_radiology_procedure_inference.py module processes a sample radiology document with the Radiology Insights service. +It will initialize a RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display +- the Procedure code, +- the Imaging Procedure anatomy and modality, +- Ordered Procedure code and description + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_radiology_procedure_inference.py + +""" +import datetime +import os +import uuid + + +from azure.identity import DefaultAzureCredential +from azure.healthinsights.radiologyinsights import RadiologyInsightsClient +from azure.healthinsights.radiologyinsights import models + +def radiology_insights_sync() -> None: + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """ + Exam: Head CT with Contrast + History: Headaches for 2 months + Technique: Axial, sagittal, and coronal images were reconstructed from helical CT through the head without IV contrast. + IV contrast: 100 mL IV Omnipaque 300. + Findings: There is no mass effect. There is no abnormal enhancement of the brain or within injuries with IV contrast.\ + However, there is no evidence of enhancing lesion in either internal auditory canal. + Impression: Negative CT of the brain without IV contrast. + I recommend a new brain CT within nine months.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Https://loinc.org", + code="24727-0", + display="CT HEAD W CONTRAST IV", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="CT HEAD W CONTRAST IV", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + # Health Insights Radiology Insights + try: + poller = radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = poller.result() + display_radiology_procedure(radiology_insights_result) + except Exception as ex: + raise ex + +def display_radiology_procedure(radiology_insights_result): + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.RADIOLOGY_PROCEDURE: + print(f"Radiology Procedure Inference found") + for proccod in ri_inference.procedure_codes: + print(f"\nRadiology Procedure: PROCEDURE CODES:") + for coding in proccod.coding: + print( + f"Radiology Procedure: PROCEDURE CODES: Code: {coding.system} {coding.code} {coding.display}" + ) + for improc in ri_inference.imaging_procedures: + print(f"\nRadiology Procedure: IMAGING PROCEDURE:") + for attribute in improc: + if ( + hasattr(improc, attribute) + and not attribute.startswith("_") + and not callable(getattr(improc, attribute)) + ): + if attribute == "anatomy": + if improc.anatomy is not None: + for coding in improc.anatomy.coding: + print( + f"Radiology Procedure: IMAGING PROCEDURE: Anatomy Code: {coding.system} {coding.code} {coding.display}" + ) + else: + print(f"Radiology Procedure: IMAGING PROCEDURE: Anatomy: none") + elif attribute == "modality": + if improc.modality is not None: + for coding in improc.modality.coding: + print( + f"Radiology Procedure: IMAGING PROCEDURE: Modality Code: {coding.system} {coding.code} {coding.display}" + ) + else: + print(f"Radiology Procedure: IMAGING PROCEDURE: Modality: none") + ordered_procedure = ri_inference.ordered_procedure + print(f"\nRadiology Procedure: ORDERED PROCEDURE:") + if ordered_procedure.description is not None: + print(f"Radiology Procedure: ORDERED PROCEDURE: Description: {ordered_procedure.description}") + if ordered_procedure.code is not None: + for coding in ordered_procedure.code.coding: + print( + f"Radiology Procedure: ORDERED PROCEDURE: Code: {coding.system} {coding.code} {coding.display}" + ) + + +if __name__ == "__main__": + radiology_insights_sync() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_radiology_procedure_inference_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_radiology_procedure_inference_async.py new file mode 100644 index 0000000000000..82c406ae54499 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_radiology_procedure_inference_async.py @@ -0,0 +1,172 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_radiology_procedure_inference_async.py + +DESCRIPTION: +The sample_radiology_procedure_inference_async.py module processes a sample radiology document with the Radiology Insights service. +It will initialize an asynchronous RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display +- the Procedure code, +- the Imaging Procedure anatomy and modality, +- Ordered Procedure code and description + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_radiology_procedure_inference_async.py + +""" +import asyncio +import datetime +import os +import uuid + +from azure.healthinsights.radiologyinsights import models + +async def radiology_insights_async() -> None: + + from azure.identity.aio import DefaultAzureCredential + from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient + + # [START create_radiology_insights_client] + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + # [END create_radiology_insights_client] + doc_content1 = """ + Exam: Head CT with Contrast + History: Headaches for 2 months + Technique: Axial, sagittal, and coronal images were reconstructed from helical CT through the head without IV contrast. + IV contrast: 100 mL IV Omnipaque 300. + Findings: There is no mass effect. There is no abnormal enhancement of the brain or within injuries with IV contrast.\ + However, there is no evidence of enhancing lesion in either internal auditory canal. + Impression: Negative CT of the brain without IV contrast. + I recommend a new brain CT within nine months.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Https://loinc.org", + code="24727-0", + display="CT HEAD W CONTRAST IV", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="CT HEAD W CONTRAST IV", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + try: + async with radiology_insights_client: + poller = await radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = await poller.result() + + display_radiology_procedure(radiology_insights_result) + except Exception as ex: + raise ex + +def display_radiology_procedure(radiology_insights_result): + # [START display_radiology_procedure] + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.RADIOLOGY_PROCEDURE: + print(f"Radiology Procedure Inference found") + for proccod in ri_inference.procedure_codes: + print(f"\nRadiology Procedure: PROCEDURE CODES:") + for coding in proccod.coding: + print( + f"Radiology Procedure: PROCEDURE CODES: Code: {coding.system} {coding.code} {coding.display}" + ) + for improc in ri_inference.imaging_procedures: + print(f"\nRadiology Procedure: IMAGING PROCEDURE:") + for attribute in improc: + if ( + hasattr(improc, attribute) + and not attribute.startswith("_") + and not callable(getattr(improc, attribute)) + ): + if attribute == "anatomy": + if improc.anatomy is not None: + for coding in improc.anatomy.coding: + print( + f"Radiology Procedure: IMAGING PROCEDURE: Anatomy Code: {coding.system} {coding.code} {coding.display}" + ) + else: + print(f"Radiology Procedure: IMAGING PROCEDURE: Anatomy: none") + elif attribute == "modality": + if improc.modality is not None: + for coding in improc.modality.coding: + print( + f"Radiology Procedure: IMAGING PROCEDURE: Modality Code: {coding.system} {coding.code} {coding.display}" + ) + else: + print(f"Radiology Procedure: IMAGING PROCEDURE: Modality: none") + ordered_procedure = ri_inference.ordered_procedure + print(f"\nRadiology Procedure: ORDERED PROCEDURE:") + if ordered_procedure.description is not None: + print(f"Radiology Procedure: ORDERED PROCEDURE: Description: {ordered_procedure.description}") + if ordered_procedure.code is not None: + for coding in ordered_procedure.code.coding: + print( + f"Radiology Procedure: ORDERED PROCEDURE: Code: {coding.system} {coding.code} {coding.display}" + ) + +# [END display_radiology_procedure] + +if __name__ == "__main__": + try: + asyncio.run(radiology_insights_async()) + except Exception as ex: + raise ex diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_sex_mismatch_inference.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_sex_mismatch_inference.py new file mode 100644 index 0000000000000..ec93269f91419 --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_sex_mismatch_inference.py @@ -0,0 +1,127 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_sex_mismatch_inference.py + +DESCRIPTION: +The sample_sex_mismatch_inference.py module processes a sample radiology document with the Radiology Insights service. +It will initialize a RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display the Sex Mismatch indication. + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_sex_mismatch_inference.py + +""" +import datetime +import os +import uuid + + +from azure.identity import DefaultAzureCredential +from azure.healthinsights.radiologyinsights import RadiologyInsightsClient +from azure.healthinsights.radiologyinsights import models + +def radiology_insights_sync() -> None: + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + + doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + # Health Insights Radiology Insights + try: + poller = radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = poller.result() + display_sex_mismatch(radiology_insights_result) + except Exception as ex: + raise ex + +def display_sex_mismatch(radiology_insights_result): + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.SEX_MISMATCH: + print(f"Sex Mismatch Inference found") + indication = ri_inference.sex_indication + for code in indication.coding: + print(f"Sex Mismatch: Sex Indication: {code.system} {code.code} {code.display}") + + +if __name__ == "__main__": + radiology_insights_sync() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_sex_mismatch_inference_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_sex_mismatch_inference_async.py new file mode 100644 index 0000000000000..36cb781d8354f --- /dev/null +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/samples/sample_sex_mismatch_inference_async.py @@ -0,0 +1,140 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +""" +FILE: sample_sex_mismatch_inference_async.py + +DESCRIPTION: +The sample_sex_mismatch_inference_async.py module processes a sample radiology document with the Radiology Insights service. +It will initialize an asynchronous RadiologyInsightsClient, build a Radiology Insights request with the sample document, +submit it to the client, RadiologyInsightsClient, and display the Sex Mismatch indication. + + +USAGE: + +1. Set the environment variables with your own values before running the sample: + - AZURE_HEALTH_INSIGHTS_ENDPOINT - the endpoint to your source Health Insights resource. + - For more details how to use DefaultAzureCredential, please take a look at https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential + +2. python sample_sex_mismatch_inference_async.py + +""" +import asyncio +import datetime +import os +import uuid + + + +from azure.healthinsights.radiologyinsights import models + +async def radiology_insights_async() -> None: + + from azure.identity.aio import DefaultAzureCredential + from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient + + # [START create_radiology_insights_client] + credential = DefaultAzureCredential() + ENDPOINT = os.environ["AZURE_HEALTH_INSIGHTS_ENDPOINT"] + + job_id = str(uuid.uuid4()) + + radiology_insights_client = RadiologyInsightsClient(endpoint=ENDPOINT, credential = credential) + # [END create_radiology_insights_client] + doc_content1 = """CLINICAL HISTORY: + 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. + COMPARISON: + Right upper quadrant sonographic performed 1 day prior. + TECHNIQUE: + Transabdominal grayscale pelvic sonography with duplex color Doppler and spectral waveform analysis of the ovaries. + FINDINGS: + The uterus is unremarkable given the transabdominal technique with endometrial echo complex within physiologic normal limits. The ovaries are symmetric in size, measuring 2.5 x 1.2 x 3.0 cm and the left measuring 2.8 x 1.5 x 1.9 cm.\n On duplex imaging, Doppler signal is symmetric. + IMPRESSION: + 1. Normal pelvic sonography. Findings of testicular torsion. + A new US pelvis within the next 6 months is recommended. + These results have been discussed with Dr. Jones at 3 PM on November 5 2020.""" + + # Create ordered procedure + procedure_coding = models.Coding( + system="Http://hl7.org/fhir/ValueSet/cpt-all", + code="USPELVIS", + display="US PELVIS COMPLETE", + ) + procedure_code = models.CodeableConcept(coding=[procedure_coding]) + ordered_procedure = models.OrderedProcedure(description="US PELVIS COMPLETE", code=procedure_code) + # Create encounter + start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) + encounter = models.PatientEncounter( + id="encounter2", + class_property=models.EncounterClass.IN_PATIENT, + period=models.TimePeriod(start=start, end=end), + ) + # Create patient info + birth_date = datetime.date(1959, 11, 11) + patient_info = models.PatientDetails(sex=models.PatientSex.FEMALE, birth_date=birth_date) + # Create author + author = models.DocumentAuthor(id="author2", full_name="authorName2") + + create_date_time = datetime.datetime(2024, 2, 19, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + patient_document1 = models.PatientDocument( + type=models.DocumentType.NOTE, + clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, + id="doc2", + content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), + created_at=create_date_time, + specialty_type=models.SpecialtyType.RADIOLOGY, + administrative_metadata=models.DocumentAdministrativeMetadata( + ordered_procedures=[ordered_procedure], encounter_id="encounter2" + ), + authors=[author], + language="en", + ) + + # Construct patient + patient1 = models.PatientRecord( + id="patient_id2", + details=patient_info, + encounters=[encounter], + patient_documents=[patient_document1], + ) + + # Create a configuration + configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") + + # Construct the request with the patient and configuration + patient_data = models.RadiologyInsightsJob( + job_data=models.RadiologyInsightsData(patients=[patient1], configuration=configuration) + ) + + try: + async with radiology_insights_client: + poller = await radiology_insights_client.begin_infer_radiology_insights( + id=job_id, + resource=patient_data, + ) + radiology_insights_result = await poller.result() + + display_sex_mismatch(radiology_insights_result) + except Exception as ex: + raise ex + +def display_sex_mismatch(radiology_insights_result): + # [START display_sex_mismatch] + for patient_result in radiology_insights_result.patient_results: + for ri_inference in patient_result.inferences: + if ri_inference.kind == models.RadiologyInsightsInferenceType.SEX_MISMATCH: + print(f"Sex Mismatch Inference found") + indication = ri_inference.sex_indication + for code in indication.coding: + print(f"Sex Mismatch: Sex Indication: {code.system} {code.code} {code.display}") + + # [END display_sex_mismatch] + + + +if __name__ == "__main__": + try: + asyncio.run(radiology_insights_async()) + except Exception as ex: + raise ex diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/setup.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/setup.py index 57be0108e385a..6cfa272e6186c 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/setup.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/setup.py @@ -38,7 +38,7 @@ url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk", keywords="azure, azure sdk", classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", @@ -63,8 +63,8 @@ "azure.healthinsights.radiologyinsights": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-core<2.0.0,>=1.30.0", + "isodate>=0.6.1", + "azure-core>=1.30.0", "typing-extensions>=4.6.0", ], python_requires=">=3.8", diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/tests/conftest.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/tests/conftest.py index 1d2c7072378ef..22125b1a27f00 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/tests/conftest.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/tests/conftest.py @@ -35,9 +35,9 @@ @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): healthinsights_endpoint = os.environ.get( - "HEALTHINSIGHTS_ENDPOINT", "https://fake_ad_resource.cognitiveservices.azure.com/" + "AZURE_HEALTH_INSIGHTS_ENDPOINT", "https://fake_ad_resource.cognitiveservices.azure.com/" ) - healthinsights_key = os.environ.get("HEALTHINSIGHTS_KEY", "00000000000000000000000000000000") + healthinsights_key = os.environ.get("AZURE_HEALTH_INSIGHTS_API_KEY", "00000000000000000000000000000000") add_general_regex_sanitizer( regex=healthinsights_endpoint, value="https://fake_ad_resource.cognitiveservices.azure.com/" ) diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/tests/test_radiology_insights_async.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/tests/test_radiology_insights_async.py index b6039f7054bae..46034b38ab70d 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/tests/test_radiology_insights_async.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/tests/test_radiology_insights_async.py @@ -2,26 +2,27 @@ import datetime import asyncio -from azure.core.credentials import AzureKeyCredential from azure.healthinsights.radiologyinsights.aio import RadiologyInsightsClient from azure.healthinsights.radiologyinsights import models from devtools_testutils.aio import recorded_by_proxy_async from devtools_testutils import ( - AzureRecordedTestCase, + AzureRecordedTestCase, EnvironmentVariableLoader, + get_credential, ) HealthInsightsEnvPreparer = functools.partial( EnvironmentVariableLoader, "healthinsights", - healthinsights_endpoint="https://fake_ad_resource.cognitiveservices.azure.com/", - healthinsights_key="00000000000000000000000000000000", + healthinsights_endpoint="https://fake_ad_resource.cognitiveservices.azure.com", ) class TestRadiologyInsightsClient(AzureRecordedTestCase): - def create_request(self): + @HealthInsightsEnvPreparer() + @recorded_by_proxy_async + async def test_async(self, healthinsights_endpoint): doc_content1 = """CLINICAL HISTORY: 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. @@ -46,7 +47,7 @@ def create_request(self): start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) - encounter = models.Encounter( + encounter = models.PatientEncounter( id="encounter2", class_property=models.EncounterClass.IN_PATIENT, period=models.TimePeriod(start=start, end=end), @@ -63,7 +64,7 @@ def create_request(self): clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, id="doc2", content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), - created_date_time=create_date_time, + created_at=create_date_time, specialty_type=models.SpecialtyType.RADIOLOGY, administrative_metadata=models.DocumentAdministrativeMetadata( ordered_procedures=[ordered_procedure], encounter_id="encounter2" @@ -74,7 +75,7 @@ def create_request(self): patient1 = models.PatientRecord( id="patient_id2", - info=patient_info, + details=patient_info, encounters=[encounter], patient_documents=[patient_document1], ) @@ -82,25 +83,16 @@ def create_request(self): configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration) - return data - - @HealthInsightsEnvPreparer() - @recorded_by_proxy_async - async def test_critical_result(self, healthinsights_endpoint, healthinsights_key): + jobdata = models.RadiologyInsightsJob(job_data=data) radiology_insights_client = RadiologyInsightsClient( - healthinsights_endpoint, AzureKeyCredential(healthinsights_key) + healthinsights_endpoint, AzureRecordedTestCase.get_credential(self, RadiologyInsightsClient, is_async=True) ) - data = TestRadiologyInsightsClient.create_request(self) - request_time = datetime.datetime(2024, 2, 26, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + poller = await radiology_insights_client.begin_infer_radiology_insights( - data, - headers={ - "Repeatability-First-Sent": request_time.strftime("%a, %d %b %Y %H:%M:%S GMT"), - "Repeatability-Request-ID": "5189b7f2-a13a-4cac-bebf-407c4ffc3a7c", - }, + id="AsyncJobID", + resource=jobdata, ) radiology_insights_result = await poller.result() - for patient_result in radiology_insights_result.patient_results: assert patient_result.inferences is not None for inference in patient_result.inferences: diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/tests/test_radiology_insights_sync.py b/sdk/healthinsights/azure-healthinsights-radiologyinsights/tests/test_radiology_insights_sync.py index a6fe9c5d10d0e..91a89cc44ff95 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/tests/test_radiology_insights_sync.py +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/tests/test_radiology_insights_sync.py @@ -1,7 +1,6 @@ import functools import datetime -from azure.core.credentials import AzureKeyCredential from azure.healthinsights.radiologyinsights import RadiologyInsightsClient from azure.healthinsights.radiologyinsights import models @@ -9,18 +8,20 @@ AzureRecordedTestCase, EnvironmentVariableLoader, recorded_by_proxy, + get_credential, ) HealthInsightsEnvPreparer = functools.partial( EnvironmentVariableLoader, "healthinsights", - healthinsights_endpoint="https://fake_ad_resource.cognitiveservices.azure.com/", - healthinsights_key="00000000000000000000000000000000", + healthinsights_endpoint="https://fake_ad_resource.cognitiveservices.azure.com", ) class TestRadiologyInsightsClient(AzureRecordedTestCase): - def create_request(self): + @HealthInsightsEnvPreparer() + @recorded_by_proxy + def test_sync(self, healthinsights_endpoint): doc_content1 = """CLINICAL HISTORY: 20-year-old female presenting with abdominal pain. Surgical history significant for appendectomy. @@ -45,7 +46,7 @@ def create_request(self): start = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) end = datetime.datetime(2021, 8, 28, 0, 0, 0, 0) - encounter = models.Encounter( + encounter = models.PatientEncounter( id="encounter2", class_property=models.EncounterClass.IN_PATIENT, period=models.TimePeriod(start=start, end=end), @@ -62,7 +63,7 @@ def create_request(self): clinical_type=models.ClinicalDocumentType.RADIOLOGY_REPORT, id="doc2", content=models.DocumentContent(source_type=models.DocumentContentSourceType.INLINE, value=doc_content1), - created_date_time=create_date_time, + created_at=create_date_time, specialty_type=models.SpecialtyType.RADIOLOGY, administrative_metadata=models.DocumentAdministrativeMetadata( ordered_procedures=[ordered_procedure], encounter_id="encounter2" @@ -73,7 +74,7 @@ def create_request(self): patient1 = models.PatientRecord( id="patient_id2", - info=patient_info, + details=patient_info, encounters=[encounter], patient_documents=[patient_document1], ) @@ -81,22 +82,15 @@ def create_request(self): configuration = models.RadiologyInsightsModelConfiguration(verbose=False, include_evidence=True, locale="en-US") data = models.RadiologyInsightsData(patients=[patient1], configuration=configuration) - return data + jobdata = models.RadiologyInsightsJob(job_data=data) - @HealthInsightsEnvPreparer() - @recorded_by_proxy - def test_critical_result(self, healthinsights_endpoint, healthinsights_key): radiology_insights_client = RadiologyInsightsClient( - healthinsights_endpoint, AzureKeyCredential(healthinsights_key) + healthinsights_endpoint, get_credential() ) - data = TestRadiologyInsightsClient.create_request(self) - request_time = datetime.datetime(2024, 2, 26, 0, 0, 0, 0, tzinfo=datetime.timezone.utc) + poller = radiology_insights_client.begin_infer_radiology_insights( - data, - headers={ - "Repeatability-First-Sent": request_time.strftime("%a, %d %b %Y %H:%M:%S GMT"), - "Repeatability-Request-ID": "5ac5fbb2-0185-4c17-82dd-e0fcf36a2184", - }, + id="SyncJobID", + resource=jobdata, ) radiology_insights_result = poller.result() diff --git a/sdk/healthinsights/azure-healthinsights-radiologyinsights/tsp-location.yaml b/sdk/healthinsights/azure-healthinsights-radiologyinsights/tsp-location.yaml index 62b271fc8b89e..683d5ce5ea2a6 100644 --- a/sdk/healthinsights/azure-healthinsights-radiologyinsights/tsp-location.yaml +++ b/sdk/healthinsights/azure-healthinsights-radiologyinsights/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/ai/HealthInsights/HealthInsights.RadiologyInsights -commit: 3efb341e0472b4b1d85f9c015666a715d9f5fa5a +commit: db63bea839f5648462c94e685d5cc96f8e8b38ba repo: Azure/azure-rest-api-specs additionalDirectories: - specification/ai/HealthInsights/HealthInsights.Common/ diff --git a/sdk/healthinsights/ci.yml b/sdk/healthinsights/ci.yml index fe1ad22f785a9..fa130b3f192fa 100644 --- a/sdk/healthinsights/ci.yml +++ b/sdk/healthinsights/ci.yml @@ -30,15 +30,6 @@ extends: ServiceDirectory: healthinsights TestProxy: true Artifacts: - - name: azure-healthinsights-cancerprofiling - safeName: azurehealthinsightscancerprofiling - skipVerifyChangeLog: true - - - name: azure-healthinsights-clinicalmatching - safeName: azurehealthinsightsclinicalmatching - skipVerifyChangeLog: true - name: azure-healthinsights-radiologyinsights safeName: azurehealthinsightsradiologyinsights - skipVerifyChangeLog: true - diff --git a/sdk/healthinsights/tests.yml b/sdk/healthinsights/tests.yml index 865c7bdc10620..15b92dddd1341 100644 --- a/sdk/healthinsights/tests.yml +++ b/sdk/healthinsights/tests.yml @@ -9,12 +9,10 @@ trigger: none extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-tests.yml parameters: + UseFederatedAuth: true ServiceDirectory: healthinsights Location: '${{ parameters.Location }}' - EnvVars: - AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) - AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) - AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) + EnvVars: TEST_MODE: 'RunLiveNoRecord' AZURE_TEST_RUN_LIVE: 'true' AZURE_SKIP_LIVE_RECORDING: 'True' \ No newline at end of file diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/pyproject.toml b/sdk/hybridcompute/azure-mgmt-hybridcompute/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/pyproject.toml b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/pyproject.toml b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/pyproject.toml b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/hybridnetwork/azure-mgmt-hybridnetwork/pyproject.toml b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/hybridnetwork/azure-mgmt-hybridnetwork/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/identity/azure-identity-broker/pyproject.toml b/sdk/identity/azure-identity-broker/pyproject.toml index e68e9286f1327..f9fdc05263173 100644 --- a/sdk/identity/azure-identity-broker/pyproject.toml +++ b/sdk/identity/azure-identity-broker/pyproject.toml @@ -1,4 +1,3 @@ [tool.azure-sdk-build] type_check_samples = false -verifytypes = false pyright = false diff --git a/sdk/identity/azure-identity/CHANGELOG.md b/sdk/identity/azure-identity/CHANGELOG.md index 247ec35c65ced..99a54b0aa1391 100644 --- a/sdk/identity/azure-identity/CHANGELOG.md +++ b/sdk/identity/azure-identity/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.18.0b2 (Unreleased) +## 1.18.0b3 (Unreleased) ### Features Added @@ -10,6 +10,15 @@ ### Other Changes +- Added identity config validation to `ManagedIdentityCredential` to avoid non-deterministic states (e.g. both `resource_id` and `object_id` are specified). ([#36950](https://github.com/Azure/azure-sdk-for-python/pull/36950)) + +## 1.18.0b2 (2024-08-09) + +### Features Added + +- Added support of `send_certificate_chain` keyword argument when using certs with the synchronous `OnBehalfOfCredential`. ([#36810](https://github.com/Azure/azure-sdk-for-python/pull/36810)) +- `AzurePowerShellCredential` now supports using secure strings when authenticating with PowerShell. ([#36653](https://github.com/Azure/azure-sdk-for-python/pull/36653)) + ## 1.18.0b1 (2024-07-16) - Fixed the issue that `SharedTokenCacheCredential` was not picklable. diff --git a/sdk/identity/azure-identity/azure/identity/_credentials/azure_powershell.py b/sdk/identity/azure-identity/azure/identity/_credentials/azure_powershell.py index 0cd7523a533cc..da3dd2c45ab00 100644 --- a/sdk/identity/azure-identity/azure/identity/_credentials/azure_powershell.py +++ b/sdk/identity/azure-identity/azure/identity/_credentials/azure_powershell.py @@ -34,9 +34,24 @@ exit }} -$token = Get-AzAccessToken -ResourceUrl '{}'{} +$params = @{{ 'ResourceUrl' = '{}'; 'WarningAction' = 'Ignore' }} -Write-Output "`nazsdk%$($token.Token)%$($token.ExpiresOn.ToUnixTimeSeconds())`n" +$tenantId = '{}' +if ($tenantId.Length -gt 0) {{ + $params['TenantId'] = $tenantId +}} + +$useSecureString = $m.Version -ge [version]'2.17.0' +if ($useSecureString) {{ + $params['AsSecureString'] = $true +}} + +$token = Get-AzAccessToken @params +$tokenValue = $token.Token +if ($useSecureString) {{ + $tokenValue = $tokenValue | ConvertFrom-SecureString -AsPlainText +}} +Write-Output "`nazsdk%$($tokenValue)%$($token.ExpiresOn.ToUnixTimeSeconds())`n" """ @@ -182,10 +197,7 @@ def parse_token(output: str) -> AccessToken: def get_command_line(scopes: Tuple[str, ...], tenant_id: str) -> List[str]: - if tenant_id: - tenant_argument = " -TenantId " + tenant_id - else: - tenant_argument = "" + tenant_argument = tenant_id if tenant_id else "" resource = _scopes_to_resource(*scopes) script = SCRIPT.format(NO_AZ_ACCOUNT_MODULE, resource, tenant_argument) encoded_script = base64.b64encode(script.encode("utf-16-le")).decode() @@ -212,4 +224,6 @@ def raise_for_error(return_code: int, stdout: str, stderr: str) -> None: if stderr: # stderr is too noisy to include with an exception but may be useful for debugging _LOGGER.debug('%s received an error from Azure PowerShell: "%s"', AzurePowerShellCredential.__name__, stderr) - raise CredentialUnavailableError(message="Failed to invoke PowerShell") + raise CredentialUnavailableError( + message="Failed to invoke PowerShell. Enable debug logging for additional information." + ) diff --git a/sdk/identity/azure-identity/azure/identity/_credentials/device_code.py b/sdk/identity/azure-identity/azure/identity/_credentials/device_code.py index 4b3603a940471..053476b2b45a1 100644 --- a/sdk/identity/azure-identity/azure/identity/_credentials/device_code.py +++ b/sdk/identity/azure-identity/azure/identity/_credentials/device_code.py @@ -2,7 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ -from datetime import datetime +from datetime import datetime, timezone import time from typing import Dict, Optional, Callable, Any @@ -93,10 +93,9 @@ def _request_token(self, *scopes: str, **kwargs: Any) -> Dict: raise ClientAuthenticationError( message="Couldn't begin authentication: {}".format(flow.get("error_description") or flow.get("error")) ) - if self._prompt_callback: self._prompt_callback( - flow["verification_uri"], flow["user_code"], datetime.utcfromtimestamp(flow["expires_at"]) + flow["verification_uri"], flow["user_code"], datetime.fromtimestamp(flow["expires_at"], timezone.utc) ) else: print(flow["message"]) diff --git a/sdk/identity/azure-identity/azure/identity/_credentials/managed_identity.py b/sdk/identity/azure-identity/azure/identity/_credentials/managed_identity.py index 86e6cf29b113b..8c8fc9012cfc9 100644 --- a/sdk/identity/azure-identity/azure/identity/_credentials/managed_identity.py +++ b/sdk/identity/azure-identity/azure/identity/_credentials/managed_identity.py @@ -4,7 +4,7 @@ # ------------------------------------ import logging import os -from typing import Optional, TYPE_CHECKING, Any +from typing import Optional, TYPE_CHECKING, Any, Mapping from azure.core.credentials import AccessToken from .. import CredentialUnavailableError @@ -17,6 +17,22 @@ _LOGGER = logging.getLogger(__name__) +def validate_identity_config(client_id: Optional[str], identity_config: Optional[Mapping[str, str]]) -> None: + if identity_config: + if client_id: + if any(key in identity_config for key in ("object_id", "resource_id", "client_id")): + raise ValueError( + "identity_config must not contain 'object_id', 'resource_id', or 'client_id' when 'client_id' is " + "provided as a keyword argument." + ) + # Only one of these keys should be present if one is present. + valid_keys = {"object_id", "resource_id", "client_id"} + if len(identity_config.keys() & valid_keys) > 1: + raise ValueError( + f"identity_config must not contain more than one of the following keys: {', '.join(valid_keys)}" + ) + + class ManagedIdentityCredential: """Authenticates with an Azure managed identity in any hosting environment which supports managed identities. @@ -42,8 +58,11 @@ class ManagedIdentityCredential: :caption: Create a ManagedIdentityCredential. """ - def __init__(self, **kwargs: Any) -> None: - self._credential = None # type: Optional[TokenCredential] + def __init__( + self, *, client_id: Optional[str] = None, identity_config: Optional[Mapping[str, str]] = None, **kwargs: Any + ) -> None: + validate_identity_config(client_id, identity_config) + self._credential: Optional[TokenCredential] = None exclude_workload_identity = kwargs.pop("_exclude_workload_identity_credential", False) if os.environ.get(EnvironmentVariables.IDENTITY_ENDPOINT): if os.environ.get(EnvironmentVariables.IDENTITY_HEADER): @@ -51,28 +70,32 @@ def __init__(self, **kwargs: Any) -> None: _LOGGER.info("%s will use Service Fabric managed identity", self.__class__.__name__) from .service_fabric import ServiceFabricCredential - self._credential = ServiceFabricCredential(**kwargs) + self._credential = ServiceFabricCredential( + client_id=client_id, identity_config=identity_config, **kwargs + ) else: _LOGGER.info("%s will use App Service managed identity", self.__class__.__name__) from .app_service import AppServiceCredential - self._credential = AppServiceCredential(**kwargs) + self._credential = AppServiceCredential( + client_id=client_id, identity_config=identity_config, **kwargs + ) elif os.environ.get(EnvironmentVariables.IMDS_ENDPOINT): _LOGGER.info("%s will use Azure Arc managed identity", self.__class__.__name__) from .azure_arc import AzureArcCredential - self._credential = AzureArcCredential(**kwargs) + self._credential = AzureArcCredential(client_id=client_id, identity_config=identity_config, **kwargs) elif os.environ.get(EnvironmentVariables.MSI_ENDPOINT): if os.environ.get(EnvironmentVariables.MSI_SECRET): _LOGGER.info("%s will use Azure ML managed identity", self.__class__.__name__) from .azure_ml import AzureMLCredential - self._credential = AzureMLCredential(**kwargs) + self._credential = AzureMLCredential(client_id=client_id, identity_config=identity_config, **kwargs) else: _LOGGER.info("%s will use Cloud Shell managed identity", self.__class__.__name__) from .cloud_shell import CloudShellCredential - self._credential = CloudShellCredential(**kwargs) + self._credential = CloudShellCredential(client_id=client_id, identity_config=identity_config, **kwargs) elif ( all(os.environ.get(var) for var in EnvironmentVariables.WORKLOAD_IDENTITY_VARS) and not exclude_workload_identity @@ -80,21 +103,21 @@ def __init__(self, **kwargs: Any) -> None: _LOGGER.info("%s will use workload identity", self.__class__.__name__) from .workload_identity import WorkloadIdentityCredential - client_id = kwargs.pop("client_id", None) or os.environ.get(EnvironmentVariables.AZURE_CLIENT_ID) - if not client_id: + workload_client_id = client_id or os.environ.get(EnvironmentVariables.AZURE_CLIENT_ID) + if not workload_client_id: raise ValueError('Configure the environment with a client ID or pass a value for "client_id" argument') self._credential = WorkloadIdentityCredential( tenant_id=os.environ[EnvironmentVariables.AZURE_TENANT_ID], - client_id=client_id, + client_id=workload_client_id, file=os.environ[EnvironmentVariables.AZURE_FEDERATED_TOKEN_FILE], - **kwargs + **kwargs, ) else: from .imds import ImdsCredential _LOGGER.info("%s will use IMDS", self.__class__.__name__) - self._credential = ImdsCredential(**kwargs) + self._credential = ImdsCredential(client_id=client_id, identity_config=identity_config, **kwargs) def __enter__(self) -> "ManagedIdentityCredential": if self._credential: diff --git a/sdk/identity/azure-identity/azure/identity/_credentials/on_behalf_of.py b/sdk/identity/azure-identity/azure/identity/_credentials/on_behalf_of.py index 28d368413d3b9..9f8889bd44f5a 100644 --- a/sdk/identity/azure-identity/azure/identity/_credentials/on_behalf_of.py +++ b/sdk/identity/azure-identity/azure/identity/_credentials/on_behalf_of.py @@ -48,6 +48,9 @@ class OnBehalfOfCredential(MsalCredential, GetTokenMixin): is a unicode string, it will be encoded as UTF-8. If the certificate requires a different encoding, pass appropriately encoded bytes instead. :paramtype password: str or bytes + :keyword bool send_certificate_chain: If True when **client_certificate** is provided, the credential will send + the public certificate chain in the x5c header of each token request's JWT. This is required for Subject + Name/Issuer (SNI) authentication. Defaults to False. :keyword bool disable_instance_discovery: Determines whether or not instance discovery is performed when attempting to authenticate. Setting this to true will completely disable both instance discovery and authority validation. This functionality is intended for use in scenarios where the metadata endpoint cannot be reached, such as in @@ -78,6 +81,8 @@ def __init__( client_secret: Optional[str] = None, client_assertion_func: Optional[Callable[[], str]] = None, user_assertion: str, + password: Optional[Union[bytes, str]] = None, + send_certificate_chain: bool = False, **kwargs: Any ) -> None: self._assertion = user_assertion @@ -98,7 +103,10 @@ def __init__( raise ValueError('Specifying both "client_certificate" and "client_secret" is not valid.') try: credential = get_client_credential( - certificate_path=None, password=kwargs.pop("password", None), certificate_data=client_certificate + certificate_path=None, + password=password, + certificate_data=client_certificate, + send_certificate_chain=send_certificate_chain, ) except ValueError as ex: # client_certificate isn't a valid cert. diff --git a/sdk/identity/azure-identity/azure/identity/_internal/aad_client.py b/sdk/identity/azure-identity/azure/identity/_internal/aad_client.py index 5df594e02a17a..f12ff5618aa29 100644 --- a/sdk/identity/azure-identity/azure/identity/_internal/aad_client.py +++ b/sdk/identity/azure-identity/azure/identity/_internal/aad_client.py @@ -68,6 +68,7 @@ def _run_pipeline(self, request: HttpRequest, **kwargs: Any) -> AccessToken: # tenant_id is already part of `request` at this point kwargs.pop("tenant_id", None) kwargs.pop("claims", None) + kwargs.pop("client_secret", None) enable_cae = kwargs.pop("enable_cae", False) now = int(time.time()) response = self._pipeline.run(request, retry_on_methods=self._POST, **kwargs) diff --git a/sdk/identity/azure-identity/azure/identity/_internal/aad_client_base.py b/sdk/identity/azure-identity/azure/identity/_internal/aad_client_base.py index 7fc6655cc7f28..c41f87d23612e 100644 --- a/sdk/identity/azure-identity/azure/identity/_internal/aad_client_base.py +++ b/sdk/identity/azure-identity/azure/identity/_internal/aad_client_base.py @@ -87,12 +87,11 @@ def get_cached_access_token(self, scopes: Iterable[str], **kwargs: Any) -> Optio ) cache = self._get_cache(**kwargs) - tokens = cache.find( + for token in cache.search( TokenCache.CredentialType.ACCESS_TOKEN, target=list(scopes), query={"client_id": self._client_id, "realm": tenant}, - ) - for token in tokens: + ): expires_on = int(token["expires_on"]) if expires_on > int(time.time()): return AccessToken(token["secret"], expires_on) @@ -101,7 +100,7 @@ def get_cached_access_token(self, scopes: Iterable[str], **kwargs: Any) -> Optio def get_cached_refresh_tokens(self, scopes: Iterable[str], **kwargs) -> List[Dict]: # Assumes all cached refresh tokens belong to the same user cache = self._get_cache(**kwargs) - return cache.find(TokenCache.CredentialType.REFRESH_TOKEN, target=list(scopes)) + return list(cache.search(TokenCache.CredentialType.REFRESH_TOKEN, target=list(scopes))) @abc.abstractmethod def obtain_token_by_authorization_code(self, scopes, code, redirect_uri, client_secret=None, **kwargs): @@ -140,17 +139,21 @@ def _process_response(self, response: PipelineResponse, request_time: int, **kwa if response.http_request.body.get("grant_type") == "refresh_token": if content.get("error") == "invalid_grant": # the request's refresh token is invalid -> evict it from the cache - cache_entries = cache.find( - TokenCache.CredentialType.REFRESH_TOKEN, - query={"secret": response.http_request.body["refresh_token"]}, + cache_entries = list( + cache.search( + TokenCache.CredentialType.REFRESH_TOKEN, + query={"secret": response.http_request.body["refresh_token"]}, + ) ) for invalid_token in cache_entries: cache.remove_rt(invalid_token) if "refresh_token" in content: # Microsoft Entra ID returned a new refresh token -> update the cache entry - cache_entries = cache.find( - TokenCache.CredentialType.REFRESH_TOKEN, - query={"secret": response.http_request.body["refresh_token"]}, + cache_entries = list( + cache.search( + TokenCache.CredentialType.REFRESH_TOKEN, + query={"secret": response.http_request.body["refresh_token"]}, + ) ) # If the old token is in multiple cache entries, the cache is in a state we don't # expect or know how to reason about, so we update nothing. diff --git a/sdk/identity/azure-identity/azure/identity/_internal/managed_identity_client.py b/sdk/identity/azure-identity/azure/identity/_internal/managed_identity_client.py index b440428111428..1b867cc844073 100644 --- a/sdk/identity/azure-identity/azure/identity/_internal/managed_identity_client.py +++ b/sdk/identity/azure-identity/azure/identity/_internal/managed_identity_client.py @@ -82,8 +82,10 @@ def _process_response(self, response: PipelineResponse, request_time: int) -> Ac def get_cached_token(self, *scopes: str) -> Optional[AccessToken]: resource = _scopes_to_resource(*scopes) - tokens = self._cache.find(TokenCache.CredentialType.ACCESS_TOKEN, target=[resource]) - for token in tokens: + for token in self._cache.search( + TokenCache.CredentialType.ACCESS_TOKEN, + target=[resource], + ): expires_on = int(token["expires_on"]) if expires_on > time.time(): return AccessToken(token["secret"], expires_on) diff --git a/sdk/identity/azure-identity/azure/identity/_internal/msal_managed_identity_client.py b/sdk/identity/azure-identity/azure/identity/_internal/msal_managed_identity_client.py index 33a4320377c45..cee1acc03450e 100644 --- a/sdk/identity/azure-identity/azure/identity/_internal/msal_managed_identity_client.py +++ b/sdk/identity/azure-identity/azure/identity/_internal/msal_managed_identity_client.py @@ -2,7 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ -from typing import Any, Optional, Dict, cast, Union +from typing import Any, Optional, Dict, cast, Union, Mapping import abc import time import logging @@ -23,10 +23,12 @@ class MsalManagedIdentityClient(abc.ABC): # pylint:disable=client-accepts-api-v """Base class for managed identity client wrapping MSAL ManagedIdentityClient.""" # pylint:disable=missing-client-constructor-parameter-credential - def __init__(self, **kwargs: Any) -> None: - self._settings = kwargs + def __init__( + self, *, client_id: Optional[str] = None, identity_config: Optional[Mapping[str, str]] = None, **kwargs: Any + ) -> None: + self._settings = {"client_id": client_id, "identity_config": identity_config or {}} self._client = MsalClient(**kwargs) - managed_identity = self.get_managed_identity(**kwargs) + managed_identity = self.get_managed_identity() self._msal_client = msal.ManagedIdentityClient(managed_identity, http_client=self._client) def __enter__(self) -> "MsalManagedIdentityClient": @@ -56,20 +58,17 @@ def _request_token(self, *scopes: str, **kwargs: Any) -> AccessToken: # pylint: error_message = self.get_unavailable_message(error_desc) raise CredentialUnavailableError(error_message) - def get_managed_identity( - self, **kwargs: Any - ) -> Union[msal.UserAssignedManagedIdentity, msal.SystemAssignedManagedIdentity]: + def get_managed_identity(self) -> Union[msal.UserAssignedManagedIdentity, msal.SystemAssignedManagedIdentity]: """ Get the managed identity configuration. - :keyword str client_id: The client ID of the user-assigned managed identity. - :keyword dict identity_config: The identity configuration. :rtype: msal.UserAssignedManagedIdentity or msal.SystemAssignedManagedIdentity :return: The managed identity configuration. """ - if "client_id" in kwargs and kwargs["client_id"]: - return msal.UserAssignedManagedIdentity(client_id=kwargs["client_id"]) - identity_config = kwargs.pop("identity_config", None) or {} + + if "client_id" in self._settings and self._settings["client_id"]: + return msal.UserAssignedManagedIdentity(client_id=self._settings["client_id"]) + identity_config = cast(Dict, self._settings.get("identity_config")) or {} if "client_id" in identity_config and identity_config["client_id"]: return msal.UserAssignedManagedIdentity(client_id=identity_config["client_id"]) if "resource_id" in identity_config and identity_config["resource_id"]: @@ -154,5 +153,5 @@ def __getstate__(self) -> Dict[str, Any]: # pylint:disable=client-method-name-n def __setstate__(self, state: Dict[str, Any]) -> None: # pylint:disable=client-method-name-no-double-underscore self.__dict__.update(state) # Re-create the unpickable entries - managed_identity = self.get_managed_identity(**self._settings) + managed_identity = self.get_managed_identity() self._msal_client = msal.ManagedIdentityClient(managed_identity, http_client=self._client) diff --git a/sdk/identity/azure-identity/azure/identity/_internal/shared_token_cache.py b/sdk/identity/azure-identity/azure/identity/_internal/shared_token_cache.py index e25f0c9144680..867b255a0c765 100644 --- a/sdk/identity/azure-identity/azure/identity/_internal/shared_token_cache.py +++ b/sdk/identity/azure-identity/azure/identity/_internal/shared_token_cache.py @@ -157,9 +157,9 @@ def _get_cache_items_for_authority( :rtype: list[CacheItem] """ - cache = self._cae_cache if is_cae else self._cache + cache = cast(msal.TokenCache, self._cae_cache if is_cae else self._cache) items = [] - for item in cache.find(credential_type): + for item in cache.search(credential_type): environment = item.get("environment") if environment in self._environment_aliases: items.append(item) @@ -232,9 +232,9 @@ def _get_cached_access_token( if "home_account_id" not in account: return None - cache = self._cae_cache if is_cae else self._cache + cache = cast(msal.TokenCache, self._cae_cache if is_cae else self._cache) try: - cache_entries = cache.find( + cache_entries = cache.search( msal.TokenCache.CredentialType.ACCESS_TOKEN, target=list(scopes), query={"home_account_id": account["home_account_id"]}, @@ -253,9 +253,9 @@ def _get_refresh_tokens(self, account, is_cae: bool = False) -> List[str]: if "home_account_id" not in account: return [] - cache = self._cae_cache if is_cae else self._cache + cache = cast(msal.TokenCache, self._cae_cache if is_cae else self._cache) try: - cache_entries = cache.find( + cache_entries = cache.search( msal.TokenCache.CredentialType.REFRESH_TOKEN, query={"home_account_id": account["home_account_id"]} ) return [token["secret"] for token in cache_entries if "secret" in token] diff --git a/sdk/identity/azure-identity/azure/identity/_version.py b/sdk/identity/azure-identity/azure/identity/_version.py index b174194045645..d035169fcb270 100644 --- a/sdk/identity/azure-identity/azure/identity/_version.py +++ b/sdk/identity/azure-identity/azure/identity/_version.py @@ -2,4 +2,4 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ -VERSION = "1.18.0b2" +VERSION = "1.18.0b3" diff --git a/sdk/identity/azure-identity/azure/identity/aio/_credentials/managed_identity.py b/sdk/identity/azure-identity/azure/identity/aio/_credentials/managed_identity.py index 9e61083427c50..0362886712ed0 100644 --- a/sdk/identity/azure-identity/azure/identity/aio/_credentials/managed_identity.py +++ b/sdk/identity/azure-identity/azure/identity/aio/_credentials/managed_identity.py @@ -4,13 +4,14 @@ # ------------------------------------ import logging import os -from typing import TYPE_CHECKING, Optional, Any +from typing import TYPE_CHECKING, Optional, Any, Mapping from azure.core.credentials import AccessToken from .._internal import AsyncContextManager from .._internal.decorators import log_get_token_async from ... import CredentialUnavailableError from ..._constants import EnvironmentVariables +from ..._credentials.managed_identity import validate_identity_config if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential @@ -43,8 +44,11 @@ class ManagedIdentityCredential(AsyncContextManager): :caption: Create a ManagedIdentityCredential. """ - def __init__(self, **kwargs: Any) -> None: - self._credential = None # type: Optional[AsyncTokenCredential] + def __init__( + self, *, client_id: Optional[str] = None, identity_config: Optional[Mapping[str, str]] = None, **kwargs: Any + ) -> None: + validate_identity_config(client_id, identity_config) + self._credential: Optional[AsyncTokenCredential] = None exclude_workload_identity = kwargs.pop("_exclude_workload_identity_credential", False) if os.environ.get(EnvironmentVariables.IDENTITY_ENDPOINT): @@ -53,33 +57,32 @@ def __init__(self, **kwargs: Any) -> None: _LOGGER.info("%s will use Service Fabric managed identity", self.__class__.__name__) from .service_fabric import ServiceFabricCredential - self._credential = ServiceFabricCredential(**kwargs) + self._credential = ServiceFabricCredential( + client_id=client_id, identity_config=identity_config, **kwargs + ) else: _LOGGER.info("%s will use App Service managed identity", self.__class__.__name__) from .app_service import AppServiceCredential - self._credential = AppServiceCredential(**kwargs) + self._credential = AppServiceCredential( + client_id=client_id, identity_config=identity_config, **kwargs + ) elif os.environ.get(EnvironmentVariables.IMDS_ENDPOINT): _LOGGER.info("%s will use Azure Arc managed identity", self.__class__.__name__) from .azure_arc import AzureArcCredential - self._credential = AzureArcCredential(**kwargs) - else: - _LOGGER.info("%s will use Cloud Shell managed identity", self.__class__.__name__) - from .cloud_shell import CloudShellCredential - - self._credential = CloudShellCredential(**kwargs) + self._credential = AzureArcCredential(client_id=client_id, identity_config=identity_config, **kwargs) elif os.environ.get(EnvironmentVariables.MSI_ENDPOINT): if os.environ.get(EnvironmentVariables.MSI_SECRET): _LOGGER.info("%s will use Azure ML managed identity", self.__class__.__name__) from .azure_ml import AzureMLCredential - self._credential = AzureMLCredential(**kwargs) + self._credential = AzureMLCredential(client_id=client_id, identity_config=identity_config, **kwargs) else: _LOGGER.info("%s will use Cloud Shell managed identity", self.__class__.__name__) from .cloud_shell import CloudShellCredential - self._credential = CloudShellCredential(**kwargs) + self._credential = CloudShellCredential(client_id=client_id, identity_config=identity_config, **kwargs) elif ( all(os.environ.get(var) for var in EnvironmentVariables.WORKLOAD_IDENTITY_VARS) and not exclude_workload_identity @@ -87,13 +90,13 @@ def __init__(self, **kwargs: Any) -> None: _LOGGER.info("%s will use workload identity", self.__class__.__name__) from .workload_identity import WorkloadIdentityCredential - client_id = kwargs.pop("client_id", None) or os.environ.get(EnvironmentVariables.AZURE_CLIENT_ID) - if not client_id: + workload_client_id = client_id or os.environ.get(EnvironmentVariables.AZURE_CLIENT_ID) + if not workload_client_id: raise ValueError('Configure the environment with a client ID or pass a value for "client_id" argument') self._credential = WorkloadIdentityCredential( tenant_id=os.environ[EnvironmentVariables.AZURE_TENANT_ID], - client_id=client_id, + client_id=workload_client_id, file=os.environ[EnvironmentVariables.AZURE_FEDERATED_TOKEN_FILE], **kwargs ) @@ -101,7 +104,7 @@ def __init__(self, **kwargs: Any) -> None: from .imds import ImdsCredential _LOGGER.info("%s will use IMDS", self.__class__.__name__) - self._credential = ImdsCredential(**kwargs) + self._credential = ImdsCredential(client_id=client_id, identity_config=identity_config, **kwargs) async def __aenter__(self) -> "ManagedIdentityCredential": if self._credential: diff --git a/sdk/identity/azure-identity/azure/identity/aio/_credentials/on_behalf_of.py b/sdk/identity/azure-identity/azure/identity/aio/_credentials/on_behalf_of.py index 55dd007458db5..d807db72c9484 100644 --- a/sdk/identity/azure-identity/azure/identity/aio/_credentials/on_behalf_of.py +++ b/sdk/identity/azure-identity/azure/identity/aio/_credentials/on_behalf_of.py @@ -68,6 +68,7 @@ def __init__( client_secret: Optional[str] = None, client_assertion_func: Optional[Callable[[], str]] = None, user_assertion: str, + password: Optional[Union[str, bytes]] = None, **kwargs: Any ) -> None: super().__init__() @@ -90,7 +91,7 @@ def __init__( if client_secret: raise ValueError('Specifying both "client_certificate" and "client_secret" is not valid.') try: - cert = get_client_credential(None, kwargs.pop("password", None), client_certificate) + cert = get_client_credential(None, password, client_certificate) except ValueError as ex: message = '"client_certificate" is not a valid certificate in PEM or PKCS12 format' raise ValueError(message) from ex diff --git a/sdk/identity/azure-identity/azure/identity/aio/_internal/aad_client.py b/sdk/identity/azure-identity/azure/identity/aio/_internal/aad_client.py index 2f542747aab48..1a6bb03cc19b3 100644 --- a/sdk/identity/azure-identity/azure/identity/aio/_internal/aad_client.py +++ b/sdk/identity/azure-identity/azure/identity/aio/_internal/aad_client.py @@ -88,6 +88,7 @@ async def _run_pipeline(self, request: HttpRequest, **kwargs) -> AccessToken: # tenant_id is already part of `request` at this point kwargs.pop("tenant_id", None) kwargs.pop("claims", None) + kwargs.pop("client_secret", None) enable_cae = kwargs.pop("enable_cae", False) now = int(time.time()) response = await self._pipeline.run(request, retry_on_methods=self._POST, **kwargs) diff --git a/sdk/identity/azure-identity/azure/identity/aio/_internal/managed_identity_base.py b/sdk/identity/azure-identity/azure/identity/aio/_internal/managed_identity_base.py index b5e1164e97fb5..1bebc28fb5c75 100644 --- a/sdk/identity/azure-identity/azure/identity/aio/_internal/managed_identity_base.py +++ b/sdk/identity/azure-identity/azure/identity/aio/_internal/managed_identity_base.py @@ -3,7 +3,8 @@ # Licensed under the MIT License. # ------------------------------------ import abc -from typing import Any, cast, Optional, TypeVar +from types import TracebackType +from typing import Any, cast, Optional, TypeVar, Type from azure.core.credentials import AccessToken from . import AsyncContextManager @@ -34,9 +35,14 @@ async def __aenter__(self: T) -> T: await self._client.__aenter__() return self - async def __aexit__(self, *args): + async def __aexit__( + self, + exc_type: Optional[Type[BaseException]] = None, + exc_value: Optional[BaseException] = None, + traceback: Optional[TracebackType] = None, + ) -> None: if self._client: - await self._client.__aexit__(*args) + await self._client.__aexit__(exc_type, exc_value, traceback) async def close(self) -> None: await self.__aexit__() diff --git a/sdk/identity/azure-identity/tests/test_aad_client.py b/sdk/identity/azure-identity/tests/test_aad_client.py index eebe2f4a02e27..bd0dc721eb353 100644 --- a/sdk/identity/azure-identity/tests/test_aad_client.py +++ b/sdk/identity/azure-identity/tests/test_aad_client.py @@ -107,6 +107,9 @@ def send(request, **_): client.obtain_token_by_authorization_code("scope", "code", "uri") client.obtain_token_by_refresh_token("scope", "refresh token") + # obtain_token_by_refresh_token is client_secret safe + client.obtain_token_by_refresh_token("scope", "refresh token", client_secret="secret") + # authority can be configured via environment variable with patch.dict("os.environ", {EnvironmentVariables.AZURE_AUTHORITY_HOST: authority}, clear=True): client = AadClient(tenant_id=tenant_id, client_id="client id", transport=Mock(send=send)) @@ -202,8 +205,8 @@ def test_evicts_invalid_refresh_token(): cache = TokenCache() cache.add({"response": build_aad_response(uid="id1", utid="tid1", access_token="*", refresh_token=invalid_token)}) cache.add({"response": build_aad_response(uid="id2", utid="tid2", access_token="*", refresh_token="...")}) - assert len(cache.find(TokenCache.CredentialType.REFRESH_TOKEN)) == 2 - assert len(cache.find(TokenCache.CredentialType.REFRESH_TOKEN, query={"secret": invalid_token})) == 1 + assert len(list(cache.search(TokenCache.CredentialType.REFRESH_TOKEN))) == 2 + assert len(list(cache.search(TokenCache.CredentialType.REFRESH_TOKEN, query={"secret": invalid_token}))) == 1 def send(request, **_): assert request.data["refresh_token"] == invalid_token @@ -216,8 +219,8 @@ def send(request, **_): client.obtain_token_by_refresh_token(scopes=("scope",), refresh_token=invalid_token) assert transport.send.call_count == 1 - assert len(cache.find(TokenCache.CredentialType.REFRESH_TOKEN)) == 1 - assert len(cache.find(TokenCache.CredentialType.REFRESH_TOKEN, query={"secret": invalid_token})) == 0 + assert len(list(cache.search(TokenCache.CredentialType.REFRESH_TOKEN))) == 1 + assert len(list(cache.search(TokenCache.CredentialType.REFRESH_TOKEN, query={"secret": invalid_token}))) == 0 def test_retries_token_requests(): diff --git a/sdk/identity/azure-identity/tests/test_aad_client_async.py b/sdk/identity/azure-identity/tests/test_aad_client_async.py index 8b007530bd615..f618669fba353 100644 --- a/sdk/identity/azure-identity/tests/test_aad_client_async.py +++ b/sdk/identity/azure-identity/tests/test_aad_client_async.py @@ -179,6 +179,9 @@ async def send(request, **_): await client.obtain_token_by_authorization_code("scope", "code", "uri") await client.obtain_token_by_refresh_token("scope", "refresh token") + # obtain_token_by_refresh_token is client_secret safe + client.obtain_token_by_refresh_token("scope", "refresh token", client_secret="secret") + # authority can be configured via environment variable with patch.dict("os.environ", {EnvironmentVariables.AZURE_AUTHORITY_HOST: authority}, clear=True): client = AadClient(tenant_id=tenant_id, client_id="client id", transport=Mock(send=send)) @@ -196,8 +199,8 @@ async def test_evicts_invalid_refresh_token(): cache = TokenCache() cache.add({"response": build_aad_response(uid="id1", utid="tid1", access_token="*", refresh_token=invalid_token)}) cache.add({"response": build_aad_response(uid="id2", utid="tid2", access_token="*", refresh_token="...")}) - assert len(cache.find(TokenCache.CredentialType.REFRESH_TOKEN)) == 2 - assert len(cache.find(TokenCache.CredentialType.REFRESH_TOKEN, query={"secret": invalid_token})) == 1 + assert len(list(cache.search(TokenCache.CredentialType.REFRESH_TOKEN))) == 2 + assert len(list(cache.search(TokenCache.CredentialType.REFRESH_TOKEN, query={"secret": invalid_token}))) == 1 async def send(request, **_): assert request.data["refresh_token"] == invalid_token @@ -210,8 +213,8 @@ async def send(request, **_): await client.obtain_token_by_refresh_token(scopes=("scope",), refresh_token=invalid_token) assert transport.send.call_count == 1 - assert len(cache.find(TokenCache.CredentialType.REFRESH_TOKEN)) == 1 - assert len(cache.find(TokenCache.CredentialType.REFRESH_TOKEN, query={"secret": invalid_token})) == 0 + assert len(list(cache.search(TokenCache.CredentialType.REFRESH_TOKEN))) == 1 + assert len(list(cache.search(TokenCache.CredentialType.REFRESH_TOKEN, query={"secret": invalid_token}))) == 0 async def test_retries_token_requests(): diff --git a/sdk/identity/azure-identity/tests/test_auth_code.py b/sdk/identity/azure-identity/tests/test_auth_code.py index 069e26071ac65..a4ee062e84d10 100644 --- a/sdk/identity/azure-identity/tests/test_auth_code.py +++ b/sdk/identity/azure-identity/tests/test_auth_code.py @@ -136,7 +136,7 @@ def test_auth_code_credential(): assert transport.send.call_count == 1 # no auth code, no cached token -> credential should redeem refresh token - cached_access_token = cache.find(cache.CredentialType.ACCESS_TOKEN)[0] + cached_access_token = list(cache.search(cache.CredentialType.ACCESS_TOKEN))[0] cache.remove_at(cached_access_token) token = credential.get_token(expected_scope) assert token.token == expected_access_token diff --git a/sdk/identity/azure-identity/tests/test_auth_code_async.py b/sdk/identity/azure-identity/tests/test_auth_code_async.py index e3df67bc764d3..2d8c984851e2f 100644 --- a/sdk/identity/azure-identity/tests/test_auth_code_async.py +++ b/sdk/identity/azure-identity/tests/test_auth_code_async.py @@ -160,7 +160,7 @@ async def test_auth_code_credential(): assert transport.send.call_count == 1 # no auth code, no cached token -> credential should redeem refresh token - cached_access_token = cache.find(cache.CredentialType.ACCESS_TOKEN)[0] + cached_access_token = list(cache.search(cache.CredentialType.ACCESS_TOKEN))[0] cache.remove_at(cached_access_token) token = await credential.get_token(expected_scope) assert token.token == expected_access_token diff --git a/sdk/identity/azure-identity/tests/test_certificate_credential.py b/sdk/identity/azure-identity/tests/test_certificate_credential.py index eebddafd26529..a9352b85a5794 100644 --- a/sdk/identity/azure-identity/tests/test_certificate_credential.py +++ b/sdk/identity/azure-identity/tests/test_certificate_credential.py @@ -414,7 +414,7 @@ def test_persistent_cache_multiple_clients(cert_path, cert_password): assert token_b.token == access_token_b assert transport_b.send.call_count == 2 - assert len(cache.find(TokenCache.CredentialType.ACCESS_TOKEN)) == 2 + assert len(list(cache.search(TokenCache.CredentialType.ACCESS_TOKEN))) == 2 def test_certificate_arguments(): diff --git a/sdk/identity/azure-identity/tests/test_certificate_credential_async.py b/sdk/identity/azure-identity/tests/test_certificate_credential_async.py index e93990d92cfe0..79786bb0216e1 100644 --- a/sdk/identity/azure-identity/tests/test_certificate_credential_async.py +++ b/sdk/identity/azure-identity/tests/test_certificate_credential_async.py @@ -334,7 +334,7 @@ async def test_persistent_cache_multiple_clients(cert_path, cert_password): assert transport_b.send.call_count == 1 assert mock_cache_loader.call_count == 2 - assert len(cache.find(TokenCache.CredentialType.ACCESS_TOKEN)) == 2 + assert len(list(cache.search(TokenCache.CredentialType.ACCESS_TOKEN))) == 2 def test_certificate_arguments(): diff --git a/sdk/identity/azure-identity/tests/test_client_secret_credential.py b/sdk/identity/azure-identity/tests/test_client_secret_credential.py index 39a1ac9a6e5db..7b9b9a195ef4b 100644 --- a/sdk/identity/azure-identity/tests/test_client_secret_credential.py +++ b/sdk/identity/azure-identity/tests/test_client_secret_credential.py @@ -260,7 +260,7 @@ def test_cache_multiple_clients(): assert token_b.token == access_token_b assert transport_b.send.call_count == 2 - assert len(cache.find(TokenCache.CredentialType.ACCESS_TOKEN)) == 2 + assert len(list(cache.search(TokenCache.CredentialType.ACCESS_TOKEN))) == 2 def test_multitenant_authentication(): diff --git a/sdk/identity/azure-identity/tests/test_client_secret_credential_async.py b/sdk/identity/azure-identity/tests/test_client_secret_credential_async.py index d84105807014d..0b4a91ac6a117 100644 --- a/sdk/identity/azure-identity/tests/test_client_secret_credential_async.py +++ b/sdk/identity/azure-identity/tests/test_client_secret_credential_async.py @@ -304,7 +304,7 @@ async def test_cache_multiple_clients(): assert transport_b.send.call_count == 1 assert mock_cache_loader.call_count == 2 - assert len(cache.find(TokenCache.CredentialType.ACCESS_TOKEN)) == 2 + assert len(list(cache.search(TokenCache.CredentialType.ACCESS_TOKEN))) == 2 @pytest.mark.asyncio diff --git a/sdk/identity/azure-identity/tests/test_device_code_credential.py b/sdk/identity/azure-identity/tests/test_device_code_credential.py index edfe1482f106e..d8ee36d4f59de 100644 --- a/sdk/identity/azure-identity/tests/test_device_code_credential.py +++ b/sdk/identity/azure-identity/tests/test_device_code_credential.py @@ -209,7 +209,7 @@ def test_device_code_credential(): disable_instance_discovery=True, ) - now = datetime.datetime.utcnow() + now = datetime.datetime.now(datetime.timezone.utc) token = credential.get_token("scope") assert token.token == expected_token @@ -269,7 +269,6 @@ def test_tenant_id(): additionally_allowed_tenants=["*"], ) - now = datetime.datetime.utcnow() token = credential.get_token("scope", tenant_id="tenant_id") assert token.token == expected_token diff --git a/sdk/identity/azure-identity/tests/test_live_async.py b/sdk/identity/azure-identity/tests/test_live_async.py index 0786f7dfc2795..073ef3f65e7d4 100644 --- a/sdk/identity/azure-identity/tests/test_live_async.py +++ b/sdk/identity/azure-identity/tests/test_live_async.py @@ -73,18 +73,21 @@ async def test_default_credential(live_service_principal): @pytest.mark.manual +@pytest.mark.asyncio async def test_cli_credential(): credential = AzureCliCredential() await get_token(credential) @pytest.mark.manual +@pytest.mark.asyncio async def test_dev_cli_credential(): credential = AzureDeveloperCliCredential() await get_token(credential) @pytest.mark.manual +@pytest.mark.asyncio async def test_powershell_credential(): credential = AzurePowerShellCredential() await get_token(credential) diff --git a/sdk/identity/azure-identity/tests/test_managed_identity.py b/sdk/identity/azure-identity/tests/test_managed_identity.py index bea5699589331..13ba051fcc006 100644 --- a/sdk/identity/azure-identity/tests/test_managed_identity.py +++ b/sdk/identity/azure-identity/tests/test_managed_identity.py @@ -944,3 +944,24 @@ def test_token_exchange_tenant_id(tmpdir): credential = ManagedIdentityCredential(transport=transport) token = credential.get_token(scope, tenant_id="tenant_id") assert token.token == access_token + + +def test_validate_identity_config(): + ManagedIdentityCredential() + ManagedIdentityCredential(client_id="foo") + ManagedIdentityCredential(identity_config={"foo": "bar"}) + ManagedIdentityCredential(identity_config={"client_id": "foo"}) + ManagedIdentityCredential(identity_config={"object_id": "foo"}) + ManagedIdentityCredential(identity_config={"resource_id": "foo"}) + ManagedIdentityCredential(identity_config={"foo": "bar"}, client_id="foo") + + with pytest.raises(ValueError): + ManagedIdentityCredential(identity_config={"client_id": "foo"}, client_id="foo") + with pytest.raises(ValueError): + ManagedIdentityCredential(identity_config={"object_id": "bar"}, client_id="bar") + with pytest.raises(ValueError): + ManagedIdentityCredential(identity_config={"resource_id": "bar"}, client_id="bar") + with pytest.raises(ValueError): + ManagedIdentityCredential(identity_config={"object_id": "bar", "resource_id": "foo"}) + with pytest.raises(ValueError): + ManagedIdentityCredential(identity_config={"object_id": "bar", "client_id": "foo"}) diff --git a/sdk/identity/azure-identity/tests/test_managed_identity_async.py b/sdk/identity/azure-identity/tests/test_managed_identity_async.py index edc3302f891ed..71a3c2929cd60 100644 --- a/sdk/identity/azure-identity/tests/test_managed_identity_async.py +++ b/sdk/identity/azure-identity/tests/test_managed_identity_async.py @@ -1213,3 +1213,24 @@ async def test_token_exchange_tenant_id(tmpdir): credential = ManagedIdentityCredential(transport=transport) token = await credential.get_token(scope, tenant_id="tenant_id") assert token.token == access_token + + +def test_validate_identity_config(): + ManagedIdentityCredential() + ManagedIdentityCredential(client_id="foo") + ManagedIdentityCredential(identity_config={"foo": "bar"}) + ManagedIdentityCredential(identity_config={"client_id": "foo"}) + ManagedIdentityCredential(identity_config={"object_id": "foo"}) + ManagedIdentityCredential(identity_config={"resource_id": "foo"}) + ManagedIdentityCredential(identity_config={"foo": "bar"}, client_id="foo") + + with pytest.raises(ValueError): + ManagedIdentityCredential(identity_config={"client_id": "foo"}, client_id="foo") + with pytest.raises(ValueError): + ManagedIdentityCredential(identity_config={"object_id": "bar"}, client_id="bar") + with pytest.raises(ValueError): + ManagedIdentityCredential(identity_config={"resource_id": "bar"}, client_id="bar") + with pytest.raises(ValueError): + ManagedIdentityCredential(identity_config={"object_id": "bar", "resource_id": "foo"}) + with pytest.raises(ValueError): + ManagedIdentityCredential(identity_config={"object_id": "bar", "client_id": "foo"}) diff --git a/sdk/identity/azure-identity/tests/test_obo.py b/sdk/identity/azure-identity/tests/test_obo.py index ea369310877b2..3678b4fa85068 100644 --- a/sdk/identity/azure-identity/tests/test_obo.py +++ b/sdk/identity/azure-identity/tests/test_obo.py @@ -279,3 +279,26 @@ def test_client_assertion_func_with_client_certificate(): user_assertion="assertion", ) assert "It is invalid to specify more than one of the following" in str(ex.value) + + +def test_client_certificate_with_params(): + """Ensure keyword arguments are passed to get_client_credential when client_certificate is provided""" + expected_send_certificate_chain = True + + cert_path = os.path.join(os.path.dirname(__file__), "certificate-with-password.pem") + cert_password = "password" + with open(cert_path, "rb") as f: + cert_bytes = f.read() + + credential = OnBehalfOfCredential( + "tenant-id", + "client-id", + client_certificate=cert_bytes, + password=cert_password, + send_certificate_chain=expected_send_certificate_chain, + user_assertion="assertion", + ) + + assert "passphrase" in credential._client_credential + assert credential._client_credential["passphrase"] == cert_password.encode("utf-8") + assert "public_certificate" in credential._client_credential diff --git a/sdk/identity/azure-identity/tests/test_powershell_credential.py b/sdk/identity/azure-identity/tests/test_powershell_credential.py index 2424833f7c26a..9441f1c69756f 100644 --- a/sdk/identity/azure-identity/tests/test_powershell_credential.py +++ b/sdk/identity/azure-identity/tests/test_powershell_credential.py @@ -114,8 +114,8 @@ def test_get_token(stderr): assert match, "couldn't find encoded script in command line" encoded_script = match.groups()[0] decoded_script = base64.b64decode(encoded_script).decode("utf-16-le") - assert "TenantId" not in decoded_script - assert "Get-AzAccessToken -ResourceUrl '{}'".format(scope) in decoded_script + assert "tenantId = ''" in decoded_script + assert f"'ResourceUrl' = '{scope}'" in decoded_script assert Popen().communicate.call_count == 1 args, kwargs = Popen().communicate.call_args @@ -292,7 +292,7 @@ def Popen(args, **kwargs): def test_multitenant_authentication(): first_token = "***" - second_tenant = "second-tenant" + second_tenant = "12345" second_token = first_token * 2 def fake_Popen(command, **_): @@ -301,11 +301,12 @@ def fake_Popen(command, **_): assert match, "couldn't find encoded script in command line" encoded_script = match.groups()[0] decoded_script = base64.b64decode(encoded_script).decode("utf-16-le") - match = re.search(r"Get-AzAccessToken -ResourceUrl '(\S+)'(?: -TenantId (\S+))?", decoded_script) - tenant = match.groups()[1] + match = re.search(r"\$tenantId\s*=\s*'([^']*)'", decoded_script) + assert match + tenant = match.group(1) - assert tenant is None or tenant == second_tenant, 'unexpected tenant "{}"'.format(tenant) - token = first_token if tenant is None else second_token + assert not tenant or tenant == second_tenant, 'unexpected tenant "{}"'.format(tenant) + token = first_token if not tenant else second_token stdout = "azsdk%{}%{}".format(token, int(time.time()) + 3600) communicate = Mock(return_value=(stdout, "")) @@ -333,10 +334,11 @@ def fake_Popen(command, **_): assert match, "couldn't find encoded script in command line" encoded_script = match.groups()[0] decoded_script = base64.b64decode(encoded_script).decode("utf-16-le") - match = re.search(r"Get-AzAccessToken -ResourceUrl '(\S+)'(?: -TenantId (\S+))?", decoded_script) - tenant = match.groups()[1] + match = re.search(r"\$tenantId\s*=\s*'([^']*)'", decoded_script) + assert match + tenant = match.group(1) - assert tenant is None, "credential shouldn't accept an explicit tenant ID" + assert not tenant, "credential shouldn't accept an explicit tenant ID" stdout = "azsdk%{}%{}".format(expected_token, int(time.time()) + 3600) communicate = Mock(return_value=(stdout, "")) @@ -348,5 +350,5 @@ def fake_Popen(command, **_): assert token.token == expected_token with patch.dict("os.environ", {EnvironmentVariables.AZURE_IDENTITY_DISABLE_MULTITENANTAUTH: "true"}): - token = credential.get_token("scope", tenant_id="some-tenant") + token = credential.get_token("scope", tenant_id="12345") assert token.token == expected_token diff --git a/sdk/identity/azure-identity/tests/test_powershell_credential_async.py b/sdk/identity/azure-identity/tests/test_powershell_credential_async.py index 2270ef42fb70a..bc694b7ef01aa 100644 --- a/sdk/identity/azure-identity/tests/test_powershell_credential_async.py +++ b/sdk/identity/azure-identity/tests/test_powershell_credential_async.py @@ -104,8 +104,8 @@ async def test_get_token(stderr): assert match, "couldn't find encoded script in command line" encoded_script = match.groups()[0] decoded_script = base64.b64decode(encoded_script).decode("utf-16-le") - assert "TenantId" not in decoded_script - assert "Get-AzAccessToken -ResourceUrl '{}'".format(scope) in decoded_script + assert "tenantId = ''" in decoded_script + assert f"'ResourceUrl' = '{scope}'" in decoded_script assert mock_exec().result().communicate.call_count == 1 @@ -289,7 +289,7 @@ async def mock_exec(*args, **kwargs): async def test_multitenant_authentication(): first_token = "***" - second_tenant = "second-tenant" + second_tenant = "12345" second_token = first_token * 2 async def fake_exec(*args, **_): @@ -299,11 +299,12 @@ async def fake_exec(*args, **_): assert match, "couldn't find encoded script in command line" encoded_script = match.groups()[0] decoded_script = base64.b64decode(encoded_script).decode("utf-16-le") - match = re.search(r"Get-AzAccessToken -ResourceUrl '(\S+)'(?: -TenantId (\S+))?", decoded_script) - tenant = match[2] + match = re.search(r"\$tenantId\s*=\s*'([^']*)'", decoded_script) + assert match + tenant = match.group(1) - assert tenant is None or tenant == second_tenant, 'unexpected tenant "{}"'.format(tenant) - token = first_token if tenant is None else second_token + assert not tenant or tenant == second_tenant, 'unexpected tenant "{}"'.format(tenant) + token = first_token if not tenant else second_token stdout = "azsdk%{}%{}".format(token, int(time.time()) + 3600) communicate = Mock(return_value=get_completed_future((stdout.encode(), b""))) @@ -332,10 +333,11 @@ async def fake_exec(*args, **_): assert match, "couldn't find encoded script in command line" encoded_script = match.groups()[0] decoded_script = base64.b64decode(encoded_script).decode("utf-16-le") - match = re.search(r"Get-AzAccessToken -ResourceUrl '(\S+)'(?: -TenantId (\S+))?", decoded_script) - tenant = match[2] + match = re.search(r"\$tenantId\s*=\s*'([^']*)'", decoded_script) + assert match + tenant = match.group(1) - assert tenant is None, "credential shouldn't accept an explicit tenant ID" + assert not tenant, "credential shouldn't accept an explicit tenant ID" stdout = "azsdk%{}%{}".format(expected_token, int(time.time()) + 3600) communicate = Mock(return_value=get_completed_future((stdout.encode(), b""))) return Mock(communicate=communicate, returncode=0) @@ -346,5 +348,5 @@ async def fake_exec(*args, **_): assert token.token == expected_token with patch.dict("os.environ", {EnvironmentVariables.AZURE_IDENTITY_DISABLE_MULTITENANTAUTH: "true"}): - token = await credential.get_token("scope", tenant_id="some-tenant") + token = await credential.get_token("scope", tenant_id="12345") assert token.token == expected_token diff --git a/sdk/identity/azure-identity/tests/test_shared_cache_credential.py b/sdk/identity/azure-identity/tests/test_shared_cache_credential.py index 0957063cff8da..ba1052ac52c30 100644 --- a/sdk/identity/azure-identity/tests/test_shared_cache_credential.py +++ b/sdk/identity/azure-identity/tests/test_shared_cache_credential.py @@ -752,7 +752,7 @@ def test_writes_to_cache(): assert token.token == second_access_token # verify the credential didn't add a new cache entry - assert len(cache.find(TokenCache.CredentialType.REFRESH_TOKEN)) == 1 + assert len(list(cache.search(TokenCache.CredentialType.REFRESH_TOKEN))) == 1 def test_initialization(): diff --git a/sdk/informaticadatamanagement/azure-mgmt-informaticadatamanagement/pyproject.toml b/sdk/informaticadatamanagement/azure-mgmt-informaticadatamanagement/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/informaticadatamanagement/azure-mgmt-informaticadatamanagement/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/pyproject.toml b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/iotfirmwaredefense/azure-mgmt-iotfirmwaredefense/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/iothub/azure-mgmt-iotcentral/pyproject.toml b/sdk/iothub/azure-mgmt-iotcentral/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iotcentral/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/iothub/azure-mgmt-iothub/pyproject.toml b/sdk/iothub/azure-mgmt-iothub/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/iothub/azure-mgmt-iothubprovisioningservices/pyproject.toml b/sdk/iothub/azure-mgmt-iothubprovisioningservices/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothubprovisioningservices/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/keyvault/azure-keyvault-administration/tests.yml b/sdk/keyvault/azure-keyvault-administration/tests.yml index 00a0448f0dc03..339df26b82700 100644 --- a/sdk/keyvault/azure-keyvault-administration/tests.yml +++ b/sdk/keyvault/azure-keyvault-administration/tests.yml @@ -6,43 +6,28 @@ extends: ServiceDirectory: keyvault BuildTargetingString: "azure-keyvault-administration" JobName: azure_keyvault_administration - SupportedClouds: 'Public,UsGov,China' + SupportedClouds: 'Public' TestTimeoutInMinutes: 240 - TestResourceDirectories: - - keyvault/ + UseFederatedAuth: true + # Since we don't use HSMs in USGov or China clouds, just run Admin tests in Public. CloudConfig: Public: + Location: 'westus2' + SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources) ServiceConnection: azure-sdk-tests SubscriptionConfigurationFilePaths: - eng/common/TestResources/sub-config/AzurePublicMsft.json - UsGov: - ServiceConnection: usgov_azure-sdk-tests - SubscriptionConfigurationFilePaths: - - eng/common/TestResources/sub-config/AzureUsGovMsft.json - MatrixFilters: - - ArmTemplateParameters=^(?!.*enableHsm.*true) - China: - ServiceConnection: china_azure-sdk-tests - SubscriptionConfigurationFilePaths: - - eng/common/TestResources/sub-config/AzureChinaMsft.json - MatrixFilters: - - ArmTemplateParameters=^(?!.*enableHsm.*true) - Location: chinaeast2 - # Test azure-keyvault-administration on *only* Managed HSM for weekly tests only - MatrixConfigs: - - Name: keyvault_admin_weekly_matrix - Path: sdk/keyvault/azure-keyvault-keys/platform-matrix.json - Selection: sparse - GenerateVMJobs: true - ${{ if not(contains(variables['Build.DefinitionName'], 'tests-weekly')) }}: - # For nightly tests, don't run live azure-keyvault-administration jobs since they require Managed HSM - MatrixFilters: - - OSVmImage=NonexistentImage + # HSMs are expensive and restricted in number so we only test them on one platform. + AdditionalMatrixConfigs: + - Name: keyvault_hsm_matrix_addons + Path: sdk/keyvault/azure-keyvault-keys/platform-matrix.json + Selection: sparse + GenerateVMJobs: true + + # Due to the high cost of Managed HSMs, we only want to test using them weekly. + ${{ if not(contains(variables['Build.DefinitionName'], 'tests-weekly')) }}: + MatrixFilters: + - ArmTemplateParameters=^(?!.*enableHsm.*true) EnvVars: AZURE_TEST_RUN_LIVE: true AZURE_SKIP_LIVE_RECORDING: 'True' - AZURE_SUBSCRIPTION_ID: $(azure-subscription-id) - AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) - AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) - AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) - AZURE_CLIENT_OID: $(aad-azure-sdk-test-client-oid) diff --git a/sdk/keyvault/azure-keyvault-administration/tests/_async_test_case.py b/sdk/keyvault/azure-keyvault-administration/tests/_async_test_case.py index cece3f5425630..71a87a26531c4 100644 --- a/sdk/keyvault/azure-keyvault-administration/tests/_async_test_case.py +++ b/sdk/keyvault/azure-keyvault-administration/tests/_async_test_case.py @@ -19,10 +19,9 @@ def __init__(self, **kwargs) -> None: if self.is_live: self.managed_hsm_url = os.environ.get("AZURE_MANAGEDHSM_URL") - storage_name = os.environ.get("BLOB_STORAGE_ACCOUNT_NAME") - storage_endpoint_suffix = os.environ.get("KEYVAULT_STORAGE_ENDPOINT_SUFFIX") + storage_url = os.environ.get("BLOB_STORAGE_URL") container_name = os.environ.get("BLOB_CONTAINER_NAME") - self.container_uri = f"https://{storage_name}.blob.{storage_endpoint_suffix}/{container_name}" + self.container_uri = f"{storage_url}/{container_name}" self.sas_token = os.environ.get("BLOB_STORAGE_SAS_TOKEN") diff --git a/sdk/keyvault/azure-keyvault-administration/tests/_test_case.py b/sdk/keyvault/azure-keyvault-administration/tests/_test_case.py index 67a5c7f450ab6..572b14ab86767 100644 --- a/sdk/keyvault/azure-keyvault-administration/tests/_test_case.py +++ b/sdk/keyvault/azure-keyvault-administration/tests/_test_case.py @@ -20,10 +20,9 @@ def __init__(self, **kwargs) -> None: if self.is_live: self.managed_hsm_url = os.environ.get("AZURE_MANAGEDHSM_URL") - storage_name = os.environ.get("BLOB_STORAGE_ACCOUNT_NAME") - storage_endpoint_suffix = os.environ.get("KEYVAULT_STORAGE_ENDPOINT_SUFFIX") + storage_url = os.environ.get("BLOB_STORAGE_URL") container_name = os.environ.get("BLOB_CONTAINER_NAME") - self.container_uri = f"https://{storage_name}.blob.{storage_endpoint_suffix}/{container_name}" + self.container_uri = f"{storage_url}/{container_name}" self.sas_token = os.environ.get("BLOB_STORAGE_SAS_TOKEN") diff --git a/sdk/keyvault/azure-keyvault-administration/tests/conftest.py b/sdk/keyvault/azure-keyvault-administration/tests/conftest.py index 60671edf47550..66f14f669a464 100644 --- a/sdk/keyvault/azure-keyvault-administration/tests/conftest.py +++ b/sdk/keyvault/azure-keyvault-administration/tests/conftest.py @@ -20,26 +20,24 @@ @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): - azure_keyvault_url = os.getenv("AZURE_KEYVAULT_URL", "https://vaultname.vault.azure.net") + azure_keyvault_url = os.getenv("AZURE_KEYVAULT_URL", "https://Sanitized.vault.azure.net") azure_keyvault_url = azure_keyvault_url.rstrip("/") keyvault_tenant_id = os.getenv("KEYVAULT_TENANT_ID", "keyvault_tenant_id") keyvault_subscription_id = os.getenv("KEYVAULT_SUBSCRIPTION_ID", "keyvault_subscription_id") - azure_managedhsm_url = os.environ.get("AZURE_MANAGEDHSM_URL","https://managedhsmvaultname.managedhsm.azure.net") + azure_managedhsm_url = os.environ.get("AZURE_MANAGEDHSM_URL","https://Sanitized.managedhsm.azure.net") azure_managedhsm_url = azure_managedhsm_url.rstrip("/") - azure_attestation_uri = os.environ.get("AZURE_KEYVAULT_ATTESTATION_URL","https://fakeattestation.azurewebsites.net") + azure_attestation_uri = os.environ.get("AZURE_KEYVAULT_ATTESTATION_URL","https://Sanitized.azurewebsites.net") azure_attestation_uri = azure_attestation_uri.rstrip('/') - storage_name = os.environ.get("BLOB_STORAGE_ACCOUNT_NAME", "blob_storage_account_name") - storage_endpoint_suffix = os.environ.get("KEYVAULT_STORAGE_ENDPOINT_SUFFIX", "keyvault_endpoint_suffix") + storage_url = os.environ.get("BLOB_STORAGE_URL", "https://Sanitized.blob.core.windows.net") client_id = os.environ.get("KEYVAULT_CLIENT_ID", "service-principal-id") sas_token = os.environ.get("BLOB_STORAGE_SAS_TOKEN","fake-sas") - add_general_string_sanitizer(target=azure_keyvault_url, value="https://vaultname.vault.azure.net") + add_general_string_sanitizer(target=azure_keyvault_url, value="https://Sanitized.vault.azure.net") add_general_string_sanitizer(target=keyvault_tenant_id, value="00000000-0000-0000-0000-000000000000") add_general_string_sanitizer(target=keyvault_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_string_sanitizer(target=azure_managedhsm_url,value="https://managedhsmvaultname.managedhsm.azure.net") - add_general_string_sanitizer(target=azure_attestation_uri,value="https://fakeattestation.azurewebsites.net") - add_general_string_sanitizer(target=storage_name, value = "blob_storage_account_name") - add_general_string_sanitizer(target=storage_endpoint_suffix, value = "keyvault_endpoint_suffix") + add_general_string_sanitizer(target=azure_managedhsm_url,value="https://Sanitized.managedhsm.azure.net") + add_general_string_sanitizer(target=azure_attestation_uri,value="https://Sanitized.azurewebsites.net") + add_general_string_sanitizer(target=storage_url, value="https://Sanitized.blob.core.windows.net") add_general_string_sanitizer(target=sas_token, value="fake-sas") add_general_string_sanitizer(target=client_id, value = "service-principal-id") # Sanitize API versions of `azure-keyvault-keys` requests diff --git a/sdk/keyvault/azure-keyvault-keys/tests.yml b/sdk/keyvault/azure-keyvault-keys/tests.yml index 5f39d29ab6b2b..911e53f1ea65e 100644 --- a/sdk/keyvault/azure-keyvault-keys/tests.yml +++ b/sdk/keyvault/azure-keyvault-keys/tests.yml @@ -8,42 +8,36 @@ extends: JobName: azure_keyvault_keys SupportedClouds: 'Public,UsGov,China' TestTimeoutInMinutes: 240 - TestResourceDirectories: - - keyvault/ + UseFederatedAuth: true CloudConfig: Public: + Location: 'westus2' + SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources) ServiceConnection: azure-sdk-tests SubscriptionConfigurationFilePaths: - eng/common/TestResources/sub-config/AzurePublicMsft.json UsGov: - ServiceConnection: usgov_azure-sdk-tests - SubscriptionConfigurationFilePaths: - - eng/common/TestResources/sub-config/AzureUsGovMsft.json + SubscriptionConfiguration: $(sub-config-gov-test-resources) MatrixFilters: - ArmTemplateParameters=^(?!.*enableHsm.*true) + ServiceConnection: usgov_azure-sdk-tests China: + Location: chinaeast2 + SubscriptionConfiguration: $(sub-config-cn-test-resources) ServiceConnection: china_azure-sdk-tests - SubscriptionConfigurationFilePaths: - - eng/common/TestResources/sub-config/AzureChinaMsft.json MatrixFilters: - ArmTemplateParameters=^(?!.*enableHsm.*true) - Location: chinaeast2 - ${{ if contains(variables['Build.DefinitionName'], 'tests-weekly') }}: - # Test azure-keyvault-keys on Managed HSM for weekly tests only - AdditionalMatrixConfigs: - - Name: keyvault_hsm_matrix_addons - Path: sdk/keyvault/azure-keyvault-keys/platform-matrix.json - Selection: sparse - GenerateVMJobs: true + # HSMs are expensive and restricted in number so we only test them on one platform. + AdditionalMatrixConfigs: + - Name: keyvault_hsm_matrix_addons + Path: sdk/keyvault/azure-keyvault-keys/platform-matrix.json + Selection: sparse + GenerateVMJobs: true + + # Due to the high cost of Managed HSMs, we only want to test using them weekly. ${{ if not(contains(variables['Build.DefinitionName'], 'tests-weekly')) }}: - # For nightly tests, don't run live azure-keyvault-administration jobs since they require Managed HSM MatrixFilters: - - OSVmImage=NonexistentImage + - ArmTemplateParameters=^(?!.*enableHsm.*true) EnvVars: AZURE_TEST_RUN_LIVE: true AZURE_SKIP_LIVE_RECORDING: 'True' - AZURE_SUBSCRIPTION_ID: $(azure-subscription-id) - AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) - AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) - AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) - AZURE_CLIENT_OID: $(aad-azure-sdk-test-client-oid) diff --git a/sdk/keyvault/azure-keyvault-keys/tests/test_challenge_auth.py b/sdk/keyvault/azure-keyvault-keys/tests/test_challenge_auth.py index 2b86270bbc1ed..8d9eff46b208e 100644 --- a/sdk/keyvault/azure-keyvault-keys/tests/test_challenge_auth.py +++ b/sdk/keyvault/azure-keyvault-keys/tests/test_challenge_auth.py @@ -41,22 +41,11 @@ def test_multitenant_authentication(self, client, is_hsm, **kwargs): if not self.is_live: pytest.skip("This test is incompatible with test proxy in playback") - client_id = os.environ.get("KEYVAULT_CLIENT_ID") - client_secret = os.environ.get("KEYVAULT_CLIENT_SECRET") - # we set up a client for this method to align with the async test, but we actually want to create a new client # this new client should use a credential with an initially fake tenant ID and still succeed with a real request - if os.environ.get("AZURE_TEST_USE_PWSH_AUTH") == "true": - credential = AzurePowerShellCredential(tenant_id=str(uuid4()), additionally_allowed_tenants="*") - elif os.environ.get("AZURE_TEST_USE_CLI_AUTH") == "true": - credential = AzureCliCredential(tenant_id=str(uuid4()), additionally_allowed_tenants="*") - else: - credential = ClientSecretCredential( - tenant_id=str(uuid4()), - client_id=client_id, - client_secret=client_secret, - additionally_allowed_tenants="*", - ) + original_tenant = os.environ.get("AZURE_TENANT_ID") + os.environ["AZURE_TENANT_ID"] = str(uuid4()) + credential = self.get_credential(KeyClient, additionally_allowed_tenants="*") managed_hsm_url = kwargs.pop("managed_hsm_url", None) keyvault_url = kwargs.pop("vault_url", None) vault_url = managed_hsm_url if is_hsm else keyvault_url @@ -74,6 +63,12 @@ def test_multitenant_authentication(self, client, is_hsm, **kwargs): fetched_key = client.get_key(key_name) assert key.id == fetched_key.id + # clear the fake tenant + if original_tenant: + os.environ["AZURE_TENANT_ID"] = original_tenant + else: + os.environ.pop("AZURE_TENANT_ID") + def empty_challenge_cache(fn): @functools.wraps(fn) def wrapper(**kwargs): diff --git a/sdk/keyvault/azure-keyvault-keys/tests/test_challenge_auth_async.py b/sdk/keyvault/azure-keyvault-keys/tests/test_challenge_auth_async.py index 253b5af67462a..980753fbdc0a3 100644 --- a/sdk/keyvault/azure-keyvault-keys/tests/test_challenge_auth_async.py +++ b/sdk/keyvault/azure-keyvault-keys/tests/test_challenge_auth_async.py @@ -42,22 +42,11 @@ async def test_multitenant_authentication(self, client, is_hsm, **kwargs): if not self.is_live: pytest.skip("This test is incompatible with vcrpy in playback") - client_id = os.environ.get("KEYVAULT_CLIENT_ID") - client_secret = os.environ.get("KEYVAULT_CLIENT_SECRET") - # we set up a client for this method so it gets awaited, but we actually want to create a new client # this new client should use a credential with an initially fake tenant ID and still succeed with a real request - if os.environ.get("AZURE_TEST_USE_PWSH_AUTH") == "true": - credential = AzurePowerShellCredential(tenant_id=str(uuid4()), additionally_allowed_tenants="*") - elif os.environ.get("AZURE_TEST_USE_CLI_AUTH") == "true": - credential = AzureCliCredential(tenant_id=str(uuid4()), additionally_allowed_tenants="*") - else: - credential = ClientSecretCredential( - tenant_id=str(uuid4()), - client_id=client_id, - client_secret=client_secret, - additionally_allowed_tenants="*", - ) + original_tenant = os.environ.get("AZURE_TENANT_ID") + os.environ["AZURE_TENANT_ID"] = str(uuid4()) + credential = self.get_credential(KeyClient, additionally_allowed_tenants="*", is_async=True) managed_hsm_url = kwargs.pop("managed_hsm_url", None) keyvault_url = kwargs.pop("vault_url", None) vault_url = managed_hsm_url if is_hsm else keyvault_url @@ -75,6 +64,12 @@ async def test_multitenant_authentication(self, client, is_hsm, **kwargs): fetched_key = await client.get_key(key_name) assert key.id == fetched_key.id + # clear the fake tenant + if original_tenant: + os.environ["AZURE_TENANT_ID"] = original_tenant + else: + os.environ.pop("AZURE_TENANT_ID") + @pytest.mark.asyncio @empty_challenge_cache diff --git a/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml b/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index 41293487ad2f0..5b441265140e9 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -80,7 +80,7 @@ Log 'Creating 3 X509 certificates to activate security domain' $wrappingFiles = foreach ($i in 0..2) { $certificate = New-X509Certificate2 "CN=$($hsmUrl.Host)" - $baseName = "$PSScriptRoot\$hsmName-certificate$i" + $baseName = Join-Path -Path $PSScriptRoot -ChildPath "$hsmName-certificate$i" Export-X509Certificate2 "$baseName.pfx" $certificate Export-X509Certificate2PEM "$baseName.cer" $certificate @@ -89,7 +89,7 @@ $wrappingFiles = foreach ($i in 0..2) { Log "Downloading security domain from '$hsmUrl'" -$sdPath = "$PSScriptRoot\$hsmName-security-domain.key" +$sdPath = Join-Path -Path $PSScriptRoot -ChildPath "$hsmName-security-domain.key" if (Test-Path $sdpath) { Log "Deleting old security domain: $sdPath" Remove-Item $sdPath -Force @@ -105,14 +105,9 @@ if ( !$? ) { Log "Security domain downloaded to '$sdPath'; Managed HSM is now active at '$hsmUrl'" -# Force a sleep to wait for Managed HSM activation to propagate through Cosmos replication. Issue tracked in Azure DevOps. -Log 'Sleeping for 120 seconds to allow activation to propagate...' -Start-Sleep -Seconds 120 - -$testApplicationOid = $DeploymentOutputs['CLIENT_OBJECTID'] - -Log "Creating additional required role assignments for '$testApplicationOid'" -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Officer' -ObjectID $testApplicationOid -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto User' -ObjectID $testApplicationOid +$testApplicationOid = $DeploymentOutputs["CLIENT_OBJECTID"] +Log "Creating additional required role assignments for resource access." +New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName "Managed HSM Crypto Officer" -ObjectID $testApplicationOid +New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName "Managed HSM Crypto User" -ObjectID $testApplicationOid Log "Role assignments created for '$testApplicationOid'" diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 16bf8f961f092..02b62206d05a7 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -82,14 +82,7 @@ "westus3" ], "metadata": { - "description": "The location of the Managed HSM. By default, this is 'japaneast'." - } - }, - "enableAttestation": { - "type": "bool", - "defaultValue": true, - "metadata": { - "description": "Whether to enable deployment of attestation resources. The default is true." + "description": "The location of the Managed HSM. By default, this is 'brazilsouth'." } }, "enableHsm": { @@ -102,66 +95,15 @@ "keyVaultSku": { "type": "string", "defaultValue": "premium", - "allowedValues": [ - "standard", - "premium" - ], "metadata": { - "description": "Key Vault SKU to deploy. The default is 'Premium'" + "description": "Key Vault SKU to deploy. The default is 'premium'" } }, - "keyVaultEndpointSuffix": { - "type": "string", - "defaultValue": ".vault.azure.net" - }, - "testApplicationId": { - "type": "string" - }, - "enabledForDeployment": { - "type": "bool", - "defaultValue": false, - "allowedValues": [ - true, - false - ] - }, - "enabledForDiskEncryption": { - "type": "bool", - "defaultValue": false, - "allowedValues": [ - true, - false - ] - }, - "enabledForTemplateDeployment": { - "type": "bool", - "defaultValue": false, - "allowedValues": [ - true, - false - ] - }, - "identityName": { - "type": "string", - "defaultValue": "identityForKeyVault" - }, - "certificateName": { - "type": "string", - "defaultValue": "myalias" - }, - "subjectName": { - "type": "string", - "defaultValue": "CN=mydomain.com" - }, - "utcValue": { - "type": "string", - "defaultValue": "[utcNow()]" - }, "baseTime": { "type": "string", "defaultValue": "[utcNow('u')]", "metadata": { - "description": "The base time to add 500 minutes to for SAS token expiration. The default is the current time." + "description": "The base time to add 2 hours to for SAS token expiration. The default is the current time." } }, "attestationImage": { @@ -170,13 +112,6 @@ "metadata": { "description": "The attestation image to use. The default is 'keyvault-mock-attestation:latest'." } - }, - "storageEndpointSuffix": { - "type": "string", - "defaultValue": "core.windows.net", - "metadata": { - "description": "The url suffix to use when accessing the storage data plane." - } } }, "variables": { @@ -188,8 +123,10 @@ "hsmApiVersion": "2021-04-01-preview", "hsmName": "[concat(parameters('baseName'), 'hsm')]", "mgmtApiVersion": "2019-04-01", - "blobContainerName": "backup", - "primaryAccountName": "[concat(parameters('baseName'), 'prim')]", + "blobContainerName": "hsmbackups", + "primaryAccountName": "[concat(replace(parameters('baseName'), '-', ''), 'prim')]", + "kvAdminDefinitionId": "00482a5a-887f-4fb3-b363-3b7fe8e74483", + "kvAdminAssignmentName": "[guid(resourceGroup().id, variables('kvAdminDefinitionId'), parameters('testApplicationOid'))]", "encryption": { "services": { "blob": { @@ -208,34 +145,12 @@ "signedServices": "b", "signedPermission": "rwdlacu", "signedProtocol": "https", - "signedExpiry": "[dateTimeAdd(parameters('baseTime'), 'PT500M')]", + "signedExpiry": "[dateTimeAdd(parameters('baseTime'), 'PT2H')]", "signedResourceTypes": "sco", "keyToSign": "key1" - }, - "bootstrapRoleAssignmentId": "[guid(concat(resourceGroup().id, 'contributor'))]", - "contributorRoleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'b24988ac-6180-42a0-ab88-20f7382dd24c')]" + } }, "resources": [ - { - "type": "Microsoft.ManagedIdentity/userAssignedIdentities", - "apiVersion": "2018-11-30", - "name": "[parameters('identityName')]", - "location": "[parameters('location')]" - }, - { - "type": "Microsoft.Authorization/roleAssignments", - "apiVersion": "2018-09-01-preview", - "name": "[variables('bootstrapRoleAssignmentId')]", - "dependsOn": [ - "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('identityName'))]" - ], - "properties": { - "roleDefinitionId": "[variables('contributorRoleDefinitionId')]", - "principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('identityName')), '2018-11-30').principalId]", - "scope": "[resourceGroup().id]", - "principalType": "ServicePrincipal" - } - }, { "type": "Microsoft.KeyVault/vaults", "apiVersion": "[variables('kvApiVersion')]", @@ -247,124 +162,22 @@ "name": "[parameters('keyVaultSku')]" }, "tenantId": "[parameters('tenantId')]", - "accessPolicies": [ - { - "tenantId": "[parameters('tenantId')]", - "objectId": "[parameters('testApplicationOid')]", - "permissions": { - "keys": [ - "Get", - "List", - "Update", - "Create", - "Import", - "Delete", - "Recover", - "Backup", - "Restore", - "Decrypt", - "Encrypt", - "UnwrapKey", - "WrapKey", - "Sign", - "Purge", - "Rotate", - "Verify", - "GetRotationPolicy", - "SetRotationPolicy" - ], - "secrets": [ - "Get", - "List", - "Set", - "Delete", - "Recover", - "Backup", - "Restore", - "Purge" - ], - "certificates": [ - "Get", - "List", - "Update", - "Create", - "Import", - "Delete", - "Recover", - "Backup", - "Restore", - "ManageContacts", - "ManageIssuers", - "GetIssuers", - "ListIssuers", - "SetIssuers", - "DeleteIssuers", - "Purge" - ] - } - }, - { - "tenantId": "[parameters('tenantId')]", - "objectId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('identityName')), '2018-11-30').principalId]", - "permissions": { - "keys": [ - "Get", - "List", - "Update", - "Create", - "Import", - "Delete", - "Recover", - "Backup", - "Restore", - "Decrypt", - "Encrypt", - "UnwrapKey", - "WrapKey", - "Sign", - "Purge", - "Rotate", - "Verify", - "GetRotationPolicy", - "SetRotationPolicy" - ], - "secrets": [ - "Get", - "List", - "Set", - "Delete", - "Recover", - "Backup", - "Restore", - "Purge" - ], - "certificates": [ - "Get", - "List", - "Update", - "Create", - "Import", - "Delete", - "Recover", - "Backup", - "Restore", - "ManageContacts", - "ManageIssuers", - "GetIssuers", - "ListIssuers", - "SetIssuers", - "DeleteIssuers", - "Purge" - ] - } - } - ], - "enabledForDeployment": "[parameters('enabledForDeployment')]", - "enabledForDiskEncryption": "[parameters('enabledForDiskEncryption')]", - "enabledForTemplateDeployment": "[parameters('enabledForTemplateDeployment')]", + "enabledForDeployment": false, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": false, "enableSoftDelete": true, - "softDeleteRetentionInDays": 7, - "networkAcls": "[variables('networkAcls')]" + "enableRbacAuthorization": true, + "softDeleteRetentionInDays": 7 + } + }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "2020-04-01-preview", + "name": "[variables('kvAdminAssignmentName')]", + "properties": { + "roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', variables('kvAdminDefinitionId'))]", + "principalId": "[parameters('testApplicationOid')]", + "scope": "[resourceGroup().id]" } }, { @@ -378,13 +191,13 @@ "name": "Standard_B1" }, "properties": { + "publicNetworkAccess": "Enabled", + "networkAcls": "[variables('networkAcls')]", "tenantId": "[parameters('tenantId')]", "initialAdminObjectIds": "[union(array(parameters('testApplicationOid')), array(parameters('provisionerApplicationOid')))]", "enablePurgeProtection": false, "enableSoftDelete": true, - "softDeleteRetentionInDays": 7, - "publicNetworkAccess": "Enabled", - "networkAcls": "[variables('networkAcls')]" + "softDeleteRetentionInDays": 7 } }, { @@ -401,13 +214,12 @@ "networkAcls": "[variables('networkAcls')]", "supportsHttpsTrafficOnly": true, "encryption": "[variables('encryption')]", - "accessTier": "Hot", - "minimumTlsVersion": "TLS1_2" + "accessTier": "Hot" } }, { "type": "Microsoft.Storage/storageAccounts/blobServices", - "apiVersion": "2022-05-01", + "apiVersion": "2019-06-01", "name": "[concat(variables('primaryAccountName'), '/default')]", "dependsOn": [ "[resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName'))]" @@ -441,7 +253,6 @@ "type": "Microsoft.Web/serverfarms", "apiVersion": "2020-12-01", "name": "[variables('attestationFarm')]", - "condition": "[parameters('enableAttestation')]", "location": "[parameters('location')]", "kind": "linux", "sku": { @@ -455,7 +266,6 @@ "type": "Microsoft.Web/sites", "apiVersion": "2020-12-01", "name": "[variables('attestationSite')]", - "condition": "[parameters('enableAttestation')]", "dependsOn": [ "[resourceId('Microsoft.Web/serverfarms', variables('attestationFarm'))]" ], @@ -475,66 +285,6 @@ ] } } - }, - { - "type": "Microsoft.Resources/deploymentScripts", - "apiVersion": "2020-10-01", - "name": "createAddCertificate", - "location": "[parameters('location')]", - "dependsOn": [ - "[resourceId('Microsoft.KeyVault/vaults', variables('kvName'))]", - "[resourceId('Microsoft.Authorization/roleAssignments', variables('bootstrapRoleAssignmentId'))]" - ], - "identity": { - "type": "UserAssigned", - "userAssignedIdentities": { - "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('identityName'))]": {} - } - }, - "kind": "AzurePowerShell", - "properties": { - "forceUpdateTag": "[parameters('utcValue')]", - "azPowerShellVersion": "5.0", - "timeout": "PT30M", - "arguments": "[format(' -vaultName {0} -certificateName {1} -subjectName {2}', variables('kvName'), parameters('certificateName'), parameters('subjectName'))]", - "scriptContent": " - param( - [string] [Parameter(Mandatory=$true)] $vaultName, - [string] [Parameter(Mandatory=$true)] $certificateName, - [string] [Parameter(Mandatory=$true)] $subjectName - ) - - $ErrorActionPreference = 'Stop' - $DeploymentScriptOutputs = @{} - - $policy = New-AzKeyVaultCertificatePolicy -SubjectName $subjectName -IssuerName Self -ValidityInMonths 12 -Verbose - - Add-AzKeyVaultCertificate -VaultName $vaultName -Name $certificateName -CertificatePolicy $policy -Verbose - - $newCert = Get-AzKeyVaultCertificate -VaultName $vaultName -Name $certificateName - - $tries = 0 - do { - Write-Host 'Waiting for certificate creation completion...' - Start-Sleep -Seconds 10 - $operation = Get-AzKeyVaultCertificateOperation -VaultName $vaultName -Name $certificateName - $tries++ - - if ($operation.Status -eq 'failed') { - throw 'Creating certificate $certificateName in vault $vaultName failed with error $($operation.ErrorMessage)' - } - - if ($tries -gt 120) { - throw 'Timed out waiting for creation of certificate $certificateName in vault $vaultName' - } - } while ($operation.Status -ne 'completed') - - $DeploymentScriptOutputs['certThumbprint'] = $newCert.Thumbprint - $newCert | Out-String - ", - "cleanupPreference": "OnSuccess", - "retentionInterval": "P1D" - } } ], "outputs": { @@ -555,29 +305,20 @@ "type": "string", "value": "[parameters('testApplicationOid')]" }, - "KEYVAULT_STORAGE_ENDPOINT_SUFFIX": { - "type": "string", - "value": "[parameters('storageEndpointSuffix')]" - }, - "BLOB_STORAGE_ACCOUNT_NAME": { - "type": "string", - "value": "[variables('primaryAccountName')]" - }, - "BLOB_PRIMARY_STORAGE_ACCOUNT_KEY": { + "BLOB_STORAGE_URL": { "type": "string", - "value": "[listKeys(variables('primaryAccountName'), variables('mgmtApiVersion')).keys[0].value]" + "value": "[reference(resourceId('Microsoft.Storage/storageAccounts', variables('primaryAccountName'))).primaryEndpoints.blob]" }, "BLOB_STORAGE_SAS_TOKEN": { "type": "string", "value": "[listAccountSas(variables('primaryAccountName'), '2019-06-01', variables('accountSasProperties')).accountSasToken]" }, - "BLOB_CONTAINER_NAME" : { + "BLOB_CONTAINER_NAME": { "type": "string", "value": "[variables('blobContainerName')]" }, "AZURE_KEYVAULT_ATTESTATION_URL": { "type": "string", - "condition": "[parameters('enableAttestation')]", "value": "[format('https://{0}/', reference(variables('attestationSite')).defaultHostName)]" } } diff --git a/sdk/keyvault/tests.yml b/sdk/keyvault/tests.yml index 23e53050411bd..16000ab1d8b8f 100644 --- a/sdk/keyvault/tests.yml +++ b/sdk/keyvault/tests.yml @@ -14,6 +14,7 @@ extends: Packages: ${{ parameters.Services }} SupportedClouds: 'Public,UsGov,China' TestTimeoutInMinutes: 240 + UseFederatedAuth: true CloudConfig: Public: ServiceConnection: azure-sdk-tests @@ -36,7 +37,4 @@ extends: AZURE_TEST_RUN_LIVE: true AZURE_SKIP_LIVE_RECORDING: 'True' AZURE_SUBSCRIPTION_ID: $(azure-subscription-id) - AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) - AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) - AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) AZURE_CLIENT_OID: $(aad-azure-sdk-test-client-oid) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/pyproject.toml b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/kusto/azure-mgmt-kusto/pyproject.toml b/sdk/kusto/azure-mgmt-kusto/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/kusto/azure-mgmt-kusto/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/labservices/azure-mgmt-labservices/pyproject.toml b/sdk/labservices/azure-mgmt-labservices/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/labservices/azure-mgmt-labservices/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/largeinstance/azure-mgmt-largeinstance/pyproject.toml b/sdk/largeinstance/azure-mgmt-largeinstance/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/largeinstance/azure-mgmt-largeinstance/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/loadtesting/azure-developer-loadtesting/pyproject.toml b/sdk/loadtesting/azure-developer-loadtesting/pyproject.toml index 45f4a483fc063..90102e2ec3386 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/pyproject.toml +++ b/sdk/loadtesting/azure-developer-loadtesting/pyproject.toml @@ -2,4 +2,3 @@ pylint = false pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/loadtesting/azure-mgmt-loadtesting/pyproject.toml b/sdk/loadtesting/azure-mgmt-loadtesting/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/loadtesting/azure-mgmt-loadtesting/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/loganalytics/azure-mgmt-loganalytics/pyproject.toml b/sdk/loganalytics/azure-mgmt-loganalytics/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/loganalytics/azure-mgmt-loganalytics/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/logic/azure-mgmt-logic/pyproject.toml b/sdk/logic/azure-mgmt-logic/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/logic/azure-mgmt-logic/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/logz/azure-mgmt-logz/pyproject.toml b/sdk/logz/azure-mgmt-logz/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/logz/azure-mgmt-logz/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/machinelearning/azure-mgmt-guestconfig/pyproject.toml b/sdk/machinelearning/azure-mgmt-guestconfig/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-guestconfig/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/machinelearning/azure-mgmt-machinelearningcompute/pyproject.toml b/sdk/machinelearning/azure-mgmt-machinelearningcompute/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningcompute/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/pyproject.toml b/sdk/machinelearning/azure-mgmt-machinelearningservices/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/maintenance/azure-mgmt-maintenance/pyproject.toml b/sdk/maintenance/azure-mgmt-maintenance/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/maintenance/azure-mgmt-maintenance/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/managedapplications/azure-mgmt-managedapplications/pyproject.toml b/sdk/managedapplications/azure-mgmt-managedapplications/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/managedapplications/azure-mgmt-managedapplications/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/pyproject.toml b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/managednetworkfabric/azure-mgmt-managednetworkfabric/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/managedservices/azure-mgmt-managedservices/pyproject.toml b/sdk/managedservices/azure-mgmt-managedservices/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/managedservices/azure-mgmt-managedservices/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/pyproject.toml b/sdk/managementgroups/azure-mgmt-managementgroups/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/managementpartner/azure-mgmt-managementpartner/pyproject.toml b/sdk/managementpartner/azure-mgmt-managementpartner/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/managementpartner/azure-mgmt-managementpartner/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/maps/azure-maps-geolocation/README.md b/sdk/maps/azure-maps-geolocation/README.md index 552a6e8fc272b..01a936234e43d 100644 --- a/sdk/maps/azure-maps-geolocation/README.md +++ b/sdk/maps/azure-maps-geolocation/README.md @@ -13,7 +13,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7 or later is required to use this package. +- Python 3.8 or later is required to use this package. - An [Azure subscription][azure_subscription] and an [Azure Maps account](https://docs.microsoft.com/azure/azure-maps/how-to-manage-account-keys). - A deployed Maps Services resource. You can create the resource via [Azure Portal][azure_portal] or [Azure CLI][azure_cli]. @@ -92,7 +92,7 @@ Once you initialized a `MapsGeolocationClient` class, you can explore the method ### Async Clients -This library includes a complete async API supported on Python 3.5+. To use it, you must first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/). +This library includes a complete async API supported on Python 3.8+. To use it, you must first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/). See [azure-core documentation](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#transport) for more information. Async clients and credentials should be closed when they're no longer needed. These diff --git a/sdk/maps/azure-maps-geolocation/dev_requirements.txt b/sdk/maps/azure-maps-geolocation/dev_requirements.txt index 60a4d2ac2b5e2..385751a7107b8 100644 --- a/sdk/maps/azure-maps-geolocation/dev_requirements.txt +++ b/sdk/maps/azure-maps-geolocation/dev_requirements.txt @@ -1,4 +1,4 @@ -e ../../../tools/azure-sdk-tools -e ../../core/azure-core -e ../../identity/azure-identity -aiohttp>=3.0; python_version >= '3.7' \ No newline at end of file +aiohttp>=3.0; python_version >= '3.8' \ No newline at end of file diff --git a/sdk/maps/azure-maps-geolocation/pyproject.toml b/sdk/maps/azure-maps-geolocation/pyproject.toml index ab396f151b523..c885b5014c675 100644 --- a/sdk/maps/azure-maps-geolocation/pyproject.toml +++ b/sdk/maps/azure-maps-geolocation/pyproject.toml @@ -1,4 +1,3 @@ [tool.azure-sdk-build] pyright = false -verifytypes = false ci_enabled = true diff --git a/sdk/maps/azure-maps-geolocation/samples/README.md b/sdk/maps/azure-maps-geolocation/samples/README.md index 26f80adf35343..bebbf5b1abd17 100644 --- a/sdk/maps/azure-maps-geolocation/samples/README.md +++ b/sdk/maps/azure-maps-geolocation/samples/README.md @@ -21,7 +21,7 @@ Then for common Azure Maps Geolocation operations: ## Prerequisites -* Python 3.6 or later is required to use this package +* Python 3.8 or later is required to use this package * You must have an [Azure subscription](https://azure.microsoft.com/free/) * A deployed Maps Services resource. You can create the resource via [Azure Portal][azure_portal] or [Azure CLI][azure_cli]. diff --git a/sdk/maps/azure-maps-geolocation/setup.py b/sdk/maps/azure-maps-geolocation/setup.py index 463e7c93d39ee..d971fa0fb25dd 100644 --- a/sdk/maps/azure-maps-geolocation/setup.py +++ b/sdk/maps/azure-maps-geolocation/setup.py @@ -69,6 +69,8 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -83,5 +85,6 @@ 'msrest>=0.6.21', 'azure-common~=1.1', 'azure-mgmt-core<2.0.0,>=1.3.0' - ] + ], + python_requires=">=3.8", ) diff --git a/sdk/maps/azure-maps-render/CHANGELOG.md b/sdk/maps/azure-maps-render/CHANGELOG.md index 6976a83b81cc4..632032b91f01d 100644 --- a/sdk/maps/azure-maps-render/CHANGELOG.md +++ b/sdk/maps/azure-maps-render/CHANGELOG.md @@ -1,6 +1,20 @@ # Release History -## 2.0.0b1 (Unreleased) +## 2.0.0b2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + +## 2.0.0b1 (2024-08-06) + +### Features Added + +- Support Render API `2024-04-01` ## 1.0.0b3 (2024-05-15) diff --git a/sdk/maps/azure-maps-render/README.md b/sdk/maps/azure-maps-render/README.md index 714430669e139..d5c66054570db 100644 --- a/sdk/maps/azure-maps-render/README.md +++ b/sdk/maps/azure-maps-render/README.md @@ -13,7 +13,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7 or later is required to use this package. +- Python 3.8 or later is required to use this package. - An [Azure subscription][azure_subscription] and an [Azure Maps account](https://docs.microsoft.com/azure/azure-maps/how-to-manage-account-keys). - A deployed Maps Services resource. You can create the resource via [Azure Portal][azure_portal] or [Azure CLI][azure_cli]. @@ -92,7 +92,7 @@ Once you initialized a `MapsRenderClient` class, you can explore the methods on ### Async Clients -This library includes a complete async API supported on Python 3.5+. To use it, you must first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/). +This library includes a complete async API supported on Python 3.8+. To use it, you must first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/). See [azure-core documentation](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#transport) for more information. Async clients and credentials should be closed when they're no longer needed. These @@ -244,14 +244,14 @@ set AZURE_SUBSCRIPTION_KEY="" pip install azure-maps-render --pre python samples/sample_authentication.py -python sample/sample_get_copyright_caption.py -python sample/sample_get_copyright_for_tile.py -python sample/sample_get_copyright_for_world.py -python sample/sample_get_copyright_from_bounding_box.py -python sample/sample_get_map_attribution.py -python sample/sample_get_map_static_image.py -python sample/sample_get_map_tile.py -python sample/sample_get_map_tileset.py +python samples/sample_get_copyright_caption.py +python samples/sample_get_copyright_for_tile.py +python samples/sample_get_copyright_for_world.py +python samples/sample_get_copyright_from_bounding_box.py +python samples/sample_get_map_attribution.py +python samples/sample_get_map_static_image.py +python samples/sample_get_map_tile.py +python samples/sample_get_map_tileset.py ``` > Notes: `--pre` flag can be optionally added, it is to include pre-release and development versions for `pip install`. By default, `pip` only finds stable versions. diff --git a/sdk/maps/azure-maps-render/azure/maps/render/_version.py b/sdk/maps/azure-maps-render/azure/maps/render/_version.py index c016b1393c0e7..3c6748e00d97e 100644 --- a/sdk/maps/azure-maps-render/azure/maps/render/_version.py +++ b/sdk/maps/azure-maps-render/azure/maps/render/_version.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "2.0.0b2" API_VERSION = "2024-04-01" diff --git a/sdk/maps/azure-maps-render/dev_requirements.txt b/sdk/maps/azure-maps-render/dev_requirements.txt index 60a4d2ac2b5e2..385751a7107b8 100644 --- a/sdk/maps/azure-maps-render/dev_requirements.txt +++ b/sdk/maps/azure-maps-render/dev_requirements.txt @@ -1,4 +1,4 @@ -e ../../../tools/azure-sdk-tools -e ../../core/azure-core -e ../../identity/azure-identity -aiohttp>=3.0; python_version >= '3.7' \ No newline at end of file +aiohttp>=3.0; python_version >= '3.8' \ No newline at end of file diff --git a/sdk/maps/azure-maps-render/pyproject.toml b/sdk/maps/azure-maps-render/pyproject.toml index 29876552d4d75..ac788c3dcde49 100644 --- a/sdk/maps/azure-maps-render/pyproject.toml +++ b/sdk/maps/azure-maps-render/pyproject.toml @@ -1,5 +1,4 @@ [tool.azure-sdk-build] pyright = false -verifytypes = false ci_enabled = true strict_sphinx = false diff --git a/sdk/maps/azure-maps-render/samples/README.md b/sdk/maps/azure-maps-render/samples/README.md index e7d43ba88abb5..69520a16abebf 100644 --- a/sdk/maps/azure-maps-render/samples/README.md +++ b/sdk/maps/azure-maps-render/samples/README.md @@ -35,7 +35,7 @@ Then for common Azure Maps Render operations: ## Prerequisites -* Python 3.6 or later is required to use this package +* Python 3.8 or later is required to use this package * You must have an [Azure subscription](https://azure.microsoft.com/free/) * A deployed Maps Services resource. You can create the resource via [Azure Portal][azure_portal] or [Azure CLI][azure_cli]. diff --git a/sdk/maps/azure-maps-render/setup.py b/sdk/maps/azure-maps-render/setup.py index a3e7e96e2eec7..9bc57f119074c 100644 --- a/sdk/maps/azure-maps-render/setup.py +++ b/sdk/maps/azure-maps-render/setup.py @@ -69,6 +69,8 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -83,5 +85,6 @@ 'msrest>=0.6.21', 'azure-common~=1.1', 'azure-mgmt-core>=1.3.0,<2.0.0', - ] + ], + python_requires=">=3.8", ) diff --git a/sdk/maps/azure-maps-route/README.md b/sdk/maps/azure-maps-route/README.md index f9afd033e20f0..328dda8cadc12 100644 --- a/sdk/maps/azure-maps-route/README.md +++ b/sdk/maps/azure-maps-route/README.md @@ -13,7 +13,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.6 or later is required to use this package. +- Python 3.8 or later is required to use this package. - An [Azure subscription][azure_subscription] and an [Azure Maps account](https://docs.microsoft.com/azure/azure-maps/how-to-manage-account-keys). - A deployed Maps Services resource. You can create the resource via [Azure Portal][azure_portal] or [Azure CLI][azure_cli]. @@ -92,7 +92,7 @@ Once you initialized a `MapsRouteClient` class, you can explore the methods on t ### Async Clients -This library includes a complete async API supported on Python 3.5+. To use it, you must first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/). +This library includes a complete async API supported on Python 3.8+. To use it, you must first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/). See [azure-core documentation](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#transport) for more information. Async clients and credentials should be closed when they're no longer needed. These diff --git a/sdk/maps/azure-maps-route/dev_requirements.txt b/sdk/maps/azure-maps-route/dev_requirements.txt index 60a4d2ac2b5e2..385751a7107b8 100644 --- a/sdk/maps/azure-maps-route/dev_requirements.txt +++ b/sdk/maps/azure-maps-route/dev_requirements.txt @@ -1,4 +1,4 @@ -e ../../../tools/azure-sdk-tools -e ../../core/azure-core -e ../../identity/azure-identity -aiohttp>=3.0; python_version >= '3.7' \ No newline at end of file +aiohttp>=3.0; python_version >= '3.8' \ No newline at end of file diff --git a/sdk/maps/azure-maps-route/pyproject.toml b/sdk/maps/azure-maps-route/pyproject.toml index bf7e912a2e2dc..e1f8abdf0dd9d 100644 --- a/sdk/maps/azure-maps-route/pyproject.toml +++ b/sdk/maps/azure-maps-route/pyproject.toml @@ -1,5 +1,4 @@ [tool.azure-sdk-build] pyright = false type_check_samples = false -verifytypes = false ci_enabled = true diff --git a/sdk/maps/azure-maps-route/samples/README.md b/sdk/maps/azure-maps-route/samples/README.md index 2cc45b8b5ddc4..15d7e7772c125 100644 --- a/sdk/maps/azure-maps-route/samples/README.md +++ b/sdk/maps/azure-maps-route/samples/README.md @@ -30,7 +30,7 @@ Then for common Azure Maps Route operations: ## Prerequisites -* Python 3.6 or later is required to use this package +* Python 3.8 or later is required to use this package * You must have an [Azure subscription](https://azure.microsoft.com/free/) * A deployed Maps Services resource. You can create the resource via [Azure Portal][azure_portal] or [Azure CLI][azure_cli]. diff --git a/sdk/maps/azure-maps-route/setup.py b/sdk/maps/azure-maps-route/setup.py index 65f61baf22bdb..258211be24d8b 100644 --- a/sdk/maps/azure-maps-route/setup.py +++ b/sdk/maps/azure-maps-route/setup.py @@ -69,6 +69,8 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -82,5 +84,6 @@ 'msrest>=0.6.21', 'azure-common~=1.1', 'azure-mgmt-core>=1.3.0,<2.0.0', - ] + ], + python_requires=">=3.8", ) diff --git a/sdk/maps/azure-maps-search/CHANGELOG.md b/sdk/maps/azure-maps-search/CHANGELOG.md index 9adba064a3419..58578643e0dda 100644 --- a/sdk/maps/azure-maps-search/CHANGELOG.md +++ b/sdk/maps/azure-maps-search/CHANGELOG.md @@ -1,5 +1,50 @@ # Release History +## 2.0.0b2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + +## 2.0.0b1 (2024-08-06) + +### New Features and Enhancements + +- Support Search API `2023-06-01` + +- **Geocoding APIs** + - Introduced `get_geocoding` method to obtain longitude and latitude coordinates for a given address. + - Introduced `get_geocoding_batch` method to handle batch geocoding queries, supporting up to 100 queries in a single request. + +- **Reverse Geocoding APIs** + - Introduced `get_reverse_geocoding` method to get address details from given coordinates. + - Introduced `get_reverse_geocoding_batch` method to handle batch reverse geocoding queries, supporting up to 100 queries in a single request. + +- **Boundary APIs** + - Introduced `get_polygon` method to obtain polygon boundaries for a given set of coordinates with specified resolution and boundary result type. + +### Breaking Changes + +- **Removed Methods** + - Removed the `fuzzy_search` method. + - Removed the `search_point_of_interest` method. + - Removed the `search_address` method. + - Removed the `search_nearby_point_of_interest` method. + - Removed the `search_point_of_interest_category` method. + - Removed the `search_structured_address` method. + - Removed the `get_geometries` method. + - Removed the `get_point_of_interest_categories` method. + - Removed the `reverse_search_address` method. + - Removed the `reverse_search_cross_street_address` method. + - Removed the `search_inside_geometry` method. + - Removed the `search_along_route` method. + - Removed the `fuzzy_search_batch` method. + - Removed the `search_address_batch` method. + ## 1.0.0b3 (2024-05-15) ### Bugs Fixed diff --git a/sdk/maps/azure-maps-search/README.md b/sdk/maps/azure-maps-search/README.md index d64c2eceeb25e..00d36f1c23dd3 100644 --- a/sdk/maps/azure-maps-search/README.md +++ b/sdk/maps/azure-maps-search/README.md @@ -13,7 +13,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.6 or later is required to use this package. +- Python 3.8 or later is required to use this package. - An [Azure subscription][azure_subscription] and an [Azure Maps account](https://docs.microsoft.com/azure/azure-maps/how-to-manage-account-keys). - A deployed Maps Services resource. You can create the resource via [Azure Portal][azure_portal] or [Azure CLI][azure_cli]. @@ -92,197 +92,220 @@ Once you initialized a `MapsSearchClient` class, you can explore the methods on This library includes a complete async API supported on Python 3.5+. To use it, you must first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/). See [azure-core documentation](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#transport) for more information. -Async clients and credentials should be closed when they're no longer needed. These -objects are async context managers and define async `close` methods. +Async clients and credentials should be closed when they're no longer needed. These objects are async context managers and define async `close` methods. ## Examples The following sections provide several code snippets covering some of the most common Azure Maps Search tasks, including: -- [Request latitude and longitude coordinates for an address](#request-latitude-and-longitude-coordinates-for-an-address) - -- [Search for an address or Point of Interest](#search-for-an-address-or-point-of-interest) - +- [Geocode an address](#geocode-an-address) +- [Batch geocode addresses](#batch-geocode-addresses) +- [Get polygons for a given location](#get-polygons-for-a-given-location) - [Make a Reverse Address Search to translate coordinate location to street address](#make-a-reverse-address-search-to-translate-coordinate-location-to-street-address) -- [Translate coordinate location into a human understandable cross street](#translate-coordinate-location-into-a-human-understandable-cross-street) -- [Get async fuzzy search batch with param and batchid](#get-async-fuzzy-search-batch-with-param-and-batchid) -- [Fail to get fuzzy search batch sync](#fail-to-get-fuzzy-search-batch-sync) -- [Search inside Geometry](#search-inside-geometry) +- [Batch request for reverse geocoding](#batch-request-for-reverse-geocoding) -- [Working with exist library for Search](#working-with-exist-library-for-search) - -### Request latitude and longitude coordinates for an address +### Geocode an address You can use an authenticated client to convert an address into latitude and longitude coordinates. This process is also called geocoding. In addition to returning the coordinates, the response will also return detailed address properties such as street, postal code, municipality, and country/region information. ```python -from azure.maps.search import MapsSearchClient +import os -search_result = client.search_address("400 Broad, Seattle"); -``` +from azure.core.exceptions import HttpResponseError -### Search for an address or Point of Interest +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") -You can use Fuzzy Search to search an address or a point of interest (POI). The following examples demostrate how to search for `pizza` over the scope of a specific country (`France`, in this example). +def geocode(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search import MapsSearchClient -```python -from azure.maps.search import MapsSearchClient + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + try: + result = maps_search_client.get_geocoding(query="15127 NE 24th Street, Redmond, WA 98052") + if result.get('features', False): + coordinates = result['features'][0]['geometry']['coordinates'] + longitude = coordinates[0] + latitude = coordinates[1] -fuzzy_search_result = client.fuzzy_search(query: "pizza", country_filter: "fr" ); + print(longitude, latitude) + else: + print("No results") -result_address = fuzzy_search_result.results[0].address + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + +if __name__ == '__main__': + geocode() ``` -### Make a Reverse Address Search to translate coordinate location to street address +### Batch geocode addresses -You can translate coordinates into human readable street addresses. This process is also called reverse geocoding. -This is often used for applications that consume GPS feeds and want to discover addresses at specific coordinate points. +This sample demonstrates how to perform batch search address. ```python -from azure.maps.search import MapsSearchClient +import os -coordinates=(47.60323, -122.33028) +from azure.core.exceptions import HttpResponseError -reverse_search_result = client.reverse_search_address(coordinates=coordinates); +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") -query_type = reverse_search_result.query_type -query_time = reverse_search_result.query_time -results = reverse_search_result.results -``` +def geocode_batch(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search import MapsSearchClient -### Translate coordinate location into a human understandable cross street + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + try: + result = maps_search_client.get_geocoding_batch({ + "batchItems": [ + {"query": "400 Broad St, Seattle, WA 98109"}, + {"query": "15127 NE 24th Street, Redmond, WA 98052"}, + ], + },) -Translate coordinate location into a human understandable cross street by using Search Address Reverse Cross Street API. Most often, this is needed in tracking applications that receive a GPS feed from a device or asset, and wish to know where the coordinate is located. + if not result.get('batchItems', False): + print("No batchItems in geocoding") + return -```python -from azure.maps.search import MapsSearchClient + for item in result['batchItems']: + if not item.get('features', False): + print(f"No features in item: {item}") + continue -coordinates=(47.60323, -122.33028) + coordinates = item['features'][0]['geometry']['coordinates'] + longitude, latitude = coordinates + print(longitude, latitude) -reverse_search_result = client.reverse_search_cross_street_address(coordinates=coordinates); + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") -result_address = reverse_search_result.results[0].address +if __name__ == '__main__': + geocode_batch() ``` -### Get async fuzzy search batch with param and batchid +### Get polygons for a given location -This sample demonstrates how to perform fuzzy search by location and lat/lon with async batch method. This function is accepting both `search_queries` and `batch_id` and returning an `AsyncLRO` object. The `batch_id` here can be use to retrieve the LRO object later which last 14 days. +This sample demonstrates how to search polygons. ```python -maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) +import os -async with maps_search_client: - result = await maps_search_client.begin_fuzzy_search_batch( - search_queries=[ - "350 5th Ave, New York, NY 10118&limit=1", - "400 Broad St, Seattle, WA 98109&limit=6" - ] - ) +from azure.core.exceptions import HttpResponseError +from azure.maps.search import Resolution +from azure.maps.search import BoundaryResultType -batch_id = result.batch_id -``` -The method `begin_fuzzy_search_batch()` also accepts `batch_id` as the parameter. The `batch_id` here can be use to retrieve the LRO object later which last 14 days. +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") -```python -maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - -async with maps_search_client: - result = await maps_search_client.begin_fuzzy_search_batch( - batch_id=batch_id - ) +def get_polygon(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search import MapsSearchClient -result = result.response -``` + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + try: + result = maps_search_client.get_polygon( + coordinates=[-122.204141, 47.61256], + result_type=BoundaryResultType.LOCALITY, + resolution=Resolution.SMALL, + ) -### Fail to get fuzzy search batch sync + if not result.get('geometry', False): + print("No geometry found") + return -This sample demonstrates how to check if there are failures in search of fuzzy_search_batch. + print(result["geometry"]) + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") -```python -maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - -result = maps_search_client.fuzzy_search_batch( - search_queries=[ - "350 5th Ave, New York, NY 10118&limit=1", - "400 Broad St, Seattle, WA 98109&lim" - ] -) -for item in result.items: - count = 0 - if item.response.error is not None: - count = count+1 - print(f"Error: {item.response.error.message}") -print(f"There are total of {count} search queries failed.") +if __name__ == '__main__': + get_polygon() ``` -### Search inside Geometry +### Make a Reverse Address Search to translate coordinate location to street address -This sample demonstrates how to perform search inside geometry by given target such as `pizza` and multiple different geometry as input with GeoJson object. +You can translate coordinates into human-readable street addresses. This process is also called reverse geocoding. This is often used for applications that consume GPS feeds and want to discover addresses at specific coordinate points. ```python -maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - -geo_json_obj1 = { - "type": "FeatureCollection", - "features": [ - { - "type": "Feature", - "geometry": { - "type": "Polygon", - "coordinates": [[ - [-122.143035,47.653536], - [-122.187164,47.617556], - [-122.114981,47.570599], - [-122.132756,47.654009], - [-122.143035,47.653536] - ]] - }, - "properties": {} - }, - { - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [-122.126986,47.639754] - }, - "properties": { - "subType": "Circle", - "radius": 100 - } - } - ] -} -result1 = maps_search_client.search_inside_geometry( - query="pizza", - geometry=geo_json_obj1 -) -print("Search inside geometry with standard GeoJson object as input, FeatureCollection:") -print(result1) +import os + +from azure.core.exceptions import HttpResponseError + +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") + +def reverse_geocode(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search import MapsSearchClient + + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + try: + result = maps_search_client.get_reverse_geocoding(coordinates=[-122.138679, 47.630356]) + if result.get('features', False): + props = result['features'][0].get('properties', {}) + if props and props.get('address', False): + print(props['address'].get('formattedAddress', 'No formatted address found')) + else: + print("Address is None") + else: + print("No features available") + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + + +if __name__ == '__main__': + reverse_geocode() ``` -### Working with exist library for Search +### Batch request for reverse geocoding -This sample demonstrates how to working with other existing packages such as `shapely` to perform search inside geometry by given target such as `pizza`. +This sample demonstrates how to perform reverse search by given coordinates in batch. ```python -maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - -from shapely.geometry import Polygon - -geo_interface_obj = Polygon([ - [-122.43576049804686, 37.7524152343544], - [-122.43301391601562, 37.70660472542312], - [-122.36434936523438, 37.712059855877314], - [-122.43576049804686, 37.7524152343544] -]) +import os +from azure.core.credentials import AzureKeyCredential +from azure.core.exceptions import HttpResponseError +from azure.maps.search import MapsSearchClient -result3 = maps_search_client.search_inside_geometry( - query="pizza", - geometry=geo_interface_obj -) -print("Search inside geometry with Polygon from third party library `shapely` with geo_interface as result 3:") -print(result2) +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") + +def reverse_geocode_batch(): + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + try: + result = maps_search_client.get_reverse_geocoding_batch({ + "batchItems": [ + {"coordinates": [-122.349309, 47.620498]}, + {"coordinates": [-122.138679, 47.630356]}, + ], + },) + + if result.get('batchItems', False): + for idx, item in enumerate(result['batchItems']): + features = item['features'] + if features: + props = features[0].get('properties', {}) + if props and props.get('address', False): + print( + props['address'].get('formattedAddress', f'No formatted address for item {idx + 1} found')) + else: + print(f"Address {idx + 1} is None") + else: + print(f"No features available for item {idx + 1}") + else: + print("No batch items found") + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + + +if __name__ == '__main__': + reverse_geocode_batch() ``` ## Troubleshooting @@ -339,15 +362,11 @@ set AZURE_SUBSCRIPTION_KEY="" pip install azure-maps-search --pre -python samples/sample_authentication.py -python sample/sample_fuzzy_search.py -python samples/sample_get_point_of_interest_categories.py -python samples/sample_reverse_search_address.py -python samples/sample_reverse_search_cross_street_address.py -python samples/sample_search_nearby_point_of_interest.py -python samples/sample_search_point_of_interest_category.py -python samples/sample_search_point_of_interest.py -python samples/sample_search_structured_address.py +python samples/sample_geocode.py +python samples/sample_geocode_batch.py +python samples/sample_get_polygon.py +python samples/sample_reverse_geocode.py +python samples/sample_reverse_geocode_batch.py ``` > Notes: `--pre` flag can be optionally added, it is to include pre-release and development versions for `pip install`. By default, `pip` only finds stable versions. diff --git a/sdk/maps/azure-maps-search/assets.json b/sdk/maps/azure-maps-search/assets.json index 3ddd20ff4f333..adf1d92625ee4 100644 --- a/sdk/maps/azure-maps-search/assets.json +++ b/sdk/maps/azure-maps-search/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/maps/azure-maps-search", - "Tag": "python/maps/azure-maps-search_036480c3c1" + "Tag": "python/maps/azure-maps-search_4b5313e46d" } diff --git a/sdk/maps/azure-maps-search/azure/maps/search/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/__init__.py index 714d01dc61f94..871b16a5eb8e9 100644 --- a/sdk/maps/azure-maps-search/azure/maps/search/__init__.py +++ b/sdk/maps/azure-maps-search/azure/maps/search/__init__.py @@ -1,12 +1,50 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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 ._version import VERSION -from ._search_client import MapsSearchClient +from ._enums import ( + LocalizedMapView, + BoundaryResultType, + CalculationMethod, + Confidence, + FeatureCollection, + FeatureType, + GeoJsonObjectType, + MatchCodes, + Resolution, + ResultType, + ReverseGeocodingResultType, + UsageType, +) + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'MapsSearchClient' + "LocalizedMapView", + "BoundaryResultType", + "CalculationMethod", + "Confidence", + "FeatureCollection", + "FeatureType", + "GeoJsonObjectType", + "MatchCodes", + "Resolution", + "ResultType", + "ReverseGeocodingResultType", + "UsageType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() + __version__ = VERSION diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_client.py b/sdk/maps/azure-maps-search/azure/maps/search/_client.py new file mode 100644 index 0000000000000..7a66a113f6a40 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_client.py @@ -0,0 +1,122 @@ +# 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, Optional, TYPE_CHECKING + +from azure.core import PipelineClient +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse + +from ._configuration import MapsSearchClientConfiguration +from ._serialization import Deserializer, Serializer +from .operations import SearchOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class MapsSearchClient(SearchOperations): # pylint: disable=client-accepts-api-version-keyword + """Azure Maps Search REST APIs. + + :ivar search: SearchOperations operations + :vartype search: azure.maps.search.operations.SearchOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param accept_language: Language in which search results should be returned. + + Please refer to `Supported Languages `_ for details. + Default value is None. + :type accept_language: str + :param client_id: Specifies which account is intended for usage in conjunction with the Azure + AD security model. It represents a unique ID for the Azure Maps account and can be retrieved + from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see + the following `articles `_ for guidance. Default value is None. + :type client_id: str + :keyword endpoint: Service URL. Default value is "https://atlas.microsoft.com". + :paramtype endpoint: str + :keyword api_version: Api Version. Default value is "2023-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + accept_language: Optional[str] = None, + client_id: Optional[str] = None, + *, + endpoint: str = "https://atlas.microsoft.com", + **kwargs: Any + ) -> None: + self._config = MapsSearchClientConfiguration( + credential=credential, accept_language=accept_language, client_id=client_id, **kwargs + ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: PipelineClient = PipelineClient(base_url=endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + # Initialize the base SearchOperations + super().__init__( + client=self._client, + config=self._config, + serializer=self._serialize, + deserializer=self._deserialize + ) + + def send_request(self, request: HttpRequest, *, stream: bool = False, **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/") + + >>> response = client.send_request(request) + + + 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) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "MapsSearchClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_common/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/_common/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_configuration.py b/sdk/maps/azure-maps-search/azure/maps/search/_configuration.py new file mode 100644 index 0000000000000..c144663253c8d --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_configuration.py @@ -0,0 +1,77 @@ +# 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 typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + + +class MapsSearchClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for MapsSearchClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param accept_language: Language in which search results should be returned. + + Please refer to `Supported Languages `_ for details. + Default value is None. + :type accept_language: str + :param client_id: Specifies which account is intended for usage in conjunction with the Azure + AD security model. It represents a unique ID for the Azure Maps account and can be retrieved + from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see + the following `articles `_ for guidance. Default value is None. + :type client_id: str + :keyword api_version: Api Version. Default value is "2023-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + accept_language: Optional[str] = None, + client_id: Optional[str] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2023-06-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.credential = credential + self.accept_language = accept_language + self.client_id = client_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://atlas.microsoft.com/.default"]) + kwargs.setdefault("sdk_moniker", "maps-search/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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 + ) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_enums.py b/sdk/maps/azure-maps-search/azure/maps/search/_enums.py new file mode 100644 index 0000000000000..17b8bfa6ec48e --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_enums.py @@ -0,0 +1,216 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class LocalizedMapView(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LocalizedMapView.""" + + AE = "AE" + """United Arab Emirates (Arabic View)""" + AR = "AR" + """Argentina (Argentinian View)""" + BH = "BH" + """Bahrain (Arabic View)""" + IN = "IN" + """India (Indian View)""" + IQ = "IQ" + """Iraq (Arabic View)""" + JO = "JO" + """Jordan (Arabic View)""" + KW = "KW" + """Kuwait (Arabic View)""" + LB = "LB" + """Lebanon (Arabic View)""" + MA = "MA" + """Morocco (Moroccan View)""" + OM = "OM" + """Oman (Arabic View)""" + PK = "PK" + """Pakistan (Pakistani View)""" + PS = "PS" + """Palestinian Authority (Arabic View)""" + QA = "QA" + """Qatar (Arabic View)""" + SA = "SA" + """Saudi Arabia (Arabic View)""" + SY = "SY" + """Syria (Arabic View)""" + YE = "YE" + """Yemen (Arabic View)""" + AUTO = "Auto" + """Return the map data based on the IP address of the request.""" + UNIFIED = "Unified" + """Unified View (Others)""" + + +class BoundaryResultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """BoundaryResultType.""" + + COUNTRY_REGION = "countryRegion" + """Country or region.""" + ADMIN_DISTRICT = "adminDistrict" + """First administrative level within the country/region level, such as a state or a province.""" + ADMIN_DISTRICT2 = "adminDistrict2" + """Second administrative level within the country/region level, such as a county.""" + POSTAL_CODE = "postalCode" + """The smallest post code category, such as a zip code.""" + POSTAL_CODE2 = "postalCode2" + """The next largest post code category after postalCode that is created by aggregating postalCode + areas.""" + POSTAL_CODE3 = "postalCode3" + """The next largest post code category after postalCode2 that is created by aggregating + postalCode2 areas.""" + POSTAL_CODE4 = "postalCode4" + """The next largest post code category after postalCode3 that is created by aggregating + postalCode3 areas.""" + NEIGHBORHOOD = "neighborhood" + """A section of a populated place that is typically well-known, but often with indistinct + boundaries.""" + LOCALITY = "locality" + """A concentrated area of human settlement, such as a city, town or village.""" + + +class CalculationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The method that was used to compute the geocode point.""" + + INTERPOLATION = "Interpolation" + """The geocode point was matched to a point on a road using interpolation.""" + INTERPOLATION_OFFSET = "InterpolationOffset" + """The geocode point was matched to a point on a road using interpolation with an additional + offset to shift the point to the side of the street.""" + PARCEL = "Parcel" + """The geocode point was matched to the center of a parcel.""" + ROOFTOP = "Rooftop" + """The geocode point was matched to the rooftop of a building.""" + + +class Confidence(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The level of confidence that the geocoded location result is a match. Use this value with the + match code to determine for more complete information about the match. + The confidence of a geocoded location is based on many factors including the relative + importance of the geocoded location and the user’s location, if specified. + """ + + HIGH = "High" + """If the confidence is set to ``High``\\ , one or more strong matches were found. Multiple + ``High`` confidence matches are sorted in ranked order by importance when applicable. For + example, landmarks have importance but addresses do not. + + If a request includes a location or a view, then the ranking may change appropriately. For + example, a location query for "Paris" returns "Paris, France" and "Paris, TX" both with + ``High`` confidence. "Paris, France" is always ranked first due to importance unless a user + location indicates that the user is in or very close to Paris, TX or the map view indicates + that the user is searching in that area.""" + MEDIUM = "Medium" + """In some situations, the returned match may not be at the same level as the information provided + in the request. For example, a request may specify address information and the geocode service + may only be able to match a postal code. In this case, if the geocode service has a confidence + that the postal code matches the data, the confidence is set to ``Medium`` and the match code + is set to ``UpHierarchy`` to specify that it could not match all of the information and had to + search up-hierarchy. + + If the location information in the query is ambiguous, and there is no additional information + to rank the locations (such as user location or the relative importance of the location), the + confidence is set to ``Medium``. For example, a location query for "148th Ave, Bellevue" may + return "148th Ave SE" and "148th Ave NE" both with ``Medium`` confidence. + + If the location information in the query does not provide enough information to geocode a + specific location, a less precise location value may be returned and the confidence is set to + ``Medium``. For example, if an address is provided, but a match is not found for the house + number, the geocode result with a Roadblock entity type may be returned.""" + LOW = "Low" + + +class FeatureCollection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of a FeatureCollection object must be FeatureCollection.""" + + FEATURE_COLLECTION = "FeatureCollection" + + +class FeatureType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of a feature must be Feature.""" + + FEATURE = "Feature" + + +class GeoJsonObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON object types - Point, + MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature and + FeatureCollection. + """ + + GEO_JSON_POINT = "Point" + """``GeoJSON Point`` geometry.""" + GEO_JSON_MULTI_POINT = "MultiPoint" + """``GeoJSON MultiPoint`` geometry.""" + GEO_JSON_LINE_STRING = "LineString" + """``GeoJSON LineString`` geometry.""" + GEO_JSON_MULTI_LINE_STRING = "MultiLineString" + """``GeoJSON MultiLineString`` geometry.""" + GEO_JSON_POLYGON = "Polygon" + """``GeoJSON Polygon`` geometry.""" + GEO_JSON_MULTI_POLYGON = "MultiPolygon" + """``GeoJSON MultiPolygon`` geometry.""" + GEO_JSON_GEOMETRY_COLLECTION = "GeometryCollection" + """``GeoJSON GeometryCollection`` geometry.""" + GEO_JSON_FEATURE = "Feature" + """``GeoJSON Feature`` object.""" + GEO_JSON_FEATURE_COLLECTION = "FeatureCollection" + """``GeoJSON FeatureCollection`` object.""" + + +class MatchCodes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MatchCodes.""" + + GOOD = "Good" + AMBIGUOUS = "Ambiguous" + UP_HIERARCHY = "UpHierarchy" + + +class Resolution(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resolution.""" + + SMALL = "small" + """Return the boundary geometry with the least amount of points.""" + MEDIUM = "medium" + """Return the boundary geometry with more or the same amount of points as small.""" + LARGE = "large" + """Return the boundary geometry with more or the same amount of points as medium.""" + HUGE = "huge" + """Return the boundary geometry with more or the same amount of points as large.""" + + +class ResultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ResultType.""" + + ADDRESS = "Address" + NEIGHBORHOOD = "Neighborhood" + POPULATED_PLACE = "PopulatedPlace" + POSTCODE1 = "Postcode1" + ADMIN_DIVISION1 = "AdminDivision1" + ADMIN_DIVISION2 = "AdminDivision2" + COUNTRY_REGION = "CountryRegion" + + +class ReverseGeocodingResultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ReverseGeocodingResultType.""" + + ADDRESS = "Address" + NEIGHBORHOOD = "Neighborhood" + POPULATED_PLACE = "PopulatedPlace" + POSTCODE1 = "Postcode1" + ADMIN_DIVISION1 = "AdminDivision1" + ADMIN_DIVISION2 = "AdminDivision2" + COUNTRY_REGION = "CountryRegion" + + +class UsageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """UsageType.""" + + DISPLAY = "Display" + ROUTE = "Route" diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/_configuration.py b/sdk/maps/azure-maps-search/azure/maps/search/_generated/_configuration.py deleted file mode 100644 index 502f16c098179..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/_configuration.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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 typing import TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - - -class SearchClientConfiguration(Configuration): - """Configuration for SearchClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. - :type client_id: str - """ - - def __init__( - self, - credential, # type: "TokenCredential" - client_id=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - super(SearchClientConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.client_id = client_id - self.api_version = "1.0" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) - kwargs.setdefault('sdk_moniker', 'maps-search/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - 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) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/_metadata.json b/sdk/maps/azure-maps-search/azure/maps/search/_generated/_metadata.json deleted file mode 100644 index ccdc8534c8f65..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/_metadata.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "chosen_version": "1.0", - "total_api_version_list": ["1.0"], - "client": { - "name": "SearchClient", - "filename": "_search_client", - "description": "Azure Maps Search REST APIs.", - "base_url": "\u0027https://atlas.microsoft.com\u0027", - "custom_base_url": null, - "azure_arm": false, - "has_lro_operations": true, - "client_side_validation": false - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "client_id": { - "signature": "client_id=None, # type: Optional[str]", - "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", - "docstring_type": "str", - "required": false - } - }, - "async": { - "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "client_id": { - "signature": "client_id=None, # type: Optional[str]", - "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", - "docstring_type": "str", - "required": false - } - }, - "constant": { - }, - "call": "credential, client_id" - }, - "config": { - "credential": true, - "credential_scopes": ["https://atlas.microsoft.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null - }, - "operation_groups": { - "search": "SearchOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" -} \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/_search_client.py b/sdk/maps/azure-maps-search/azure/maps/search/_generated/_search_client.py deleted file mode 100644 index 8d694987df112..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/_search_client.py +++ /dev/null @@ -1,70 +0,0 @@ -# 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 typing import TYPE_CHECKING - -from azure.core import PipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - -from ._configuration import SearchClientConfiguration -from .operations import SearchOperations -from . import models - - -class SearchClient(object): - """Azure Maps Search REST APIs. - - :ivar search: SearchOperations operations - :vartype search: azure.maps.search.operations.SearchOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. - :type client_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - """ - - def __init__( - self, - credential, # type: "TokenCredential" - client_id=None, # type: Optional[str] - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://atlas.microsoft.com' - self._config = SearchClientConfiguration(credential, client_id, **kwargs) - self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False - self._deserialize = Deserializer(client_models) - - self.search = SearchOperations( - self._client, self._config, self._serialize, self._deserialize) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> SearchClient - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/__init__.py deleted file mode 100644 index ec41d54fc0466..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# 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 ._search_client import SearchClient -__all__ = ['SearchClient'] diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/_configuration.py b/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/_configuration.py deleted file mode 100644 index 3b8316242ee96..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/_configuration.py +++ /dev/null @@ -1,64 +0,0 @@ -# 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 typing import Any, Optional, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class SearchClientConfiguration(Configuration): - """Configuration for SearchClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. - :type client_id: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - client_id: Optional[str] = None, - **kwargs: Any - ) -> None: - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - super(SearchClientConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.client_id = client_id - self.api_version = "1.0" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) - kwargs.setdefault('sdk_moniker', 'maps-search/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/_search_client.py b/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/_search_client.py deleted file mode 100644 index 7244f3175e2cb..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/_search_client.py +++ /dev/null @@ -1,64 +0,0 @@ -# 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 typing import Any, Optional, TYPE_CHECKING - -from azure.core import AsyncPipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -from ._configuration import SearchClientConfiguration -from .operations import SearchOperations -from .. import models - - -class SearchClient(object): - """Azure Maps Search REST APIs. - - :ivar search: SearchOperations operations - :vartype search: azure.maps.search.aio.operations.SearchOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. - :type client_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - client_id: Optional[str] = None, - base_url: Optional[str] = None, - **kwargs: Any - ) -> None: - if not base_url: - base_url = 'https://atlas.microsoft.com' - self._config = SearchClientConfiguration(credential, client_id, **kwargs) - self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False - self._deserialize = Deserializer(client_models) - - self.search = SearchOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "SearchClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/operations/_search_operations.py b/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/operations/_search_operations.py deleted file mode 100644 index 9788972adfa41..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/operations/_search_operations.py +++ /dev/null @@ -1,5261 +0,0 @@ -# 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 typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.polling.async_base_polling import AsyncLROBasePolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class SearchOperations: - """SearchOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.maps.search.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def list_polygons( - self, - geometry_ids: List[str], - format: Union[str, "models.JsonFormat"] = "json", - **kwargs - ) -> "models.PolygonResult": - """**Get Polygon** - - **Applies to**\ : S1 pricing tier. - - The Get Polygon service allows you to request the geometry data such as a city or country - outline for a set of entities, previously retrieved from an Online Search request in GeoJSON - format. The geometry ID is returned in the sourceGeometry object under "geometry" and "id" in - either a Search Address or Search Fuzzy call. - - Please note that any geometry ID retrieved from an Online Search endpoint has a limited - lifetime. The client should not store geometry IDs in persistent storage for later referral, - as the stability of these identifiers is not guaranteed for a long period of time. It is - expected that a request to the Polygon method is made within a few minutes of the request to - the Online Search method that provided the ID. The service allows for batch requests up to 20 - identifiers. - - :param geometry_ids: Comma separated list of geometry UUIDs, previously retrieved from an - Online Search request. - :type geometry_ids: list[str] - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PolygonResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.PolygonResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolygonResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.list_polygons.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['geometries'] = self._serialize.query("geometry_ids", geometry_ids, '[str]', div=',') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('PolygonResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list_polygons.metadata = {'url': '/search/polygon/{format}'} # type: ignore - - async def fuzzy_search( - self, - query: str, - format: Union[str, "models.ResponseFormat"] = "json", - is_type_ahead: Optional[bool] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - category_filter: Optional[List[int]] = None, - country_filter: Optional[List[str]] = None, - lat: Optional[float] = None, - lon: Optional[float] = None, - radius_in_meters: Optional[int] = None, - top_left: Optional[str] = None, - btm_right: Optional[str] = None, - language: Optional[str] = None, - extended_postal_codes_for: Optional[List[Union[str, "models.SearchIndexes"]]] = None, - min_fuzzy_level: Optional[int] = None, - max_fuzzy_level: Optional[int] = None, - index_filter: Optional[List[Union[str, "models.SearchIndexes"]]] = None, - brand_filter: Optional[List[str]] = None, - electric_vehicle_connector_filter: Optional[List[Union[str, "models.ElectricVehicleConnector"]]] = None, - entity_type: Optional[Union[str, "models.GeographicEntityType"]] = None, - localized_map_view: Optional[Union[str, "models.LocalizedMapView"]] = None, - operating_hours: Optional[Union[str, "models.OperatingHoursRange"]] = None, - **kwargs - ) -> "models.SearchAddressResult": - """**Free Form Search** - - **Applies to**\ : S0 and S1 pricing tiers. - - The basic default API is Free Form Search which handles the most fuzzy of inputs handling any - combination of address or POI tokens. This search API is the canonical 'single line search'. - The Free Form Search API is a seamless combination of POI search and geocoding. The API can - also be weighted with a contextual position (lat./lon. pair), or fully constrained by a - coordinate and radius, or it can be executed more generally without any geo biasing anchor - point.:code:`
`:code:`
`We strongly advise you to use the 'countrySet' parameter to - specify only the countries for which your application needs coverage, as the default behavior - will be to search the entire world, potentially returning unnecessary - results.:code:`
`:code:`
` E.g.: ``countrySet``\ =US,FR :code:`
`:code:`
`Please - see `Search Coverage `_ for a complete list of all the supported countries.:code:`
`:code:`
`Most - Search queries default to ``maxFuzzyLevel``\ =2 to gain performance and also reduce unusual - results. This new default can be overridden as needed per request by passing in the query param - ``maxFuzzyLevel``\ =3 or 4. - - :param query: The applicable query string (e.g., "seattle", "pizza"). Can *also* be specified - as a comma separated string composed by latitude followed by longitude (e.g., "47.641268, - -122.125679"). Must be properly URL encoded. - :type query: str - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :type is_type_ahead: bool - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param skip: Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :type skip: int - :param category_filter: A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API `_. Usage - examples: - - - * - **categorySet=7315**\  (Search Points of Interest from category Restaurant) - - * - **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or - French Restaurant). - :type category_filter: list[int] - :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :type country_filter: list[str] - :param lat: Latitude where results should be biased. E.g. 37.337. - :type lat: float - :param lon: Longitude where results should be biased. E.g. -121.89. - :type lon: float - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area. - :type radius_in_meters: int - :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. - :type top_left: str - :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. - :type btm_right: str - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **Addr** = Address ranges - - **Geo** = Geographies - - **PAD** = Point Addresses - - **POI** = Points of Interest - - **Str** = Streets - - **XStr** = Cross Streets (intersections) - - Value should be a comma separated list of index types (in any order) or **None** for no - indexes. - - By default extended postal codes are included for all indexes except Geo. Extended postal code - lists for geographies can be quite long so they have to be explicitly requested when needed. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=PAD,Addr,POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] - :param min_fuzzy_level: Minimum fuzziness level to be used. Default: 1, minimum: 1 and maximum: - 4 - - - * - Level 1 has no spell checking. - - * - Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to - "restaurant." - - * - Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell - checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" - to "mountain view" matching. - - * - Level 4 doesn’t add any more spell checking functions. - - The search engine will start looking for a match on the level defined by minFuzzyLevel, and - will stop searching at the level specified by maxFuzzyLevel. - :type min_fuzzy_level: int - :param max_fuzzy_level: Maximum fuzziness level to be used. Default: 2, minimum: 1 and maximum: - 4 - - - * - Level 1 has no spell checking. - - * - Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to - "restaurant." - - * - Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell - checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" - to "mountain view" matching. - - * - Level 4 doesn’t add any more spell checking functions. - - The search engine will start looking for a match on the level defined by minFuzzyLevel, and - will stop searching at the level specified by maxFuzzyLevel. - :type max_fuzzy_level: int - :param index_filter: A comma separated list of indexes which should be utilized for the search. - Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = - Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross - Streets (intersections). - :type index_filter: list[str or ~azure.maps.search.models.SearchIndexes] - :param brand_filter: A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - - Usage examples: - - brandSet=Foo - - brandSet=Foo,Bar - - brandSet="A,B,C Comma",Bar. - :type brand_filter: list[str] - :param electric_vehicle_connector_filter: A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - - Available connector types are: - - - * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a - certain region. They are all AC single phase and the standard Voltage and standard Amperage. - See also: `Plug & socket types - World Standards - `_. - * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called - Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. - Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. - * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. - Provided as a cable and plug attached to the charging point. - * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided - as a socket set into the charging point. - * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called - Scame after the original manufacturer. Mostly used in combination with up to 240V single phase - or up to 420V three phase infrastructure. - * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric - Power Company and industrial partners. Because of this is is also known as the TEPCO's - connector. It supports fast DC charging. - * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 - standard. It is sometime referred to as by some combination of the standard, the color and the - fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. - * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 - standard. - * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. - I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port - mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. - - Usage examples: - - connectorSet=IEC62196Type2CableAttached - connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. - :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :param entity_type: Specifies the level of filtering performed on geographies. Narrows the - search for specified geography entity types, e.g. return only municipality. The resulting - response will contain the geography ID as well as the entity type matched. If you provide more - than one entity as a comma separated list, endpoint will return the 'smallest entity - available'. Returned Geometry ID can be used to get the geometry of that geography via `Get - Search Polygon `_ API. The - following parameters are ignored when entityType is set: - - - * heading - * number - * returnRoadUse - * returnSpeedLimit - * roadUse - * returnMatchType. - :type entity_type: str or ~azure.maps.search.models.GeographicEntityType - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.fuzzy_search.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, 'str') - if is_type_ahead is not None: - query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) - if category_filter is not None: - query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') - if country_filter is not None: - query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') - if lat is not None: - query_parameters['lat'] = self._serialize.query("lat", lat, 'float') - if lon is not None: - query_parameters['lon'] = self._serialize.query("lon", lon, 'float') - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if top_left is not None: - query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') - if btm_right is not None: - query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if min_fuzzy_level is not None: - query_parameters['minFuzzyLevel'] = self._serialize.query("min_fuzzy_level", min_fuzzy_level, 'int', maximum=4, minimum=1) - if max_fuzzy_level is not None: - query_parameters['maxFuzzyLevel'] = self._serialize.query("max_fuzzy_level", max_fuzzy_level, 'int', maximum=4, minimum=1) - if index_filter is not None: - query_parameters['idxSet'] = self._serialize.query("index_filter", index_filter, '[str]', div=',') - if brand_filter is not None: - query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') - if electric_vehicle_connector_filter is not None: - query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') - if entity_type is not None: - query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - if operating_hours is not None: - query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - fuzzy_search.metadata = {'url': '/search/fuzzy/{format}'} # type: ignore - - async def search_point_of_interest( - self, - query: str, - format: Union[str, "models.ResponseFormat"] = "json", - is_type_ahead: Optional[bool] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - category_filter: Optional[List[int]] = None, - country_filter: Optional[List[str]] = None, - lat: Optional[float] = None, - lon: Optional[float] = None, - radius_in_meters: Optional[int] = None, - top_left: Optional[str] = None, - btm_right: Optional[str] = None, - language: Optional[str] = None, - extended_postal_codes_for: Optional[List[Union[str, "models.PointOfInterestExtendedPostalCodes"]]] = None, - brand_filter: Optional[List[str]] = None, - electric_vehicle_connector_filter: Optional[List[Union[str, "models.ElectricVehicleConnector"]]] = None, - localized_map_view: Optional[Union[str, "models.LocalizedMapView"]] = None, - operating_hours: Optional[Union[str, "models.OperatingHoursRange"]] = None, - **kwargs - ) -> "models.SearchAddressResult": - """**Get POI by Name** - - **Applies to**\ : S0 and S1 pricing tiers. - - Points of Interest (POI) Search allows you to request POI results by name. Search supports - additional query parameters such as language and filtering results by area of interest driven - by country or bounding box. Endpoint will return only POI results matching the query string. - Response includes POI details such as address, coordinate location and category. - - :param query: The POI name to search for (e.g., "statue of liberty", "starbucks"), must be - properly URL encoded. - :type query: str - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :type is_type_ahead: bool - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param skip: Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :type skip: int - :param category_filter: A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API `_. Usage - examples: - - - * - **categorySet=7315**\  (Search Points of Interest from category Restaurant) - - * - **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or - French Restaurant). - :type category_filter: list[int] - :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :type country_filter: list[str] - :param lat: Latitude where results should be biased. E.g. 37.337. - :type lat: float - :param lon: Longitude where results should be biased. E.g. -121.89. - :type lon: float - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area. - :type radius_in_meters: int - :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. - :type top_left: str - :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. - :type btm_right: str - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **POI** = Points of Interest - - Value should be **POI** or **None** to disable extended postal codes. - - By default extended postal codes are included. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.PointOfInterestExtendedPostalCodes] - :param brand_filter: A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - - Usage examples: - - brandSet=Foo - - brandSet=Foo,Bar - - brandSet="A,B,C Comma",Bar. - :type brand_filter: list[str] - :param electric_vehicle_connector_filter: A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - - Available connector types are: - - - * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a - certain region. They are all AC single phase and the standard Voltage and standard Amperage. - See also: `Plug & socket types - World Standards - `_. - * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called - Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. - Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. - * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. - Provided as a cable and plug attached to the charging point. - * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided - as a socket set into the charging point. - * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called - Scame after the original manufacturer. Mostly used in combination with up to 240V single phase - or up to 420V three phase infrastructure. - * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric - Power Company and industrial partners. Because of this is is also known as the TEPCO's - connector. It supports fast DC charging. - * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 - standard. It is sometime referred to as by some combination of the standard, the color and the - fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. - * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 - standard. - * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. - I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port - mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. - - Usage examples: - - connectorSet=IEC62196Type2CableAttached - connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. - :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.search_point_of_interest.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, 'str') - if is_type_ahead is not None: - query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) - if category_filter is not None: - query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') - if country_filter is not None: - query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') - if lat is not None: - query_parameters['lat'] = self._serialize.query("lat", lat, 'float') - if lon is not None: - query_parameters['lon'] = self._serialize.query("lon", lon, 'float') - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if top_left is not None: - query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') - if btm_right is not None: - query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if brand_filter is not None: - query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') - if electric_vehicle_connector_filter is not None: - query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - if operating_hours is not None: - query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_point_of_interest.metadata = {'url': '/search/poi/{format}'} # type: ignore - - async def search_nearby_point_of_interest( - self, - lat: float, - lon: float, - format: Union[str, "models.ResponseFormat"] = "json", - top: Optional[int] = None, - skip: Optional[int] = None, - category_filter: Optional[List[int]] = None, - country_filter: Optional[List[str]] = None, - radius_in_meters: Optional[int] = None, - language: Optional[str] = None, - extended_postal_codes_for: Optional[List[Union[str, "models.SearchIndexes"]]] = None, - brand_filter: Optional[List[str]] = None, - electric_vehicle_connector_filter: Optional[List[Union[str, "models.ElectricVehicleConnector"]]] = None, - localized_map_view: Optional[Union[str, "models.LocalizedMapView"]] = None, - **kwargs - ) -> "models.SearchAddressResult": - """**Nearby Search** - - **Applies to**\ : S0 and S1 pricing tiers. - - If you have a use case for only retrieving POI results around a specific location, the nearby - search method may be the right choice. This endpoint will only return POI results, and does not - take in a search query parameter. - - :param lat: Latitude where results should be biased. E.g. 37.337. - :type lat: float - :param lon: Longitude where results should be biased. E.g. -121.89. - :type lon: float - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param skip: Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :type skip: int - :param category_filter: A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API `_. Usage - examples: - - - * - **categorySet=7315**\  (Search Points of Interest from category Restaurant) - - * - **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or - French Restaurant). - :type category_filter: list[int] - :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :type country_filter: list[str] - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area, Min value is 1, Max Value is 50000. - :type radius_in_meters: int - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **Addr** = Address ranges - - **Geo** = Geographies - - **PAD** = Point Addresses - - **POI** = Points of Interest - - **Str** = Streets - - **XStr** = Cross Streets (intersections) - - Value should be a comma separated list of index types (in any order) or **None** for no - indexes. - - By default extended postal codes are included for all indexes except Geo. Extended postal code - lists for geographies can be quite long so they have to be explicitly requested when needed. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=PAD,Addr,POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] - :param brand_filter: A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - - Usage examples: - - brandSet=Foo - - brandSet=Foo,Bar - - brandSet="A,B,C Comma",Bar. - :type brand_filter: list[str] - :param electric_vehicle_connector_filter: A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - - Available connector types are: - - - * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a - certain region. They are all AC single phase and the standard Voltage and standard Amperage. - See also: `Plug & socket types - World Standards - `_. - * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called - Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. - Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. - * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. - Provided as a cable and plug attached to the charging point. - * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided - as a socket set into the charging point. - * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called - Scame after the original manufacturer. Mostly used in combination with up to 240V single phase - or up to 420V three phase infrastructure. - * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric - Power Company and industrial partners. Because of this is is also known as the TEPCO's - connector. It supports fast DC charging. - * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 - standard. It is sometime referred to as by some combination of the standard, the color and the - fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. - * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 - standard. - * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. - I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port - mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. - - Usage examples: - - connectorSet=IEC62196Type2CableAttached - connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. - :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.search_nearby_point_of_interest.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['lat'] = self._serialize.query("lat", lat, 'float') - query_parameters['lon'] = self._serialize.query("lon", lon, 'float') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) - if category_filter is not None: - query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') - if country_filter is not None: - query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if brand_filter is not None: - query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') - if electric_vehicle_connector_filter is not None: - query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_nearby_point_of_interest.metadata = {'url': '/search/nearby/{format}'} # type: ignore - - async def search_point_of_interest_category( - self, - query: str, - format: Union[str, "models.ResponseFormat"] = "json", - is_type_ahead: Optional[bool] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - category_filter: Optional[List[int]] = None, - country_filter: Optional[List[str]] = None, - lat: Optional[float] = None, - lon: Optional[float] = None, - radius_in_meters: Optional[int] = None, - top_left: Optional[str] = None, - btm_right: Optional[str] = None, - language: Optional[str] = None, - extended_postal_codes_for: Optional[List[Union[str, "models.SearchIndexes"]]] = None, - brand_filter: Optional[List[str]] = None, - electric_vehicle_connector_filter: Optional[List[Union[str, "models.ElectricVehicleConnector"]]] = None, - localized_map_view: Optional[Union[str, "models.LocalizedMapView"]] = None, - operating_hours: Optional[Union[str, "models.OperatingHoursRange"]] = None, - **kwargs - ) -> "models.SearchAddressResult": - """**Get POI by Category** - - **Applies to**\ : S0 and S1 pricing tiers. - - Points of Interest (POI) Category Search allows you to request POI results from given category. - Search allows to query POIs from one category at a time. Endpoint will only return POI results - which are categorized as specified. Response includes POI details such as address, coordinate - location and classification. - - :param query: The POI category to search for (e.g., "AIRPORT", "RESTAURANT"), must be properly - URL encoded. Supported main categories can be requested by calling `Get Search POI Category - Tree API `_. List of available categories can also be - found `here `_. We - recommend to use POI Search Category Tree API to request the supported categories. - :type query: str - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :type is_type_ahead: bool - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param skip: Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :type skip: int - :param category_filter: A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API `_. Usage - examples: - - - * - **categorySet=7315**\  (Search Points of Interest from category Restaurant) - - * - **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or - French Restaurant). - :type category_filter: list[int] - :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :type country_filter: list[str] - :param lat: Latitude where results should be biased. E.g. 37.337. - :type lat: float - :param lon: Longitude where results should be biased. E.g. -121.89. - :type lon: float - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area. - :type radius_in_meters: int - :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. - :type top_left: str - :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. - :type btm_right: str - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **Addr** = Address ranges - - **Geo** = Geographies - - **PAD** = Point Addresses - - **POI** = Points of Interest - - **Str** = Streets - - **XStr** = Cross Streets (intersections) - - Value should be a comma separated list of index types (in any order) or **None** for no - indexes. - - By default extended postal codes are included for all indexes except Geo. Extended postal code - lists for geographies can be quite long so they have to be explicitly requested when needed. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=PAD,Addr,POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] - :param brand_filter: A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - - Usage examples: - - brandSet=Foo - - brandSet=Foo,Bar - - brandSet="A,B,C Comma",Bar. - :type brand_filter: list[str] - :param electric_vehicle_connector_filter: A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - - Available connector types are: - - - * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a - certain region. They are all AC single phase and the standard Voltage and standard Amperage. - See also: `Plug & socket types - World Standards - `_. - * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called - Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. - Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. - * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. - Provided as a cable and plug attached to the charging point. - * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided - as a socket set into the charging point. - * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called - Scame after the original manufacturer. Mostly used in combination with up to 240V single phase - or up to 420V three phase infrastructure. - * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric - Power Company and industrial partners. Because of this is is also known as the TEPCO's - connector. It supports fast DC charging. - * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 - standard. It is sometime referred to as by some combination of the standard, the color and the - fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. - * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 - standard. - * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. - I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port - mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. - - Usage examples: - - connectorSet=IEC62196Type2CableAttached - connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. - :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.search_point_of_interest_category.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, 'str') - if is_type_ahead is not None: - query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) - if category_filter is not None: - query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') - if country_filter is not None: - query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') - if lat is not None: - query_parameters['lat'] = self._serialize.query("lat", lat, 'float') - if lon is not None: - query_parameters['lon'] = self._serialize.query("lon", lon, 'float') - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if top_left is not None: - query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') - if btm_right is not None: - query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if brand_filter is not None: - query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') - if electric_vehicle_connector_filter is not None: - query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - if operating_hours is not None: - query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_point_of_interest_category.metadata = {'url': '/search/poi/category/{format}'} # type: ignore - - async def get_point_of_interest_category_tree( - self, - format: Union[str, "models.JsonFormat"] = "json", - language: Optional[str] = None, - **kwargs - ) -> "models.PointOfInterestCategoryTreeResult": - """**Get POI Category Tree** - - **Applies to**\ : S0 and S1 pricing tiers. - - POI Category API provides a full list of supported Points of Interest (POI) categories and - subcategories together with their translations and synonyms. The returned content can be used - to provide more meaningful results through other Search Service APIs, like `Get Search POI - `_. - - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, except NGT and NGT-Latn. Language tag is case insensitive. When - data in specified language is not available for a specific field, default language is used - (English). - - Please refer to `Supported Languages `_ for details. - :type language: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PointOfInterestCategoryTreeResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.PointOfInterestCategoryTreeResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PointOfInterestCategoryTreeResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.get_point_of_interest_category_tree.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('PointOfInterestCategoryTreeResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_point_of_interest_category_tree.metadata = {'url': '/search/poi/category/tree/{format}'} # type: ignore - - async def search_address( - self, - query: str, - format: Union[str, "models.ResponseFormat"] = "json", - is_type_ahead: Optional[bool] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - country_filter: Optional[List[str]] = None, - lat: Optional[float] = None, - lon: Optional[float] = None, - radius_in_meters: Optional[int] = None, - top_left: Optional[str] = None, - btm_right: Optional[str] = None, - language: Optional[str] = None, - extended_postal_codes_for: Optional[List[Union[str, "models.SearchIndexes"]]] = None, - entity_type: Optional[Union[str, "models.GeographicEntityType"]] = None, - localized_map_view: Optional[Union[str, "models.LocalizedMapView"]] = None, - **kwargs - ) -> "models.SearchAddressResult": - """**Address Geocoding** - - **Applies to**\ : S0 and S1 pricing tiers. - - In many cases, the complete search service might be too much, for instance if you are only - interested in traditional geocoding. Search can also be accessed for address look up - exclusively. The geocoding is performed by hitting the geocode endpoint with just the address - or partial address in question. The geocoding search index will be queried for everything above - the street level data. No POIs will be returned. Note that the geocoder is very tolerant of - typos and incomplete addresses. It will also handle everything from exact street addresses or - street or intersections as well as higher level geographies such as city centers, counties, - states etc. - - :param query: The address to search for (e.g., "1 Microsoft way, Redmond, WA"), must be - properly URL encoded. - :type query: str - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :type is_type_ahead: bool - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param skip: Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :type skip: int - :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :type country_filter: list[str] - :param lat: Latitude where results should be biased. E.g. 37.337. - :type lat: float - :param lon: Longitude where results should be biased. E.g. -121.89. - :type lon: float - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area. - :type radius_in_meters: int - :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. - :type top_left: str - :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. - :type btm_right: str - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **Addr** = Address ranges - - **Geo** = Geographies - - **PAD** = Point Addresses - - **POI** = Points of Interest - - **Str** = Streets - - **XStr** = Cross Streets (intersections) - - Value should be a comma separated list of index types (in any order) or **None** for no - indexes. - - By default extended postal codes are included for all indexes except Geo. Extended postal code - lists for geographies can be quite long so they have to be explicitly requested when needed. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=PAD,Addr,POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] - :param entity_type: Specifies the level of filtering performed on geographies. Narrows the - search for specified geography entity types, e.g. return only municipality. The resulting - response will contain the geography ID as well as the entity type matched. If you provide more - than one entity as a comma separated list, endpoint will return the 'smallest entity - available'. Returned Geometry ID can be used to get the geometry of that geography via `Get - Search Polygon `_ API. The - following parameters are ignored when entityType is set: - - - * heading - * number - * returnRoadUse - * returnSpeedLimit - * roadUse - * returnMatchType. - :type entity_type: str or ~azure.maps.search.models.GeographicEntityType - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.search_address.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, 'str') - if is_type_ahead is not None: - query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) - if country_filter is not None: - query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') - if lat is not None: - query_parameters['lat'] = self._serialize.query("lat", lat, 'float') - if lon is not None: - query_parameters['lon'] = self._serialize.query("lon", lon, 'float') - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if top_left is not None: - query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') - if btm_right is not None: - query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if entity_type is not None: - query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_address.metadata = {'url': '/search/address/{format}'} # type: ignore - - async def reverse_search_address( - self, - query: List[float], - format: Union[str, "models.ResponseFormat"] = "json", - language: Optional[str] = None, - include_speed_limit: Optional[bool] = None, - heading: Optional[int] = None, - radius_in_meters: Optional[int] = None, - number: Optional[str] = None, - include_road_use: Optional[bool] = None, - road_use: Optional[List[Union[str, "models.RoadUseType"]]] = None, - allow_freeform_newline: Optional[bool] = None, - include_match_type: Optional[bool] = None, - entity_type: Optional[Union[str, "models.GeographicEntityType"]] = None, - localized_map_view: Optional[Union[str, "models.LocalizedMapView"]] = None, - **kwargs - ) -> "models.ReverseSearchAddressResult": - """**Reverse Geocode to an Address** - - **Applies to**\ : S0 and S1 pricing tiers. - - There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) - into a human understandable street address. Most often this is needed in tracking applications - where you receive a GPS feed from the device or asset and wish to know what address where the - coordinate is located. This endpoint will return address information for a given coordinate. - - :param query: The applicable query specified as a comma separated string composed by latitude - followed by longitude e.g. "47.641268,-122.125679". - :type query: list[float] - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param include_speed_limit: Boolean. To enable return of the posted speed limit. - :type include_speed_limit: bool - :param heading: The directional heading of the vehicle in degrees, for travel along a segment - of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can - include upto one decimal place. - :type heading: int - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area. - :type radius_in_meters: int - :param number: If a number is sent in along with the request, the response may include the side - of the street (Left/Right) and also an offset position for that number. - :type number: str - :param include_road_use: Boolean. To enable return of the road use array for reverse geocodes - at street level. - :type include_road_use: bool - :param road_use: To restrict reverse geocodes to a certain type of road use. The road use array - for reverse geocodes can be one or more of LimitedAccess, Arterial, Terminal, Ramp, Rotary, - LocalStreet. - :type road_use: list[str or ~azure.maps.search.models.RoadUseType] - :param allow_freeform_newline: Format of newlines in the formatted address. - - If true, the address will contain newlines. - If false, newlines will be converted to commas. - :type allow_freeform_newline: bool - :param include_match_type: Include information on the type of match the geocoder achieved in - the response. - :type include_match_type: bool - :param entity_type: Specifies the level of filtering performed on geographies. Narrows the - search for specified geography entity types, e.g. return only municipality. The resulting - response will contain the geography ID as well as the entity type matched. If you provide more - than one entity as a comma separated list, endpoint will return the 'smallest entity - available'. Returned Geometry ID can be used to get the geometry of that geography via `Get - Search Polygon `_ API. The - following parameters are ignored when entityType is set: - - - * heading - * number - * returnRoadUse - * returnSpeedLimit - * roadUse - * returnMatchType. - :type entity_type: str or ~azure.maps.search.models.GeographicEntityType - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReverseSearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.ReverseSearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ReverseSearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.reverse_search_address.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, '[float]', div=',') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if include_speed_limit is not None: - query_parameters['returnSpeedLimit'] = self._serialize.query("include_speed_limit", include_speed_limit, 'bool') - if heading is not None: - query_parameters['heading'] = self._serialize.query("heading", heading, 'int', maximum=360, minimum=-360) - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if number is not None: - query_parameters['number'] = self._serialize.query("number", number, 'str') - if include_road_use is not None: - query_parameters['returnRoadUse'] = self._serialize.query("include_road_use", include_road_use, 'bool') - if road_use is not None: - query_parameters['roadUse'] = self._serialize.query("road_use", road_use, '[str]', div=',') - if allow_freeform_newline is not None: - query_parameters['allowFreeformNewline'] = self._serialize.query("allow_freeform_newline", allow_freeform_newline, 'bool') - if include_match_type is not None: - query_parameters['returnMatchType'] = self._serialize.query("include_match_type", include_match_type, 'bool') - if entity_type is not None: - query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('ReverseSearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - reverse_search_address.metadata = {'url': '/search/address/reverse/{format}'} # type: ignore - - async def reverse_search_cross_street_address( - self, - query: List[float], - format: Union[str, "models.ResponseFormat"] = "json", - top: Optional[int] = None, - heading: Optional[int] = None, - radius_in_meters: Optional[int] = None, - language: Optional[str] = None, - localized_map_view: Optional[Union[str, "models.LocalizedMapView"]] = None, - **kwargs - ) -> "models.ReverseSearchCrossStreetAddressResult": - """**Reverse Geocode to a Cross Street** - - **Applies to**\ : S0 and S1 pricing tiers. - - There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) - into a human understandable cross street. Most often this is needed in tracking applications - where you receive a GPS feed from the device or asset and wish to know what address where the - coordinate is located. - This endpoint will return cross street information for a given coordinate. - - :param query: The applicable query specified as a comma separated string composed by latitude - followed by longitude e.g. "47.641268,-122.125679". - :type query: list[float] - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param heading: The directional heading of the vehicle in degrees, for travel along a segment - of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can - include upto one decimal place. - :type heading: int - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area. - :type radius_in_meters: int - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReverseSearchCrossStreetAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.ReverseSearchCrossStreetAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ReverseSearchCrossStreetAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.reverse_search_cross_street_address.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, '[float]', div=',') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if heading is not None: - query_parameters['heading'] = self._serialize.query("heading", heading, 'int', maximum=360, minimum=-360) - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('ReverseSearchCrossStreetAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - reverse_search_cross_street_address.metadata = {'url': '/search/address/reverse/crossStreet/{format}'} # type: ignore - - async def search_structured_address( - self, - format: Union[str, "models.ResponseFormat"] = "json", - language: Optional[str] = None, - country_code: str = "US", - top: Optional[int] = None, - skip: Optional[int] = None, - street_number: Optional[str] = None, - street_name: Optional[str] = None, - cross_street: Optional[str] = None, - municipality: Optional[str] = None, - municipality_subdivision: Optional[str] = None, - country_tertiary_subdivision: Optional[str] = None, - country_secondary_subdivision: Optional[str] = None, - country_subdivision: Optional[str] = None, - postal_code: Optional[str] = None, - extended_postal_codes_for: Optional[List[Union[str, "models.SearchIndexes"]]] = None, - entity_type: Optional[Union[str, "models.GeographicEntityType"]] = None, - localized_map_view: Optional[Union[str, "models.LocalizedMapView"]] = None, - **kwargs - ) -> "models.SearchAddressResult": - """**Structured Address Geocoding** - - **Applies to**\ : S0 and S1 pricing tiers. - - Azure Address Geocoding can also be accessed for structured address look up exclusively. The - geocoding search index will be queried for everything above the street level data. No POIs - will be returned. Note that the geocoder is very tolerant of typos and incomplete addresses. - It will also handle everything from exact street addresses or street or intersections as well - as higher level geographies such as city centers, counties, states etc. - - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param country_code: The 2 or 3 letter `ISO3166-1 `_ country code portion of an address. E.g. US. - :type country_code: str - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param skip: Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :type skip: int - :param street_number: The street number portion of an address. - :type street_number: str - :param street_name: The street name portion of an address. - :type street_name: str - :param cross_street: The cross street name for the structured address. - :type cross_street: str - :param municipality: The municipality portion of an address. - :type municipality: str - :param municipality_subdivision: The municipality subdivision (sub/super city) for the - structured address. - :type municipality_subdivision: str - :param country_tertiary_subdivision: The named area for the structured address. - :type country_tertiary_subdivision: str - :param country_secondary_subdivision: The county for the structured address. - :type country_secondary_subdivision: str - :param country_subdivision: The country subdivision portion of an address. - :type country_subdivision: str - :param postal_code: The postal code portion of an address. - :type postal_code: str - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **Addr** = Address ranges - - **Geo** = Geographies - - **PAD** = Point Addresses - - **POI** = Points of Interest - - **Str** = Streets - - **XStr** = Cross Streets (intersections) - - Value should be a comma separated list of index types (in any order) or **None** for no - indexes. - - By default extended postal codes are included for all indexes except Geo. Extended postal code - lists for geographies can be quite long so they have to be explicitly requested when needed. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=PAD,Addr,POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] - :param entity_type: Specifies the level of filtering performed on geographies. Narrows the - search for specified geography entity types, e.g. return only municipality. The resulting - response will contain the geography ID as well as the entity type matched. If you provide more - than one entity as a comma separated list, endpoint will return the 'smallest entity - available'. Returned Geometry ID can be used to get the geometry of that geography via `Get - Search Polygon `_ API. The - following parameters are ignored when entityType is set: - - - * heading - * number - * returnRoadUse - * returnSpeedLimit - * roadUse - * returnMatchType. - :type entity_type: str or ~azure.maps.search.models.GeographicEntityType - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.search_structured_address.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - query_parameters['countryCode'] = self._serialize.query("country_code", country_code, 'str') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) - if street_number is not None: - query_parameters['streetNumber'] = self._serialize.query("street_number", street_number, 'str') - if street_name is not None: - query_parameters['streetName'] = self._serialize.query("street_name", street_name, 'str') - if cross_street is not None: - query_parameters['crossStreet'] = self._serialize.query("cross_street", cross_street, 'str') - if municipality is not None: - query_parameters['municipality'] = self._serialize.query("municipality", municipality, 'str') - if municipality_subdivision is not None: - query_parameters['municipalitySubdivision'] = self._serialize.query("municipality_subdivision", municipality_subdivision, 'str') - if country_tertiary_subdivision is not None: - query_parameters['countryTertiarySubdivision'] = self._serialize.query("country_tertiary_subdivision", country_tertiary_subdivision, 'str') - if country_secondary_subdivision is not None: - query_parameters['countrySecondarySubdivision'] = self._serialize.query("country_secondary_subdivision", country_secondary_subdivision, 'str') - if country_subdivision is not None: - query_parameters['countrySubdivision'] = self._serialize.query("country_subdivision", country_subdivision, 'str') - if postal_code is not None: - query_parameters['postalCode'] = self._serialize.query("postal_code", postal_code, 'str') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if entity_type is not None: - query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_structured_address.metadata = {'url': '/search/address/structured/{format}'} # type: ignore - - async def search_inside_geometry( - self, - query: str, - geometry: "models.SearchInsideGeometryRequest", - format: Union[str, "models.ResponseFormat"] = "json", - top: Optional[int] = None, - language: Optional[str] = None, - category_filter: Optional[List[int]] = None, - extended_postal_codes_for: Optional[List[Union[str, "models.SearchIndexes"]]] = None, - index_filter: Optional[List[Union[str, "models.SearchIndexes"]]] = None, - localized_map_view: Optional[Union[str, "models.LocalizedMapView"]] = None, - operating_hours: Optional[Union[str, "models.OperatingHoursRange"]] = None, - **kwargs - ) -> "models.SearchAddressResult": - """**Applies to**\ : S0 and S1 pricing tiers. - - The Search Geometry endpoint allows you to perform a free form search inside a single geometry - or many of them. The search results that fall inside the geometry/geometries will be - returned.:code:`
`:code:`
`To send the geometry you will use a ``POST`` request where the - request body will contain the ``geometry`` object represented as a ``GeoJSON`` type and the - ``Content-Type`` header will be set to ``application/json``. The geographical features to be - searched can be modeled as Polygon and/or Circle geometries represented using any one of the - following ``GeoJSON`` types::code:`
  • **GeoJSON FeatureCollection**
    The `geometry` can - be represented as a `GeoJSON FeatureCollection` object. This is the recommended option if the - geometry contains both Polygons and Circles. The `FeatureCollection` can contain a max of 50 - `GeoJSON Feature` objects. Each `Feature` object should represent either a Polygon or a Circle - with the following conditions:
    • A `Feature` object for the - Polygon geometry can have a max of 50 coordinates and it's properties must be empty.
    • A - `Feature` object for the Circle geometry is composed of a _center_ represented using a `GeoJSON - Point` type and a _radius_ value (in meters) which must be specified in the object's properties - along with the _subType_ property whose value should be 'Circle'.
    `:code:`
    ` Please - see the Examples section below for a sample ``FeatureCollection`` - representation.:code:`
    `:code:`
    `
  • :code:`
  • **GeoJSON GeometryCollection**
    The - `geometry` can be represented as a `GeoJSON GeometryCollection` object. This is the recommended - option if the geometry contains a list of Polygons only. The `GeometryCollection` can contain a - max of 50 `GeoJSON Polygon` objects. Each `Polygon` object can have a max of 50 coordinates. - Please see the Examples section below for a sample `GeometryCollection` - representation.

  • `:code:`
  • **GeoJSON Polygon**
    The `geometry` can be - represented as a `GeoJSON Polygon` object. This is the recommended option if the geometry - contains a single Polygon. The `Polygon` object can have a max of 50 coordinates. Please see - the Examples section below for a sample `Polygon` - representation.

  • `
.:code:`
`:code:`
`. - - :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). - Must be properly URL encoded. - :type query: str - :param geometry: This represents the geometry for one or more geographical features (parks, - state boundary etc.) to search in and should be a GeoJSON compliant type. Please refer to `RFC - 7946 `_ for details. - :type geometry: ~azure.maps.search.models.SearchInsideGeometryRequest - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param category_filter: A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API `_. Usage - examples: - - - * - **categorySet=7315**\  (Search Points of Interest from category Restaurant) - - * - **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or - French Restaurant). - :type category_filter: list[int] - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **Addr** = Address ranges - - **Geo** = Geographies - - **PAD** = Point Addresses - - **POI** = Points of Interest - - **Str** = Streets - - **XStr** = Cross Streets (intersections) - - Value should be a comma separated list of index types (in any order) or **None** for no - indexes. - - By default extended postal codes are included for all indexes except Geo. Extended postal code - lists for geographies can be quite long so they have to be explicitly requested when needed. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=PAD,Addr,POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] - :param index_filter: A comma separated list of indexes which should be utilized for the search. - Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = - Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross - Streets (intersections). - :type index_filter: list[str or ~azure.maps.search.models.SearchIndexes] - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.search_inside_geometry.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, 'str') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if category_filter is not None: - query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if index_filter is not None: - query_parameters['idxSet'] = self._serialize.query("index_filter", index_filter, '[str]', div=',') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - if operating_hours is not None: - query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(geometry, 'SearchInsideGeometryRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_inside_geometry.metadata = {'url': '/search/geometry/{format}'} # type: ignore - - async def search_along_route( - self, - query: str, - max_detour_time: int, - route: "models.SearchAlongRouteRequest", - format: Union[str, "models.ResponseFormat"] = "json", - top: Optional[int] = None, - brand_filter: Optional[List[str]] = None, - category_filter: Optional[List[int]] = None, - electric_vehicle_connector_filter: Optional[List[Union[str, "models.ElectricVehicleConnector"]]] = None, - localized_map_view: Optional[Union[str, "models.LocalizedMapView"]] = None, - operating_hours: Optional[Union[str, "models.OperatingHoursRange"]] = None, - **kwargs - ) -> "models.SearchAddressResult": - """**Applies to**\ : S0 and S1 pricing tiers. - - The Search Along Route endpoint allows you to perform a fuzzy search for POIs along a specified - route. This search is constrained by specifying the ``maxDetourTime`` limiting - measure.:code:`
`:code:`
`To send the route-points you will use a ``POST`` request where - the request body will contain the ``route`` object represented as a ``GeoJSON LineString`` type - and the ``Content-Type`` header will be set to ``application/json``. Each route-point in - ``route`` is represented as a ``GeoJSON Position`` type i.e. an array where the *longitude* - value is followed by the *latitude* value and the *altitude* value is ignored. The ``route`` - should contain at least 2 route-points.:code:`
`:code:`
`It is possible that original - route will be altered, some of it's points may be skipped. If the route that passes through the - found point is faster than the original one, the ``detourTime`` value in the response is - negative. - - :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). - Must be properly URL encoded. - :type query: str - :param max_detour_time: Maximum detour time of the point of interest in seconds. Max value is - 3600 seconds. - :type max_detour_time: int - :param route: This represents the route to search along and should be a valid ``GeoJSON - LineString`` type. Please refer to `RFC 7946 - `_ for details. - :type route: ~azure.maps.search.models.SearchAlongRouteRequest - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param top: Maximum number of responses that will be returned. Default value is 10. Max value - is 20. - :type top: int - :param brand_filter: A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - - Usage examples: - - brandSet=Foo - - brandSet=Foo,Bar - - brandSet="A,B,C Comma",Bar. - :type brand_filter: list[str] - :param category_filter: A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API `_. Usage - examples: - - - * - **categorySet=7315**\  (Search Points of Interest from category Restaurant) - - * - **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or - French Restaurant). - :type category_filter: list[int] - :param electric_vehicle_connector_filter: A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - - Available connector types are: - - - * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a - certain region. They are all AC single phase and the standard Voltage and standard Amperage. - See also: `Plug & socket types - World Standards - `_. - * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called - Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. - Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. - * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. - Provided as a cable and plug attached to the charging point. - * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided - as a socket set into the charging point. - * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called - Scame after the original manufacturer. Mostly used in combination with up to 240V single phase - or up to 420V three phase infrastructure. - * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric - Power Company and industrial partners. Because of this is is also known as the TEPCO's - connector. It supports fast DC charging. - * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 - standard. It is sometime referred to as by some combination of the standard, the color and the - fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. - * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 - standard. - * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. - I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port - mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. - - Usage examples: - - connectorSet=IEC62196Type2CableAttached - connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. - :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.search_along_route.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, 'str') - query_parameters['maxDetourTime'] = self._serialize.query("max_detour_time", max_detour_time, 'int', maximum=3600) - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=20) - if brand_filter is not None: - query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') - if category_filter is not None: - query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') - if electric_vehicle_connector_filter is not None: - query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - if operating_hours is not None: - query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(route, 'SearchAlongRouteRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_along_route.metadata = {'url': '/search/alongRoute/{format}'} # type: ignore - - async def fuzzy_search_batch_sync( - self, - batch_request: "models.BatchRequest", - format: Union[str, "models.JsonFormat"] = "json", - **kwargs - ) -> "models.SearchAddressBatchResult": - """**Search Fuzzy Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Fuzzy API - `_ using just a single API - call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription- - key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search fuzzy* queries you will use a ``POST`` request where the request body will - contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set - to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, - {"query": "?query=Statue Of Liberty&limit=2"}, - {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, - {"query": "?query=Space Needle"}, - {"query": "?query=pizza&limit=10"} - ] - } - - A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, - api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI - parameters `_. - The string values in the *search fuzzy* query must be properly escaped (e.g. " character should - be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription- - key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressResponse`` - `_ - If - the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "query": "atm" - }, - "results": [ - { - "type": "POI", - "poi": { - "name": "ATM at Wells Fargo" - }, - "address": { - "country": "United States Of America", - "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" - } - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "query": "statue of liberty" - }, - "results": [ - { - "type": "POI", - "poi": { - "name": "Statue of Liberty" - }, - "address": { - "country": "United States Of America", - "freeformAddress": "New York, NY 10004" - } - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_request: The list of search fuzzy queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type batch_request: ~azure.maps.search.models.BatchRequest - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressBatchResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressBatchResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressBatchResult"] - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 408: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.fuzzy_search_batch_sync.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(batch_request, 'BatchRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - fuzzy_search_batch_sync.metadata = {'url': '/search/fuzzy/batch/sync/{format}'} # type: ignore - - async def _fuzzy_search_batch_initial( - self, - batch_request: "models.BatchRequest", - format: Union[str, "models.JsonFormat"] = "json", - **kwargs - ) -> Optional["models.SearchAddressBatchResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SearchAddressBatchResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._fuzzy_search_batch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(batch_request, 'BatchRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _fuzzy_search_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore - - async def begin_fuzzy_search_batch( - self, - batch_request: "models.BatchRequest", - format: Union[str, "models.JsonFormat"] = "json", - **kwargs - ) -> AsyncLROPoller["models.SearchAddressBatchResult"]: - """**Search Fuzzy Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Fuzzy API - `_ using just a single API - call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription- - key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search fuzzy* queries you will use a ``POST`` request where the request body will - contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set - to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, - {"query": "?query=Statue Of Liberty&limit=2"}, - {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, - {"query": "?query=Space Needle"}, - {"query": "?query=pizza&limit=10"} - ] - } - - A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, - api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI - parameters `_. - The string values in the *search fuzzy* query must be properly escaped (e.g. " character should - be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription- - key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressResponse`` - `_ - If - the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "query": "atm" - }, - "results": [ - { - "type": "POI", - "poi": { - "name": "ATM at Wells Fargo" - }, - "address": { - "country": "United States Of America", - "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" - } - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "query": "statue of liberty" - }, - "results": [ - { - "type": "POI", - "poi": { - "name": "Statue of Liberty" - }, - "address": { - "country": "United States Of America", - "freeformAddress": "New York, NY 10004" - } - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_request: The list of search fuzzy queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type batch_request: ~azure.maps.search.models.BatchRequest - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SearchAddressBatchResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressBatchResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._fuzzy_search_batch_initial( - batch_request=batch_request, - format=format, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_fuzzy_search_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore - - async def _get_fuzzy_search_batch_initial( - self, - batch_id: str, - **kwargs - ) -> Optional["models.SearchAddressBatchResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SearchAddressBatchResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self._get_fuzzy_search_batch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("batch_id", batch_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _get_fuzzy_search_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore - - async def begin_get_fuzzy_search_batch( - self, - batch_id: str, - **kwargs - ) -> AsyncLROPoller["models.SearchAddressBatchResult"]: - """**Search Fuzzy Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Fuzzy API - `_ using just a single API - call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription- - key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search fuzzy* queries you will use a ``POST`` request where the request body will - contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set - to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, - {"query": "?query=Statue Of Liberty&limit=2"}, - {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, - {"query": "?query=Space Needle"}, - {"query": "?query=pizza&limit=10"} - ] - } - - A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, - api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI - parameters `_. - The string values in the *search fuzzy* query must be properly escaped (e.g. " character should - be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription- - key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressResponse`` - `_ - If - the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "query": "atm" - }, - "results": [ - { - "type": "POI", - "poi": { - "name": "ATM at Wells Fargo" - }, - "address": { - "country": "United States Of America", - "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" - } - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "query": "statue of liberty" - }, - "results": [ - { - "type": "POI", - "poi": { - "name": "Statue of Liberty" - }, - "address": { - "country": "United States Of America", - "freeformAddress": "New York, NY 10004" - } - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_id: Batch id for querying the operation. - :type batch_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SearchAddressBatchResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressBatchResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._get_fuzzy_search_batch_initial( - batch_id=batch_id, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'format': self._serialize.url("batch_id", batch_id, 'str'), - } - - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_get_fuzzy_search_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore - - async def search_address_batch_sync( - self, - batch_request: "models.BatchRequest", - format: Union[str, "models.JsonFormat"] = "json", - **kwargs - ) -> "models.SearchAddressBatchResult": - """**Search Address Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Address API - `_ using just a single API - call. You can call Search Address Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/address/batch/sync/json?api- - version=1.0&subscription-key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/address/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search address* queries you will use a ``POST`` request where the request body - will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will - be set to ``application/json``. Here's a sample request body containing 5 *search address* - queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, - {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, - {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, - {"query": "?query=Pike Pl, Seattle, WA - 98101&lat=47.610970&lon=-122.342469&radius=1000"}, - {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, - France&limit=1"} - ] - } - - A *search address* query in a batch is just a partial URL *without* the protocol, base URL, - path, api-version and subscription-key. It can accept any of the supported *search address* - `URI parameters `_. The string values in the *search address* query must be properly escaped (e.g. " - character should be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription- - key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressResponse`` - `_ - If - the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "query": "one microsoft way redmond wa 98052" - }, - "results": [ - { - "position": { - "lat": 47.63989, - "lon": -122.12509 - } - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "query": "pike pl seattle wa 98101" - }, - "results": [ - { - "position": { - "lat": 47.60963, - "lon": -122.34215 - } - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_request: The list of address geocoding queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type batch_request: ~azure.maps.search.models.BatchRequest - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressBatchResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressBatchResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressBatchResult"] - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 408: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.search_address_batch_sync.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(batch_request, 'BatchRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_address_batch_sync.metadata = {'url': '/search/address/batch/sync/{format}'} # type: ignore - - async def _search_address_batch_initial( - self, - batch_request: "models.BatchRequest", - format: Union[str, "models.JsonFormat"] = "json", - **kwargs - ) -> Optional["models.SearchAddressBatchResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SearchAddressBatchResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._search_address_batch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(batch_request, 'BatchRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore - - async def begin_search_address_batch( - self, - batch_request: "models.BatchRequest", - format: Union[str, "models.JsonFormat"] = "json", - **kwargs - ) -> AsyncLROPoller["models.SearchAddressBatchResult"]: - """**Search Address Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Address API - `_ using just a single API - call. You can call Search Address Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/address/batch/sync/json?api- - version=1.0&subscription-key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/address/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search address* queries you will use a ``POST`` request where the request body - will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will - be set to ``application/json``. Here's a sample request body containing 5 *search address* - queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, - {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, - {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, - {"query": "?query=Pike Pl, Seattle, WA - 98101&lat=47.610970&lon=-122.342469&radius=1000"}, - {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, - France&limit=1"} - ] - } - - A *search address* query in a batch is just a partial URL *without* the protocol, base URL, - path, api-version and subscription-key. It can accept any of the supported *search address* - `URI parameters `_. The string values in the *search address* query must be properly escaped (e.g. " - character should be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription- - key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressResponse`` - `_ - If - the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "query": "one microsoft way redmond wa 98052" - }, - "results": [ - { - "position": { - "lat": 47.63989, - "lon": -122.12509 - } - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "query": "pike pl seattle wa 98101" - }, - "results": [ - { - "position": { - "lat": 47.60963, - "lon": -122.34215 - } - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_request: The list of address geocoding queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type batch_request: ~azure.maps.search.models.BatchRequest - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SearchAddressBatchResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressBatchResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._search_address_batch_initial( - batch_request=batch_request, - format=format, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore - - async def _get_search_address_batch_initial( - self, - batch_id: str, - **kwargs - ) -> Optional["models.SearchAddressBatchResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SearchAddressBatchResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self._get_search_address_batch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("batch_id", batch_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _get_search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore - - async def begin_get_search_address_batch( - self, - batch_id: str, - **kwargs - ) -> AsyncLROPoller["models.SearchAddressBatchResult"]: - """**Search Address Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Address API - `_ using just a single API - call. You can call Search Address Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/address/batch/sync/json?api- - version=1.0&subscription-key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/address/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search address* queries you will use a ``POST`` request where the request body - will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will - be set to ``application/json``. Here's a sample request body containing 5 *search address* - queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, - {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, - {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, - {"query": "?query=Pike Pl, Seattle, WA - 98101&lat=47.610970&lon=-122.342469&radius=1000"}, - {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, - France&limit=1"} - ] - } - - A *search address* query in a batch is just a partial URL *without* the protocol, base URL, - path, api-version and subscription-key. It can accept any of the supported *search address* - `URI parameters `_. The string values in the *search address* query must be properly escaped (e.g. " - character should be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription- - key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressResponse`` - `_ - If - the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "query": "one microsoft way redmond wa 98052" - }, - "results": [ - { - "position": { - "lat": 47.63989, - "lon": -122.12509 - } - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "query": "pike pl seattle wa 98101" - }, - "results": [ - { - "position": { - "lat": 47.60963, - "lon": -122.34215 - } - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_id: Batch id for querying the operation. - :type batch_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SearchAddressBatchResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressBatchResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._get_search_address_batch_initial( - batch_id=batch_id, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'format': self._serialize.url("batch_id", batch_id, 'str'), - } - - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_get_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore - - async def reverse_search_address_batch_sync( - self, - batch_request: "models.BatchRequest", - format: Union[str, "models.JsonFormat"] = "json", - **kwargs - ) -> "models.ReverseSearchAddressBatchProcessResult": - """**Search Address Reverse Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Address Reverse API - `_ using just a single - API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api- - version=1.0&subscription-key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search address reverse* queries you will use a ``POST`` request where the request - body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header - will be set to ``application/json``. Here's a sample request body containing 5 *search address - reverse* queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=48.858561,2.294911"}, - {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, - {"query": "?query=47.621028,-122.348170"}, - {"query": "?query=43.722990,10.396695"}, - {"query": "?query=40.750958,-73.982336"} - ] - } - - A *search address reverse* query in a batch is just a partial URL *without* the protocol, base - URL, path, api-version and subscription-key. It can accept any of the supported *search address - reverse* `URI parameters - `_. The - string values in the *search address reverse* query must be properly escaped (e.g. " character - should be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressReverseResponse`` - `_ - - If the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "queryTime": 11 - }, - "addresses": [ - { - "address": { - "country": "France", - "freeformAddress": "Avenue Anatole France, 75007 Paris" - }, - "position": "48.858490,2.294820" - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "queryTime": 1 - }, - "addresses": [ - { - "address": { - "country": "United States of America", - "freeformAddress": "157th Pl NE, Redmond WA 98052" - }, - "position": "47.640470,-122.129430" - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_request: The list of reverse geocoding queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type batch_request: ~azure.maps.search.models.BatchRequest - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReverseSearchAddressBatchProcessResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.ReverseSearchAddressBatchProcessResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ReverseSearchAddressBatchProcessResult"] - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 408: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.reverse_search_address_batch_sync.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(batch_request, 'BatchRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - reverse_search_address_batch_sync.metadata = {'url': '/search/address/reverse/batch/sync/{format}'} # type: ignore - - async def _reverse_search_address_batch_initial( - self, - batch_request: "models.BatchRequest", - format: Union[str, "models.JsonFormat"] = "json", - **kwargs - ) -> Optional["models.ReverseSearchAddressBatchProcessResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ReverseSearchAddressBatchProcessResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._reverse_search_address_batch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(batch_request, 'BatchRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _reverse_search_address_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore - - async def begin_reverse_search_address_batch( - self, - batch_request: "models.BatchRequest", - format: Union[str, "models.JsonFormat"] = "json", - **kwargs - ) -> AsyncLROPoller["models.ReverseSearchAddressBatchProcessResult"]: - """**Search Address Reverse Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Address Reverse API - `_ using just a single - API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api- - version=1.0&subscription-key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search address reverse* queries you will use a ``POST`` request where the request - body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header - will be set to ``application/json``. Here's a sample request body containing 5 *search address - reverse* queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=48.858561,2.294911"}, - {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, - {"query": "?query=47.621028,-122.348170"}, - {"query": "?query=43.722990,10.396695"}, - {"query": "?query=40.750958,-73.982336"} - ] - } - - A *search address reverse* query in a batch is just a partial URL *without* the protocol, base - URL, path, api-version and subscription-key. It can accept any of the supported *search address - reverse* `URI parameters - `_. The - string values in the *search address reverse* query must be properly escaped (e.g. " character - should be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressReverseResponse`` - `_ - - If the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "queryTime": 11 - }, - "addresses": [ - { - "address": { - "country": "France", - "freeformAddress": "Avenue Anatole France, 75007 Paris" - }, - "position": "48.858490,2.294820" - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "queryTime": 1 - }, - "addresses": [ - { - "address": { - "country": "United States of America", - "freeformAddress": "157th Pl NE, Redmond WA 98052" - }, - "position": "47.640470,-122.129430" - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_request: The list of reverse geocoding queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type batch_request: ~azure.maps.search.models.BatchRequest - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReverseSearchAddressBatchProcessResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ReverseSearchAddressBatchProcessResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._reverse_search_address_batch_initial( - batch_request=batch_request, - format=format, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reverse_search_address_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore - - async def _get_reverse_search_address_batch_initial( - self, - batch_id: str, - **kwargs - ) -> Optional["models.ReverseSearchAddressBatchProcessResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ReverseSearchAddressBatchProcessResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self._get_reverse_search_address_batch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("batch_id", batch_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _get_reverse_search_address_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore - - async def begin_get_reverse_search_address_batch( - self, - batch_id: str, - **kwargs - ) -> AsyncLROPoller["models.ReverseSearchAddressBatchProcessResult"]: - """**Search Address Reverse Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Address Reverse API - `_ using just a single - API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api- - version=1.0&subscription-key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search address reverse* queries you will use a ``POST`` request where the request - body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header - will be set to ``application/json``. Here's a sample request body containing 5 *search address - reverse* queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=48.858561,2.294911"}, - {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, - {"query": "?query=47.621028,-122.348170"}, - {"query": "?query=43.722990,10.396695"}, - {"query": "?query=40.750958,-73.982336"} - ] - } - - A *search address reverse* query in a batch is just a partial URL *without* the protocol, base - URL, path, api-version and subscription-key. It can accept any of the supported *search address - reverse* `URI parameters - `_. The - string values in the *search address reverse* query must be properly escaped (e.g. " character - should be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressReverseResponse`` - `_ - - If the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "queryTime": 11 - }, - "addresses": [ - { - "address": { - "country": "France", - "freeformAddress": "Avenue Anatole France, 75007 Paris" - }, - "position": "48.858490,2.294820" - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "queryTime": 1 - }, - "addresses": [ - { - "address": { - "country": "United States of America", - "freeformAddress": "157th Pl NE, Redmond WA 98052" - }, - "position": "47.640470,-122.129430" - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_id: Batch id for querying the operation. - :type batch_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReverseSearchAddressBatchProcessResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ReverseSearchAddressBatchProcessResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._get_reverse_search_address_batch_initial( - batch_id=batch_id, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'format': self._serialize.url("batch_id", batch_id, 'str'), - } - - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_get_reverse_search_address_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/models/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/_generated/models/__init__.py deleted file mode 100644 index 8ea3ff907483a..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/models/__init__.py +++ /dev/null @@ -1,233 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -try: - from ._models_py3 import Address - from ._models_py3 import AddressRanges - from ._models_py3 import BatchRequest - from ._models_py3 import BatchRequestItem - from ._models_py3 import BatchResult - from ._models_py3 import BatchResultItem - from ._models_py3 import BatchResultSummary - from ._models_py3 import BoundingBox - from ._models_py3 import BrandName - from ._models_py3 import Classification - from ._models_py3 import ClassificationName - from ._models_py3 import DataSource - from ._models_py3 import EntryPoint - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import GeoJsonFeature - from ._models_py3 import GeoJsonFeatureCollection - from ._models_py3 import GeoJsonFeatureCollectionData - from ._models_py3 import GeoJsonFeatureData - from ._models_py3 import GeoJsonGeometry - from ._models_py3 import GeoJsonGeometryCollection - from ._models_py3 import GeoJsonGeometryCollectionData - from ._models_py3 import GeoJsonLineString - from ._models_py3 import GeoJsonLineStringData - from ._models_py3 import GeoJsonMultiLineString - from ._models_py3 import GeoJsonMultiLineStringData - from ._models_py3 import GeoJsonMultiPoint - from ._models_py3 import GeoJsonMultiPointData - from ._models_py3 import GeoJsonMultiPolygon - from ._models_py3 import GeoJsonMultiPolygonData - from ._models_py3 import GeoJsonObject - from ._models_py3 import GeoJsonPoint - from ._models_py3 import GeoJsonPointData - from ._models_py3 import GeoJsonPolygon - from ._models_py3 import GeoJsonPolygonData - from ._models_py3 import GeometryIdentifier - from ._models_py3 import LatLongPairAbbreviated - from ._models_py3 import OperatingHours - from ._models_py3 import OperatingHoursTime - from ._models_py3 import OperatingHoursTimeRange - from ._models_py3 import PointOfInterest - from ._models_py3 import PointOfInterestCategory - from ._models_py3 import PointOfInterestCategorySet - from ._models_py3 import PointOfInterestCategoryTreeResult - from ._models_py3 import Polygon - from ._models_py3 import PolygonResult - from ._models_py3 import ReverseSearchAddressBatchItem - from ._models_py3 import ReverseSearchAddressBatchItemResponse - from ._models_py3 import ReverseSearchAddressBatchProcessResult - from ._models_py3 import ReverseSearchAddressResult - from ._models_py3 import ReverseSearchAddressResultItem - from ._models_py3 import ReverseSearchCrossStreetAddressResult - from ._models_py3 import ReverseSearchCrossStreetAddressResultItem - from ._models_py3 import SearchAddressBatchItem - from ._models_py3 import SearchAddressBatchItemResponse - from ._models_py3 import SearchAddressBatchResult - from ._models_py3 import SearchAddressResult - from ._models_py3 import SearchAddressResultItem - from ._models_py3 import SearchAlongRouteRequest - from ._models_py3 import SearchInsideGeometryRequest - from ._models_py3 import SearchSummary - from ._models_py3 import Viewport -except (SyntaxError, ImportError): - from ._models import Address # type: ignore - from ._models import AddressRanges # type: ignore - from ._models import BatchRequest # type: ignore - from ._models import BatchRequestItem # type: ignore - from ._models import BatchResult # type: ignore - from ._models import BatchResultItem # type: ignore - from ._models import BatchResultSummary # type: ignore - from ._models import BoundingBox # type: ignore - from ._models import BrandName # type: ignore - from ._models import Classification # type: ignore - from ._models import ClassificationName # type: ignore - from ._models import DataSource # type: ignore - from ._models import EntryPoint # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import GeoJsonFeature # type: ignore - from ._models import GeoJsonFeatureCollection # type: ignore - from ._models import GeoJsonFeatureCollectionData # type: ignore - from ._models import GeoJsonFeatureData # type: ignore - from ._models import GeoJsonGeometry # type: ignore - from ._models import GeoJsonGeometryCollection # type: ignore - from ._models import GeoJsonGeometryCollectionData # type: ignore - from ._models import GeoJsonLineString # type: ignore - from ._models import GeoJsonLineStringData # type: ignore - from ._models import GeoJsonMultiLineString # type: ignore - from ._models import GeoJsonMultiLineStringData # type: ignore - from ._models import GeoJsonMultiPoint # type: ignore - from ._models import GeoJsonMultiPointData # type: ignore - from ._models import GeoJsonMultiPolygon # type: ignore - from ._models import GeoJsonMultiPolygonData # type: ignore - from ._models import GeoJsonObject # type: ignore - from ._models import GeoJsonPoint # type: ignore - from ._models import GeoJsonPointData # type: ignore - from ._models import GeoJsonPolygon # type: ignore - from ._models import GeoJsonPolygonData # type: ignore - from ._models import GeometryIdentifier # type: ignore - from ._models import LatLongPairAbbreviated # type: ignore - from ._models import OperatingHours # type: ignore - from ._models import OperatingHoursTime # type: ignore - from ._models import OperatingHoursTimeRange # type: ignore - from ._models import PointOfInterest # type: ignore - from ._models import PointOfInterestCategory # type: ignore - from ._models import PointOfInterestCategorySet # type: ignore - from ._models import PointOfInterestCategoryTreeResult # type: ignore - from ._models import Polygon # type: ignore - from ._models import PolygonResult # type: ignore - from ._models import ReverseSearchAddressBatchItem # type: ignore - from ._models import ReverseSearchAddressBatchItemResponse # type: ignore - from ._models import ReverseSearchAddressBatchProcessResult # type: ignore - from ._models import ReverseSearchAddressResult # type: ignore - from ._models import ReverseSearchAddressResultItem # type: ignore - from ._models import ReverseSearchCrossStreetAddressResult # type: ignore - from ._models import ReverseSearchCrossStreetAddressResultItem # type: ignore - from ._models import SearchAddressBatchItem # type: ignore - from ._models import SearchAddressBatchItemResponse # type: ignore - from ._models import SearchAddressBatchResult # type: ignore - from ._models import SearchAddressResult # type: ignore - from ._models import SearchAddressResultItem # type: ignore - from ._models import SearchAlongRouteRequest # type: ignore - from ._models import SearchInsideGeometryRequest # type: ignore - from ._models import SearchSummary # type: ignore - from ._models import Viewport # type: ignore - -from ._search_client_enums import ( - ElectricVehicleConnector, - EntryPointType, - GeoJsonObjectType, - GeographicEntityType, - JsonFormat, - LocalizedMapView, - MatchType, - OperatingHoursRange, - PointOfInterestExtendedPostalCodes, - QueryType, - ResponseFormat, - RoadUseType, - SearchAddressResultType, - SearchIndexes, -) - -__all__ = [ - 'Address', - 'AddressRanges', - 'BatchRequest', - 'BatchRequestItem', - 'BatchResult', - 'BatchResultItem', - 'BatchResultSummary', - 'BoundingBox', - 'BrandName', - 'Classification', - 'ClassificationName', - 'DataSource', - 'EntryPoint', - 'ErrorAdditionalInfo', - 'ErrorDetail', - 'ErrorResponse', - 'GeoJsonFeature', - 'GeoJsonFeatureCollection', - 'GeoJsonFeatureCollectionData', - 'GeoJsonFeatureData', - 'GeoJsonGeometry', - 'GeoJsonGeometryCollection', - 'GeoJsonGeometryCollectionData', - 'GeoJsonLineString', - 'GeoJsonLineStringData', - 'GeoJsonMultiLineString', - 'GeoJsonMultiLineStringData', - 'GeoJsonMultiPoint', - 'GeoJsonMultiPointData', - 'GeoJsonMultiPolygon', - 'GeoJsonMultiPolygonData', - 'GeoJsonObject', - 'GeoJsonPoint', - 'GeoJsonPointData', - 'GeoJsonPolygon', - 'GeoJsonPolygonData', - 'GeometryIdentifier', - 'LatLongPairAbbreviated', - 'OperatingHours', - 'OperatingHoursTime', - 'OperatingHoursTimeRange', - 'PointOfInterest', - 'PointOfInterestCategory', - 'PointOfInterestCategorySet', - 'PointOfInterestCategoryTreeResult', - 'Polygon', - 'PolygonResult', - 'ReverseSearchAddressBatchItem', - 'ReverseSearchAddressBatchItemResponse', - 'ReverseSearchAddressBatchProcessResult', - 'ReverseSearchAddressResult', - 'ReverseSearchAddressResultItem', - 'ReverseSearchCrossStreetAddressResult', - 'ReverseSearchCrossStreetAddressResultItem', - 'SearchAddressBatchItem', - 'SearchAddressBatchItemResponse', - 'SearchAddressBatchResult', - 'SearchAddressResult', - 'SearchAddressResultItem', - 'SearchAlongRouteRequest', - 'SearchInsideGeometryRequest', - 'SearchSummary', - 'Viewport', - 'ElectricVehicleConnector', - 'EntryPointType', - 'GeoJsonObjectType', - 'GeographicEntityType', - 'JsonFormat', - 'LocalizedMapView', - 'MatchType', - 'OperatingHoursRange', - 'PointOfInterestExtendedPostalCodes', - 'QueryType', - 'ResponseFormat', - 'RoadUseType', - 'SearchAddressResultType', - 'SearchIndexes', -] diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/models/_models.py b/sdk/maps/azure-maps-search/azure/maps/search/_generated/models/_models.py deleted file mode 100644 index 4c51386a4b2c8..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/models/_models.py +++ /dev/null @@ -1,2143 +0,0 @@ -# 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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Address(msrest.serialization.Model): - """The address of the result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar building_number: The building number on the street. DEPRECATED, use streetNumber instead. - :vartype building_number: str - :ivar street: The street name. DEPRECATED, use streetName instead. - :vartype street: str - :ivar cross_street: The name of the street being crossed. - :vartype cross_street: str - :ivar street_number: The building number on the street. - :vartype street_number: str - :ivar route_numbers: The codes used to unambiguously identify the street. - :vartype route_numbers: list[int] - :ivar street_name: The street name. - :vartype street_name: str - :ivar street_name_and_number: The street name and number. - :vartype street_name_and_number: str - :ivar municipality: City / Town. - :vartype municipality: str - :ivar municipality_subdivision: Sub / Super City. - :vartype municipality_subdivision: str - :ivar country_tertiary_subdivision: Named Area. - :vartype country_tertiary_subdivision: str - :ivar country_secondary_subdivision: County. - :vartype country_secondary_subdivision: str - :ivar country_subdivision: State or Province. - :vartype country_subdivision: str - :ivar postal_code: Postal Code / Zip Code. - :vartype postal_code: str - :ivar extended_postal_code: Extended postal code (availability is dependent on the region). - :vartype extended_postal_code: str - :ivar country_code: Country (Note: This is a two-letter code, not a country name.). - :vartype country_code: str - :ivar country: Country name. - :vartype country: str - :ivar country_code_iso3: ISO alpha-3 country code. - :vartype country_code_iso3: str - :ivar freeform_address: An address line formatted according to the formatting rules of a - Result's country of origin, or in the case of a country, its full country name. - :vartype freeform_address: str - :ivar country_subdivision_name: The full name of a first level of country administrative - hierarchy. This field appears only in case countrySubdivision is presented in an abbreviated - form. Only supported for USA, Canada, and Great Britain. - :vartype country_subdivision_name: str - :ivar local_name: An address component which represents the name of a geographic area or - locality that groups a number of addressable objects for addressing purposes, without being an - administrative unit. This field is used to build the ``freeformAddress`` property. - :vartype local_name: str - :ivar bounding_box: Bounding box coordinates. - :vartype bounding_box: object - """ - - _validation = { - 'building_number': {'readonly': True}, - 'street': {'readonly': True}, - 'cross_street': {'readonly': True}, - 'street_number': {'readonly': True}, - 'route_numbers': {'readonly': True}, - 'street_name': {'readonly': True}, - 'street_name_and_number': {'readonly': True}, - 'municipality': {'readonly': True}, - 'municipality_subdivision': {'readonly': True}, - 'country_tertiary_subdivision': {'readonly': True}, - 'country_secondary_subdivision': {'readonly': True}, - 'country_subdivision': {'readonly': True}, - 'postal_code': {'readonly': True}, - 'extended_postal_code': {'readonly': True}, - 'country_code': {'readonly': True}, - 'country': {'readonly': True}, - 'country_code_iso3': {'readonly': True}, - 'freeform_address': {'readonly': True}, - 'country_subdivision_name': {'readonly': True}, - 'local_name': {'readonly': True}, - 'bounding_box': {'readonly': True}, - } - - _attribute_map = { - 'building_number': {'key': 'buildingNumber', 'type': 'str'}, - 'street': {'key': 'street', 'type': 'str'}, - 'cross_street': {'key': 'crossStreet', 'type': 'str'}, - 'street_number': {'key': 'streetNumber', 'type': 'str'}, - 'route_numbers': {'key': 'routeNumbers', 'type': '[int]'}, - 'street_name': {'key': 'streetName', 'type': 'str'}, - 'street_name_and_number': {'key': 'streetNameAndNumber', 'type': 'str'}, - 'municipality': {'key': 'municipality', 'type': 'str'}, - 'municipality_subdivision': {'key': 'municipalitySubdivision', 'type': 'str'}, - 'country_tertiary_subdivision': {'key': 'countryTertiarySubdivision', 'type': 'str'}, - 'country_secondary_subdivision': {'key': 'countrySecondarySubdivision', 'type': 'str'}, - 'country_subdivision': {'key': 'countrySubdivision', 'type': 'str'}, - 'postal_code': {'key': 'postalCode', 'type': 'str'}, - 'extended_postal_code': {'key': 'extendedPostalCode', 'type': 'str'}, - 'country_code': {'key': 'countryCode', 'type': 'str'}, - 'country': {'key': 'country', 'type': 'str'}, - 'country_code_iso3': {'key': 'countryCodeISO3', 'type': 'str'}, - 'freeform_address': {'key': 'freeformAddress', 'type': 'str'}, - 'country_subdivision_name': {'key': 'countrySubdivisionName', 'type': 'str'}, - 'local_name': {'key': 'localName', 'type': 'str'}, - 'bounding_box': {'key': 'boundingBox', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(Address, self).__init__(**kwargs) - self.building_number = None - self.street = None - self.cross_street = None - self.street_number = None - self.route_numbers = None - self.street_name = None - self.street_name_and_number = None - self.municipality = None - self.municipality_subdivision = None - self.country_tertiary_subdivision = None - self.country_secondary_subdivision = None - self.country_subdivision = None - self.postal_code = None - self.extended_postal_code = None - self.country_code = None - self.country = None - self.country_code_iso3 = None - self.freeform_address = None - self.country_subdivision_name = None - self.local_name = None - self.bounding_box = None - - -class AddressRanges(msrest.serialization.Model): - """Describes the address range on both sides of the street for a search result. Coordinates for the start and end locations of the address range are included. - - :param range_left: Address range on the left side of the street. - :type range_left: str - :param range_right: Address range on the right side of the street. - :type range_right: str - :param from_property: A location represented as a latitude and longitude using short names - 'lat' & 'lon'. - :type from_property: ~azure.maps.search.models.LatLongPairAbbreviated - :param to: A location represented as a latitude and longitude using short names 'lat' & 'lon'. - :type to: ~azure.maps.search.models.LatLongPairAbbreviated - """ - - _attribute_map = { - 'range_left': {'key': 'rangeLeft', 'type': 'str'}, - 'range_right': {'key': 'rangeRight', 'type': 'str'}, - 'from_property': {'key': 'from', 'type': 'LatLongPairAbbreviated'}, - 'to': {'key': 'to', 'type': 'LatLongPairAbbreviated'}, - } - - def __init__( - self, - **kwargs - ): - super(AddressRanges, self).__init__(**kwargs) - self.range_left = kwargs.get('range_left', None) - self.range_right = kwargs.get('range_right', None) - self.from_property = kwargs.get('from_property', None) - self.to = kwargs.get('to', None) - - -class BatchRequest(msrest.serialization.Model): - """This type represents the request body for the Batch service. - - :param batch_items: The list of queries to process. - :type batch_items: list[~azure.maps.search.models.BatchRequestItem] - """ - - _attribute_map = { - 'batch_items': {'key': 'batchItems', 'type': '[BatchRequestItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchRequest, self).__init__(**kwargs) - self.batch_items = kwargs.get('batch_items', None) - - -class BatchRequestItem(msrest.serialization.Model): - """Batch request object. - - :param query: This parameter contains a query string used to perform an unstructured geocoding - operation. The query string will be passed verbatim to the search API for processing. - :type query: str - """ - - _attribute_map = { - 'query': {'key': 'query', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchRequestItem, self).__init__(**kwargs) - self.query = kwargs.get('query', None) - - -class BatchResult(msrest.serialization.Model): - """This object is returned from a successful Batch service call. Extend with 'batchItems' property. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar batch_summary: Summary of the results for the batch request. - :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary - """ - - _validation = { - 'batch_summary': {'readonly': True}, - } - - _attribute_map = { - 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchResult, self).__init__(**kwargs) - self.batch_summary = None - - -class BatchResultItem(msrest.serialization.Model): - """An item returned from Batch API. Extend with 'response' property. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status_code: HTTP request status code. - :vartype status_code: int - """ - - _validation = { - 'status_code': {'readonly': True}, - } - - _attribute_map = { - 'status_code': {'key': 'statusCode', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchResultItem, self).__init__(**kwargs) - self.status_code = None - - -class BatchResultSummary(msrest.serialization.Model): - """Summary of the results for the batch request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar successful_requests: Number of successful requests in the batch. - :vartype successful_requests: int - :ivar total_requests: Total number of requests in the batch. - :vartype total_requests: int - """ - - _validation = { - 'successful_requests': {'readonly': True}, - 'total_requests': {'readonly': True}, - } - - _attribute_map = { - 'successful_requests': {'key': 'successfulRequests', 'type': 'int'}, - 'total_requests': {'key': 'totalRequests', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchResultSummary, self).__init__(**kwargs) - self.successful_requests = None - self.total_requests = None - - -class BoundingBox(msrest.serialization.Model): - """The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. - - :param top_left: A location represented as a latitude and longitude using short names 'lat' & - 'lon'. - :type top_left: ~azure.maps.search.models.LatLongPairAbbreviated - :param bottom_right: A location represented as a latitude and longitude using short names 'lat' - & 'lon'. - :type bottom_right: ~azure.maps.search.models.LatLongPairAbbreviated - """ - - _attribute_map = { - 'top_left': {'key': 'topLeftPoint', 'type': 'LatLongPairAbbreviated'}, - 'bottom_right': {'key': 'btmRightPoint', 'type': 'LatLongPairAbbreviated'}, - } - - def __init__( - self, - **kwargs - ): - super(BoundingBox, self).__init__(**kwargs) - self.top_left = kwargs.get('top_left', None) - self.bottom_right = kwargs.get('bottom_right', None) - - -class BrandName(msrest.serialization.Model): - """The name of the brand for the POI being returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the brand. - :vartype name: str - """ - - _validation = { - 'name': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BrandName, self).__init__(**kwargs) - self.name = None - - -class Classification(msrest.serialization.Model): - """The classification for the POI being returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Code property. - :vartype code: str - :ivar names: Names array. - :vartype names: list[~azure.maps.search.models.ClassificationName] - """ - - _validation = { - 'code': {'readonly': True}, - 'names': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'names': {'key': 'names', 'type': '[ClassificationName]'}, - } - - def __init__( - self, - **kwargs - ): - super(Classification, self).__init__(**kwargs) - self.code = None - self.names = None - - -class ClassificationName(msrest.serialization.Model): - """Name for the classification. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_locale: Name Locale property. - :vartype name_locale: str - :ivar name: Name property. - :vartype name: str - """ - - _validation = { - 'name_locale': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'name_locale': {'key': 'nameLocale', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClassificationName, self).__init__(**kwargs) - self.name_locale = None - self.name = None - - -class DataSource(msrest.serialization.Model): - """Optional section. Reference ids for use with the `Get Search Polygon `_ API. - - :param geometry: Information about the geometric shape of the result. Only present if type == - Geography. - :type geometry: ~azure.maps.search.models.GeometryIdentifier - """ - - _attribute_map = { - 'geometry': {'key': 'geometry', 'type': 'GeometryIdentifier'}, - } - - def __init__( - self, - **kwargs - ): - super(DataSource, self).__init__(**kwargs) - self.geometry = kwargs.get('geometry', None) - - -class EntryPoint(msrest.serialization.Model): - """The entry point for the POI being returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of entry point. Value can be either *main* or *minor*. Possible values - include: "main", "minor". - :vartype type: str or ~azure.maps.search.models.EntryPointType - :param position: A location represented as a latitude and longitude using short names 'lat' & - 'lon'. - :type position: ~azure.maps.search.models.LatLongPairAbbreviated - """ - - _validation = { - 'type': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'position': {'key': 'position', 'type': 'LatLongPairAbbreviated'}, - } - - def __init__( - self, - **kwargs - ): - super(EntryPoint, self).__init__(**kwargs) - self.type = None - self.position = kwargs.get('position', None) - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: object - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.maps.search.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.maps.search.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~azure.maps.search.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class GeoJsonFeatureData(msrest.serialization.Model): - """GeoJsonFeatureData. - - All required parameters must be populated in order to send to Azure. - - :param geometry: Required. A valid ``GeoJSON`` object. Please refer to `RFC 7946 - `_ for details. - :type geometry: ~azure.maps.search.models.GeoJsonObject - :param properties: Properties can contain any additional metadata about the ``Feature``. Value - can be any JSON object or a JSON null value. - :type properties: object - :param id: Identifier for the feature. - :type id: str - :param feature_type: The type of the feature. The value depends on the data model the current - feature is part of. Some data models may have an empty value. - :type feature_type: str - """ - - _validation = { - 'geometry': {'required': True}, - } - - _attribute_map = { - 'geometry': {'key': 'geometry', 'type': 'GeoJsonObject'}, - 'properties': {'key': 'properties', 'type': 'object'}, - 'id': {'key': 'id', 'type': 'str'}, - 'feature_type': {'key': 'featureType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonFeatureData, self).__init__(**kwargs) - self.geometry = kwargs['geometry'] - self.properties = kwargs.get('properties', None) - self.id = kwargs.get('id', None) - self.feature_type = kwargs.get('feature_type', None) - - -class GeoJsonObject(msrest.serialization.Model): - """A valid ``GeoJSON`` object. Please refer to `RFC 7946 `_ for details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: GeoJsonFeature, GeoJsonFeatureCollection, GeoJsonGeometry, GeoJsonGeometryCollection, GeoJsonLineString, GeoJsonMultiLineString, GeoJsonMultiPoint, GeoJsonMultiPolygon, GeoJsonPoint, GeoJsonPolygon. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Feature': 'GeoJsonFeature', 'FeatureCollection': 'GeoJsonFeatureCollection', 'GeoJsonGeometry': 'GeoJsonGeometry', 'GeometryCollection': 'GeoJsonGeometryCollection', 'LineString': 'GeoJsonLineString', 'MultiLineString': 'GeoJsonMultiLineString', 'MultiPoint': 'GeoJsonMultiPoint', 'MultiPolygon': 'GeoJsonMultiPolygon', 'Point': 'GeoJsonPoint', 'Polygon': 'GeoJsonPolygon'} - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonObject, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class GeoJsonFeature(GeoJsonObject, GeoJsonFeatureData): - """A valid ``GeoJSON Feature`` object type. Please refer to `RFC 7946 `_ for details. - - All required parameters must be populated in order to send to Azure. - - :param geometry: Required. A valid ``GeoJSON`` object. Please refer to `RFC 7946 - `_ for details. - :type geometry: ~azure.maps.search.models.GeoJsonObject - :param properties: Properties can contain any additional metadata about the ``Feature``. Value - can be any JSON object or a JSON null value. - :type properties: object - :param id: Identifier for the feature. - :type id: str - :param feature_type: The type of the feature. The value depends on the data model the current - feature is part of. Some data models may have an empty value. - :type feature_type: str - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'geometry': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'geometry': {'key': 'geometry', 'type': 'GeoJsonObject'}, - 'properties': {'key': 'properties', 'type': 'object'}, - 'id': {'key': 'id', 'type': 'str'}, - 'feature_type': {'key': 'featureType', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonFeature, self).__init__(**kwargs) - self.geometry = kwargs['geometry'] - self.properties = kwargs.get('properties', None) - self.id = kwargs.get('id', None) - self.feature_type = kwargs.get('feature_type', None) - self.type = 'Feature' # type: str - self.type = 'Feature' # type: str - - -class GeoJsonFeatureCollectionData(msrest.serialization.Model): - """GeoJsonFeatureCollectionData. - - All required parameters must be populated in order to send to Azure. - - :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. - :type features: list[~azure.maps.search.models.GeoJsonFeature] - """ - - _validation = { - 'features': {'required': True}, - } - - _attribute_map = { - 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonFeatureCollectionData, self).__init__(**kwargs) - self.features = kwargs['features'] - - -class GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): - """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. - - All required parameters must be populated in order to send to Azure. - - :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. - :type features: list[~azure.maps.search.models.GeoJsonFeature] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'features': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonFeatureCollection, self).__init__(**kwargs) - self.features = kwargs['features'] - self.type = 'FeatureCollection' # type: str - self.type = 'FeatureCollection' # type: str - - -class GeoJsonGeometry(GeoJsonObject): - """A valid ``GeoJSON`` geometry object. The type must be one of the seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. Please refer to `RFC 7946 `_ for details. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonGeometry, self).__init__(**kwargs) - self.type = 'GeoJsonGeometry' # type: str - - -class GeoJsonGeometryCollectionData(msrest.serialization.Model): - """GeoJsonGeometryCollectionData. - - All required parameters must be populated in order to send to Azure. - - :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** - that coordinates in GeoJSON are in x, y order (longitude, latitude). - :type geometries: list[~azure.maps.search.models.GeoJsonObject] - """ - - _validation = { - 'geometries': {'required': True}, - } - - _attribute_map = { - 'geometries': {'key': 'geometries', 'type': '[GeoJsonObject]'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonGeometryCollectionData, self).__init__(**kwargs) - self.geometries = kwargs['geometries'] - - -class GeoJsonGeometryCollection(GeoJsonObject, GeoJsonGeometryCollectionData): - """A valid ``GeoJSON GeometryCollection`` object type. Please refer to `RFC 7946 `_ for details. - - All required parameters must be populated in order to send to Azure. - - :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** - that coordinates in GeoJSON are in x, y order (longitude, latitude). - :type geometries: list[~azure.maps.search.models.GeoJsonObject] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'geometries': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'geometries': {'key': 'geometries', 'type': '[GeoJsonObject]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonGeometryCollection, self).__init__(**kwargs) - self.geometries = kwargs['geometries'] - self.type = 'GeometryCollection' # type: str - self.type = 'GeometryCollection' # type: str - - -class GeoJsonLineStringData(msrest.serialization.Model): - """GeoJsonLineStringData. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. - :type coordinates: list[list[float]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonLineStringData, self).__init__(**kwargs) - self.coordinates = kwargs['coordinates'] - - -class GeoJsonLineString(GeoJsonObject, GeoJsonLineStringData): - """A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 `_ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. - :type coordinates: list[list[float]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonLineString, self).__init__(**kwargs) - self.coordinates = kwargs['coordinates'] - self.type = 'LineString' # type: str - self.type = 'LineString' # type: str - - -class GeoJsonMultiLineStringData(msrest.serialization.Model): - """GeoJsonMultiLineStringData. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. - :type coordinates: list[list[list[float]]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonMultiLineStringData, self).__init__(**kwargs) - self.coordinates = kwargs['coordinates'] - - -class GeoJsonMultiLineString(GeoJsonObject, GeoJsonMultiLineStringData): - """A valid ``GeoJSON MultiLineString`` geometry type. Please refer to `RFC 7946 `_ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. - :type coordinates: list[list[list[float]]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonMultiLineString, self).__init__(**kwargs) - self.coordinates = kwargs['coordinates'] - self.type = 'MultiLineString' # type: str - self.type = 'MultiLineString' # type: str - - -class GeoJsonMultiPointData(msrest.serialization.Model): - """Data contained by a ``GeoJson MultiPoint``. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. - :type coordinates: list[list[float]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonMultiPointData, self).__init__(**kwargs) - self.coordinates = kwargs['coordinates'] - - -class GeoJsonMultiPoint(GeoJsonObject, GeoJsonMultiPointData): - """A valid ``GeoJSON MultiPoint`` geometry type. Please refer to `RFC 7946 `_ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. - :type coordinates: list[list[float]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonMultiPoint, self).__init__(**kwargs) - self.coordinates = kwargs['coordinates'] - self.type = 'MultiPoint' # type: str - self.type = 'MultiPoint' # type: str - - -class GeoJsonMultiPolygonData(msrest.serialization.Model): - """GeoJsonMultiPolygonData. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** - that coordinates in GeoJSON are in x, y order (longitude, latitude). - :type coordinates: list[list[list[list[float]]]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonMultiPolygonData, self).__init__(**kwargs) - self.coordinates = kwargs['coordinates'] - - -class GeoJsonMultiPolygon(GeoJsonObject, GeoJsonMultiPolygonData): - """A valid ``GeoJSON MultiPolygon`` object type. Please refer to `RFC 7946 `_ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** - that coordinates in GeoJSON are in x, y order (longitude, latitude). - :type coordinates: list[list[list[list[float]]]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonMultiPolygon, self).__init__(**kwargs) - self.coordinates = kwargs['coordinates'] - self.type = 'MultiPolygon' # type: str - self.type = 'MultiPolygon' # type: str - - -class GeoJsonPointData(msrest.serialization.Model): - """Data contained by a ``GeoJson Point``. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. - The first two elements are *longitude* and *latitude*\ , precisely in that order. - *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 - `_ for details. - :type coordinates: list[float] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[float]'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonPointData, self).__init__(**kwargs) - self.coordinates = kwargs['coordinates'] - - -class GeoJsonPoint(GeoJsonObject, GeoJsonPointData): - """A valid ``GeoJSON Point`` geometry type. Please refer to `RFC 7946 `_ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. - The first two elements are *longitude* and *latitude*\ , precisely in that order. - *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 - `_ for details. - :type coordinates: list[float] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[float]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonPoint, self).__init__(**kwargs) - self.coordinates = kwargs['coordinates'] - self.type = 'Point' # type: str - self.type = 'Point' # type: str - - -class GeoJsonPolygonData(msrest.serialization.Model): - """GeoJsonPolygonData. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. - :type coordinates: list[list[list[float]]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonPolygonData, self).__init__(**kwargs) - self.coordinates = kwargs['coordinates'] - - -class GeoJsonPolygon(GeoJsonObject, GeoJsonPolygonData): - """A valid ``GeoJSON Polygon`` geometry type. Please refer to `RFC 7946 `_ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. - :type coordinates: list[list[list[float]]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonPolygon, self).__init__(**kwargs) - self.coordinates = kwargs['coordinates'] - self.type = 'Polygon' # type: str - self.type = 'Polygon' # type: str - - -class GeometryIdentifier(msrest.serialization.Model): - """Information about the geometric shape of the result. Only present if type == Geography. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Pass this as geometryId to the `Get Search Polygon - `_ API to fetch geometry - information for this result. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeometryIdentifier, self).__init__(**kwargs) - self.id = None - - -class LatLongPairAbbreviated(msrest.serialization.Model): - """A location represented as a latitude and longitude using short names 'lat' & 'lon'. - - :param lat: Latitude property. - :type lat: float - :param lon: Longitude property. - :type lon: float - """ - - _attribute_map = { - 'lat': {'key': 'lat', 'type': 'float'}, - 'lon': {'key': 'lon', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(LatLongPairAbbreviated, self).__init__(**kwargs) - self.lat = kwargs.get('lat', None) - self.lon = kwargs.get('lon', None) - - -class OperatingHours(msrest.serialization.Model): - """Opening hours for a POI (Points of Interest). - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar mode: Value used in the request: none or "nextSevenDays". - :vartype mode: str - :ivar time_ranges: List of time ranges for the next 7 days. - :vartype time_ranges: list[~azure.maps.search.models.OperatingHoursTimeRange] - """ - - _validation = { - 'mode': {'readonly': True}, - 'time_ranges': {'readonly': True}, - } - - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'time_ranges': {'key': 'timeRanges', 'type': '[OperatingHoursTimeRange]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperatingHours, self).__init__(**kwargs) - self.mode = None - self.time_ranges = None - - -class OperatingHoursTime(msrest.serialization.Model): - """Represents a date and time. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar date: Represents current calendar date in POI time zone, e.g. "2019-02-07". - :vartype date: str - :ivar hour: Hours are in the 24 hour format in the local time of a POI; possible values are 0 - - 23. - :vartype hour: int - :ivar minute: Minutes are in the local time of a POI; possible values are 0 - 59. - :vartype minute: int - """ - - _validation = { - 'date': {'readonly': True}, - 'hour': {'readonly': True}, - 'minute': {'readonly': True}, - } - - _attribute_map = { - 'date': {'key': 'date', 'type': 'str'}, - 'hour': {'key': 'hour', 'type': 'int'}, - 'minute': {'key': 'minute', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(OperatingHoursTime, self).__init__(**kwargs) - self.date = None - self.hour = None - self.minute = None - - -class OperatingHoursTimeRange(msrest.serialization.Model): - """Open time range for a day. - - :param start_time: The point in the next 7 days range when a given POI is being opened, or the - beginning of the range if it was opened before the range. - :type start_time: ~azure.maps.search.models.OperatingHoursTime - :param end_time: The point in the next 7 days range when a given POI is being closed, or the - beginning of the range if it was closed before the range. - :type end_time: ~azure.maps.search.models.OperatingHoursTime - """ - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'OperatingHoursTime'}, - 'end_time': {'key': 'endTime', 'type': 'OperatingHoursTime'}, - } - - def __init__( - self, - **kwargs - ): - super(OperatingHoursTimeRange, self).__init__(**kwargs) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - - -class PointOfInterest(msrest.serialization.Model): - """Details of the returned POI including information such as the name, phone, url address, and classifications. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the POI property. - :vartype name: str - :ivar phone: Telephone number property. - :vartype phone: str - :ivar url: Website URL property. - :vartype url: str - :ivar category_set: The list of the most specific POI categories. - :vartype category_set: list[~azure.maps.search.models.PointOfInterestCategorySet] - :ivar classifications: Classification array. - :vartype classifications: list[~azure.maps.search.models.Classification] - :ivar brands: Brands array. The name of the brand for the POI being returned. - :vartype brands: list[~azure.maps.search.models.BrandName] - :param operating_hours: Opening hours for a POI (Points of Interest). - :type operating_hours: ~azure.maps.search.models.OperatingHours - """ - - _validation = { - 'name': {'readonly': True}, - 'phone': {'readonly': True}, - 'url': {'readonly': True}, - 'category_set': {'readonly': True}, - 'classifications': {'readonly': True}, - 'brands': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - 'category_set': {'key': 'categorySet', 'type': '[PointOfInterestCategorySet]'}, - 'classifications': {'key': 'classifications', 'type': '[Classification]'}, - 'brands': {'key': 'brands', 'type': '[BrandName]'}, - 'operating_hours': {'key': 'openingHours', 'type': 'OperatingHours'}, - } - - def __init__( - self, - **kwargs - ): - super(PointOfInterest, self).__init__(**kwargs) - self.name = None - self.phone = None - self.url = None - self.category_set = None - self.classifications = None - self.brands = None - self.operating_hours = kwargs.get('operating_hours', None) - - -class PointOfInterestCategory(msrest.serialization.Model): - """POI category result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Unique ID for the category. ID can be used to restrict search results to specific - categories through other Search Service APIs, like `Get Search POI - `_. - :vartype id: int - :ivar name: Name of the category. - :vartype name: str - :ivar child_ids: Array of child category ids. - :vartype child_ids: list[int] - :ivar synonyms: Array of alternative names of the category. - :vartype synonyms: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'child_ids': {'readonly': True}, - 'synonyms': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'str'}, - 'child_ids': {'key': 'childCategoryIds', 'type': '[int]'}, - 'synonyms': {'key': 'synonyms', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PointOfInterestCategory, self).__init__(**kwargs) - self.id = None - self.name = None - self.child_ids = None - self.synonyms = None - - -class PointOfInterestCategorySet(msrest.serialization.Model): - """POI category. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Category ID. - :vartype id: int - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(PointOfInterestCategorySet, self).__init__(**kwargs) - self.id = None - - -class PointOfInterestCategoryTreeResult(msrest.serialization.Model): - """This object is returned from a successful POI Category Tree call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar categories: Categories array. - :vartype categories: list[~azure.maps.search.models.PointOfInterestCategory] - """ - - _validation = { - 'categories': {'readonly': True}, - } - - _attribute_map = { - 'categories': {'key': 'poiCategories', 'type': '[PointOfInterestCategory]'}, - } - - def __init__( - self, - **kwargs - ): - super(PointOfInterestCategoryTreeResult, self).__init__(**kwargs) - self.categories = None - - -class Polygon(msrest.serialization.Model): - """Polygon. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider_id: ID of the returned entity. - :vartype provider_id: str - :param geometry_data: Geometry data in GeoJSON format. Please refer to `RFC 7946 - `_ for details. Present only if "error" is not present. - :type geometry_data: ~azure.maps.search.models.GeoJsonObject - """ - - _validation = { - 'provider_id': {'readonly': True}, - } - - _attribute_map = { - 'provider_id': {'key': 'providerID', 'type': 'str'}, - 'geometry_data': {'key': 'geometryData', 'type': 'GeoJsonObject'}, - } - - def __init__( - self, - **kwargs - ): - super(Polygon, self).__init__(**kwargs) - self.provider_id = None - self.geometry_data = kwargs.get('geometry_data', None) - - -class PolygonResult(msrest.serialization.Model): - """This object is returned from a successful Search Polygon call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar polygons: Results array. - :vartype polygons: list[~azure.maps.search.models.Polygon] - """ - - _validation = { - 'polygons': {'readonly': True}, - } - - _attribute_map = { - 'polygons': {'key': 'additionalData', 'type': '[Polygon]'}, - } - - def __init__( - self, - **kwargs - ): - super(PolygonResult, self).__init__(**kwargs) - self.polygons = None - - -class ReverseSearchAddressBatchItem(BatchResultItem): - """An item returned from Search Address Reverse Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status_code: HTTP request status code. - :vartype status_code: int - :ivar response: The result of the query. SearchAddressReverseResponse if the query completed - successfully, ErrorResponse otherwise. - :vartype response: ~azure.maps.search.models.ReverseSearchAddressBatchItemResponse - """ - - _validation = { - 'status_code': {'readonly': True}, - 'response': {'readonly': True}, - } - - _attribute_map = { - 'status_code': {'key': 'statusCode', 'type': 'int'}, - 'response': {'key': 'response', 'type': 'ReverseSearchAddressBatchItemResponse'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchAddressBatchItem, self).__init__(**kwargs) - self.response = None - - -class ReverseSearchAddressResult(msrest.serialization.Model): - """This object is returned from a successful Search Address Reverse call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar summary: Summary object for a Search Address Reverse response. - :vartype summary: ~azure.maps.search.models.SearchSummary - :ivar addresses: Addresses array. - :vartype addresses: list[~azure.maps.search.models.ReverseSearchAddressResultItem] - """ - - _validation = { - 'summary': {'readonly': True}, - 'addresses': {'readonly': True}, - } - - _attribute_map = { - 'summary': {'key': 'summary', 'type': 'SearchSummary'}, - 'addresses': {'key': 'addresses', 'type': '[ReverseSearchAddressResultItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchAddressResult, self).__init__(**kwargs) - self.summary = None - self.addresses = None - - -class ReverseSearchAddressBatchItemResponse(ErrorResponse, ReverseSearchAddressResult): - """The result of the query. SearchAddressReverseResponse if the query completed successfully, ErrorResponse otherwise. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar summary: Summary object for a Search Address Reverse response. - :vartype summary: ~azure.maps.search.models.SearchSummary - :ivar addresses: Addresses array. - :vartype addresses: list[~azure.maps.search.models.ReverseSearchAddressResultItem] - :param error: The error object. - :type error: ~azure.maps.search.models.ErrorDetail - """ - - _validation = { - 'summary': {'readonly': True}, - 'addresses': {'readonly': True}, - } - - _attribute_map = { - 'summary': {'key': 'summary', 'type': 'SearchSummary'}, - 'addresses': {'key': 'addresses', 'type': '[ReverseSearchAddressResultItem]'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchAddressBatchItemResponse, self).__init__(**kwargs) - self.summary = None - self.addresses = None - self.error = kwargs.get('error', None) - - -class ReverseSearchAddressBatchProcessResult(BatchResult): - """This object is returned from a successful Search Address Reverse Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar batch_summary: Summary of the results for the batch request. - :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary - :ivar batch_items: Array containing the batch results. - :vartype batch_items: list[~azure.maps.search.models.ReverseSearchAddressBatchItem] - """ - - _validation = { - 'batch_summary': {'readonly': True}, - 'batch_items': {'readonly': True}, - } - - _attribute_map = { - 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, - 'batch_items': {'key': 'batchItems', 'type': '[ReverseSearchAddressBatchItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchAddressBatchProcessResult, self).__init__(**kwargs) - self.batch_items = None - - -class ReverseSearchAddressResultItem(msrest.serialization.Model): - """Result object for a Search Address Reverse response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar address: The address of the result. - :vartype address: ~azure.maps.search.models.Address - :ivar position: Position property in the form of "{latitude},{longitude}". - :vartype position: str - :ivar road_use: - :vartype road_use: list[str or ~azure.maps.search.models.RoadUseType] - :ivar match_type: Information on the type of match. - - One of: - - - * AddressPoint - * HouseNumberRange - * Street. Possible values include: "AddressPoint", "HouseNumberRange", "Street". - :vartype match_type: str or ~azure.maps.search.models.MatchType - """ - - _validation = { - 'address': {'readonly': True}, - 'position': {'readonly': True}, - 'road_use': {'readonly': True}, - 'match_type': {'readonly': True}, - } - - _attribute_map = { - 'address': {'key': 'address', 'type': 'Address'}, - 'position': {'key': 'position', 'type': 'str'}, - 'road_use': {'key': 'roadUse', 'type': '[str]'}, - 'match_type': {'key': 'matchType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchAddressResultItem, self).__init__(**kwargs) - self.address = None - self.position = None - self.road_use = None - self.match_type = None - - -class ReverseSearchCrossStreetAddressResult(msrest.serialization.Model): - """This object is returned from a successful Search Address Reverse CrossStreet call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar summary: Summary object for a Search Address Reverse Cross Street response. - :vartype summary: ~azure.maps.search.models.SearchSummary - :ivar addresses: Addresses array. - :vartype addresses: list[~azure.maps.search.models.ReverseSearchCrossStreetAddressResultItem] - """ - - _validation = { - 'summary': {'readonly': True}, - 'addresses': {'readonly': True}, - } - - _attribute_map = { - 'summary': {'key': 'summary', 'type': 'SearchSummary'}, - 'addresses': {'key': 'addresses', 'type': '[ReverseSearchCrossStreetAddressResultItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchCrossStreetAddressResult, self).__init__(**kwargs) - self.summary = None - self.addresses = None - - -class ReverseSearchCrossStreetAddressResultItem(msrest.serialization.Model): - """Result object for a Search Address Reverse Cross Street response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar address: The address of the result. - :vartype address: ~azure.maps.search.models.Address - :ivar position: Position property in the form of "{latitude},{longitude}". - :vartype position: str - """ - - _validation = { - 'address': {'readonly': True}, - 'position': {'readonly': True}, - } - - _attribute_map = { - 'address': {'key': 'address', 'type': 'Address'}, - 'position': {'key': 'position', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchCrossStreetAddressResultItem, self).__init__(**kwargs) - self.address = None - self.position = None - - -class SearchAddressBatchItem(BatchResultItem): - """An item returned from Search Address Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status_code: HTTP request status code. - :vartype status_code: int - :ivar response: The result of the query. SearchAddressResponse if the query completed - successfully, ErrorResponse otherwise. - :vartype response: ~azure.maps.search.models.SearchAddressBatchItemResponse - """ - - _validation = { - 'status_code': {'readonly': True}, - 'response': {'readonly': True}, - } - - _attribute_map = { - 'status_code': {'key': 'statusCode', 'type': 'int'}, - 'response': {'key': 'response', 'type': 'SearchAddressBatchItemResponse'}, - } - - def __init__( - self, - **kwargs - ): - super(SearchAddressBatchItem, self).__init__(**kwargs) - self.response = None - - -class SearchAddressResult(msrest.serialization.Model): - """This object is returned from a successful Search calls. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar summary: Summary object for a Search API response. - :vartype summary: ~azure.maps.search.models.SearchSummary - :ivar results: A list of Search API results. - :vartype results: list[~azure.maps.search.models.SearchAddressResultItem] - """ - - _validation = { - 'summary': {'readonly': True}, - 'results': {'readonly': True}, - } - - _attribute_map = { - 'summary': {'key': 'summary', 'type': 'SearchSummary'}, - 'results': {'key': 'results', 'type': '[SearchAddressResultItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(SearchAddressResult, self).__init__(**kwargs) - self.summary = None - self.results = None - - -class SearchAddressBatchItemResponse(ErrorResponse, SearchAddressResult): - """The result of the query. SearchAddressResponse if the query completed successfully, ErrorResponse otherwise. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar summary: Summary object for a Search API response. - :vartype summary: ~azure.maps.search.models.SearchSummary - :ivar results: A list of Search API results. - :vartype results: list[~azure.maps.search.models.SearchAddressResultItem] - :param error: The error object. - :type error: ~azure.maps.search.models.ErrorDetail - """ - - _validation = { - 'summary': {'readonly': True}, - 'results': {'readonly': True}, - } - - _attribute_map = { - 'summary': {'key': 'summary', 'type': 'SearchSummary'}, - 'results': {'key': 'results', 'type': '[SearchAddressResultItem]'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(SearchAddressBatchItemResponse, self).__init__(**kwargs) - self.summary = None - self.results = None - self.error = kwargs.get('error', None) - - -class SearchAddressBatchResult(BatchResult): - """This object is returned from a successful Search Address Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar batch_summary: Summary of the results for the batch request. - :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary - :ivar batch_items: Array containing the batch results. - :vartype batch_items: list[~azure.maps.search.models.SearchAddressBatchItem] - """ - - _validation = { - 'batch_summary': {'readonly': True}, - 'batch_items': {'readonly': True}, - } - - _attribute_map = { - 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, - 'batch_items': {'key': 'batchItems', 'type': '[SearchAddressBatchItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(SearchAddressBatchResult, self).__init__(**kwargs) - self.batch_items = None - - -class SearchAddressResultItem(msrest.serialization.Model): - """Result object for a Search API response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: One of: - - - * POI - * Street - * Geography - * Point Address - * Address Range - * Cross Street. Possible values include: "POI", "Street", "Geography", "Point Address", - "Address Range", "Cross Street". - :vartype type: str or ~azure.maps.search.models.SearchAddressResultType - :ivar id: Id property. - :vartype id: str - :ivar score: The value within a result set to indicate the relative matching score between - results. You can use this to determine that result x is twice as likely to be as relevant as - result y if the value of x is 2x the value of y. The values vary between queries and is only - meant as a relative value for one result set. - :vartype score: float - :ivar distance_in_meters: Straight line distance between the result and geobias location in - meters. - :vartype distance_in_meters: float - :ivar info: Information about the original data source of the Result. Used for support - requests. - :vartype info: str - :param entity_type: Possible values include: "Country", "CountrySubdivision", - "CountrySecondarySubdivision", "CountryTertiarySubdivision", "Municipality", - "MunicipalitySubdivision", "Neighbourhood", "PostalCodeArea". - :type entity_type: str or ~azure.maps.search.models.GeographicEntityType - :ivar point_of_interest: Details of the returned POI including information such as the name, - phone, url address, and classifications. - :vartype point_of_interest: ~azure.maps.search.models.PointOfInterest - :ivar address: The address of the result. - :vartype address: ~azure.maps.search.models.Address - :param position: A location represented as a latitude and longitude using short names 'lat' & - 'lon'. - :type position: ~azure.maps.search.models.LatLongPairAbbreviated - :ivar viewport: The viewport that covers the result represented by the top-left and bottom- - right coordinates of the viewport. - :vartype viewport: ~azure.maps.search.models.BoundingBox - :ivar entry_points: Array of EntryPoints. Those describe the types of entrances available at - the location. The type can be "main" for main entrances such as a front door, or a lobby, and - "minor", for side and back doors. - :vartype entry_points: list[~azure.maps.search.models.EntryPoint] - :ivar address_ranges: Describes the address range on both sides of the street for a search - result. Coordinates for the start and end locations of the address range are included. - :vartype address_ranges: ~azure.maps.search.models.AddressRanges - :ivar data_sources: Optional section. Reference geometry id for use with the `Get Search - Polygon `_ API. - :vartype data_sources: ~azure.maps.search.models.DataSource - :ivar match_type: Information on the type of match. - - One of: - - - * AddressPoint - * HouseNumberRange - * Street. Possible values include: "AddressPoint", "HouseNumberRange", "Street". - :vartype match_type: str or ~azure.maps.search.models.MatchType - :ivar detour_time: Detour time in seconds. Only returned for calls to the Search Along Route - API. - :vartype detour_time: int - """ - - _validation = { - 'type': {'readonly': True}, - 'id': {'readonly': True}, - 'score': {'readonly': True}, - 'distance_in_meters': {'readonly': True}, - 'info': {'readonly': True}, - 'point_of_interest': {'readonly': True}, - 'address': {'readonly': True}, - 'viewport': {'readonly': True}, - 'entry_points': {'readonly': True}, - 'address_ranges': {'readonly': True}, - 'data_sources': {'readonly': True}, - 'match_type': {'readonly': True}, - 'detour_time': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'score': {'key': 'score', 'type': 'float'}, - 'distance_in_meters': {'key': 'dist', 'type': 'float'}, - 'info': {'key': 'info', 'type': 'str'}, - 'entity_type': {'key': 'entityType', 'type': 'str'}, - 'point_of_interest': {'key': 'poi', 'type': 'PointOfInterest'}, - 'address': {'key': 'address', 'type': 'Address'}, - 'position': {'key': 'position', 'type': 'LatLongPairAbbreviated'}, - 'viewport': {'key': 'viewport', 'type': 'BoundingBox'}, - 'entry_points': {'key': 'entryPoints', 'type': '[EntryPoint]'}, - 'address_ranges': {'key': 'addressRanges', 'type': 'AddressRanges'}, - 'data_sources': {'key': 'dataSources', 'type': 'DataSource'}, - 'match_type': {'key': 'matchType', 'type': 'str'}, - 'detour_time': {'key': 'detourTime', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(SearchAddressResultItem, self).__init__(**kwargs) - self.type = None - self.id = None - self.score = None - self.distance_in_meters = None - self.info = None - self.entity_type = kwargs.get('entity_type', None) - self.point_of_interest = None - self.address = None - self.position = kwargs.get('position', None) - self.viewport = None - self.entry_points = None - self.address_ranges = None - self.data_sources = None - self.match_type = None - self.detour_time = None - - -class SearchAlongRouteRequest(msrest.serialization.Model): - """This type represents the request body for the Search Along Route service. - - :param route: A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 - `_ for details. - :type route: ~azure.maps.search.models.GeoJsonLineString - """ - - _attribute_map = { - 'route': {'key': 'route', 'type': 'GeoJsonLineString'}, - } - - def __init__( - self, - **kwargs - ): - super(SearchAlongRouteRequest, self).__init__(**kwargs) - self.route = kwargs.get('route', None) - - -class SearchInsideGeometryRequest(msrest.serialization.Model): - """This type represents the request body for the Search Inside Geometry service. - - :param geometry: A valid ``GeoJSON`` object. Please refer to `RFC 7946 - `_ for details. - :type geometry: ~azure.maps.search.models.GeoJsonObject - """ - - _attribute_map = { - 'geometry': {'key': 'geometry', 'type': 'GeoJsonObject'}, - } - - def __init__( - self, - **kwargs - ): - super(SearchInsideGeometryRequest, self).__init__(**kwargs) - self.geometry = kwargs.get('geometry', None) - - -class SearchSummary(msrest.serialization.Model): - """Summary object for a Search API response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar query: The query parameter that was used to produce these search results. - :vartype query: str - :ivar query_type: The type of query being returned: NEARBY or NON_NEAR. Possible values - include: "NEARBY", "NON_NEAR". - :vartype query_type: str or ~azure.maps.search.models.QueryType - :ivar query_time: Time spent resolving the query, in milliseconds. - :vartype query_time: int - :ivar num_results: Number of results in the response. - :vartype num_results: int - :ivar top: Maximum number of responses that will be returned. - :vartype top: int - :ivar skip: The starting offset of the returned Results within the full Result set. - :vartype skip: int - :ivar total_results: The total number of Results found. - :vartype total_results: int - :ivar fuzzy_level: The maximum fuzzy level required to provide Results. - :vartype fuzzy_level: int - :ivar geo_bias: Indication when the internal search engine has applied a geospatial bias to - improve the ranking of results. In some methods, this can be affected by setting the lat and - lon parameters where available. In other cases it is purely internal. - :vartype geo_bias: ~azure.maps.search.models.LatLongPairAbbreviated - """ - - _validation = { - 'query': {'readonly': True}, - 'query_type': {'readonly': True}, - 'query_time': {'readonly': True}, - 'num_results': {'readonly': True}, - 'top': {'readonly': True}, - 'skip': {'readonly': True}, - 'total_results': {'readonly': True}, - 'fuzzy_level': {'readonly': True}, - 'geo_bias': {'readonly': True}, - } - - _attribute_map = { - 'query': {'key': 'query', 'type': 'str'}, - 'query_type': {'key': 'queryType', 'type': 'str'}, - 'query_time': {'key': 'queryTime', 'type': 'int'}, - 'num_results': {'key': 'numResults', 'type': 'int'}, - 'top': {'key': 'limit', 'type': 'int'}, - 'skip': {'key': 'offset', 'type': 'int'}, - 'total_results': {'key': 'totalResults', 'type': 'int'}, - 'fuzzy_level': {'key': 'fuzzyLevel', 'type': 'int'}, - 'geo_bias': {'key': 'geoBias', 'type': 'LatLongPairAbbreviated'}, - } - - def __init__( - self, - **kwargs - ): - super(SearchSummary, self).__init__(**kwargs) - self.query = None - self.query_type = None - self.query_time = None - self.num_results = None - self.top = None - self.skip = None - self.total_results = None - self.fuzzy_level = None - self.geo_bias = None - - -class Viewport(msrest.serialization.Model): - """The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. - - :param top_left_point: A location represented as a latitude and longitude using short names - 'lat' & 'lon'. - :type top_left_point: ~azure.maps.search.models.LatLongPairAbbreviated - :param btm_right_point: A location represented as a latitude and longitude using short names - 'lat' & 'lon'. - :type btm_right_point: ~azure.maps.search.models.LatLongPairAbbreviated - """ - - _attribute_map = { - 'top_left_point': {'key': 'topLeftPoint', 'type': 'LatLongPairAbbreviated'}, - 'btm_right_point': {'key': 'btmRightPoint', 'type': 'LatLongPairAbbreviated'}, - } - - def __init__( - self, - **kwargs - ): - super(Viewport, self).__init__(**kwargs) - self.top_left_point = kwargs.get('top_left_point', None) - self.btm_right_point = kwargs.get('btm_right_point', None) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/models/_models_py3.py b/sdk/maps/azure-maps-search/azure/maps/search/_generated/models/_models_py3.py deleted file mode 100644 index 6d2c0c5543062..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/models/_models_py3.py +++ /dev/null @@ -1,2231 +0,0 @@ -# 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 typing import List, Optional, Union - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - -from ._search_client_enums import * - - -class Address(msrest.serialization.Model): - """The address of the result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar building_number: The building number on the street. DEPRECATED, use streetNumber instead. - :vartype building_number: str - :ivar street: The street name. DEPRECATED, use streetName instead. - :vartype street: str - :ivar cross_street: The name of the street being crossed. - :vartype cross_street: str - :ivar street_number: The building number on the street. - :vartype street_number: str - :ivar route_numbers: The codes used to unambiguously identify the street. - :vartype route_numbers: list[int] - :ivar street_name: The street name. - :vartype street_name: str - :ivar street_name_and_number: The street name and number. - :vartype street_name_and_number: str - :ivar municipality: City / Town. - :vartype municipality: str - :ivar municipality_subdivision: Sub / Super City. - :vartype municipality_subdivision: str - :ivar country_tertiary_subdivision: Named Area. - :vartype country_tertiary_subdivision: str - :ivar country_secondary_subdivision: County. - :vartype country_secondary_subdivision: str - :ivar country_subdivision: State or Province. - :vartype country_subdivision: str - :ivar postal_code: Postal Code / Zip Code. - :vartype postal_code: str - :ivar extended_postal_code: Extended postal code (availability is dependent on the region). - :vartype extended_postal_code: str - :ivar country_code: Country (Note: This is a two-letter code, not a country name.). - :vartype country_code: str - :ivar country: Country name. - :vartype country: str - :ivar country_code_iso3: ISO alpha-3 country code. - :vartype country_code_iso3: str - :ivar freeform_address: An address line formatted according to the formatting rules of a - Result's country of origin, or in the case of a country, its full country name. - :vartype freeform_address: str - :ivar country_subdivision_name: The full name of a first level of country administrative - hierarchy. This field appears only in case countrySubdivision is presented in an abbreviated - form. Only supported for USA, Canada, and Great Britain. - :vartype country_subdivision_name: str - :ivar local_name: An address component which represents the name of a geographic area or - locality that groups a number of addressable objects for addressing purposes, without being an - administrative unit. This field is used to build the ``freeformAddress`` property. - :vartype local_name: str - :ivar bounding_box: Bounding box coordinates. - :vartype bounding_box: object - """ - - _validation = { - 'building_number': {'readonly': True}, - 'street': {'readonly': True}, - 'cross_street': {'readonly': True}, - 'street_number': {'readonly': True}, - 'route_numbers': {'readonly': True}, - 'street_name': {'readonly': True}, - 'street_name_and_number': {'readonly': True}, - 'municipality': {'readonly': True}, - 'municipality_subdivision': {'readonly': True}, - 'country_tertiary_subdivision': {'readonly': True}, - 'country_secondary_subdivision': {'readonly': True}, - 'country_subdivision': {'readonly': True}, - 'postal_code': {'readonly': True}, - 'extended_postal_code': {'readonly': True}, - 'country_code': {'readonly': True}, - 'country': {'readonly': True}, - 'country_code_iso3': {'readonly': True}, - 'freeform_address': {'readonly': True}, - 'country_subdivision_name': {'readonly': True}, - 'local_name': {'readonly': True}, - 'bounding_box': {'readonly': True}, - } - - _attribute_map = { - 'building_number': {'key': 'buildingNumber', 'type': 'str'}, - 'street': {'key': 'street', 'type': 'str'}, - 'cross_street': {'key': 'crossStreet', 'type': 'str'}, - 'street_number': {'key': 'streetNumber', 'type': 'str'}, - 'route_numbers': {'key': 'routeNumbers', 'type': '[str]'}, - 'street_name': {'key': 'streetName', 'type': 'str'}, - 'street_name_and_number': {'key': 'streetNameAndNumber', 'type': 'str'}, - 'municipality': {'key': 'municipality', 'type': 'str'}, - 'municipality_subdivision': {'key': 'municipalitySubdivision', 'type': 'str'}, - 'country_tertiary_subdivision': {'key': 'countryTertiarySubdivision', 'type': 'str'}, - 'country_secondary_subdivision': {'key': 'countrySecondarySubdivision', 'type': 'str'}, - 'country_subdivision': {'key': 'countrySubdivision', 'type': 'str'}, - 'postal_code': {'key': 'postalCode', 'type': 'str'}, - 'extended_postal_code': {'key': 'extendedPostalCode', 'type': 'str'}, - 'country_code': {'key': 'countryCode', 'type': 'str'}, - 'country': {'key': 'country', 'type': 'str'}, - 'country_code_iso3': {'key': 'countryCodeISO3', 'type': 'str'}, - 'freeform_address': {'key': 'freeformAddress', 'type': 'str'}, - 'country_subdivision_name': {'key': 'countrySubdivisionName', 'type': 'str'}, - 'local_name': {'key': 'localName', 'type': 'str'}, - 'bounding_box': {'key': 'boundingBox', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(Address, self).__init__(**kwargs) - self.building_number = None - self.street = None - self.cross_street = None - self.street_number = None - self.route_numbers = None - self.street_name = None - self.street_name_and_number = None - self.municipality = None - self.municipality_subdivision = None - self.country_tertiary_subdivision = None - self.country_secondary_subdivision = None - self.country_subdivision = None - self.postal_code = None - self.extended_postal_code = None - self.country_code = None - self.country = None - self.country_code_iso3 = None - self.freeform_address = None - self.country_subdivision_name = None - self.local_name = None - self.bounding_box = None - - -class AddressRanges(msrest.serialization.Model): - """Describes the address range on both sides of the street for a search result. Coordinates for the start and end locations of the address range are included. - - :param range_left: Address range on the left side of the street. - :type range_left: str - :param range_right: Address range on the right side of the street. - :type range_right: str - :param from_property: A location represented as a latitude and longitude using short names - 'lat' & 'lon'. - :type from_property: ~azure.maps.search.models.LatLongPairAbbreviated - :param to: A location represented as a latitude and longitude using short names 'lat' & 'lon'. - :type to: ~azure.maps.search.models.LatLongPairAbbreviated - """ - - _attribute_map = { - 'range_left': {'key': 'rangeLeft', 'type': 'str'}, - 'range_right': {'key': 'rangeRight', 'type': 'str'}, - 'from_property': {'key': 'from', 'type': 'LatLongPairAbbreviated'}, - 'to': {'key': 'to', 'type': 'LatLongPairAbbreviated'}, - } - - def __init__( - self, - *, - range_left: Optional[str] = None, - range_right: Optional[str] = None, - from_property: Optional["LatLongPairAbbreviated"] = None, - to: Optional["LatLongPairAbbreviated"] = None, - **kwargs - ): - super(AddressRanges, self).__init__(**kwargs) - self.range_left = range_left - self.range_right = range_right - self.from_property = from_property - self.to = to - - -class BatchRequest(msrest.serialization.Model): - """This type represents the request body for the Batch service. - - :param batch_items: The list of queries to process. - :type batch_items: list[~azure.maps.search.models.BatchRequestItem] - """ - - _attribute_map = { - 'batch_items': {'key': 'batchItems', 'type': '[BatchRequestItem]'}, - } - - def __init__( - self, - *, - batch_items: Optional[List["BatchRequestItem"]] = None, - **kwargs - ): - super(BatchRequest, self).__init__(**kwargs) - self.batch_items = batch_items - - -class BatchRequestItem(msrest.serialization.Model): - """Batch request object. - - :param query: This parameter contains a query string used to perform an unstructured geocoding - operation. The query string will be passed verbatim to the search API for processing. - :type query: str - """ - - _attribute_map = { - 'query': {'key': 'query', 'type': 'str'}, - } - - def __init__( - self, - *, - query: Optional[str] = None, - **kwargs - ): - super(BatchRequestItem, self).__init__(**kwargs) - self.query = query - - -class BatchResult(msrest.serialization.Model): - """This object is returned from a successful Batch service call. Extend with 'batchItems' property. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar batch_summary: Summary of the results for the batch request. - :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary - """ - - _validation = { - 'batch_summary': {'readonly': True}, - } - - _attribute_map = { - 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchResult, self).__init__(**kwargs) - self.batch_summary = None - - -class BatchResultItem(msrest.serialization.Model): - """An item returned from Batch API. Extend with 'response' property. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status_code: HTTP request status code. - :vartype status_code: int - """ - - _validation = { - 'status_code': {'readonly': True}, - } - - _attribute_map = { - 'status_code': {'key': 'statusCode', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchResultItem, self).__init__(**kwargs) - self.status_code = None - - -class BatchResultSummary(msrest.serialization.Model): - """Summary of the results for the batch request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar successful_requests: Number of successful requests in the batch. - :vartype successful_requests: int - :ivar total_requests: Total number of requests in the batch. - :vartype total_requests: int - """ - - _validation = { - 'successful_requests': {'readonly': True}, - 'total_requests': {'readonly': True}, - } - - _attribute_map = { - 'successful_requests': {'key': 'successfulRequests', 'type': 'int'}, - 'total_requests': {'key': 'totalRequests', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(BatchResultSummary, self).__init__(**kwargs) - self.successful_requests = None - self.total_requests = None - - -class BoundingBox(msrest.serialization.Model): - """The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. - - :param top_left: A location represented as a latitude and longitude using short names 'lat' & - 'lon'. - :type top_left: ~azure.maps.search.models.LatLongPairAbbreviated - :param bottom_right: A location represented as a latitude and longitude using short names 'lat' - & 'lon'. - :type bottom_right: ~azure.maps.search.models.LatLongPairAbbreviated - """ - - _attribute_map = { - 'top_left': {'key': 'topLeftPoint', 'type': 'LatLongPairAbbreviated'}, - 'bottom_right': {'key': 'btmRightPoint', 'type': 'LatLongPairAbbreviated'}, - } - - def __init__( - self, - *, - top_left: Optional["LatLongPairAbbreviated"] = None, - bottom_right: Optional["LatLongPairAbbreviated"] = None, - **kwargs - ): - super(BoundingBox, self).__init__(**kwargs) - self.top_left = top_left - self.bottom_right = bottom_right - - -class BrandName(msrest.serialization.Model): - """The name of the brand for the POI being returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the brand. - :vartype name: str - """ - - _validation = { - 'name': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BrandName, self).__init__(**kwargs) - self.name = None - - -class Classification(msrest.serialization.Model): - """The classification for the POI being returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Code property. - :vartype code: str - :ivar names: Names array. - :vartype names: list[~azure.maps.search.models.ClassificationName] - """ - - _validation = { - 'code': {'readonly': True}, - 'names': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'names': {'key': 'names', 'type': '[ClassificationName]'}, - } - - def __init__( - self, - **kwargs - ): - super(Classification, self).__init__(**kwargs) - self.code = None - self.names = None - - -class ClassificationName(msrest.serialization.Model): - """Name for the classification. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_locale: Name Locale property. - :vartype name_locale: str - :ivar name: Name property. - :vartype name: str - """ - - _validation = { - 'name_locale': {'readonly': True}, - 'name': {'readonly': True}, - } - - _attribute_map = { - 'name_locale': {'key': 'nameLocale', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClassificationName, self).__init__(**kwargs) - self.name_locale = None - self.name = None - - -class DataSource(msrest.serialization.Model): - """Optional section. Reference ids for use with the `Get Search Polygon `_ API. - - :param geometry: Information about the geometric shape of the result. Only present if type == - Geography. - :type geometry: ~azure.maps.search.models.GeometryIdentifier - """ - - _attribute_map = { - 'geometry': {'key': 'geometry', 'type': 'GeometryIdentifier'}, - } - - def __init__( - self, - *, - geometry: Optional["GeometryIdentifier"] = None, - **kwargs - ): - super(DataSource, self).__init__(**kwargs) - self.geometry = geometry - - -class EntryPoint(msrest.serialization.Model): - """The entry point for the POI being returned. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of entry point. Value can be either *main* or *minor*. Possible values - include: "main", "minor". - :vartype type: str or ~azure.maps.search.models.EntryPointType - :param position: A location represented as a latitude and longitude using short names 'lat' & - 'lon'. - :type position: ~azure.maps.search.models.LatLongPairAbbreviated - """ - - _validation = { - 'type': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'position': {'key': 'position', 'type': 'LatLongPairAbbreviated'}, - } - - def __init__( - self, - *, - position: Optional["LatLongPairAbbreviated"] = None, - **kwargs - ): - super(EntryPoint, self).__init__(**kwargs) - self.type = None - self.position = position - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: object - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.maps.search.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.maps.search.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~azure.maps.search.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - *, - error: Optional["ErrorDetail"] = None, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = error - - -class GeoJsonFeatureData(msrest.serialization.Model): - """GeoJsonFeatureData. - - All required parameters must be populated in order to send to Azure. - - :param geometry: Required. A valid ``GeoJSON`` object. Please refer to `RFC 7946 - `__ for details. - :type geometry: ~azure.maps.search.models.GeoJsonObject - :param properties: Properties can contain any additional metadata about the ``Feature``. Value - can be any JSON object or a JSON null value. - :type properties: object - :param id: Identifier for the feature. - :type id: str - :param feature_type: The type of the feature. The value depends on the data model the current - feature is part of. Some data models may have an empty value. - :type feature_type: str - """ - - _validation = { - 'geometry': {'required': True}, - } - - _attribute_map = { - 'geometry': {'key': 'geometry', 'type': 'GeoJsonObject'}, - 'properties': {'key': 'properties', 'type': 'object'}, - 'id': {'key': 'id', 'type': 'str'}, - 'feature_type': {'key': 'featureType', 'type': 'str'}, - } - - def __init__( - self, - *, - geometry: "GeoJsonObject", - properties: Optional[object] = None, - id: Optional[str] = None, - feature_type: Optional[str] = None, - **kwargs - ): - super(GeoJsonFeatureData, self).__init__(**kwargs) - self.geometry = geometry - self.properties = properties - self.id = id - self.feature_type = feature_type - - -class GeoJsonObject(msrest.serialization.Model): - """A valid ``GeoJSON`` object. Please refer to `RFC 7946 `__ for details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: GeoJsonFeature, GeoJsonFeatureCollection, GeoJsonGeometry, GeoJsonGeometryCollection, GeoJsonLineString, GeoJsonMultiLineString, GeoJsonMultiPoint, GeoJsonMultiPolygon, GeoJsonPoint, GeoJsonPolygon. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Feature': 'GeoJsonFeature', 'FeatureCollection': 'GeoJsonFeatureCollection', 'GeoJsonGeometry': 'GeoJsonGeometry', 'GeometryCollection': 'GeoJsonGeometryCollection', 'LineString': 'GeoJsonLineString', 'MultiLineString': 'GeoJsonMultiLineString', 'MultiPoint': 'GeoJsonMultiPoint', 'MultiPolygon': 'GeoJsonMultiPolygon', 'Point': 'GeoJsonPoint', 'Polygon': 'GeoJsonPolygon'} - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonObject, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class GeoJsonFeature(GeoJsonObject, GeoJsonFeatureData): - """A valid ``GeoJSON Feature`` object type. Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param geometry: Required. A valid ``GeoJSON`` object. Please refer to `RFC 7946 - `__ for details. - :type geometry: ~azure.maps.search.models.GeoJsonObject - :param properties: Properties can contain any additional metadata about the ``Feature``. Value - can be any JSON object or a JSON null value. - :type properties: object - :param id: Identifier for the feature. - :type id: str - :param feature_type: The type of the feature. The value depends on the data model the current - feature is part of. Some data models may have an empty value. - :type feature_type: str - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'geometry': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'geometry': {'key': 'geometry', 'type': 'GeoJsonObject'}, - 'properties': {'key': 'properties', 'type': 'object'}, - 'id': {'key': 'id', 'type': 'str'}, - 'feature_type': {'key': 'featureType', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - geometry: "GeoJsonObject", - properties: Optional[object] = None, - id: Optional[str] = None, - feature_type: Optional[str] = None, - **kwargs - ): - super(GeoJsonFeature, self).__init__(geometry=geometry, properties=properties, id=id, feature_type=feature_type, **kwargs) - self.geometry = geometry - self.properties = properties - self.id = id - self.feature_type = feature_type - self.type = 'Feature' # type: str - self.type = 'Feature' # type: str - - -class GeoJsonFeatureCollectionData(msrest.serialization.Model): - """GeoJsonFeatureCollectionData. - - All required parameters must be populated in order to send to Azure. - - :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. - :type features: list[~azure.maps.search.models.GeoJsonFeature] - """ - - _validation = { - 'features': {'required': True}, - } - - _attribute_map = { - 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, - } - - def __init__( - self, - *, - features: List["GeoJsonFeature"], - **kwargs - ): - super(GeoJsonFeatureCollectionData, self).__init__(**kwargs) - self.features = features - - -class GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): - """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. - :type features: list[~azure.maps.search.models.GeoJsonFeature] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'features': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - features: List["GeoJsonFeature"], - **kwargs - ): - super(GeoJsonFeatureCollection, self).__init__(features=features, **kwargs) - self.features = features - self.type = 'FeatureCollection' # type: str - self.type = 'FeatureCollection' # type: str - - -class GeoJsonGeometry(GeoJsonObject): - """A valid ``GeoJSON`` geometry object. The type must be one of the seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonGeometry, self).__init__(**kwargs) - self.type = 'GeoJsonGeometry' # type: str - - -class GeoJsonGeometryCollectionData(msrest.serialization.Model): - """GeoJsonGeometryCollectionData. - - All required parameters must be populated in order to send to Azure. - - :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** - that coordinates in GeoJSON are in x, y order (longitude, latitude). - :type geometries: list[~azure.maps.search.models.GeoJsonObject] - """ - - _validation = { - 'geometries': {'required': True}, - } - - _attribute_map = { - 'geometries': {'key': 'geometries', 'type': '[GeoJsonObject]'}, - } - - def __init__( - self, - *, - geometries: List["GeoJsonObject"], - **kwargs - ): - super(GeoJsonGeometryCollectionData, self).__init__(**kwargs) - self.geometries = geometries - - -class GeoJsonGeometryCollection(GeoJsonObject, GeoJsonGeometryCollectionData): - """A valid ``GeoJSON GeometryCollection`` object type. Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** - that coordinates in GeoJSON are in x, y order (longitude, latitude). - :type geometries: list[~azure.maps.search.models.GeoJsonObject] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'geometries': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'geometries': {'key': 'geometries', 'type': '[GeoJsonObject]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - geometries: List["GeoJsonObject"], - **kwargs - ): - super(GeoJsonGeometryCollection, self).__init__(geometries=geometries, **kwargs) - self.geometries = geometries - self.type = 'GeometryCollection' # type: str - self.type = 'GeometryCollection' # type: str - - -class GeoJsonLineStringData(msrest.serialization.Model): - """GeoJsonLineStringData. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. - :type coordinates: list[list[float]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, - } - - def __init__( - self, - *, - coordinates: List[List[float]], - **kwargs - ): - super(GeoJsonLineStringData, self).__init__(**kwargs) - self.coordinates = coordinates - - -class GeoJsonLineString(GeoJsonObject, GeoJsonLineStringData): - """A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. - :type coordinates: list[list[float]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - coordinates: List[List[float]], - **kwargs - ): - super(GeoJsonLineString, self).__init__(coordinates=coordinates, **kwargs) - self.coordinates = coordinates - self.type = 'LineString' # type: str - self.type = 'LineString' # type: str - - -class GeoJsonMultiLineStringData(msrest.serialization.Model): - """GeoJsonMultiLineStringData. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. - :type coordinates: list[list[list[float]]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, - } - - def __init__( - self, - *, - coordinates: List[List[List[float]]], - **kwargs - ): - super(GeoJsonMultiLineStringData, self).__init__(**kwargs) - self.coordinates = coordinates - - -class GeoJsonMultiLineString(GeoJsonObject, GeoJsonMultiLineStringData): - """A valid ``GeoJSON MultiLineString`` geometry type. Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. - :type coordinates: list[list[list[float]]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - coordinates: List[List[List[float]]], - **kwargs - ): - super(GeoJsonMultiLineString, self).__init__(coordinates=coordinates, **kwargs) - self.coordinates = coordinates - self.type = 'MultiLineString' # type: str - self.type = 'MultiLineString' # type: str - - -class GeoJsonMultiPointData(msrest.serialization.Model): - """Data contained by a ``GeoJson MultiPoint``. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. - :type coordinates: list[list[float]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, - } - - def __init__( - self, - *, - coordinates: List[List[float]], - **kwargs - ): - super(GeoJsonMultiPointData, self).__init__(**kwargs) - self.coordinates = coordinates - - -class GeoJsonMultiPoint(GeoJsonObject, GeoJsonMultiPointData): - """A valid ``GeoJSON MultiPoint`` geometry type. Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. - :type coordinates: list[list[float]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - coordinates: List[List[float]], - **kwargs - ): - super(GeoJsonMultiPoint, self).__init__(coordinates=coordinates, **kwargs) - self.coordinates = coordinates - self.type = 'MultiPoint' # type: str - self.type = 'MultiPoint' # type: str - - -class GeoJsonMultiPolygonData(msrest.serialization.Model): - """GeoJsonMultiPolygonData. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** - that coordinates in GeoJSON are in x, y order (longitude, latitude). - :type coordinates: list[list[list[list[float]]]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, - } - - def __init__( - self, - *, - coordinates: List[List[List[List[float]]]], - **kwargs - ): - super(GeoJsonMultiPolygonData, self).__init__(**kwargs) - self.coordinates = coordinates - - -class GeoJsonMultiPolygon(GeoJsonObject, GeoJsonMultiPolygonData): - """A valid ``GeoJSON MultiPolygon`` object type. Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** - that coordinates in GeoJSON are in x, y order (longitude, latitude). - :type coordinates: list[list[list[list[float]]]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - coordinates: List[List[List[List[float]]]], - **kwargs - ): - super(GeoJsonMultiPolygon, self).__init__(coordinates=coordinates, **kwargs) - self.coordinates = coordinates - self.type = 'MultiPolygon' # type: str - self.type = 'MultiPolygon' # type: str - - -class GeoJsonPointData(msrest.serialization.Model): - """Data contained by a ``GeoJson Point``. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. - The first two elements are *longitude* and *latitude*\ , precisely in that order. - *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 - `__ for details. - :type coordinates: list[float] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[float]'}, - } - - def __init__( - self, - *, - coordinates: List[float], - **kwargs - ): - super(GeoJsonPointData, self).__init__(**kwargs) - self.coordinates = coordinates - - -class GeoJsonPoint(GeoJsonObject, GeoJsonPointData): - """A valid ``GeoJSON Point`` geometry type. Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. - The first two elements are *longitude* and *latitude*\ , precisely in that order. - *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 - `__ for details. - :type coordinates: list[float] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[float]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - coordinates: List[float], - **kwargs - ): - super(GeoJsonPoint, self).__init__(coordinates=coordinates, **kwargs) - self.coordinates = coordinates - self.type = 'Point' # type: str - self.type = 'Point' # type: str - - -class GeoJsonPolygonData(msrest.serialization.Model): - """GeoJsonPolygonData. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. - :type coordinates: list[list[list[float]]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, - } - - def __init__( - self, - *, - coordinates: List[List[List[float]]], - **kwargs - ): - super(GeoJsonPolygonData, self).__init__(**kwargs) - self.coordinates = coordinates - - -class GeoJsonPolygon(GeoJsonObject, GeoJsonPolygonData): - """A valid ``GeoJSON Polygon`` geometry type. Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. - :type coordinates: list[list[list[float]]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - coordinates: List[List[List[float]]], - **kwargs - ): - super(GeoJsonPolygon, self).__init__(coordinates=coordinates, **kwargs) - self.coordinates = coordinates - self.type = 'Polygon' # type: str - self.type = 'Polygon' # type: str - - -class GeometryIdentifier(msrest.serialization.Model): - """Information about the geometric shape of the result. Only present if type == Geography. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Pass this as geometryId to the `Get Search Polygon - `_ API to fetch geometry - information for this result. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeometryIdentifier, self).__init__(**kwargs) - self.id = None - - -class LatLongPairAbbreviated(msrest.serialization.Model): - """A location represented as a latitude and longitude using short names 'lat' & 'lon'. - - :param lat: Latitude property. - :type lat: float - :param lon: Longitude property. - :type lon: float - """ - - _attribute_map = { - 'lat': {'key': 'lat', 'type': 'float'}, - 'lon': {'key': 'lon', 'type': 'float'}, - } - - def __init__( - self, - *, - lat: Optional[float] = None, - lon: Optional[float] = None, - **kwargs - ): - super(LatLongPairAbbreviated, self).__init__(**kwargs) - self.lat = lat - self.lon = lon - - -class OperatingHours(msrest.serialization.Model): - """Opening hours for a POI (Points of Interest). - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar mode: Value used in the request: none or "nextSevenDays". - :vartype mode: str - :ivar time_ranges: List of time ranges for the next 7 days. - :vartype time_ranges: list[~azure.maps.search.models.OperatingHoursTimeRange] - """ - - _validation = { - 'mode': {'readonly': True}, - 'time_ranges': {'readonly': True}, - } - - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'time_ranges': {'key': 'timeRanges', 'type': '[OperatingHoursTimeRange]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperatingHours, self).__init__(**kwargs) - self.mode = None - self.time_ranges = None - - -class OperatingHoursTime(msrest.serialization.Model): - """Represents a date and time. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar date: Represents current calendar date in POI time zone, e.g. "2019-02-07". - :vartype date: str - :ivar hour: Hours are in the 24 hour format in the local time of a POI; possible values are 0 - - 23. - :vartype hour: int - :ivar minute: Minutes are in the local time of a POI; possible values are 0 - 59. - :vartype minute: int - """ - - _validation = { - 'date': {'readonly': True}, - 'hour': {'readonly': True}, - 'minute': {'readonly': True}, - } - - _attribute_map = { - 'date': {'key': 'date', 'type': 'str'}, - 'hour': {'key': 'hour', 'type': 'int'}, - 'minute': {'key': 'minute', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(OperatingHoursTime, self).__init__(**kwargs) - self.date = None - self.hour = None - self.minute = None - - -class OperatingHoursTimeRange(msrest.serialization.Model): - """Open time range for a day. - - :param start_time: The point in the next 7 days range when a given POI is being opened, or the - beginning of the range if it was opened before the range. - :type start_time: ~azure.maps.search.models.OperatingHoursTime - :param end_time: The point in the next 7 days range when a given POI is being closed, or the - beginning of the range if it was closed before the range. - :type end_time: ~azure.maps.search.models.OperatingHoursTime - """ - - _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'OperatingHoursTime'}, - 'end_time': {'key': 'endTime', 'type': 'OperatingHoursTime'}, - } - - def __init__( - self, - *, - start_time: Optional["OperatingHoursTime"] = None, - end_time: Optional["OperatingHoursTime"] = None, - **kwargs - ): - super(OperatingHoursTimeRange, self).__init__(**kwargs) - self.start_time = start_time - self.end_time = end_time - - -class PointOfInterest(msrest.serialization.Model): - """Details of the returned POI including information such as the name, phone, url address, and classifications. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the POI property. - :vartype name: str - :ivar phone: Telephone number property. - :vartype phone: str - :ivar url: Website URL property. - :vartype url: str - :ivar category_set: The list of the most specific POI categories. - :vartype category_set: list[~azure.maps.search.models.PointOfInterestCategorySet] - :ivar classifications: Classification array. - :vartype classifications: list[~azure.maps.search.models.Classification] - :ivar brands: Brands array. The name of the brand for the POI being returned. - :vartype brands: list[~azure.maps.search.models.BrandName] - :param operating_hours: Opening hours for a POI (Points of Interest). - :type operating_hours: ~azure.maps.search.models.OperatingHours - """ - - _validation = { - 'name': {'readonly': True}, - 'phone': {'readonly': True}, - 'url': {'readonly': True}, - 'category_set': {'readonly': True}, - 'classifications': {'readonly': True}, - 'brands': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'phone': {'key': 'phone', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - 'category_set': {'key': 'categorySet', 'type': '[PointOfInterestCategorySet]'}, - 'classifications': {'key': 'classifications', 'type': '[Classification]'}, - 'brands': {'key': 'brands', 'type': '[BrandName]'}, - 'operating_hours': {'key': 'openingHours', 'type': 'OperatingHours'}, - } - - def __init__( - self, - *, - operating_hours: Optional["OperatingHours"] = None, - **kwargs - ): - super(PointOfInterest, self).__init__(**kwargs) - self.name = None - self.phone = None - self.url = None - self.category_set = None - self.classifications = None - self.brands = None - self.operating_hours = operating_hours - - -class PointOfInterestCategory(msrest.serialization.Model): - """POI category result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Unique ID for the category. ID can be used to restrict search results to specific - categories through other Search Service APIs, like `Get Search POI - `_. - :vartype id: int - :ivar name: Name of the category. - :vartype name: str - :ivar child_ids: Array of child category ids. - :vartype child_ids: list[int] - :ivar synonyms: Array of alternative names of the category. - :vartype synonyms: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'child_ids': {'readonly': True}, - 'synonyms': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'str'}, - 'child_ids': {'key': 'childCategoryIds', 'type': '[int]'}, - 'synonyms': {'key': 'synonyms', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PointOfInterestCategory, self).__init__(**kwargs) - self.id = None - self.name = None - self.child_ids = None - self.synonyms = None - - -class PointOfInterestCategorySet(msrest.serialization.Model): - """POI category. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Category ID. - :vartype id: int - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(PointOfInterestCategorySet, self).__init__(**kwargs) - self.id = None - - -class PointOfInterestCategoryTreeResult(msrest.serialization.Model): - """This object is returned from a successful POI Category Tree call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar categories: Categories array. - :vartype categories: list[~azure.maps.search.models.PointOfInterestCategory] - """ - - _validation = { - 'categories': {'readonly': True}, - } - - _attribute_map = { - 'categories': {'key': 'poiCategories', 'type': '[PointOfInterestCategory]'}, - } - - def __init__( - self, - **kwargs - ): - super(PointOfInterestCategoryTreeResult, self).__init__(**kwargs) - self.categories = None - - -class Polygon(msrest.serialization.Model): - """Polygon. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider_id: ID of the returned entity. - :vartype provider_id: str - :param geometry_data: Geometry data in GeoJSON format. Please refer to `RFC 7946 - `__ for details. Present only if "error" is not present. - :type geometry_data: ~azure.maps.search.models.GeoJsonObject - """ - - _validation = { - 'provider_id': {'readonly': True}, - } - - _attribute_map = { - 'provider_id': {'key': 'providerID', 'type': 'str'}, - 'geometry_data': {'key': 'geometryData', 'type': 'GeoJsonObject'}, - } - - def __init__( - self, - *, - geometry_data: Optional["GeoJsonObject"] = None, - **kwargs - ): - super(Polygon, self).__init__(**kwargs) - self.provider_id = None - self.geometry_data = geometry_data - - -class PolygonResult(msrest.serialization.Model): - """This object is returned from a successful Search Polygon call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar polygons: Results array. - :vartype polygons: list[~azure.maps.search.models.Polygon] - """ - - _validation = { - 'polygons': {'readonly': True}, - } - - _attribute_map = { - 'polygons': {'key': 'additionalData', 'type': '[Polygon]'}, - } - - def __init__( - self, - **kwargs - ): - super(PolygonResult, self).__init__(**kwargs) - self.polygons = None - - -class ReverseSearchAddressBatchItem(BatchResultItem): - """An item returned from Search Address Reverse Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status_code: HTTP request status code. - :vartype status_code: int - :ivar response: The result of the query. SearchAddressReverseResponse if the query completed - successfully, ErrorResponse otherwise. - :vartype response: ~azure.maps.search.models.ReverseSearchAddressBatchItemResponse - """ - - _validation = { - 'status_code': {'readonly': True}, - 'response': {'readonly': True}, - } - - _attribute_map = { - 'status_code': {'key': 'statusCode', 'type': 'int'}, - 'response': {'key': 'response', 'type': 'ReverseSearchAddressBatchItemResponse'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchAddressBatchItem, self).__init__(**kwargs) - self.response = None - - -class ReverseSearchAddressResult(msrest.serialization.Model): - """This object is returned from a successful Search Address Reverse call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar summary: Summary object for a Search Address Reverse response. - :vartype summary: ~azure.maps.search.models.SearchSummary - :ivar addresses: Addresses array. - :vartype addresses: list[~azure.maps.search.models.ReverseSearchAddressResultItem] - """ - - _validation = { - 'summary': {'readonly': True}, - 'addresses': {'readonly': True}, - } - - _attribute_map = { - 'summary': {'key': 'summary', 'type': 'SearchSummary'}, - 'addresses': {'key': 'addresses', 'type': '[ReverseSearchAddressResultItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchAddressResult, self).__init__(**kwargs) - self.summary = None - self.addresses = None - - -class ReverseSearchAddressBatchItemResponse(ErrorResponse, ReverseSearchAddressResult): - """The result of the query. SearchAddressReverseResponse if the query completed successfully, ErrorResponse otherwise. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar summary: Summary object for a Search Address Reverse response. - :vartype summary: ~azure.maps.search.models.SearchSummary - :ivar addresses: Addresses array. - :vartype addresses: list[~azure.maps.search.models.ReverseSearchAddressResultItem] - :param error: The error object. - :type error: ~azure.maps.search.models.ErrorDetail - """ - - _validation = { - 'summary': {'readonly': True}, - 'addresses': {'readonly': True}, - } - - _attribute_map = { - 'summary': {'key': 'summary', 'type': 'SearchSummary'}, - 'addresses': {'key': 'addresses', 'type': '[ReverseSearchAddressResultItem]'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - *, - error: Optional["ErrorDetail"] = None, - **kwargs - ): - super(ReverseSearchAddressBatchItemResponse, self).__init__(error=error, **kwargs) - self.summary = None - self.addresses = None - self.error = error - - -class ReverseSearchAddressBatchProcessResult(BatchResult): - """This object is returned from a successful Search Address Reverse Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar batch_summary: Summary of the results for the batch request. - :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary - :ivar batch_items: Array containing the batch results. - :vartype batch_items: list[~azure.maps.search.models.ReverseSearchAddressBatchItem] - """ - - _validation = { - 'batch_summary': {'readonly': True}, - 'batch_items': {'readonly': True}, - } - - _attribute_map = { - 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, - 'batch_items': {'key': 'batchItems', 'type': '[ReverseSearchAddressBatchItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchAddressBatchProcessResult, self).__init__(**kwargs) - self.batch_items = None - - -class ReverseSearchAddressResultItem(msrest.serialization.Model): - """Result object for a Search Address Reverse response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar address: The address of the result. - :vartype address: ~azure.maps.search.models.Address - :ivar position: Position property in the form of "{latitude},{longitude}". - :vartype position: str - :ivar road_use: - :vartype road_use: list[str or ~azure.maps.search.models.RoadUseType] - :ivar match_type: Information on the type of match. - - One of: - - - * AddressPoint - * HouseNumberRange - * Street. Possible values include: "AddressPoint", "HouseNumberRange", "Street". - :vartype match_type: str or ~azure.maps.search.models.MatchType - """ - - _validation = { - 'address': {'readonly': True}, - 'position': {'readonly': True}, - 'road_use': {'readonly': True}, - 'match_type': {'readonly': True}, - } - - _attribute_map = { - 'address': {'key': 'address', 'type': 'Address'}, - 'position': {'key': 'position', 'type': 'str'}, - 'road_use': {'key': 'roadUse', 'type': '[str]'}, - 'match_type': {'key': 'matchType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchAddressResultItem, self).__init__(**kwargs) - self.address = None - self.position = None - self.road_use = None - self.match_type = None - - -class ReverseSearchCrossStreetAddressResult(msrest.serialization.Model): - """This object is returned from a successful Search Address Reverse CrossStreet call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar summary: Summary object for a Search Address Reverse Cross Street response. - :vartype summary: ~azure.maps.search.models.SearchSummary - :ivar addresses: Addresses array. - :vartype addresses: list[~azure.maps.search.models.ReverseSearchCrossStreetAddressResultItem] - """ - - _validation = { - 'summary': {'readonly': True}, - 'addresses': {'readonly': True}, - } - - _attribute_map = { - 'summary': {'key': 'summary', 'type': 'SearchSummary'}, - 'addresses': {'key': 'addresses', 'type': '[ReverseSearchCrossStreetAddressResultItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchCrossStreetAddressResult, self).__init__(**kwargs) - self.summary = None - self.addresses = None - - -class ReverseSearchCrossStreetAddressResultItem(msrest.serialization.Model): - """Result object for a Search Address Reverse Cross Street response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar address: The address of the result. - :vartype address: ~azure.maps.search.models.Address - :ivar position: Position property in the form of "{latitude},{longitude}". - :vartype position: str - """ - - _validation = { - 'address': {'readonly': True}, - 'position': {'readonly': True}, - } - - _attribute_map = { - 'address': {'key': 'address', 'type': 'Address'}, - 'position': {'key': 'position', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReverseSearchCrossStreetAddressResultItem, self).__init__(**kwargs) - self.address = None - self.position = None - - -class SearchAddressBatchItem(BatchResultItem): - """An item returned from Search Address Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status_code: HTTP request status code. - :vartype status_code: int - :ivar response: The result of the query. SearchAddressResponse if the query completed - successfully, ErrorResponse otherwise. - :vartype response: ~azure.maps.search.models.SearchAddressBatchItemResponse - """ - - _validation = { - 'status_code': {'readonly': True}, - 'response': {'readonly': True}, - } - - _attribute_map = { - 'status_code': {'key': 'statusCode', 'type': 'int'}, - 'response': {'key': 'response', 'type': 'SearchAddressBatchItemResponse'}, - } - - def __init__( - self, - **kwargs - ): - super(SearchAddressBatchItem, self).__init__(**kwargs) - self.response = None - - -class SearchAddressResult(msrest.serialization.Model): - """This object is returned from a successful Search calls. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar summary: Summary object for a Search API response. - :vartype summary: ~azure.maps.search.models.SearchSummary - :ivar results: A list of Search API results. - :vartype results: list[~azure.maps.search.models.SearchAddressResultItem] - """ - - _validation = { - 'summary': {'readonly': True}, - 'results': {'readonly': True}, - } - - _attribute_map = { - 'summary': {'key': 'summary', 'type': 'SearchSummary'}, - 'results': {'key': 'results', 'type': '[SearchAddressResultItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(SearchAddressResult, self).__init__(**kwargs) - self.summary = None - self.results = None - - -class SearchAddressBatchItemResponse(ErrorResponse, SearchAddressResult): - """The result of the query. SearchAddressResponse if the query completed successfully, ErrorResponse otherwise. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar summary: Summary object for a Search API response. - :vartype summary: ~azure.maps.search.models.SearchSummary - :ivar results: A list of Search API results. - :vartype results: list[~azure.maps.search.models.SearchAddressResultItem] - :param error: The error object. - :type error: ~azure.maps.search.models.ErrorDetail - """ - - _validation = { - 'summary': {'readonly': True}, - 'results': {'readonly': True}, - } - - _attribute_map = { - 'summary': {'key': 'summary', 'type': 'SearchSummary'}, - 'results': {'key': 'results', 'type': '[SearchAddressResultItem]'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - *, - error: Optional["ErrorDetail"] = None, - **kwargs - ): - super(SearchAddressBatchItemResponse, self).__init__(error=error, **kwargs) - self.summary = None - self.results = None - self.error = error - - -class SearchAddressBatchResult(BatchResult): - """This object is returned from a successful Search Address Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar batch_summary: Summary of the results for the batch request. - :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary - :ivar batch_items: Array containing the batch results. - :vartype batch_items: list[~azure.maps.search.models.SearchAddressBatchItem] - """ - - _validation = { - 'batch_summary': {'readonly': True}, - 'batch_items': {'readonly': True}, - } - - _attribute_map = { - 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, - 'batch_items': {'key': 'batchItems', 'type': '[SearchAddressBatchItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(SearchAddressBatchResult, self).__init__(**kwargs) - self.batch_items = None - - -class SearchAddressResultItem(msrest.serialization.Model): - """Result object for a Search API response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: One of: - - - * POI - * Street - * Geography - * Point Address - * Address Range - * Cross Street. Possible values include: "POI", "Street", "Geography", "Point Address", - "Address Range", "Cross Street". - :vartype type: str or ~azure.maps.search.models.SearchAddressResultType - :ivar id: Id property. - :vartype id: str - :ivar score: The value within a result set to indicate the relative matching score between - results. You can use this to determine that result x is twice as likely to be as relevant as - result y if the value of x is 2x the value of y. The values vary between queries and is only - meant as a relative value for one result set. - :vartype score: float - :ivar distance_in_meters: Straight line distance between the result and geobias location in - meters. - :vartype distance_in_meters: float - :ivar info: Information about the original data source of the Result. Used for support - requests. - :vartype info: str - :param entity_type: Possible values include: "Country", "CountrySubdivision", - "CountrySecondarySubdivision", "CountryTertiarySubdivision", "Municipality", - "MunicipalitySubdivision", "Neighbourhood", "PostalCodeArea". - :type entity_type: str or ~azure.maps.search.models.GeographicEntityType - :ivar point_of_interest: Details of the returned POI including information such as the name, - phone, url address, and classifications. - :vartype point_of_interest: ~azure.maps.search.models.PointOfInterest - :ivar address: The address of the result. - :vartype address: ~azure.maps.search.models.Address - :param position: A location represented as a latitude and longitude using short names 'lat' & - 'lon'. - :type position: ~azure.maps.search.models.LatLongPairAbbreviated - :ivar viewport: The viewport that covers the result represented by the top-left and bottom- - right coordinates of the viewport. - :vartype viewport: ~azure.maps.search.models.BoundingBox - :ivar entry_points: Array of EntryPoints. Those describe the types of entrances available at - the location. The type can be "main" for main entrances such as a front door, or a lobby, and - "minor", for side and back doors. - :vartype entry_points: list[~azure.maps.search.models.EntryPoint] - :ivar address_ranges: Describes the address range on both sides of the street for a search - result. Coordinates for the start and end locations of the address range are included. - :vartype address_ranges: ~azure.maps.search.models.AddressRanges - :ivar data_sources: Optional section. Reference geometry id for use with the `Get Search - Polygon `_ API. - :vartype data_sources: ~azure.maps.search.models.DataSource - :ivar match_type: Information on the type of match. - - One of: - - - * AddressPoint - * HouseNumberRange - * Street. Possible values include: "AddressPoint", "HouseNumberRange", "Street". - :vartype match_type: str or ~azure.maps.search.models.MatchType - :ivar detour_time: Detour time in seconds. Only returned for calls to the Search Along Route - API. - :vartype detour_time: int - """ - - _validation = { - 'type': {'readonly': True}, - 'id': {'readonly': True}, - 'score': {'readonly': True}, - 'distance_in_meters': {'readonly': True}, - 'info': {'readonly': True}, - 'point_of_interest': {'readonly': True}, - 'address': {'readonly': True}, - 'viewport': {'readonly': True}, - 'entry_points': {'readonly': True}, - 'address_ranges': {'readonly': True}, - 'data_sources': {'readonly': True}, - 'match_type': {'readonly': True}, - 'detour_time': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'score': {'key': 'score', 'type': 'float'}, - 'distance_in_meters': {'key': 'dist', 'type': 'float'}, - 'info': {'key': 'info', 'type': 'str'}, - 'entity_type': {'key': 'entityType', 'type': 'str'}, - 'point_of_interest': {'key': 'poi', 'type': 'PointOfInterest'}, - 'address': {'key': 'address', 'type': 'Address'}, - 'position': {'key': 'position', 'type': 'LatLongPairAbbreviated'}, - 'viewport': {'key': 'viewport', 'type': 'BoundingBox'}, - 'entry_points': {'key': 'entryPoints', 'type': '[EntryPoint]'}, - 'address_ranges': {'key': 'addressRanges', 'type': 'AddressRanges'}, - 'data_sources': {'key': 'dataSources', 'type': 'DataSource'}, - 'match_type': {'key': 'matchType', 'type': 'str'}, - 'detour_time': {'key': 'detourTime', 'type': 'int'}, - } - - def __init__( - self, - *, - entity_type: Optional[Union[str, "GeographicEntityType"]] = None, - position: Optional["LatLongPairAbbreviated"] = None, - **kwargs - ): - super(SearchAddressResultItem, self).__init__(**kwargs) - self.type = None - self.id = None - self.score = None - self.distance_in_meters = None - self.info = None - self.entity_type = entity_type - self.point_of_interest = None - self.address = None - self.position = position - self.viewport = None - self.entry_points = None - self.address_ranges = None - self.data_sources = None - self.match_type = None - self.detour_time = None - - -class SearchAlongRouteRequest(msrest.serialization.Model): - """This type represents the request body for the Search Along Route service. - - :param route: A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 - `__ for details. - :type route: ~azure.maps.search.models.GeoJsonLineString - """ - - _attribute_map = { - 'route': {'key': 'route', 'type': 'GeoJsonLineString'}, - } - - def __init__( - self, - *, - route: Optional["GeoJsonLineString"] = None, - **kwargs - ): - super(SearchAlongRouteRequest, self).__init__(**kwargs) - self.route = route - - -class SearchInsideGeometryRequest(msrest.serialization.Model): - """This type represents the request body for the Search Inside Geometry service. - - :param geometry: A valid ``GeoJSON`` object. Please refer to `RFC 7946 - `__ for details. - :type geometry: ~azure.maps.search.models.GeoJsonObject - """ - - _attribute_map = { - 'geometry': {'key': 'geometry', 'type': 'GeoJsonObject'}, - } - - def __init__( - self, - *, - geometry: Optional["GeoJsonObject"] = None, - **kwargs - ): - super(SearchInsideGeometryRequest, self).__init__(**kwargs) - self.geometry = geometry - - -class SearchSummary(msrest.serialization.Model): - """Summary object for a Search API response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar query: The query parameter that was used to produce these search results. - :vartype query: str - :ivar query_type: The type of query being returned: NEARBY or NON_NEAR. Possible values - include: "NEARBY", "NON_NEAR". - :vartype query_type: str or ~azure.maps.search.models.QueryType - :ivar query_time: Time spent resolving the query, in milliseconds. - :vartype query_time: int - :ivar num_results: Number of results in the response. - :vartype num_results: int - :ivar top: Maximum number of responses that will be returned. - :vartype top: int - :ivar skip: The starting offset of the returned Results within the full Result set. - :vartype skip: int - :ivar total_results: The total number of Results found. - :vartype total_results: int - :ivar fuzzy_level: The maximum fuzzy level required to provide Results. - :vartype fuzzy_level: int - :ivar geo_bias: Indication when the internal search engine has applied a geospatial bias to - improve the ranking of results. In some methods, this can be affected by setting the lat and - lon parameters where available. In other cases it is purely internal. - :vartype geo_bias: ~azure.maps.search.models.LatLongPairAbbreviated - """ - - _validation = { - 'query': {'readonly': True}, - 'query_type': {'readonly': True}, - 'query_time': {'readonly': True}, - 'num_results': {'readonly': True}, - 'top': {'readonly': True}, - 'skip': {'readonly': True}, - 'total_results': {'readonly': True}, - 'fuzzy_level': {'readonly': True}, - 'geo_bias': {'readonly': True}, - } - - _attribute_map = { - 'query': {'key': 'query', 'type': 'str'}, - 'query_type': {'key': 'queryType', 'type': 'str'}, - 'query_time': {'key': 'queryTime', 'type': 'int'}, - 'num_results': {'key': 'numResults', 'type': 'int'}, - 'top': {'key': 'limit', 'type': 'int'}, - 'skip': {'key': 'offset', 'type': 'int'}, - 'total_results': {'key': 'totalResults', 'type': 'int'}, - 'fuzzy_level': {'key': 'fuzzyLevel', 'type': 'int'}, - 'geo_bias': {'key': 'geoBias', 'type': 'LatLongPairAbbreviated'}, - } - - def __init__( - self, - **kwargs - ): - super(SearchSummary, self).__init__(**kwargs) - self.query = None - self.query_type = None - self.query_time = None - self.num_results = None - self.top = None - self.skip = None - self.total_results = None - self.fuzzy_level = None - self.geo_bias = None - - -class Viewport(msrest.serialization.Model): - """The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. - - :param top_left_point: A location represented as a latitude and longitude using short names - 'lat' & 'lon'. - :type top_left_point: ~azure.maps.search.models.LatLongPairAbbreviated - :param btm_right_point: A location represented as a latitude and longitude using short names - 'lat' & 'lon'. - :type btm_right_point: ~azure.maps.search.models.LatLongPairAbbreviated - """ - - _attribute_map = { - 'top_left_point': {'key': 'topLeftPoint', 'type': 'LatLongPairAbbreviated'}, - 'btm_right_point': {'key': 'btmRightPoint', 'type': 'LatLongPairAbbreviated'}, - } - - def __init__( - self, - *, - top_left_point: Optional["LatLongPairAbbreviated"] = None, - btm_right_point: Optional["LatLongPairAbbreviated"] = None, - **kwargs - ): - super(Viewport, self).__init__(**kwargs) - self.top_left_point = top_left_point - self.btm_right_point = btm_right_point diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/models/_search_client_enums.py b/sdk/maps/azure-maps-search/azure/maps/search/_generated/models/_search_client_enums.py deleted file mode 100644 index 7652009df4b6c..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/models/_search_client_enums.py +++ /dev/null @@ -1,169 +0,0 @@ -# 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 enum import Enum, EnumMeta -from six import with_metaclass - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ElectricVehicleConnector(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - STANDARD_HOUSEHOLD_COUNTRY_SPECIFIC = "StandardHouseholdCountrySpecific" #: These are the standard household connectors for a certain region. They are all AC single phase and the standard Voltage and standard Amperage. - #See also: `Plug & socket types - World Standards `_. - IEC62196_TYPE1 = "IEC62196Type1" #: Type 1 connector as defined in the IEC 62196-2 standard. Also called Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. - IEC62196_TYPE1_CCS = "IEC62196Type1CCS" #: Type 1 based combo connector as defined in the IEC 62196-3 standard. The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with two additional direct current (DC) contacts to allow DC fast charging. - IEC62196_TYPE2_CABLE_ATTACHED = "IEC62196Type2CableAttached" #: Type 2 connector as defined in the IEC 62196-2 standard. Provided as a cable and plug attached to the charging point. - IEC62196_TYPE2_OUTLET = "IEC62196Type2Outlet" #: Type 2 connector as defined in the IEC 62196-2 standard. Provided as a socket set into the charging point. - IEC62196_TYPE2_CCS = "IEC62196Type2CCS" #: Type 2 based combo connector as defined in the IEC 62196-3 standard. The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with two additional direct current (DC) contacts to allow DC fast charging. - IEC62196_TYPE3 = "IEC62196Type3" #: Type 3 connector as defined in the IEC 62196-2 standard. Also called Scame after the original manufacturer. Mostly used in combination with up to 240V single phase or up to 420V three phase infrastructure. - CHADEMO = "Chademo" #: CHAdeMO connector named after an association formed by the Tokyo Electric Power Company and industrial partners. Because of this is is also known as the TEPCO's connector. It supports fast DC charging. - IEC60309_AC1_PHASE_BLUE = "IEC60309AC1PhaseBlue" #: Industrial Blue connector is a connector defined in the IEC 60309 standard. It is sometime referred to as by some combination of the standard, the color and the fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. - IEC60309_DC_WHITE = "IEC60309DCWhite" #: Industrial White connector is a DC connector defined in the IEC 60309 standard. - TESLA = "Tesla" #: The Tesla connector is the regionally specific Tesla Supercharger connector. I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. - -class EntryPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of entry point. Value can be either *main* or *minor*. - """ - - MAIN = "main" - MINOR = "minor" - -class GeographicEntityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - COUNTRY = "Country" - COUNTRY_SUBDIVISION = "CountrySubdivision" - COUNTRY_SECONDARY_SUBDIVISION = "CountrySecondarySubdivision" - COUNTRY_TERTIARY_SUBDIVISION = "CountryTertiarySubdivision" - MUNICIPALITY = "Municipality" - MUNICIPALITY_SUBDIVISION = "MunicipalitySubdivision" - NEIGHBOURHOOD = "Neighbourhood" - POSTAL_CODE_AREA = "PostalCodeArea" - -class GeoJsonObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON object types - Point, - MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature and - FeatureCollection. - """ - - GEO_JSON_POINT = "Point" #: ``GeoJSON Point`` geometry. - GEO_JSON_MULTI_POINT = "MultiPoint" #: ``GeoJSON MultiPoint`` geometry. - GEO_JSON_LINE_STRING = "LineString" #: ``GeoJSON LineString`` geometry. - GEO_JSON_MULTI_LINE_STRING = "MultiLineString" #: ``GeoJSON MultiLineString`` geometry. - GEO_JSON_POLYGON = "Polygon" #: ``GeoJSON Polygon`` geometry. - GEO_JSON_MULTI_POLYGON = "MultiPolygon" #: ``GeoJSON MultiPolygon`` geometry. - GEO_JSON_GEOMETRY_COLLECTION = "GeometryCollection" #: ``GeoJSON GeometryCollection`` geometry. - GEO_JSON_FEATURE = "Feature" #: ``GeoJSON Feature`` object. - GEO_JSON_FEATURE_COLLECTION = "FeatureCollection" #: ``GeoJSON FeatureCollection`` object. - -class JsonFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - JSON = "json" #: `The JavaScript Object Notation Data Interchange Format `_. - -class LocalizedMapView(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - AE = "AE" #: United Arab Emirates (Arabic View). - AR = "AR" #: Argentina (Argentinian View). - BH = "BH" #: Bahrain (Arabic View). - IN_ENUM = "IN" #: India (Indian View). - IQ = "IQ" #: Iraq (Arabic View). - JO = "JO" #: Jordan (Arabic View). - KW = "KW" #: Kuwait (Arabic View). - LB = "LB" #: Lebanon (Arabic View). - MA = "MA" #: Morocco (Moroccan View). - OM = "OM" #: Oman (Arabic View). - PK = "PK" #: Pakistan (Pakistani View). - PS = "PS" #: Palestinian Authority (Arabic View). - QA = "QA" #: Qatar (Arabic View). - SA = "SA" #: Saudi Arabia (Arabic View). - SY = "SY" #: Syria (Arabic View). - YE = "YE" #: Yemen (Arabic View). - AUTO = "Auto" #: Return the map data based on the IP address of the request. - UNIFIED = "Unified" #: Unified View (Others). - -class MatchType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Types of match for a reverse address search operation. - """ - - ADDRESS_POINT = "AddressPoint" - HOUSE_NUMBER_RANGE = "HouseNumberRange" - STREET = "Street" - -class OperatingHoursRange(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - NEXT_SEVEN_DAYS = "nextSevenDays" #: Shows the hours of operation for the next week, starting with the current day in the local time of the POI. - -class PointOfInterestExtendedPostalCodes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - POI = "POI" - NONE = "None" - -class QueryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of query being returned: NEARBY or NON_NEAR. - """ - - NEARBY = "NEARBY" #: Search was performed around a certain latitude and longitude with a defined radius. - GLOBAL_ENUM = "NON_NEAR" #: Search was performed globally, without biasing to a certain latitude and longitude, and no defined radius. - -class ResponseFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - JSON = "json" #: `The JavaScript Object Notation Data Interchange Format `_. - XML = "xml" #: `The Extensible Markup Language `_. - -class RoadUseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Describes the possible uses of a road. - """ - - LIMITED_ACCESS = "LimitedAccess" - ARTERIAL = "Arterial" - TERMINAL = "Terminal" - RAMP = "Ramp" - ROTARY = "Rotary" - LOCAL_STREET = "LocalStreet" - -class SearchAddressResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """One of: - - - * POI - * Street - * Geography - * Point Address - * Address Range - * Cross Street - """ - - POI = "POI" - STREET = "Street" - GEOGRAPHY = "Geography" - POINT_ADDRESS = "Point Address" - ADDRESS_RANGE = "Address Range" - CROSS_STREET = "Cross Street" - -class SearchIndexes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - ADDRESS = "Addr" #: Address range interpolation. - GEOGRAPHIES = "Geo" #: Geographies. - POINT_ADDRESSES = "PAD" #: Point Addresses. - POINTS_OF_INTEREST = "POI" #: Points of interest. - STREETS = "Str" #: Streets. - CROSS_STREETS = "Xstr" #: Cross Streets (Intersections). diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/operations/_search_operations.py b/sdk/maps/azure-maps-search/azure/maps/search/_generated/operations/_search_operations.py deleted file mode 100644 index e2381db473044..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/operations/_search_operations.py +++ /dev/null @@ -1,5292 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.polling.base_polling import LROBasePolling - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class SearchOperations(object): - """SearchOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.maps.search.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_polygons( - self, - geometry_ids, # type: List[str] - format="json", # type: Union[str, "models.JsonFormat"] - **kwargs # type: Any - ): - # type: (...) -> "models.PolygonResult" - """**Get Polygon** - - **Applies to**\ : S1 pricing tier. - - The Get Polygon service allows you to request the geometry data such as a city or country - outline for a set of entities, previously retrieved from an Online Search request in GeoJSON - format. The geometry ID is returned in the sourceGeometry object under "geometry" and "id" in - either a Search Address or Search Fuzzy call. - - Please note that any geometry ID retrieved from an Online Search endpoint has a limited - lifetime. The client should not store geometry IDs in persistent storage for later referral, - as the stability of these identifiers is not guaranteed for a long period of time. It is - expected that a request to the Polygon method is made within a few minutes of the request to - the Online Search method that provided the ID. The service allows for batch requests up to 20 - identifiers. - - :param geometry_ids: Comma separated list of geometry UUIDs, previously retrieved from an - Online Search request. - :type geometry_ids: list[str] - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PolygonResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.PolygonResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolygonResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.list_polygons.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['geometries'] = self._serialize.query("geometry_ids", geometry_ids, '[str]', div=',') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('PolygonResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list_polygons.metadata = {'url': '/search/polygon/{format}'} # type: ignore - - def fuzzy_search( - self, - query, # type: str - format="json", # type: Union[str, "models.ResponseFormat"] - is_type_ahead=None, # type: Optional[bool] - top=None, # type: Optional[int] - skip=None, # type: Optional[int] - category_filter=None, # type: Optional[List[int]] - country_filter=None, # type: Optional[List[str]] - lat=None, # type: Optional[float] - lon=None, # type: Optional[float] - radius_in_meters=None, # type: Optional[int] - top_left=None, # type: Optional[str] - btm_right=None, # type: Optional[str] - language=None, # type: Optional[str] - extended_postal_codes_for=None, # type: Optional[List[Union[str, "models.SearchIndexes"]]] - min_fuzzy_level=None, # type: Optional[int] - max_fuzzy_level=None, # type: Optional[int] - index_filter=None, # type: Optional[List[Union[str, "models.SearchIndexes"]]] - brand_filter=None, # type: Optional[List[str]] - electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "models.ElectricVehicleConnector"]]] - entity_type=None, # type: Optional[Union[str, "models.GeographicEntityType"]] - localized_map_view=None, # type: Optional[Union[str, "models.LocalizedMapView"]] - operating_hours=None, # type: Optional[Union[str, "models.OperatingHoursRange"]] - **kwargs # type: Any - ): - # type: (...) -> "models.SearchAddressResult" - """**Free Form Search** - - **Applies to**\ : S0 and S1 pricing tiers. - - The basic default API is Free Form Search which handles the most fuzzy of inputs handling any - combination of address or POI tokens. This search API is the canonical 'single line search'. - The Free Form Search API is a seamless combination of POI search and geocoding. The API can - also be weighted with a contextual position (lat./lon. pair), or fully constrained by a - coordinate and radius, or it can be executed more generally without any geo biasing anchor - point.:code:`
`:code:`
`We strongly advise you to use the 'countrySet' parameter to - specify only the countries for which your application needs coverage, as the default behavior - will be to search the entire world, potentially returning unnecessary - results.:code:`
`:code:`
` E.g.: ``countrySet``\ =US,FR :code:`
`:code:`
`Please - see `Search Coverage `_ for a complete list of all the supported countries.:code:`
`:code:`
`Most - Search queries default to ``maxFuzzyLevel``\ =2 to gain performance and also reduce unusual - results. This new default can be overridden as needed per request by passing in the query param - ``maxFuzzyLevel``\ =3 or 4. - - :param query: The applicable query string (e.g., "seattle", "pizza"). Can *also* be specified - as a comma separated string composed by latitude followed by longitude (e.g., "47.641268, - -122.125679"). Must be properly URL encoded. - :type query: str - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :type is_type_ahead: bool - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param skip: Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :type skip: int - :param category_filter: A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API `_. Usage - examples: - - - * - **categorySet=7315**\  (Search Points of Interest from category Restaurant) - - * - **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or - French Restaurant). - :type category_filter: list[int] - :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :type country_filter: list[str] - :param lat: Latitude where results should be biased. E.g. 37.337. - :type lat: float - :param lon: Longitude where results should be biased. E.g. -121.89. - :type lon: float - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area. - :type radius_in_meters: int - :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. - :type top_left: str - :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. - :type btm_right: str - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **Addr** = Address ranges - - **Geo** = Geographies - - **PAD** = Point Addresses - - **POI** = Points of Interest - - **Str** = Streets - - **XStr** = Cross Streets (intersections) - - Value should be a comma separated list of index types (in any order) or **None** for no - indexes. - - By default extended postal codes are included for all indexes except Geo. Extended postal code - lists for geographies can be quite long so they have to be explicitly requested when needed. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=PAD,Addr,POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] - :param min_fuzzy_level: Minimum fuzziness level to be used. Default: 1, minimum: 1 and maximum: - 4 - - - * - Level 1 has no spell checking. - - * - Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to - "restaurant." - - * - Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell - checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" - to "mountain view" matching. - - * - Level 4 doesn’t add any more spell checking functions. - - The search engine will start looking for a match on the level defined by minFuzzyLevel, and - will stop searching at the level specified by maxFuzzyLevel. - :type min_fuzzy_level: int - :param max_fuzzy_level: Maximum fuzziness level to be used. Default: 2, minimum: 1 and maximum: - 4 - - - * - Level 1 has no spell checking. - - * - Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to - "restaurant." - - * - Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell - checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" - to "mountain view" matching. - - * - Level 4 doesn’t add any more spell checking functions. - - The search engine will start looking for a match on the level defined by minFuzzyLevel, and - will stop searching at the level specified by maxFuzzyLevel. - :type max_fuzzy_level: int - :param index_filter: A comma separated list of indexes which should be utilized for the search. - Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = - Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross - Streets (intersections). - :type index_filter: list[str or ~azure.maps.search.models.SearchIndexes] - :param brand_filter: A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - - Usage examples: - - brandSet=Foo - - brandSet=Foo,Bar - - brandSet="A,B,C Comma",Bar. - :type brand_filter: list[str] - :param electric_vehicle_connector_filter: A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - - Available connector types are: - - - * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a - certain region. They are all AC single phase and the standard Voltage and standard Amperage. - See also: `Plug & socket types - World Standards - `_. - * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called - Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. - Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. - * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. - Provided as a cable and plug attached to the charging point. - * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided - as a socket set into the charging point. - * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called - Scame after the original manufacturer. Mostly used in combination with up to 240V single phase - or up to 420V three phase infrastructure. - * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric - Power Company and industrial partners. Because of this is is also known as the TEPCO's - connector. It supports fast DC charging. - * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 - standard. It is sometime referred to as by some combination of the standard, the color and the - fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. - * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 - standard. - * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. - I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port - mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. - - Usage examples: - - connectorSet=IEC62196Type2CableAttached - connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. - :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :param entity_type: Specifies the level of filtering performed on geographies. Narrows the - search for specified geography entity types, e.g. return only municipality. The resulting - response will contain the geography ID as well as the entity type matched. If you provide more - than one entity as a comma separated list, endpoint will return the 'smallest entity - available'. Returned Geometry ID can be used to get the geometry of that geography via `Get - Search Polygon `_ API. The - following parameters are ignored when entityType is set: - - - * heading - * number - * returnRoadUse - * returnSpeedLimit - * roadUse - * returnMatchType. - :type entity_type: str or ~azure.maps.search.models.GeographicEntityType - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.fuzzy_search.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, 'str') - if is_type_ahead is not None: - query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) - if category_filter is not None: - query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') - if country_filter is not None: - query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') - if lat is not None: - query_parameters['lat'] = self._serialize.query("lat", lat, 'float') - if lon is not None: - query_parameters['lon'] = self._serialize.query("lon", lon, 'float') - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if top_left is not None: - query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') - if btm_right is not None: - query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if min_fuzzy_level is not None: - query_parameters['minFuzzyLevel'] = self._serialize.query("min_fuzzy_level", min_fuzzy_level, 'int', maximum=4, minimum=1) - if max_fuzzy_level is not None: - query_parameters['maxFuzzyLevel'] = self._serialize.query("max_fuzzy_level", max_fuzzy_level, 'int', maximum=4, minimum=1) - if index_filter is not None: - query_parameters['idxSet'] = self._serialize.query("index_filter", index_filter, '[str]', div=',') - if brand_filter is not None: - query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') - if electric_vehicle_connector_filter is not None: - query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') - if entity_type is not None: - query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - if operating_hours is not None: - query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - fuzzy_search.metadata = {'url': '/search/fuzzy/{format}'} # type: ignore - - def search_point_of_interest( - self, - query, # type: str - format="json", # type: Union[str, "models.ResponseFormat"] - is_type_ahead=None, # type: Optional[bool] - top=None, # type: Optional[int] - skip=None, # type: Optional[int] - category_filter=None, # type: Optional[List[int]] - country_filter=None, # type: Optional[List[str]] - lat=None, # type: Optional[float] - lon=None, # type: Optional[float] - radius_in_meters=None, # type: Optional[int] - top_left=None, # type: Optional[str] - btm_right=None, # type: Optional[str] - language=None, # type: Optional[str] - extended_postal_codes_for=None, # type: Optional[List[Union[str, "models.PointOfInterestExtendedPostalCodes"]]] - brand_filter=None, # type: Optional[List[str]] - electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "models.ElectricVehicleConnector"]]] - localized_map_view=None, # type: Optional[Union[str, "models.LocalizedMapView"]] - operating_hours=None, # type: Optional[Union[str, "models.OperatingHoursRange"]] - **kwargs # type: Any - ): - # type: (...) -> "models.SearchAddressResult" - """**Get POI by Name** - - **Applies to**\ : S0 and S1 pricing tiers. - - Points of Interest (POI) Search allows you to request POI results by name. Search supports - additional query parameters such as language and filtering results by area of interest driven - by country or bounding box. Endpoint will return only POI results matching the query string. - Response includes POI details such as address, coordinate location and category. - - :param query: The POI name to search for (e.g., "statue of liberty", "starbucks"), must be - properly URL encoded. - :type query: str - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :type is_type_ahead: bool - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param skip: Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :type skip: int - :param category_filter: A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API `_. Usage - examples: - - - * - **categorySet=7315**\  (Search Points of Interest from category Restaurant) - - * - **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or - French Restaurant). - :type category_filter: list[int] - :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :type country_filter: list[str] - :param lat: Latitude where results should be biased. E.g. 37.337. - :type lat: float - :param lon: Longitude where results should be biased. E.g. -121.89. - :type lon: float - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area. - :type radius_in_meters: int - :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. - :type top_left: str - :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. - :type btm_right: str - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **POI** = Points of Interest - - Value should be **POI** or **None** to disable extended postal codes. - - By default extended postal codes are included. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.PointOfInterestExtendedPostalCodes] - :param brand_filter: A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - - Usage examples: - - brandSet=Foo - - brandSet=Foo,Bar - - brandSet="A,B,C Comma",Bar. - :type brand_filter: list[str] - :param electric_vehicle_connector_filter: A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - - Available connector types are: - - - * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a - certain region. They are all AC single phase and the standard Voltage and standard Amperage. - See also: `Plug & socket types - World Standards - `_. - * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called - Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. - Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. - * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. - Provided as a cable and plug attached to the charging point. - * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided - as a socket set into the charging point. - * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called - Scame after the original manufacturer. Mostly used in combination with up to 240V single phase - or up to 420V three phase infrastructure. - * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric - Power Company and industrial partners. Because of this is is also known as the TEPCO's - connector. It supports fast DC charging. - * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 - standard. It is sometime referred to as by some combination of the standard, the color and the - fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. - * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 - standard. - * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. - I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port - mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. - - Usage examples: - - connectorSet=IEC62196Type2CableAttached - connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. - :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.search_point_of_interest.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, 'str') - if is_type_ahead is not None: - query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) - if category_filter is not None: - query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') - if country_filter is not None: - query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') - if lat is not None: - query_parameters['lat'] = self._serialize.query("lat", lat, 'float') - if lon is not None: - query_parameters['lon'] = self._serialize.query("lon", lon, 'float') - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if top_left is not None: - query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') - if btm_right is not None: - query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if brand_filter is not None: - query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') - if electric_vehicle_connector_filter is not None: - query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - if operating_hours is not None: - query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_point_of_interest.metadata = {'url': '/search/poi/{format}'} # type: ignore - - def search_nearby_point_of_interest( - self, - lat, # type: float - lon, # type: float - format="json", # type: Union[str, "models.ResponseFormat"] - top=None, # type: Optional[int] - skip=None, # type: Optional[int] - category_filter=None, # type: Optional[List[int]] - country_filter=None, # type: Optional[List[str]] - radius_in_meters=None, # type: Optional[int] - language=None, # type: Optional[str] - extended_postal_codes_for=None, # type: Optional[List[Union[str, "models.SearchIndexes"]]] - brand_filter=None, # type: Optional[List[str]] - electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "models.ElectricVehicleConnector"]]] - localized_map_view=None, # type: Optional[Union[str, "models.LocalizedMapView"]] - **kwargs # type: Any - ): - # type: (...) -> "models.SearchAddressResult" - """**Nearby Search** - - **Applies to**\ : S0 and S1 pricing tiers. - - If you have a use case for only retrieving POI results around a specific location, the nearby - search method may be the right choice. This endpoint will only return POI results, and does not - take in a search query parameter. - - :param lat: Latitude where results should be biased. E.g. 37.337. - :type lat: float - :param lon: Longitude where results should be biased. E.g. -121.89. - :type lon: float - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param skip: Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :type skip: int - :param category_filter: A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API `_. Usage - examples: - - - * - **categorySet=7315**\  (Search Points of Interest from category Restaurant) - - * - **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or - French Restaurant). - :type category_filter: list[int] - :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :type country_filter: list[str] - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area, Min value is 1, Max Value is 50000. - :type radius_in_meters: int - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **Addr** = Address ranges - - **Geo** = Geographies - - **PAD** = Point Addresses - - **POI** = Points of Interest - - **Str** = Streets - - **XStr** = Cross Streets (intersections) - - Value should be a comma separated list of index types (in any order) or **None** for no - indexes. - - By default extended postal codes are included for all indexes except Geo. Extended postal code - lists for geographies can be quite long so they have to be explicitly requested when needed. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=PAD,Addr,POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] - :param brand_filter: A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - - Usage examples: - - brandSet=Foo - - brandSet=Foo,Bar - - brandSet="A,B,C Comma",Bar. - :type brand_filter: list[str] - :param electric_vehicle_connector_filter: A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - - Available connector types are: - - - * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a - certain region. They are all AC single phase and the standard Voltage and standard Amperage. - See also: `Plug & socket types - World Standards - `_. - * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called - Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. - Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. - * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. - Provided as a cable and plug attached to the charging point. - * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided - as a socket set into the charging point. - * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called - Scame after the original manufacturer. Mostly used in combination with up to 240V single phase - or up to 420V three phase infrastructure. - * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric - Power Company and industrial partners. Because of this is is also known as the TEPCO's - connector. It supports fast DC charging. - * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 - standard. It is sometime referred to as by some combination of the standard, the color and the - fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. - * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 - standard. - * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. - I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port - mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. - - Usage examples: - - connectorSet=IEC62196Type2CableAttached - connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. - :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.search_nearby_point_of_interest.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['lat'] = self._serialize.query("lat", lat, 'float') - query_parameters['lon'] = self._serialize.query("lon", lon, 'float') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) - if category_filter is not None: - query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') - if country_filter is not None: - query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if brand_filter is not None: - query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') - if electric_vehicle_connector_filter is not None: - query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_nearby_point_of_interest.metadata = {'url': '/search/nearby/{format}'} # type: ignore - - def search_point_of_interest_category( - self, - query, # type: str - format="json", # type: Union[str, "models.ResponseFormat"] - is_type_ahead=None, # type: Optional[bool] - top=None, # type: Optional[int] - skip=None, # type: Optional[int] - category_filter=None, # type: Optional[List[int]] - country_filter=None, # type: Optional[List[str]] - lat=None, # type: Optional[float] - lon=None, # type: Optional[float] - radius_in_meters=None, # type: Optional[int] - top_left=None, # type: Optional[str] - btm_right=None, # type: Optional[str] - language=None, # type: Optional[str] - extended_postal_codes_for=None, # type: Optional[List[Union[str, "models.SearchIndexes"]]] - brand_filter=None, # type: Optional[List[str]] - electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "models.ElectricVehicleConnector"]]] - localized_map_view=None, # type: Optional[Union[str, "models.LocalizedMapView"]] - operating_hours=None, # type: Optional[Union[str, "models.OperatingHoursRange"]] - **kwargs # type: Any - ): - # type: (...) -> "models.SearchAddressResult" - """**Get POI by Category** - - **Applies to**\ : S0 and S1 pricing tiers. - - Points of Interest (POI) Category Search allows you to request POI results from given category. - Search allows to query POIs from one category at a time. Endpoint will only return POI results - which are categorized as specified. Response includes POI details such as address, coordinate - location and classification. - - :param query: The POI category to search for (e.g., "AIRPORT", "RESTAURANT"), must be properly - URL encoded. Supported main categories can be requested by calling `Get Search POI Category - Tree API `_. List of available categories can also be - found `here `_. We - recommend to use POI Search Category Tree API to request the supported categories. - :type query: str - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :type is_type_ahead: bool - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param skip: Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :type skip: int - :param category_filter: A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API `_. Usage - examples: - - - * - **categorySet=7315**\  (Search Points of Interest from category Restaurant) - - * - **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or - French Restaurant). - :type category_filter: list[int] - :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :type country_filter: list[str] - :param lat: Latitude where results should be biased. E.g. 37.337. - :type lat: float - :param lon: Longitude where results should be biased. E.g. -121.89. - :type lon: float - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area. - :type radius_in_meters: int - :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. - :type top_left: str - :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. - :type btm_right: str - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **Addr** = Address ranges - - **Geo** = Geographies - - **PAD** = Point Addresses - - **POI** = Points of Interest - - **Str** = Streets - - **XStr** = Cross Streets (intersections) - - Value should be a comma separated list of index types (in any order) or **None** for no - indexes. - - By default extended postal codes are included for all indexes except Geo. Extended postal code - lists for geographies can be quite long so they have to be explicitly requested when needed. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=PAD,Addr,POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] - :param brand_filter: A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - - Usage examples: - - brandSet=Foo - - brandSet=Foo,Bar - - brandSet="A,B,C Comma",Bar. - :type brand_filter: list[str] - :param electric_vehicle_connector_filter: A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - - Available connector types are: - - - * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a - certain region. They are all AC single phase and the standard Voltage and standard Amperage. - See also: `Plug & socket types - World Standards - `_. - * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called - Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. - Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. - * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. - Provided as a cable and plug attached to the charging point. - * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided - as a socket set into the charging point. - * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called - Scame after the original manufacturer. Mostly used in combination with up to 240V single phase - or up to 420V three phase infrastructure. - * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric - Power Company and industrial partners. Because of this is is also known as the TEPCO's - connector. It supports fast DC charging. - * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 - standard. It is sometime referred to as by some combination of the standard, the color and the - fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. - * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 - standard. - * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. - I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port - mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. - - Usage examples: - - connectorSet=IEC62196Type2CableAttached - connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. - :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.search_point_of_interest_category.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, 'str') - if is_type_ahead is not None: - query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) - if category_filter is not None: - query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') - if country_filter is not None: - query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') - if lat is not None: - query_parameters['lat'] = self._serialize.query("lat", lat, 'float') - if lon is not None: - query_parameters['lon'] = self._serialize.query("lon", lon, 'float') - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if top_left is not None: - query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') - if btm_right is not None: - query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if brand_filter is not None: - query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') - if electric_vehicle_connector_filter is not None: - query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - if operating_hours is not None: - query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_point_of_interest_category.metadata = {'url': '/search/poi/category/{format}'} # type: ignore - - def get_point_of_interest_category_tree( - self, - format="json", # type: Union[str, "models.JsonFormat"] - language=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "models.PointOfInterestCategoryTreeResult" - """**Get POI Category Tree** - - **Applies to**\ : S0 and S1 pricing tiers. - - POI Category API provides a full list of supported Points of Interest (POI) categories and - subcategories together with their translations and synonyms. The returned content can be used - to provide more meaningful results through other Search Service APIs, like `Get Search POI - `_. - - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, except NGT and NGT-Latn. Language tag is case insensitive. When - data in specified language is not available for a specific field, default language is used - (English). - - Please refer to `Supported Languages `_ for details. - :type language: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PointOfInterestCategoryTreeResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.PointOfInterestCategoryTreeResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PointOfInterestCategoryTreeResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.get_point_of_interest_category_tree.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('PointOfInterestCategoryTreeResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_point_of_interest_category_tree.metadata = {'url': '/search/poi/category/tree/{format}'} # type: ignore - - def search_address( - self, - query, # type: str - format="json", # type: Union[str, "models.ResponseFormat"] - is_type_ahead=None, # type: Optional[bool] - top=None, # type: Optional[int] - skip=None, # type: Optional[int] - country_filter=None, # type: Optional[List[str]] - lat=None, # type: Optional[float] - lon=None, # type: Optional[float] - radius_in_meters=None, # type: Optional[int] - top_left=None, # type: Optional[str] - btm_right=None, # type: Optional[str] - language=None, # type: Optional[str] - extended_postal_codes_for=None, # type: Optional[List[Union[str, "models.SearchIndexes"]]] - entity_type=None, # type: Optional[Union[str, "models.GeographicEntityType"]] - localized_map_view=None, # type: Optional[Union[str, "models.LocalizedMapView"]] - **kwargs # type: Any - ): - # type: (...) -> "models.SearchAddressResult" - """**Address Geocoding** - - **Applies to**\ : S0 and S1 pricing tiers. - - In many cases, the complete search service might be too much, for instance if you are only - interested in traditional geocoding. Search can also be accessed for address look up - exclusively. The geocoding is performed by hitting the geocode endpoint with just the address - or partial address in question. The geocoding search index will be queried for everything above - the street level data. No POIs will be returned. Note that the geocoder is very tolerant of - typos and incomplete addresses. It will also handle everything from exact street addresses or - street or intersections as well as higher level geographies such as city centers, counties, - states etc. - - :param query: The address to search for (e.g., "1 Microsoft way, Redmond, WA"), must be - properly URL encoded. - :type query: str - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :type is_type_ahead: bool - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param skip: Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :type skip: int - :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :type country_filter: list[str] - :param lat: Latitude where results should be biased. E.g. 37.337. - :type lat: float - :param lon: Longitude where results should be biased. E.g. -121.89. - :type lon: float - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area. - :type radius_in_meters: int - :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. - :type top_left: str - :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. - :type btm_right: str - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **Addr** = Address ranges - - **Geo** = Geographies - - **PAD** = Point Addresses - - **POI** = Points of Interest - - **Str** = Streets - - **XStr** = Cross Streets (intersections) - - Value should be a comma separated list of index types (in any order) or **None** for no - indexes. - - By default extended postal codes are included for all indexes except Geo. Extended postal code - lists for geographies can be quite long so they have to be explicitly requested when needed. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=PAD,Addr,POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] - :param entity_type: Specifies the level of filtering performed on geographies. Narrows the - search for specified geography entity types, e.g. return only municipality. The resulting - response will contain the geography ID as well as the entity type matched. If you provide more - than one entity as a comma separated list, endpoint will return the 'smallest entity - available'. Returned Geometry ID can be used to get the geometry of that geography via `Get - Search Polygon `_ API. The - following parameters are ignored when entityType is set: - - - * heading - * number - * returnRoadUse - * returnSpeedLimit - * roadUse - * returnMatchType. - :type entity_type: str or ~azure.maps.search.models.GeographicEntityType - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.search_address.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, 'str') - if is_type_ahead is not None: - query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) - if country_filter is not None: - query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') - if lat is not None: - query_parameters['lat'] = self._serialize.query("lat", lat, 'float') - if lon is not None: - query_parameters['lon'] = self._serialize.query("lon", lon, 'float') - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if top_left is not None: - query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') - if btm_right is not None: - query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if entity_type is not None: - query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_address.metadata = {'url': '/search/address/{format}'} # type: ignore - - def reverse_search_address( - self, - query, # type: List[float] - format="json", # type: Union[str, "models.ResponseFormat"] - language=None, # type: Optional[str] - include_speed_limit=None, # type: Optional[bool] - heading=None, # type: Optional[int] - radius_in_meters=None, # type: Optional[int] - number=None, # type: Optional[str] - include_road_use=None, # type: Optional[bool] - road_use=None, # type: Optional[List[Union[str, "models.RoadUseType"]]] - allow_freeform_newline=None, # type: Optional[bool] - include_match_type=None, # type: Optional[bool] - entity_type=None, # type: Optional[Union[str, "models.GeographicEntityType"]] - localized_map_view=None, # type: Optional[Union[str, "models.LocalizedMapView"]] - **kwargs # type: Any - ): - # type: (...) -> "models.ReverseSearchAddressResult" - """**Reverse Geocode to an Address** - - **Applies to**\ : S0 and S1 pricing tiers. - - There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) - into a human understandable street address. Most often this is needed in tracking applications - where you receive a GPS feed from the device or asset and wish to know what address where the - coordinate is located. This endpoint will return address information for a given coordinate. - - :param query: The applicable query specified as a comma separated string composed by latitude - followed by longitude e.g. "47.641268,-122.125679". - :type query: list[float] - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param include_speed_limit: Boolean. To enable return of the posted speed limit. - :type include_speed_limit: bool - :param heading: The directional heading of the vehicle in degrees, for travel along a segment - of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can - include upto one decimal place. - :type heading: int - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area. - :type radius_in_meters: int - :param number: If a number is sent in along with the request, the response may include the side - of the street (Left/Right) and also an offset position for that number. - :type number: str - :param include_road_use: Boolean. To enable return of the road use array for reverse geocodes - at street level. - :type include_road_use: bool - :param road_use: To restrict reverse geocodes to a certain type of road use. The road use array - for reverse geocodes can be one or more of LimitedAccess, Arterial, Terminal, Ramp, Rotary, - LocalStreet. - :type road_use: list[str or ~azure.maps.search.models.RoadUseType] - :param allow_freeform_newline: Format of newlines in the formatted address. - - If true, the address will contain newlines. - If false, newlines will be converted to commas. - :type allow_freeform_newline: bool - :param include_match_type: Include information on the type of match the geocoder achieved in - the response. - :type include_match_type: bool - :param entity_type: Specifies the level of filtering performed on geographies. Narrows the - search for specified geography entity types, e.g. return only municipality. The resulting - response will contain the geography ID as well as the entity type matched. If you provide more - than one entity as a comma separated list, endpoint will return the 'smallest entity - available'. Returned Geometry ID can be used to get the geometry of that geography via `Get - Search Polygon `_ API. The - following parameters are ignored when entityType is set: - - - * heading - * number - * returnRoadUse - * returnSpeedLimit - * roadUse - * returnMatchType. - :type entity_type: str or ~azure.maps.search.models.GeographicEntityType - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReverseSearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.ReverseSearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ReverseSearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.reverse_search_address.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, '[float]', div=',') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if include_speed_limit is not None: - query_parameters['returnSpeedLimit'] = self._serialize.query("include_speed_limit", include_speed_limit, 'bool') - if heading is not None: - query_parameters['heading'] = self._serialize.query("heading", heading, 'int', maximum=360, minimum=-360) - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if number is not None: - query_parameters['number'] = self._serialize.query("number", number, 'str') - if include_road_use is not None: - query_parameters['returnRoadUse'] = self._serialize.query("include_road_use", include_road_use, 'bool') - if road_use is not None: - query_parameters['roadUse'] = self._serialize.query("road_use", road_use, '[str]', div=',') - if allow_freeform_newline is not None: - query_parameters['allowFreeformNewline'] = self._serialize.query("allow_freeform_newline", allow_freeform_newline, 'bool') - if include_match_type is not None: - query_parameters['returnMatchType'] = self._serialize.query("include_match_type", include_match_type, 'bool') - if entity_type is not None: - query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('ReverseSearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - reverse_search_address.metadata = {'url': '/search/address/reverse/{format}'} # type: ignore - - def reverse_search_cross_street_address( - self, - query, # type: List[float] - format="json", # type: Union[str, "models.ResponseFormat"] - top=None, # type: Optional[int] - heading=None, # type: Optional[int] - radius_in_meters=None, # type: Optional[int] - language=None, # type: Optional[str] - localized_map_view=None, # type: Optional[Union[str, "models.LocalizedMapView"]] - **kwargs # type: Any - ): - # type: (...) -> "models.ReverseSearchCrossStreetAddressResult" - """**Reverse Geocode to a Cross Street** - - **Applies to**\ : S0 and S1 pricing tiers. - - There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) - into a human understandable cross street. Most often this is needed in tracking applications - where you receive a GPS feed from the device or asset and wish to know what address where the - coordinate is located. - This endpoint will return cross street information for a given coordinate. - - :param query: The applicable query specified as a comma separated string composed by latitude - followed by longitude e.g. "47.641268,-122.125679". - :type query: list[float] - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param heading: The directional heading of the vehicle in degrees, for travel along a segment - of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can - include upto one decimal place. - :type heading: int - :param radius_in_meters: The radius in meters to for the results to be constrained to the - defined area. - :type radius_in_meters: int - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReverseSearchCrossStreetAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.ReverseSearchCrossStreetAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ReverseSearchCrossStreetAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.reverse_search_cross_street_address.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, '[float]', div=',') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if heading is not None: - query_parameters['heading'] = self._serialize.query("heading", heading, 'int', maximum=360, minimum=-360) - if radius_in_meters is not None: - query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('ReverseSearchCrossStreetAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - reverse_search_cross_street_address.metadata = {'url': '/search/address/reverse/crossStreet/{format}'} # type: ignore - - def search_structured_address( - self, - format="json", # type: Union[str, "models.ResponseFormat"] - language=None, # type: Optional[str] - country_code="US", # type: str - top=None, # type: Optional[int] - skip=None, # type: Optional[int] - street_number=None, # type: Optional[str] - street_name=None, # type: Optional[str] - cross_street=None, # type: Optional[str] - municipality=None, # type: Optional[str] - municipality_subdivision=None, # type: Optional[str] - country_tertiary_subdivision=None, # type: Optional[str] - country_secondary_subdivision=None, # type: Optional[str] - country_subdivision=None, # type: Optional[str] - postal_code=None, # type: Optional[str] - extended_postal_codes_for=None, # type: Optional[List[Union[str, "models.SearchIndexes"]]] - entity_type=None, # type: Optional[Union[str, "models.GeographicEntityType"]] - localized_map_view=None, # type: Optional[Union[str, "models.LocalizedMapView"]] - **kwargs # type: Any - ): - # type: (...) -> "models.SearchAddressResult" - """**Structured Address Geocoding** - - **Applies to**\ : S0 and S1 pricing tiers. - - Azure Address Geocoding can also be accessed for structured address look up exclusively. The - geocoding search index will be queried for everything above the street level data. No POIs - will be returned. Note that the geocoder is very tolerant of typos and incomplete addresses. - It will also handle everything from exact street addresses or street or intersections as well - as higher level geographies such as city centers, counties, states etc. - - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param country_code: The 2 or 3 letter `ISO3166-1 `_ country code portion of an address. E.g. US. - :type country_code: str - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param skip: Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :type skip: int - :param street_number: The street number portion of an address. - :type street_number: str - :param street_name: The street name portion of an address. - :type street_name: str - :param cross_street: The cross street name for the structured address. - :type cross_street: str - :param municipality: The municipality portion of an address. - :type municipality: str - :param municipality_subdivision: The municipality subdivision (sub/super city) for the - structured address. - :type municipality_subdivision: str - :param country_tertiary_subdivision: The named area for the structured address. - :type country_tertiary_subdivision: str - :param country_secondary_subdivision: The county for the structured address. - :type country_secondary_subdivision: str - :param country_subdivision: The country subdivision portion of an address. - :type country_subdivision: str - :param postal_code: The postal code portion of an address. - :type postal_code: str - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **Addr** = Address ranges - - **Geo** = Geographies - - **PAD** = Point Addresses - - **POI** = Points of Interest - - **Str** = Streets - - **XStr** = Cross Streets (intersections) - - Value should be a comma separated list of index types (in any order) or **None** for no - indexes. - - By default extended postal codes are included for all indexes except Geo. Extended postal code - lists for geographies can be quite long so they have to be explicitly requested when needed. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=PAD,Addr,POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] - :param entity_type: Specifies the level of filtering performed on geographies. Narrows the - search for specified geography entity types, e.g. return only municipality. The resulting - response will contain the geography ID as well as the entity type matched. If you provide more - than one entity as a comma separated list, endpoint will return the 'smallest entity - available'. Returned Geometry ID can be used to get the geometry of that geography via `Get - Search Polygon `_ API. The - following parameters are ignored when entityType is set: - - - * heading - * number - * returnRoadUse - * returnSpeedLimit - * roadUse - * returnMatchType. - :type entity_type: str or ~azure.maps.search.models.GeographicEntityType - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self.search_structured_address.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - query_parameters['countryCode'] = self._serialize.query("country_code", country_code, 'str') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if skip is not None: - query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) - if street_number is not None: - query_parameters['streetNumber'] = self._serialize.query("street_number", street_number, 'str') - if street_name is not None: - query_parameters['streetName'] = self._serialize.query("street_name", street_name, 'str') - if cross_street is not None: - query_parameters['crossStreet'] = self._serialize.query("cross_street", cross_street, 'str') - if municipality is not None: - query_parameters['municipality'] = self._serialize.query("municipality", municipality, 'str') - if municipality_subdivision is not None: - query_parameters['municipalitySubdivision'] = self._serialize.query("municipality_subdivision", municipality_subdivision, 'str') - if country_tertiary_subdivision is not None: - query_parameters['countryTertiarySubdivision'] = self._serialize.query("country_tertiary_subdivision", country_tertiary_subdivision, 'str') - if country_secondary_subdivision is not None: - query_parameters['countrySecondarySubdivision'] = self._serialize.query("country_secondary_subdivision", country_secondary_subdivision, 'str') - if country_subdivision is not None: - query_parameters['countrySubdivision'] = self._serialize.query("country_subdivision", country_subdivision, 'str') - if postal_code is not None: - query_parameters['postalCode'] = self._serialize.query("postal_code", postal_code, 'str') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if entity_type is not None: - query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_structured_address.metadata = {'url': '/search/address/structured/{format}'} # type: ignore - - def search_inside_geometry( - self, - query, # type: str - geometry, # type: "models.SearchInsideGeometryRequest" - format="json", # type: Union[str, "models.ResponseFormat"] - top=None, # type: Optional[int] - language=None, # type: Optional[str] - category_filter=None, # type: Optional[List[int]] - extended_postal_codes_for=None, # type: Optional[List[Union[str, "models.SearchIndexes"]]] - index_filter=None, # type: Optional[List[Union[str, "models.SearchIndexes"]]] - localized_map_view=None, # type: Optional[Union[str, "models.LocalizedMapView"]] - operating_hours=None, # type: Optional[Union[str, "models.OperatingHoursRange"]] - **kwargs # type: Any - ): - # type: (...) -> "models.SearchAddressResult" - """**Applies to**\ : S0 and S1 pricing tiers. - - The Search Geometry endpoint allows you to perform a free form search inside a single geometry - or many of them. The search results that fall inside the geometry/geometries will be - returned.:code:`
`:code:`
`To send the geometry you will use a ``POST`` request where the - request body will contain the ``geometry`` object represented as a ``GeoJSON`` type and the - ``Content-Type`` header will be set to ``application/json``. The geographical features to be - searched can be modeled as Polygon and/or Circle geometries represented using any one of the - following ``GeoJSON`` types::code:`
  • **GeoJSON FeatureCollection**
    The `geometry` can - be represented as a `GeoJSON FeatureCollection` object. This is the recommended option if the - geometry contains both Polygons and Circles. The `FeatureCollection` can contain a max of 50 - `GeoJSON Feature` objects. Each `Feature` object should represent either a Polygon or a Circle - with the following conditions:
    • A `Feature` object for the - Polygon geometry can have a max of 50 coordinates and it's properties must be empty.
    • A - `Feature` object for the Circle geometry is composed of a _center_ represented using a `GeoJSON - Point` type and a _radius_ value (in meters) which must be specified in the object's properties - along with the _subType_ property whose value should be 'Circle'.
    `:code:`
    ` Please - see the Examples section below for a sample ``FeatureCollection`` - representation.:code:`
    `:code:`
    `
  • :code:`
  • **GeoJSON GeometryCollection**
    The - `geometry` can be represented as a `GeoJSON GeometryCollection` object. This is the recommended - option if the geometry contains a list of Polygons only. The `GeometryCollection` can contain a - max of 50 `GeoJSON Polygon` objects. Each `Polygon` object can have a max of 50 coordinates. - Please see the Examples section below for a sample `GeometryCollection` - representation.

  • `:code:`
  • **GeoJSON Polygon**
    The `geometry` can be - represented as a `GeoJSON Polygon` object. This is the recommended option if the geometry - contains a single Polygon. The `Polygon` object can have a max of 50 coordinates. Please see - the Examples section below for a sample `Polygon` - representation.

  • `
.:code:`
`:code:`
`. - - :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). - Must be properly URL encoded. - :type query: str - :param geometry: This represents the geometry for one or more geographical features (parks, - state boundary etc.) to search in and should be a GeoJSON compliant type. Please refer to `RFC - 7946 `_ for details. - :type geometry: ~azure.maps.search.models.SearchInsideGeometryRequest - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :type top: int - :param language: Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - - Please refer to `Supported Languages `_ for details. - :type language: str - :param category_filter: A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API `_. Usage - examples: - - - * - **categorySet=7315**\  (Search Points of Interest from category Restaurant) - - * - **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or - French Restaurant). - :type category_filter: list[int] - :param extended_postal_codes_for: Indexes for which extended postal codes should be included in - the results. - - Available indexes are: - - **Addr** = Address ranges - - **Geo** = Geographies - - **PAD** = Point Addresses - - **POI** = Points of Interest - - **Str** = Streets - - **XStr** = Cross Streets (intersections) - - Value should be a comma separated list of index types (in any order) or **None** for no - indexes. - - By default extended postal codes are included for all indexes except Geo. Extended postal code - lists for geographies can be quite long so they have to be explicitly requested when needed. - - Usage examples: - - extendedPostalCodesFor=POI - - extendedPostalCodesFor=PAD,Addr,POI - - extendedPostalCodesFor=None - - Extended postal code is returned as an **extendedPostalCode** property of an address. - Availability is region-dependent. - :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] - :param index_filter: A comma separated list of indexes which should be utilized for the search. - Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = - Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross - Streets (intersections). - :type index_filter: list[str or ~azure.maps.search.models.SearchIndexes] - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.search_inside_geometry.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, 'str') - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') - if category_filter is not None: - query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') - if extended_postal_codes_for is not None: - query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') - if index_filter is not None: - query_parameters['idxSet'] = self._serialize.query("index_filter", index_filter, '[str]', div=',') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - if operating_hours is not None: - query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(geometry, 'SearchInsideGeometryRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_inside_geometry.metadata = {'url': '/search/geometry/{format}'} # type: ignore - - def search_along_route( - self, - query, # type: str - max_detour_time, # type: int - route, # type: "models.SearchAlongRouteRequest" - format="json", # type: Union[str, "models.ResponseFormat"] - top=None, # type: Optional[int] - brand_filter=None, # type: Optional[List[str]] - category_filter=None, # type: Optional[List[int]] - electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "models.ElectricVehicleConnector"]]] - localized_map_view=None, # type: Optional[Union[str, "models.LocalizedMapView"]] - operating_hours=None, # type: Optional[Union[str, "models.OperatingHoursRange"]] - **kwargs # type: Any - ): - # type: (...) -> "models.SearchAddressResult" - """**Applies to**\ : S0 and S1 pricing tiers. - - The Search Along Route endpoint allows you to perform a fuzzy search for POIs along a specified - route. This search is constrained by specifying the ``maxDetourTime`` limiting - measure.:code:`
`:code:`
`To send the route-points you will use a ``POST`` request where - the request body will contain the ``route`` object represented as a ``GeoJSON LineString`` type - and the ``Content-Type`` header will be set to ``application/json``. Each route-point in - ``route`` is represented as a ``GeoJSON Position`` type i.e. an array where the *longitude* - value is followed by the *latitude* value and the *altitude* value is ignored. The ``route`` - should contain at least 2 route-points.:code:`
`:code:`
`It is possible that original - route will be altered, some of it's points may be skipped. If the route that passes through the - found point is faster than the original one, the ``detourTime`` value in the response is - negative. - - :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). - Must be properly URL encoded. - :type query: str - :param max_detour_time: Maximum detour time of the point of interest in seconds. Max value is - 3600 seconds. - :type max_detour_time: int - :param route: This represents the route to search along and should be a valid ``GeoJSON - LineString`` type. Please refer to `RFC 7946 - `_ for details. - :type route: ~azure.maps.search.models.SearchAlongRouteRequest - :param format: Desired format of the response. Value can be either *json* or *xml*. - :type format: str or ~azure.maps.search.models.ResponseFormat - :param top: Maximum number of responses that will be returned. Default value is 10. Max value - is 20. - :type top: int - :param brand_filter: A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - - Usage examples: - - brandSet=Foo - - brandSet=Foo,Bar - - brandSet="A,B,C Comma",Bar. - :type brand_filter: list[str] - :param category_filter: A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API `_. Usage - examples: - - - * - **categorySet=7315**\  (Search Points of Interest from category Restaurant) - - * - **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or - French Restaurant). - :type category_filter: list[int] - :param electric_vehicle_connector_filter: A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - - Available connector types are: - - - * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a - certain region. They are all AC single phase and the standard Voltage and standard Amperage. - See also: `Plug & socket types - World Standards - `_. - * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called - Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. - Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. - * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. - Provided as a cable and plug attached to the charging point. - * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided - as a socket set into the charging point. - * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. - The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with - two additional direct current (DC) contacts to allow DC fast charging. - * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called - Scame after the original manufacturer. Mostly used in combination with up to 240V single phase - or up to 420V three phase infrastructure. - * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric - Power Company and industrial partners. Because of this is is also known as the TEPCO's - connector. It supports fast DC charging. - * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 - standard. It is sometime referred to as by some combination of the standard, the color and the - fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. - * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 - standard. - * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. - I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port - mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. - - Usage examples: - - connectorSet=IEC62196Type2CableAttached - connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. - :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :param localized_map_view: The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - - Please refer to `Supported Views `_ for details and - to see the available Views. - :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView - :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.search_along_route.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['query'] = self._serialize.query("query", query, 'str') - query_parameters['maxDetourTime'] = self._serialize.query("max_detour_time", max_detour_time, 'int', maximum=3600) - if top is not None: - query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=20) - if brand_filter is not None: - query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') - if category_filter is not None: - query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') - if electric_vehicle_connector_filter is not None: - query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') - if localized_map_view is not None: - query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') - if operating_hours is not None: - query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(route, 'SearchAlongRouteRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_along_route.metadata = {'url': '/search/alongRoute/{format}'} # type: ignore - - def fuzzy_search_batch_sync( - self, - batch_request, # type: "models.BatchRequest" - format="json", # type: Union[str, "models.JsonFormat"] - **kwargs # type: Any - ): - # type: (...) -> "models.SearchAddressBatchResult" - """**Search Fuzzy Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Fuzzy API - `_ using just a single API - call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription- - key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search fuzzy* queries you will use a ``POST`` request where the request body will - contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set - to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, - {"query": "?query=Statue Of Liberty&limit=2"}, - {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, - {"query": "?query=Space Needle"}, - {"query": "?query=pizza&limit=10"} - ] - } - - A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, - api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI - parameters `_. - The string values in the *search fuzzy* query must be properly escaped (e.g. " character should - be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription- - key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressResponse`` - `_ - If - the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "query": "atm" - }, - "results": [ - { - "type": "POI", - "poi": { - "name": "ATM at Wells Fargo" - }, - "address": { - "country": "United States Of America", - "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" - } - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "query": "statue of liberty" - }, - "results": [ - { - "type": "POI", - "poi": { - "name": "Statue of Liberty" - }, - "address": { - "country": "United States Of America", - "freeformAddress": "New York, NY 10004" - } - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_request: The list of search fuzzy queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type batch_request: ~azure.maps.search.models.BatchRequest - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressBatchResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressBatchResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressBatchResult"] - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 408: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.fuzzy_search_batch_sync.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(batch_request, 'BatchRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - fuzzy_search_batch_sync.metadata = {'url': '/search/fuzzy/batch/sync/{format}'} # type: ignore - - def _fuzzy_search_batch_initial( - self, - batch_request, # type: "models.BatchRequest" - format="json", # type: Union[str, "models.JsonFormat"] - **kwargs # type: Any - ): - # type: (...) -> Optional["models.SearchAddressBatchResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SearchAddressBatchResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._fuzzy_search_batch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(batch_request, 'BatchRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _fuzzy_search_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore - - def begin_fuzzy_search_batch( - self, - batch_request, # type: "models.BatchRequest" - format="json", # type: Union[str, "models.JsonFormat"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.SearchAddressBatchResult"] - """**Search Fuzzy Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Fuzzy API - `_ using just a single API - call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription- - key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search fuzzy* queries you will use a ``POST`` request where the request body will - contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set - to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, - {"query": "?query=Statue Of Liberty&limit=2"}, - {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, - {"query": "?query=Space Needle"}, - {"query": "?query=pizza&limit=10"} - ] - } - - A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, - api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI - parameters `_. - The string values in the *search fuzzy* query must be properly escaped (e.g. " character should - be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription- - key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressResponse`` - `_ - If - the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "query": "atm" - }, - "results": [ - { - "type": "POI", - "poi": { - "name": "ATM at Wells Fargo" - }, - "address": { - "country": "United States Of America", - "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" - } - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "query": "statue of liberty" - }, - "results": [ - { - "type": "POI", - "poi": { - "name": "Statue of Liberty" - }, - "address": { - "country": "United States Of America", - "freeformAddress": "New York, NY 10004" - } - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_request: The list of search fuzzy queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type batch_request: ~azure.maps.search.models.BatchRequest - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SearchAddressBatchResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressBatchResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._fuzzy_search_batch_initial( - batch_request=batch_request, - format=format, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - - if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_fuzzy_search_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore - - def _get_fuzzy_search_batch_initial( - self, - batch_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["models.SearchAddressBatchResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SearchAddressBatchResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self._get_fuzzy_search_batch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("batch_id", batch_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _get_fuzzy_search_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore - - def begin_get_fuzzy_search_batch( - self, - batch_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.SearchAddressBatchResult"] - """**Search Fuzzy Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Fuzzy API - `_ using just a single API - call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription- - key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search fuzzy* queries you will use a ``POST`` request where the request body will - contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set - to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, - {"query": "?query=Statue Of Liberty&limit=2"}, - {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, - {"query": "?query=Space Needle"}, - {"query": "?query=pizza&limit=10"} - ] - } - - A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, - api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI - parameters `_. - The string values in the *search fuzzy* query must be properly escaped (e.g. " character should - be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription- - key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressResponse`` - `_ - If - the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "query": "atm" - }, - "results": [ - { - "type": "POI", - "poi": { - "name": "ATM at Wells Fargo" - }, - "address": { - "country": "United States Of America", - "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" - } - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "query": "statue of liberty" - }, - "results": [ - { - "type": "POI", - "poi": { - "name": "Statue of Liberty" - }, - "address": { - "country": "United States Of America", - "freeformAddress": "New York, NY 10004" - } - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_id: Batch id for querying the operation. - :type batch_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SearchAddressBatchResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressBatchResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._get_fuzzy_search_batch_initial( - batch_id=batch_id, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'format': self._serialize.url("batch_id", batch_id, 'str'), - } - - if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_get_fuzzy_search_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore - - def search_address_batch_sync( - self, - batch_request, # type: "models.BatchRequest" - format="json", # type: Union[str, "models.JsonFormat"] - **kwargs # type: Any - ): - # type: (...) -> "models.SearchAddressBatchResult" - """**Search Address Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Address API - `_ using just a single API - call. You can call Search Address Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/address/batch/sync/json?api- - version=1.0&subscription-key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/address/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search address* queries you will use a ``POST`` request where the request body - will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will - be set to ``application/json``. Here's a sample request body containing 5 *search address* - queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, - {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, - {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, - {"query": "?query=Pike Pl, Seattle, WA - 98101&lat=47.610970&lon=-122.342469&radius=1000"}, - {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, - France&limit=1"} - ] - } - - A *search address* query in a batch is just a partial URL *without* the protocol, base URL, - path, api-version and subscription-key. It can accept any of the supported *search address* - `URI parameters `_. The string values in the *search address* query must be properly escaped (e.g. " - character should be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription- - key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressResponse`` - `_ - If - the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "query": "one microsoft way redmond wa 98052" - }, - "results": [ - { - "position": { - "lat": 47.63989, - "lon": -122.12509 - } - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "query": "pike pl seattle wa 98101" - }, - "results": [ - { - "position": { - "lat": 47.60963, - "lon": -122.34215 - } - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_request: The list of address geocoding queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type batch_request: ~azure.maps.search.models.BatchRequest - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SearchAddressBatchResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.SearchAddressBatchResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressBatchResult"] - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 408: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.search_address_batch_sync.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(batch_request, 'BatchRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - search_address_batch_sync.metadata = {'url': '/search/address/batch/sync/{format}'} # type: ignore - - def _search_address_batch_initial( - self, - batch_request, # type: "models.BatchRequest" - format="json", # type: Union[str, "models.JsonFormat"] - **kwargs # type: Any - ): - # type: (...) -> Optional["models.SearchAddressBatchResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SearchAddressBatchResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._search_address_batch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(batch_request, 'BatchRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore - - def begin_search_address_batch( - self, - batch_request, # type: "models.BatchRequest" - format="json", # type: Union[str, "models.JsonFormat"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.SearchAddressBatchResult"] - """**Search Address Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Address API - `_ using just a single API - call. You can call Search Address Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/address/batch/sync/json?api- - version=1.0&subscription-key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/address/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search address* queries you will use a ``POST`` request where the request body - will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will - be set to ``application/json``. Here's a sample request body containing 5 *search address* - queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, - {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, - {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, - {"query": "?query=Pike Pl, Seattle, WA - 98101&lat=47.610970&lon=-122.342469&radius=1000"}, - {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, - France&limit=1"} - ] - } - - A *search address* query in a batch is just a partial URL *without* the protocol, base URL, - path, api-version and subscription-key. It can accept any of the supported *search address* - `URI parameters `_. The string values in the *search address* query must be properly escaped (e.g. " - character should be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription- - key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressResponse`` - `_ - If - the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "query": "one microsoft way redmond wa 98052" - }, - "results": [ - { - "position": { - "lat": 47.63989, - "lon": -122.12509 - } - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "query": "pike pl seattle wa 98101" - }, - "results": [ - { - "position": { - "lat": 47.60963, - "lon": -122.34215 - } - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_request: The list of address geocoding queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type batch_request: ~azure.maps.search.models.BatchRequest - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SearchAddressBatchResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressBatchResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._search_address_batch_initial( - batch_request=batch_request, - format=format, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - - if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore - - def _get_search_address_batch_initial( - self, - batch_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["models.SearchAddressBatchResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.SearchAddressBatchResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self._get_search_address_batch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("batch_id", batch_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _get_search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore - - def begin_get_search_address_batch( - self, - batch_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.SearchAddressBatchResult"] - """**Search Address Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Address API - `_ using just a single API - call. You can call Search Address Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/address/batch/sync/json?api- - version=1.0&subscription-key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/address/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search address* queries you will use a ``POST`` request where the request body - will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will - be set to ``application/json``. Here's a sample request body containing 5 *search address* - queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, - {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, - {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, - {"query": "?query=Pike Pl, Seattle, WA - 98101&lat=47.610970&lon=-122.342469&radius=1000"}, - {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, - France&limit=1"} - ] - } - - A *search address* query in a batch is just a partial URL *without* the protocol, base URL, - path, api-version and subscription-key. It can accept any of the supported *search address* - `URI parameters `_. The string values in the *search address* query must be properly escaped (e.g. " - character should be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription- - key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressResponse`` - `_ - If - the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "query": "one microsoft way redmond wa 98052" - }, - "results": [ - { - "position": { - "lat": 47.63989, - "lon": -122.12509 - } - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "query": "pike pl seattle wa 98101" - }, - "results": [ - { - "position": { - "lat": 47.60963, - "lon": -122.34215 - } - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_id: Batch id for querying the operation. - :type batch_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SearchAddressBatchResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.SearchAddressBatchResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._get_search_address_batch_initial( - batch_id=batch_id, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'format': self._serialize.url("batch_id", batch_id, 'str'), - } - - if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_get_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore - - def reverse_search_address_batch_sync( - self, - batch_request, # type: "models.BatchRequest" - format="json", # type: Union[str, "models.JsonFormat"] - **kwargs # type: Any - ): - # type: (...) -> "models.ReverseSearchAddressBatchProcessResult" - """**Search Address Reverse Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Address Reverse API - `_ using just a single - API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api- - version=1.0&subscription-key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search address reverse* queries you will use a ``POST`` request where the request - body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header - will be set to ``application/json``. Here's a sample request body containing 5 *search address - reverse* queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=48.858561,2.294911"}, - {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, - {"query": "?query=47.621028,-122.348170"}, - {"query": "?query=43.722990,10.396695"}, - {"query": "?query=40.750958,-73.982336"} - ] - } - - A *search address reverse* query in a batch is just a partial URL *without* the protocol, base - URL, path, api-version and subscription-key. It can accept any of the supported *search address - reverse* `URI parameters - `_. The - string values in the *search address reverse* query must be properly escaped (e.g. " character - should be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressReverseResponse`` - `_ - - If the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "queryTime": 11 - }, - "addresses": [ - { - "address": { - "country": "France", - "freeformAddress": "Avenue Anatole France, 75007 Paris" - }, - "position": "48.858490,2.294820" - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "queryTime": 1 - }, - "addresses": [ - { - "address": { - "country": "United States of America", - "freeformAddress": "157th Pl NE, Redmond WA 98052" - }, - "position": "47.640470,-122.129430" - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_request: The list of reverse geocoding queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type batch_request: ~azure.maps.search.models.BatchRequest - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ReverseSearchAddressBatchProcessResult, or the result of cls(response) - :rtype: ~azure.maps.search.models.ReverseSearchAddressBatchProcessResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ReverseSearchAddressBatchProcessResult"] - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 408: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.reverse_search_address_batch_sync.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(batch_request, 'BatchRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - reverse_search_address_batch_sync.metadata = {'url': '/search/address/reverse/batch/sync/{format}'} # type: ignore - - def _reverse_search_address_batch_initial( - self, - batch_request, # type: "models.BatchRequest" - format="json", # type: Union[str, "models.JsonFormat"] - **kwargs # type: Any - ): - # type: (...) -> Optional["models.ReverseSearchAddressBatchProcessResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ReverseSearchAddressBatchProcessResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._reverse_search_address_batch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(batch_request, 'BatchRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _reverse_search_address_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore - - def begin_reverse_search_address_batch( - self, - batch_request, # type: "models.BatchRequest" - format="json", # type: Union[str, "models.JsonFormat"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.ReverseSearchAddressBatchProcessResult"] - """**Search Address Reverse Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Address Reverse API - `_ using just a single - API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api- - version=1.0&subscription-key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search address reverse* queries you will use a ``POST`` request where the request - body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header - will be set to ``application/json``. Here's a sample request body containing 5 *search address - reverse* queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=48.858561,2.294911"}, - {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, - {"query": "?query=47.621028,-122.348170"}, - {"query": "?query=43.722990,10.396695"}, - {"query": "?query=40.750958,-73.982336"} - ] - } - - A *search address reverse* query in a batch is just a partial URL *without* the protocol, base - URL, path, api-version and subscription-key. It can accept any of the supported *search address - reverse* `URI parameters - `_. The - string values in the *search address reverse* query must be properly escaped (e.g. " character - should be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressReverseResponse`` - `_ - - If the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "queryTime": 11 - }, - "addresses": [ - { - "address": { - "country": "France", - "freeformAddress": "Avenue Anatole France, 75007 Paris" - }, - "position": "48.858490,2.294820" - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "queryTime": 1 - }, - "addresses": [ - { - "address": { - "country": "United States of America", - "freeformAddress": "157th Pl NE, Redmond WA 98052" - }, - "position": "47.640470,-122.129430" - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_request: The list of reverse geocoding queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type batch_request: ~azure.maps.search.models.BatchRequest - :param format: Desired format of the response. Only ``json`` format is supported. - :type format: str or ~azure.maps.search.models.JsonFormat - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReverseSearchAddressBatchProcessResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ReverseSearchAddressBatchProcessResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._reverse_search_address_batch_initial( - batch_request=batch_request, - format=format, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'format': self._serialize.url("format", format, 'str'), - } - - if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reverse_search_address_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore - - def _get_reverse_search_address_batch_initial( - self, - batch_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["models.ReverseSearchAddressBatchProcessResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ReverseSearchAddressBatchProcessResult"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "1.0" - accept = "application/json" - - # Construct URL - url = self._get_reverse_search_address_batch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'format': self._serialize.url("batch_id", batch_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if self._config.client_id is not None: - header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) - - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _get_reverse_search_address_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore - - def begin_get_reverse_search_address_batch( - self, - batch_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.ReverseSearchAddressBatchProcessResult"] - """**Search Address Reverse Batch API** - - **Applies to**\ : S1 pricing tier. - - The Search Address Batch API sends batches of queries to `Search Address Reverse API - `_ using just a single - API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - Submit Synchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Synchronous API is recommended for lightweight batch requests. When the service receives a - request, it will respond as soon as the batch items are calculated and there will be no - possibility to retrieve the results later. The Synchronous API will return a timeout error (a - 408 response) if the request takes longer than 60 seconds. The number of batch items is limited - to **100** for this API. - - .. code-block:: - - POST https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api- - version=1.0&subscription-key={subscription-key} - - Submit Asynchronous Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - The Asynchronous API is appropriate for processing big volumes of relatively complex search - requests - - - * It allows the retrieval of results in a separate call (multiple downloads are possible). - * The asynchronous API is optimized for reliability and is not expected to run into a timeout. - * The number of batch items is limited to **10,000** for this API. - - When you make a request by using async request, by default the service returns a 202 response - code along a redirect URL in the Location field of the response header. This URL should be - checked periodically until the response data or error information is available. - The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response - if used after the expiration period. - - Please note that asynchronous batch request is a long-running request. Here's a typical - sequence of operations: - - - #. Client sends a Search Address Batch ``POST`` request to Azure Maps - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request has been accepted. - - HTTP ``Error`` - There was an error processing your Batch request. This could either be a - ``400 Bad Request`` or any other ``Error`` status code. - - - #. - If the batch request was accepted successfully, the ``Location`` header in the response - contains the URL to download the results of the batch request. - This status URI looks like following: - - .. code-block:: - - GET https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - - #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the - batch results. - - POST Body for Batch Request - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To send the *search address reverse* queries you will use a ``POST`` request where the request - body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header - will be set to ``application/json``. Here's a sample request body containing 5 *search address - reverse* queries: - - .. code-block:: json - - { - "batchItems": [ - {"query": "?query=48.858561,2.294911"}, - {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, - {"query": "?query=47.621028,-122.348170"}, - {"query": "?query=43.722990,10.396695"}, - {"query": "?query=40.750958,-73.982336"} - ] - } - - A *search address reverse* query in a batch is just a partial URL *without* the protocol, base - URL, path, api-version and subscription-key. It can accept any of the supported *search address - reverse* `URI parameters - `_. The - string values in the *search address reverse* query must be properly escaped (e.g. " character - should be escaped with ) and it should also be properly URL-encoded. - - The async API allows caller to batch up to **10,000** queries and sync API up to **100** - queries, and the batch should contain at least **1** query. - - Download Asynchronous Batch Results - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - To download the async batch results you will issue a ``GET`` request to the batch download - endpoint. This *download URL* can be obtained from the ``Location`` header of a successful - ``POST`` batch request and looks like the following: - - .. code-block:: - - https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api- - version=1.0&subscription-key={subscription-key} - - Here's the typical sequence of operations for downloading the batch results: - - - #. Client sends a ``GET`` request using the *download URL*. - #. - The server will respond with one of the following: - - .. - - HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please - try again in some time. - - HTTP ``200 OK`` - Batch request successfully processed. The response body contains all - the batch results. - - - Batch Response Model - ^^^^^^^^^^^^^^^^^^^^ - - The returned data content is similar for async and sync requests. When downloading the results - of an async batch request, if the batch has finished processing, the response body contains the - batch response. This batch response contains a ``summary`` component that indicates the - ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. - queries which were executed successfully. The batch response also includes a ``batchItems`` - array which contains a response for each and every query in the batch request. The - ``batchItems`` will contain the results in the exact same order the original queries were sent - in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` - fields. Each ``response`` in ``batchItems`` is of one of the following types: - - - * - `\ ``SearchAddressReverseResponse`` - `_ - - If the query completed successfully. - - * - ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in - this case. - - Here's a sample Batch Response with 2 *successful* and 1 *failed* result: - - .. code-block:: json - - { - "summary": { - "successfulRequests": 2, - "totalRequests": 3 - }, - "batchItems": [ - { - "statusCode": 200, - "response": - { - "summary": { - "queryTime": 11 - }, - "addresses": [ - { - "address": { - "country": "France", - "freeformAddress": "Avenue Anatole France, 75007 Paris" - }, - "position": "48.858490,2.294820" - } - ] - } - }, - { - "statusCode": 200, - "response": - { - "summary": { - "queryTime": 1 - }, - "addresses": [ - { - "address": { - "country": "United States of America", - "freeformAddress": "157th Pl NE, Redmond WA 98052" - }, - "position": "47.640470,-122.129430" - } - ] - } - }, - { - "statusCode": 400, - "response": - { - "error": - { - "code": "400 BadRequest", - "message": "Bad request: one or more parameters were incorrectly - specified or are mutually exclusive." - } - } - } - ] - }. - - :param batch_id: Batch id for querying the operation. - :type batch_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReverseSearchAddressBatchProcessResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ReverseSearchAddressBatchProcessResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._get_reverse_search_address_batch_initial( - batch_id=batch_id, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - path_format_arguments = { - 'format': self._serialize.url("batch_id", batch_id, 'str'), - } - - if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_get_reverse_search_address_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_base_client.py b/sdk/maps/azure-maps-search/azure/maps/search/_patch.py similarity index 53% rename from sdk/maps/azure-maps-search/azure/maps/search/_base_client.py rename to sdk/maps/azure-maps-search/azure/maps/search/_patch.py index 0400ac1116c00..80cab1a840d7f 100644 --- a/sdk/maps/azure-maps-search/azure/maps/search/_base_client.py +++ b/sdk/maps/azure-maps-search/azure/maps/search/_patch.py @@ -3,14 +3,31 @@ # Licensed under the MIT License. # ------------------------------------ -# pylint: disable=unused-import -from typing import Union, Any -from azure.core.pipeline.policies import AzureKeyCredentialPolicy + +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +# pylint: disable=unused-import,ungrouped-imports, R0904, C0302 +from typing import Union, Any, MutableMapping, List, Optional + from azure.core.credentials import AzureKeyCredential, TokenCredential -from ._generated import SearchClient as _MapsSearchClient -from ._version import VERSION +from azure.core.pipeline.policies import AzureKeyCredentialPolicy +from ._client import MapsSearchClient as MapsSearchClientGenerated + +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + +__all__: List[str] = ["MapsSearchClient"] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ -# To check the credential is either AzureKeyCredential or TokenCredential def _authentication_policy(credential): authentication_policy = None if credential is None: @@ -26,26 +43,23 @@ def _authentication_policy(credential): ) return authentication_policy -class MapsSearchClientBase: + +# pylint: disable=C4748 +class MapsSearchClient(MapsSearchClientGenerated): + def __init__( self, credential: Union[AzureKeyCredential, TokenCredential], + *, + endpoint: str = "https://atlas.microsoft.com", + client_id: Optional[str] = None, **kwargs: Any ) -> None: - - self._maps_client = _MapsSearchClient( + super().__init__( credential=credential, # type: ignore - api_version=kwargs.pop("api_version", VERSION), - base_url=kwargs.pop("base_url", None), - client_id=kwargs.pop("client_id", None), + endpoint=endpoint, + client_id=client_id, + api_version=kwargs.pop("api_version", "2023-06-01"), authentication_policy=kwargs.pop("authentication_policy", _authentication_policy(credential)), **kwargs ) - self._search_client = self._maps_client.search - - def __enter__(self): - self._maps_client.__enter__() # pylint:disable=no-member - return self - - def __exit__(self, *args): - self._maps_client.__exit__(*args) # pylint:disable=no-member diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_search_client.py b/sdk/maps/azure-maps-search/azure/maps/search/_search_client.py deleted file mode 100644 index 41a6ce51e84c8..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_search_client.py +++ /dev/null @@ -1,1114 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - -# pylint: disable=unused-import,ungrouped-imports, R0904, C0302 -from typing import Union, Any, List, Tuple -from collections import namedtuple -from azure.core.tracing.decorator import distributed_trace -from azure.core.exceptions import HttpResponseError -from azure.core.credentials import AzureKeyCredential, TokenCredential -from azure.core.polling import LROPoller - -from ._base_client import MapsSearchClientBase -from ._generated.models import ( - PointOfInterestCategory, - ReverseSearchCrossStreetAddressResult, - Polygon, -) -from .models import ( - LatLon, - BoundingBox, - StructuredAddress, - SearchAddressResult, - SearchAlongRouteOptions, - SearchAddressBatchResult, - ReverseSearchAddressResult, - ReverseSearchAddressBatchProcessResult, -) - -from ._shared import ( - parse_geometry_input -) - - -# By default, use the latest supported API version -class MapsSearchClient(MapsSearchClientBase): - """Azure Maps Search REST APIs. - - :param credential: - Credential needed for the client to connect to Azure. - :type credential: - ~azure.core.credentials.TokenCredential or ~azure.core.credentials.AzureKeyCredential - :keyword str base_url: - Supported Maps Services or Language resource base_url - (protocol and hostname, for example: 'https://us.atlas.microsoft.com'). - :keyword str client_id: - Specifies which account is intended for usage with the Azure AD security model. - It represents a unique ID for the Azure Maps account. - :keyword api_version: - The API version of the service to use for requests. - It defaults to the latest service version. - Setting to an older version may result in reduced feature compatibility. - :paramtype api_version: - str - """ - - def __init__( - self, - credential: Union[AzureKeyCredential, TokenCredential], - **kwargs: Any - )-> None: - - super().__init__( - credential=credential, **kwargs - ) - - @distributed_trace - def get_geometries( - self, - geometry_ids: List[str], - **kwargs: Any - )-> List[Polygon]: - - """**Get Geometries** - The Get Geometries service allows you to request the geometry data such as a city or country - outline for a set of entities, previously retrieved from an Online Search request in GeoJSON - format. The geometry ID is returned in the sourceGeometry object under "geometry" and "id" in - either a Search Address or Search Fuzzy call. - - :param geometry_ids: - list of geometry UUIDs string, previously retrieved from an Online Search request. - :type geometry_ids: - list[str] - :return: - The result list of Polygon/Geometries. - :rtype: - List[~azure.maps.search.models.Polygon] - """ - polygon_result = self._search_client.list_polygons( - geometry_ids, - **kwargs - ) - result = [] if not polygon_result else polygon_result.polygons - return result - - - @distributed_trace - def fuzzy_search( - self, - query: str, - **kwargs: Any - )-> SearchAddressResult: - """**Free Form Search** - - The basic default API is Free Form Search which handles the most fuzzy of inputs handling any - combination of address or POI tokens. This search API is the canonical 'single line search'. - The Free Form Search API is a seamless combination of POI search and geocoding. The API can - also be weighted with a contextual position (lat./lon. pair), or fully constrained by a - coordinate and radius, or it can be executed more generally without any geo biasing anchor - point. We strongly advise you to use the 'country_filter' parameter to - specify only the countries for which your application needs coverage, as the default behavior - will be to search the entire world, potentially returning unnecessary results. - - :param query: - The applicable query string (e.g., "seattle", "pizza"). Can *also* be specified - as a comma separated string composed by latitude followed by longitude (e.g., "47.641268, - -122.125679"). Must be properly URL encoded. - :type query: - str - :keyword bool is_type_ahead: - Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :keyword str top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :keyword int skip: - Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :keyword list[int] category_filter: - A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API`. - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the - defined area. - :keyword LatLon coordinates: - coordinates as (lat, lon) - :keyword country_filter: - Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :paramtype country_filter: - list[str] - :keyword BoundingBox bounding_box: - north(top), west(left), south(bottom), east(right) - position of the bounding box as float. E.g. BoundingBox(west=37.553, south=-122.453, east=33.2, north=57) - :keyword str language: - Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in - the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword int min_fuzzy_level: - Minimum fuzziness level to be used. - :keyword int max_fuzzy_level: - Maximum fuzziness level to be used. - :keyword index_filter: - A comma separated list of indexes which should be utilized for the search. - Item order does not matter. - :paramtype index_filter: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword list[str] brand_filter: - A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - :keyword electric_vehicle_connector_filter: - A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - :paramtype electric_vehicle_connector_filter: - list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :keyword entity_type: - Specifies the level of filtering performed on geographies. Narrows the - search for specified geography entity types, e.g. return only municipality. The resulting - response will contain the geography ID as well as the entity type matched. If you provide more - than one entity as a comma separated list, endpoint will return the 'smallest entity - available'. - :paramtype entity_type: - str or ~azure.maps.search.models.GeographicEntityType - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :keyword operating_hours: - Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :paramtype operating_hours: - str or ~azure.maps.search.models.OperatingHoursRange - :return: - The results of the search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - - coordinates = kwargs.pop("coordinates", (0, 0)) - bounding_box = kwargs.pop("bounding_box", BoundingBox()) - - result = self._search_client.fuzzy_search( - query, - lat=coordinates[0], - lon=coordinates[1], - btm_right=f"{bounding_box.south}, {bounding_box.east}", - top_left=f"{bounding_box.north}, {bounding_box.west}", - **kwargs - ) - return SearchAddressResult(result.summary, result.results) - - @distributed_trace - def get_point_of_interest_categories( - self, - **kwargs: Any - ) -> List[PointOfInterestCategory]: - - """**Get POI Category Tree** - - POI Category API provides a full list of supported Points of Interest (POI) categories and - subcategories together with their translations and synonyms. The returned content can be used - to provide more meaningful results through other Search Service APIs, - - :keyword str language: - Language in which search results should be returned. Should be one of - supported IETF language tags, except NGT and NGT-Latn. Language tag is case insensitive. When - data in specified language is not available for a specific field, default language is used - (English). - :return: - The result as list of point of interest categories. - :rtype: - List[~azure.maps.search.models.PointOfInterestCategory] - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - result = self._search_client.get_point_of_interest_category_tree( - **kwargs - ) - return result.categories - - @distributed_trace - def reverse_search_address( - self, - coordinates: LatLon, - **kwargs: Any - ) -> ReverseSearchAddressResult: - """**Search Address Reverse Batch API** - - There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) - into a human understandable street address. Most often this is needed in tracking applications - where you receive a GPS feed from the device or asset and wish to know what address where the - coordinate is located. This endpoint will return address information for a given coordinate. - - :param coordinates: - The applicable coordinates as (lat, lon) - :type coordinates: - LatLon - :keyword bool include_speed_limit: - Boolean. To enable return of the posted speed limit. - :keyword int heading: - The directional heading of the vehicle in degrees, for travel along a segment - of roadway. - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the - defined area. - :keyword str number: - If a number is sent in along with the request, the response may include the side - of the street (Left/Right) and also an offset position for that number. - :keyword bool include_road_use: - Boolean. To enable return of the road use array for reverse geocodes - at street level. - :keyword road_use: - To restrict reverse geocodes to a certain type of road use. - :paramtype road_use: - list[str or ~azure.maps.search.models.RoadUseType] - :keyword bool allow_freeform_newline: - Format of newlines in the formatted address. - :keyword bool include_match_type: - Include information on the type of match the geocoder achieved in - the response. - :keyword entity_type: - Specifies the level of filtering performed on geographies. - :paramtype entity_type: - str or ~azure.maps.search.models.GeographicEntityType - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :return: - The results of the search - :rtype: - ~azure.maps.search.models.ReverseSearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - result = self._search_client.reverse_search_address( - query=[coordinates[0], coordinates[1]], - ** kwargs - ) - return ReverseSearchAddressResult(summary=result.summary, results=result.addresses) - - @distributed_trace - def reverse_search_cross_street_address( - self, - coordinates: LatLon, - **kwargs: Any - )-> ReverseSearchCrossStreetAddressResult: - """**Reverse Geocode to a Cross Street** - - There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) - into a human understandable cross street. Most often this is needed in tracking applications - where you receive a GPS feed from the device or asset and wish to know what address where the - coordinate is located. - This endpoint will return cross street information for a given coordinate. - - :param coordinates: - The applicable coordinates as (lat, lon) - :type coordinates: - LatLon - :keyword int top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :keyword int heading: - The directional heading of the vehicle in degrees, for travel along a segment - of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can - include up to one decimal place. - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the - defined area. - :keyword str language: - Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :return: - The results of the reverse search. - :rtype: - ~azure.maps.search.models.ReverseSearchCrossStreetAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - return self._search_client.reverse_search_cross_street_address( - query=[coordinates[0], coordinates[1]], - **kwargs - ) - - @distributed_trace - def search_along_route( - self, - query: str, - max_detour_time: int, - route: SearchAlongRouteOptions, - **kwargs: Any - ) -> SearchAddressResult: - """ - The Search Along Route endpoint allows you to perform a fuzzy search for POIs along a specified - route. - - :param query: - The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). - Must be properly URL encoded. - :type query: - str - :param max_detour_time: - Maximum detour time of the point of interest in seconds. Max value is - 3600 seconds. - :type max_detour_time: - int - :param route: - This represents the route to search along and should be a valid ``GeoJSON - LineString`` type. - :type route: - ~azure.maps.search.models.SearchAlongRouteOptions - :keyword int top: - Maximum number of responses that will be returned. Default value is 10. Max value is 20. - :keyword list[str] brand_filter: - A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - :keyword list[int] category_filter: - A comma-separated list of category set IDs - which could be used to restrict the result to specific Points of Interest categories. - ID order does not matter. - :keyword electric_vehicle_connector_filter: - A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - :paramtype electric_vehicle_connector_filter: - list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :keyword operating_hours: - Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :paramtype operating_hours: - str or ~azure.maps.search.models.OperatingHoursRange - :return: - The results of the search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - result = self._search_client.search_along_route( - query, - max_detour_time=max_detour_time, - route=route, - **kwargs - ) - return SearchAddressResult(summary=result.summary, results=result.results) - - @distributed_trace - def search_inside_geometry( - self, - query: str, - geometry: Union[object, str], - **kwargs: Any - ) -> SearchAddressResult: - """ - The Search Geometry endpoint allows you to perform a free form search inside a single geometry - or many of them. - - :param query: - The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). - Must be properly URL encoded. - :type query: - str - :param geometry: - This represents the geometry for one or more geographical features (parks, - state boundary etc.) to search in and should be a GeoJSON compliant type. - We are accepting GeoJson object or geo_interface - :type geometry: - obejct or str - :keyword int top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :keyword str language: - Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - :keyword list[int] category_filter: - A comma-separated list of category set IDs - which could be used to restrict the result to specific Points of Interest categories. - ID order does not matter. - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in - the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword index_filter: - A comma separated list of indexes which should be utilized for the search. - Item order does not matter. - :paramtype index_filter: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :keyword operating_hours: - Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :paramtype operating_hours: - str or ~azure.maps.search.models.OperatingHoursRange - :return: - The results of search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - result = self._search_client.search_inside_geometry( - query, - geometry=parse_geometry_input(geometry), - **kwargs - ) - return SearchAddressResult(result.summary, result.results) - - @distributed_trace - def search_point_of_interest( - self, - query: str, - **kwargs: Any - ) -> SearchAddressResult: - """**Get POI by Name** - - Points of Interest (POI) Search allows you to request POI results by name. Search supports - additional query parameters such as language and filtering results by area of interest driven - by country or bounding box. Endpoint will return only POI results matching the query string. - Response includes POI details such as address, coordinate location and category. - - :param query: - The POI name to search for (e.g., "statue of liberty", "starbucks"), must be - properly URL encoded. - :type query: - str - :keyword bool is_type_ahead: - Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :keyword int top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :keyword int skip: - Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :keyword list[int] category_filter: - A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. - :keyword list[int] country_filter: - Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :keyword LatLon coordinates: - coordinates as (lat, lon) - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the - defined area. - :keyword BoundingBox bounding_box: - north(top), west(left), south(bottom), east(right) - position of the bounding box as float. E.g. BoundingBox(west=37.553, south=-122.453, east=33.2, north=57) - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in - the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.PointOfInterestExtendedPostalCodes] - :keyword list[str] brand_filter: - A comma-separated list of brand names which could be used to restrict the - result to specific brands. - :keyword electric_vehicle_connector_filter: - A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - :paramtype electric_vehicle_connector_filter: - list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :keyword operating_hours: - Hours of operation for a POI (Points of Interest). - :paramtype operating_hours: - str or ~azure.maps.search.models.OperatingHoursRange - :return: - The results of search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError - """ - coordinates = kwargs.pop("coordinates", (0, 0)) - bounding_box = kwargs.pop("bounding_box", BoundingBox()) - - result = self._search_client.search_point_of_interest( - query, - lat=coordinates[0], - lon=coordinates[1], - btm_right=f"{bounding_box.south}, {bounding_box.east}", - top_left=f"{bounding_box.north}, {bounding_box.west}", - **kwargs - ) - return SearchAddressResult(result.summary, result.results) - - @distributed_trace - def search_nearby_point_of_interest( - self, - coordinates: LatLon, - **kwargs: Any - ) -> SearchAddressResult: - """**Search Nearby Point of Interest** - - If you have a use case for only retrieving POI results around a specific location, the nearby - search method may be the right choice. This endpoint will only return POI results, and does not - take in a search query parameter. - - :keyword int top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :keyword int skip: - Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :keyword list[int] category_filter: - A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. - :keyword list[str] country_filter: - Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :param coordinates: - The applicable coordinates as (lat, lon) - :type coordinates: - LatLon - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the - defined area, Min value is 1, Max Value is 50000. - :keyword str language: - Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in - the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword list[str] brand_filter: - A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. - :keyword electric_vehicle_connector_filter: - A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - :paramtype electric_vehicle_connector_filter: - list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :return: - The results of search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError - """ - - result = self._search_client.search_nearby_point_of_interest( - lat=coordinates[0], - lon=coordinates[1], - **kwargs - ) - return SearchAddressResult(result.summary, result.results) - - - @distributed_trace - def search_point_of_interest_category( - self, - query: str, - **kwargs: Any - ) -> SearchAddressResult: - """**Get POI by Category** - - Points of Interest (POI) Category Search allows you to request POI results from given category. - Search allows to query POIs from one category at a time. Endpoint will only return POI results - which are categorized as specified. Response includes POI details such as address, coordinate - location and classification. - - :param query: - The POI category to search for (e.g., "AIRPORT", "RESTAURANT"), must be properly URL encoded. - :type query: - str - :keyword bool is_type_ahead: - Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :keyword int top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and maximum: 100. - :keyword int skip: - Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :keyword LatLon coordinates: - coordinates as (lat, lon) - :keyword list[int] category_filter: - A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. - :keyword country_filter: - Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :paramtype country_filter: - list[str] - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the - defined area. - :keyword BoundingBox bounding_box: - north(top), west(left), south(bottom), east(right) - position of the bounding box as float. E.g. BoundingBox(west=37.553, south=-122.453, east=33.2, north=57) - :keyword str language: - Language in which search results should be returned. - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword list[str] brand_filter: - A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. - :keyword electric_vehicle_connector_filter: - A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - :paramtype electric_vehicle_connector_filter: - list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :keyword operating_hours: - Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :paramtype operating_hours: - str or ~azure.maps.search.models.OperatingHoursRange - :return: - The results of search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError - """ - - coordinates = kwargs.pop("coordinates", (0, 0)) - bounding_box = kwargs.pop("bounding_box", BoundingBox()) - - result = self._search_client.search_point_of_interest_category( - query, - lat=coordinates[0], - lon=coordinates[1], - btm_right=f"{bounding_box.south}, {bounding_box.east}", - top_left=f"{bounding_box.north}, {bounding_box.west}", - **kwargs - ) - return SearchAddressResult(result.summary, result.results) - - @distributed_trace - def search_address( - self, - query: str, - **kwargs: Any - ) -> SearchAddressResult: - """**Address Geocoding** - - In many cases, the complete search service might be too much, for instance if you are only - interested in traditional geocoding. Search can also be accessed for address look up - exclusively. The geocoding is performed by hitting the geocode endpoint with just the address - or partial address in question. The geocoding search index will be queried for everything above - the street level data. No POIs will be returned. Note that the geocoder is very tolerant of - typos and incomplete addresses. It will also handle everything from exact street addresses or - street or intersections as well as higher level geographies such as city centers, counties, - states etc. - - :param query: - The address to search for (e.g., "1 Microsoft way, Redmond, WA"), must be properly URL encoded. - :type query: - str - :keyword bool is_type_ahead: - Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :keyword int top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and maximum: 100. - :keyword int skip: - Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the defined area. - :keyword LatLon coordinates: - coordinates as (lat, lon) - :keyword country_filter: - Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :paramtype country_filter: - list[str] - :keyword BoundingBox bounding_box: - north(top), west(left), south(bottom), east(right) - position of the bounding box as float. - E.g. BoundingBox(west=37.553, south=-122.453, east=33.2, north=57) - :keyword str language: - Language in which search results should be returned. - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword entity_type: - Specifies the level of filtering performed on geographies. - :paramtype entity_type: - str or ~azure.maps.search.models.GeographicEntityType - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - :paramtype localized_map_view: - str or ~azure.maps.search._generated.models.LocalizedMapView - :return: - The results of search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError - """ - coordinates = kwargs.pop("coordinates", (0, 0)) - bounding_box = kwargs.pop("bounding_box", BoundingBox()) - - result = self._search_client.search_address( - query, - lat=coordinates[0], - lon=coordinates[1], - btm_right=f"{bounding_box.south}, {bounding_box.east}", - top_left=f"{bounding_box.north}, {bounding_box.west}", - **kwargs - ) - return SearchAddressResult(result.summary, result.results) - - @distributed_trace - def search_structured_address( - self, - structured_address: StructuredAddress, - **kwargs: Any - ) -> SearchAddressResult: - """**Structured Address Geocoding** - - Azure Address Geocoding can also be accessed for structured address look up exclusively. The - geocoding search index will be queried for everything above the street level data. No POIs - will be returned. Note that the geocoder is very tolerant of typos and incomplete addresses. - It will also handle everything from exact street addresses or street or intersections as well - as higher level geographies such as city centers, counties, states etc. - - :param structured_address: - structured address type - :type structured_address: - ~azure.maps.search._models.StructuredAddress - :type top: - int - :keyword int skip: - Starting offset of the returned results within the full result set. - Default: 0, minimum: 0 and maximum: 1900. - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword entity_type: - Specifies the level of filtering performed on geographies. - :paramtype entity_type: - str or ~azure.maps.search.models.GeographicEntityType - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows you to show the - correct maps for a certain country/region for geopolitically disputed regions. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :return: - The results of search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError - """ - result = self._search_client.search_structured_address( - country_code=structured_address.country_code, - cross_street=structured_address.cross_street, - street_number=structured_address.street_number, - street_name=structured_address.street_name, - municipality=structured_address.municipality, - municipality_subdivision=structured_address.municipality_subdivision, - country_tertiary_subdivision=structured_address.country_tertiary_subdivision, - country_secondary_subdivision=structured_address.country_secondary_subdivision, - country_subdivision=structured_address.country_subdivision, - postal_code=structured_address.postal_code, - **kwargs) - return SearchAddressResult(summary=result.summary, results=result.results) - - @distributed_trace - def fuzzy_search_batch( - self, - search_queries: List[str], - **kwargs: Any - ) -> SearchAddressBatchResult: - """**Search Fuzzy Batch API** - - The Search Address Batch API sends batches of queries to `Search Fuzzy API`. - You can call Search Address Fuzzy Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - :param search_queries: - The list of search fuzzy queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type search_queries: - List[str] - :return: - The results of search batch request. - :rtype: - ~azure.maps.search.models.SearchAddressBatchResult - :raises: - ~azure.core.exceptions.HttpResponseError - """ - batch_items = [{"query": f"?query={query}"} for query in search_queries] if search_queries else [] - - batch_response = self._search_client.fuzzy_search_batch_sync( - batch_request={"batch_items" : batch_items}, - **kwargs - ) - result = SearchAddressBatchResult( - batch_response.batch_summary, batch_response.batch_items - ) - return result - - - @distributed_trace - def begin_fuzzy_search_batch( - self, - search_queries: List[str], - **kwargs - ) -> LROPoller[SearchAddressBatchResult]: - """**Begin Search Fuzzy Batch API Request** - - Sends batches of fuzzy search requests. - The method returns a poller for retrieving the result later. - - The Search Address Batch API sends batches of queries to `Search Fuzzy API` using just a single API - call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - :param search_queries: - The list of search fuzzy queries/requests to process. - The list can contain a max of 10,000 queries and must contain at least 1 query. - :type search_queries: - List[str] - :return: - The results of search batch request. - :rtype: - ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - batch_items = [{"query": f"?query={query}"} for query in search_queries] if search_queries else [] - - return self._search_client.begin_fuzzy_search_batch( - batch_request={"batch_items": batch_items}, - **kwargs, - ) - - - @distributed_trace - def search_address_batch( - self, - search_queries: List[str], - **kwargs: Any - ) -> SearchAddressBatchResult: - """**Search Address Batch API** - - :param search_queries: - The list of search fuzzy queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type search_queries: - List[str] - :return: - The results of search batch request. - :rtype: - ~azure.maps.search.models.SearchAddressBatchResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - batch_items = [{"query": f"?query={query}"} for query in search_queries] if search_queries else [] - - return self._search_client.search_address_batch_sync( - batch_request={"batch_items": batch_items}, - **kwargs - ) - - @distributed_trace - def begin_search_address_batch( - self, - search_queries: List[str], - **kwargs: Any - ) -> LROPoller[SearchAddressBatchResult]: - """**Begin Search Address Batch API** - - Sends batches of geocoding requests. - The method returns a poller for retrieving the result later. - - The Search Address Batch API sends batches of queries to `Search Address API` using just a single API - call. You can call Search Address Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - :param search_queries: - The list of search fuzzy queries/requests to process. - The list can contain a max of 10,000 queries and must contain at least 1 query. - :type search_queries: - List[str] - :keyword batch_id: - Batch id for querying the operation. - :paramtype batch_id: - str - :return: - The results of search batch request. - :rtype: - ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - batch_items = [{"query": f"?query={query}"} for query in search_queries] if search_queries else [] - - poller = self._search_client.begin_search_address_batch( - batch_request={"batch_items": batch_items}, - **kwargs - ) - - return poller - - @distributed_trace - def reverse_search_address_batch( - self, - search_queries: List[str], - **kwargs: Any - ) -> ReverseSearchAddressBatchProcessResult: - """**Search Address Reverse Batch API** - - The Search Address Batch API sends batches of queries to `Search Address Reverse API`. - You can call Search Address Reverse Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - :param search_queries: - The list of search fuzzy queries/requests to process. - The list can contain a max of 10,000 queries and must contain at least 1 query. - :type search_queries: - List[str] - :return: - The results of search batch request. - :rtype: - ~azure.maps.search.models.ReverseSearchAddressBatchProcessResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - batch_items = [{"query": f"?query={query}"} for query in search_queries] if search_queries else [] - - batch_result = self._search_client.reverse_search_address_batch_sync( - batch_request={"batch_items": batch_items}, - **kwargs - ) - - return batch_result - - @distributed_trace - def begin_reverse_search_address_batch( - self, - search_queries: List[str], - **kwargs: Any - ) -> LROPoller[ReverseSearchAddressBatchProcessResult]: - """*Begin Search Address Reverse Batch API Request** - - Sends batches of reverse geocoding requests. - The method returns a poller for retrieving the result later. - - The Search Address Batch API sends batches of queries to `Search Address Reverse API`. - You can call Search Address Reverse Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - :param search_queries: - The list of search fuzzy queries/requests to process. - The list can contain a max of 10,000 queries and must contain at least 1 query. - :type search_queries: - List[str] - :return: - The results of reverse search batch request. - :paramtype: - ~azure.core.polling.LROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - batch_items = [{"query": f"?query={query}"} for query in search_queries] if search_queries else [] - - poller = self._search_client.begin_reverse_search_address_batch( - batch_request={"batch_items": batch_items}, - **kwargs - ) - - return poller diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_serialization.py b/sdk/maps/azure-maps-search/azure/maps/search/_serialization.py new file mode 100644 index 0000000000000..f0c6180722c89 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_serialization.py @@ -0,0 +1,1998 @@ +# -------------------------------------------------------------------------- +# +# 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. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[Dict[str, Any]] = {} + for k in kwargs: + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str, list + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node
is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + else: + return date_obj diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_shared/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/_shared/__init__.py deleted file mode 100644 index bf90c682d4e90..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_shared/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ - -from .converter import ( - geo_interface_to_geojson, - parse_geometry_input -) - -__all__ = [ - 'geo_interface_to_geojson', - 'parse_geometry_input' -] diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_shared/converter.py b/sdk/maps/azure-maps-search/azure/maps/search/_shared/converter.py deleted file mode 100644 index ff6261e95334e..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/_shared/converter.py +++ /dev/null @@ -1,237 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - -""" -Maps SDK converter for Geo Json -This module provides converters to and from GeoJSON geo_interface, etc. -Azure Maps Search uses these converters; they can also be used directly. -""" -import re -from ast import literal_eval -from typing import Union - - -geo_types = { - 'Point', - 'MultiPoint', - 'LineString', - 'MultiLineString', - 'Polygon', - 'MultiPolygon' -} - -wkt_types = {x.upper() for x in geo_types} - -type_translations = {x.upper(): x for x in geo_types} - -def _reformat_coordinates( - item: Union[list, tuple], - style: str -) -> Union[list, tuple]: - """ - **Reformat Coordinates** - - Converts and reformats coordinate data structures between lists and tuples to ensure compatibility - with either GeoJSON or geo_interface specifications. This function can handle nested structures - like lists of lists or tuples of tuples, commonly used in geographical data representations. - - :param item: - The coordinate data to be reformatted. This can be a single coordinate pair (e.g., `[longitude, latitude]`), - a list of coordinate pairs (e.g., `[[lng1, lat1], [lng2, lat2], ...]`), or a nested structure of these pairs. - :type item: - Union[list, tuple] - :param style: - The desired output format of the coordinates. Use 'geojson' to convert all coordinate pairs to lists, - or 'geo_interface' to convert them to tuples. - :type style: - str - - :return: - The reformatted coordinate data structured as per the specified `style`. - :rtype: - Union[list, tuple] - - :raises ValueError: - If `style` is not 'geojson' or 'geo_interface', indicating an unknown formatting style. - """ - if type(item) in {tuple, list} and type(item[0]) in {tuple, list}: - return [_reformat_coordinates(x, style) for x in item] - if style == 'geojson': - return list(item) - if style == 'geo_interface': - return tuple(item) - raise ValueError('Unknown style') - -def geo_interface_to_geojson(geo_interface: dict) -> dict: - """ - **Geo Interface to GeoJSON Conversion** - - Transforms a dictionary representing a geographic object in geo_interface format to a GeoJSON - format dictionary. This conversion ensures the structure of the coordinates is compliant with - the GeoJSON specification. - - :param geo_interface: - A dictionary that represents a geographical feature, adhering to the geo_interface format. - It must include at least 'type' and 'coordinates' keys. For example, a simple point may be - represented as `{"type": "Point", "coordinates": (x, y)}`, and more complex structures are - supported for types like `Polygon` or `MultiPoint`. - :type geo_interface: - dict - - :return: - A dictionary formatted according to the GeoJSON specification, representing the same geographical - feature as the input. This dictionary will include 'type' and 'coordinates' keys at a minimum, - with additional keys as required by the specific geographical feature type. - :rtype: - dict - - :raises ValueError: - If `geo_interface` does not contain the required keys or if the coordinates cannot be - successfully reformatted to the GeoJSON format. - """ - coords = _reformat_coordinates(geo_interface['coordinates'], 'geojson') - - return {'type': geo_interface['type'], 'coordinates': coords} - -def wkt_to_geo_interface(wkt: str) -> dict: - """ - **WKT to Geo Interface Conversion** - - Translates a Well-Known Text (WKT) representation of geographic geometries into a dictionary - compliant with the geo_interface specification. It supports various geometry types like Point, - LineString, and Polygon among others. - - :param wkt: - The Well-Known Text (WKT) representation of the geometry to be converted. WKT is a text - markup language for representing vector geometry objects on a map. - :type wkt: - str - - :return: - A dictionary formatted according to the geo_interface specification, containing 'type' and - 'coordinates' keys, where 'type' is the geometry type and 'coordinates' is a tuple (or nested - tuples) representing the geometry's coordinates. - :rtype: - dict - - :raises ValueError: - If the `wkt` string cannot be parsed into a valid geo_interface dictionary, indicating that - the string is not in a proper WKT format or is unsupported. - """ - try: - wkt_type, coords = re.split(r'(?<=[A-Z])\s', wkt) - - geo_type = type_translations[wkt_type] - - # Clean up the strings so they'll covert correctly - if geo_type in {'Polygon', 'MultiLineString', 'MultiPolygon'}: - coords = re.sub(r'(?<=\d)\), \((?=\d)', ')), ((', coords) - - # Pairs of coordinates must be enclosed in parentheses - coords = re.sub(r'(?<=\d), (?=\d)', '), (', coords) - - # Coordinates within parentheses must be separated by commas - coords = re.sub(r'(?<=\d) (?=\d)', ', ', coords) - - # Now we can turn the string into a tuple or a tuple of tuples - coords = literal_eval(coords) - - coords = _reformat_coordinates(coords, 'geo_interface') # type: ignore # noqa: E501 - - # If we only have a simple polygon (no hole), the coordinate array - # won't be deep enough to satisfy the GeoJSON/geo_interface spec, so - # we need to enclose it in a list. - numbers = {float, int} - if geo_type == 'Polygon' and type(coords[0][0]) in numbers: - coords = [coords] # type: ignore - elif geo_type == 'MultiPolygon' and type(coords[0][0][0]) in numbers: - coords = [coords] # type: ignore - - except Exception as ex: - raise ValueError('{} is not a WKT string'.format(wkt)) from ex - - return {'type': geo_type, 'coordinates': coords} - -def wkt_to_geojson(wkt: str) -> str: - """ - **WKT to GeoJSON Conversion** - - Transforms a Well-Known Text (WKT) string into its corresponding GeoJSON string representation. - This function leverages the geo_interface format as an intermediate step to ensure accurate - translation from WKT to GeoJSON. - - :param wkt: - The Well-Known Text (WKT) representation of the geometry to be converted. WKT is a standard - text notation for representing vector geometry objects. - :type wkt: - str - - :return: - A string formatted in GeoJSON representing the same geometric object as defined in the input WKT. - :rtype: - str - - :raises ValueError: - If the `wkt` string cannot be converted into GeoJSON, indicating that the WKT string is not in - a valid format or represents a geometry type that is not supported. - """ - return geo_interface_to_geojson(wkt_to_geo_interface(wkt)) - -def parse_geometry_input(geo_thing: Union[str, dict]) -> dict: - """ - **Parse Geometry Input** - - Interprets various input formats and standardizes them into a GeoJSON dictionary. This function - can handle GeoJSON strings, Well-Known Text (WKT) strings, GeoJSON-like dictionaries, and objects - that implement the `__geo_interface__` protocol. - - :param geo_thing: - The geometry input to parse, which can be one of the following: - - A GeoJSON string. - - A WKT string. - - A dictionary with 'type' and 'coordinates' keys that follows the GeoJSON structure. - - An object that has a `__geo_interface__` property representing the geometry. - :type geo_thing: - Union[str, dict] - - :return: - A dictionary with a 'geometry' key containing the standardized geometry in GeoJSON format. - :rtype: - dict - - :raises ValueError: - If the string input is not a valid GeoJSON or WKT representation, or if a dictionary input - does not conform to the GeoJSON structure. - :raises AttributeError: - If the input is an object lacking a `__geo_interface__` property. - """ - error_msg = 'Strings must be valid GeoJSON or WKT or geo_interface property' - geometry={} - # Input might be WKT - if isinstance(geo_thing, str): - wkt_type = geo_thing.split(' ')[0] - if wkt_type not in wkt_types: - raise ValueError(error_msg) - geom = wkt_to_geojson(geo_thing) - elif isinstance(geo_thing, dict): - try: - # geo_interface property contains coordinates as tuple type - if isinstance(geo_thing.get("coordinates"), tuple): - geom = geo_interface_to_geojson(geo_thing) - # or assume it is a valid Geo Json obejct - else: - geom = geo_thing - except ValueError as ex: - raise ValueError(error_msg) from ex - else: - # Input might be an object with a geo_interface - try: - geo_interface = geo_thing.__geo_interface__ - geom = geo_interface_to_geojson(geo_interface) - except AttributeError as ex: - raise AttributeError('Object has no geo_interface.') from ex - - geometry['geometry'] = geom - return geometry diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_version.py b/sdk/maps/azure-maps-search/azure/maps/search/_version.py index 20971492f1291..2eda207895836 100644 --- a/sdk/maps/azure-maps-search/azure/maps/search/_version.py +++ b/sdk/maps/azure-maps-search/azure/maps/search/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b3" +VERSION = "2.0.0b2" diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/__init__.py index b66b9fe307806..3df35d786db9c 100644 --- a/sdk/maps/azure-maps-search/azure/maps/search/aio/__init__.py +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/__init__.py @@ -6,5 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._search_client_async import MapsSearchClient -__all__ = ['MapsSearchClient'] + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/_client.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/_client.py new file mode 100644 index 0000000000000..6a01e362d0fe2 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/_client.py @@ -0,0 +1,124 @@ +# 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, Awaitable, Optional, TYPE_CHECKING + +from azure.core import AsyncPipelineClient +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest + +from .._serialization import Deserializer, Serializer +from ._configuration import MapsSearchClientConfiguration +from .operations import SearchOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class MapsSearchClient(SearchOperations): # pylint: disable=client-accepts-api-version-keyword + """Azure Maps Search REST APIs. + + :ivar search: SearchOperations operations + :vartype search: azure.maps.search.aio.operations.SearchOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param accept_language: Language in which search results should be returned. + + Please refer to `Supported Languages `_ for details. + Default value is None. + :type accept_language: str + :param client_id: Specifies which account is intended for usage in conjunction with the Azure + AD security model. It represents a unique ID for the Azure Maps account and can be retrieved + from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see + the following `articles `_ for guidance. Default value is None. + :type client_id: str + :keyword endpoint: Service URL. Default value is "https://atlas.microsoft.com". + :paramtype endpoint: str + :keyword api_version: Api Version. Default value is "2023-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + accept_language: Optional[str] = None, + client_id: Optional[str] = None, + *, + endpoint: str = "https://atlas.microsoft.com", + **kwargs: Any + ) -> None: + self._config = MapsSearchClientConfiguration( + credential=credential, accept_language=accept_language, client_id=client_id, **kwargs + ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + # Initialize the base SearchOperations + super().__init__( + client=self._client, + config=self._config, + serializer=self._serialize, + deserializer=self._deserialize + ) + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + 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.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MapsSearchClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/_configuration.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/_configuration.py new file mode 100644 index 0000000000000..9dda20fa8e9c0 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/_configuration.py @@ -0,0 +1,77 @@ +# 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 typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + + +class MapsSearchClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for MapsSearchClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param accept_language: Language in which search results should be returned. + + Please refer to `Supported Languages `_ for details. + Default value is None. + :type accept_language: str + :param client_id: Specifies which account is intended for usage in conjunction with the Azure + AD security model. It represents a unique ID for the Azure Maps account and can be retrieved + from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see + the following `articles `_ for guidance. Default value is None. + :type client_id: str + :keyword api_version: Api Version. Default value is "2023-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + accept_language: Optional[str] = None, + client_id: Optional[str] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2023-06-01") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.credential = credential + self.accept_language = accept_language + self.client_id = client_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://atlas.microsoft.com/.default"]) + kwargs.setdefault("sdk_moniker", "maps-search/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/_base_client_async.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/_patch.py similarity index 53% rename from sdk/maps/azure-maps-search/azure/maps/search/aio/_base_client_async.py rename to sdk/maps/azure-maps-search/azure/maps/search/aio/_patch.py index 35b6e46cf367f..0766451594d29 100644 --- a/sdk/maps/azure-maps-search/azure/maps/search/aio/_base_client_async.py +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/_patch.py @@ -3,13 +3,32 @@ # Licensed under the MIT License. # ------------------------------------ -# pylint: disable=unused-import -from typing import Union, Any -from azure.core.pipeline.policies import AzureKeyCredentialPolicy + +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +# pylint: disable=unused-import,ungrouped-imports, R0904, C0302 +from typing import Union, Any, MutableMapping, List, Optional + from azure.core.credentials import AzureKeyCredential from azure.core.credentials_async import AsyncTokenCredential -from .._generated.aio import SearchClient as _MapsSearchClient -from .._version import VERSION +from azure.core.pipeline.policies import AzureKeyCredentialPolicy +from ._client import MapsSearchClient as MapsSearchClientGenerated + +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + +__all__: List[str] = ["MapsSearchClient"] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ + def _authentication_policy(credential): authentication_policy = None @@ -26,26 +45,23 @@ def _authentication_policy(credential): ) return authentication_policy -class AsyncMapsSearchClientBase: + +# pylint: disable=C4748 +class MapsSearchClient(MapsSearchClientGenerated): + def __init__( self, credential: Union[AzureKeyCredential, AsyncTokenCredential], + *, + endpoint: str = "https://atlas.microsoft.com", + client_id: Optional[str] = None, **kwargs: Any ) -> None: - - self._maps_client = _MapsSearchClient( + super().__init__( credential=credential, # type: ignore - api_version=kwargs.pop("api_version", VERSION), - base_url=kwargs.pop("base_url", None), - client_id=kwargs.pop("client_id", None), + endpoint=endpoint, + client_id=client_id, + api_version=kwargs.pop("api_version", "2023-06-01"), authentication_policy=kwargs.pop("authentication_policy", _authentication_policy(credential)), **kwargs ) - self._search_client = self._maps_client.search - - async def __aenter__(self): - await self._maps_client.__aenter__() # pylint:disable=no-member - return self - - async def __aexit__(self, *args): - return await self._maps_client.__aexit__(*args) # pylint:disable=no-member diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/_search_client_async.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/_search_client_async.py deleted file mode 100644 index 3bbf3999d557d..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/aio/_search_client_async.py +++ /dev/null @@ -1,1208 +0,0 @@ -# --------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# --------------------------------------------------------------------- - -# pylint: disable=unused-import,ungrouped-imports, R0904, C0302, too-many-function-args, W0212 -from typing import overload, Any, List, Union, Tuple -from collections import namedtuple -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.exceptions import HttpResponseError -from azure.core.credentials import AzureKeyCredential -from azure.core.credentials_async import AsyncTokenCredential -from azure.core.polling import AsyncLROPoller - -from ._base_client_async import AsyncMapsSearchClientBase -from .._generated.models import ( - PointOfInterestCategory, - ReverseSearchCrossStreetAddressResult, - SearchAddressBatchResult, - Polygon, -) -from ..models import ( - LatLon, - BoundingBox, - StructuredAddress, - SearchAddressResult, - SearchAlongRouteOptions, - ReverseSearchAddressResult, - ReverseSearchAddressBatchProcessResult, -) - -from .._shared import ( - parse_geometry_input -) - -def get_batch_id_from_poller(polling_method): - if hasattr(polling_method, "_operation"): - operation=polling_method._operation - return operation._location_url.split('/')[-1].split('?')[0] - return None - - -# By default, use the latest supported API version -class MapsSearchClient(AsyncMapsSearchClientBase): - """Azure Maps Search REST APIs. - - :param credential: - Credential needed for the client to connect to Azure. - :type credential: - ~azure.core.credentials.AsyncTokenCredential or ~azure.core.credentials.AzureKeyCredential - :keyword str base_url: - Supported Maps Services or Language resource base_url - (protocol and hostname, for example: 'https://us.atlas.microsoft.com'). - :keyword str client_id: - Specifies which account is intended for usage with the Azure AD security model. - It represents a unique ID for the Azure Maps account. - :keyword api_version: - The API version of the service to use for requests. - It defaults to the latest service version. - Setting to an older version may result in reduced feature compatibility. - :paramtype api_version: - str - """ - def __init__( - self, - credential: Union[AzureKeyCredential, AsyncTokenCredential], - **kwargs: Any - )-> None: - - super().__init__( - credential=credential, **kwargs - ) - - @distributed_trace_async - async def get_geometries( - self, - geometry_ids: List[str], - **kwargs: Any - )-> List[Polygon]: - """**Get Geometries** - The Get Geometries service allows you to request the geometry data such as a city or country - outline for a set of entities, previously retrieved from an Online Search request in GeoJSON - format. The geometry ID is returned in the sourceGeometry object under "geometry" and "id" in - either a Search Address or Search Fuzzy call. - - :param geometry_ids: - list of geometry UUIDs string, previously retrieved from an Online Search request. - :type geometry_ids: - list[str] - :return: - The result list of Polygon/Geometries. - :rtype: - List[~azure.maps.search.models.Polygon] - """ - polygon_result = await self._search_client.list_polygons( - geometry_ids, - **kwargs - ) - result = [] if not polygon_result else polygon_result.polygons - return result - - - @distributed_trace_async - async def fuzzy_search( - self, - query: str, - **kwargs: Any - )-> SearchAddressResult: - """**Free Form Search** - - The basic default API is Free Form Search which handles the most fuzzy of inputs handling any - combination of address or POI tokens. This search API is the canonical 'single line search'. - The Free Form Search API is a seamless combination of POI search and geocoding. The API can - also be weighted with a contextual position (lat./lon. pair), or fully constrained by a - coordinate and radius, or it can be executed more generally without any geo biasing anchor - point. We strongly advise you to use the 'country_filter' parameter to - specify only the countries for which your application needs coverage, as the default behavior - will be to search the entire world, potentially returning unnecessary results. - - :param query: - The applicable query string (e.g., "seattle", "pizza"). Can *also* be specified - as a comma separated string composed by latitude followed by longitude (e.g., "47.641268, - -122.125679"). Must be properly URL encoded. - :type query: - str - :keyword bool is_type_ahead: - Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :keyword str top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :keyword int skip: - Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :keyword list[int] category_filter: - A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. When - multiple category identifiers are provided, only POIs that belong to (at least) one of the - categories from the provided list will be returned. The list of supported categories can be - discovered using  `POI Categories API`. - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the - defined area. - :keyword LatLon coordinates: - coordinates as (lat, lon) - :keyword country_filter: - Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :paramtype country_filter: - list[str] - :keyword BoundingBox bounding_box: - north(top), west(left), south(bottom), east(right) - position of the bounding box as float. E.g. BoundingBox(west=37.553, south=-122.453, east=33.2, north=57) - :keyword str language: - Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in - the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword int min_fuzzy_level: - Minimum fuzziness level to be used. - :keyword int max_fuzzy_level: - Maximum fuzziness level to be used. - :keyword index_filter: - A comma separated list of indexes which should be utilized for the search. - Item order does not matter. - :paramtype index_filter: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword list[str] brand_filter: - A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - :keyword electric_vehicle_connector_filter: - A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - :paramtype electric_vehicle_connector_filter: - list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :keyword entity_type: - Specifies the level of filtering performed on geographies. Narrows the - search for specified geography entity types, e.g. return only municipality. The resulting - response will contain the geography ID as well as the entity type matched. If you provide more - than one entity as a comma separated list, endpoint will return the 'smallest entity - available'. - :paramtype entity_type: - str or ~azure.maps.search.models.GeographicEntityType - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :keyword operating_hours: - Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :paramtype operating_hours: - str or ~azure.maps.search.models.OperatingHoursRange - :return: - The results of the search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - - coordinates = kwargs.pop("coordinates", (0, 0)) - bounding_box = kwargs.pop("bounding_box", BoundingBox()) - - result = await self._search_client.fuzzy_search( - query, - lat=coordinates[0], - lon=coordinates[1], - btm_right=f"{bounding_box.south}, {bounding_box.east}", - top_left=f"{bounding_box.north}, {bounding_box.west}", - **kwargs - ) - return SearchAddressResult(summary=result.summary, results=result.results) - - @distributed_trace_async - async def get_point_of_interest_categories( - self, - **kwargs: Any - ) -> List[PointOfInterestCategory]: - """**Get POI Category Tree** - - POI Category API provides a full list of supported Points of Interest (POI) categories and - subcategories together with their translations and synonyms. The returned content can be used - to provide more meaningful results through other Search Service APIs, - - :keyword str language: - Language in which search results should be returned. Should be one of - supported IETF language tags, except NGT and NGT-Latn. Language tag is case insensitive. When - data in specified language is not available for a specific field, default language is used - (English). - :return: - The result as list of point of interest categories. - :rtype: - List[~azure.maps.search.models.PointOfInterestCategory] - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - result = await self._search_client.get_point_of_interest_category_tree( - **kwargs - ) - return result.categories - - @distributed_trace_async - async def reverse_search_address( - self, - coordinates: LatLon, - **kwargs: Any - ) -> ReverseSearchAddressResult: - """**Search Address Reverse Batch API** - - There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) - into a human understandable street address. Most often this is needed in tracking applications - where you receive a GPS feed from the device or asset and wish to know what address where the - coordinate is located. This endpoint will return address information for a given coordinate. - - :param coordinates: - The applicable coordinates as (lat, lon) - :type coordinates: - LatLon - :keyword bool include_speed_limit: - Boolean. To enable return of the posted speed limit. - :keyword int heading: - The directional heading of the vehicle in degrees, for travel along a segment - of roadway. - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the - defined area. - :keyword str number: - If a number is sent in along with the request, the response may include the side - of the street (Left/Right) and also an offset position for that number. - :keyword bool include_road_use: - Boolean. To enable return of the road use array for reverse geocodes - at street level. - :keyword road_use: - To restrict reverse geocodes to a certain type of road use. - :paramtype road_use: - list[str or ~azure.maps.search.models.RoadUseType] - :keyword bool allow_freeform_newline: - Format of newlines in the formatted address. - :keyword bool include_match_type: - Include information on the type of match the geocoder achieved in - the response. - :keyword entity_type: - Specifies the level of filtering performed on geographies. - :paramtype entity_type: - str or ~azure.maps.search.models.GeographicEntityType - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :return: - The results of the search - :rtype: - ~azure.maps.search.models.ReverseSearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - result = await self._search_client.reverse_search_address( - query=[coordinates[0], coordinates[1]], - ** kwargs - ) - return ReverseSearchAddressResult(summary=result.summary, results=result.addresses) - - @distributed_trace_async - async def reverse_search_cross_street_address( - self, - coordinates: LatLon, - **kwargs: Any - )-> ReverseSearchCrossStreetAddressResult: - """**Reverse Geocode to a Cross Street** - - There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) - into a human understandable cross street. Most often this is needed in tracking applications - where you receive a GPS feed from the device or asset and wish to know what address where the - coordinate is located. - This endpoint will return cross street information for a given coordinate. - - :param coordinates: - The applicable coordinates as (lat, lon) - :type coordinates: - LatLon - :keyword int top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :keyword int heading: - The directional heading of the vehicle in degrees, for travel along a segment - of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can - include up to one decimal place. - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the - defined area. - :keyword str language: - Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :return: - The results of the reverse search. - :rtype: - ~azure.maps.search.models.ReverseSearchCrossStreetAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - return await self._search_client.reverse_search_cross_street_address( - query=[coordinates[0], coordinates[1]], - **kwargs - ) - - @distributed_trace_async - async def search_along_route( - self, - query: str, - max_detour_time: int, - route: SearchAlongRouteOptions, - **kwargs: Any - ) -> SearchAddressResult: - """ - The Search Along Route endpoint allows you to perform a fuzzy search for POIs along a specified - route. - - :param query: - The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). - Must be properly URL encoded. - :type query: - str - :param max_detour_time: - Maximum detour time of the point of interest in seconds. Max value is - 3600 seconds. - :type max_detour_time: - int - :param route: - This represents the route to search along and should be a valid ``GeoJSON - LineString`` type. - :type route: - ~azure.maps.search.models.SearchAlongRouteOptions - :keyword int top: - Maximum number of responses that will be returned. Default value is 10. Max value is 20. - :keyword list[str] brand_filter: - A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. When multiple brands are provided, only - results that belong to (at least) one of the provided list will be returned. Brands that - contain a "," in their name should be put into quotes. - :keyword list[int] category_filter: - A comma-separated list of category set IDs - which could be used to restrict the result to specific Points of Interest categories. - ID order does not matter. - :keyword electric_vehicle_connector_filter: - A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - Item order does not matter. When multiple connector types are provided, only results that - belong to (at least) one of the provided list will be returned. - :paramtype electric_vehicle_connector_filter: - list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :keyword operating_hours: - Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :paramtype operating_hours: - str or ~azure.maps.search.models.OperatingHoursRange - :return: - The results of the search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - result = await self._search_client.search_along_route( - query, - max_detour_time=max_detour_time, - route=route, - **kwargs - ) - return SearchAddressResult(summary=result.summary, results=result.results) - - @distributed_trace_async - async def search_inside_geometry( - self, - query: str, - geometry: Union[object, str], - **kwargs: Any - ) -> SearchAddressResult: - """ - The Search Geometry endpoint allows you to perform a free form search inside a single geometry - or many of them. - - :param query: - The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). - Must be properly URL encoded. - :type query: - str - :param geometry: - This represents the geometry for one or more geographical features (parks, - state boundary etc.) to search in and should be a GeoJSON compliant type. - We are accepting GeoJson object or geo_interface - :type geometry: - obejct or str - :keyword int top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :keyword str language: - Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. When data in specified language is not - available for a specific field, default language is used. - :keyword list[int] category_filter: - A comma-separated list of category set IDs - which could be used to restrict the result to specific Points of Interest categories. - ID order does not matter. - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in - the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword index_filter: - A comma separated list of indexes which should be utilized for the search. - Item order does not matter. - :paramtype index_filter: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - Different countries have different views of such regions, and the View parameter allows your - application to comply with the view required by the country your application will be serving. - By default, the View parameter is set to “Unified” even if you haven’t defined it in the - request. It is your responsibility to determine the location of your users, and then set the - View parameter correctly for that location. Alternatively, you have the option to set - ‘View=Auto’, which will return the map data based on the IP address of the request. The View - parameter in Azure Maps must be used in compliance with applicable laws, including those - regarding mapping, of the country where maps, images and other data and third party content - that you are authorized to access via Azure Maps is made available. Example: view=IN. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :keyword operating_hours: - Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :paramtype operating_hours: - str or ~azure.maps.search.models.OperatingHoursRange - :return: - The results of search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - result = await self._search_client.search_inside_geometry( - query, - geometry=parse_geometry_input(geometry), - **kwargs - ) - return SearchAddressResult(result.summary, result.results) - - - @distributed_trace_async - async def search_point_of_interest( - self, - query: str, - **kwargs: Any - ) -> SearchAddressResult: - """**Get POI by Name** - - Points of Interest (POI) Search allows you to request POI results by name. Search supports - additional query parameters such as language and filtering results by area of interest driven - by country or bounding box. Endpoint will return only POI results matching the query string. - Response includes POI details such as address, coordinate location and category. - - :param query: - The POI name to search for (e.g., "statue of liberty", "starbucks"), must be - properly URL encoded. - :type query: - str - :keyword bool is_type_ahead: - Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :keyword int top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :keyword int skip: - Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :keyword list[int] category_filter: - A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. - :keyword list[int] country_filter: - Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :keyword LatLon coordinates: - coordinates as (lat, lon) - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the - defined area. - :keyword BoundingBox bounding_box: - north(top), west(left), south(bottom), east(right) - position of the bounding box as float. E.g. BoundingBox(west=37.553, south=-122.453, east=33.2, north=57) - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in - the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.PointOfInterestExtendedPostalCodes] - :keyword list[str] brand_filter: - A comma-separated list of brand names which could be used to restrict the - result to specific brands. - :keyword electric_vehicle_connector_filter: - A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - :paramtype electric_vehicle_connector_filter: - list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :keyword operating_hours: - Hours of operation for a POI (Points of Interest). - :paramtype operating_hours: - str or ~azure.maps.search.models.OperatingHoursRange - :return: - The results of search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError - """ - coordinates = kwargs.pop("coordinates", (0, 0)) - bounding_box = kwargs.pop("bounding_box", BoundingBox()) - - result = await self._search_client.search_point_of_interest( - query, - lat=coordinates[0], - lon=coordinates[1], - btm_right=f"{bounding_box.south}, {bounding_box.east}", - top_left=f"{bounding_box.north}, {bounding_box.west}", - **kwargs - ) - return SearchAddressResult(result.summary, result.results) - - @distributed_trace_async - async def search_nearby_point_of_interest( - self, - coordinates: LatLon, - **kwargs: Any - ) -> SearchAddressResult: - """**Search Nearby Point of Interest** - - If you have a use case for only retrieving POI results around a specific location, the nearby - search method may be the right choice. This endpoint will only return POI results, and does not - take in a search query parameter. - - :keyword int top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and - maximum: 100. - :keyword int skip: - Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :keyword list[int] category_filter: - A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. ID order does not matter. - :keyword list[str] country_filter: - Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :param coordinates: - The applicable coordinates as (lat, lon) - :type coordinates: - LatLon - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the - defined area, Min value is 1, Max Value is 50000. - :keyword str language: - Language in which search results should be returned. Should be one of - supported IETF language tags, case insensitive. - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in - the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword list[str] brand_filter: - A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. - :keyword electric_vehicle_connector_filter: - A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - :paramtype electric_vehicle_connector_filter: - list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :return: - The results of search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError - """ - - result = await self._search_client.search_nearby_point_of_interest( - lat=coordinates[0], - lon=coordinates[1], - **kwargs - ) - return SearchAddressResult(result.summary, result.results) - - - @distributed_trace_async - async def search_point_of_interest_category( - self, - query: str, - **kwargs: Any - ) -> SearchAddressResult: - """**Get POI by Category** - - Points of Interest (POI) Category Search allows you to request POI results from given category. - Search allows to query POIs from one category at a time. Endpoint will only return POI results - which are categorized as specified. Response includes POI details such as address, coordinate - location and classification. - - :param query: - The POI category to search for (e.g., "AIRPORT", "RESTAURANT"), must be properly URL encoded. - :type query: - str - :keyword bool is_type_ahead: - Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :keyword int top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and maximum: 100. - :keyword int skip: - Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :keyword LatLon coordinates: - coordinates as (lat, lon) - :keyword list[int] category_filter: - A comma-separated list of category set IDs which could be used to - restrict the result to specific Points of Interest categories. - :keyword country_filter: - Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :paramtype country_filter: - list[str] - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the - defined area. - :keyword BoundingBox bounding_box: - north(top), west(left), south(bottom), east(right) - position of the bounding box as float. E.g. BoundingBox(west=37.553, south=-122.453, east=33.2, north=57) - :keyword str language: - Language in which search results should be returned. - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword list[str] brand_filter: - A comma-separated list of brand names which could be used to restrict the - result to specific brands. Item order does not matter. - :keyword electric_vehicle_connector_filter: - A comma-separated list of connector types which could - be used to restrict the result to Electric Vehicle Station supporting specific connector types. - :paramtype electric_vehicle_connector_filter: - list[str or ~azure.maps.search.models.ElectricVehicleConnector] - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :keyword operating_hours: - Hours of operation for a POI (Points of Interest). The availability of - hours of operation will vary based on the data available. If not passed, then no opening hours - information will be returned. - Supported value: nextSevenDays. - :paramtype operating_hours: - str or ~azure.maps.search.models.OperatingHoursRange - :return: - The results of search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError - """ - - coordinates = kwargs.pop("coordinates", (0, 0)) - bounding_box = kwargs.pop("bounding_box", BoundingBox()) - - result = await self._search_client.search_point_of_interest_category( - query, - lat=coordinates[0], - lon=coordinates[1], - btm_right=f"{bounding_box.south}, {bounding_box.east}", - top_left=f"{bounding_box.north}, {bounding_box.west}", - **kwargs - ) - return SearchAddressResult(result.summary, result.results) - - @distributed_trace_async - async def search_address( - self, - query: str, - **kwargs: Any - ) -> SearchAddressResult: - """**Address Geocoding** - - In many cases, the complete search service might be too much, for instance if you are only - interested in traditional geocoding. Search can also be accessed for address look up - exclusively. The geocoding is performed by hitting the geocode endpoint with just the address - or partial address in question. The geocoding search index will be queried for everything above - the street level data. No POIs will be returned. Note that the geocoder is very tolerant of - typos and incomplete addresses. It will also handle everything from exact street addresses or - street or intersections as well as higher level geographies such as city centers, counties, - states etc. - - :param query: - The address to search for (e.g., "1 Microsoft way, Redmond, WA"), must be properly URL encoded. - :type query: - str - :keyword bool is_type_ahead: - Boolean. If the typeahead flag is set, the query will be interpreted as a - partial input and the search will enter predictive mode. - :keyword int top: - Maximum number of responses that will be returned. Default: 10, minimum: 1 and maximum: 100. - :keyword int skip: - Starting offset of the returned results within the full result set. Default: 0, - minimum: 0 and maximum: 1900. - :keyword int radius_in_meters: - The radius in meters to for the results to be constrained to the defined area. - :keyword LatLon coordinates: - coordinates as (lat, lon) - :keyword country_filter: - Comma separated string of country codes, e.g. FR,ES. This will limit the - search to the specified countries. - :paramtype country_filter: - list[str] - :keyword BoundingBox bounding_box: - north(top), west(left), south(bottom), east(right) - position of the bounding box as float. - E.g. BoundingBox(west=37.553, south=-122.453, east=33.2, north=57) - :keyword str language: - Language in which search results should be returned. - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword entity_type: - Specifies the level of filtering performed on geographies. - :paramtype entity_type: - str or ~azure.maps.search.models.GeographicEntityType - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows - you to show the correct maps for a certain country/region for geopolitically disputed regions. - :paramtype localized_map_view: - str or ~azure.maps.search._generated.models.LocalizedMapView - :return: - The results of search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError - """ - coordinates = kwargs.pop("coordinates", (0, 0)) - bounding_box = kwargs.pop("bounding_box", BoundingBox()) - - result = await self._search_client.search_address( - query, - lat=coordinates[0], - lon=coordinates[1], - btm_right=f"{bounding_box.south}, {bounding_box.east}", - top_left=f"{bounding_box.north}, {bounding_box.west}", - **kwargs - ) - return SearchAddressResult(result.summary, result.results) - - @distributed_trace_async - async def search_structured_address( - self, - structured_address: StructuredAddress, - **kwargs: Any - ) -> SearchAddressResult: - """**Structured Address Geocoding** - - Azure Address Geocoding can also be accessed for structured address look up exclusively. The - geocoding search index will be queried for everything above the street level data. No POIs - will be returned. Note that the geocoder is very tolerant of typos and incomplete addresses. - It will also handle everything from exact street addresses or street or intersections as well - as higher level geographies such as city centers, counties, states etc. - - :param structured_address: - structured address type - :type structured_address: - ~azure.maps.search._models.StructuredAddress - :type top: - int - :keyword int skip: - Starting offset of the returned results within the full result set. - Default: 0, minimum: 0 and maximum: 1900. - :keyword extended_postal_codes_for: - Indexes for which extended postal codes should be included in the results. - :paramtype extended_postal_codes_for: - list[str or ~azure.maps.search.models.SearchIndexes] - :keyword entity_type: - Specifies the level of filtering performed on geographies. - :paramtype entity_type: - str or ~azure.maps.search.models.GeographicEntityType - :keyword localized_map_view: - The View parameter (also called the "user region" parameter) allows you to show - the correct maps for a certain country/region for geopolitically disputed regions. - :paramtype localized_map_view: - str or ~azure.maps.search.models.LocalizedMapView - :return: - The results of search. - :rtype: - ~azure.maps.search.models.SearchAddressResult - :raises: - ~azure.core.exceptions.HttpResponseError - """ - result = await self._search_client.search_structured_address( - country_code=structured_address.country_code, - cross_street=structured_address.cross_street, - street_number=structured_address.street_number, - street_name=structured_address.street_name, - municipality=structured_address.municipality, - municipality_subdivision=structured_address.municipality_subdivision, - country_tertiary_subdivision=structured_address.country_tertiary_subdivision, - country_secondary_subdivision=structured_address.country_secondary_subdivision, - country_subdivision=structured_address.country_subdivision, - postal_code=structured_address.postal_code, - **kwargs) - return SearchAddressResult(result.summary, result.results) - - @distributed_trace_async - async def fuzzy_search_batch( - self, - search_queries: List[str], - **kwargs: Any - ) -> SearchAddressBatchResult: - """**Search Fuzzy Batch API** - - The Search Address Batch API sends batches of queries to `Search Fuzzy API`. - You can call Search Address Fuzzy Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - :param search_queries: - The list of search fuzzy queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type search_queries: - List[str] - :return: - The results of search batch request. - :rtype: - ~azure.maps.search.models.SearchAddressBatchResult - :raises: - ~azure.core.exceptions.HttpResponseError - """ - batch_items = [{"query": f"?query={query}"} for query in search_queries] if search_queries else [] - - batch_response = await self._search_client.fuzzy_search_batch_sync( - batch_request={"batch_items": batch_items}, - **kwargs - ) - - result = SearchAddressBatchResult( - batch_response.batch_summary, batch_response.batch_items - ) - return result - - @overload - async def begin_fuzzy_search_batch( - self, - search_queries: List[str], - **kwargs: Any - )-> AsyncLROPoller[SearchAddressBatchResult]: - pass - - @overload - async def begin_fuzzy_search_batch( - self, - batch_id: str, - **kwargs: Any - ) -> AsyncLROPoller[SearchAddressBatchResult]: - pass - - @distributed_trace_async - async def begin_fuzzy_search_batch( - self, - **kwargs: Any - ) -> AsyncLROPoller[SearchAddressBatchResult]: - """**Begin Search Fuzzy Batch API Request** - - Sends batches of fuzzy search requests. - The method returns a poller for retrieving the result later. - - The Search Address Batch API sends batches of queries to `Search Fuzzy API` using just a single API - call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - :keyword search_queries: - The list of search fuzzy queries/requests to process. - The list can contain a max of 10,000 queries and must contain at least 1 query. - :paramtype search_queries: - List[str] - :keyword str batch_id: - Batch id for querying the operation. - :return: - The results of search batch request. - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - batch_id = kwargs.pop("batch_id", None) - search_queries = kwargs.pop("search_queries", None) - - if batch_id: - return await self._search_client.begin_get_fuzzy_search_batch( - batch_id=batch_id, - **kwargs - ) - - batch_items = [{"query": f"?query={query}"} for query in search_queries] if search_queries else [] - batch_poller = await self._search_client.begin_fuzzy_search_batch( - batch_request={"batch_items": batch_items}, - **kwargs - ) - - batch_poller.batch_id = get_batch_id_from_poller(batch_poller.polling_method()) - return batch_poller - - - @distributed_trace_async - async def search_address_batch( - self, - search_queries: List[str], - **kwargs: Any - ) -> SearchAddressBatchResult: - """**Search Address Batch API** - - :param search_queries: - The list of search fuzzy queries/requests to process. The list can - contain a max of 10,000 queries and must contain at least 1 query. - :type search_queries: - List[str] - :return: - The results of search batch request. - :rtype: - ~azure.maps.search.models.SearchAddressBatchResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - batch_items = [{"query": f"?query={query}"} for query in search_queries] if search_queries else [] - - batch_response = await self._search_client.search_address_batch_sync( - batch_request={"batch_items": batch_items}, - **kwargs - ) - - result = SearchAddressBatchResult( - batch_response.batch_summary, batch_response.batch_items - ) - return result - - - @overload - async def begin_search_address_batch( - self, - search_queries: List[str], - **kwargs: Any - ) -> AsyncLROPoller[SearchAddressBatchResult]: - pass - - @overload - async def begin_search_address_batch( - self, - batch_id: str, - **kwargs: Any - ) -> AsyncLROPoller[SearchAddressBatchResult]: - pass - - @distributed_trace_async - async def begin_search_address_batch( - self, - **kwargs # type: Any - ): - # type: (...) -> AsyncLROPoller["SearchAddressBatchResult"] - """**Begin Search Address Batch API** - - Sends batches of geocoding requests. - The method returns a poller for retrieving the result later. - - The Search Address Batch API sends batches of queries to `Search Address API` using just a single API - call. You can call Search Address Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - :keyword search_queries: - The list of search fuzzy queries/requests to process. - The list can contain a max of 10,000 queries and must contain at least 1 query. - :paramtype search_queries: - List[str] - :keyword str batch_id: - Batch id for querying the operation. - :return: - The results of search batch request. - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - batch_id = kwargs.pop("batch_id", None) - search_queries = kwargs.pop("search_queries", None) - - if batch_id: - return await self._search_client.begin_get_search_address_batch( - batch_id=batch_id, - **kwargs - ) - - batch_items = [{"query": f"?query={query}"} for query in search_queries] if search_queries else [] - batch_poller = await self._search_client.begin_search_address_batch( - batch_request={"batch_items": batch_items}, - polling=True, - **kwargs - ) - - batch_poller.batch_id = get_batch_id_from_poller(batch_poller.polling_method()) - return batch_poller - - - @distributed_trace_async - async def reverse_search_address_batch( - self, - search_queries: List[str], - **kwargs: Any - ) -> ReverseSearchAddressBatchProcessResult: - """**Search Address Reverse Batch API** - - The Search Address Batch API sends batches of queries to `Search Address Reverse API`. - You can call Search Address Reverse Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - :param search_queries: The list of search fuzzy queries/requests to process. - The list can contain a max of 10,000 queries and must contain at least 1 query. - :type search_queries: - List[str] - :return: - The results of search batch request. - :rtype: - ~azure.maps.search.models.ReverseSearchAddressBatchProcessResult - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - batch_items = [{"query": f"?query={query}"} for query in search_queries] if search_queries else [] - - batch_result = await self._search_client.reverse_search_address_batch_sync( - batch_request={"batch_items": batch_items}, - **kwargs - ) - result = ReverseSearchAddressBatchProcessResult( - batch_result.batch_summary, batch_result.batch_items - ) - return result - - - - @overload - async def begin_reverse_search_address_batch( - self, - search_queries: List[str], - **kwargs: Any - ) -> AsyncLROPoller[SearchAddressBatchResult]: - pass - - @overload - async def begin_reverse_search_address_batch( - self, - batch_id: str, - **kwargs: Any - ) -> AsyncLROPoller[SearchAddressBatchResult]: - pass - - @distributed_trace_async - async def begin_reverse_search_address_batch( - self, - **kwargs: Any - ) -> AsyncLROPoller[ReverseSearchAddressBatchProcessResult]: - """*Begin Search Address Reverse Batch API Request** - - Sends batches of reverse geocoding requests. - The method returns a poller for retrieving the result later. - - The Search Address Batch API sends batches of queries to `Search Address Reverse API`. - You can call Search Address Reverse Batch API to run either asynchronously (async) or - synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync - API up to **100** queries. - - :keyword search_queries: The list of search fuzzy queries/requests to process. - The list can contain a max of 10,000 queries and must contain at least 1 query. - :paramtype search_queries: - List[str] - :keyword str batch_id: - Batch id for querying the operation. - :return: - The results of reverse search batch request. - :paramtype: - ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] - :raises: - ~azure.core.exceptions.HttpResponseError: - """ - batch_id = kwargs.pop("batch_id", None) - search_queries = kwargs.pop("search_queries", None) - - if batch_id: - return await self._search_client.begin_get_reverse_search_address_batch( - batch_id=batch_id, - **kwargs - ) - - batch_items = [{"query": f"?query={query}"} for query in search_queries] if search_queries else [] - batch_poller = await self._search_client.begin_reverse_search_address_batch( - batch_request={"batch_items": batch_items}, - polling=True, - **kwargs - ) - - batch_poller.batch_id = get_batch_id_from_poller(batch_poller.polling_method()) - return batch_poller diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/operations/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/__init__.py similarity index 62% rename from sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/operations/__init__.py rename to sdk/maps/azure-maps-search/azure/maps/search/aio/operations/__init__.py index c7f640e252e17..8d2ba24d8b3f2 100644 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/aio/operations/__init__.py +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/__init__.py @@ -6,8 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._search_operations import SearchOperations +from ._operations import SearchOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'SearchOperations', + "SearchOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_operations.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_operations.py new file mode 100644 index 0000000000000..57b70d8dd234d --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_operations.py @@ -0,0 +1,857 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict + +from ...operations._operations import ( + build_search_get_geocoding_batch_request, + build_search_get_geocoding_request, + build_search_get_polygon_request, + build_search_get_reverse_geocoding_batch_request, + build_search_get_reverse_geocoding_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SearchOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.maps.search.aio.MapsSearchClient`'s + :attr:`search` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get_geocoding( + self, + *, + top: int = 5, + query: Optional[str] = None, + address_line: Optional[str] = None, + country_region: Optional[str] = None, + bbox: Optional[List[float]] = None, + view: Optional[str] = None, + coordinates: Optional[List[float]] = None, + admin_district: Optional[str] = None, + admin_district2: Optional[str] = None, + admin_district3: Optional[str] = None, + locality: Optional[str] = None, + postal_code: Optional[str] = None, + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to get longitude and latitude coordinates of a street address or name of a place. + + The ``Get Geocoding`` API is an HTTP ``GET`` request that returns the longitude and latitude + coordinates of the location being searched. + + In many cases, the complete search service might be too much, for instance if you are only + interested in traditional geocoding. Search can also be accessed for address look up + exclusively. The geocoding is performed by hitting the geocoding endpoint with just the address + or partial address in question. The geocoding search index will be queried for everything above + the street level data. No Point of Interest (POIs) will be returned. Note that the geocoder is + very tolerant of typos and incomplete addresses. It will also handle everything from exact + street addresses or street or intersections as well as higher level geographies such as city + centers, counties and states. The response also returns detailed address properties such as + street, postal code, municipality, and country/region information. + + :keyword top: Maximum number of responses that will be returned. Default: 5, minimum: 1 and + maximum: 20. Default value is 5. + :paramtype top: int + :keyword query: A string that contains information about a location, such as an address or + landmark name. Default value is None. + :paramtype query: str + :keyword address_line: The official street line of an address relative to the area, as + specified by the locality, or postalCode, properties. Typical use of this element would be to + provide a street address or any official address. + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype address_line: str + :keyword country_region: Signal for the geocoding result to an `ISO 3166-1 Alpha-2 + region/country code `_ that is specified e.g. + FR./ + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype country_region: str + :keyword bbox: A rectangular area on the earth defined as a bounding box object. The sides of + the rectangles are defined by longitude and latitude values. When you specify this parameter, + the geographical area is taken into account when computing the results of a location query. + + Example: lon1,lat1,lon2,lat2. Default value is None. + :paramtype bbox: list[float] + :keyword view: A string that represents an `ISO 3166-1 Alpha-2 region/country code + `_. This will alter Geopolitical disputed + borders and labels to align with the specified user region. By default, the View parameter is + set to “Auto” even if you haven’t defined it in the request. + + Please refer to `Supported Views `_ for details and + to see the available Views. Default value is None. + :paramtype view: str + :keyword coordinates: A point on the earth specified as a longitude and latitude. When you + specify this parameter, the user’s location is taken into account and the results returned may + be more relevant to the user. Example: &coordinates=lon,lat. Default value is None. + :paramtype coordinates: list[float] + :keyword admin_district: The country subdivision portion of an address, such as WA. + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype admin_district: str + :keyword admin_district2: The county for the structured address, such as King. + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype admin_district2: str + :keyword admin_district3: The named area for the structured address. + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype admin_district3: str + :keyword locality: The locality portion of an address, such as Seattle. + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype locality: str + :keyword postal_code: The postal code portion of an address. + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype postal_code: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_search_get_geocoding_request( + top=top, + query=query, + address_line=address_line, + country_region=country_region, + bbox=bbox, + view=view, + coordinates=coordinates, + admin_district=admin_district, + admin_district2=admin_district2, + admin_district3=admin_district3, + locality=locality, + postal_code=postal_code, + accept_language=self._config.accept_language, + client_id=self._config.client_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + async def get_geocoding_batch( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to send a batch of queries to the `Geocoding `_ API in + a single request. + + The ``Get Geocoding Batch`` API is an HTTP ``POST`` request that sends batches of up to **100** + queries to the `Geocoding `_ API in a single request. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *geocoding* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 2 *geocoding* queries: + + A *geocoding* batchItem object can accept any of the supported *geocoding* `URI parameters + `__. + + The batch should contain at least **1** query. + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The batch response contains a ``summary`` component that indicates the ``totalRequests`` that + were part of the original batch request and ``successfulRequests`` i.e. queries which were + executed successfully. The batch response also includes a ``batchItems`` array which contains a + response for each and every query in the batch request. The ``batchItems`` will contain the + results in the exact same order the original queries were sent in the batch request. Each item + is of one of the following types: + + * `GeocodingResponse `_ - If the query completed successfully. + + * ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in this case. + + :param body: The list of address geocoding queries/requests to process. + The list can contain a max of 100 queries and must contain at least 1 query. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_geocoding_batch( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to send a batch of queries to the `Geocoding `_ API in + a single request. + + The ``Get Geocoding Batch`` API is an HTTP ``POST`` request that sends batches of up to **100** + queries to the `Geocoding `_ API in a single request. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *geocoding* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 2 *geocoding* queries: + + A *geocoding* batchItem object can accept any of the supported *geocoding* `URI parameters + `__. + + The batch should contain at least **1** query. + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The batch response contains a ``summary`` component that indicates the ``totalRequests`` that + were part of the original batch request and ``successfulRequests`` i.e. queries which were + executed successfully. The batch response also includes a ``batchItems`` array which contains a + response for each and every query in the batch request. The ``batchItems`` will contain the + results in the exact same order the original queries were sent in the batch request. Each item + is of one of the following types: + + * `GeocodingResponse `_ - If the query completed successfully. + + * ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in this case. + + :param body: The list of address geocoding queries/requests to process. + The list can contain a max of 100 queries and must contain at least 1 query. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_geocoding_batch(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Use to send a batch of queries to the `Geocoding `_ API in + a single request. + + The ``Get Geocoding Batch`` API is an HTTP ``POST`` request that sends batches of up to **100** + queries to the `Geocoding `_ API in a single request. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *geocoding* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 2 *geocoding* queries: + + A *geocoding* batchItem object can accept any of the supported *geocoding* `URI parameters + `__. + + The batch should contain at least **1** query. + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The batch response contains a ``summary`` component that indicates the ``totalRequests`` that + were part of the original batch request and ``successfulRequests`` i.e. queries which were + executed successfully. The batch response also includes a ``batchItems`` array which contains a + response for each and every query in the batch request. The ``batchItems`` will contain the + results in the exact same order the original queries were sent in the batch request. Each item + is of one of the following types: + + * `GeocodingResponse `_ - If the query completed successfully. + + * ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in this case. + + :param body: The list of address geocoding queries/requests to process. + The list can contain a max of 100 queries and must contain at least 1 query. Is either a JSON + type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_search_get_geocoding_batch_request( + client_id=self._config.client_id, + accept_language=self._config.accept_language, + content_type=content_type, + api_version=self._config.api_version, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace_async + async def get_polygon( + self, + *, + coordinates: List[float], + view: Optional[str] = None, + result_type: str = "countryRegion", + resolution: str = "medium", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to get polygon data of a geographical area shape such as a city or a country region. + + The ``Get Polygon`` API is an HTTP ``GET`` request that supplies polygon data of a geographical + area outline such as a city or a country region. + + :keyword coordinates: A point on the earth specified as a longitude and latitude. Example: + &coordinates=lon,lat. Required. + :paramtype coordinates: list[float] + :keyword view: A string that represents an `ISO 3166-1 Alpha-2 region/country code + `_. This will alter Geopolitical disputed + borders and labels to align with the specified user region. By default, the View parameter is + set to “Auto” even if you haven’t defined it in the request. + + Please refer to `Supported Views `_ for details and + to see the available Views. Default value is None. + :paramtype view: str + :keyword result_type: The geopolitical concept to return a boundary for. If not specified, the + default is ``countryRegion`` result type. Known values are: "countryRegion", "adminDistrict", + "adminDistrict2", "postalCode", "postalCode2", "postalCode3", "postalCode4", "neighborhood", + and "locality". Default value is "countryRegion". + :paramtype result_type: str + :keyword resolution: Resolution determines the amount of points to send back. If not specified, + the default is medium resolution. Known values are: "small", "medium", "large", and "huge". + Default value is "medium". + :paramtype resolution: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_search_get_polygon_request( + coordinates=coordinates, + view=view, + result_type=result_type, + resolution=resolution, + client_id=self._config.client_id, + accept_language=self._config.accept_language, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace_async + async def get_reverse_geocoding( + self, + *, + coordinates: List[float], + result_types: Optional[List[str]] = None, + view: Optional[str] = None, + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to get a street address and location info from longitude and latitude coordinates. + + The ``Get Reverse Geocoding`` API is an HTTP ``GET`` request used to translate a coordinate + (example: 37.786505, -122.3862) into a human understandable street address. Useful in tracking + applications where you receive a GPS feed from the device or asset and wish to know the address + associated with the coordinates. This endpoint will return address information for a given + coordinate. + + :keyword coordinates: The coordinates of the location that you want to reverse geocode. + Example: &coordinates=lon,lat. Required. + :paramtype coordinates: list[float] + :keyword result_types: Specify entity types that you want in the response. Only the types you + specify will be returned. If the point cannot be mapped to the entity types you specify, no + location information is returned in the response. + Default value is all possible entities. + A comma separated list of entity types selected from the following options. + + + * Address + * Neighborhood + * PopulatedPlace + * Postcode1 + * AdminDivision1 + * AdminDivision2 + * CountryRegion + + These entity types are ordered from the most specific entity to the least specific entity. + When entities of more than one entity type are found, only the most specific entity is + returned. For example, if you specify Address and AdminDistrict1 as entity types and entities + were found for both types, only the Address entity information is returned in the response. + Default value is None. + :paramtype result_types: list[str] + :keyword view: A string that represents an `ISO 3166-1 Alpha-2 region/country code + `_. This will alter Geopolitical disputed + borders and labels to align with the specified user region. By default, the View parameter is + set to “Auto” even if you haven’t defined it in the request. + + Please refer to `Supported Views `_ for details and + to see the available Views. Default value is None. + :paramtype view: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_search_get_reverse_geocoding_request( + coordinates=coordinates, + result_types=result_types, + view=view, + client_id=self._config.client_id, + accept_language=self._config.accept_language, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + async def get_reverse_geocoding_batch( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to send a batch of queries to the `Reverse Geocoding + `_ API in a single request. + + The ``Get Reverse Geocoding Batch`` API is an HTTP ``POST`` request that sends batches of up to + **100** queries to `Reverse Geocoding `_ API using + a single request. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *reverse geocoding* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 2 *reverse geocoding* + queries: + + A *reverse geocoding* batchItem object can accept any of the supported *reverse geocoding* `URI + parameters `__. + + The batch should contain at least **1** query. + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The batch response contains a ``summary`` component that indicates the ``totalRequests`` that + were part of the original batch request and ``successfulRequests`` i.e. queries which were + executed successfully. The batch response also includes a ``batchItems`` array which contains a + response for each and every query in the batch request. The ``batchItems`` will contain the + results in the exact same order the original queries were sent in the batch request. Each item + is of one of the following types: + + * `GeocodingResponse `_ - If the query completed successfully. + + * ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in this case. + + :param body: The list of reverse geocoding queries/requests to + process. The list can contain a max of 100 queries and must contain at least 1 query. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_reverse_geocoding_batch( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to send a batch of queries to the `Reverse Geocoding + `_ API in a single request. + + The ``Get Reverse Geocoding Batch`` API is an HTTP ``POST`` request that sends batches of up to + **100** queries to `Reverse Geocoding `_ API using + a single request. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *reverse geocoding* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 2 *reverse geocoding* + queries: + + A *reverse geocoding* batchItem object can accept any of the supported *reverse geocoding* `URI + parameters `__. + + The batch should contain at least **1** query. + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The batch response contains a ``summary`` component that indicates the ``totalRequests`` that + were part of the original batch request and ``successfulRequests`` i.e. queries which were + executed successfully. The batch response also includes a ``batchItems`` array which contains a + response for each and every query in the batch request. The ``batchItems`` will contain the + results in the exact same order the original queries were sent in the batch request. Each item + is of one of the following types: + + * `GeocodingResponse `_ - If the query completed successfully. + + * ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in this case. + + :param body: The list of reverse geocoding queries/requests to + process. The list can contain a max of 100 queries and must contain at least 1 query. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_reverse_geocoding_batch( + self, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to send a batch of queries to the `Reverse Geocoding + `_ API in a single request. + + The ``Get Reverse Geocoding Batch`` API is an HTTP ``POST`` request that sends batches of up to + **100** queries to `Reverse Geocoding `_ API using + a single request. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *reverse geocoding* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 2 *reverse geocoding* + queries: + + A *reverse geocoding* batchItem object can accept any of the supported *reverse geocoding* `URI + parameters `__. + + The batch should contain at least **1** query. + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The batch response contains a ``summary`` component that indicates the ``totalRequests`` that + were part of the original batch request and ``successfulRequests`` i.e. queries which were + executed successfully. The batch response also includes a ``batchItems`` array which contains a + response for each and every query in the batch request. The ``batchItems`` will contain the + results in the exact same order the original queries were sent in the batch request. Each item + is of one of the following types: + + * `GeocodingResponse `_ - If the query completed successfully. + + * ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in this case. + + :param body: The list of reverse geocoding queries/requests to + process. The list can contain a max of 100 queries and must contain at least 1 query. Is either + a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_search_get_reverse_geocoding_batch_request( + client_id=self._config.client_id, + accept_language=self._config.accept_language, + content_type=content_type, + api_version=self._config.api_version, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore + + return cast(JSON, deserialized) # type: ignore diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_patch.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_patch.py new file mode 100644 index 0000000000000..5755fd181b3f1 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_patch.py @@ -0,0 +1,22 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + + +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/maps/azure-maps-search/azure/maps/search/models/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/models/__init__.py deleted file mode 100644 index 28edc03221857..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/models/__init__.py +++ /dev/null @@ -1,66 +0,0 @@ - -from .._generated.models import ( - ReverseSearchCrossStreetAddressResult, - BatchResultSummary, - Polygon, - ReverseSearchAddressBatchItem, - PointOfInterestCategory, - SearchAlongRouteRequest, - SearchIndexes, - LocalizedMapView, - ElectricVehicleConnector, - OperatingHoursRange, - RoadUseType, - PointOfInterestExtendedPostalCodes, -) - -from ._models import ( - LatLon, - StructuredAddress, - BoundingBox, - AddressRanges, - EntryPoint, - GeoJsonObject, - SearchAddressResultItem, - ReverseSearchAddressResultItem, - SearchSummary, - Address, - SearchAddressResult, - SearchAddressBatchItem, - SearchAlongRouteOptions, - SearchAddressBatchResult, - ReverseSearchAddressResult, - ReverseSearchAddressBatchProcessResult -) - - -__all__ = [ - 'LatLon', - 'RoadUseType', - 'AddressRanges', - 'StructuredAddress', - 'BoundingBox', - 'Polygon', - 'EntryPoint', - 'Address', - 'SearchAddressResultItem', - 'ReverseSearchAddressBatchItem', - 'ReverseSearchAddressResultItem', - 'SearchSummary', - 'SearchAddressResult', - 'BatchResultSummary', - 'ReverseSearchAddressBatchProcessResult', - 'ReverseSearchAddressResult', - 'ReverseSearchCrossStreetAddressResult', - 'PointOfInterestCategory', - 'SearchAlongRouteRequest', - 'SearchAddressBatchResult', - 'SearchIndexes', - 'SearchAddressBatchItem', - 'SearchAlongRouteOptions', - 'LocalizedMapView', - 'ElectricVehicleConnector', - 'OperatingHoursRange', - 'GeoJsonObject', - 'PointOfInterestExtendedPostalCodes', -] diff --git a/sdk/maps/azure-maps-search/azure/maps/search/models/_models.py b/sdk/maps/azure-maps-search/azure/maps/search/models/_models.py deleted file mode 100644 index 26322293fed6f..0000000000000 --- a/sdk/maps/azure-maps-search/azure/maps/search/models/_models.py +++ /dev/null @@ -1,1239 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - -# pylint: disable=unused-import,ungrouped-imports, C0302, C0203 -from typing import List, Optional, Union, NamedTuple -import msrest.serialization - -from .._generated.models import ( - PointOfInterest, - DataSource, - SearchAddressBatchItem as _SearchAddressBatchItem, - SearchAddressBatchItemResponse, - ReverseSearchAddressBatchItem as _ReverseSearchAddressBatchItem, - BatchResultSummary, - GeoJsonObjectType -) - -class LatLon(NamedTuple): - """Represents coordinate latitude and longitude - - :keyword lat: The coordinate as latitude. - :paramtype lat: float - :keyword lon: The coordinate as longitude. - :paramtype lon: float - """ - lat: float = 0 - lon: float = 0 - - -class BoundingBox(NamedTuple): - """Represents information about the coordinate range - - :keyword west: The westmost value of coordinates. - :paramtype west: float - :keyword south: The southmost value of coordinates. - :paramtype south: float - :keyword east: The eastmost value of coordinates. - :paramtype east: float - :keyword north: The northmost value of coordinates. - :paramtype north: float - """ - west: float = 0.0 - south: float = 0.0 - east: float = 0.0 - north: float = 0.0 - - -# pylint: disable=too-many-instance-attributes -class StructuredAddress(object): - """The Structured address as the search input. - - :param country_code: Country (Note: This is a two-letter code, not a country name.). - :type country_code: str - :keyword cross_street: The name of the street being crossed. - :paramtype cross_street: str - :keyword street_number: The building number on the street. - :paramtype street_number: str - :keyword street_name: The street name. - :paramtype street_name: str - :keyword municipality: City / Town. - :paramtype municipality: str - :keyword municipality_subdivision: Sub / Super City. - :paramtype municipality_subdivision: str - :keyword country_tertiary_subdivision: Named Area. - :paramtype country_tertiary_subdivision: str - :keyword country_secondary_subdivision: County. - :paramtype country_secondary_subdivision: str - :keyword country_subdivision: State or Province. - :paramtype country_subdivision: str - :keyword postal_code: Postal Code / Zip Code. - :paramtype postal_code: str - """ - def __init__( - self, - country_code: str, - *, - cross_street: Optional[str] = None, - street_number: Optional[str] = None, - street_name: Optional[str] = None, - municipality: Optional[str] = None, - municipality_subdivision: Optional[str] = None, - country_tertiary_subdivision: Optional[str] = None, - country_secondary_subdivision: Optional[str] = None, - country_subdivision: Optional[str] = None, - postal_code: Optional[str] = None - ): - self.country_code = country_code - self.cross_street = cross_street - self.street_number = street_number - self.street_name = street_name - self.municipality = municipality - self.municipality_subdivision = municipality_subdivision - self.country_tertiary_subdivision = country_tertiary_subdivision - self.country_secondary_subdivision = country_secondary_subdivision - self.country_subdivision = country_subdivision - self.postal_code = postal_code - - -class SearchSummary(object): - """Summary object for a Search API response. - - :keyword query: The query parameter that was used to produce these search results. - :paramtype query: str - :keyword query_type: The type of query being returned: NEARBY or NON_NEAR. Possible values - include: "NEARBY", "NON_NEAR". - :paramtype query_type: str or ~azure.maps.search.models.QueryType - :keyword query_time: Time spent resolving the query, in milliseconds. - :paramtype query_time: int - :keyword num_results: Number of results in the response. - :paramtype num_results: int - :keyword top: Maximum number of responses that will be returned. - :paramtype top: int - :keyword skip: The starting offset of the returned Results within the full Result set. - :paramtype skip: int - :keyword total_results: The total number of Results found. - :paramtype total_results: int - :keyword fuzzy_level: The maximum fuzzy level required to provide Results. - :paramtype fuzzy_level: int - :keyword geo_bias: Indication when the internal search engine has applied a geospatial bias to - improve the ranking of results. - :paramtype geo_bias: ~azure.maps.search.models.LatLongPairAbbreviated - """ - - def __init__( - self, - *, - query: str = None, - query_type: str = None, - query_time: int = None, - num_results: int = None, - top: int = None, - skip: int = None, - total_results: int = None, - fuzzy_level: int = None, - geo_bias: LatLon = None - ): - self.query = query - self.query_type = query_type - self.query_time = query_time - self.num_results = num_results - self.top = top - self.skip = skip - self.total_results = total_results - self.fuzzy_level = fuzzy_level - self.geo_bias = geo_bias - - -class AddressRanges(object): - """Describes the address range on both sides of the street for a search result. - Coordinates for the start and end locations of the address range are included. - - :keyword range_start: Address range on the left(start) side of the street. - :paramtype range_start: str - :keyword range_end: Address range on the right(end) side of the street. - :paramtype range_end: str - :keyword range_from: A location represented as a latitude and longitude using short names - 'lat' & 'lon'. - :paramtype range_from: ~azure.maps.search.models.LatLon - :keyword range_to: A location represented as a latitude and longitude using short names 'lat' & 'lon'. - :paramtype range_to: ~azure.maps.search.models.LatLon - """ - def __init__( - self, - *, - range_start: str = None, - range_end: str = None, - range_from: LatLon = None, - range_to: LatLon = None - ): - self.range_left = range_start - self.range_right = range_end - self.from_property = None if not range_from else LatLon( - range_from.lat, range_from.lon - ) - self.to = None if not range_to else LatLon( - range_to.lat, range_to.lon - ) - - -class EntryPoint(object): - """The entry point for the POI being returned. - - :keyword entry_point_type: The type of entry point. - :paramtype entry_point_type: str or ~azure.maps.search.models.EntryPointType - :keyword position: A location represented as a latitude and longitude using short names 'lat' & - 'lon'. - :paramtype position: ~azure.maps.search.models.LatLon - """ - def __init__( - self, - entry_point_type: str = None, - position: LatLon = None - ): - self.type = entry_point_type - self.position = None if not position else LatLon( - position.lat, position.lon - ) - - -# pylint: disable=too-many-instance-attributes -class Address(object): - """The address of the result. - - :keyword building_number: The building number on the street. - :paramtype building_number: str - :keyword street: The street name. - :paramtype street: str - :keyword cross_street: The name of the street being crossed. - :paramtype cross_street: str - :keyword street_number: The building number on the street. - :paramtype street_number: str - :keyword route_numbers: The codes used to unambiguously identify the street. - :paramtype route_numbers: list[int] - :keyword street_name: The street name. - :paramtype street_name: str - :keyword street_name_and_number: The street name and number. - :paramtype street_name_and_number: str - :keyword municipality: City / Town. - :paramtype municipality: str - :keyword municipality_subdivision: Sub / Super City. - :paramtype municipality_subdivision: str - :keyword country_tertiary_subdivision: Named Area. - :paramtype country_tertiary_subdivision: str - :keyword country_secondary_subdivision: County. - :paramtype country_secondary_subdivision: str - :keyword country_subdivision: State or Province. - :paramtype country_subdivision: str - :keyword postal_code: Postal Code / Zip Code. - :paramtype postal_code: str - :keyword extended_postal_code: Extended postal code (availability is dependent on the region). - :paramtype extended_postal_code: str - :keyword country_code: Country (Note: This is a two-letter code, not a country name.). - :paramtype country_code: str - :keyword country: Country name. - :paramtype country: str - :keyword country_code_iso3: ISO alpha-3 country code. - :paramtype country_code_iso3: str - :keyword freeform_address: An address line formatted according to the formatting rules of a - Result's country of origin, or in the case of a country, its full country name. - :paramtype freeform_address: str - :keyword country_subdivision_name: The full name of a first level of country administrative - hierarchy. This field appears only in case countrySubdivision is presented in an abbreviated - form. Only supported for USA, Canada, and Great Britain. - :paramtype country_subdivision_name: str - :keyword local_name: An address component which represents the name of a geographic area or - locality that groups a number of addressable objects for addressing purposes, without being an - administrative unit. This field is used to build the ``freeformAddress`` property. - :paramtype local_name: str - :keyword bounding_box: Bounding box coordinates. - :paramtype bounding_box: ~azure.maps.search.models.BoundingBox - """ - def __init__( - self, - *, - building_number: str = None, - street: str = None, - cross_street: str = None, - street_number: str = None, - route_numbers: List[int] = None, - street_name: str = None, - street_name_and_number: str = None, - municipality: str = None, - municipality_subdivision: str = None, - country_tertiary_subdivision: str = None, - country_secondary_subdivision: str = None, - country_subdivision: str = None, - postal_code: str = None, - extended_postal_code: str = None, - country_code: str = None, - country: str = None, - country_code_iso3: str = None, - freeform_address: str = None, - country_subdivision_name: str = None, - local_name: str = None, - bounding_box: BoundingBox = None, - ): - self.building_number = building_number - self.street = street - self.cross_street = cross_street - self.street_number = street_number - self.route_numbers = route_numbers - self.street_name = street_name - self.street_name_and_number = street_name_and_number - self.municipality = municipality - self.municipality_subdivision = municipality_subdivision - self.country_tertiary_subdivision = country_tertiary_subdivision - self.country_secondary_subdivision = country_secondary_subdivision - self.country_subdivision = country_subdivision - self.postal_code = postal_code - self.extended_postal_code = extended_postal_code - self.country_code = country_code - self.country = country - self.country_code_iso3 = country_code_iso3 - self.freeform_address = freeform_address - self.country_subdivision_name = country_subdivision_name - self.local_name = local_name - self.bounding_box = bounding_box - - -# pylint: disable=too-many-instance-attributes -class SearchAddressResultItem(object): - """Result object for a Search API response.. - - :keyword type: Possible values include: "POI", "Street", "Geography", "Point Address", - "Address Range", "Cross Street". - :paramtype type: str or ~azure.maps.search.models.SearchAddressResultType - :keyword id: Id property. - :paramtype id: str - :keyword score: The value within a result set to indicate the relative matching score between - results. - :paramtype score: float - :keyword distance_in_meters: Straight line distance between the result and geobias location in - meters. - :paramtype distance_in_meters: float - :keyword info: Information about the original data source of the Result. Used for support - requests. - :paramtype info: str - :param entity_type: Possible values include: "Country", "CountrySubdivision", - "CountrySecondarySubdivision", "CountryTertiarySubdivision", "Municipality", - "MunicipalitySubdivision", "Neighbourhood", "PostalCodeArea". - :type entity_type: str or ~azure.maps.search.models.GeographicEntityType - :keyword point_of_interest: Details of the returned POI including information such as the name, - phone, url address, and classifications. - :paramtype point_of_interest: ~azure.maps.search.models.PointOfInterest - :keyword address: The address of the result. - :paramtype address: ~azure.maps.search.models.Address - :param position: A location represented as a latitude and longitude using short names 'lat' & - 'lon'. - :type position: ~azure.maps.search.models.LatLon - :keyword viewport: The viewport that covers the result represented by the top-left and bottom- - right coordinates as BoundingBox. - :paramtype viewport: ~azure.maps.search.models.BoundingBox - :keyword entry_points: Array of EntryPoints. Those describe the types of entrances available at - the location. The type can be "main" for main entrances such as a front door, or a lobby, and - "minor", for side and back doors. - :paramtype entry_points: list[~azure.maps.search.models.EntryPoint] - :keyword address_ranges: Describes the address range on both sides of the street for a search - result. Coordinates for the start and end locations of the address range are included. - :paramtype address_ranges: ~azure.maps.search.models.AddressRanges - :keyword data_sources: Optional section. Reference geometry id. - :paramtype data_sources: ~azure.maps.search.models.DataSource - :keyword match_type: Information on the type of match. - :paramtype match_type: str or ~azure.maps.search.models.MatchType - :keyword detour_time: Detour time in seconds. - :paramtype detour_time: int - """ - def __init__( - self, - *, - type_: str = None, - id_: str = None, - score: float = None, - distance_in_meters: float = None, - info: str = None, - entity_type: str = None, - point_of_interest: PointOfInterest = None, - address: Address = None, - position: LatLon = None, - viewport: BoundingBox = None, - entry_points: EntryPoint = None, - address_ranges: AddressRanges = None, - data_sources: DataSource = None, - match_type: str = None, - detour_time: int = None - ): - self.type = type_ - self.id = id_ - self.score = score - self.distance_in_meters = distance_in_meters - self.info = info - self.entity_type = entity_type - self.point_of_interest = point_of_interest - self.address = address - self.position = None if not position else LatLon( - position.lat, position.lon - ) - self.viewport = viewport - self.entry_points = entry_points - self.address_ranges = None if not position else LatLon( - address_ranges.range_left, address_ranges.range_right - ) - self.data_sources = data_sources - self.match_type = match_type - self.detour_time = detour_time - - -class SearchAddressResult(object): - """This object is returned from a successful Search calls. - - Variables are only populated by the server, and will be ignored when sending a request. - - :keyword summary: Summary object for a Search API response. - :paramtype summary: ~azure.maps.search.models.SearchSummary - :keyword results: A list of Search API results. - :paramtype results: list[~azure.maps.search.models.SearchAddressResultItem] - """ - - def __init__( - self, - summary: SearchSummary = None, - results: List[SearchAddressResultItem] = None - ): - self.query = summary.query - self.query_type = summary.query_type - self.query_time = summary.query_time - self.num_results = summary.num_results - self.top = summary.top - self.skip = summary.skip - self.total_results = summary.total_results - self.fuzzy_level = summary.fuzzy_level - self.geo_bias = None if not summary.geo_bias else LatLon( - summary.geo_bias.lat, summary.geo_bias.lon - ) - self.results = results - - -class ReverseSearchAddressResultItem(object): - """Result object for a Search Address Reverse response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :keyword address: The address of the result. - :paramtype address: ~azure.maps.search.models.Address - :keyword position: Position property in the form of "latitude,longitude". - :paramtype position: ~azure.maps.search.models.LatLon - :keyword road_use: - :paramtype road_use: list[str] - :keyword match_type: Information on the type of match. - :paramtype match_type: str or ~azure.maps.search.models.MatchType - """ - - def __init__( - self, - *, - address: Address = None, - position: LatLon = None, - road_use: List[str] = None, - match_type: str = None - ): - self.address = address - self.position = None if not position else LatLon( - float(position.split(',')[0]), float(position.split(',')[1]) - ) - self.road_use = road_use - self.match_type = match_type - - -class ReverseSearchAddressResult(object): - """This object is returned from a successful Search Address Reverse call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :keyword summary: Summary object for a Search Address Reverse response. - :paramtype summary: ~azure.maps.search.models.SearchSummary - :keyword results: Addresses array. - :paramtype results: list[~azure.maps.search.models.ReverseSearchAddressResultItem] - """ - - def __init__( - self, - *, - summary: SearchSummary = None, - results: List[ReverseSearchAddressResultItem] = None - ): - self.query_type = summary.query_type - self.query_time = summary.query_time - self.results = results - - -class ReverseSearchAddressBatchItem(_ReverseSearchAddressBatchItem): - """An item returned from Search Address Reverse Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :keyword response: The result of the query. SearchAddressReverseResponse if the query completed - successfully, ErrorResponse otherwise. - :paramtype response: ~azure.maps.search.models.ReverseSearchAddressBatchItemResponse - """ - - def __init__( - self, - **kwargs - ): - super(ReverseSearchAddressBatchItem, self).__init__(**kwargs) - self.response = None - - -class ReverseSearchAddressBatchProcessResult(object): - """This object is returned from a successful Search Address Reverse Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :keyword summary: Summary of the results for the batch request. - :paramtype summary: ~azure.maps.search._generated.models.BatchResultSummary - :keyword items: Array containing the batch results. - :paramtype items: list[ReverseSearchAddressBatchItem] - """ - - def __init__( - self, - *, - summary: BatchResultSummary = None, - items: List[ReverseSearchAddressBatchItem] = None - ): - self.summary = summary - self.items = items - -class GeoJsonObject(msrest.serialization.Model): - """A valid ``GeoJSON`` object. - Please refer to `RFC 7946 `__ for details. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: GeoJsonFeature, GeoJsonFeatureCollection, GeoJsonGeometry, - GeoJsonGeometryCollection, GeoJsonLineString, GeoJsonMultiLineString, - GeoJsonMultiPoint, GeoJsonMultiPolygon, GeoJsonPoint, GeoJsonPolygon. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search._generated.models.GeoJsonObjectType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Feature': 'GeoJsonFeature', 'FeatureCollection': 'GeoJsonFeatureCollection', - 'GeoJsonGeometry': 'GeoJsonGeometry', 'GeometryCollection': 'GeoJsonGeometryCollection', - 'LineString': 'GeoJsonLineString', 'MultiLineString': 'GeoJsonMultiLineString', - 'MultiPoint': 'GeoJsonMultiPoint', 'MultiPolygon': 'GeoJsonMultiPolygon', - 'Point': 'GeoJsonPoint', 'Polygon': 'GeoJsonPolygon' - } - } - - def __init__( - self, - type_: Union[str, GeoJsonObjectType] = None, - **kwargs - ): - super(GeoJsonObject, self).__init__(**kwargs) - self.type = type_ # type: Optional[Union[str, GeoJsonObjectType]] - -class GeoJsonFeatureData(msrest.serialization.Model): - """GeoJsonFeatureData. - - All required parameters must be populated in order to send to Azure. - - :param geometry: Required. A valid ``GeoJSON`` object. Please refer to `RFC 7946 - `__ for details. - :type geometry: ~azure.maps.search.models.GeoJsonObject - :param properties: Properties can contain any additional metadata about the ``Feature``. Value - can be any JSON object or a JSON null value. - :type properties: object - :param feature_type: The type of the feature. The value depends on the data model the current - feature is part of. Some data models may have an empty value. - :type feature_type: str - """ - - _validation = { - 'geometry': {'required': True}, - } - - _attribute_map = { - 'geometry': {'key': 'geometry', 'type': 'GeoJsonObject'}, - 'properties': {'key': 'properties', 'type': 'object'}, - 'feature_type': {'key': 'featureType', 'type': 'str'}, - } - - def __init__( - self, - geometry: "GeoJsonObject", - *, - properties: Optional[object] = None, - feature_type: Optional[str] = None, - **kwargs - ): - super(GeoJsonFeatureData, self).__init__(**kwargs) - self.geometry = geometry - self.properties = properties - self.feature_type = feature_type - -class GeoJsonFeature(GeoJsonObject, GeoJsonFeatureData): - """A valid ``GeoJSON Feature`` object type. - Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param geometry: Required. A valid ``GeoJSON`` object. Please refer to `RFC 7946 - `__ for details. - :type geometry: ~azure.maps.search.models.GeoJsonObject - :param properties: Properties can contain any additional metadata about the ``Feature``. Value - can be any JSON object or a JSON null value. - :type properties: object - :param feature_type: The type of the feature. The value depends on the data model the current - feature is part of. Some data models may have an empty value. - :type feature_type: str - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search._generated.models.GeoJsonObjectType - """ - - def __init__( - self, - geometry: GeoJsonObject, - *, - properties: Optional[object] = None, - feature_type: Optional[str] = None, - **kwargs - ): - super(GeoJsonFeature, self).__init__( - geometry=geometry, properties=properties, feature_type=feature_type, **kwargs - ) - self.geometry = geometry - self.properties = properties - self.feature_type = feature_type - self.type = 'Feature' # type: str - - -class GeoJsonFeatureCollectionData(msrest.serialization.Model): - """GeoJsonFeatureCollectionData. - - All required parameters must be populated in order to send to Azure. - - :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. - :type features: list[~azure.maps.search.models.GeoJsonFeature] - """ - - _validation = { - 'features': {'required': True}, - } - - _attribute_map = { - 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, - } - - def __init__( - self, - *, - features: List["GeoJsonFeature"], - **kwargs - ): - super(GeoJsonFeatureCollectionData, self).__init__(**kwargs) - self.features = features - - -class GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): - """A valid ``GeoJSON FeatureCollection`` object type. - Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. - :type features: list[~azure.maps.search.models.GeoJsonFeature] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search._generated.models.GeoJsonObjectType - """ - - _validation = { - 'features': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - features: List["GeoJsonFeature"], - **kwargs - ): - super(GeoJsonFeatureCollection, self).__init__(features=features, **kwargs) - self.features = features - self.type = 'FeatureCollection' # type: str - self.type = 'FeatureCollection' # type: str - - -class GeoJsonGeometry(GeoJsonObject): - """A valid ``GeoJSON`` geometry object. - The type must be one of the seven valid GeoJSON geometry types - - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. - Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search._generated.models.GeoJsonObjectType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoJsonGeometry, self).__init__(**kwargs) - self.type = 'GeoJsonGeometry' # type: str - - -class GeoJsonGeometryCollectionData(msrest.serialization.Model): - """GeoJsonGeometryCollectionData. - - All required parameters must be populated in order to send to Azure. - - :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** - that coordinates in GeoJSON are in x, y order (longitude, latitude). - :type geometries: list[~azure.maps.search.models.GeoJsonObject] - """ - - _validation = { - 'geometries': {'required': True}, - } - - _attribute_map = { - 'geometries': {'key': 'geometries', 'type': '[GeoJsonObject]'}, - } - - def __init__( - self, - *, - geometries: List["GeoJsonObject"], - **kwargs - ): - super(GeoJsonGeometryCollectionData, self).__init__(**kwargs) - self.geometries = geometries - - -class GeoJsonGeometryCollection(GeoJsonObject, GeoJsonGeometryCollectionData): - """A valid ``GeoJSON GeometryCollection`` object type. - Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** - that coordinates in GeoJSON are in x, y order (longitude, latitude). - :type geometries: list[~azure.maps.search.models.GeoJsonObject] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search._generated.models.GeoJsonObjectType - """ - - _validation = { - 'geometries': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'geometries': {'key': 'geometries', 'type': '[GeoJsonObject]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - geometries: List["GeoJsonObject"], - **kwargs - ): - super(GeoJsonGeometryCollection, self).__init__(geometries=geometries, **kwargs) - self.geometries = geometries - self.type = 'GeometryCollection' # type: str - self.type = 'GeometryCollection' # type: str - - -class GeoJsonLineStringData(msrest.serialization.Model): - """GeoJsonLineStringData. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. - :type coordinates: list[LatLon] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[LatLon]'}, - } - - def __init__( - self, - *, - coordinates: List[LatLon], - **kwargs - ): - super(GeoJsonLineStringData, self).__init__(**kwargs) - self.coordinates = coordinates - -class GeoJsonLineString(GeoJsonObject, GeoJsonLineStringData): - """A valid ``GeoJSON LineString`` geometry type. - Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. - :type coordinates: list[LatLon] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search._generated.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[LatLon]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - coordinates: List[LatLon], - **kwargs - ): - super(GeoJsonLineString, self).__init__(coordinates=coordinates, **kwargs) - self.coordinates = coordinates - self.type = 'LineString' # type: str - self.type = 'LineString' # type: str - - -class GeoJsonMultiLineStringData(msrest.serialization.Model): - """GeoJsonMultiLineStringData. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. - :type coordinates: list[list[LatLon]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[LatLon]]'}, - } - - def __init__( - self, - *, - coordinates: List[List[LatLon]], - **kwargs - ): - super(GeoJsonMultiLineStringData, self).__init__(**kwargs) - self.coordinates = coordinates - - -class GeoJsonMultiLineString(GeoJsonObject, GeoJsonMultiLineStringData): - """A valid ``GeoJSON MultiLineString`` geometry type. - Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. - :type coordinates: list[list[LatLon]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search._generated.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[LatLon]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - coordinates: List[List[LatLon]], - **kwargs - ): - super(GeoJsonMultiLineString, self).__init__(coordinates=coordinates, **kwargs) - self.coordinates = coordinates - self.type = 'MultiLineString' # type: str - self.type = 'MultiLineString' # type: str - - -class GeoJsonMultiPointData(msrest.serialization.Model): - """Data contained by a ``GeoJson MultiPoint``. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. - :type coordinates: list[LatLon] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[LatLon]'}, - } - - def __init__( - self, - *, - coordinates: List[LatLon], - **kwargs - ): - super(GeoJsonMultiPointData, self).__init__(**kwargs) - self.coordinates = coordinates - - -class GeoJsonMultiPoint(GeoJsonObject, GeoJsonMultiPointData): - """A valid ``GeoJSON MultiPoint`` geometry type. - Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. - :type coordinates: list[LatLon] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search._generated.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[LatLon]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - coordinates: List[LatLon], - **kwargs - ): - super(GeoJsonMultiPoint, self).__init__(coordinates=coordinates, **kwargs) - self.coordinates = coordinates - self.type = 'MultiPoint' # type: str - self.type = 'MultiPoint' # type: str - - -class GeoJsonMultiPolygonData(msrest.serialization.Model): - """GeoJsonMultiPolygonData. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** - that coordinates in GeoJSON are in x, y order (longitude, latitude). - :type coordinates: list[list[list[LatLon]]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[LatLon]]]'}, - } - - def __init__( - self, - *, - coordinates: List[List[List[LatLon]]], - **kwargs - ): - super(GeoJsonMultiPolygonData, self).__init__(**kwargs) - self.coordinates = coordinates - - -class GeoJsonMultiPolygon(GeoJsonObject, GeoJsonMultiPolygonData): - """A valid ``GeoJSON MultiPolygon`` object type. - Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** - that coordinates in GeoJSON are in x, y order (longitude, latitude). - :type coordinates: list[list[list[LatLon]]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search._generated.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[[LatLon]]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - coordinates: List[List[List[LatLon]]], - **kwargs - ): - super(GeoJsonMultiPolygon, self).__init__(coordinates=coordinates, **kwargs) - self.coordinates = coordinates - self.type = 'MultiPolygon' # type: str - self.type = 'MultiPolygon' # type: str - - -class GeoJsonPointData(msrest.serialization.Model): - """Data contained by a ``GeoJson Point``. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. - The first two elements are *longitude* and *latitude*, precisely in that order. - *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 - `__ for details. - :type coordinates: LatLon - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': 'LatLon'}, - } - - def __init__( - self, - *, - coordinates: LatLon, - **kwargs - ): - super(GeoJsonPointData, self).__init__(**kwargs) - self.coordinates = coordinates - - -class GeoJsonPoint(GeoJsonObject, GeoJsonPointData): - """A valid ``GeoJSON Point`` geometry type. - Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. - The first two elements are *longitude* and *latitude*, precisely in that order. - *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 - `__ for details. - :type coordinates: LatLon - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search._models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': 'LatLon'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - coordinates: LatLon, - **kwargs - ): - super(GeoJsonPoint, self).__init__(coordinates=coordinates, **kwargs) - self.coordinates = coordinates - self.type = 'Point' # type: str - -class GeoJsonPolygonData(msrest.serialization.Model): - """GeoJsonPolygonData. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. - :type coordinates: list[list[LatLon]] - """ - - _validation = { - 'coordinates': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[LatLon]]'}, - } - - def __init__( - self, - *, - coordinates: List[List[LatLon]], - **kwargs - ): - super(GeoJsonPolygonData, self).__init__(**kwargs) - self.coordinates = coordinates - - -class GeoJsonPolygon(GeoJsonObject, GeoJsonPolygonData): - """A valid ``GeoJSON Polygon`` geometry type. - Please refer to `RFC 7946 `__ for details. - - All required parameters must be populated in order to send to Azure. - - :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. - :type coordinates: list[list[LatLon]] - :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON - object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, - GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values - include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", - "GeometryCollection", "Feature", "FeatureCollection". - :type type: str or ~azure.maps.search._generated.models.GeoJsonObjectType - """ - - _validation = { - 'coordinates': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'coordinates': {'key': 'coordinates', 'type': '[[LatLon]]'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - coordinates: List[List[LatLon]], - **kwargs - ): - super(GeoJsonPolygon, self).__init__(coordinates=coordinates, **kwargs) - self.coordinates = coordinates - self.type = 'Polygon' # type: str - - -class SearchAlongRouteOptions(object): - def __init__( - self, - *, - route: Optional["GeoJsonLineString"] = None, - **kwargs - ): - super(SearchAlongRouteOptions, self).__init__(**kwargs) - self.route = route - - -class SearchAddressBatchItem(_SearchAddressBatchItem): - """An item returned from Search Address Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :keyword status_code: HTTP request status code. - :paramtype status_code: int - :keyword response: The result of the query. SearchAddressResponse if the query completed - successfully, ErrorResponse otherwise. - :paramtype response: ~azure.maps.search.models.SearchAddressBatchItemResponse - """ - - def __init__( - self, - response: SearchAddressBatchItemResponse = None, - **kwargs - ): - super(SearchAddressBatchItem, self).__init__(**kwargs) - self.response = response - -class SearchAddressBatchResult(object): - """This object is returned from a successful Search Address Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :keyword summary: Summary of the results for the batch request. - :paramtype summary: ~azure.maps.search._generated.models.BatchResultSummary - :keyword items: Array containing the batch results. - :paramtype items: list[~azure.maps.search._generated.models.SearchAddressBatchItem] - """ - - def __init__( - self, - summary: BatchResultSummary = None, - items: List[SearchAddressBatchItem] = None - ): - self.summary = summary - self.items = items diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_generated/operations/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/operations/__init__.py similarity index 62% rename from sdk/maps/azure-maps-search/azure/maps/search/_generated/operations/__init__.py rename to sdk/maps/azure-maps-search/azure/maps/search/operations/__init__.py index c7f640e252e17..8d2ba24d8b3f2 100644 --- a/sdk/maps/azure-maps-search/azure/maps/search/_generated/operations/__init__.py +++ b/sdk/maps/azure-maps-search/azure/maps/search/operations/__init__.py @@ -6,8 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._search_operations import SearchOperations +from ._operations import SearchOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'SearchOperations', + "SearchOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/maps/azure-maps-search/azure/maps/search/operations/_operations.py b/sdk/maps/azure-maps-search/azure/maps/search/operations/_operations.py new file mode 100644 index 0000000000000..dbaa74b6c5945 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/operations/_operations.py @@ -0,0 +1,1049 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_search_get_geocoding_request( + *, + top: int = 5, + query: Optional[str] = None, + address_line: Optional[str] = None, + country_region: Optional[str] = None, + bbox: Optional[List[float]] = None, + view: Optional[str] = None, + coordinates: Optional[List[float]] = None, + admin_district: Optional[str] = None, + admin_district2: Optional[str] = None, + admin_district3: Optional[str] = None, + locality: Optional[str] = None, + postal_code: Optional[str] = None, + accept_language: Optional[str] = None, + client_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + accept = _headers.pop("Accept", "application/geo+json, application/json") + + # Construct URL + _url = "/geocode" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["top"] = _SERIALIZER.query("top", top, "int", maximum=20, minimum=1) + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if address_line is not None: + _params["addressLine"] = _SERIALIZER.query("address_line", address_line, "str") + if country_region is not None: + _params["countryRegion"] = _SERIALIZER.query("country_region", country_region, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "[float]", div=",") + if view is not None: + _params["view"] = _SERIALIZER.query("view", view, "str") + if coordinates is not None: + _params["coordinates"] = _SERIALIZER.query("coordinates", coordinates, "[float]", div=",") + if admin_district is not None: + _params["adminDistrict"] = _SERIALIZER.query("admin_district", admin_district, "str") + if admin_district2 is not None: + _params["adminDistrict2"] = _SERIALIZER.query("admin_district2", admin_district2, "str") + if admin_district3 is not None: + _params["adminDistrict3"] = _SERIALIZER.query("admin_district3", admin_district3, "str") + if locality is not None: + _params["locality"] = _SERIALIZER.query("locality", locality, "str") + if postal_code is not None: + _params["postalCode"] = _SERIALIZER.query("postal_code", postal_code, "str") + + # Construct headers + if accept_language is not None: + _headers["Accept-Language"] = _SERIALIZER.header("accept_language", accept_language, "str") + if client_id is not None: + _headers["x-ms-client-id"] = _SERIALIZER.header("client_id", client_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_search_get_geocoding_batch_request( + *, client_id: Optional[str] = None, accept_language: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/geocode:batch" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_id is not None: + _headers["x-ms-client-id"] = _SERIALIZER.header("client_id", client_id, "str") + if accept_language is not None: + _headers["Accept-Language"] = _SERIALIZER.header("accept_language", accept_language, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_search_get_polygon_request( + *, + coordinates: List[float], + view: Optional[str] = None, + result_type: str = "countryRegion", + resolution: str = "medium", + client_id: Optional[str] = None, + accept_language: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + accept = _headers.pop("Accept", "application/geo+json, application/json") + + # Construct URL + _url = "/search/polygon" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["coordinates"] = _SERIALIZER.query("coordinates", coordinates, "[float]", div=",") + if view is not None: + _params["view"] = _SERIALIZER.query("view", view, "str") + if result_type is not None: + _params["resultType"] = _SERIALIZER.query("result_type", result_type, "str") + if resolution is not None: + _params["resolution"] = _SERIALIZER.query("resolution", resolution, "str") + + # Construct headers + if client_id is not None: + _headers["x-ms-client-id"] = _SERIALIZER.header("client_id", client_id, "str") + if accept_language is not None: + _headers["Accept-Language"] = _SERIALIZER.header("accept_language", accept_language, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_search_get_reverse_geocoding_request( # pylint: disable=name-too-long + *, + coordinates: List[float], + result_types: Optional[List[str]] = None, + view: Optional[str] = None, + client_id: Optional[str] = None, + accept_language: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + accept = _headers.pop("Accept", "application/geo+json, application/json") + + # Construct URL + _url = "/reverseGeocode" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["coordinates"] = _SERIALIZER.query("coordinates", coordinates, "[float]", div=",") + if result_types is not None: + _params["resultTypes"] = _SERIALIZER.query("result_types", result_types, "[str]", div=",") + if view is not None: + _params["view"] = _SERIALIZER.query("view", view, "str") + + # Construct headers + if client_id is not None: + _headers["x-ms-client-id"] = _SERIALIZER.header("client_id", client_id, "str") + if accept_language is not None: + _headers["Accept-Language"] = _SERIALIZER.header("accept_language", accept_language, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_search_get_reverse_geocoding_batch_request( # pylint: disable=name-too-long + *, client_id: Optional[str] = None, accept_language: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/reverseGeocode:batch" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_id is not None: + _headers["x-ms-client-id"] = _SERIALIZER.header("client_id", client_id, "str") + if accept_language is not None: + _headers["Accept-Language"] = _SERIALIZER.header("accept_language", accept_language, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class SearchOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.maps.search.MapsSearchClient`'s + :attr:`search` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get_geocoding( + self, + *, + top: int = 5, + query: Optional[str] = None, + address_line: Optional[str] = None, + country_region: Optional[str] = None, + bbox: Optional[List[float]] = None, + view: Optional[str] = None, + coordinates: Optional[List[float]] = None, + admin_district: Optional[str] = None, + admin_district2: Optional[str] = None, + admin_district3: Optional[str] = None, + locality: Optional[str] = None, + postal_code: Optional[str] = None, + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to get longitude and latitude coordinates of a street address or name of a place. + + The ``Get Geocoding`` API is an HTTP ``GET`` request that returns the longitude and latitude + coordinates of the location being searched. + + In many cases, the complete search service might be too much, for instance if you are only + interested in traditional geocoding. Search can also be accessed for address look up + exclusively. The geocoding is performed by hitting the geocoding endpoint with just the address + or partial address in question. The geocoding search index will be queried for everything above + the street level data. No Point of Interest (POIs) will be returned. Note that the geocoder is + very tolerant of typos and incomplete addresses. It will also handle everything from exact + street addresses or street or intersections as well as higher level geographies such as city + centers, counties and states. The response also returns detailed address properties such as + street, postal code, municipality, and country/region information. + + :keyword top: Maximum number of responses that will be returned. Default: 5, minimum: 1 and + maximum: 20. Default value is 5. + :paramtype top: int + :keyword query: A string that contains information about a location, such as an address or + landmark name. Default value is None. + :paramtype query: str + :keyword address_line: The official street line of an address relative to the area, as + specified by the locality, or postalCode, properties. Typical use of this element would be to + provide a street address or any official address. + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype address_line: str + :keyword country_region: Signal for the geocoding result to an `ISO 3166-1 Alpha-2 + region/country code `_ that is specified e.g. + FR./ + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype country_region: str + :keyword bbox: A rectangular area on the earth defined as a bounding box object. The sides of + the rectangles are defined by longitude and latitude values. When you specify this parameter, + the geographical area is taken into account when computing the results of a location query. + + Example: lon1,lat1,lon2,lat2. Default value is None. + :paramtype bbox: list[float] + :keyword view: A string that represents an `ISO 3166-1 Alpha-2 region/country code + `_. This will alter Geopolitical disputed + borders and labels to align with the specified user region. By default, the View parameter is + set to “Auto” even if you haven’t defined it in the request. + + Please refer to `Supported Views `_ for details and + to see the available Views. Default value is None. + :paramtype view: str + :keyword coordinates: A point on the earth specified as a longitude and latitude. When you + specify this parameter, the user’s location is taken into account and the results returned may + be more relevant to the user. Example: &coordinates=lon,lat. Default value is None. + :paramtype coordinates: list[float] + :keyword admin_district: The country subdivision portion of an address, such as WA. + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype admin_district: str + :keyword admin_district2: The county for the structured address, such as King. + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype admin_district2: str + :keyword admin_district3: The named area for the structured address. + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype admin_district3: str + :keyword locality: The locality portion of an address, such as Seattle. + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype locality: str + :keyword postal_code: The postal code portion of an address. + + **If query is given, should not use this parameter.**. Default value is None. + :paramtype postal_code: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_search_get_geocoding_request( + top=top, + query=query, + address_line=address_line, + country_region=country_region, + bbox=bbox, + view=view, + coordinates=coordinates, + admin_district=admin_district, + admin_district2=admin_district2, + admin_district3=admin_district3, + locality=locality, + postal_code=postal_code, + accept_language=self._config.accept_language, + client_id=self._config.client_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + def get_geocoding_batch( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to send a batch of queries to the `Geocoding `_ API in + a single request. + + The ``Get Geocoding Batch`` API is an HTTP ``POST`` request that sends batches of up to **100** + queries to the `Geocoding `_ API in a single request. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *geocoding* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 2 *geocoding* queries: + + A *geocoding* batchItem object can accept any of the supported *geocoding* `URI parameters + `__. + + The batch should contain at least **1** query. + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The batch response contains a ``summary`` component that indicates the ``totalRequests`` that + were part of the original batch request and ``successfulRequests`` i.e. queries which were + executed successfully. The batch response also includes a ``batchItems`` array which contains a + response for each and every query in the batch request. The ``batchItems`` will contain the + results in the exact same order the original queries were sent in the batch request. Each item + is of one of the following types: + + * `GeocodingResponse `_ - If the query completed successfully. + + * ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in this case. + + :param body: The list of address geocoding queries/requests to process. + The list can contain a max of 100 queries and must contain at least 1 query. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_geocoding_batch( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to send a batch of queries to the `Geocoding `_ API in + a single request. + + The ``Get Geocoding Batch`` API is an HTTP ``POST`` request that sends batches of up to **100** + queries to the `Geocoding `_ API in a single request. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *geocoding* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 2 *geocoding* queries: + + A *geocoding* batchItem object can accept any of the supported *geocoding* `URI parameters + `__. + + The batch should contain at least **1** query. + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The batch response contains a ``summary`` component that indicates the ``totalRequests`` that + were part of the original batch request and ``successfulRequests`` i.e. queries which were + executed successfully. The batch response also includes a ``batchItems`` array which contains a + response for each and every query in the batch request. The ``batchItems`` will contain the + results in the exact same order the original queries were sent in the batch request. Each item + is of one of the following types: + + * `GeocodingResponse `_ - If the query completed successfully. + + * ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in this case. + + :param body: The list of address geocoding queries/requests to process. + The list can contain a max of 100 queries and must contain at least 1 query. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_geocoding_batch(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Use to send a batch of queries to the `Geocoding `_ API in + a single request. + + The ``Get Geocoding Batch`` API is an HTTP ``POST`` request that sends batches of up to **100** + queries to the `Geocoding `_ API in a single request. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *geocoding* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 2 *geocoding* queries: + + A *geocoding* batchItem object can accept any of the supported *geocoding* `URI parameters + `__. + + The batch should contain at least **1** query. + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The batch response contains a ``summary`` component that indicates the ``totalRequests`` that + were part of the original batch request and ``successfulRequests`` i.e. queries which were + executed successfully. The batch response also includes a ``batchItems`` array which contains a + response for each and every query in the batch request. The ``batchItems`` will contain the + results in the exact same order the original queries were sent in the batch request. Each item + is of one of the following types: + + * `GeocodingResponse `_ - If the query completed successfully. + + * ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in this case. + + :param body: The list of address geocoding queries/requests to process. + The list can contain a max of 100 queries and must contain at least 1 query. Is either a JSON + type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_search_get_geocoding_batch_request( + client_id=self._config.client_id, + accept_language=self._config.accept_language, + content_type=content_type, + api_version=self._config.api_version, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace + def get_polygon( + self, + *, + coordinates: List[float], + view: Optional[str] = None, + result_type: str = "countryRegion", + resolution: str = "medium", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to get polygon data of a geographical area shape such as a city or a country region. + + The ``Get Polygon`` API is an HTTP ``GET`` request that supplies polygon data of a geographical + area outline such as a city or a country region. + + :keyword coordinates: A point on the earth specified as a longitude and latitude. Example: + &coordinates=lon,lat. Required. + :paramtype coordinates: list[float] + :keyword view: A string that represents an `ISO 3166-1 Alpha-2 region/country code + `_. This will alter Geopolitical disputed + borders and labels to align with the specified user region. By default, the View parameter is + set to “Auto” even if you haven’t defined it in the request. + + Please refer to `Supported Views `_ for details and + to see the available Views. Default value is None. + :paramtype view: str + :keyword result_type: The geopolitical concept to return a boundary for. If not specified, the + default is ``countryRegion`` result type. Known values are: "countryRegion", "adminDistrict", + "adminDistrict2", "postalCode", "postalCode2", "postalCode3", "postalCode4", "neighborhood", + and "locality". Default value is "countryRegion". + :paramtype result_type: str + :keyword resolution: Resolution determines the amount of points to send back. If not specified, + the default is medium resolution. Known values are: "small", "medium", "large", and "huge". + Default value is "medium". + :paramtype resolution: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_search_get_polygon_request( + coordinates=coordinates, + view=view, + result_type=result_type, + resolution=resolution, + client_id=self._config.client_id, + accept_language=self._config.accept_language, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace + def get_reverse_geocoding( + self, + *, + coordinates: List[float], + result_types: Optional[List[str]] = None, + view: Optional[str] = None, + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to get a street address and location info from longitude and latitude coordinates. + + The ``Get Reverse Geocoding`` API is an HTTP ``GET`` request used to translate a coordinate + (example: 37.786505, -122.3862) into a human understandable street address. Useful in tracking + applications where you receive a GPS feed from the device or asset and wish to know the address + associated with the coordinates. This endpoint will return address information for a given + coordinate. + + :keyword coordinates: The coordinates of the location that you want to reverse geocode. + Example: &coordinates=lon,lat. Required. + :paramtype coordinates: list[float] + :keyword result_types: Specify entity types that you want in the response. Only the types you + specify will be returned. If the point cannot be mapped to the entity types you specify, no + location information is returned in the response. + Default value is all possible entities. + A comma separated list of entity types selected from the following options. + + + * Address + * Neighborhood + * PopulatedPlace + * Postcode1 + * AdminDivision1 + * AdminDivision2 + * CountryRegion + + These entity types are ordered from the most specific entity to the least specific entity. + When entities of more than one entity type are found, only the most specific entity is + returned. For example, if you specify Address and AdminDistrict1 as entity types and entities + were found for both types, only the Address entity information is returned in the response. + Default value is None. + :paramtype result_types: list[str] + :keyword view: A string that represents an `ISO 3166-1 Alpha-2 region/country code + `_. This will alter Geopolitical disputed + borders and labels to align with the specified user region. By default, the View parameter is + set to “Auto” even if you haven’t defined it in the request. + + Please refer to `Supported Views `_ for details and + to see the available Views. Default value is None. + :paramtype view: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_search_get_reverse_geocoding_request( + coordinates=coordinates, + result_types=result_types, + view=view, + client_id=self._config.client_id, + accept_language=self._config.accept_language, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + def get_reverse_geocoding_batch( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to send a batch of queries to the `Reverse Geocoding + `_ API in a single request. + + The ``Get Reverse Geocoding Batch`` API is an HTTP ``POST`` request that sends batches of up to + **100** queries to `Reverse Geocoding `_ API using + a single request. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *reverse geocoding* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 2 *reverse geocoding* + queries: + + A *reverse geocoding* batchItem object can accept any of the supported *reverse geocoding* `URI + parameters `__. + + The batch should contain at least **1** query. + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The batch response contains a ``summary`` component that indicates the ``totalRequests`` that + were part of the original batch request and ``successfulRequests`` i.e. queries which were + executed successfully. The batch response also includes a ``batchItems`` array which contains a + response for each and every query in the batch request. The ``batchItems`` will contain the + results in the exact same order the original queries were sent in the batch request. Each item + is of one of the following types: + + * `GeocodingResponse `_ - If the query completed successfully. + + * ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in this case. + + :param body: The list of reverse geocoding queries/requests to + process. The list can contain a max of 100 queries and must contain at least 1 query. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_reverse_geocoding_batch( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to send a batch of queries to the `Reverse Geocoding + `_ API in a single request. + + The ``Get Reverse Geocoding Batch`` API is an HTTP ``POST`` request that sends batches of up to + **100** queries to `Reverse Geocoding `_ API using + a single request. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *reverse geocoding* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 2 *reverse geocoding* + queries: + + A *reverse geocoding* batchItem object can accept any of the supported *reverse geocoding* `URI + parameters `__. + + The batch should contain at least **1** query. + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The batch response contains a ``summary`` component that indicates the ``totalRequests`` that + were part of the original batch request and ``successfulRequests`` i.e. queries which were + executed successfully. The batch response also includes a ``batchItems`` array which contains a + response for each and every query in the batch request. The ``batchItems`` will contain the + results in the exact same order the original queries were sent in the batch request. Each item + is of one of the following types: + + * `GeocodingResponse `_ - If the query completed successfully. + + * ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in this case. + + :param body: The list of reverse geocoding queries/requests to + process. The list can contain a max of 100 queries and must contain at least 1 query. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_reverse_geocoding_batch( + self, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Use to send a batch of queries to the `Reverse Geocoding + `_ API in a single request. + + The ``Get Reverse Geocoding Batch`` API is an HTTP ``POST`` request that sends batches of up to + **100** queries to `Reverse Geocoding `_ API using + a single request. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *reverse geocoding* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 2 *reverse geocoding* + queries: + + A *reverse geocoding* batchItem object can accept any of the supported *reverse geocoding* `URI + parameters `__. + + The batch should contain at least **1** query. + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The batch response contains a ``summary`` component that indicates the ``totalRequests`` that + were part of the original batch request and ``successfulRequests`` i.e. queries which were + executed successfully. The batch response also includes a ``batchItems`` array which contains a + response for each and every query in the batch request. The ``batchItems`` will contain the + results in the exact same order the original queries were sent in the batch request. Each item + is of one of the following types: + + * `GeocodingResponse `_ - If the query completed successfully. + + * ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in this case. + + :param body: The list of reverse geocoding queries/requests to + process. The list can contain a max of 100 queries and must contain at least 1 query. Is either + a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_search_get_reverse_geocoding_batch_request( + client_id=self._config.client_id, + accept_language=self._config.accept_language, + content_type=content_type, + api_version=self._config.api_version, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore + + return cast(JSON, deserialized) # type: ignore diff --git a/sdk/maps/azure-maps-search/azure/maps/search/operations/_patch.py b/sdk/maps/azure-maps-search/azure/maps/search/operations/_patch.py new file mode 100644 index 0000000000000..5755fd181b3f1 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/operations/_patch.py @@ -0,0 +1,22 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + + +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/maps/azure-maps-search/dev_requirements.txt b/sdk/maps/azure-maps-search/dev_requirements.txt index 60a4d2ac2b5e2..385751a7107b8 100644 --- a/sdk/maps/azure-maps-search/dev_requirements.txt +++ b/sdk/maps/azure-maps-search/dev_requirements.txt @@ -1,4 +1,4 @@ -e ../../../tools/azure-sdk-tools -e ../../core/azure-core -e ../../identity/azure-identity -aiohttp>=3.0; python_version >= '3.7' \ No newline at end of file +aiohttp>=3.0; python_version >= '3.8' \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/mypy.ini b/sdk/maps/azure-maps-search/mypy.ini index 5692bc5d25e94..3e79d3d273149 100644 --- a/sdk/maps/azure-maps-search/mypy.ini +++ b/sdk/maps/azure-maps-search/mypy.ini @@ -1,5 +1,3 @@ [mypy] python_version = 3.10 -[mypy-azure.*] -ignore_errors = True diff --git a/sdk/maps/azure-maps-search/pyproject.toml b/sdk/maps/azure-maps-search/pyproject.toml index bf7e912a2e2dc..b34976c60fd32 100644 --- a/sdk/maps/azure-maps-search/pyproject.toml +++ b/sdk/maps/azure-maps-search/pyproject.toml @@ -1,5 +1,5 @@ [tool.azure-sdk-build] pyright = false type_check_samples = false -verifytypes = false ci_enabled = true +strict_sphinx = false diff --git a/sdk/maps/azure-maps-search/pytest.ini b/sdk/maps/azure-maps-search/pytest.ini new file mode 100644 index 0000000000000..d280de047e8de --- /dev/null +++ b/sdk/maps/azure-maps-search/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +asyncio_mode = auto \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/README.md b/sdk/maps/azure-maps-search/samples/README.md index 5f87271bd39f4..e61d686689645 100644 --- a/sdk/maps/azure-maps-search/samples/README.md +++ b/sdk/maps/azure-maps-search/samples/README.md @@ -13,31 +13,22 @@ These code samples show common scenario operations with the Azure Maps Search cl Authenticate the client with a Azure Maps Search [API Key Credential](https://docs.microsoft.com/azure/azure-maps/how-to-manage-account-keys): -[samples authentication](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_authentication.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_authentication_async.py)) - Then for common Azure Maps Search operations: -* Perform fuzzy search: [sample_fuzzy_search.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_fuzzy_search.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_fuzzy_search_async.py)) - -* Perform get POI categories search: [sample_get_point_of_interest_categories.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_get_point_of_interest_categories.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_get_point_of_interest_categories_async.py)) - -* Perform reverse search address: [sample_reverse_search_address.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_reverse_search_address.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_search_address_async.py)) - -* Perform reverse search cross street address: [sample_reverse_search_cross_street_address.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_reverse_search_cross_street_address.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_search_cross_street_address_async.py)) +* Perform geocode search: [sample_geocode.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_geocode.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_geocode_async.py)) -* Get search nearby POI: [sample_search_nearby_point_of_interest.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_search_nearby_point_of_interest.py)) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_search_nearby_point_of_interest_async.py)) +* Perform geocode batch search: [sample_geocode_batch.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_geocode_batch.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_geocode_batch_async.py)) -* Get search POI: [sample_search_point_of_interest.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_search_point_of_interest.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_search_point_of_interest_async.py)) +* Perform reverse geocode search: [sample_reverse_geocode.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_reverse_geocode.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_geocode_async.py)) -* Get search POI category: [sample_search_point_of_interest_category.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_search_point_of_interest_category.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_search_point_of_interest_category_async.py)) +* Perform reverse batch geocode search: [sample_reverse_geocode_batch.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_reverse_geocode_batch.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_geocode_batch_async.py)) -* Perform search with structured address: [sample_search_structured_address.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_search_structured_address.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_search_structured_address_async.py)) +* Perform polygon search: [sample_get_polygon.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_get_polygon.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_get_polygon_async.py)) -* Search inside Geometry: [sample_search_inside_geometry.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/sample_search_inside_geometry.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-search/samples/async_samples/sample_search_inside_geometry_async.py)) ## Prerequisites -* Python 3.6 or later is required to use this package +* Python 3.8 or later is required to use this package * You must have an [Azure subscription](https://azure.microsoft.com/free/) * A deployed Maps Services resource. You can create the resource via [Azure Portal][azure_portal] or [Azure CLI][azure_cli]. @@ -56,7 +47,7 @@ Then for common Azure Maps Search operations: 1. Open a terminal window and `cd` to the directory that the samples are saved in. 2. Set the environment variables specified in the sample file you wish to run. -3. Follow the usage described in the file, e.g. `python sample_fuzzy_search.py` +3. Follow the usage described in the file, e.g. `python sample_geocode.py` ## Next steps diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_authentication_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_authentication_async.py deleted file mode 100644 index 5d028aca7d2d2..0000000000000 --- a/sdk/maps/azure-maps-search/samples/async_samples/sample_authentication_async.py +++ /dev/null @@ -1,38 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_authentication_async.py -DESCRIPTION: - This sample demonstrates how to authenticate with the Azure Maps Search - service with an Subscription key. See more details about authentication here: - https://docs.microsoft.com/azure/azure-maps/how-to-manage-account-keys -USAGE: - python sample_authentication_async.py - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" - -import asyncio -import os - -async def authentication_maps_service_client_with_subscription_key_credential_async(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search.aio import MapsSearchClient - - subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - async with maps_search_client: - result = await maps_search_client.get_point_of_interest_categories() - - print(result) - -if __name__ == '__main__': - asyncio.run(authentication_maps_service_client_with_subscription_key_credential_async()) \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_fuzzy_search_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_fuzzy_search_async.py deleted file mode 100644 index ff01c6b1db5d2..0000000000000 --- a/sdk/maps/azure-maps-search/samples/async_samples/sample_fuzzy_search_async.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_fuzzy_search_async.py -DESCRIPTION: - This sample demonstrates how to perform fuzzy search by location and lat/lon. -USAGE: - python sample_fuzzy_search_async.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import asyncio -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -async def fuzzy_search_async(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search.aio import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - async with maps_search_client: - result = await maps_search_client.fuzzy_search("seattle", coordinates=(47.60323, -122.33028)) - - print("Get Search Fuzzy with coordinates with search query: " + result.query) - print("Fuzzy level: {}".format(result.fuzzy_level)) - print("Total results: {}".format(result.num_results)) - print("Address from the first item in results: ") - print(result.results[0].address) - -if __name__ == '__main__': - asyncio.run(fuzzy_search_async()) diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_fuzzy_search_batch_async_with_batch_id.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_fuzzy_search_batch_async_with_batch_id.py deleted file mode 100644 index fcb6c60f1cce2..0000000000000 --- a/sdk/maps/azure-maps-search/samples/async_samples/sample_fuzzy_search_batch_async_with_batch_id.py +++ /dev/null @@ -1,63 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_fuzzy_search_batch_async_with_batch_id.py -DESCRIPTION: - This sample demonstrates how to perform fuzzy search by location and lat/lon. -USAGE: - python sample_fuzzy_search_batch_async_with_batch_id.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import asyncio -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - - -async def fuzzy_search_batch_with_search_queries(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search.aio import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - async with maps_search_client: - result = await maps_search_client.begin_fuzzy_search_batch( - search_queries=[ - "350 5th Ave, New York, NY 10118&limit=1", - "400 Broad St, Seattle, WA 98109&limit=6" - ], - polling=True, - ) - - print(result) - print(result.batch_id) - return result - -async def fuzzy_search_batch_with_batch_id(batch_id=None): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search.aio import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - async with maps_search_client: - result = await maps_search_client.begin_fuzzy_search_batch( - batch_id=batch_id, - ) - - print(result.__dict__) - print(result._polling_method._initial_response) - -async def main(): - result = await fuzzy_search_batch_with_search_queries() - await fuzzy_search_batch_with_batch_id(result.batch_id) - -if __name__ == '__main__': - asyncio.run(main()) diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_geocode_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_geocode_async.py new file mode 100644 index 0000000000000..5eb0ad84fd958 --- /dev/null +++ b/sdk/maps/azure-maps-search/samples/async_samples/sample_geocode_async.py @@ -0,0 +1,49 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: sample_geocode_async.py +DESCRIPTION: + This sample demonstrates how to perform search by location. +USAGE: + python sample_geocode_async.py + + Set the environment variables with your own values before running the sample: + - AZURE_SUBSCRIPTION_KEY - your subscription key +""" +import asyncio +import os + +from azure.core.exceptions import HttpResponseError + +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") + +async def geocode_async(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search.aio import MapsSearchClient + + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + try: + async with maps_search_client: + result = await maps_search_client.get_geocoding(query="15127 NE 24th Street, Redmond, WA 98052") + if result.get('features', False): + coordinates = result['features'][0]['geometry']['coordinates'] + longitude = coordinates[0] + latitude = coordinates[1] + + print(longitude, latitude) + else: + print("No results") + + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + +if __name__ == '__main__': + asyncio.run(geocode_async()) diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_geocode_batch_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_geocode_batch_async.py new file mode 100644 index 0000000000000..30ca9505c1355 --- /dev/null +++ b/sdk/maps/azure-maps-search/samples/async_samples/sample_geocode_batch_async.py @@ -0,0 +1,59 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: sample_geocode_batch_async.py +DESCRIPTION: + This sample demonstrates how to perform batch search by location. +USAGE: + python sample_geocode_batch_async.py + + Set the environment variables with your own values before running the sample: + - AZURE_SUBSCRIPTION_KEY - your subscription key +""" +import asyncio +import os + +from azure.core.exceptions import HttpResponseError + +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") + +async def geocode_batch_async(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search.aio import MapsSearchClient + + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + try: + async with maps_search_client: + result = await maps_search_client.get_geocoding_batch({ + "batchItems": [ + {"query": "400 Broad St, Seattle, WA 98109"}, + {"query": "15127 NE 24th Street, Redmond, WA 98052"}, + ], + }, ) + + if not result.get('batchItems', False): + print("No batchItems in geocoding") + return + + for item in result['batchItems']: + if not item.get('features', False): + print(f"No features in item: {item}") + continue + + coordinates = item['features'][0]['geometry']['coordinates'] + longitude, latitude = coordinates + print(longitude, latitude) + + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + +if __name__ == '__main__': + asyncio.run(geocode_batch_async()) diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_get_point_of_interest_categories_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_get_point_of_interest_categories_async.py deleted file mode 100644 index 5ab9ac261ae47..0000000000000 --- a/sdk/maps/azure-maps-search/samples/async_samples/sample_get_point_of_interest_categories_async.py +++ /dev/null @@ -1,37 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_get_point_of_interest_categories_async.py -DESCRIPTION: - This sample demonstrates get POI categories. -USAGE: - python sample_get_point_of_interest_categories_async.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import asyncio -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -async def get_point_of_interest_categories_async(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search.aio import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - async with maps_search_client: - result = await maps_search_client.get_point_of_interest_categories() - - print("Get Search POI Categories:") - print(result) - -if __name__ == '__main__': - asyncio.run(get_point_of_interest_categories_async()) diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_get_polygon_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_get_polygon_async.py new file mode 100644 index 0000000000000..4cedf6c48cf29 --- /dev/null +++ b/sdk/maps/azure-maps-search/samples/async_samples/sample_get_polygon_async.py @@ -0,0 +1,52 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: sample_get_polygon_async.py +DESCRIPTION: + This sample demonstrates how to search polygons. +USAGE: + python sample_get_polygon_async.py + + Set the environment variables with your own values before running the sample: + - AZURE_SUBSCRIPTION_KEY - your subscription key +""" +import asyncio +import os + +from azure.core.exceptions import HttpResponseError +from azure.maps.search import Resolution +from azure.maps.search import BoundaryResultType + +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") + +async def get_polygon_async(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search.aio import MapsSearchClient + + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + async with maps_search_client: + try: + result = await maps_search_client.get_polygon( + coordinates=[-122.204141, 47.61256], + result_type=BoundaryResultType.LOCALITY, + resolution=Resolution.SMALL, + ) + + if not result.get('geometry', False): + print("No geometry found") + return + + print(result["geometry"]) + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + +if __name__ == '__main__': + asyncio.run(get_polygon_async()) diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_geocode_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_geocode_async.py new file mode 100644 index 0000000000000..b5bde70bfc5fc --- /dev/null +++ b/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_geocode_async.py @@ -0,0 +1,50 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: sample_reverse_geocode_async.py +DESCRIPTION: + This sample demonstrates how to perform reverse search by given coordinates. +USAGE: + python sample_reverse_geocode_async.py + + Set the environment variables with your own values before running the sample: + - AZURE_SUBSCRIPTION_KEY - your subscription key +""" +import asyncio +import os + +from azure.core.exceptions import HttpResponseError + +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") + + +async def reverse_geocode_async(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search.aio import MapsSearchClient + + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + + async with maps_search_client: + try: + result = await maps_search_client.get_reverse_geocoding(coordinates=[-122.138679, 47.630356]) + if result.get('features', False): + props = result['features'][0].get('properties', {}) + if props and props.get('address', False): + print(props['address'].get('formattedAddress', 'No formatted address found')) + else: + print("Address is None") + else: + print("No features available") + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + +if __name__ == '__main__': + asyncio.run(reverse_geocode_async()) \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_geocode_batch_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_geocode_batch_async.py new file mode 100644 index 0000000000000..88eded8a79af7 --- /dev/null +++ b/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_geocode_batch_async.py @@ -0,0 +1,63 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: sample_reverse_geocode_batch_async.py +DESCRIPTION: + This sample demonstrates how to perform reverse search by given coordinates in a batch. +USAGE: + python sample_reverse_geocode_async.py + + Set the environment variables with your own values before running the sample: + - AZURE_SUBSCRIPTION_KEY - your subscription key +""" +import asyncio +import os + +from azure.core.exceptions import HttpResponseError + +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") + + +async def reverse_geocode_async(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search.aio import MapsSearchClient + + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + + async with maps_search_client: + try: + result = await maps_search_client.get_reverse_geocoding_batch({ + "batchItems": [ + {"coordinates": [-122.349309, 47.620498]}, + {"coordinates": [-122.138679, 47.630356]}, + ], + }, ) + + if result.get('batchItems', False): + for idx, item in enumerate(result['batchItems']): + features = item['features'] + if features: + props = features[0].get('properties', {}) + if props and props.get('address', False): + print( + props['address'].get('formattedAddress', + f'No formatted address for item {idx + 1} found')) + else: + print(f"Address {idx + 1} is None") + else: + print(f"No features available for item {idx + 1}") + else: + print("No batch items found") + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + +if __name__ == '__main__': + asyncio.run(reverse_geocode_async()) \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_search_address_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_search_address_async.py deleted file mode 100644 index e922a463957c3..0000000000000 --- a/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_search_address_async.py +++ /dev/null @@ -1,38 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_reverse_search_address_async.py -DESCRIPTION: - This sample demonstrates how to perform reverse search by given coordinates. -USAGE: - python sample_reverse_search_address_async.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import asyncio -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - - -async def reverse_search_address_async(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search.aio import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - async with maps_search_client: - result = await maps_search_client.reverse_search_address(coordinates=(25.0338053, 121.5640089), language="en") - - print("Get Search Address Reverse:") - print(result) - -if __name__ == '__main__': - asyncio.run(reverse_search_address_async()) \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_search_cross_street_address_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_search_cross_street_address_async.py deleted file mode 100644 index bd6ab4bead7d1..0000000000000 --- a/sdk/maps/azure-maps-search/samples/async_samples/sample_reverse_search_cross_street_address_async.py +++ /dev/null @@ -1,38 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_reverse_search_cross_street_address_async.py -DESCRIPTION: - This sample demonstrates how to perform reverse search cross street address. -USAGE: - python sample_reverse_search_cross_street_address_async.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import asyncio -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - - -async def reverse_search_cross_street_address_async(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search.aio import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - async with maps_search_client: - result = await maps_search_client.reverse_search_cross_street_address(coordinates=(25.0338053, 121.5640089), language="en") - - print("Get Search Address Reverse Cross Street:") - print(result) - -if __name__ == '__main__': - asyncio.run(reverse_search_cross_street_address_async()) \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_search_inside_geometry_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_search_inside_geometry_async.py deleted file mode 100644 index ab39cbb641d8b..0000000000000 --- a/sdk/maps/azure-maps-search/samples/async_samples/sample_search_inside_geometry_async.py +++ /dev/null @@ -1,121 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_inside_geometry_async.py -DESCRIPTION: - This sample demonstrates how to perform search inside geometry by given target such as `pizza` and multiple different geometry as input, which include GeoJson object and geo_interface property from other existing packages such as shapely. -USAGE: - python sample_search_inside_geometry_async.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import asyncio -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - - -async def search_inside_geometry(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - - geo_json_obj1 = { - "type": "FeatureCollection", - "features": [ - { - "type": "Feature", - "geometry": { - "type": "Polygon", - "coordinates": [[ - [-122.143035,47.653536], - [-122.187164,47.617556], - [-122.114981,47.570599], - [-122.132756,47.654009], - [-122.143035,47.653536] - ]] - }, - "properties": {} - }, - { - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [-122.126986,47.639754] - }, - "properties": { - "subType": "Circle", - "radius": 100 - } - } - ] - } - - geo_json_obj2= { - 'type': 'Polygon', - 'coordinates': [ - [[-122.43576049804686, 37.7524152343544], - [-122.43301391601562, 37.70660472542312], - [-122.36434936523438, 37.712059855877314], - [-122.43576049804686, 37.7524152343544]] - ] - } - - # This is the mock results we can get from 3rd party package `Shapely` - # - # from shapely.geometry import Polygon - # - # data = Polygon([ - # [-122.43576049804686, 37.7524152343544], - # [-122.43301391601562, 37.70660472542312], - # [-122.36434936523438, 37.712059855877314], - # [-122.43576049804686, 37.7524152343544] - # ]).__geo_interface__ - # - geo_obj_interface = { - 'type': 'Polygon', - 'coordinates': (( - (-122.43576049804686, 37.7524152343544), - (-122.43301391601562, 37.70660472542312), - (-122.36434936523438, 37.712059855877314), - (-122.43576049804686, 37.7524152343544)), - ) - } - - result1 = maps_search_client.search_inside_geometry( - query="pizza", - geometry=geo_json_obj1 - ) - print("Search inside geometry with standard GeoJson obejct as input, FeatureCollection:") - print(result1.__dict__) - - print("Result 2 and result 3 should be the same: ") - print("__________________________________________") - result2 = maps_search_client.search_inside_geometry( - query="pizza", - geometry=geo_json_obj2 - ) - print("Search inside geometry with standard GeoJson object as input, Polygon as result 2:") - print(result2.__dict__) - print(f'Id of the first result item of result 2: {result2.results[0].id}') - - result3 = maps_search_client.search_inside_geometry( - query="pizza", - geometry=geo_obj_interface - ) - print("Search inside geometry with Polygon from third party library `shapely` with geo_interface as result 3:") - print(result2.__dict__) - print(f'Id of the first result item of result 3: {result3.results[0].id}') - - -if __name__ == '__main__': - asyncio.run(search_inside_geometry()) \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_search_nearby_point_of_interest_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_search_nearby_point_of_interest_async.py deleted file mode 100644 index 618fdf69b7655..0000000000000 --- a/sdk/maps/azure-maps-search/samples/async_samples/sample_search_nearby_point_of_interest_async.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_nearby_point_of_interest_async.py -DESCRIPTION: - This sample demonstrates how to perform search nearby POI by given coordinates. -USAGE: - python sample_search_nearby_point_of_interest_async.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import asyncio -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - - -async def search_nearby_point_of_interest_async(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search.aio import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - async with maps_search_client: - result = await maps_search_client.search_nearby_point_of_interest(coordinates=(25.0338053, 121.5640089)) - - print("Get Search Nearby point of interest:") - print(result) - - -if __name__ == '__main__': - asyncio.run(search_nearby_point_of_interest_async()) \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_search_point_of_interest_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_search_point_of_interest_async.py deleted file mode 100644 index 60668751a9f63..0000000000000 --- a/sdk/maps/azure-maps-search/samples/async_samples/sample_search_point_of_interest_async.py +++ /dev/null @@ -1,38 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_point_of_interest_async.py -DESCRIPTION: - This sample demonstrates how to perform search POI by given target such as `juice bars`. -USAGE: - python sample_search_point_of_interest_async.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" - -import asyncio -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -async def search_point_of_interest_async(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search.aio import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - async with maps_search_client: - result = await maps_search_client.search_point_of_interest("juice bars") - - print("Get Search POI:") - print(result) - -if __name__ == '__main__': - asyncio.run(search_point_of_interest_async()) diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_search_point_of_interest_category_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_search_point_of_interest_category_async.py deleted file mode 100644 index a8d3abd823b42..0000000000000 --- a/sdk/maps/azure-maps-search/samples/async_samples/sample_search_point_of_interest_category_async.py +++ /dev/null @@ -1,38 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_point_of_interest_category_async.py -DESCRIPTION: - This sample demonstrates search POI by given target such as `RESTAURANT` and coordinates. -USAGE: - python sample_search_point_of_interest_category_async.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import asyncio -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - - -async def search_point_of_interest_category_async(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search.aio import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - async with maps_search_client: - result = await maps_search_client.search_point_of_interest_category("RESTAURANT", coordinates=(25.0338053, 121.5640089)) - - print("Get Search POI Category:") - print(result) - - -if __name__ == '__main__': - asyncio.run(search_point_of_interest_category_async()) \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/async_samples/sample_search_structured_address_async.py b/sdk/maps/azure-maps-search/samples/async_samples/sample_search_structured_address_async.py deleted file mode 100644 index 922774903c6f2..0000000000000 --- a/sdk/maps/azure-maps-search/samples/async_samples/sample_search_structured_address_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_structured_address_async.py -DESCRIPTION: - This sample demonstrates how to perform search structured address. -USAGE: - python sample_search_structured_address_async.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import asyncio -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -# cSpell:disable -async def search_structured_address_async(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search.aio import MapsSearchClient - from azure.maps.search.models import StructuredAddress - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - addr = StructuredAddress( - street_number="221", - street_name="Sec. 2, Zhishan Rd.", - municipality_subdivision="Shilin Dist.", - municipality="Taipei City", - country_code="TW") - - async with maps_search_client: - result = await maps_search_client.search_structured_address(addr) - - print("Get Search Address Structured:") - print(result) - -if __name__ == '__main__': - asyncio.run(search_structured_address_async()) diff --git a/sdk/maps/azure-maps-search/samples/sample_authentication.py b/sdk/maps/azure-maps-search/samples/sample_authentication.py deleted file mode 100644 index bf9f9914b597e..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_authentication.py +++ /dev/null @@ -1,36 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_authentication.py -DESCRIPTION: - This sample demonstrates how to authenticate with the Azure Maps Search - service with an Subscription key. See more details about authentication here: - https://docs.microsoft.com/azure/azure-maps/how-to-manage-account-keys -USAGE: - python sample_authentication.py - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" - -import os - -def authentication_maps_service_client_with_subscription_key_credential(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - result = maps_search_client.get_point_of_interest_categories() - - print(result) - -if __name__ == '__main__': - authentication_maps_service_client_with_subscription_key_credential() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_fuzzy_search.py b/sdk/maps/azure-maps-search/samples/sample_fuzzy_search.py deleted file mode 100644 index 4a5ba2d18a117..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_fuzzy_search.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_fuzzy_search.py -DESCRIPTION: - This sample demonstrates how to perform fuzzy search by location and lat/lon. -USAGE: - python sample_fuzzy_search.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -def fuzzy_search(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - from azure.maps.search.models import BoundingBox - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - result = maps_search_client.fuzzy_search(query="starbucks", bounding_box=BoundingBox(-122.4594, 25.105497, 121.597366, 121.597366)) - - print("Get Search Fuzzy with coordinates with search query: " + result.query) - print("Fuzzy level: {}".format(result.fuzzy_level)) - print("Total results: {}".format(result.num_results)) - print("Address from the first item in results: ") - print(result.results[0].address) - -if __name__ == '__main__': - fuzzy_search() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_fuzzy_search_batch.py b/sdk/maps/azure-maps-search/samples/sample_fuzzy_search_batch.py deleted file mode 100644 index 315d86748d74d..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_fuzzy_search_batch.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_fuzzy_search_batch.py -DESCRIPTION: - This sample demonstrates how to perform fuzzy search by location and lat/lon. -USAGE: - python sample_fuzzy_search_batch.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -def fuzzy_search_batch(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - result = maps_search_client.fuzzy_search_batch( - search_queries=[ - "350 5th Ave, New York, NY 10118&limit=1", - "400 Broad St, Seattle, WA 98109&limit=3" - ] - ) - - print(result.summary) - for item in result.items: - print(item.response.results[0].address) - -if __name__ == '__main__': - fuzzy_search_batch() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_fuzzy_search_batch_failure.py b/sdk/maps/azure-maps-search/samples/sample_fuzzy_search_batch_failure.py deleted file mode 100644 index 7ce306532d125..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_fuzzy_search_batch_failure.py +++ /dev/null @@ -1,48 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_fuzzy_search_batch_failure.py -DESCRIPTION: - This sample demonstrates how to perform fuzzy search by location and lat/lon. -USAGE: - python sample_fuzzy_search_batch_failure.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -# cSpell:disable -def fuzzy_search_batch_failure(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - result = maps_search_client.fuzzy_search_batch( - search_queries=[ - "350 5th Ave, New York, NY 10118&limit=1", - "400 Broad St, Seattle, WA 98109&limi" - ] - ) - - print(result.summary) - print(result.items[0].response.summary) - print("--------------------------") - for item in result.items: - count = 0 - if item.response.error is not None: - count = count+1 - print(f"Error: {item.response.error.message}") - print(f"There are total of {count} search queries failed.") - -if __name__ == '__main__': - fuzzy_search_batch_failure() diff --git a/sdk/maps/azure-maps-search/samples/sample_geocode.py b/sdk/maps/azure-maps-search/samples/sample_geocode.py new file mode 100644 index 0000000000000..d2d13f47b0cf4 --- /dev/null +++ b/sdk/maps/azure-maps-search/samples/sample_geocode.py @@ -0,0 +1,47 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: sample_geocode.py +DESCRIPTION: + This sample demonstrates how to perform search address +USAGE: + python sample_geocode.py + + Set the environment variables with your own values before running the sample: + - AZURE_SUBSCRIPTION_KEY - your subscription key +""" +import os + +from azure.core.exceptions import HttpResponseError + +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") + +def geocode(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search import MapsSearchClient + + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + try: + result = maps_search_client.get_geocoding(query="15127 NE 24th Street, Redmond, WA 98052") + if result.get('features', False): + coordinates = result['features'][0]['geometry']['coordinates'] + longitude = coordinates[0] + latitude = coordinates[1] + + print(longitude, latitude) + else: + print("No results") + + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + +if __name__ == '__main__': + geocode() diff --git a/sdk/maps/azure-maps-search/samples/sample_geocode_batch.py b/sdk/maps/azure-maps-search/samples/sample_geocode_batch.py new file mode 100644 index 0000000000000..26e8c9714b407 --- /dev/null +++ b/sdk/maps/azure-maps-search/samples/sample_geocode_batch.py @@ -0,0 +1,57 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: sample_geocode_batch.py +DESCRIPTION: + This sample demonstrates how to perform batch search address +USAGE: + python sample_geocode_batch.py + + Set the environment variables with your own values before running the sample: + - AZURE_SUBSCRIPTION_KEY - your subscription key +""" +import os + +from azure.core.exceptions import HttpResponseError + +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") + +def geocode_batch(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search import MapsSearchClient + + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + try: + result = maps_search_client.get_geocoding_batch({ + "batchItems": [ + {"query": "400 Broad St, Seattle, WA 98109"}, + {"query": "15127 NE 24th Street, Redmond, WA 98052"}, + ], + },) + + if not result.get('batchItems', False): + print("No batchItems in geocoding") + return + + for item in result['batchItems']: + if not item.get('features', False): + print(f"No features in item: {item}") + continue + + coordinates = item['features'][0]['geometry']['coordinates'] + longitude, latitude = coordinates + print(longitude, latitude) + + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + +if __name__ == '__main__': + geocode_batch() diff --git a/sdk/maps/azure-maps-search/samples/sample_get_geometries.py b/sdk/maps/azure-maps-search/samples/sample_get_geometries.py deleted file mode 100644 index 201f9dc90e7b7..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_get_geometries.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_get_geometries.py -DESCRIPTION: - This sample demonstrates how to perform fuzzy search by location and lat/lon. -USAGE: - python sample_get_geometries.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -def get_geometries(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - result = maps_search_client.get_geometries(geometry_ids=["8bceafe8-3d98-4445-b29b-fd81d3e9adf5"]) - - print(result[0].geometry_data) - -if __name__ == '__main__': - get_geometries() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_get_point_of_interest_categories.py b/sdk/maps/azure-maps-search/samples/sample_get_point_of_interest_categories.py deleted file mode 100644 index df9ca50b8a918..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_get_point_of_interest_categories.py +++ /dev/null @@ -1,37 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_get_point_of_interest_categories.py -DESCRIPTION: - This sample demonstrates get POI categories. -USAGE: - python sample_get_point_of_interest_categories.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" - -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -def get_point_of_interest_categories(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - result = maps_search_client.get_point_of_interest_categories() - - print("Get Search POI Categories:") - print(result[0]) - - -if __name__ == '__main__': - get_point_of_interest_categories() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_get_polygon.py b/sdk/maps/azure-maps-search/samples/sample_get_polygon.py new file mode 100644 index 0000000000000..53bb5080cf8a9 --- /dev/null +++ b/sdk/maps/azure-maps-search/samples/sample_get_polygon.py @@ -0,0 +1,51 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: sample_get_polygon.py +DESCRIPTION: + This sample demonstrates how to search polygons. +USAGE: + python sample_get_polygon.py + + Set the environment variables with your own values before running the sample: + - AZURE_SUBSCRIPTION_KEY - your subscription key +""" +import os + +from azure.core.exceptions import HttpResponseError +from azure.maps.search import Resolution +from azure.maps.search import BoundaryResultType + + +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") + +def get_polygon(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search import MapsSearchClient + + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + try: + result = maps_search_client.get_polygon( + coordinates=[-122.204141, 47.61256], + result_type=BoundaryResultType.LOCALITY, + resolution=Resolution.SMALL, + ) + + if not result.get('geometry', False): + print("No geometry found") + return + + print(result["geometry"]) + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + +if __name__ == '__main__': + get_polygon() diff --git a/sdk/maps/azure-maps-search/samples/sample_reverse_geocode.py b/sdk/maps/azure-maps-search/samples/sample_reverse_geocode.py new file mode 100644 index 0000000000000..ff2938b2ae6fc --- /dev/null +++ b/sdk/maps/azure-maps-search/samples/sample_reverse_geocode.py @@ -0,0 +1,48 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: sample_reverse_geocode.py +DESCRIPTION: + This sample demonstrates how to perform reverse search by given coordinates. +USAGE: + python sample_reverse_geocode.py + + Set the environment variables with your own values before running the sample: + - AZURE_SUBSCRIPTION_KEY - your subscription key +""" + +import os + +from azure.core.exceptions import HttpResponseError + +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") + +def reverse_geocode(): + from azure.core.credentials import AzureKeyCredential + from azure.maps.search import MapsSearchClient + + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + try: + result = maps_search_client.get_reverse_geocoding(coordinates=[-122.138679, 47.630356]) + if result.get('features', False): + props = result['features'][0].get('properties', {}) + if props and props.get('address', False): + print(props['address'].get('formattedAddress', 'No formatted address found')) + else: + print("Address is None") + else: + print("No features available") + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + + +if __name__ == '__main__': + reverse_geocode() diff --git a/sdk/maps/azure-maps-search/samples/sample_reverse_geocode_batch.py b/sdk/maps/azure-maps-search/samples/sample_reverse_geocode_batch.py new file mode 100644 index 0000000000000..30c5328beb727 --- /dev/null +++ b/sdk/maps/azure-maps-search/samples/sample_reverse_geocode_batch.py @@ -0,0 +1,58 @@ +# 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. +# -------------------------------------------------------------------------- + +""" +FILE: sample_reverse_geocode_batch.py +DESCRIPTION: + This sample demonstrates how to perform reverse batch search by given coordinates. +USAGE: + python sample_reverse_geocode_batch.py + + Set the environment variables with your own values before running the sample: + - AZURE_SUBSCRIPTION_KEY - your subscription key +""" + +import os +from azure.core.credentials import AzureKeyCredential +from azure.core.exceptions import HttpResponseError +from azure.maps.search import MapsSearchClient + +subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") + +def reverse_geocode_batch(): + maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) + try: + result = maps_search_client.get_reverse_geocoding_batch({ + "batchItems": [ + {"coordinates": [-122.349309, 47.620498]}, + {"coordinates": [-122.138679, 47.630356]}, + ], + },) + + if result.get('batchItems', False): + for idx, item in enumerate(result['batchItems']): + features = item['features'] + if features: + props = features[0].get('properties', {}) + if props and props.get('address', False): + print( + props['address'].get('formattedAddress', f'No formatted address for item {idx + 1} found')) + else: + print(f"Address {idx + 1} is None") + else: + print(f"No features available for item {idx + 1}") + else: + print("No batch items found") + except HttpResponseError as exception: + if exception.error is not None: + print(f"Error Code: {exception.error.code}") + print(f"Message: {exception.error.message}") + + +if __name__ == '__main__': + reverse_geocode_batch() diff --git a/sdk/maps/azure-maps-search/samples/sample_reverse_search_address.py b/sdk/maps/azure-maps-search/samples/sample_reverse_search_address.py deleted file mode 100644 index 94fddac27691e..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_reverse_search_address.py +++ /dev/null @@ -1,36 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_reverse_search_address.py -DESCRIPTION: - This sample demonstrates how to perform reverse search by given coordinates. -USAGE: - python sample_reverse_search_address.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" - -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -def reverse_search_address(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - result = maps_search_client.reverse_search_address(coordinates=(25.0338053, 121.5640089), language="en") - - print("Get Search Address Reverse:") - print(result.results[0].address) - -if __name__ == '__main__': - reverse_search_address() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_reverse_search_cross_street_address.py b/sdk/maps/azure-maps-search/samples/sample_reverse_search_cross_street_address.py deleted file mode 100644 index 4502a0028bb53..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_reverse_search_cross_street_address.py +++ /dev/null @@ -1,35 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_reverse_search_cross_street_address.py -DESCRIPTION: - This sample demonstrates how to perform reverse search cross street address. -USAGE: - python sample_reverse_search_cross_street_address.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" - -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -def reverse_search_cross_street_address(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - result = maps_search_client.reverse_search_cross_street_address(coordinates=(25.0338053, 121.5640089), language="en") - print("Get Search Address Reverse Cross Street:") - print(result.addresses[0].address) - -if __name__ == '__main__': - reverse_search_cross_street_address() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_search_address.py b/sdk/maps/azure-maps-search/samples/sample_search_address.py deleted file mode 100644 index a310bef04f86b..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_search_address.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_address.py -DESCRIPTION: - This sample demonstrates how to perform search address -USAGE: - python sample_search_address.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -def search_address(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - result = maps_search_client.search_address(query="15127 NE 24th Street, Redmond, WA 98052") - - print(result.results[0].address) - -if __name__ == '__main__': - search_address() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_search_along_route.py b/sdk/maps/azure-maps-search/samples/sample_search_along_route.py deleted file mode 100644 index 33c07cd0fa994..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_search_along_route.py +++ /dev/null @@ -1,49 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_along_route.py -DESCRIPTION: - This sample demonstrates how to perform search along route -USAGE: - python sample_search_along_route.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -def search_along_route(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - route_obj = { - "route": { - "type": "LineString", - "coordinates": [ - [-122.143035,47.653536], - [-122.187164,47.617556], - [-122.114981,47.570599], - [-122.132756,47.654009] - ] - } - } - result = maps_search_client.search_along_route( - query="burger", - route=route_obj, - max_detour_time=1000 - ) - - print(result.results[0].address.__dict__) - -if __name__ == '__main__': - search_along_route() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_search_inside_geometry.py b/sdk/maps/azure-maps-search/samples/sample_search_inside_geometry.py deleted file mode 100644 index adfa735594456..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_search_inside_geometry.py +++ /dev/null @@ -1,124 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_inside_geometry.py -DESCRIPTION: - This sample demonstrates how to perform search inside geometry by given target such as `pizza` and multiple different geometry as input, which include GeoJson object and geo_interface property from other existing packages such as shapely. -USAGE: - python sample_search_inside_geometry.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" - -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -def search_inside_geometry(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - - geo_json_obj1 = { - "type": "FeatureCollection", - "features": [ - { - "type": "Feature", - "geometry": { - "type": "Polygon", - "coordinates": [[ - [-122.143035,47.653536], - [-122.187164,47.617556], - [-122.114981,47.570599], - [-122.132756,47.654009], - [-122.143035,47.653536] - ]] - }, - "properties": {} - }, - { - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [-122.126986,47.639754] - }, - "properties": { - "subType": "Circle", - "radius": 100 - } - } - ] - } - - geo_json_obj2= { - 'type': 'Polygon', - 'coordinates': [ - [[-122.43576049804686, 37.7524152343544], - [-122.43301391601562, 37.70660472542312], - [-122.36434936523438, 37.712059855877314], - [-122.43576049804686, 37.7524152343544]] - ] - } - - # This is the mock results we can get from 3rd party package `Shapely` - # - # from shapely.geometry import Polygon - # - # data = Polygon([ - # [-122.43576049804686, 37.7524152343544], - # [-122.43301391601562, 37.70660472542312], - # [-122.36434936523438, 37.712059855877314], - # [-122.43576049804686, 37.7524152343544] - # ]).__geo_interface__ - # - geo_obj_interface = { - 'type': 'Polygon', - 'coordinates': (( - (-122.43576049804686, 37.7524152343544), - (-122.43301391601562, 37.70660472542312), - (-122.36434936523438, 37.712059855877314), - (-122.43576049804686, 37.7524152343544)), - ) - } - - geo_thing_wkt = 'POLYGON ((-122.43576049804686 37.7524152343544, 40 40, 20 40, 10 20, -122.43576049804686 37.7524152343544))' - - - result1 = maps_search_client.search_inside_geometry( - query="pizza", - geometry=geo_json_obj1 - ) - print("Search inside geometry with standard GeoJson obejct as input, FeatureCollection:") - print(result1.__dict__) - - print("Result 2 and result 3 should be the same: ") - print("__________________________________________") - result2 = maps_search_client.search_inside_geometry( - query="pizza", - geometry=geo_json_obj2 - ) - print("Search inside geometry with standard GeoJson object as input, Polygon as result 2:") - print(result2.results[0].address.local_name) - print(result2.results[0].address.country_subdivision) - print(f'Id of the first result item of result 2: {result2.results[0].id}') - - result3 = maps_search_client.search_inside_geometry( - query="pizza", - geometry=geo_obj_interface - ) - print("Search inside geometry with Polygon from third party library `shapely` with geo_interface as result 3:") - print(result3.results[0].address.local_name) - print(result3.results[0].address.country_subdivision) - print(f'Id of the first result item of result 3: {result3.results[0].id}') - -if __name__ == '__main__': - search_inside_geometry() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_search_nearby_point_of_interest.py b/sdk/maps/azure-maps-search/samples/sample_search_nearby_point_of_interest.py deleted file mode 100644 index e3b017a2351c5..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_search_nearby_point_of_interest.py +++ /dev/null @@ -1,36 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_nearby_point_of_interest.py -DESCRIPTION: - This sample demonstrates how to perform search nearby POI by given coordinates. -USAGE: - python sample_search_nearby_point_of_interest.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" - -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -def search_nearby_point_of_interest(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - result = maps_search_client.search_nearby_point_of_interest(coordinates=(25.0338053, 121.5640089)) - - print("Get Search Nearby point of interest:") - print(result) - -if __name__ == '__main__': - search_nearby_point_of_interest() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_search_point_of_interest.py b/sdk/maps/azure-maps-search/samples/sample_search_point_of_interest.py deleted file mode 100644 index 0a7f388111f2e..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_search_point_of_interest.py +++ /dev/null @@ -1,35 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_point_of_interest.py -DESCRIPTION: - This sample demonstrates how to perform search POI by given target such as `juice bars`. -USAGE: - python sample_search_point_of_interest.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" - -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -def search_point_of_interest(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - result = maps_search_client.search_point_of_interest("juice bars") - print("Get Search POI:") - print(result) - -if __name__ == '__main__': - search_point_of_interest() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_search_point_of_interest_category.py b/sdk/maps/azure-maps-search/samples/sample_search_point_of_interest_category.py deleted file mode 100644 index 539a422672998..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_search_point_of_interest_category.py +++ /dev/null @@ -1,36 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_point_of_interest_category.py -DESCRIPTION: - This sample demonstrates search POI by given target such as `RESTAURANT` and coordinates. -USAGE: - python sample_search_point_of_interest_category.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" - -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -def search_point_of_interest_category(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - result = maps_search_client.search_point_of_interest_category("RESTAURANT", coordinates=(25.0338053, 121.5640089)) - - print("Get Search POI Category:") - print(result) - -if __name__ == '__main__': - search_point_of_interest_category() \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/samples/sample_search_structured_address.py b/sdk/maps/azure-maps-search/samples/sample_search_structured_address.py deleted file mode 100644 index 037347e52d21d..0000000000000 --- a/sdk/maps/azure-maps-search/samples/sample_search_structured_address.py +++ /dev/null @@ -1,44 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -""" -FILE: sample_search_structured_address.py -DESCRIPTION: - This sample demonstrates how to perform search structured address. -USAGE: - python sample_search_structured_address.py - - Set the environment variables with your own values before running the sample: - - AZURE_SUBSCRIPTION_KEY - your subscription key -""" - -import os - -subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY") - -# cSpell:disable -def search_structured_address(): - from azure.core.credentials import AzureKeyCredential - from azure.maps.search import MapsSearchClient - from azure.maps.search.models import StructuredAddress - - maps_search_client = MapsSearchClient(credential=AzureKeyCredential(subscription_key)) - - addr = StructuredAddress( - street_number="221", - street_name="Sec. 2, Zhishan Rd.", - municipality_subdivision="Shilin Dist.", - municipality="Taipei City", - country_code="TW") - result = maps_search_client.search_structured_address(addr) - - print("Get Search Address Structured:") - print(result) - -if __name__ == '__main__': - search_structured_address() diff --git a/sdk/maps/azure-maps-search/setup.py b/sdk/maps/azure-maps-search/setup.py index 5341bbdbba064..869b741019598 100644 --- a/sdk/maps/azure-maps-search/setup.py +++ b/sdk/maps/azure-maps-search/setup.py @@ -68,6 +68,8 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -81,5 +83,6 @@ 'msrest>=0.6.21', 'azure-common~=1.1', 'azure-mgmt-core>=1.3.0,<2.0.0', - ] + ], + python_requires=">=3.8", ) diff --git a/sdk/maps/azure-maps-search/swagger/README.md b/sdk/maps/azure-maps-search/swagger/README.md index 754fe899ec942..1f9f3a1235a64 100644 --- a/sdk/maps/azure-maps-search/swagger/README.md +++ b/sdk/maps/azure-maps-search/swagger/README.md @@ -29,7 +29,7 @@ We automatically hardcode in that this is `python`. ## Basic Information ```yaml -tag: 1.0-preview +tag: package-2023-06 require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/maps/data-plane/Search/readme.md output-folder: ../azure/maps/search/_generated namespace: azure.maps.search diff --git a/sdk/maps/azure-maps-search/tests/test_client_unit.py b/sdk/maps/azure-maps-search/tests/test_client_unit.py deleted file mode 100644 index f5c94f05490d0..0000000000000 --- a/sdk/maps/azure-maps-search/tests/test_client_unit.py +++ /dev/null @@ -1,103 +0,0 @@ -import sys -import pytest -import unittest -from unittest.mock import Mock -from azure.core.credentials import AzureKeyCredential -from azure.maps.search.models import StructuredAddress -from azure.maps.search import MapsSearchClient -from azure.maps.search._shared import converter - -# cSpell:disable -def test_fuzzy_search_invalid_top(): - client = MapsSearchClient( - credential=Mock(AzureKeyCredential) - ) - with pytest.raises(TypeError): - client.search_point_of_interest_category(StructuredAddress()) - -def test_search_structured_address(): - client = MapsSearchClient( - credential=Mock(AzureKeyCredential) - ) - with pytest.raises(TypeError): - client.search_structured_address(StructuredAddress()) - -class TestConverter(unittest.TestCase): - - def test_geo_interface_to_geojson(self): - data_input= { - 'type': 'Polygon', - 'coordinates': (( - (-122.43576049804686, 37.7524152343544), - (-122.43301391601562, 37.70660472542312), - (-122.36434936523438, 37.712059855877314), - (-122.43576049804686, 37.7524152343544) - ),)} - - data_output = { - 'type': 'Polygon', - 'coordinates': [[ - [-122.43576049804686, 37.7524152343544], - [-122.43301391601562, 37.70660472542312], - [-122.36434936523438, 37.712059855877314], - [-122.43576049804686, 37.7524152343544]] - ]} - - g_json = converter.geo_interface_to_geojson(data_input) - self.assertEqual(g_json, data_output) - - def test_wkt_to_geo_interface(self): - data_input= 'POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))' - - data_output = { - 'type': 'Polygon', - 'coordinates': [[ - (30, 10), (40, 40), (20, 40), (10, 20), (30, 10) - ]]} - - g_interface = converter.wkt_to_geo_interface(data_input) - self.assertEqual(g_interface, data_output) - - def test_wkt_to_geojson(self): - data_input= 'POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))' - - data_output = { - 'type': 'Polygon', - 'coordinates': [[ - [30, 10], [40, 40], [20, 40], [10, 20], [30, 10] - ]]} - - g_json = converter.wkt_to_geojson(data_input) - self.assertEqual(g_json, data_output) - - def test_parse_geometry_input_with_geo_json_obj(self): - data_input= { - 'type': 'Polygon', - 'coordinates': [[ - [-122.43576049804686, 37.7524152343544], - [-122.43301391601562, 37.70660472542312], - [-122.36434936523438, 37.712059855877314], - [-122.43576049804686, 37.7524152343544] - ]]} - - data_output = {'geometry': {'type': 'Polygon', - 'coordinates': [[ - [-122.43576049804686, 37.7524152343544], - [-122.43301391601562, 37.70660472542312], - [-122.36434936523438, 37.712059855877314], - [-122.43576049804686, 37.7524152343544] - ]]}} - - g_obj = converter.parse_geometry_input(data_input) - self.assertEqual(g_obj, data_output) - -if __name__ == "__main__" : - testArgs = [ "-v" , "-s" ] if len(sys.argv) == 1 else sys.argv[1:] - #testArgs = [ "-s" , "-n" , "auto" , "--dist=loadscope" ] if len(sys.argv) == 1 else sys.argv[1:] - #pytest-xdist: -n auto --dist=loadscope - #pytest-parallel: --tests-per-worker auto - #print( "testArgs={}".format(testArgs) ) - - pytest.main(args=testArgs) - - print("main() Leave") \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/tests/test_maps_search_client.py b/sdk/maps/azure-maps-search/tests/test_maps_search_client.py index 9a8dbe662c425..d9fb78371c8fd 100644 --- a/sdk/maps/azure-maps-search/tests/test_maps_search_client.py +++ b/sdk/maps/azure-maps-search/tests/test_maps_search_client.py @@ -4,12 +4,15 @@ # license information. # -------------------------------------------------------------------------- import os -from azure.core.credentials import AccessToken, AzureKeyCredential + +from azure.core.credentials import AzureKeyCredential from azure.maps.search import MapsSearchClient -from azure.maps.search.models import StructuredAddress -from devtools_testutils import AzureRecordedTestCase, recorded_by_proxy +from azure.maps.search import BoundaryResultType, Resolution +from devtools_testutils import AzureRecordedTestCase, recorded_by_proxy, is_live + from search_preparer import MapsSearchPreparer + # cSpell:disable class TestMapsSearchClient(AzureRecordedTestCase): def setup_method(self, method): @@ -20,235 +23,89 @@ def setup_method(self, method): @MapsSearchPreparer() @recorded_by_proxy - def test_fuzzy_search_poi_coordinates(self): - result = self.client.fuzzy_search("Taipei 101", coordinates=(25.0338053, 121.5640089)) - assert len(result.results) > 0 - top_answer = result.results[0] - assert top_answer.point_of_interest.name == "Taipei 101" - assert top_answer.address.street_name == "Xinyi Road Section 5" - assert top_answer.address.municipality == "Taipei City" - assert top_answer.address.postal_code == "110" - assert top_answer.address.country_code_iso3 == "TWN" - assert top_answer.position.lat > 25 and top_answer.position.lon > 121 - - @MapsSearchPreparer() - @recorded_by_proxy - def test_fuzzy_search_poi_country_set(self): - result = self.client.fuzzy_search("Taipei 101", country_filter=["TW"]) - assert len(result.results) > 0 - for item in result.results: - assert item.address.country_code_iso3 == "TWN" + def test_geocode(self): + result = self.client.get_geocoding(query="15127 NE 24th Street, Redmond, WA 98052") - @MapsSearchPreparer() - @recorded_by_proxy - def test_fuzzy_search_address(self): - result = self.client.fuzzy_search("No. 221, Sec. 2, Zhishan Rd., Shilin Dist., Taipei City 111, Taiwan (R.O.C.)") - assert len(result.results) > 0 - top_answer = result.results[0] - assert top_answer.type == "Point Address" - assert top_answer.address.street_name == "Zhishan Road Section 2" - assert top_answer.address.municipality == "Taipei City" - assert top_answer.address.postal_code == "111" - assert top_answer.address.country_code_iso3 == "TWN" + assert result.get('features', False) + coordinates = result['features'][0]['geometry']['coordinates'] + longitude = coordinates[0] + latitude = coordinates[1] - @MapsSearchPreparer() - @recorded_by_proxy - def test_fuzzy_search_top(self): - result = self.client.fuzzy_search("Taiwan High Speed Rail", top=5) - assert len(result.results) == 5 + assert longitude == -122.138669 + assert latitude == 47.630359 @MapsSearchPreparer() @recorded_by_proxy - def test_fuzzy_search_skip(self): - result = self.client.fuzzy_search("Taiwan High Speed Rail") - assert len(result.results) > 0 + def test_geocode_batch(self): + result = self.client.get_geocoding_batch({ + "batchItems": [ + {"query": "400 Broad St, Seattle, WA 98109"}, + {"query": "15127 NE 24th Street, Redmond, WA 98052"}, + ], + },) - assert result.total_results > result.num_results - result2 = self.client.fuzzy_search("Taiwan High Speed Rail", skip=result.num_results) - assert len(result2.results) > 0 and result2.results[0] != result.results[0] + assert 'batchItems' in result and result['batchItems'] - @MapsSearchPreparer() - @recorded_by_proxy - def test_fuzzy_search_multiple_results(self): - result = self.client.fuzzy_search("Taiwan High Speed Rail") - assert len(result.results) > 0 - - assert result.total_results > result.num_results - result2 = self.client.fuzzy_search("Taiwan High Speed Rail", skip=result.num_results) - assert len(result2.results) > 0 and result2.results[0] != result.results[0] + expected_coordinates = [ + (-122.349309, 47.620498), + (-122.138669, 47.630359) + ] - @MapsSearchPreparer() - @recorded_by_proxy - def test_search_point_of_interest(self): - result = self.client.search_point_of_interest("Taipei") - assert len(result.results) > 0 - for item in result.results: - assert item.type == "POI" + for i, item in enumerate(result['batchItems']): + assert item.get('features') - @MapsSearchPreparer() - @recorded_by_proxy - def test_search_address(self): - result = self.client.search_address("Taipei") - assert len(result.results) > 0 - for item in result.results: - assert item.type != "POI" + coordinates = item['features'][0]['geometry']['coordinates'] + longitude, latitude = coordinates - @MapsSearchPreparer() - @recorded_by_proxy - def test_search_nearby_point_of_interest(self): - result = self.client.search_nearby_point_of_interest(coordinates=(25.0338053, 121.5640089)) - assert len(result.results) > 0 - for item in result.results: - assert item.type == "POI" + expected_longitude, expected_latitude = expected_coordinates[i] - @MapsSearchPreparer() - @recorded_by_proxy - def test_search_point_of_interest_category(self): - result = self.client.search_point_of_interest_category( - "RESTAURANT", coordinates=(25.0338053, 121.5640089) - ) - assert len(result.results) > 0 - for item in result.results: - assert item.type == "POI" - assert "RESTAURANT" in [category.code for category in item.point_of_interest.classifications] + assert longitude == expected_longitude + assert latitude == expected_latitude @MapsSearchPreparer() @recorded_by_proxy - def test_search_structured_address(self): - addr = StructuredAddress(street_number="221", - street_name="Sec. 2, Zhishan Rd.", - municipality_subdivision="Shilin Dist.", - municipality="Taipei City", - country_code="TW") - result = self.client.search_structured_address(addr) - assert len(result.results) > 0 - for item in result.results: - assert item.type != "POI" - top_answer = result.results[0] - assert top_answer.type == "Point Address" - assert top_answer.address.street_name == "Zhishan Road Section 2" - assert top_answer.address.municipality == "Taipei City" - assert top_answer.address.postal_code == "111" - assert top_answer.address.country_code_iso3 == "TWN" + def test_reverse_geocode(self): + result = self.client.get_reverse_geocoding(coordinates=[-122.138679, 47.630356]) + assert result.get('features', False) + props = result['features'][0].get('properties', {}) - @MapsSearchPreparer() - @recorded_by_proxy - def test_get_geometries(self): - result = self.client.get_geometries(geometry_ids=["8bceafe8-3d98-4445-b29b-fd81d3e9adf5"]) - assert len(result) > 0 - assert result[0].provider_id == "8bceafe8-3d98-4445-b29b-fd81d3e9adf5" - top_answer = result[0] - assert top_answer.geometry_data.type == "FeatureCollection" - assert len(top_answer.geometry_data.features) > 0 + assert props.get('address', False) + assert props['address'].get('formattedAddress', 'No formatted address found') == "2265 152nd Ave NE, Redmond, Washington 98052, United States" @MapsSearchPreparer() @recorded_by_proxy - def test_get_point_of_interest_categories(self): - result = self.client.get_point_of_interest_categories() - assert len(result) > 0 - assert result[0].name == 'Sports Center' - assert result[0].id == 7320 + def test_reverse_geocode_batch(self): + result = self.client.get_reverse_geocoding_batch({ + "batchItems": [ + {"coordinates": [-122.349309, 47.620498]}, + {"coordinates": [-122.138679, 47.630356]}, + ], + }, ) - @MapsSearchPreparer() - @recorded_by_proxy - def test_reverse_search_address(self): - result = self.client.reverse_search_address(coordinates=(25.0338053, 121.5640089)) - assert len(result.results) > 0 - top_answer = result.results[0] - assert top_answer.address.building_number == '45' - assert top_answer.address.postal_code == "110" - assert top_answer.address.country_code_iso3 == "TWN" + assert result.get('batchItems', False) - @MapsSearchPreparer() - @recorded_by_proxy - def test_reverse_search_cross_street_address(self): - result = self.client.reverse_search_cross_street_address(coordinates=(25.0338053, 121.5640089)) - assert len(result.addresses) > 0 - top_answer = result.addresses[0] - assert top_answer.address.postal_code == "110" - assert top_answer.address.country_code_iso3 == "TWN" + expected_addresses = [ + "400 Broad St, Seattle, Washington 98109, United States", + "2265 152nd Ave NE, Redmond, Washington 98052, United States" + ] - @MapsSearchPreparer() - @recorded_by_proxy - def test_search_inside_geometry(self): - geo_json_obj = { - 'type': 'Polygon', - 'coordinates': [ - [[-122.43576049804686, 37.7524152343544], - [-122.43301391601562, 37.70660472542312], - [-122.36434936523438, 37.712059855877314], - [-122.43576049804686, 37.7524152343544]] - ] - } - result = self.client.search_inside_geometry( - query="pizza", - geometry=geo_json_obj - ) - assert len(result.results) > 0 - top_answer = result.results[0] - assert top_answer.score > 2 - assert top_answer.address.country_subdivision == "CA" - assert top_answer.address.local_name == "San Francisco" + for i, item in enumerate(result['batchItems']): + features = item.get('features', []) + assert features - @MapsSearchPreparer() - @recorded_by_proxy - def test_search_along_route(self): - route_obj = { - "route": { - "type": "LineString", - "coordinates": [ - [-122.143035,47.653536], - [-122.187164,47.617556], - [-122.114981,47.570599], - [-122.132756,47.654009] - ] - } - } - result = self.client.search_along_route( - query="burger", - route=route_obj, - max_detour_time=1000 - ) - assert len(result.results) > 0 - top_answer = result.results[0] - assert top_answer.address.country_subdivision_name == "Washington" - assert top_answer.address.country_subdivision == "WA" - assert top_answer.address.country_code == "US" + props = features[0].get('properties', {}) + assert props and props.get('address', False) - @MapsSearchPreparer() - @recorded_by_proxy - def test_search_address(self): - result = self.client.search_address(query="15127 NE 24th Street, Redmond, WA 98052") - assert len(result.results) > 0 - top_answer = result.results[0] - assert top_answer.type == 'Point Address' - assert top_answer.address.country_subdivision == "WA" - assert top_answer.address.country_code == "US" + formatted_address = props['address'].get('formattedAddress', f'No formatted address for item {i + 1} found') + assert formatted_address == expected_addresses[i] @MapsSearchPreparer() @recorded_by_proxy - def fuzzy_search_batch(self): - result = self.client.fuzzy_search_batch( - search_queries=[ - "350 5th Ave, New York, NY 10118&limit=1", - "400 Broad St, Seattle, WA 98109&limit=3" - ] - ) - assert len(result.items) > 0 - top_answer = result.items[0] - assert top_answer.response.results[0].address.country_subdivision == "NY" - assert top_answer.response.results[0].address.country_code == "US" + def test_get_polygon(self): + result = self.client.get_polygon(**{ + "coordinates": [-122.204141, 47.61256], + "result_type": BoundaryResultType.LOCALITY, + "resolution": Resolution.SMALL, + }) - @MapsSearchPreparer() - @recorded_by_proxy - def search_address_batch(self): - result = self.client.search_address_batch( - search_queries=[ - "350 5th Ave, New York, NY 10118&limit=1", - "400 Broad St, Seattle, WA 98109&limit=3" - ] - ) - assert len(result.items) > 0 - top_answer = result.items[0] - assert top_answer.response.results[0].address.country_subdivision == "NY" - assert top_answer.response.results[0].address.country_code == "US" + assert result.get('geometry', False) and result['geometry'].get('geometries', False) diff --git a/sdk/maps/azure-maps-search/tests/test_maps_search_client_async.py b/sdk/maps/azure-maps-search/tests/test_maps_search_client_async.py new file mode 100644 index 0000000000000..cd6c2d1314048 --- /dev/null +++ b/sdk/maps/azure-maps-search/tests/test_maps_search_client_async.py @@ -0,0 +1,117 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import os + +from azure.core.credentials import AzureKeyCredential +from azure.maps.search.aio import MapsSearchClient +from azure.maps.search import BoundaryResultType, Resolution +from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import AzureRecordedTestCase, is_live + +from search_preparer import MapsSearchPreparer + + +# cSpell:disable +class TestMapsSearchClientAsync(AzureRecordedTestCase): + def setup_method(self, method): + self.client = MapsSearchClient( + credential=AzureKeyCredential(os.environ.get('AZURE_SUBSCRIPTION_KEY', "AzureMapsSubscriptionKey")) + ) + assert self.client is not None + + @MapsSearchPreparer() + @recorded_by_proxy_async + async def test_geocode(self): + async with self.client: + result = await self.client.get_geocoding(query="15127 NE 24th Street, Redmond, WA 98052") + + assert result.get('features', False) + coordinates = result['features'][0]['geometry']['coordinates'] + longitude = coordinates[0] + latitude = coordinates[1] + + assert longitude == -122.138669 + assert latitude == 47.630359 + + @MapsSearchPreparer() + @recorded_by_proxy_async + async def test_geocode_batch(self): + async with self.client: + result = await self.client.get_geocoding_batch({ + "batchItems": [ + {"query": "400 Broad St, Seattle, WA 98109"}, + {"query": "15127 NE 24th Street, Redmond, WA 98052"}, + ], + },) + + assert 'batchItems' in result and result['batchItems'] + + expected_coordinates = [ + (-122.349309, 47.620498), + (-122.138669, 47.630359) + ] + + for i, item in enumerate(result['batchItems']): + assert item.get('features') + + coordinates = item['features'][0]['geometry']['coordinates'] + longitude, latitude = coordinates + + expected_longitude, expected_latitude = expected_coordinates[i] + + assert longitude == expected_longitude + assert latitude == expected_latitude + + @MapsSearchPreparer() + @recorded_by_proxy_async + async def test_reverse_geocode(self): + async with self.client: + result = await self.client.get_reverse_geocoding(coordinates=[-122.138679, 47.630356]) + assert result.get('features', False) + props = result['features'][0].get('properties', {}) + + assert props.get('address', False) + assert props['address'].get('formattedAddress', 'No formatted address found') == "2265 152nd Ave NE, Redmond, Washington 98052, United States" + + @MapsSearchPreparer() + @recorded_by_proxy_async + async def test_reverse_geocode_batch(self): + async with self.client: + result = await self.client.get_reverse_geocoding_batch({ + "batchItems": [ + {"coordinates": [-122.349309, 47.620498]}, + {"coordinates": [-122.138679, 47.630356]}, + ], + }, ) + + assert result.get('batchItems', False) + + expected_addresses = [ + "400 Broad St, Seattle, Washington 98109, United States", + "2265 152nd Ave NE, Redmond, Washington 98052, United States" + ] + + for i, item in enumerate(result['batchItems']): + features = item.get('features', []) + assert features + + props = features[0].get('properties', {}) + assert props and props.get('address', False) + + formatted_address = props['address'].get('formattedAddress', f'No formatted address for item {i + 1} found') + assert formatted_address == expected_addresses[i] + + @MapsSearchPreparer() + @recorded_by_proxy_async + async def test_get_polygon(self): + async with self.client: + result = await self.client.get_polygon(**{ + "coordinates": [-122.204141, 47.61256], + "result_type": BoundaryResultType.LOCALITY, + "resolution": Resolution.SMALL, + }) + + assert result.get('geometry', False) and result['geometry'].get('geometries', False) diff --git a/sdk/maps/azure-maps-timezone/CHANGELOG.md b/sdk/maps/azure-maps-timezone/CHANGELOG.md index ff7212600d5e4..16d6cd4380f1a 100644 --- a/sdk/maps/azure-maps-timezone/CHANGELOG.md +++ b/sdk/maps/azure-maps-timezone/CHANGELOG.md @@ -1,4 +1,8 @@ # Release History -## 1.0.0b1 (Unreleased) +## 1.0.0b1 (2024-08-06) + +### Features Added + +- Initial release diff --git a/sdk/maps/azure-maps-timezone/README.md b/sdk/maps/azure-maps-timezone/README.md index 5e5678273dc4a..63b82ca609bc8 100644 --- a/sdk/maps/azure-maps-timezone/README.md +++ b/sdk/maps/azure-maps-timezone/README.md @@ -13,7 +13,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7 or later is required to use this package. +- Python 3.8 or later is required to use this package. - An [Azure subscription][azure_subscription] and an [Azure Maps account](https://docs.microsoft.com/azure/azure-maps/how-to-manage-account-keys). - A deployed Maps Services resource. You can create the resource via [Azure Portal][azure_portal] or [Azure CLI][azure_cli]. @@ -31,7 +31,7 @@ Install the Azure Maps Service Timezone SDK. pip install azure-maps-timezone ``` -### Create and Authenticate the TimezoneClient +### Create and Authenticate the MapsTimezoneClient To create a client object to access the Azure Maps Timezone API, you will need a **credential** object. Azure Maps Timezone client also support two ways to authenticate. @@ -45,11 +45,11 @@ Then pass an `AZURE_SUBSCRIPTION_KEY` as the `credential` parameter into an inst import os from azure.core.credentials import AzureKeyCredential -from azure.maps.timezone import TimezoneClient +from azure.maps.timezone import MapsTimezoneClient credential = AzureKeyCredential(os.environ.get("AZURE_SUBSCRIPTION_KEY")) -timezone_client = TimezoneClient( +timezone_client = MapsTimezoneClient( credential=credential, ) ``` @@ -74,11 +74,11 @@ You will also need to specify the Azure Maps resource you intend to use by speci ```python import os -from azure.maps.timezone import TimezoneClient +from azure.maps.timezone import MapsTimezoneClient from azure.identity import DefaultAzureCredential credential = DefaultAzureCredential() -timezone_client = TimezoneClient(credential=credential) +timezone_client = MapsTimezoneClient(credential=credential) ``` ## Key concepts @@ -87,12 +87,12 @@ The Azure Maps Timezone client library for Python allows you to interact with ea ### Sync Clients -`TimezoneClient` is the primary client for developers using the Azure Maps Timezone client library for Python. -Once you initialized a `TimezoneClient` class, you can explore the methods on this client object to understand the different features of the Azure Maps Timezone service that you can access. +`MapsTimezoneClient` is the primary client for developers using the Azure Maps Timezone client library for Python. +Once you initialized a `MapsTimezoneClient` class, you can explore the methods on this client object to understand the different features of the Azure Maps Timezone service that you can access. ### Async Clients -This library includes a complete async API supported on Python 3.5+. To use it, you must first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/). +This library includes a complete async API supported on Python 3.8+. To use it, you must first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/). See [azure-core documentation](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#transport) for more information. Async clients and credentials should be closed when they're no longer needed. These objects are async context managers and define async `close` methods. @@ -121,9 +121,9 @@ subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") def get_timezone_by_id(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone import TimezoneClient + from azure.maps.timezone import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: result = timezone_client.get_timezone_by_id(timezone_id="sr-Latn-RS") print(result) @@ -149,9 +149,9 @@ subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") def get_timezone_by_coordinates(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone import TimezoneClient + from azure.maps.timezone import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: result = timezone_client.get_timezone_by_coordinates(coordinates=[25.0338053, 121.5640089]) print(result) @@ -177,9 +177,9 @@ subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") def get_iana_version(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone import TimezoneClient + from azure.maps.timezone import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: result = timezone_client.get_iana_version() print(result) @@ -205,9 +205,9 @@ subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") def get_iana_timezone_ids(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone import TimezoneClient + from azure.maps.timezone import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: result = timezone_client.get_iana_timezone_ids() print(result) @@ -233,9 +233,9 @@ subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") def get_windows_timezone_ids(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone import TimezoneClient + from azure.maps.timezone import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: result = timezone_client.get_windows_timezone_ids() print(result) @@ -260,9 +260,9 @@ subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY", "your subscription key") def convert_windows_timezone_to_iana(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone import TimezoneClient + from azure.maps.timezone import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: result = timezone_client.convert_windows_timezone_to_iana(windows_timezone_id="Pacific Standard Time") print(result) diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/__init__.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/__init__.py index 4c26036bca77b..ec4b704bbba48 100644 --- a/sdk/maps/azure-maps-timezone/azure/maps/timezone/__init__.py +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/__init__.py @@ -14,7 +14,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "TimezoneClient", + "MapsTimezoneClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/_patch.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/_patch.py index def3fd729e954..68c65a317b787 100644 --- a/sdk/maps/azure-maps-timezone/azure/maps/timezone/_patch.py +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/_patch.py @@ -13,7 +13,7 @@ from azure.core.pipeline.policies import AzureKeyCredentialPolicy from ._client import TimezoneClient as TimezoneClientGenerated -__all__: List[str] = ["TimezoneClient"] # Add all objects you want publicly available to users at this package level +__all__: List[str] = ["MapsTimezoneClient"] def patch_sdk(): @@ -43,7 +43,7 @@ def _authentication_policy(credential): # pylint: disable=C4748 -class TimezoneClient(TimezoneClientGenerated): +class MapsTimezoneClient(TimezoneClientGenerated): def __init__( self, credential: Union[AzureKeyCredential, TokenCredential], diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/__init__.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/__init__.py index 4c26036bca77b..ec4b704bbba48 100644 --- a/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/__init__.py +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/__init__.py @@ -14,7 +14,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "TimezoneClient", + "MapsTimezoneClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_patch.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_patch.py index c8252f3bd9d90..d6b9db84d2a9e 100644 --- a/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_patch.py +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_patch.py @@ -14,7 +14,7 @@ from azure.core.pipeline.policies import AzureKeyCredentialPolicy from ._client import TimezoneClient as TimezoneClientGenerated -__all__: List[str] = ["TimezoneClient"] # Add all objects you want publicly available to users at this package level +__all__: List[str] = ["MapsTimezoneClient"] def patch_sdk(): @@ -43,7 +43,7 @@ def _authentication_policy(credential): # pylint: disable=C4748 -class TimezoneClient(TimezoneClientGenerated): +class MapsTimezoneClient(TimezoneClientGenerated): def __init__( self, credential: Union[AzureKeyCredential, AsyncTokenCredential], diff --git a/sdk/maps/azure-maps-timezone/dev_requirements.txt b/sdk/maps/azure-maps-timezone/dev_requirements.txt index 60a4d2ac2b5e2..385751a7107b8 100644 --- a/sdk/maps/azure-maps-timezone/dev_requirements.txt +++ b/sdk/maps/azure-maps-timezone/dev_requirements.txt @@ -1,4 +1,4 @@ -e ../../../tools/azure-sdk-tools -e ../../core/azure-core -e ../../identity/azure-identity -aiohttp>=3.0; python_version >= '3.7' \ No newline at end of file +aiohttp>=3.0; python_version >= '3.8' \ No newline at end of file diff --git a/sdk/maps/azure-maps-timezone/pyproject.toml b/sdk/maps/azure-maps-timezone/pyproject.toml index b267c0a5bac53..1728add4bb431 100644 --- a/sdk/maps/azure-maps-timezone/pyproject.toml +++ b/sdk/maps/azure-maps-timezone/pyproject.toml @@ -1,6 +1,5 @@ [tool.azure-sdk-build] pyright = false type_check_samples = false -verifytypes = false ci_enabled = true strict_sphinx = false \ No newline at end of file diff --git a/sdk/maps/azure-maps-timezone/samples/README.md b/sdk/maps/azure-maps-timezone/samples/README.md index 4aa7a7b9a68b2..670695d271613 100644 --- a/sdk/maps/azure-maps-timezone/samples/README.md +++ b/sdk/maps/azure-maps-timezone/samples/README.md @@ -30,7 +30,7 @@ Then for common Azure Maps Timezone operations: ## Prerequisites -* Python 3.7 or later is required to use this package +* Python 3.8 or later is required to use this package * You must have an [Azure subscription](https://azure.microsoft.com/free/) * A deployed Maps Services resource. You can create the resource via [Azure Portal][azure_portal] or [Azure CLI][azure_cli]. diff --git a/sdk/maps/azure-maps-timezone/samples/async_samples/convert_windows_timezone_to_iana_async.py b/sdk/maps/azure-maps-timezone/samples/async_samples/convert_windows_timezone_to_iana_async.py index ebe57b34bc8ff..450a95b9f60da 100644 --- a/sdk/maps/azure-maps-timezone/samples/async_samples/convert_windows_timezone_to_iana_async.py +++ b/sdk/maps/azure-maps-timezone/samples/async_samples/convert_windows_timezone_to_iana_async.py @@ -25,9 +25,9 @@ async def convert_windows_timezone_to_iana_async(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone.aio import TimezoneClient + from azure.maps.timezone.aio import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: async with timezone_client: result = await timezone_client.convert_windows_timezone_to_iana(windows_timezone_id="Pacific Standard Time") diff --git a/sdk/maps/azure-maps-timezone/samples/async_samples/get_iana_timezone_ids_async.py b/sdk/maps/azure-maps-timezone/samples/async_samples/get_iana_timezone_ids_async.py index f473efbda232e..7ed8c43d98d12 100644 --- a/sdk/maps/azure-maps-timezone/samples/async_samples/get_iana_timezone_ids_async.py +++ b/sdk/maps/azure-maps-timezone/samples/async_samples/get_iana_timezone_ids_async.py @@ -25,9 +25,9 @@ async def get_iana_timezone_ids_async(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone.aio import TimezoneClient + from azure.maps.timezone.aio import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: async with timezone_client: result = await timezone_client.get_iana_timezone_ids() diff --git a/sdk/maps/azure-maps-timezone/samples/async_samples/get_iana_version_async.py b/sdk/maps/azure-maps-timezone/samples/async_samples/get_iana_version_async.py index d0a8705bbddff..6741ceee5e3ee 100644 --- a/sdk/maps/azure-maps-timezone/samples/async_samples/get_iana_version_async.py +++ b/sdk/maps/azure-maps-timezone/samples/async_samples/get_iana_version_async.py @@ -25,9 +25,9 @@ async def get_iana_version_async(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone.aio import TimezoneClient + from azure.maps.timezone.aio import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: async with timezone_client: result = await timezone_client.get_iana_version() diff --git a/sdk/maps/azure-maps-timezone/samples/async_samples/get_timezone_by_coordinates_async.py b/sdk/maps/azure-maps-timezone/samples/async_samples/get_timezone_by_coordinates_async.py index 9b90cfe28e899..7773ae47b167f 100644 --- a/sdk/maps/azure-maps-timezone/samples/async_samples/get_timezone_by_coordinates_async.py +++ b/sdk/maps/azure-maps-timezone/samples/async_samples/get_timezone_by_coordinates_async.py @@ -25,9 +25,9 @@ async def get_timezone_by_coordinates_async(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone.aio import TimezoneClient + from azure.maps.timezone.aio import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: async with timezone_client: result = await timezone_client.get_timezone_by_coordinates(coordinates=[25.0338053, 121.5640089]) diff --git a/sdk/maps/azure-maps-timezone/samples/async_samples/get_timezone_by_id_async.py b/sdk/maps/azure-maps-timezone/samples/async_samples/get_timezone_by_id_async.py index 28679939225b6..89d4f4543b588 100644 --- a/sdk/maps/azure-maps-timezone/samples/async_samples/get_timezone_by_id_async.py +++ b/sdk/maps/azure-maps-timezone/samples/async_samples/get_timezone_by_id_async.py @@ -25,9 +25,9 @@ async def get_timezone_by_id_async(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone.aio import TimezoneClient + from azure.maps.timezone.aio import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: async with timezone_client: result = await timezone_client.get_timezone_by_id(timezone_id="sr-Latn-RS") diff --git a/sdk/maps/azure-maps-timezone/samples/async_samples/get_windows_timezone_ids_async.py b/sdk/maps/azure-maps-timezone/samples/async_samples/get_windows_timezone_ids_async.py index adf9187ca396b..0bd9d04adca1b 100644 --- a/sdk/maps/azure-maps-timezone/samples/async_samples/get_windows_timezone_ids_async.py +++ b/sdk/maps/azure-maps-timezone/samples/async_samples/get_windows_timezone_ids_async.py @@ -25,9 +25,9 @@ async def get_windows_timezone_ids_async(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone.aio import TimezoneClient + from azure.maps.timezone.aio import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: async with timezone_client: result = await timezone_client.get_windows_timezone_ids() diff --git a/sdk/maps/azure-maps-timezone/samples/convert_windows_timezone_to_iana.py b/sdk/maps/azure-maps-timezone/samples/convert_windows_timezone_to_iana.py index 9c1fa832a2017..11f7e6d78d8ac 100644 --- a/sdk/maps/azure-maps-timezone/samples/convert_windows_timezone_to_iana.py +++ b/sdk/maps/azure-maps-timezone/samples/convert_windows_timezone_to_iana.py @@ -24,9 +24,9 @@ def convert_windows_timezone_to_iana(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone import TimezoneClient + from azure.maps.timezone import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: result = timezone_client.convert_windows_timezone_to_iana(windows_timezone_id="Pacific Standard Time") print(result) diff --git a/sdk/maps/azure-maps-timezone/samples/get_iana_timezone_ids.py b/sdk/maps/azure-maps-timezone/samples/get_iana_timezone_ids.py index c56213eb1e14b..bb17ae51404cf 100644 --- a/sdk/maps/azure-maps-timezone/samples/get_iana_timezone_ids.py +++ b/sdk/maps/azure-maps-timezone/samples/get_iana_timezone_ids.py @@ -24,9 +24,9 @@ def get_iana_timezone_ids(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone import TimezoneClient + from azure.maps.timezone import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: result = timezone_client.get_iana_timezone_ids() print(result) diff --git a/sdk/maps/azure-maps-timezone/samples/get_iana_version.py b/sdk/maps/azure-maps-timezone/samples/get_iana_version.py index 4a3d73ba8326b..09deb25f6bbae 100644 --- a/sdk/maps/azure-maps-timezone/samples/get_iana_version.py +++ b/sdk/maps/azure-maps-timezone/samples/get_iana_version.py @@ -24,9 +24,9 @@ def get_iana_version(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone import TimezoneClient + from azure.maps.timezone import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: result = timezone_client.get_iana_version() print(result) diff --git a/sdk/maps/azure-maps-timezone/samples/get_timezone_by_coordinates.py b/sdk/maps/azure-maps-timezone/samples/get_timezone_by_coordinates.py index e42d654fd7211..66f7aad65cab8 100644 --- a/sdk/maps/azure-maps-timezone/samples/get_timezone_by_coordinates.py +++ b/sdk/maps/azure-maps-timezone/samples/get_timezone_by_coordinates.py @@ -24,9 +24,9 @@ def get_timezone_by_coordinates(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone import TimezoneClient + from azure.maps.timezone import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: result = timezone_client.get_timezone_by_coordinates(coordinates=[25.0338053, 121.5640089]) print(result) diff --git a/sdk/maps/azure-maps-timezone/samples/get_timezone_by_id.py b/sdk/maps/azure-maps-timezone/samples/get_timezone_by_id.py index f50b432c988c4..2e463dbee15ae 100644 --- a/sdk/maps/azure-maps-timezone/samples/get_timezone_by_id.py +++ b/sdk/maps/azure-maps-timezone/samples/get_timezone_by_id.py @@ -24,9 +24,9 @@ def get_timezone_by_id(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone import TimezoneClient + from azure.maps.timezone import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: result = timezone_client.get_timezone_by_id(timezone_id="sr-Latn-RS") print(result) diff --git a/sdk/maps/azure-maps-timezone/samples/get_windows_timezone_ids.py b/sdk/maps/azure-maps-timezone/samples/get_windows_timezone_ids.py index da69d8bb2cf63..cb4198f18d829 100644 --- a/sdk/maps/azure-maps-timezone/samples/get_windows_timezone_ids.py +++ b/sdk/maps/azure-maps-timezone/samples/get_windows_timezone_ids.py @@ -24,9 +24,9 @@ def get_windows_timezone_ids(): from azure.core.credentials import AzureKeyCredential - from azure.maps.timezone import TimezoneClient + from azure.maps.timezone import MapsTimezoneClient - timezone_client = TimezoneClient(credential=AzureKeyCredential(subscription_key)) + timezone_client = MapsTimezoneClient(credential=AzureKeyCredential(subscription_key)) try: result = timezone_client.get_windows_timezone_ids() print(result) diff --git a/sdk/maps/azure-maps-timezone/setup.py b/sdk/maps/azure-maps-timezone/setup.py index 8cf7755fde7c3..4b36fe50cd360 100644 --- a/sdk/maps/azure-maps-timezone/setup.py +++ b/sdk/maps/azure-maps-timezone/setup.py @@ -68,6 +68,8 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -81,5 +83,6 @@ 'msrest>=0.6.21', 'azure-common~=1.1', 'azure-mgmt-core>=1.3.0,<2.0.0', - ] + ], + python_requires=">=3.8", ) diff --git a/sdk/maps/azure-maps-timezone/tests/test_maps_timezone_client.py b/sdk/maps/azure-maps-timezone/tests/test_maps_timezone_client.py index 61359c36dd058..d3512b63f40f7 100644 --- a/sdk/maps/azure-maps-timezone/tests/test_maps_timezone_client.py +++ b/sdk/maps/azure-maps-timezone/tests/test_maps_timezone_client.py @@ -6,7 +6,7 @@ import os from azure.core.credentials import AzureKeyCredential -from azure.maps.timezone import TimezoneClient +from azure.maps.timezone import MapsTimezoneClient from devtools_testutils import AzureRecordedTestCase, recorded_by_proxy, is_live from timezone_preparer import MapsTimezonePreparer @@ -15,7 +15,7 @@ # cSpell:disable class TestMapsTimezoneClient(AzureRecordedTestCase): def setup_method(self, method): - self.client = TimezoneClient( + self.client = MapsTimezoneClient( credential=AzureKeyCredential(os.getenv("AZURE_SUBSCRIPTION_KEY", "AzureSubscriptionKey")) ) assert self.client is not None diff --git a/sdk/maps/azure-maps-timezone/tests/test_maps_timezone_client_async.py b/sdk/maps/azure-maps-timezone/tests/test_maps_timezone_client_async.py index e6a3adb062226..eedaa048121a2 100644 --- a/sdk/maps/azure-maps-timezone/tests/test_maps_timezone_client_async.py +++ b/sdk/maps/azure-maps-timezone/tests/test_maps_timezone_client_async.py @@ -6,7 +6,7 @@ import os from azure.core.credentials import AzureKeyCredential -from azure.maps.timezone.aio import TimezoneClient +from azure.maps.timezone.aio import MapsTimezoneClient from devtools_testutils import AzureRecordedTestCase, is_live from devtools_testutils.aio import recorded_by_proxy_async @@ -16,7 +16,7 @@ # cSpell:disable class TestMapsTimezoneClient(AzureRecordedTestCase): def setup_method(self, method): - self.client = TimezoneClient( + self.client = MapsTimezoneClient( credential=AzureKeyCredential(os.getenv("AZURE_SUBSCRIPTION_KEY", "AzureSubscriptionKey")) ) assert self.client is not None diff --git a/sdk/maps/azure-mgmt-maps/README.md b/sdk/maps/azure-mgmt-maps/README.md index ed90f83ed0d5f..75978aa2ce957 100644 --- a/sdk/maps/azure-mgmt-maps/README.md +++ b/sdk/maps/azure-mgmt-maps/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Maps Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package diff --git a/sdk/maps/azure-mgmt-maps/pyproject.toml b/sdk/maps/azure-mgmt-maps/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/maps/azure-mgmt-maps/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/maps/azure-mgmt-maps/setup.py b/sdk/maps/azure-mgmt-maps/setup.py index b47353f52ce32..7dd04b73103db 100644 --- a/sdk/maps/azure-mgmt-maps/setup.py +++ b/sdk/maps/azure-mgmt-maps/setup.py @@ -58,6 +58,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -79,5 +80,5 @@ "azure-mgmt-core>=1.3.2,<2.0.0", "typing-extensions>=4.3.0; python_version<'3.8.0'", ], - python_requires=">=3.7", + python_requires=">=3.8", ) diff --git a/sdk/maps/ci.yml b/sdk/maps/ci.yml index 08a1f791cce6b..49b760c8e6f06 100644 --- a/sdk/maps/ci.yml +++ b/sdk/maps/ci.yml @@ -29,13 +29,7 @@ extends: ServiceDirectory: maps TestProxy: true Artifacts: - - name: azure-mgmt-maps - safeName: azuremgmtmaps - name: azure-maps-search safeName: azuremapssearch - - name: azure-maps-geolocation - safeName: azuremapsgeolocation - name: azure-maps-render safeName: azuremapsrender - - name: azure-maps-route - safeName: azuremapsroute diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/pyproject.toml b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/media/azure-mgmt-media/pyproject.toml b/sdk/media/azure-mgmt-media/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/media/azure-mgmt-media/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/migrationdiscovery/azure-mgmt-migrationdiscoverysap/pyproject.toml b/sdk/migrationdiscovery/azure-mgmt-migrationdiscoverysap/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/migrationdiscovery/azure-mgmt-migrationdiscoverysap/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/pyproject.toml b/sdk/mixedreality/azure-mgmt-mixedreality/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/mixedreality/azure-mgmt-mixedreality/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/mixedreality/azure-mixedreality-authentication/pyproject.toml b/sdk/mixedreality/azure-mixedreality-authentication/pyproject.toml index cf845e14852bf..df558bb3b1e74 100644 --- a/sdk/mixedreality/azure-mixedreality-authentication/pyproject.toml +++ b/sdk/mixedreality/azure-mixedreality-authentication/pyproject.toml @@ -1,5 +1,4 @@ [tool.azure-sdk-build] pyright = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py index 71b4d322507b3..a04f831d0c6a3 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py @@ -942,7 +942,6 @@ def feature_store_entities(self) -> FeatureStoreEntityOperations: return self._featurestoreentities @property - @experimental def connections(self) -> WorkspaceConnectionsOperations: """A collection of connection related operations. diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/_azure_machine_learning_workspaces.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/_azure_machine_learning_workspaces.py index 727908dcfa746..83687c377b4bd 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/_azure_machine_learning_workspaces.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/_azure_machine_learning_workspaces.py @@ -15,7 +15,7 @@ from . import models from ._configuration import AzureMachineLearningWorkspacesConfiguration -from .operations import BatchDeploymentsOperations, BatchEndpointsOperations, CodeContainersOperations, CodeVersionsOperations, ComponentContainersOperations, ComponentVersionsOperations, ComputeOperations, DataContainersOperations, DataVersionsOperations, DatastoresOperations, EnvironmentContainersOperations, EnvironmentVersionsOperations, FeaturesOperations, FeaturesetContainersOperations, FeaturesetVersionsOperations, FeaturestoreEntityContainersOperations, FeaturestoreEntityVersionsOperations, JobsOperations, ManagedNetworkProvisionsOperations, ManagedNetworkSettingsRuleOperations, MarketplaceSubscriptionsOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, OnlineEndpointsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, RegistriesOperations, RegistryCodeContainersOperations, RegistryCodeVersionsOperations, RegistryComponentContainersOperations, RegistryComponentVersionsOperations, RegistryDataContainersOperations, RegistryDataReferencesOperations, RegistryDataVersionsOperations, RegistryEnvironmentContainersOperations, RegistryEnvironmentVersionsOperations, RegistryModelContainersOperations, RegistryModelVersionsOperations, SchedulesOperations, ServerlessEndpointsOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, WorkspaceFeaturesOperations, WorkspacesOperations +from .operations import BatchDeploymentsOperations, BatchEndpointsOperations, CodeContainersOperations, CodeVersionsOperations, ComponentContainersOperations, ComponentVersionsOperations, ComputeOperations, ConnectionOperations, ConnectionRaiBlocklistItemOperations, ConnectionRaiBlocklistItemsOperations, ConnectionRaiBlocklistOperations, ConnectionRaiBlocklistsOperations, ConnectionRaiPoliciesOperations, ConnectionRaiPolicyOperations, DataContainersOperations, DataVersionsOperations, DatastoresOperations, EndpointDeploymentOperations, EndpointOperations, EnvironmentContainersOperations, EnvironmentVersionsOperations, FeaturesOperations, FeaturesetContainersOperations, FeaturesetVersionsOperations, FeaturestoreEntityContainersOperations, FeaturestoreEntityVersionsOperations, JobsOperations, ManagedNetworkProvisionsOperations, ManagedNetworkSettingsRuleOperations, MarketplaceSubscriptionsOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, OnlineEndpointsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, RaiPoliciesOperations, RaiPolicyOperations, RegistriesOperations, RegistryCodeContainersOperations, RegistryCodeVersionsOperations, RegistryComponentContainersOperations, RegistryComponentVersionsOperations, RegistryDataContainersOperations, RegistryDataReferencesOperations, RegistryDataVersionsOperations, RegistryEnvironmentContainersOperations, RegistryEnvironmentVersionsOperations, RegistryModelContainersOperations, RegistryModelVersionsOperations, SchedulesOperations, ServerlessEndpointsOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, WorkspaceFeaturesOperations, WorkspacesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -27,10 +27,6 @@ class AzureMachineLearningWorkspaces(object): # pylint: disable=too-many-instance-attributes """These APIs allow end users to operate on Azure Machine Learning Workspace resources. - :ivar operations: Operations operations - :vartype operations: azure.mgmt.machinelearningservices.operations.Operations - :ivar workspaces: WorkspacesOperations operations - :vartype workspaces: azure.mgmt.machinelearningservices.operations.WorkspacesOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.machinelearningservices.operations.UsagesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations @@ -40,21 +36,6 @@ class AzureMachineLearningWorkspaces(object): # pylint: disable=too-many-inst :vartype quotas: azure.mgmt.machinelearningservices.operations.QuotasOperations :ivar compute: ComputeOperations operations :vartype compute: azure.mgmt.machinelearningservices.operations.ComputeOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.machinelearningservices.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.machinelearningservices.operations.PrivateLinkResourcesOperations - :ivar workspace_connections: WorkspaceConnectionsOperations operations - :vartype workspace_connections: - azure.mgmt.machinelearningservices.operations.WorkspaceConnectionsOperations - :ivar managed_network_settings_rule: ManagedNetworkSettingsRuleOperations operations - :vartype managed_network_settings_rule: - azure.mgmt.machinelearningservices.operations.ManagedNetworkSettingsRuleOperations - :ivar managed_network_provisions: ManagedNetworkProvisionsOperations operations - :vartype managed_network_provisions: - azure.mgmt.machinelearningservices.operations.ManagedNetworkProvisionsOperations :ivar registries: RegistriesOperations operations :vartype registries: azure.mgmt.machinelearningservices.operations.RegistriesOperations :ivar workspace_features: WorkspaceFeaturesOperations operations @@ -158,6 +139,54 @@ class AzureMachineLearningWorkspaces(object): # pylint: disable=too-many-inst :ivar serverless_endpoints: ServerlessEndpointsOperations operations :vartype serverless_endpoints: azure.mgmt.machinelearningservices.operations.ServerlessEndpointsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.machinelearningservices.operations.Operations + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: azure.mgmt.machinelearningservices.operations.WorkspacesOperations + :ivar workspace_connections: WorkspaceConnectionsOperations operations + :vartype workspace_connections: + azure.mgmt.machinelearningservices.operations.WorkspaceConnectionsOperations + :ivar connection: ConnectionOperations operations + :vartype connection: azure.mgmt.machinelearningservices.operations.ConnectionOperations + :ivar connection_rai_blocklists: ConnectionRaiBlocklistsOperations operations + :vartype connection_rai_blocklists: + azure.mgmt.machinelearningservices.operations.ConnectionRaiBlocklistsOperations + :ivar connection_rai_blocklist: ConnectionRaiBlocklistOperations operations + :vartype connection_rai_blocklist: + azure.mgmt.machinelearningservices.operations.ConnectionRaiBlocklistOperations + :ivar connection_rai_blocklist_item: ConnectionRaiBlocklistItemOperations operations + :vartype connection_rai_blocklist_item: + azure.mgmt.machinelearningservices.operations.ConnectionRaiBlocklistItemOperations + :ivar connection_rai_blocklist_items: ConnectionRaiBlocklistItemsOperations operations + :vartype connection_rai_blocklist_items: + azure.mgmt.machinelearningservices.operations.ConnectionRaiBlocklistItemsOperations + :ivar connection_rai_policies: ConnectionRaiPoliciesOperations operations + :vartype connection_rai_policies: + azure.mgmt.machinelearningservices.operations.ConnectionRaiPoliciesOperations + :ivar connection_rai_policy: ConnectionRaiPolicyOperations operations + :vartype connection_rai_policy: + azure.mgmt.machinelearningservices.operations.ConnectionRaiPolicyOperations + :ivar endpoint_deployment: EndpointDeploymentOperations operations + :vartype endpoint_deployment: + azure.mgmt.machinelearningservices.operations.EndpointDeploymentOperations + :ivar endpoint: EndpointOperations operations + :vartype endpoint: azure.mgmt.machinelearningservices.operations.EndpointOperations + :ivar rai_policies: RaiPoliciesOperations operations + :vartype rai_policies: azure.mgmt.machinelearningservices.operations.RaiPoliciesOperations + :ivar rai_policy: RaiPolicyOperations operations + :vartype rai_policy: azure.mgmt.machinelearningservices.operations.RaiPolicyOperations + :ivar managed_network_settings_rule: ManagedNetworkSettingsRuleOperations operations + :vartype managed_network_settings_rule: + azure.mgmt.machinelearningservices.operations.ManagedNetworkSettingsRuleOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.machinelearningservices.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.machinelearningservices.operations.PrivateLinkResourcesOperations + :ivar managed_network_provisions: ManagedNetworkProvisionsOperations operations + :vartype managed_network_provisions: + azure.mgmt.machinelearningservices.operations.ManagedNetworkProvisionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. @@ -186,17 +215,10 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.virtual_machine_sizes = VirtualMachineSizesOperations(self._client, self._config, self._serialize, self._deserialize) self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize) self.compute = ComputeOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.workspace_connections = WorkspaceConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_network_settings_rule = ManagedNetworkSettingsRuleOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_network_provisions = ManagedNetworkProvisionsOperations(self._client, self._config, self._serialize, self._deserialize) self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) self.workspace_features = WorkspaceFeaturesOperations(self._client, self._config, self._serialize, self._deserialize) self.registry_code_containers = RegistryCodeContainersOperations(self._client, self._config, self._serialize, self._deserialize) @@ -234,6 +256,24 @@ def __init__( self.online_deployments = OnlineDeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.schedules = SchedulesOperations(self._client, self._config, self._serialize, self._deserialize) self.serverless_endpoints = ServerlessEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_connections = WorkspaceConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection = ConnectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_blocklists = ConnectionRaiBlocklistsOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_blocklist = ConnectionRaiBlocklistOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_blocklist_item = ConnectionRaiBlocklistItemOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_blocklist_items = ConnectionRaiBlocklistItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_policies = ConnectionRaiPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_policy = ConnectionRaiPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.endpoint_deployment = EndpointDeploymentOperations(self._client, self._config, self._serialize, self._deserialize) + self.endpoint = EndpointOperations(self._client, self._config, self._serialize, self._deserialize) + self.rai_policies = RaiPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.rai_policy = RaiPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_network_settings_rule = ManagedNetworkSettingsRuleOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_network_provisions = ManagedNetworkProvisionsOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request( diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/_azure_machine_learning_workspaces.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/_azure_machine_learning_workspaces.py index dbd44e3674027..3a141cdfdf638 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/_azure_machine_learning_workspaces.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/_azure_machine_learning_workspaces.py @@ -16,7 +16,7 @@ from .. import models from ._configuration import AzureMachineLearningWorkspacesConfiguration -from .operations import BatchDeploymentsOperations, BatchEndpointsOperations, CodeContainersOperations, CodeVersionsOperations, ComponentContainersOperations, ComponentVersionsOperations, ComputeOperations, DataContainersOperations, DataVersionsOperations, DatastoresOperations, EnvironmentContainersOperations, EnvironmentVersionsOperations, FeaturesOperations, FeaturesetContainersOperations, FeaturesetVersionsOperations, FeaturestoreEntityContainersOperations, FeaturestoreEntityVersionsOperations, JobsOperations, ManagedNetworkProvisionsOperations, ManagedNetworkSettingsRuleOperations, MarketplaceSubscriptionsOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, OnlineEndpointsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, RegistriesOperations, RegistryCodeContainersOperations, RegistryCodeVersionsOperations, RegistryComponentContainersOperations, RegistryComponentVersionsOperations, RegistryDataContainersOperations, RegistryDataReferencesOperations, RegistryDataVersionsOperations, RegistryEnvironmentContainersOperations, RegistryEnvironmentVersionsOperations, RegistryModelContainersOperations, RegistryModelVersionsOperations, SchedulesOperations, ServerlessEndpointsOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, WorkspaceFeaturesOperations, WorkspacesOperations +from .operations import BatchDeploymentsOperations, BatchEndpointsOperations, CodeContainersOperations, CodeVersionsOperations, ComponentContainersOperations, ComponentVersionsOperations, ComputeOperations, ConnectionOperations, ConnectionRaiBlocklistItemOperations, ConnectionRaiBlocklistItemsOperations, ConnectionRaiBlocklistOperations, ConnectionRaiBlocklistsOperations, ConnectionRaiPoliciesOperations, ConnectionRaiPolicyOperations, DataContainersOperations, DataVersionsOperations, DatastoresOperations, EndpointDeploymentOperations, EndpointOperations, EnvironmentContainersOperations, EnvironmentVersionsOperations, FeaturesOperations, FeaturesetContainersOperations, FeaturesetVersionsOperations, FeaturestoreEntityContainersOperations, FeaturestoreEntityVersionsOperations, JobsOperations, ManagedNetworkProvisionsOperations, ManagedNetworkSettingsRuleOperations, MarketplaceSubscriptionsOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, OnlineEndpointsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, RaiPoliciesOperations, RaiPolicyOperations, RegistriesOperations, RegistryCodeContainersOperations, RegistryCodeVersionsOperations, RegistryComponentContainersOperations, RegistryComponentVersionsOperations, RegistryDataContainersOperations, RegistryDataReferencesOperations, RegistryDataVersionsOperations, RegistryEnvironmentContainersOperations, RegistryEnvironmentVersionsOperations, RegistryModelContainersOperations, RegistryModelVersionsOperations, SchedulesOperations, ServerlessEndpointsOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, WorkspaceFeaturesOperations, WorkspacesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -25,10 +25,6 @@ class AzureMachineLearningWorkspaces: # pylint: disable=too-many-instance-attributes """These APIs allow end users to operate on Azure Machine Learning Workspace resources. - :ivar operations: Operations operations - :vartype operations: azure.mgmt.machinelearningservices.aio.operations.Operations - :ivar workspaces: WorkspacesOperations operations - :vartype workspaces: azure.mgmt.machinelearningservices.aio.operations.WorkspacesOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.machinelearningservices.aio.operations.UsagesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations @@ -38,21 +34,6 @@ class AzureMachineLearningWorkspaces: # pylint: disable=too-many-instance-att :vartype quotas: azure.mgmt.machinelearningservices.aio.operations.QuotasOperations :ivar compute: ComputeOperations operations :vartype compute: azure.mgmt.machinelearningservices.aio.operations.ComputeOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.machinelearningservices.aio.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.machinelearningservices.aio.operations.PrivateLinkResourcesOperations - :ivar workspace_connections: WorkspaceConnectionsOperations operations - :vartype workspace_connections: - azure.mgmt.machinelearningservices.aio.operations.WorkspaceConnectionsOperations - :ivar managed_network_settings_rule: ManagedNetworkSettingsRuleOperations operations - :vartype managed_network_settings_rule: - azure.mgmt.machinelearningservices.aio.operations.ManagedNetworkSettingsRuleOperations - :ivar managed_network_provisions: ManagedNetworkProvisionsOperations operations - :vartype managed_network_provisions: - azure.mgmt.machinelearningservices.aio.operations.ManagedNetworkProvisionsOperations :ivar registries: RegistriesOperations operations :vartype registries: azure.mgmt.machinelearningservices.aio.operations.RegistriesOperations :ivar workspace_features: WorkspaceFeaturesOperations operations @@ -159,6 +140,54 @@ class AzureMachineLearningWorkspaces: # pylint: disable=too-many-instance-att :ivar serverless_endpoints: ServerlessEndpointsOperations operations :vartype serverless_endpoints: azure.mgmt.machinelearningservices.aio.operations.ServerlessEndpointsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.machinelearningservices.aio.operations.Operations + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: azure.mgmt.machinelearningservices.aio.operations.WorkspacesOperations + :ivar workspace_connections: WorkspaceConnectionsOperations operations + :vartype workspace_connections: + azure.mgmt.machinelearningservices.aio.operations.WorkspaceConnectionsOperations + :ivar connection: ConnectionOperations operations + :vartype connection: azure.mgmt.machinelearningservices.aio.operations.ConnectionOperations + :ivar connection_rai_blocklists: ConnectionRaiBlocklistsOperations operations + :vartype connection_rai_blocklists: + azure.mgmt.machinelearningservices.aio.operations.ConnectionRaiBlocklistsOperations + :ivar connection_rai_blocklist: ConnectionRaiBlocklistOperations operations + :vartype connection_rai_blocklist: + azure.mgmt.machinelearningservices.aio.operations.ConnectionRaiBlocklistOperations + :ivar connection_rai_blocklist_item: ConnectionRaiBlocklistItemOperations operations + :vartype connection_rai_blocklist_item: + azure.mgmt.machinelearningservices.aio.operations.ConnectionRaiBlocklistItemOperations + :ivar connection_rai_blocklist_items: ConnectionRaiBlocklistItemsOperations operations + :vartype connection_rai_blocklist_items: + azure.mgmt.machinelearningservices.aio.operations.ConnectionRaiBlocklistItemsOperations + :ivar connection_rai_policies: ConnectionRaiPoliciesOperations operations + :vartype connection_rai_policies: + azure.mgmt.machinelearningservices.aio.operations.ConnectionRaiPoliciesOperations + :ivar connection_rai_policy: ConnectionRaiPolicyOperations operations + :vartype connection_rai_policy: + azure.mgmt.machinelearningservices.aio.operations.ConnectionRaiPolicyOperations + :ivar endpoint_deployment: EndpointDeploymentOperations operations + :vartype endpoint_deployment: + azure.mgmt.machinelearningservices.aio.operations.EndpointDeploymentOperations + :ivar endpoint: EndpointOperations operations + :vartype endpoint: azure.mgmt.machinelearningservices.aio.operations.EndpointOperations + :ivar rai_policies: RaiPoliciesOperations operations + :vartype rai_policies: azure.mgmt.machinelearningservices.aio.operations.RaiPoliciesOperations + :ivar rai_policy: RaiPolicyOperations operations + :vartype rai_policy: azure.mgmt.machinelearningservices.aio.operations.RaiPolicyOperations + :ivar managed_network_settings_rule: ManagedNetworkSettingsRuleOperations operations + :vartype managed_network_settings_rule: + azure.mgmt.machinelearningservices.aio.operations.ManagedNetworkSettingsRuleOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.machinelearningservices.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.machinelearningservices.aio.operations.PrivateLinkResourcesOperations + :ivar managed_network_provisions: ManagedNetworkProvisionsOperations operations + :vartype managed_network_provisions: + azure.mgmt.machinelearningservices.aio.operations.ManagedNetworkProvisionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. @@ -186,17 +215,10 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.virtual_machine_sizes = VirtualMachineSizesOperations(self._client, self._config, self._serialize, self._deserialize) self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize) self.compute = ComputeOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.workspace_connections = WorkspaceConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_network_settings_rule = ManagedNetworkSettingsRuleOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_network_provisions = ManagedNetworkProvisionsOperations(self._client, self._config, self._serialize, self._deserialize) self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) self.workspace_features = WorkspaceFeaturesOperations(self._client, self._config, self._serialize, self._deserialize) self.registry_code_containers = RegistryCodeContainersOperations(self._client, self._config, self._serialize, self._deserialize) @@ -234,6 +256,24 @@ def __init__( self.online_deployments = OnlineDeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.schedules = SchedulesOperations(self._client, self._config, self._serialize, self._deserialize) self.serverless_endpoints = ServerlessEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_connections = WorkspaceConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection = ConnectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_blocklists = ConnectionRaiBlocklistsOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_blocklist = ConnectionRaiBlocklistOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_blocklist_item = ConnectionRaiBlocklistItemOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_blocklist_items = ConnectionRaiBlocklistItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_policies = ConnectionRaiPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_policy = ConnectionRaiPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.endpoint_deployment = EndpointDeploymentOperations(self._client, self._config, self._serialize, self._deserialize) + self.endpoint = EndpointOperations(self._client, self._config, self._serialize, self._deserialize) + self.rai_policies = RaiPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.rai_policy = RaiPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_network_settings_rule = ManagedNetworkSettingsRuleOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_network_provisions = ManagedNetworkProvisionsOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request( diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/__init__.py index 47b3a25a2289f..f76d571ef953e 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/__init__.py @@ -6,17 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import Operations -from ._workspaces_operations import WorkspacesOperations from ._usages_operations import UsagesOperations from ._virtual_machine_sizes_operations import VirtualMachineSizesOperations from ._quotas_operations import QuotasOperations from ._compute_operations import ComputeOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._workspace_connections_operations import WorkspaceConnectionsOperations -from ._managed_network_settings_rule_operations import ManagedNetworkSettingsRuleOperations -from ._managed_network_provisions_operations import ManagedNetworkProvisionsOperations from ._registries_operations import RegistriesOperations from ._workspace_features_operations import WorkspaceFeaturesOperations from ._registry_code_containers_operations import RegistryCodeContainersOperations @@ -54,19 +47,30 @@ from ._online_deployments_operations import OnlineDeploymentsOperations from ._schedules_operations import SchedulesOperations from ._serverless_endpoints_operations import ServerlessEndpointsOperations +from ._operations import Operations +from ._workspaces_operations import WorkspacesOperations +from ._workspace_connections_operations import WorkspaceConnectionsOperations +from ._connection_operations import ConnectionOperations +from ._connection_rai_blocklists_operations import ConnectionRaiBlocklistsOperations +from ._connection_rai_blocklist_operations import ConnectionRaiBlocklistOperations +from ._connection_rai_blocklist_item_operations import ConnectionRaiBlocklistItemOperations +from ._connection_rai_blocklist_items_operations import ConnectionRaiBlocklistItemsOperations +from ._connection_rai_policies_operations import ConnectionRaiPoliciesOperations +from ._connection_rai_policy_operations import ConnectionRaiPolicyOperations +from ._endpoint_deployment_operations import EndpointDeploymentOperations +from ._endpoint_operations import EndpointOperations +from ._rai_policies_operations import RaiPoliciesOperations +from ._rai_policy_operations import RaiPolicyOperations +from ._managed_network_settings_rule_operations import ManagedNetworkSettingsRuleOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._managed_network_provisions_operations import ManagedNetworkProvisionsOperations __all__ = [ - 'Operations', - 'WorkspacesOperations', 'UsagesOperations', 'VirtualMachineSizesOperations', 'QuotasOperations', 'ComputeOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'WorkspaceConnectionsOperations', - 'ManagedNetworkSettingsRuleOperations', - 'ManagedNetworkProvisionsOperations', 'RegistriesOperations', 'WorkspaceFeaturesOperations', 'RegistryCodeContainersOperations', @@ -104,4 +108,22 @@ 'OnlineDeploymentsOperations', 'SchedulesOperations', 'ServerlessEndpointsOperations', + 'Operations', + 'WorkspacesOperations', + 'WorkspaceConnectionsOperations', + 'ConnectionOperations', + 'ConnectionRaiBlocklistsOperations', + 'ConnectionRaiBlocklistOperations', + 'ConnectionRaiBlocklistItemOperations', + 'ConnectionRaiBlocklistItemsOperations', + 'ConnectionRaiPoliciesOperations', + 'ConnectionRaiPolicyOperations', + 'EndpointDeploymentOperations', + 'EndpointOperations', + 'RaiPoliciesOperations', + 'RaiPolicyOperations', + 'ManagedNetworkSettingsRuleOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ManagedNetworkProvisionsOperations', ] diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_compute_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_compute_operations.py index 561ce228b1288..3691676e7e7b2 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_compute_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_compute_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -21,11 +21,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._compute_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_keys_request, build_list_nodes_request, build_list_request, build_restart_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial +from ...operations._compute_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_allowed_resize_sizes_request, build_get_request, build_list_keys_request, build_list_nodes_request, build_list_request, build_resize_request_initial, build_restart_request_initial, build_start_request_initial, build_stop_request_initial, build_update_custom_services_request, build_update_data_mounts_request, build_update_idle_shutdown_setting_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ComputeOperations: +class ComputeOperations: # pylint: disable=too-many-public-methods """ComputeOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -594,6 +594,72 @@ def get_long_running_output(pipeline_response): begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}"} # type: ignore + @distributed_trace_async + async def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: List["_models.CustomService"], + **kwargs: Any + ) -> None: + """Updates the custom services list. The list of custom services provided shall be overwritten. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. + :type compute_name: str + :param custom_services: New list of Custom Services. + :type custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(custom_services, '[CustomService]') + + request = build_update_custom_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_custom_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + update_custom_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/customServices"} # type: ignore + + @distributed_trace def list_nodes( self, @@ -746,6 +812,74 @@ async def list_keys( list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listKeys"} # type: ignore + @distributed_trace_async + async def update_data_mounts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + data_mounts: List["_models.ComputeInstanceDataMount"], + **kwargs: Any + ) -> None: + """Update Data Mounts of a Machine Learning compute. + + Update Data Mounts of a Machine Learning compute. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. + :type compute_name: str + :param data_mounts: The parameters for creating or updating a machine learning workspace. + :type data_mounts: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceDataMount] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(data_mounts, '[ComputeInstanceDataMount]') + + request = build_update_data_mounts_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_data_mounts.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + update_data_mounts.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateDataMounts"} # type: ignore + + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, @@ -1075,3 +1209,257 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart"} # type: ignore + + @distributed_trace_async + async def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: "_models.IdleShutdownSetting", + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + :type parameters: ~azure.mgmt.machinelearningservices.models.IdleShutdownSetting + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IdleShutdownSetting') + + request = build_update_idle_shutdown_setting_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_idle_shutdown_setting.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + update_idle_shutdown_setting.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateIdleShutdownSetting"} # type: ignore + + + @distributed_trace_async + async def get_allowed_resize_sizes( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + **kwargs: Any + ) -> "_models.VirtualMachineSizeListResult": + """Returns supported virtual machine sizes for resize. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. + :type compute_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineSizeListResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.VirtualMachineSizeListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_allowed_resize_sizes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + api_version=api_version, + template_url=self.get_allowed_resize_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_allowed_resize_sizes.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/getAllowedVmSizesForResize"} # type: ignore + + + async def _resize_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: "_models.ResizeSchema", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ResizeSchema') + + request = build_resize_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._resize_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _resize_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/resize"} # type: ignore + + + @distributed_trace_async + async def begin_resize( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: "_models.ResizeSchema", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the size of a Compute Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. + :type compute_name: str + :param parameters: The object for updating VM size setting of specified Compute Instance. + :type parameters: ~azure.mgmt.machinelearningservices.models.ResizeSchema + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._resize_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resize.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/resize"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_operations.py new file mode 100644 index 0000000000000..ea14e6e7e1019 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_operations.py @@ -0,0 +1,630 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connection_operations import build_create_or_update_deployment_request_initial, build_delete_deployment_request_initial, build_get_deployment_request, build_get_models_request, build_list_deployments_request, build_list_models_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectionOperations: + """ConnectionOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_deployments( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult"]: + """Get all the deployments under the Azure OpenAI connection. + + Get all the deployments under the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_deployments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=self.list_deployments.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_deployments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments"} # type: ignore + + async def _delete_deployment_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_deployment_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_deployment_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_deployment_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete_deployment( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete Azure OpenAI connection deployment resource by name. + + Delete Azure OpenAI connection deployment resource by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param deployment_name: Name of the deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_deployment_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete_deployment.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}"} # type: ignore + + @distributed_trace_async + async def get_deployment( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.EndpointDeploymentResourcePropertiesBasicResource": + """Get deployments under the Azure OpenAI connection by name. + + Get deployments under the Azure OpenAI connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param deployment_name: Name of the deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointDeploymentResourcePropertiesBasicResource, or the result of cls(response) + :rtype: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_deployment_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_deployment.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_deployment.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}"} # type: ignore + + + async def _create_or_update_deployment_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + body: "_models.EndpointDeploymentResourcePropertiesBasicResource", + **kwargs: Any + ) -> "_models.EndpointDeploymentResourcePropertiesBasicResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'EndpointDeploymentResourcePropertiesBasicResource') + + request = build_create_or_update_deployment_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_deployment_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_deployment_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update_deployment( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + body: "_models.EndpointDeploymentResourcePropertiesBasicResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.EndpointDeploymentResourcePropertiesBasicResource"]: + """Create or update Azure OpenAI connection deployment resource with the specified parameters. + + Create or update Azure OpenAI connection deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param deployment_name: Name of the deployment resource. + :type deployment_name: str + :param body: deployment object. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_deployment_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update_deployment.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}"} # type: ignore + + @distributed_trace + def get_models( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EndpointModels"]: + """Get available models under the Azure OpenAI connection. + + Get available models under the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointModels or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EndpointModels] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointModels"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_models_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=self.get_models.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_models_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointModels", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + get_models.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/models"} # type: ignore + + @distributed_trace_async + async def list_models( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.EndpointModels": + """Get models under the Azure ML workspace for all Azure OpenAI connections that the user can + deploy. + + Get models under the Azure ML workspace for all Azure OpenAI connections that the user can + deploy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointModels, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointModels + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointModels"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_list_models_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list_models.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointModels', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_models.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listConnectionModels"} # type: ignore + diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_blocklist_item_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_blocklist_item_operations.py new file mode 100644 index 0000000000000..6b13c244c4ffe --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_blocklist_item_operations.py @@ -0,0 +1,676 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, Callable, Dict, List, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connection_rai_blocklist_item_operations import build_add_bulk_request_initial, build_create_request_initial, build_delete_bulk_request_initial, build_delete_request_initial, build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectionRaiBlocklistItemOperations: + """ConnectionRaiBlocklistItemOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _add_bulk_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: List["_models.RaiBlocklistItemBulkRequest"], + **kwargs: Any + ) -> Optional[List["_models.RaiBlocklistItemPropertiesBasicResource"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["_models.RaiBlocklistItemPropertiesBasicResource"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, '[RaiBlocklistItemBulkRequest]') + + request = build_add_bulk_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._add_bulk_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('[RaiBlocklistItemPropertiesBasicResource]', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _add_bulk_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/addRaiBlocklistItems"} # type: ignore + + + @distributed_trace_async + async def begin_add_bulk( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: List["_models.RaiBlocklistItemBulkRequest"], + **kwargs: Any + ) -> AsyncLROPoller[List["_models.RaiBlocklistItemPropertiesBasicResource"]]: + """Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :param body: Properties describing the custom blocklist items. + :type body: list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemBulkRequest] + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either list of + RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource]] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.RaiBlocklistItemPropertiesBasicResource"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._add_bulk_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('[RaiBlocklistItemPropertiesBasicResource]', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_add_bulk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/addRaiBlocklistItems"} # type: ignore + + async def _delete_bulk_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: Any, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'object') + + request = build_delete_bulk_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._delete_bulk_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_bulk_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/deleteRaiBlocklistItems"} # type: ignore + + + @distributed_trace_async + async def begin_delete_bulk( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: Any, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete multiple blocklist items from the specified blocklist associated with the Azure OpenAI + connection. + + Delete multiple blocklist items from the specified blocklist associated with the Azure OpenAI + connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :param body: List of RAI Blocklist Items Names. + :type body: any + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_bulk_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete_bulk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/deleteRaiBlocklistItems"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified custom blocklist item associated with the Azure OpenAI connection. + + Deletes the specified custom blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. + :type rai_blocklist_item_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + **kwargs: Any + ) -> "_models.RaiBlocklistItemPropertiesBasicResource": + """Gets the specified custom blocklist item associated with the Azure OpenAI connection. + + Gets the specified custom blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. + :type rai_blocklist_item_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklistItemPropertiesBasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistItemPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RaiBlocklistItemPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}"} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + body: "_models.RaiBlocklistItemPropertiesBasicResource", + **kwargs: Any + ) -> "_models.RaiBlocklistItemPropertiesBasicResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistItemPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'RaiBlocklistItemPropertiesBasicResource') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RaiBlocklistItemPropertiesBasicResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RaiBlocklistItemPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}"} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + body: "_models.RaiBlocklistItemPropertiesBasicResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.RaiBlocklistItemPropertiesBasicResource"]: + """Update the state of specified blocklist item associated with the Azure OpenAI connection. + + Update the state of specified blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. + :type rai_blocklist_item_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistItemPropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('RaiBlocklistItemPropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_blocklist_items_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_blocklist_items_operations.py new file mode 100644 index 0000000000000..39949a32ffff3 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_blocklist_items_operations.py @@ -0,0 +1,141 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connection_rai_blocklist_items_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectionRaiBlocklistItemsOperations: + """ConnectionRaiBlocklistItemsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult"]: + """Gets the custom blocklist items associated with the Azure OpenAI connection. + + Gets the custom blocklist items associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_blocklist_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_blocklist_operations.py new file mode 100644 index 0000000000000..54ecf567d397f --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_blocklist_operations.py @@ -0,0 +1,381 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connection_rai_blocklist_operations import build_create_request_initial, build_delete_request_initial, build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectionRaiBlocklistOperations: + """ConnectionRaiBlocklistOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified custom blocklist associated with the Azure OpenAI connection. + + Deletes the specified custom blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + **kwargs: Any + ) -> "_models.RaiBlocklistPropertiesBasicResource": + """Gets the specified custom blocklist associated with the Azure OpenAI connection. + + Gets the specified custom blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklistPropertiesBasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RaiBlocklistPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}"} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: "_models.RaiBlocklistPropertiesBasicResource", + **kwargs: Any + ) -> "_models.RaiBlocklistPropertiesBasicResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'RaiBlocklistPropertiesBasicResource') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RaiBlocklistPropertiesBasicResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RaiBlocklistPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}"} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: "_models.RaiBlocklistPropertiesBasicResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.RaiBlocklistPropertiesBasicResource"]: + """Update the state of specified blocklist associated with the Azure OpenAI connection. + + Update the state of specified blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RaiBlocklistPropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistPropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('RaiBlocklistPropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_blocklists_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_blocklists_operations.py new file mode 100644 index 0000000000000..66c9932ec6627 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_blocklists_operations.py @@ -0,0 +1,136 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connection_rai_blocklists_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectionRaiBlocklistsOperations: + """ConnectionRaiBlocklistsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.RaiBlocklistPropertiesBasicResourceArmPaginatedResult"]: + """Gets the custom blocklists associated with the Azure OpenAI connection. + + Gets the custom blocklists associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + RaiBlocklistPropertiesBasicResourceArmPaginatedResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistPropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RaiBlocklistPropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_policies_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_policies_operations.py new file mode 100644 index 0000000000000..b40980930cf82 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_policies_operations.py @@ -0,0 +1,136 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connection_rai_policies_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectionRaiPoliciesOperations: + """ConnectionRaiPoliciesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.RaiPolicyPropertiesBasicResourceArmPaginatedResult"]: + """List the specified Content Filters associated with the Azure OpenAI connection. + + List the specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RaiPolicyPropertiesBasicResourceArmPaginatedResult + or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RaiPolicyPropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_policy_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_policy_operations.py new file mode 100644 index 0000000000000..2e38e17b0e95b --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_connection_rai_policy_operations.py @@ -0,0 +1,381 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._connection_rai_policy_operations import build_create_request_initial, build_delete_request_initial, build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConnectionRaiPolicyOperations: + """ConnectionRaiPolicyOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified Content Filters associated with the Azure OpenAI connection. + + Deletes the specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. + :type rai_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + **kwargs: Any + ) -> "_models.RaiPolicyPropertiesBasicResource": + """Gets the specified Content Filters associated with the Azure OpenAI connection. + + Gets the specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. + :type rai_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiPolicyPropertiesBasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}"} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + body: "_models.RaiPolicyPropertiesBasicResource", + **kwargs: Any + ) -> "_models.RaiPolicyPropertiesBasicResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'RaiPolicyPropertiesBasicResource') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}"} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + body: "_models.RaiPolicyPropertiesBasicResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.RaiPolicyPropertiesBasicResource"]: + """Update the state of specified Content Filters associated with the Azure OpenAI connection. + + Update the state of specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. + :type rai_policy_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RaiPolicyPropertiesBasicResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_endpoint_deployment_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_endpoint_deployment_operations.py new file mode 100644 index 0000000000000..247ac35515774 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_endpoint_deployment_operations.py @@ -0,0 +1,578 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._endpoint_deployment_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_in_workspace_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EndpointDeploymentOperations: + """EndpointDeploymentOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_in_workspace( + self, + resource_group_name: str, + workspace_name: str, + endpoint_type: Optional[Union[str, "_models.EndpointType"]] = None, + skip: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult"]: + """Get all the deployments under the workspace scope. + + Get all the deployments under the workspace scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_type: Endpoint type filter. + :type endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :param skip: Continuation token for pagination. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_in_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + endpoint_type=endpoint_type, + skip=skip, + template_url=self.get_in_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_in_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + endpoint_type=endpoint_type, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + get_in_workspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/deployments"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult"]: + """Get all the deployments under the endpoint resource scope. + + Get all the deployments under the endpoint resource scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete endpoint deployment resource by name. + + Delete endpoint deployment resource by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.EndpointDeploymentResourcePropertiesBasicResource": + """Get deployments under endpoint resource by name. + + Get deployments under endpoint resource by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointDeploymentResourcePropertiesBasicResource, or the result of cls(response) + :rtype: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + body: "_models.EndpointDeploymentResourcePropertiesBasicResource", + **kwargs: Any + ) -> Optional["_models.EndpointDeploymentResourcePropertiesBasicResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.EndpointDeploymentResourcePropertiesBasicResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'EndpointDeploymentResourcePropertiesBasicResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + body: "_models.EndpointDeploymentResourcePropertiesBasicResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.EndpointDeploymentResourcePropertiesBasicResource"]: + """Create or update endpoint deployment resource with the specified parameters. + + Create or update endpoint deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. + :type deployment_name: str + :param body: deployment object. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_endpoint_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_endpoint_operations.py new file mode 100644 index 0000000000000..4c6a87093251e --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_endpoint_operations.py @@ -0,0 +1,587 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._endpoint_operations import build_create_or_update_request_initial, build_get_models_request, build_get_request, build_list_keys_request, build_list_request, build_regenerate_keys_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EndpointOperations: + """EndpointOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + endpoint_type: Optional[Union[str, "_models.EndpointType"]] = None, + include_inference_endpoints: Optional[bool] = False, + skip: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EndpointResourcePropertiesBasicResourceArmPaginatedResult"]: + """List All the endpoints under this workspace. + + List All the endpoints under this workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_type: Endpoint type filter. + :type endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :param include_inference_endpoints: + :type include_inference_endpoints: bool + :param skip: Continuation token for pagination. + :type skip: str + :param expand: Whether the endpoint resource will be expand to include deployment information, + e.g. $expand=deployments. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + EndpointResourcePropertiesBasicResourceArmPaginatedResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointResourcePropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + endpoint_type=endpoint_type, + include_inference_endpoints=include_inference_endpoints, + skip=skip, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + endpoint_type=endpoint_type, + include_inference_endpoints=include_inference_endpoints, + skip=skip, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointResourcePropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + **kwargs: Any + ) -> "_models.EndpointResourcePropertiesBasicResource": + """Gets endpoint resource. + + Gets endpoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointResourcePropertiesBasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointResourcePropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointResourcePropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: "_models.EndpointResourcePropertiesBasicResource", + **kwargs: Any + ) -> Optional["_models.EndpointResourcePropertiesBasicResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.EndpointResourcePropertiesBasicResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'EndpointResourcePropertiesBasicResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('EndpointResourcePropertiesBasicResource', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: "_models.EndpointResourcePropertiesBasicResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.EndpointResourcePropertiesBasicResource"]: + """Create or update endpoint resource with the specified parameters. + + Create or update endpoint resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param body: Endpoint resource object. + :type body: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + EndpointResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointResourcePropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EndpointResourcePropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}"} # type: ignore + + @distributed_trace_async + async def list_keys( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + **kwargs: Any + ) -> "_models.EndpointKeys": + """List keys for the endpoint resource. + + List keys for the endpoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointKeys, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_list_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/listKeys"} # type: ignore + + + @distributed_trace + def get_models( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EndpointModels"]: + """Get available models under the endpoint resource. + + Get available models under the endpoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointModels or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EndpointModels] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointModels"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_models_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.get_models.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_models_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointModels", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + get_models.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/models"} # type: ignore + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: "_models.RegenerateServiceAccountKeyContent", + **kwargs: Any + ) -> "_models.AccountApiKeys": + """Regenerate account keys. + + Regenerate account keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateServiceAccountKeyContent + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountApiKeys, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.AccountApiKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountApiKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'RegenerateServiceAccountKeyContent') + + request = build_regenerate_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccountApiKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/regenerateKey"} # type: ignore + diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_managed_network_provisions_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_managed_network_provisions_operations.py index c61fbe9d8c07a..d4fd6423c1349 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_managed_network_provisions_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_managed_network_provisions_operations.py @@ -121,7 +121,7 @@ async def begin_provision_managed_network( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param body: Managed Network Provisioning Options for a machine learning workspace. :type body: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionOptions diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_managed_network_settings_rule_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_managed_network_settings_rule_operations.py index 739788e95573d..01a0417f8cd60 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_managed_network_settings_rule_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_managed_network_settings_rule_operations.py @@ -60,7 +60,7 @@ def list( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OutboundRuleListResult or the result of @@ -174,6 +174,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if cls: @@ -196,7 +197,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param rule_name: Name of the workspace managed network outbound rule. :type rule_name: str @@ -236,7 +237,7 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -264,7 +265,7 @@ async def get( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param rule_name: Name of the workspace managed network outbound rule. :type rule_name: str @@ -391,7 +392,7 @@ async def begin_create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param rule_name: Name of the workspace managed network outbound rule. :type rule_name: str diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_operations.py index 70dfd2a4566e6..e4e8310a76364 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_operations.py @@ -51,6 +51,8 @@ def list( ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Azure Machine Learning Workspaces REST API operations. + Lists all of the available Azure Machine Learning Workspaces REST API operations. + :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) :rtype: diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_private_endpoint_connections_operations.py index 358e14512204b..2035b8d78ae32 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -52,11 +52,13 @@ def list( workspace_name: str, **kwargs: Any ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: - """List all the private endpoint connections associated with the workspace. + """Called by end-users to get all PE connections. + + Called by end-users to get all PE connections. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result @@ -76,9 +78,9 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, - subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], ) @@ -88,9 +90,9 @@ def prepare_request(next_link=None): else: request = build_list_request( + subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, - subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, ) @@ -130,28 +132,29 @@ async def get_next(next_link=None): list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async - async def get( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": - """Gets the specified private endpoint connection associated with the workspace. + ) -> None: + """Called by end-users to delete a PE connection. + + Called by end-users to delete a PE connection. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection + :return: None, or the result of cls(response) + :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -160,13 +163,13 @@ async def get( api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - request = build_get_request( + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -178,41 +181,35 @@ async def get( ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, None, {}) - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def create_or_update( + async def get( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", **kwargs: Any ) -> "_models.PrivateEndpointConnection": - """Update the state of specified private endpoint connection associated with the workspace. + """Called by end-users to get a PE connection. + + Called by end-users to get a PE connection. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. - :type properties: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection @@ -225,19 +222,15 @@ async def create_or_update( error_map.update(kwargs.pop('error_map', {})) api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(properties, 'PrivateEndpointConnection') - request = build_create_or_update_request( + + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.create_or_update.metadata['url'], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -261,47 +254,57 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def create_or_update( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, + body: "_models.PrivateEndpointConnection", **kwargs: Any - ) -> None: - """Deletes the specified private endpoint connection associated with the workspace. + ) -> "_models.PrivateEndpointConnection": + """Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. + + Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. :type private_endpoint_connection_name: str + :param body: PrivateEndpointConnection object. + :type body: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - request = build_delete_request( + _json = self._serialize.body(body, 'PrivateEndpointConnection') + + request = build_create_or_update_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - template_url=self.delete.metadata['url'], + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -313,13 +316,17 @@ async def delete( # pylint: disable=inconsistent-return-statements ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_private_link_resources_operations.py index f29ce05c47ba5..17db461c3c33a 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_private_link_resources_operations.py @@ -6,13 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -43,61 +44,100 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async - async def list( + @distributed_trace + def list( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": - """Gets the private link resources that need to be created for a workspace. + ) -> AsyncIterable["_models.PrivateLinkResourceListResult"]: + """Called by Client (Portal, CLI, etc) to get available "private link resources" for the + workspace. + Each "private link resource" is a connection endpoint (IP address) to the resource. + Pre single connection endpoint per workspace: the Data Plane IP address, returned by DNS + resolution. + Other RPs, such as Azure Storage, have multiple - one for Blobs, other for Queues, etc. + Defined in the "[NRP] Private Endpoint Design" doc, topic "GET API for GroupIds". + + Called by Client (Portal, CLI, etc) to get available "private link resources" for the + workspace. + Each "private link resource" is a connection endpoint (IP address) to the resource. + Pre single connection endpoint per workspace: the Data Plane IP address, returned by DNS + resolution. + Other RPs, such as Azure Storage, have multiple - one for Blobs, other for Queues, etc. + Defined in the "[NRP] Private Endpoint Design" doc, topic "GET API for GroupIds". :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourceListResult, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.PrivateLinkResourceListResult + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateLinkResources"} # type: ignore - diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_rai_policies_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_rai_policies_operations.py new file mode 100644 index 0000000000000..44271a03b1371 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_rai_policies_operations.py @@ -0,0 +1,136 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._rai_policies_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RaiPoliciesOperations: + """RaiPoliciesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.RaiPolicyPropertiesBasicResourceArmPaginatedResult"]: + """List the specified Content Filters associated with the Azure OpenAI account. + + List the specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RaiPolicyPropertiesBasicResourceArmPaginatedResult + or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RaiPolicyPropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_rai_policy_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_rai_policy_operations.py new file mode 100644 index 0000000000000..1438481d65565 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_rai_policy_operations.py @@ -0,0 +1,381 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._rai_policy_operations import build_create_request_initial, build_delete_request_initial, build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RaiPolicyOperations: + """RaiPolicyOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified Content Filters associated with the Azure OpenAI account. + + Deletes the specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. + :type rai_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + **kwargs: Any + ) -> "_models.RaiPolicyPropertiesBasicResource": + """Gets the specified Content Filters associated with the Azure OpenAI account. + + Gets the specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. + :type rai_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiPolicyPropertiesBasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}"} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + body: "_models.RaiPolicyPropertiesBasicResource", + **kwargs: Any + ) -> "_models.RaiPolicyPropertiesBasicResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'RaiPolicyPropertiesBasicResource') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}"} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + body: "_models.RaiPolicyPropertiesBasicResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.RaiPolicyPropertiesBasicResource"]: + """Update the state of specified Content Filters associated with the Azure OpenAI account. + + Update the state of specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. + :type rai_policy_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RaiPolicyPropertiesBasicResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_workspace_connections_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_workspace_connections_operations.py index 69db6572d8bc6..66b0d50130c3c 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_workspace_connections_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_workspace_connections_operations.py @@ -6,20 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._workspace_connections_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_list_secrets_request +from ...operations._workspace_connections_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_list_secrets_request, build_test_connection_request_initial, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,51 +47,147 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: Optional[bool] = False, + **kwargs: Any + ) -> AsyncIterable["_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult"]: + """Lists all the available machine learning workspaces connections under the specified workspace. + + Lists all the available machine learning workspaces connections under the specified workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param target: Target of the workspace connection. + :type target: str + :param category: Category of the workspace connection. + :type category: str + :param include_all: query parameter that indicates if get connection call should return both + connections and datastores. + :type include_all: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + target=target, + category=category, + include_all=include_all, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + target=target, + category=category, + include_all=include_all, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections"} # type: ignore + @distributed_trace_async - async def create( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, connection_name: str, - parameters: "_models.WorkspaceConnectionPropertiesV2BasicResource", **kwargs: Any - ) -> "_models.WorkspaceConnectionPropertiesV2BasicResource": - """create. + ) -> None: + """Delete machine learning workspaces connections by name. + + Delete machine learning workspaces connections by name. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. :type connection_name: str - :param parameters: The object for creating or updating a new workspace connection. - :type parameters: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkspaceConnectionPropertiesV2BasicResource, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :return: None, or the result of cls(response) + :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceConnectionPropertiesV2BasicResource"] + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'WorkspaceConnectionPropertiesV2BasicResource') - request = build_create_request( + + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, connection_name=connection_name, api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.create.metadata['url'], + template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -101,19 +199,15 @@ async def create( ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('WorkspaceConnectionPropertiesV2BasicResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, None, {}) - create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}"} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}"} # type: ignore @distributed_trace_async @@ -124,11 +218,13 @@ async def get( connection_name: str, **kwargs: Any ) -> "_models.WorkspaceConnectionPropertiesV2BasicResource": - """get. + """Lists machine learning workspaces connections by name. + + Lists machine learning workspaces connections by name. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. :type connection_name: str @@ -180,42 +276,54 @@ async def get( @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def update( self, resource_group_name: str, workspace_name: str, connection_name: str, + body: Optional["_models.WorkspaceConnectionUpdateParameter"] = None, **kwargs: Any - ) -> None: - """delete. + ) -> "_models.WorkspaceConnectionPropertiesV2BasicResource": + """Update machine learning workspaces connections under the specified workspace. + + Update machine learning workspaces connections under the specified workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. :type connection_name: str + :param body: Parameters for workspace connection update. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUpdateParameter :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None + :return: WorkspaceConnectionPropertiesV2BasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceConnectionPropertiesV2BasicResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - request = build_delete_request( + if body is not None: + _json = self._serialize.body(body, 'WorkspaceConnectionUpdateParameter') + else: + _json = None + + request = build_update_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, connection_name=connection_name, api_version=api_version, - template_url=self.delete.metadata['url'], + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -227,110 +335,96 @@ async def delete( # pylint: disable=inconsistent-return-statements ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize('WorkspaceConnectionPropertiesV2BasicResource', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}"} # type: ignore + return deserialized + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}"} # type: ignore - @distributed_trace - def list( + + @distributed_trace_async + async def create( self, resource_group_name: str, workspace_name: str, - target: Optional[str] = None, - category: Optional[str] = None, + connection_name: str, + body: Optional["_models.WorkspaceConnectionPropertiesV2BasicResource"] = None, **kwargs: Any - ) -> AsyncIterable["_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult"]: - """list. + ) -> "_models.WorkspaceConnectionPropertiesV2BasicResource": + """Create or update machine learning workspaces connections under the specified workspace. + + Create or update machine learning workspaces connections under the specified workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param target: Target of the workspace connection. - :type target: str - :param category: Category of the workspace connection. - :type category: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param body: The object for creating or updating a new workspace connection. + :type body: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either - WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult] + :return: WorkspaceConnectionPropertiesV2BasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceConnectionPropertiesV2BasicResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - target=target, - category=category, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - target=target, - category=category, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) + if body is not None: + _json = self._serialize.body(body, 'WorkspaceConnectionPropertiesV2BasicResource') + else: + _json = None - async def get_next(next_link=None): - request = prepare_request(next_link) + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return pipeline_response + deserialized = self._deserialize('WorkspaceConnectionPropertiesV2BasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}"} # type: ignore - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections"} # type: ignore @distributed_trace_async async def list_secrets( @@ -346,7 +440,7 @@ async def list_secrets( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. :type connection_name: str @@ -396,3 +490,135 @@ async def list_secrets( list_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/listsecrets"} # type: ignore + + async def _test_connection_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional["_models.WorkspaceConnectionPropertiesV2BasicResource"] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'WorkspaceConnectionPropertiesV2BasicResource') + else: + _json = None + + request = build_test_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._test_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _test_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/testconnection"} # type: ignore + + + @distributed_trace_async + async def begin_test_connection( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional["_models.WorkspaceConnectionPropertiesV2BasicResource"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Test machine learning workspaces connections under the specified workspace. + + Test machine learning workspaces connections under the specified workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param body: Workspace Connection object. + :type body: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._test_connection_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/testconnection"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_workspaces_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_workspaces_operations.py index 8e2375ff751ba..f5ed073829520 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_workspaces_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/aio/operations/_workspaces_operations.py @@ -47,196 +47,190 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async - async def get( + @distributed_trace + def list_by_subscription( self, - resource_group_name: str, - workspace_name: str, + kind: Optional[str] = None, + skip: Optional[str] = None, + ai_capabilities: Optional[str] = None, **kwargs: Any - ) -> "_models.Workspace": - """Gets the properties of the specified machine learning workspace. + ) -> AsyncIterable["_models.WorkspaceListResult"]: + """Lists all the available machine learning workspaces under the specified subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. - :type workspace_name: str + Lists all the available machine learning workspaces under the specified subscription. + + :param kind: Kind of workspace. + :type kind: str + :param skip: Continuation token for pagination. + :type skip: str + :param ai_capabilities: + :type ai_capabilities: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Workspace, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.Workspace + :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Workspace', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - workspace_name: str, - parameters: "_models.Workspace", - **kwargs: Any - ) -> Optional["_models.Workspace"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Workspace"]] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'Workspace') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize('Workspace', pipeline_response) + async def get_next(next_link=None): + request = prepare_request(next_link) - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, response_headers) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized + return pipeline_response - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces"} # type: ignore - @distributed_trace_async - async def begin_create_or_update( + @distributed_trace + def list_by_resource_group( self, resource_group_name: str, - workspace_name: str, - parameters: "_models.Workspace", + kind: Optional[str] = None, + skip: Optional[str] = None, + ai_capabilities: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller["_models.Workspace"]: - """Creates or updates a workspace with the specified parameters. + ) -> AsyncIterable["_models.WorkspaceListResult"]: + """Lists all the available machine learning workspaces under the specified resource group. + + Lists all the available machine learning workspaces under the specified resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. - :type workspace_name: str - :param parameters: The parameters for creating or updating a machine learning workspace. - :type parameters: ~azure.mgmt.machinelearningservices.models.Workspace + :param kind: Kind of workspace. + :type kind: str + :param skip: Continuation token for pagination. + :type skip: str + :param ai_capabilities: + :type ai_capabilities: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Workspace or the result of - cls(response) + :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Workspace] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Workspace', pipeline_response) + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + async def get_next(next_link=None): + request = prepare_request(next_link) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + response = pipeline_response.http_response - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -276,8 +270,14 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore @@ -292,9 +292,11 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements ) -> AsyncLROPoller[None]: """Deletes a machine learning workspace. + Deletes a machine learning workspace. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param force_to_purge: Flag to indicate delete is a purge request. :type force_to_purge: bool @@ -334,7 +336,7 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -348,11 +350,72 @@ def get_long_running_output(pipeline_response): begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.Workspace": + """Gets the properties of the specified machine learning workspace. + + Gets the properties of the specified machine learning workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore + + async def _update_initial( self, resource_group_name: str, workspace_name: str, - parameters: "_models.WorkspaceUpdateParameters", + body: "_models.WorkspaceUpdateParameters", **kwargs: Any ) -> Optional["_models.Workspace"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Workspace"]] @@ -364,7 +427,7 @@ async def _update_initial( api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(parameters, 'WorkspaceUpdateParameters') + _json = self._serialize.body(body, 'WorkspaceUpdateParameters') request = build_update_request_initial( subscription_id=self._config.subscription_id, @@ -390,17 +453,11 @@ async def _update_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - response_headers = {} if response.status_code == 200: deserialized = self._deserialize('Workspace', pipeline_response) - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - - if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, {}) return deserialized @@ -412,17 +469,19 @@ async def begin_update( self, resource_group_name: str, workspace_name: str, - parameters: "_models.WorkspaceUpdateParameters", + body: "_models.WorkspaceUpdateParameters", **kwargs: Any ) -> AsyncLROPoller["_models.Workspace"]: """Updates a machine learning workspace with the specified parameters. + Updates a machine learning workspace with the specified parameters. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param parameters: The parameters for updating a machine learning workspace. - :type parameters: ~azure.mgmt.machinelearningservices.models.WorkspaceUpdateParameters + :param body: The parameters for updating a machine learning workspace. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -450,7 +509,7 @@ async def begin_update( raw_result = await self._update_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, - parameters=parameters, + body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, @@ -480,94 +539,145 @@ def get_long_running_output(pipeline_response): begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore - @distributed_trace - def list_by_resource_group( + async def _create_or_update_initial( self, resource_group_name: str, - skip: Optional[str] = None, + workspace_name: str, + body: "_models.Workspace", **kwargs: Any - ) -> AsyncIterable["_models.WorkspaceListResult"]: - """Lists all the available machine learning workspaces under the specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param skip: Continuation token for pagination. - :type skip: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] + ) -> Optional["_models.Workspace"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Workspace"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - skip=skip, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - skip=skip, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'Workspace') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('Workspace', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkspaceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore - async def get_next(next_link=None): - request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + body: "_models.Workspace", + **kwargs: Any + ) -> AsyncLROPoller["_models.Workspace"]: + """Creates or updates a workspace with the specified parameters. + + Creates or updates a workspace with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param body: The parameters for creating or updating a machine learning workspace. + :type body: ~azure.mgmt.machinelearningservices.models.Workspace + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Workspace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Workspace] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, **kwargs ) - response = pipeline_response.http_response + kwargs.pop('error_map', None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Workspace', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized - return pipeline_response + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces"} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore async def _diagnose_initial( self, resource_group_name: str, workspace_name: str, - parameters: Optional["_models.DiagnoseWorkspaceParameters"] = None, + body: Optional["_models.DiagnoseWorkspaceParameters"] = None, **kwargs: Any ) -> Optional["_models.DiagnoseResponseResult"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DiagnoseResponseResult"]] @@ -579,8 +689,8 @@ async def _diagnose_initial( api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - if parameters is not None: - _json = self._serialize.body(parameters, 'DiagnoseWorkspaceParameters') + if body is not None: + _json = self._serialize.body(body, 'DiagnoseWorkspaceParameters') else: _json = None @@ -630,7 +740,7 @@ async def begin_diagnose( self, resource_group_name: str, workspace_name: str, - parameters: Optional["_models.DiagnoseWorkspaceParameters"] = None, + body: Optional["_models.DiagnoseWorkspaceParameters"] = None, **kwargs: Any ) -> AsyncLROPoller["_models.DiagnoseResponseResult"]: """Diagnose workspace setup issue. @@ -639,10 +749,10 @@ async def begin_diagnose( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param parameters: The parameter of diagnosing workspace health. - :type parameters: ~azure.mgmt.machinelearningservices.models.DiagnoseWorkspaceParameters + :param body: The parameter of diagnosing workspace health. + :type body: ~azure.mgmt.machinelearningservices.models.DiagnoseWorkspaceParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -670,7 +780,7 @@ async def begin_diagnose( raw_result = await self._diagnose_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, - parameters=parameters, + body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, @@ -710,9 +820,12 @@ async def list_keys( """Lists all the keys associated with this workspace. This includes keys for the storage account, app insights and password for container registry. + Lists all the keys associated with this workspace. This includes keys for the storage account, + app insights and password for container registry. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListWorkspaceKeysResult, or the result of cls(response) @@ -760,13 +873,27 @@ async def list_keys( list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listKeys"} # type: ignore - async def _resync_keys_initial( # pylint: disable=inconsistent-return-statements + @distributed_trace_async + async def list_notebook_access_token( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] + ) -> "_models.NotebookAccessTokenResult": + """Get Azure Machine Learning Workspace notebook access token. + + Get Azure Machine Learning Workspace notebook access token. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NotebookAccessTokenResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.NotebookAccessTokenResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookAccessTokenResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -775,12 +902,12 @@ async def _resync_keys_initial( # pylint: disable=inconsistent-return-statement api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - request = build_resync_keys_request_initial( + request = build_list_notebook_access_token_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, api_version=api_version, - template_url=self._resync_keys_initial.metadata['url'], + template_url=self.list_notebook_access_token.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -792,182 +919,166 @@ async def _resync_keys_initial( # pylint: disable=inconsistent-return-statement ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - + deserialized = self._deserialize('NotebookAccessTokenResult', pipeline_response) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, {}) - _resync_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys"} # type: ignore + return deserialized + + list_notebook_access_token.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken"} # type: ignore @distributed_trace_async - async def begin_resync_keys( # pylint: disable=inconsistent-return-statements + async def list_notebook_keys( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Resync all the keys associated with this workspace. This includes keys for the storage account, - app insights and password for container registry. + ) -> "_models.ListNotebookKeysResult": + """Lists keys of Azure Machine Learning Workspaces notebook. + + Lists keys of Azure Machine Learning Workspaces notebook. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: ListNotebookKeysResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListNotebookKeysResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + + + request = build_list_notebook_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list_notebook_keys.metadata['url'], ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._resync_keys_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + deserialized = self._deserialize('ListNotebookKeysResult', pipeline_response) - begin_resync_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys"} # type: ignore + if cls: + return cls(pipeline_response, deserialized, {}) - @distributed_trace - def list_by_subscription( + return deserialized + + list_notebook_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys"} # type: ignore + + + @distributed_trace_async + async def list_storage_account_keys( self, - skip: Optional[str] = None, + resource_group_name: str, + workspace_name: str, **kwargs: Any - ) -> AsyncIterable["_models.WorkspaceListResult"]: - """Lists all the available machine learning workspaces under the specified subscription. + ) -> "_models.ListStorageAccountKeysResult": + """Lists keys of Azure Machine Learning Workspace's storage account. - :param skip: Continuation token for pagination. - :type skip: str + Lists keys of Azure Machine Learning Workspace's storage account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceListResult] + :return: ListStorageAccountKeysResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ListStorageAccountKeysResult :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListStorageAccountKeysResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + } + error_map.update(kwargs.pop('error_map', {})) - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkspaceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - async def get_next(next_link=None): - request = prepare_request(next_link) + + request = build_list_storage_account_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list_storage_account_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return pipeline_response + deserialized = self._deserialize('ListStorageAccountKeysResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_storage_account_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys"} # type: ignore - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces"} # type: ignore @distributed_trace_async - async def list_notebook_access_token( + async def list_outbound_network_dependencies_endpoints( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> "_models.NotebookAccessTokenResult": - """return notebook access token and refresh token. + ) -> "_models.ExternalFQDNResponse": + """Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) + programmatically. + + Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) + programmatically. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NotebookAccessTokenResult, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.NotebookAccessTokenResult + :return: ExternalFQDNResponse, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ExternalFQDNResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookAccessTokenResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExternalFQDNResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -976,12 +1087,12 @@ async def list_notebook_access_token( api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - request = build_list_notebook_access_token_request( + request = build_list_outbound_network_dependencies_endpoints_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, api_version=api_version, - template_url=self.list_notebook_access_token.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -998,14 +1109,14 @@ async def list_notebook_access_token( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NotebookAccessTokenResult', pipeline_response) + deserialized = self._deserialize('ExternalFQDNResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_notebook_access_token.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints"} # type: ignore async def _prepare_notebook_initial( @@ -1069,11 +1180,13 @@ async def begin_prepare_notebook( workspace_name: str, **kwargs: Any ) -> AsyncLROPoller["_models.NotebookResourceInfo"]: - """Prepare a notebook. + """Prepare Azure Machine Learning Workspace's notebook resource. + + Prepare Azure Machine Learning Workspace's notebook resource. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1129,84 +1242,13 @@ def get_long_running_output(pipeline_response): begin_prepare_notebook.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook"} # type: ignore - @distributed_trace_async - async def list_storage_account_keys( - self, - resource_group_name: str, - workspace_name: str, - **kwargs: Any - ) -> "_models.ListStorageAccountKeysResult": - """List storage account keys of a workspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. - :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListStorageAccountKeysResult, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.ListStorageAccountKeysResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListStorageAccountKeysResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - - request = build_list_storage_account_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - template_url=self.list_storage_account_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ListStorageAccountKeysResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_storage_account_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys"} # type: ignore - - - @distributed_trace_async - async def list_notebook_keys( + async def _resync_keys_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> "_models.ListNotebookKeysResult": - """List keys of a notebook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. - :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListNotebookKeysResult, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListNotebookKeysResult"] + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1215,12 +1257,12 @@ async def list_notebook_keys( api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - request = build_list_notebook_keys_request( + request = build_resync_keys_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, api_version=api_version, - template_url=self.list_notebook_keys.metadata['url'], + template_url=self._resync_keys_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -1232,80 +1274,84 @@ async def list_notebook_keys( ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ListNotebookKeysResult', pipeline_response) + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, None, response_headers) - list_notebook_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys"} # type: ignore + _resync_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys"} # type: ignore @distributed_trace_async - async def list_outbound_network_dependencies_endpoints( + async def begin_resync_keys( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> "_models.ExternalFQDNResponse": - """Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) - programmatically. + ) -> AsyncLROPoller[None]: + """Resync all the keys associated with this workspace.This includes keys for the storage account, + app insights and password for container registry. - Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) - programmatically. + Resync all the keys associated with this workspace.This includes keys for the storage account, + app insights and password for container registry. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ExternalFQDNResponse, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.ExternalFQDNResponse + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ExternalFQDNResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ExternalFQDNResponse', pipeline_response) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._resync_keys_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) - if cls: - return cls(pipeline_response, deserialized, {}) + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - return deserialized - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resync_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/__init__.py index 0e4430016433d..b60ce93270b20 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/__init__.py @@ -12,6 +12,7 @@ from ._models_py3 import AKSSchema from ._models_py3 import AKSSchemaProperties from ._models_py3 import AccessKeyAuthTypeWorkspaceConnectionProperties + from ._models_py3 import AccountApiKeys from ._models_py3 import AccountKeyAuthTypeWorkspaceConnectionProperties from ._models_py3 import AccountKeyDatastoreCredentials from ._models_py3 import AccountKeyDatastoreSecrets @@ -68,6 +69,7 @@ from ._models_py3 import BindOptions from ._models_py3 import BlobReferenceForConsumptionDto from ._models_py3 import BuildContext + from ._models_py3 import CapacityConfig from ._models_py3 import CategoricalDataDriftMetricThreshold from ._models_py3 import CategoricalDataQualityMetricThreshold from ._models_py3 import CategoricalPredictionDriftMetricThreshold @@ -83,6 +85,8 @@ from ._models_py3 import CodeVersion from ._models_py3 import CodeVersionProperties from ._models_py3 import CodeVersionResourceArmPaginatedResult + from ._models_py3 import CognitiveServiceEndpointDeploymentResourceProperties + from ._models_py3 import CognitiveServicesSku from ._models_py3 import Collection from ._models_py3 import ColumnTransformer from ._models_py3 import CommandJob @@ -96,6 +100,7 @@ from ._models_py3 import Compute from ._models_py3 import ComputeInstance from ._models_py3 import ComputeInstanceApplication + from ._models_py3 import ComputeInstanceAutologgerSettings from ._models_py3 import ComputeInstanceConnectivityEndpoints from ._models_py3 import ComputeInstanceContainer from ._models_py3 import ComputeInstanceCreatedBy @@ -117,6 +122,8 @@ from ._models_py3 import ContainerResourceRequirements from ._models_py3 import ContainerResourceSettings from ._models_py3 import ContentSafety + from ._models_py3 import ContentSafetyEndpointDeploymentResourceProperties + from ._models_py3 import ContentSafetyEndpointResourceProperties from ._models_py3 import CosmosDbSettings from ._models_py3 import CreateMonitorAction from ._models_py3 import Cron @@ -174,15 +181,30 @@ from ._models_py3 import Docker from ._models_py3 import DockerCredential from ._models_py3 import EarlyTerminationPolicy - from ._models_py3 import EncryptionKeyVaultProperties from ._models_py3 import EncryptionKeyVaultUpdateProperties from ._models_py3 import EncryptionProperty from ._models_py3 import EncryptionUpdateProperties from ._models_py3 import Endpoint from ._models_py3 import EndpointAuthKeys from ._models_py3 import EndpointAuthToken + from ._models_py3 import EndpointDeploymentModel from ._models_py3 import EndpointDeploymentPropertiesBase + from ._models_py3 import EndpointDeploymentResourceProperties + from ._models_py3 import EndpointDeploymentResourcePropertiesBasicResource + from ._models_py3 import EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult + from ._models_py3 import EndpointKeys + from ._models_py3 import EndpointModelDeprecationProperties + from ._models_py3 import EndpointModelProperties + from ._models_py3 import EndpointModelSkuCapacityProperties + from ._models_py3 import EndpointModelSkuProperties + from ._models_py3 import EndpointModelSkuRateLimitProperties + from ._models_py3 import EndpointModelSkuRateLimitRulePatternProperties + from ._models_py3 import EndpointModelSkuRateLimitRuleProperties + from ._models_py3 import EndpointModels from ._models_py3 import EndpointPropertiesBase + from ._models_py3 import EndpointResourceProperties + from ._models_py3 import EndpointResourcePropertiesBasicResource + from ._models_py3 import EndpointResourcePropertiesBasicResourceArmPaginatedResult from ._models_py3 import EndpointScheduleAction from ._models_py3 import EnvironmentContainer from ._models_py3 import EnvironmentContainerProperties @@ -200,7 +222,7 @@ from ._models_py3 import FQDNEndpoint from ._models_py3 import FQDNEndpointDetail from ._models_py3 import FQDNEndpoints - from ._models_py3 import FQDNEndpointsProperties + from ._models_py3 import FQDNEndpointsPropertyBag from ._models_py3 import Feature from ._models_py3 import FeatureAttributionDriftMonitoringSignal from ._models_py3 import FeatureAttributionMetricThreshold @@ -274,6 +296,8 @@ from ._models_py3 import JobResourceConfiguration from ._models_py3 import JobScheduleAction from ._models_py3 import JobService + from ._models_py3 import JupyterKernelConfig + from ._models_py3 import KeyVaultProperties from ._models_py3 import Kubernetes from ._models_py3 import KubernetesOnlineDeployment from ._models_py3 import KubernetesProperties @@ -299,6 +323,10 @@ from ._models_py3 import ManagedNetworkProvisionStatus from ._models_py3 import ManagedNetworkSettings from ._models_py3 import ManagedOnlineDeployment + from ._models_py3 import ManagedOnlineEndpointDeploymentResourceProperties + from ._models_py3 import ManagedOnlineEndpointResourceProperties + from ._models_py3 import ManagedResourceGroupAssignedIdentities + from ._models_py3 import ManagedResourceGroupSettings from ._models_py3 import ManagedServiceIdentity from ._models_py3 import MarketplacePlan from ._models_py3 import MarketplaceSubscription @@ -353,9 +381,12 @@ from ._models_py3 import OnlineEndpointTrackedResourceArmPaginatedResult from ._models_py3 import OnlineRequestSettings from ._models_py3 import OnlineScaleSettings + from ._models_py3 import OpenAIEndpointDeploymentResourceProperties + from ._models_py3 import OpenAIEndpointResourceProperties from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult + from ._models_py3 import OsPatchingStatus from ._models_py3 import OutboundRule from ._models_py3 import OutboundRuleBasicResource from ._models_py3 import OutboundRuleListResult @@ -394,11 +425,24 @@ from ._models_py3 import QueueSettings from ._models_py3 import QuotaBaseProperties from ._models_py3 import QuotaUpdateParameters + from ._models_py3 import RaiBlocklistConfig + from ._models_py3 import RaiBlocklistItemBulkRequest + from ._models_py3 import RaiBlocklistItemProperties + from ._models_py3 import RaiBlocklistItemPropertiesBasicResource + from ._models_py3 import RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult + from ._models_py3 import RaiBlocklistProperties + from ._models_py3 import RaiBlocklistPropertiesBasicResource + from ._models_py3 import RaiBlocklistPropertiesBasicResourceArmPaginatedResult + from ._models_py3 import RaiPolicyContentFilter + from ._models_py3 import RaiPolicyProperties + from ._models_py3 import RaiPolicyPropertiesBasicResource + from ._models_py3 import RaiPolicyPropertiesBasicResourceArmPaginatedResult from ._models_py3 import RandomSamplingAlgorithm from ._models_py3 import Recurrence from ._models_py3 import RecurrenceSchedule from ._models_py3 import RecurrenceTrigger from ._models_py3 import RegenerateEndpointKeysRequest + from ._models_py3 import RegenerateServiceAccountKeyContent from ._models_py3 import Registry from ._models_py3 import RegistryListCredentialsResult from ._models_py3 import RegistryPartialManagedServiceIdentity @@ -409,6 +453,7 @@ from ._models_py3 import Regression from ._models_py3 import RegressionTrainingSettings from ._models_py3 import RequestLogging + from ._models_py3 import ResizeSchema from ._models_py3 import Resource from ._models_py3 import ResourceBase from ._models_py3 import ResourceConfiguration @@ -436,9 +481,15 @@ from ._models_py3 import SecretExpiry from ._models_py3 import ServerlessComputeSettings from ._models_py3 import ServerlessEndpoint + from ._models_py3 import ServerlessEndpointCapacityReservation + from ._models_py3 import ServerlessEndpointContentSafety + from ._models_py3 import ServerlessEndpointInferenceEndpoint + from ._models_py3 import ServerlessEndpointModelSettings from ._models_py3 import ServerlessEndpointProperties + from ._models_py3 import ServerlessEndpointResourceProperties from ._models_py3 import ServerlessEndpointTrackedResourceArmPaginatedResult from ._models_py3 import ServerlessInferenceEndpoint + from ._models_py3 import ServerlessOffer from ._models_py3 import ServiceManagedResourcesSettings from ._models_py3 import ServicePrincipalAuthTypeWorkspaceConnectionProperties from ._models_py3 import ServicePrincipalDatastoreCredentials @@ -457,6 +508,8 @@ from ._models_py3 import SparkJobPythonEntry from ._models_py3 import SparkJobScalaEntry from ._models_py3 import SparkResourceConfiguration + from ._models_py3 import SpeechEndpointDeploymentResourceProperties + from ._models_py3 import SpeechEndpointResourceProperties from ._models_py3 import SslConfiguration from ._models_py3 import StackEnsembleSettings from ._models_py3 import StaticInputData @@ -528,9 +581,11 @@ from ._models_py3 import WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult from ._models_py3 import WorkspaceConnectionServicePrincipal from ._models_py3 import WorkspaceConnectionSharedAccessSignature + from ._models_py3 import WorkspaceConnectionUpdateParameter from ._models_py3 import WorkspaceConnectionUsernamePassword from ._models_py3 import WorkspaceHubConfig from ._models_py3 import WorkspaceListResult + from ._models_py3 import WorkspacePrivateEndpointResource from ._models_py3 import WorkspaceUpdateParameters except (SyntaxError, ImportError): from ._models import AADAuthTypeWorkspaceConnectionProperties # type: ignore @@ -538,6 +593,7 @@ from ._models import AKSSchema # type: ignore from ._models import AKSSchemaProperties # type: ignore from ._models import AccessKeyAuthTypeWorkspaceConnectionProperties # type: ignore + from ._models import AccountApiKeys # type: ignore from ._models import AccountKeyAuthTypeWorkspaceConnectionProperties # type: ignore from ._models import AccountKeyDatastoreCredentials # type: ignore from ._models import AccountKeyDatastoreSecrets # type: ignore @@ -594,6 +650,7 @@ from ._models import BindOptions # type: ignore from ._models import BlobReferenceForConsumptionDto # type: ignore from ._models import BuildContext # type: ignore + from ._models import CapacityConfig # type: ignore from ._models import CategoricalDataDriftMetricThreshold # type: ignore from ._models import CategoricalDataQualityMetricThreshold # type: ignore from ._models import CategoricalPredictionDriftMetricThreshold # type: ignore @@ -609,6 +666,8 @@ from ._models import CodeVersion # type: ignore from ._models import CodeVersionProperties # type: ignore from ._models import CodeVersionResourceArmPaginatedResult # type: ignore + from ._models import CognitiveServiceEndpointDeploymentResourceProperties # type: ignore + from ._models import CognitiveServicesSku # type: ignore from ._models import Collection # type: ignore from ._models import ColumnTransformer # type: ignore from ._models import CommandJob # type: ignore @@ -622,6 +681,7 @@ from ._models import Compute # type: ignore from ._models import ComputeInstance # type: ignore from ._models import ComputeInstanceApplication # type: ignore + from ._models import ComputeInstanceAutologgerSettings # type: ignore from ._models import ComputeInstanceConnectivityEndpoints # type: ignore from ._models import ComputeInstanceContainer # type: ignore from ._models import ComputeInstanceCreatedBy # type: ignore @@ -643,6 +703,8 @@ from ._models import ContainerResourceRequirements # type: ignore from ._models import ContainerResourceSettings # type: ignore from ._models import ContentSafety # type: ignore + from ._models import ContentSafetyEndpointDeploymentResourceProperties # type: ignore + from ._models import ContentSafetyEndpointResourceProperties # type: ignore from ._models import CosmosDbSettings # type: ignore from ._models import CreateMonitorAction # type: ignore from ._models import Cron # type: ignore @@ -700,15 +762,30 @@ from ._models import Docker # type: ignore from ._models import DockerCredential # type: ignore from ._models import EarlyTerminationPolicy # type: ignore - from ._models import EncryptionKeyVaultProperties # type: ignore from ._models import EncryptionKeyVaultUpdateProperties # type: ignore from ._models import EncryptionProperty # type: ignore from ._models import EncryptionUpdateProperties # type: ignore from ._models import Endpoint # type: ignore from ._models import EndpointAuthKeys # type: ignore from ._models import EndpointAuthToken # type: ignore + from ._models import EndpointDeploymentModel # type: ignore from ._models import EndpointDeploymentPropertiesBase # type: ignore + from ._models import EndpointDeploymentResourceProperties # type: ignore + from ._models import EndpointDeploymentResourcePropertiesBasicResource # type: ignore + from ._models import EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult # type: ignore + from ._models import EndpointKeys # type: ignore + from ._models import EndpointModelDeprecationProperties # type: ignore + from ._models import EndpointModelProperties # type: ignore + from ._models import EndpointModelSkuCapacityProperties # type: ignore + from ._models import EndpointModelSkuProperties # type: ignore + from ._models import EndpointModelSkuRateLimitProperties # type: ignore + from ._models import EndpointModelSkuRateLimitRulePatternProperties # type: ignore + from ._models import EndpointModelSkuRateLimitRuleProperties # type: ignore + from ._models import EndpointModels # type: ignore from ._models import EndpointPropertiesBase # type: ignore + from ._models import EndpointResourceProperties # type: ignore + from ._models import EndpointResourcePropertiesBasicResource # type: ignore + from ._models import EndpointResourcePropertiesBasicResourceArmPaginatedResult # type: ignore from ._models import EndpointScheduleAction # type: ignore from ._models import EnvironmentContainer # type: ignore from ._models import EnvironmentContainerProperties # type: ignore @@ -726,7 +803,7 @@ from ._models import FQDNEndpoint # type: ignore from ._models import FQDNEndpointDetail # type: ignore from ._models import FQDNEndpoints # type: ignore - from ._models import FQDNEndpointsProperties # type: ignore + from ._models import FQDNEndpointsPropertyBag # type: ignore from ._models import Feature # type: ignore from ._models import FeatureAttributionDriftMonitoringSignal # type: ignore from ._models import FeatureAttributionMetricThreshold # type: ignore @@ -800,6 +877,8 @@ from ._models import JobResourceConfiguration # type: ignore from ._models import JobScheduleAction # type: ignore from ._models import JobService # type: ignore + from ._models import JupyterKernelConfig # type: ignore + from ._models import KeyVaultProperties # type: ignore from ._models import Kubernetes # type: ignore from ._models import KubernetesOnlineDeployment # type: ignore from ._models import KubernetesProperties # type: ignore @@ -825,6 +904,10 @@ from ._models import ManagedNetworkProvisionStatus # type: ignore from ._models import ManagedNetworkSettings # type: ignore from ._models import ManagedOnlineDeployment # type: ignore + from ._models import ManagedOnlineEndpointDeploymentResourceProperties # type: ignore + from ._models import ManagedOnlineEndpointResourceProperties # type: ignore + from ._models import ManagedResourceGroupAssignedIdentities # type: ignore + from ._models import ManagedResourceGroupSettings # type: ignore from ._models import ManagedServiceIdentity # type: ignore from ._models import MarketplacePlan # type: ignore from ._models import MarketplaceSubscription # type: ignore @@ -879,9 +962,12 @@ from ._models import OnlineEndpointTrackedResourceArmPaginatedResult # type: ignore from ._models import OnlineRequestSettings # type: ignore from ._models import OnlineScaleSettings # type: ignore + from ._models import OpenAIEndpointDeploymentResourceProperties # type: ignore + from ._models import OpenAIEndpointResourceProperties # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationListResult # type: ignore + from ._models import OsPatchingStatus # type: ignore from ._models import OutboundRule # type: ignore from ._models import OutboundRuleBasicResource # type: ignore from ._models import OutboundRuleListResult # type: ignore @@ -920,11 +1006,24 @@ from ._models import QueueSettings # type: ignore from ._models import QuotaBaseProperties # type: ignore from ._models import QuotaUpdateParameters # type: ignore + from ._models import RaiBlocklistConfig # type: ignore + from ._models import RaiBlocklistItemBulkRequest # type: ignore + from ._models import RaiBlocklistItemProperties # type: ignore + from ._models import RaiBlocklistItemPropertiesBasicResource # type: ignore + from ._models import RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult # type: ignore + from ._models import RaiBlocklistProperties # type: ignore + from ._models import RaiBlocklistPropertiesBasicResource # type: ignore + from ._models import RaiBlocklistPropertiesBasicResourceArmPaginatedResult # type: ignore + from ._models import RaiPolicyContentFilter # type: ignore + from ._models import RaiPolicyProperties # type: ignore + from ._models import RaiPolicyPropertiesBasicResource # type: ignore + from ._models import RaiPolicyPropertiesBasicResourceArmPaginatedResult # type: ignore from ._models import RandomSamplingAlgorithm # type: ignore from ._models import Recurrence # type: ignore from ._models import RecurrenceSchedule # type: ignore from ._models import RecurrenceTrigger # type: ignore from ._models import RegenerateEndpointKeysRequest # type: ignore + from ._models import RegenerateServiceAccountKeyContent # type: ignore from ._models import Registry # type: ignore from ._models import RegistryListCredentialsResult # type: ignore from ._models import RegistryPartialManagedServiceIdentity # type: ignore @@ -935,6 +1034,7 @@ from ._models import Regression # type: ignore from ._models import RegressionTrainingSettings # type: ignore from ._models import RequestLogging # type: ignore + from ._models import ResizeSchema # type: ignore from ._models import Resource # type: ignore from ._models import ResourceBase # type: ignore from ._models import ResourceConfiguration # type: ignore @@ -962,9 +1062,15 @@ from ._models import SecretExpiry # type: ignore from ._models import ServerlessComputeSettings # type: ignore from ._models import ServerlessEndpoint # type: ignore + from ._models import ServerlessEndpointCapacityReservation # type: ignore + from ._models import ServerlessEndpointContentSafety # type: ignore + from ._models import ServerlessEndpointInferenceEndpoint # type: ignore + from ._models import ServerlessEndpointModelSettings # type: ignore from ._models import ServerlessEndpointProperties # type: ignore + from ._models import ServerlessEndpointResourceProperties # type: ignore from ._models import ServerlessEndpointTrackedResourceArmPaginatedResult # type: ignore from ._models import ServerlessInferenceEndpoint # type: ignore + from ._models import ServerlessOffer # type: ignore from ._models import ServiceManagedResourcesSettings # type: ignore from ._models import ServicePrincipalAuthTypeWorkspaceConnectionProperties # type: ignore from ._models import ServicePrincipalDatastoreCredentials # type: ignore @@ -983,6 +1089,8 @@ from ._models import SparkJobPythonEntry # type: ignore from ._models import SparkJobScalaEntry # type: ignore from ._models import SparkResourceConfiguration # type: ignore + from ._models import SpeechEndpointDeploymentResourceProperties # type: ignore + from ._models import SpeechEndpointResourceProperties # type: ignore from ._models import SslConfiguration # type: ignore from ._models import StackEnsembleSettings # type: ignore from ._models import StaticInputData # type: ignore @@ -1054,14 +1162,17 @@ from ._models import WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult # type: ignore from ._models import WorkspaceConnectionServicePrincipal # type: ignore from ._models import WorkspaceConnectionSharedAccessSignature # type: ignore + from ._models import WorkspaceConnectionUpdateParameter # type: ignore from ._models import WorkspaceConnectionUsernamePassword # type: ignore from ._models import WorkspaceHubConfig # type: ignore from ._models import WorkspaceListResult # type: ignore + from ._models import WorkspacePrivateEndpointResource # type: ignore from ._models import WorkspaceUpdateParameters # type: ignore from ._azure_machine_learning_workspaces_enums import ( ActionType, AllocationState, + AllowedContentLevel, ApplicationSharingPolicy, AssetProvisioningState, AutoRebuildSetting, @@ -1098,6 +1209,8 @@ DataReferenceCredentialType, DataType, DatastoreType, + DefaultResourceProvisioningState, + DeploymentModelVersionUpgradeOption, DeploymentProvisioningState, DiagnoseResultLevel, DistributionType, @@ -1109,6 +1222,7 @@ EndpointComputeType, EndpointProvisioningState, EndpointServiceConnectionStatus, + EndpointType, EnvironmentType, EnvironmentVariableType, FeatureAttributionMetric, @@ -1137,10 +1251,14 @@ LoadBalancerType, LogVerbosity, ManagedNetworkStatus, + ManagedPERequirement, + ManagedPEStatus, ManagedServiceIdentityType, MarketplaceSubscriptionProvisioningState, MarketplaceSubscriptionStatus, MaterializationStoreType, + MlflowAutologger, + ModelLifecycleStatus, ModelSize, ModelTaskType, MonitorComputeIdentityType, @@ -1151,6 +1269,7 @@ MonitoringNotificationType, MonitoringSignalType, MountAction, + MountMode, MountState, NCrossValidationsMode, Network, @@ -1169,16 +1288,18 @@ Origin, OsType, OutputDeliveryMode, + PatchStatus, PendingUploadCredentialType, PendingUploadType, PrivateEndpointConnectionProvisioningState, - PrivateEndpointServiceConnectionStatus, Protocol, ProvisioningState, ProvisioningStatus, - PublicNetworkAccess, PublicNetworkAccessType, QuotaUnit, + RaiPolicyContentSource, + RaiPolicyMode, + RaiPolicyType, RandomSamplingAlgorithmRule, RecurrenceFrequency, ReferenceType, @@ -1201,6 +1322,7 @@ SecretsType, ServerlessEndpointState, ServerlessInferenceEndpointAuthMode, + ServiceAccountKeyName, ServiceDataAccessAuthIdentity, ShortSeriesHandlingConfiguration, SkuScaleType, @@ -1225,7 +1347,6 @@ VMPriceOSType, VMTier, ValidationMetricType, - ValueFormat, VmPriority, VolumeDefinitionType, WebhookType, @@ -1238,6 +1359,7 @@ 'AKSSchema', 'AKSSchemaProperties', 'AccessKeyAuthTypeWorkspaceConnectionProperties', + 'AccountApiKeys', 'AccountKeyAuthTypeWorkspaceConnectionProperties', 'AccountKeyDatastoreCredentials', 'AccountKeyDatastoreSecrets', @@ -1294,6 +1416,7 @@ 'BindOptions', 'BlobReferenceForConsumptionDto', 'BuildContext', + 'CapacityConfig', 'CategoricalDataDriftMetricThreshold', 'CategoricalDataQualityMetricThreshold', 'CategoricalPredictionDriftMetricThreshold', @@ -1309,6 +1432,8 @@ 'CodeVersion', 'CodeVersionProperties', 'CodeVersionResourceArmPaginatedResult', + 'CognitiveServiceEndpointDeploymentResourceProperties', + 'CognitiveServicesSku', 'Collection', 'ColumnTransformer', 'CommandJob', @@ -1322,6 +1447,7 @@ 'Compute', 'ComputeInstance', 'ComputeInstanceApplication', + 'ComputeInstanceAutologgerSettings', 'ComputeInstanceConnectivityEndpoints', 'ComputeInstanceContainer', 'ComputeInstanceCreatedBy', @@ -1343,6 +1469,8 @@ 'ContainerResourceRequirements', 'ContainerResourceSettings', 'ContentSafety', + 'ContentSafetyEndpointDeploymentResourceProperties', + 'ContentSafetyEndpointResourceProperties', 'CosmosDbSettings', 'CreateMonitorAction', 'Cron', @@ -1400,15 +1528,30 @@ 'Docker', 'DockerCredential', 'EarlyTerminationPolicy', - 'EncryptionKeyVaultProperties', 'EncryptionKeyVaultUpdateProperties', 'EncryptionProperty', 'EncryptionUpdateProperties', 'Endpoint', 'EndpointAuthKeys', 'EndpointAuthToken', + 'EndpointDeploymentModel', 'EndpointDeploymentPropertiesBase', + 'EndpointDeploymentResourceProperties', + 'EndpointDeploymentResourcePropertiesBasicResource', + 'EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult', + 'EndpointKeys', + 'EndpointModelDeprecationProperties', + 'EndpointModelProperties', + 'EndpointModelSkuCapacityProperties', + 'EndpointModelSkuProperties', + 'EndpointModelSkuRateLimitProperties', + 'EndpointModelSkuRateLimitRulePatternProperties', + 'EndpointModelSkuRateLimitRuleProperties', + 'EndpointModels', 'EndpointPropertiesBase', + 'EndpointResourceProperties', + 'EndpointResourcePropertiesBasicResource', + 'EndpointResourcePropertiesBasicResourceArmPaginatedResult', 'EndpointScheduleAction', 'EnvironmentContainer', 'EnvironmentContainerProperties', @@ -1426,7 +1569,7 @@ 'FQDNEndpoint', 'FQDNEndpointDetail', 'FQDNEndpoints', - 'FQDNEndpointsProperties', + 'FQDNEndpointsPropertyBag', 'Feature', 'FeatureAttributionDriftMonitoringSignal', 'FeatureAttributionMetricThreshold', @@ -1500,6 +1643,8 @@ 'JobResourceConfiguration', 'JobScheduleAction', 'JobService', + 'JupyterKernelConfig', + 'KeyVaultProperties', 'Kubernetes', 'KubernetesOnlineDeployment', 'KubernetesProperties', @@ -1525,6 +1670,10 @@ 'ManagedNetworkProvisionStatus', 'ManagedNetworkSettings', 'ManagedOnlineDeployment', + 'ManagedOnlineEndpointDeploymentResourceProperties', + 'ManagedOnlineEndpointResourceProperties', + 'ManagedResourceGroupAssignedIdentities', + 'ManagedResourceGroupSettings', 'ManagedServiceIdentity', 'MarketplacePlan', 'MarketplaceSubscription', @@ -1579,9 +1728,12 @@ 'OnlineEndpointTrackedResourceArmPaginatedResult', 'OnlineRequestSettings', 'OnlineScaleSettings', + 'OpenAIEndpointDeploymentResourceProperties', + 'OpenAIEndpointResourceProperties', 'Operation', 'OperationDisplay', 'OperationListResult', + 'OsPatchingStatus', 'OutboundRule', 'OutboundRuleBasicResource', 'OutboundRuleListResult', @@ -1620,11 +1772,24 @@ 'QueueSettings', 'QuotaBaseProperties', 'QuotaUpdateParameters', + 'RaiBlocklistConfig', + 'RaiBlocklistItemBulkRequest', + 'RaiBlocklistItemProperties', + 'RaiBlocklistItemPropertiesBasicResource', + 'RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult', + 'RaiBlocklistProperties', + 'RaiBlocklistPropertiesBasicResource', + 'RaiBlocklistPropertiesBasicResourceArmPaginatedResult', + 'RaiPolicyContentFilter', + 'RaiPolicyProperties', + 'RaiPolicyPropertiesBasicResource', + 'RaiPolicyPropertiesBasicResourceArmPaginatedResult', 'RandomSamplingAlgorithm', 'Recurrence', 'RecurrenceSchedule', 'RecurrenceTrigger', 'RegenerateEndpointKeysRequest', + 'RegenerateServiceAccountKeyContent', 'Registry', 'RegistryListCredentialsResult', 'RegistryPartialManagedServiceIdentity', @@ -1635,6 +1800,7 @@ 'Regression', 'RegressionTrainingSettings', 'RequestLogging', + 'ResizeSchema', 'Resource', 'ResourceBase', 'ResourceConfiguration', @@ -1662,9 +1828,15 @@ 'SecretExpiry', 'ServerlessComputeSettings', 'ServerlessEndpoint', + 'ServerlessEndpointCapacityReservation', + 'ServerlessEndpointContentSafety', + 'ServerlessEndpointInferenceEndpoint', + 'ServerlessEndpointModelSettings', 'ServerlessEndpointProperties', + 'ServerlessEndpointResourceProperties', 'ServerlessEndpointTrackedResourceArmPaginatedResult', 'ServerlessInferenceEndpoint', + 'ServerlessOffer', 'ServiceManagedResourcesSettings', 'ServicePrincipalAuthTypeWorkspaceConnectionProperties', 'ServicePrincipalDatastoreCredentials', @@ -1683,6 +1855,8 @@ 'SparkJobPythonEntry', 'SparkJobScalaEntry', 'SparkResourceConfiguration', + 'SpeechEndpointDeploymentResourceProperties', + 'SpeechEndpointResourceProperties', 'SslConfiguration', 'StackEnsembleSettings', 'StaticInputData', @@ -1754,12 +1928,15 @@ 'WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult', 'WorkspaceConnectionServicePrincipal', 'WorkspaceConnectionSharedAccessSignature', + 'WorkspaceConnectionUpdateParameter', 'WorkspaceConnectionUsernamePassword', 'WorkspaceHubConfig', 'WorkspaceListResult', + 'WorkspacePrivateEndpointResource', 'WorkspaceUpdateParameters', 'ActionType', 'AllocationState', + 'AllowedContentLevel', 'ApplicationSharingPolicy', 'AssetProvisioningState', 'AutoRebuildSetting', @@ -1796,6 +1973,8 @@ 'DataReferenceCredentialType', 'DataType', 'DatastoreType', + 'DefaultResourceProvisioningState', + 'DeploymentModelVersionUpgradeOption', 'DeploymentProvisioningState', 'DiagnoseResultLevel', 'DistributionType', @@ -1807,6 +1986,7 @@ 'EndpointComputeType', 'EndpointProvisioningState', 'EndpointServiceConnectionStatus', + 'EndpointType', 'EnvironmentType', 'EnvironmentVariableType', 'FeatureAttributionMetric', @@ -1835,10 +2015,14 @@ 'LoadBalancerType', 'LogVerbosity', 'ManagedNetworkStatus', + 'ManagedPERequirement', + 'ManagedPEStatus', 'ManagedServiceIdentityType', 'MarketplaceSubscriptionProvisioningState', 'MarketplaceSubscriptionStatus', 'MaterializationStoreType', + 'MlflowAutologger', + 'ModelLifecycleStatus', 'ModelSize', 'ModelTaskType', 'MonitorComputeIdentityType', @@ -1849,6 +2033,7 @@ 'MonitoringNotificationType', 'MonitoringSignalType', 'MountAction', + 'MountMode', 'MountState', 'NCrossValidationsMode', 'Network', @@ -1867,16 +2052,18 @@ 'Origin', 'OsType', 'OutputDeliveryMode', + 'PatchStatus', 'PendingUploadCredentialType', 'PendingUploadType', 'PrivateEndpointConnectionProvisioningState', - 'PrivateEndpointServiceConnectionStatus', 'Protocol', 'ProvisioningState', 'ProvisioningStatus', - 'PublicNetworkAccess', 'PublicNetworkAccessType', 'QuotaUnit', + 'RaiPolicyContentSource', + 'RaiPolicyMode', + 'RaiPolicyType', 'RandomSamplingAlgorithmRule', 'RecurrenceFrequency', 'ReferenceType', @@ -1899,6 +2086,7 @@ 'SecretsType', 'ServerlessEndpointState', 'ServerlessInferenceEndpointAuthMode', + 'ServiceAccountKeyName', 'ServiceDataAccessAuthIdentity', 'ShortSeriesHandlingConfiguration', 'SkuScaleType', @@ -1923,7 +2111,6 @@ 'VMPriceOSType', 'VMTier', 'ValidationMetricType', - 'ValueFormat', 'VmPriority', 'VolumeDefinitionType', 'WebhookType', diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/_azure_machine_learning_workspaces_enums.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/_azure_machine_learning_workspaces_enums.py index 3396e8f2e5a98..b2ffda132b51d 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/_azure_machine_learning_workspaces_enums.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/_azure_machine_learning_workspaces_enums.py @@ -28,6 +28,14 @@ class AllocationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STEADY = "Steady" RESIZING = "Resizing" +class AllowedContentLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Level at which content is filtered. + """ + + LOW = "Low" + MEDIUM = "Medium" + HIGH = "High" + class ApplicationSharingPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Policy for sharing applications on this compute instance among users of parent workspace. If Personal, only the creator can access applications on this compute instance. When Shared, any @@ -286,6 +294,7 @@ class ComputeInstanceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETING = "Deleting" RUNNING = "Running" RESTARTING = "Restarting" + RESIZING = "Resizing" JOB_RUNNING = "JobRunning" SETTING_UP = "SettingUp" SETUP_FAILED = "SetupFailed" @@ -298,7 +307,7 @@ class ComputeInstanceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNUSABLE = "Unusable" class ComputePowerAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The compute power action. + """[Required] The compute power action. """ START = "Start" @@ -320,8 +329,6 @@ class ComputeRecurrenceFrequency(with_metaclass(CaseInsensitiveEnumMeta, str, En MONTH = "Month" class ComputeTriggerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Is the trigger type recurrence or cron. - """ RECURRENCE = "Recurrence" CRON = "Cron" @@ -394,6 +401,7 @@ class ConnectionCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REDIS = "Redis" API_KEY = "ApiKey" AZURE_OPEN_AI = "AzureOpenAI" + AI_SERVICES = "AIServices" COGNITIVE_SEARCH = "CognitiveSearch" COGNITIVE_SERVICE = "CognitiveService" CUSTOM_KEYS = "CustomKeys" @@ -482,7 +490,6 @@ class ConnectionCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SERP = "Serp" BING_LLM_SEARCH = "BingLLMSearch" SERVERLESS = "Serverless" - AI_SERVICES = "AIServices" class ConnectionGroup(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Group based on connection category @@ -566,6 +573,27 @@ class DataType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): URI_FOLDER = "uri_folder" MLTABLE = "mltable" +class DefaultResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + NOT_STARTED = "NotStarted" + FAILED = "Failed" + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + DELETING = "Deleting" + ACCEPTED = "Accepted" + CANCELED = "Canceled" + SCALING = "Scaling" + DISABLED = "Disabled" + +class DeploymentModelVersionUpgradeOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Deployment model version upgrade option. + """ + + ONCE_NEW_DEFAULT_VERSION_AVAILABLE = "OnceNewDefaultVersionAvailable" + ONCE_CURRENT_VERSION_EXPIRED = "OnceCurrentVersionExpired" + NO_AUTO_UPGRADE = "NoAutoUpgrade" + class DeploymentProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Possible values for DeploymentProvisioningState. """ @@ -658,6 +686,18 @@ class EndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, st PENDING = "Pending" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + TIMEOUT = "Timeout" + +class EndpointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of the endpoint. + """ + + AZURE_OPEN_AI = "Azure.OpenAI" + AZURE_SPEECH = "Azure.Speech" + AZURE_CONTENT_SAFETY = "Azure.ContentSafety" + AZURE_LLAMA = "Azure.Llama" + MANAGED_ONLINE_ENDPOINT = "managedOnlineEndpoint" + SERVERLESS_ENDPOINT = "serverlessEndpoint" class EnvironmentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Environment type is either user created or curated by Azure ML service @@ -791,8 +831,8 @@ class ForecastingModels(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: It's an inexact but powerful technique. SGD = "SGD" #: Random forest is a supervised learning algorithm. - #: The "forest" it builds, is an ensemble of decision trees, usually trained with the “bagging” - #: method. + #: The "forest"\\ it builds, is an ensemble of decision trees, usually trained with the + #: “bagging”\\ method. #: The general idea of the bagging method is that a combination of learning models increases the #: overall result. RANDOM_FOREST = "RandomForest" @@ -838,7 +878,7 @@ class IdentityConfigurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enu class ImageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the image. Possible values are: docker - For docker images. azureml - For AzureML - images + Environment images (custom and curated) """ DOCKER = "docker" @@ -1010,6 +1050,18 @@ class ManagedNetworkStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INACTIVE = "Inactive" ACTIVE = "Active" +class ManagedPERequirement(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + REQUIRED = "Required" + NOT_REQUIRED = "NotRequired" + NOT_APPLICABLE = "NotApplicable" + +class ManagedPEStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + INACTIVE = "Inactive" + ACTIVE = "Active" + NOT_APPLICABLE = "NotApplicable" + class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). @@ -1054,6 +1106,20 @@ class MaterializationStoreType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum OFFLINE = "Offline" ONLINE_AND_OFFLINE = "OnlineAndOffline" +class MlflowAutologger(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates whether mlflow autologger is enabled for notebooks. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ModelLifecycleStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Model lifecycle status. + """ + + GENERALLY_AVAILABLE = "GenerallyAvailable" + PREVIEW = "Preview" + class ModelSize(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Image model size. """ @@ -1147,6 +1213,13 @@ class MountAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MOUNT = "Mount" UNMOUNT = "Unmount" +class MountMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Mount Mode. + """ + + READ_ONLY = "ReadOnly" + READ_WRITE = "ReadWrite" + class MountState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Mount state. """ @@ -1253,6 +1326,7 @@ class OperationName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): START = "Start" STOP = "Stop" RESTART = "Restart" + RESIZE = "Resize" REIMAGE = "Reimage" DELETE = "Delete" @@ -1266,6 +1340,7 @@ class OperationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): START_FAILED = "StartFailed" STOP_FAILED = "StopFailed" RESTART_FAILED = "RestartFailed" + RESIZE_FAILED = "ResizeFailed" REIMAGE_FAILED = "ReimageFailed" DELETE_FAILED = "DeleteFailed" @@ -1308,6 +1383,16 @@ class OutputDeliveryMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UPLOAD = "Upload" DIRECT = "Direct" +class PatchStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The os patching status. + """ + + COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" + FAILED = "Failed" + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + UNKNOWN = "Unknown" + class PendingUploadCredentialType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enum to determine the PendingUpload credentials type. """ @@ -1330,16 +1415,6 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The private endpoint connection status. - """ - - PENDING = "Pending" - APPROVED = "Approved" - REJECTED = "Rejected" - DISCONNECTED = "Disconnected" - TIMEOUT = "Timeout" - class Protocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Protocol over which communication will happen over this endpoint """ @@ -1349,8 +1424,8 @@ class Protocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): HTTP = "http" class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The current deployment state of workspace resource. The provisioningState is to indicate states - for resource provisioning. + """The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, + Succeeded, and Failed. """ UNKNOWN = "Unknown" @@ -1369,13 +1444,6 @@ class ProvisioningStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PROVISIONING = "Provisioning" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Whether requests from Public Network are allowed. - """ - - ENABLED = "Enabled" - DISABLED = "Disabled" - class PublicNetworkAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enum to determine whether PublicNetworkAccess is Enabled or Disabled. """ @@ -1389,6 +1457,28 @@ class QuotaUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COUNT = "Count" +class RaiPolicyContentSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Content source to apply the Content Filters. + """ + + PROMPT = "Prompt" + COMPLETION = "Completion" + +class RaiPolicyMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Content Filters mode. + """ + + DEFAULT = "Default" + DEFERRED = "Deferred" + BLOCKING = "Blocking" + +class RaiPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Content Filters policy type. + """ + + USER_MANAGED = "UserManaged" + SYSTEM_MANAGED = "SystemManaged" + class RandomSamplingAlgorithmRule(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The specific type of random algorithm """ @@ -1614,6 +1704,11 @@ class ServerlessInferenceEndpointAuthMode(with_metaclass(CaseInsensitiveEnumMeta KEY = "Key" +class ServiceAccountKeyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + KEY1 = "Key1" + KEY2 = "Key2" + class ServiceDataAccessAuthIdentity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use any identity for service data access. @@ -1860,12 +1955,6 @@ class ValidationMetricType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: CocoVoc metric. COCO_VOC = "CocoVoc" -class ValueFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """format for the workspace connection value - """ - - JSON = "JSON" - class VMPriceOSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Operating system type used by the VM. """ diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/_models.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/_models.py index 1e31e12c922ec..f24b18f506e9f 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/_models.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/_models.py @@ -26,7 +26,7 @@ class WorkspaceConnectionPropertiesV2(msrest.serialization.Model): :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -41,10 +41,12 @@ class WorkspaceConnectionPropertiesV2(msrest.serialization.Model): "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -52,16 +54,18 @@ class WorkspaceConnectionPropertiesV2(msrest.serialization.Model): :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool """ _validation = { @@ -74,14 +78,16 @@ class WorkspaceConnectionPropertiesV2(msrest.serialization.Model): 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, } _subtype_map = { @@ -95,7 +101,7 @@ def __init__( """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -110,36 +116,42 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool """ super(WorkspaceConnectionPropertiesV2, self).__init__(**kwargs) self.auth_type = None # type: Optional[str] self.category = kwargs.get('category', None) self.created_by_workspace_arm_id = None + self.error = kwargs.get('error', None) self.expiry_time = kwargs.get('expiry_time', None) self.group = None self.is_shared_to_all = kwargs.get('is_shared_to_all', None) - self.target = kwargs.get('target', None) self.metadata = kwargs.get('metadata', None) + self.pe_requirement = kwargs.get('pe_requirement', None) + self.pe_status = kwargs.get('pe_status', None) self.shared_user_list = kwargs.get('shared_user_list', None) - self.value = kwargs.get('value', None) - self.value_format = kwargs.get('value_format', None) + self.target = kwargs.get('target', None) + self.use_workspace_managed_identity = kwargs.get('use_workspace_managed_identity', None) class AADAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): @@ -155,7 +167,7 @@ class AADAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -170,10 +182,12 @@ class AADAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -181,16 +195,18 @@ class AADAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool """ _validation = { @@ -203,14 +219,16 @@ class AADAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, } def __init__( @@ -220,7 +238,7 @@ def __init__( """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -235,23 +253,27 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool """ super(AADAuthTypeWorkspaceConnectionProperties, self).__init__(**kwargs) self.auth_type = 'AAD' # type: str @@ -270,7 +292,7 @@ class AccessKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionProperti :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -285,10 +307,12 @@ class AccessKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionProperti "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -296,16 +320,18 @@ class AccessKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionProperti :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccessKey """ @@ -320,14 +346,16 @@ class AccessKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionProperti 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionAccessKey'}, } @@ -338,7 +366,7 @@ def __init__( """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -353,23 +381,27 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccessKey """ @@ -378,6 +410,35 @@ def __init__( self.credentials = kwargs.get('credentials', None) +class AccountApiKeys(msrest.serialization.Model): + """AccountApiKeys. + + :ivar key1: + :vartype key1: str + :ivar key2: + :vartype key2: str + """ + + _attribute_map = { + 'key1': {'key': 'key1', 'type': 'str'}, + 'key2': {'key': 'key2', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword key1: + :paramtype key1: str + :keyword key2: + :paramtype key2: str + """ + super(AccountApiKeys, self).__init__(**kwargs) + self.key1 = kwargs.get('key1', None) + self.key2 = kwargs.get('key2', None) + + class AccountKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): """This connection type covers the account key connection for Azure storage. @@ -391,7 +452,7 @@ class AccountKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropert :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -406,10 +467,12 @@ class AccountKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropert "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -417,17 +480,19 @@ class AccountKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropert :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :ivar credentials: + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: Account key object for workspace connection credential. :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccountKey """ @@ -441,14 +506,16 @@ class AccountKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropert 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionAccountKey'}, } @@ -459,7 +526,7 @@ def __init__( """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -474,24 +541,28 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :keyword credentials: + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: Account key object for workspace connection credential. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccountKey """ @@ -1903,7 +1974,7 @@ class ApiKeyAuthWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -1918,10 +1989,12 @@ class ApiKeyAuthWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -1929,16 +2002,18 @@ class ApiKeyAuthWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: Api key object for workspace connection credential. :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionApiKey """ @@ -1953,14 +2028,16 @@ class ApiKeyAuthWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionApiKey'}, } @@ -1971,7 +2048,7 @@ def __init__( """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -1986,23 +2063,27 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: Api key object for workspace connection credential. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionApiKey """ @@ -4581,7 +4662,7 @@ def __init__( class BindOptions(msrest.serialization.Model): - """Describes the bind options for the container. + """BindOptions. :ivar propagation: Type of Bind Option. :vartype propagation: str @@ -4711,6 +4792,53 @@ def __init__( self.dockerfile_path = kwargs.get('dockerfile_path', "Dockerfile") +class CapacityConfig(msrest.serialization.Model): + """The capacity configuration. + + :ivar minimum: The minimum capacity. + :vartype minimum: int + :ivar maximum: The maximum capacity. + :vartype maximum: int + :ivar step: The minimal incremental between allowed values for capacity. + :vartype step: int + :ivar default: The default capacity. + :vartype default: int + :ivar allowed_values: The array of allowed values for capacity. + :vartype allowed_values: list[int] + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'step': {'key': 'step', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + 'allowed_values': {'key': 'allowedValues', 'type': '[int]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword minimum: The minimum capacity. + :paramtype minimum: int + :keyword maximum: The maximum capacity. + :paramtype maximum: int + :keyword step: The minimal incremental between allowed values for capacity. + :paramtype step: int + :keyword default: The default capacity. + :paramtype default: int + :keyword allowed_values: The array of allowed values for capacity. + :paramtype allowed_values: list[int] + """ + super(CapacityConfig, self).__init__(**kwargs) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + self.step = kwargs.get('step', None) + self.default = kwargs.get('default', None) + self.allowed_values = kwargs.get('allowed_values', None) + + class DataDriftMetricThresholdBase(msrest.serialization.Model): """DataDriftMetricThresholdBase. @@ -5842,6 +5970,98 @@ def __init__( self.value = kwargs.get('value', None) +class CognitiveServiceEndpointDeploymentResourceProperties(msrest.serialization.Model): + """CognitiveServiceEndpointDeploymentResourceProperties. + + All required parameters must be populated in order to send to Azure. + + :ivar model: Required. Model used for the endpoint deployment. + :vartype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar version_upgrade_option: Deployment model version upgrade option. Possible values include: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + """ + + _validation = { + 'model': {'required': True}, + } + + _attribute_map = { + 'model': {'key': 'model', 'type': 'EndpointDeploymentModel'}, + 'rai_policy_name': {'key': 'raiPolicyName', 'type': 'str'}, + 'version_upgrade_option': {'key': 'versionUpgradeOption', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword model: Required. Model used for the endpoint deployment. + :paramtype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :keyword rai_policy_name: The name of RAI policy. + :paramtype rai_policy_name: str + :keyword version_upgrade_option: Deployment model version upgrade option. Possible values + include: "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :paramtype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + """ + super(CognitiveServiceEndpointDeploymentResourceProperties, self).__init__(**kwargs) + self.model = kwargs['model'] + self.rai_policy_name = kwargs.get('rai_policy_name', None) + self.version_upgrade_option = kwargs.get('version_upgrade_option', None) + + +class CognitiveServicesSku(msrest.serialization.Model): + """CognitiveServicesSku. + + :ivar capacity: + :vartype capacity: int + :ivar family: + :vartype family: str + :ivar name: + :vartype name: str + :ivar size: + :vartype size: str + :ivar tier: + :vartype tier: str + """ + + _attribute_map = { + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword capacity: + :paramtype capacity: int + :keyword family: + :paramtype family: str + :keyword name: + :paramtype name: str + :keyword size: + :paramtype size: str + :keyword tier: + :paramtype tier: str + """ + super(CognitiveServicesSku, self).__init__(**kwargs) + self.capacity = kwargs.get('capacity', None) + self.family = kwargs.get('family', None) + self.name = kwargs.get('name', None) + self.size = kwargs.get('size', None) + self.tier = kwargs.get('tier', None) + + class Collection(msrest.serialization.Model): """Collection. @@ -6616,6 +6836,32 @@ def __init__( self.endpoint_uri = kwargs.get('endpoint_uri', None) +class ComputeInstanceAutologgerSettings(msrest.serialization.Model): + """Specifies settings for autologger. + + :ivar mlflow_autologger: Indicates whether mlflow autologger is enabled for notebooks. Possible + values include: "Enabled", "Disabled". + :vartype mlflow_autologger: str or ~azure.mgmt.machinelearningservices.models.MlflowAutologger + """ + + _attribute_map = { + 'mlflow_autologger': {'key': 'mlflowAutologger', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword mlflow_autologger: Indicates whether mlflow autologger is enabled for notebooks. + Possible values include: "Enabled", "Disabled". + :paramtype mlflow_autologger: str or + ~azure.mgmt.machinelearningservices.models.MlflowAutologger + """ + super(ComputeInstanceAutologgerSettings, self).__init__(**kwargs) + self.mlflow_autologger = kwargs.get('mlflow_autologger', None) + + class ComputeInstanceConnectivityEndpoints(msrest.serialization.Model): """Defines all connectivity endpoints and properties for an ComputeInstance. @@ -6804,6 +7050,8 @@ class ComputeInstanceDataMount(msrest.serialization.Model): :vartype mount_name: str :ivar mount_action: Mount Action. Possible values include: "Mount", "Unmount". :vartype mount_action: str or ~azure.mgmt.machinelearningservices.models.MountAction + :ivar mount_mode: Mount Mode. Possible values include: "ReadOnly", "ReadWrite". + :vartype mount_mode: str or ~azure.mgmt.machinelearningservices.models.MountMode :ivar created_by: who this data mount created by. :vartype created_by: str :ivar mount_path: Path of this data mount. @@ -6822,6 +7070,7 @@ class ComputeInstanceDataMount(msrest.serialization.Model): 'source_type': {'key': 'sourceType', 'type': 'str'}, 'mount_name': {'key': 'mountName', 'type': 'str'}, 'mount_action': {'key': 'mountAction', 'type': 'str'}, + 'mount_mode': {'key': 'mountMode', 'type': 'str'}, 'created_by': {'key': 'createdBy', 'type': 'str'}, 'mount_path': {'key': 'mountPath', 'type': 'str'}, 'mount_state': {'key': 'mountState', 'type': 'str'}, @@ -6842,6 +7091,8 @@ def __init__( :paramtype mount_name: str :keyword mount_action: Mount Action. Possible values include: "Mount", "Unmount". :paramtype mount_action: str or ~azure.mgmt.machinelearningservices.models.MountAction + :keyword mount_mode: Mount Mode. Possible values include: "ReadOnly", "ReadWrite". + :paramtype mount_mode: str or ~azure.mgmt.machinelearningservices.models.MountMode :keyword created_by: who this data mount created by. :paramtype created_by: str :keyword mount_path: Path of this data mount. @@ -6859,6 +7110,7 @@ def __init__( self.source_type = kwargs.get('source_type', None) self.mount_name = kwargs.get('mount_name', None) self.mount_action = kwargs.get('mount_action', None) + self.mount_mode = kwargs.get('mount_mode', None) self.created_by = kwargs.get('created_by', None) self.mount_path = kwargs.get('mount_path', None) self.mount_state = kwargs.get('mount_state', None) @@ -6899,12 +7151,13 @@ class ComputeInstanceLastOperation(msrest.serialization.Model): """The last operation on ComputeInstance. :ivar operation_name: Name of the last operation. Possible values include: "Create", "Start", - "Stop", "Restart", "Reimage", "Delete". + "Stop", "Restart", "Resize", "Reimage", "Delete". :vartype operation_name: str or ~azure.mgmt.machinelearningservices.models.OperationName :ivar operation_time: Time of the last operation. :vartype operation_time: ~datetime.datetime :ivar operation_status: Operation status. Possible values include: "InProgress", "Succeeded", - "CreateFailed", "StartFailed", "StopFailed", "RestartFailed", "ReimageFailed", "DeleteFailed". + "CreateFailed", "StartFailed", "StopFailed", "RestartFailed", "ResizeFailed", "ReimageFailed", + "DeleteFailed". :vartype operation_status: str or ~azure.mgmt.machinelearningservices.models.OperationStatus :ivar operation_trigger: Trigger of operation. Possible values include: "User", "Schedule", "IdleShutdown". @@ -6924,13 +7177,13 @@ def __init__( ): """ :keyword operation_name: Name of the last operation. Possible values include: "Create", - "Start", "Stop", "Restart", "Reimage", "Delete". + "Start", "Stop", "Restart", "Resize", "Reimage", "Delete". :paramtype operation_name: str or ~azure.mgmt.machinelearningservices.models.OperationName :keyword operation_time: Time of the last operation. :paramtype operation_time: ~datetime.datetime :keyword operation_status: Operation status. Possible values include: "InProgress", - "Succeeded", "CreateFailed", "StartFailed", "StopFailed", "RestartFailed", "ReimageFailed", - "DeleteFailed". + "Succeeded", "CreateFailed", "StartFailed", "StopFailed", "RestartFailed", "ResizeFailed", + "ReimageFailed", "DeleteFailed". :paramtype operation_status: str or ~azure.mgmt.machinelearningservices.models.OperationStatus :keyword operation_trigger: Trigger of operation. Possible values include: "User", "Schedule", "IdleShutdown". @@ -6960,6 +7213,9 @@ class ComputeInstanceProperties(msrest.serialization.Model): value: "Shared". :vartype application_sharing_policy: str or ~azure.mgmt.machinelearningservices.models.ApplicationSharingPolicy + :ivar autologger_settings: Specifies settings for autologger. + :vartype autologger_settings: + ~azure.mgmt.machinelearningservices.models.ComputeInstanceAutologgerSettings :ivar ssh_settings: Specifies policy and settings for SSH access. :vartype ssh_settings: ~azure.mgmt.machinelearningservices.models.ComputeInstanceSshSettings :ivar custom_services: List of Custom Services added to the compute. @@ -6980,13 +7236,24 @@ class ComputeInstanceProperties(msrest.serialization.Model): :ivar errors: Collection of errors encountered on this ComputeInstance. :vartype errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] :ivar state: The current state of this ComputeInstance. Possible values include: "Creating", - "CreateFailed", "Deleting", "Running", "Restarting", "JobRunning", "SettingUp", "SetupFailed", - "Starting", "Stopped", "Stopping", "UserSettingUp", "UserSetupFailed", "Unknown", "Unusable". + "CreateFailed", "Deleting", "Running", "Restarting", "Resizing", "JobRunning", "SettingUp", + "SetupFailed", "Starting", "Stopped", "Stopping", "UserSettingUp", "UserSetupFailed", + "Unknown", "Unusable". :vartype state: str or ~azure.mgmt.machinelearningservices.models.ComputeInstanceState :ivar compute_instance_authorization_type: The Compute Instance Authorization type. Available values are personal (default). Possible values include: "personal". Default value: "personal". :vartype compute_instance_authorization_type: str or ~azure.mgmt.machinelearningservices.models.ComputeInstanceAuthorizationType + :ivar enable_os_patching: Enable Auto OS Patching. Possible values are: true, false. + :vartype enable_os_patching: bool + :ivar enable_root_access: Enable root access. Possible values are: true, false. + :vartype enable_root_access: bool + :ivar enable_sso: Enable SSO (single sign on). Possible values are: true, false. + :vartype enable_sso: bool + :ivar release_quota_on_stop: Release quota if compute instance stopped. Possible values are: + true - release quota if compute instance stopped. false - don't release quota when compute + instance stopped. + :vartype release_quota_on_stop: bool :ivar personal_compute_instance_settings: Settings for a personal compute instance. :vartype personal_compute_instance_settings: ~azure.mgmt.machinelearningservices.models.PersonalComputeInstanceSettings @@ -6997,6 +7264,9 @@ class ComputeInstanceProperties(msrest.serialization.Model): ~azure.mgmt.machinelearningservices.models.ComputeInstanceLastOperation :ivar schedules: The list of schedules to be applied on the computes. :vartype schedules: ~azure.mgmt.machinelearningservices.models.ComputeSchedules + :ivar idle_time_before_shutdown: Stops compute instance after user defined period of + inactivity. Time is defined in ISO8601 format. Minimum is 15 min, maximum is 3 days. + :vartype idle_time_before_shutdown: str :ivar enable_node_public_ip: Enable or disable node public IP address provisioning. Possible values are: Possible values are: true - Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will have a private endpoint and no @@ -7030,6 +7300,7 @@ class ComputeInstanceProperties(msrest.serialization.Model): 'vm_size': {'key': 'vmSize', 'type': 'str'}, 'subnet': {'key': 'subnet', 'type': 'ResourceId'}, 'application_sharing_policy': {'key': 'applicationSharingPolicy', 'type': 'str'}, + 'autologger_settings': {'key': 'autologgerSettings', 'type': 'ComputeInstanceAutologgerSettings'}, 'ssh_settings': {'key': 'sshSettings', 'type': 'ComputeInstanceSshSettings'}, 'custom_services': {'key': 'customServices', 'type': '[CustomService]'}, 'os_image_metadata': {'key': 'osImageMetadata', 'type': 'ImageMetadata'}, @@ -7039,10 +7310,15 @@ class ComputeInstanceProperties(msrest.serialization.Model): 'errors': {'key': 'errors', 'type': '[ErrorResponse]'}, 'state': {'key': 'state', 'type': 'str'}, 'compute_instance_authorization_type': {'key': 'computeInstanceAuthorizationType', 'type': 'str'}, + 'enable_os_patching': {'key': 'enableOSPatching', 'type': 'bool'}, + 'enable_root_access': {'key': 'enableRootAccess', 'type': 'bool'}, + 'enable_sso': {'key': 'enableSSO', 'type': 'bool'}, + 'release_quota_on_stop': {'key': 'releaseQuotaOnStop', 'type': 'bool'}, 'personal_compute_instance_settings': {'key': 'personalComputeInstanceSettings', 'type': 'PersonalComputeInstanceSettings'}, 'setup_scripts': {'key': 'setupScripts', 'type': 'SetupScripts'}, 'last_operation': {'key': 'lastOperation', 'type': 'ComputeInstanceLastOperation'}, 'schedules': {'key': 'schedules', 'type': 'ComputeSchedules'}, + 'idle_time_before_shutdown': {'key': 'idleTimeBeforeShutdown', 'type': 'str'}, 'enable_node_public_ip': {'key': 'enableNodePublicIp', 'type': 'bool'}, 'containers': {'key': 'containers', 'type': '[ComputeInstanceContainer]'}, 'data_disks': {'key': 'dataDisks', 'type': '[ComputeInstanceDataDisk]'}, @@ -7066,6 +7342,9 @@ def __init__( value: "Shared". :paramtype application_sharing_policy: str or ~azure.mgmt.machinelearningservices.models.ApplicationSharingPolicy + :keyword autologger_settings: Specifies settings for autologger. + :paramtype autologger_settings: + ~azure.mgmt.machinelearningservices.models.ComputeInstanceAutologgerSettings :keyword ssh_settings: Specifies policy and settings for SSH access. :paramtype ssh_settings: ~azure.mgmt.machinelearningservices.models.ComputeInstanceSshSettings :keyword custom_services: List of Custom Services added to the compute. @@ -7075,6 +7354,16 @@ def __init__( "personal". :paramtype compute_instance_authorization_type: str or ~azure.mgmt.machinelearningservices.models.ComputeInstanceAuthorizationType + :keyword enable_os_patching: Enable Auto OS Patching. Possible values are: true, false. + :paramtype enable_os_patching: bool + :keyword enable_root_access: Enable root access. Possible values are: true, false. + :paramtype enable_root_access: bool + :keyword enable_sso: Enable SSO (single sign on). Possible values are: true, false. + :paramtype enable_sso: bool + :keyword release_quota_on_stop: Release quota if compute instance stopped. Possible values are: + true - release quota if compute instance stopped. false - don't release quota when compute + instance stopped. + :paramtype release_quota_on_stop: bool :keyword personal_compute_instance_settings: Settings for a personal compute instance. :paramtype personal_compute_instance_settings: ~azure.mgmt.machinelearningservices.models.PersonalComputeInstanceSettings @@ -7082,6 +7371,9 @@ def __init__( :paramtype setup_scripts: ~azure.mgmt.machinelearningservices.models.SetupScripts :keyword schedules: The list of schedules to be applied on the computes. :paramtype schedules: ~azure.mgmt.machinelearningservices.models.ComputeSchedules + :keyword idle_time_before_shutdown: Stops compute instance after user defined period of + inactivity. Time is defined in ISO8601 format. Minimum is 15 min, maximum is 3 days. + :paramtype idle_time_before_shutdown: str :keyword enable_node_public_ip: Enable or disable node public IP address provisioning. Possible values are: Possible values are: true - Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will have a private endpoint and no @@ -7092,6 +7384,7 @@ def __init__( self.vm_size = kwargs.get('vm_size', None) self.subnet = kwargs.get('subnet', None) self.application_sharing_policy = kwargs.get('application_sharing_policy', "Shared") + self.autologger_settings = kwargs.get('autologger_settings', None) self.ssh_settings = kwargs.get('ssh_settings', None) self.custom_services = kwargs.get('custom_services', None) self.os_image_metadata = None @@ -7101,10 +7394,15 @@ def __init__( self.errors = None self.state = None self.compute_instance_authorization_type = kwargs.get('compute_instance_authorization_type', "personal") + self.enable_os_patching = kwargs.get('enable_os_patching', False) + self.enable_root_access = kwargs.get('enable_root_access', True) + self.enable_sso = kwargs.get('enable_sso', True) + self.release_quota_on_stop = kwargs.get('release_quota_on_stop', False) self.personal_compute_instance_settings = kwargs.get('personal_compute_instance_settings', None) self.setup_scripts = kwargs.get('setup_scripts', None) self.last_operation = None self.schedules = kwargs.get('schedules', None) + self.idle_time_before_shutdown = kwargs.get('idle_time_before_shutdown', None) self.enable_node_public_ip = kwargs.get('enable_node_public_ip', None) self.containers = None self.data_disks = None @@ -7334,7 +7632,7 @@ def __init__( class ComputeRuntimeDto(msrest.serialization.Model): - """Compute runtime config for feature store type workspace. + """ComputeRuntimeDto. :ivar spark_runtime_version: :vartype spark_runtime_version: str @@ -7562,52 +7860,40 @@ def __init__( self.content_safety_status = kwargs['content_safety_status'] -class CosmosDbSettings(msrest.serialization.Model): - """CosmosDbSettings. - - :ivar collections_throughput: The throughput of the collections in cosmosdb database. - :vartype collections_throughput: int - """ - - _attribute_map = { - 'collections_throughput': {'key': 'collectionsThroughput', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword collections_throughput: The throughput of the collections in cosmosdb database. - :paramtype collections_throughput: int - """ - super(CosmosDbSettings, self).__init__(**kwargs) - self.collections_throughput = kwargs.get('collections_throughput', None) - - -class ScheduleActionBase(msrest.serialization.Model): - """ScheduleActionBase. +class EndpointDeploymentResourceProperties(msrest.serialization.Model): + """EndpointDeploymentResourceProperties. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: JobScheduleAction, CreateMonitorAction, EndpointScheduleAction. + sub-classes are: ContentSafetyEndpointDeploymentResourceProperties, OpenAIEndpointDeploymentResourceProperties, SpeechEndpointDeploymentResourceProperties, ManagedOnlineEndpointDeploymentResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar action_type: Required. [Required] Specifies the action type of the schedule.Constant - filled by server. Possible values include: "CreateJob", "InvokeBatchEndpoint", "CreateMonitor". - :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Required. Kind of the deployment.Constant filled by server. + :vartype type: str """ _validation = { - 'action_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, } _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } _subtype_map = { - 'action_type': {'CreateJob': 'JobScheduleAction', 'CreateMonitor': 'CreateMonitorAction', 'InvokeBatchEndpoint': 'EndpointScheduleAction'} + 'type': {'Azure.ContentSafety': 'ContentSafetyEndpointDeploymentResourceProperties', 'Azure.OpenAI': 'OpenAIEndpointDeploymentResourceProperties', 'Azure.Speech': 'SpeechEndpointDeploymentResourceProperties', 'managedOnlineEndpoint': 'ManagedOnlineEndpointDeploymentResourceProperties'} } def __init__( @@ -7615,31 +7901,54 @@ def __init__( **kwargs ): """ + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str """ - super(ScheduleActionBase, self).__init__(**kwargs) - self.action_type = None # type: Optional[str] + super(EndpointDeploymentResourceProperties, self).__init__(**kwargs) + self.failure_reason = kwargs.get('failure_reason', None) + self.provisioning_state = None + self.type = None # type: Optional[str] -class CreateMonitorAction(ScheduleActionBase): - """CreateMonitorAction. +class ContentSafetyEndpointDeploymentResourceProperties(EndpointDeploymentResourceProperties, CognitiveServiceEndpointDeploymentResourceProperties): + """ContentSafetyEndpointDeploymentResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar action_type: Required. [Required] Specifies the action type of the schedule.Constant - filled by server. Possible values include: "CreateJob", "InvokeBatchEndpoint", "CreateMonitor". - :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType - :ivar monitor_definition: Required. [Required] Defines the monitor. - :vartype monitor_definition: ~azure.mgmt.machinelearningservices.models.MonitorDefinition + :ivar model: Required. Model used for the endpoint deployment. + :vartype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar version_upgrade_option: Deployment model version upgrade option. Possible values include: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Required. Kind of the deployment.Constant filled by server. + :vartype type: str """ _validation = { - 'action_type': {'required': True}, - 'monitor_definition': {'required': True}, + 'model': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, } _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'str'}, - 'monitor_definition': {'key': 'monitorDefinition', 'type': 'MonitorDefinition'}, + 'model': {'key': 'model', 'type': 'EndpointDeploymentModel'}, + 'rai_policy_name': {'key': 'raiPolicyName', 'type': 'str'}, + 'version_upgrade_option': {'key': 'versionUpgradeOption', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( @@ -7647,10 +7956,304 @@ def __init__( **kwargs ): """ - :keyword monitor_definition: Required. [Required] Defines the monitor. - :paramtype monitor_definition: ~azure.mgmt.machinelearningservices.models.MonitorDefinition + :keyword model: Required. Model used for the endpoint deployment. + :paramtype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :keyword rai_policy_name: The name of RAI policy. + :paramtype rai_policy_name: str + :keyword version_upgrade_option: Deployment model version upgrade option. Possible values + include: "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :paramtype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str """ - super(CreateMonitorAction, self).__init__(**kwargs) + super(ContentSafetyEndpointDeploymentResourceProperties, self).__init__(**kwargs) + self.model = kwargs['model'] + self.rai_policy_name = kwargs.get('rai_policy_name', None) + self.version_upgrade_option = kwargs.get('version_upgrade_option', None) + self.type = 'Azure.ContentSafety' # type: str + self.failure_reason = kwargs.get('failure_reason', None) + self.provisioning_state = None + + +class EndpointResourceProperties(msrest.serialization.Model): + """EndpointResourceProperties. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ContentSafetyEndpointResourceProperties, OpenAIEndpointResourceProperties, SpeechEndpointResourceProperties, ManagedOnlineEndpointResourceProperties, ServerlessEndpointResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Required. Type of the endpoint.Constant filled by server. Possible values + include: "Azure.OpenAI", "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", + "managedOnlineEndpoint", "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool + """ + + _validation = { + 'endpoint_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'associated_resource_id': {'key': 'associatedResourceId', 'type': 'str'}, + 'deployments': {'key': 'deployments', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'should_create_ai_services_endpoint': {'key': 'shouldCreateAiServicesEndpoint', 'type': 'bool'}, + } + + _subtype_map = { + 'endpoint_type': {'Azure.ContentSafety': 'ContentSafetyEndpointResourceProperties', 'Azure.OpenAI': 'OpenAIEndpointResourceProperties', 'Azure.Speech': 'SpeechEndpointResourceProperties', 'managedOnlineEndpoint': 'ManagedOnlineEndpointResourceProperties', 'serverlessEndpoint': 'ServerlessEndpointResourceProperties'} + } + + def __init__( + self, + **kwargs + ): + """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + """ + super(EndpointResourceProperties, self).__init__(**kwargs) + self.associated_resource_id = kwargs.get('associated_resource_id', None) + self.deployments = kwargs.get('deployments', None) + self.endpoint_type = None # type: Optional[str] + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.failure_reason = kwargs.get('failure_reason', None) + self.location = kwargs.get('location', None) + self.name = kwargs.get('name', None) + self.provisioning_state = None + self.should_create_ai_services_endpoint = kwargs.get('should_create_ai_services_endpoint', None) + + +class ContentSafetyEndpointResourceProperties(EndpointResourceProperties): + """ContentSafetyEndpointResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Required. Type of the endpoint.Constant filled by server. Possible values + include: "Azure.OpenAI", "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", + "managedOnlineEndpoint", "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool + """ + + _validation = { + 'endpoint_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'associated_resource_id': {'key': 'associatedResourceId', 'type': 'str'}, + 'deployments': {'key': 'deployments', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'should_create_ai_services_endpoint': {'key': 'shouldCreateAiServicesEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + """ + super(ContentSafetyEndpointResourceProperties, self).__init__(**kwargs) + self.endpoint_type = 'Azure.ContentSafety' # type: str + + +class CosmosDbSettings(msrest.serialization.Model): + """CosmosDbSettings. + + :ivar collections_throughput: + :vartype collections_throughput: int + """ + + _attribute_map = { + 'collections_throughput': {'key': 'collectionsThroughput', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword collections_throughput: + :paramtype collections_throughput: int + """ + super(CosmosDbSettings, self).__init__(**kwargs) + self.collections_throughput = kwargs.get('collections_throughput', None) + + +class ScheduleActionBase(msrest.serialization.Model): + """ScheduleActionBase. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: JobScheduleAction, CreateMonitorAction, EndpointScheduleAction. + + All required parameters must be populated in order to send to Azure. + + :ivar action_type: Required. [Required] Specifies the action type of the schedule.Constant + filled by server. Possible values include: "CreateJob", "InvokeBatchEndpoint", "CreateMonitor". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType + """ + + _validation = { + 'action_type': {'required': True}, + } + + _attribute_map = { + 'action_type': {'key': 'actionType', 'type': 'str'}, + } + + _subtype_map = { + 'action_type': {'CreateJob': 'JobScheduleAction', 'CreateMonitor': 'CreateMonitorAction', 'InvokeBatchEndpoint': 'EndpointScheduleAction'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ScheduleActionBase, self).__init__(**kwargs) + self.action_type = None # type: Optional[str] + + +class CreateMonitorAction(ScheduleActionBase): + """CreateMonitorAction. + + All required parameters must be populated in order to send to Azure. + + :ivar action_type: Required. [Required] Specifies the action type of the schedule.Constant + filled by server. Possible values include: "CreateJob", "InvokeBatchEndpoint", "CreateMonitor". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType + :ivar monitor_definition: Required. [Required] Defines the monitor. + :vartype monitor_definition: ~azure.mgmt.machinelearningservices.models.MonitorDefinition + """ + + _validation = { + 'action_type': {'required': True}, + 'monitor_definition': {'required': True}, + } + + _attribute_map = { + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'monitor_definition': {'key': 'monitorDefinition', 'type': 'MonitorDefinition'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword monitor_definition: Required. [Required] Defines the monitor. + :paramtype monitor_definition: ~azure.mgmt.machinelearningservices.models.MonitorDefinition + """ + super(CreateMonitorAction, self).__init__(**kwargs) self.action_type = 'CreateMonitor' # type: str self.monitor_definition = kwargs['monitor_definition'] @@ -7900,7 +8503,7 @@ class CustomKeysWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -7915,10 +8518,12 @@ class CustomKeysWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -7926,16 +8531,18 @@ class CustomKeysWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: Custom Keys credential object. :vartype credentials: ~azure.mgmt.machinelearningservices.models.CustomKeys """ @@ -7950,14 +8557,16 @@ class CustomKeysWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'CustomKeys'}, } @@ -7968,7 +8577,7 @@ def __init__( """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -7983,23 +8592,27 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: Custom Keys credential object. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.CustomKeys """ @@ -8446,6 +9059,8 @@ class CustomService(msrest.serialization.Model): :vartype endpoints: list[~azure.mgmt.machinelearningservices.models.Endpoint] :ivar volumes: Configuring the volumes for the container. :vartype volumes: list[~azure.mgmt.machinelearningservices.models.VolumeDefinition] + :ivar kernel: Describes the jupyter kernel settings for the image if its a custom environment. + :vartype kernel: ~azure.mgmt.machinelearningservices.models.JupyterKernelConfig """ _attribute_map = { @@ -8456,6 +9071,7 @@ class CustomService(msrest.serialization.Model): 'docker': {'key': 'docker', 'type': 'Docker'}, 'endpoints': {'key': 'endpoints', 'type': '[Endpoint]'}, 'volumes': {'key': 'volumes', 'type': '[VolumeDefinition]'}, + 'kernel': {'key': 'kernel', 'type': 'JupyterKernelConfig'}, } def __init__( @@ -8479,6 +9095,9 @@ def __init__( :paramtype endpoints: list[~azure.mgmt.machinelearningservices.models.Endpoint] :keyword volumes: Configuring the volumes for the container. :paramtype volumes: list[~azure.mgmt.machinelearningservices.models.VolumeDefinition] + :keyword kernel: Describes the jupyter kernel settings for the image if its a custom + environment. + :paramtype kernel: ~azure.mgmt.machinelearningservices.models.JupyterKernelConfig """ super(CustomService, self).__init__(**kwargs) self.additional_properties = kwargs.get('additional_properties', None) @@ -8488,6 +9107,7 @@ def __init__( self.docker = kwargs.get('docker', None) self.endpoints = kwargs.get('endpoints', None) self.volumes = kwargs.get('volumes', None) + self.kernel = kwargs.get('kernel', None) class CustomTargetLags(TargetLags): @@ -9859,36 +10479,40 @@ def __init__( class DiagnoseRequestProperties(msrest.serialization.Model): """DiagnoseRequestProperties. - :ivar udr: Setting for diagnosing user defined routing. - :vartype udr: dict[str, any] - :ivar nsg: Setting for diagnosing network security group. - :vartype nsg: dict[str, any] - :ivar resource_lock: Setting for diagnosing resource lock. - :vartype resource_lock: dict[str, any] + :ivar application_insights: Setting for diagnosing dependent application insights. + :vartype application_insights: dict[str, any] + :ivar container_registry: Setting for diagnosing dependent container registry. + :vartype container_registry: dict[str, any] :ivar dns_resolution: Setting for diagnosing dns resolution. :vartype dns_resolution: dict[str, any] - :ivar storage_account: Setting for diagnosing dependent storage account. - :vartype storage_account: dict[str, any] :ivar key_vault: Setting for diagnosing dependent key vault. :vartype key_vault: dict[str, any] - :ivar container_registry: Setting for diagnosing dependent container registry. - :vartype container_registry: dict[str, any] - :ivar application_insights: Setting for diagnosing dependent application insights. - :vartype application_insights: dict[str, any] + :ivar nsg: Setting for diagnosing network security group. + :vartype nsg: dict[str, any] :ivar others: Setting for diagnosing unclassified category of problems. :vartype others: dict[str, any] + :ivar required_resource_providers: Setting for diagnosing the presence of required resource + providers in the workspace. + :vartype required_resource_providers: dict[str, any] + :ivar resource_lock: Setting for diagnosing resource lock. + :vartype resource_lock: dict[str, any] + :ivar storage_account: Setting for diagnosing dependent storage account. + :vartype storage_account: dict[str, any] + :ivar udr: Setting for diagnosing user defined routing. + :vartype udr: dict[str, any] """ _attribute_map = { - 'udr': {'key': 'udr', 'type': '{object}'}, - 'nsg': {'key': 'nsg', 'type': '{object}'}, - 'resource_lock': {'key': 'resourceLock', 'type': '{object}'}, + 'application_insights': {'key': 'applicationInsights', 'type': '{object}'}, + 'container_registry': {'key': 'containerRegistry', 'type': '{object}'}, 'dns_resolution': {'key': 'dnsResolution', 'type': '{object}'}, - 'storage_account': {'key': 'storageAccount', 'type': '{object}'}, 'key_vault': {'key': 'keyVault', 'type': '{object}'}, - 'container_registry': {'key': 'containerRegistry', 'type': '{object}'}, - 'application_insights': {'key': 'applicationInsights', 'type': '{object}'}, + 'nsg': {'key': 'nsg', 'type': '{object}'}, 'others': {'key': 'others', 'type': '{object}'}, + 'required_resource_providers': {'key': 'requiredResourceProviders', 'type': '{object}'}, + 'resource_lock': {'key': 'resourceLock', 'type': '{object}'}, + 'storage_account': {'key': 'storageAccount', 'type': '{object}'}, + 'udr': {'key': 'udr', 'type': '{object}'}, } def __init__( @@ -9896,35 +10520,39 @@ def __init__( **kwargs ): """ - :keyword udr: Setting for diagnosing user defined routing. - :paramtype udr: dict[str, any] - :keyword nsg: Setting for diagnosing network security group. - :paramtype nsg: dict[str, any] - :keyword resource_lock: Setting for diagnosing resource lock. - :paramtype resource_lock: dict[str, any] + :keyword application_insights: Setting for diagnosing dependent application insights. + :paramtype application_insights: dict[str, any] + :keyword container_registry: Setting for diagnosing dependent container registry. + :paramtype container_registry: dict[str, any] :keyword dns_resolution: Setting for diagnosing dns resolution. :paramtype dns_resolution: dict[str, any] - :keyword storage_account: Setting for diagnosing dependent storage account. - :paramtype storage_account: dict[str, any] :keyword key_vault: Setting for diagnosing dependent key vault. :paramtype key_vault: dict[str, any] - :keyword container_registry: Setting for diagnosing dependent container registry. - :paramtype container_registry: dict[str, any] - :keyword application_insights: Setting for diagnosing dependent application insights. - :paramtype application_insights: dict[str, any] + :keyword nsg: Setting for diagnosing network security group. + :paramtype nsg: dict[str, any] :keyword others: Setting for diagnosing unclassified category of problems. :paramtype others: dict[str, any] + :keyword required_resource_providers: Setting for diagnosing the presence of required resource + providers in the workspace. + :paramtype required_resource_providers: dict[str, any] + :keyword resource_lock: Setting for diagnosing resource lock. + :paramtype resource_lock: dict[str, any] + :keyword storage_account: Setting for diagnosing dependent storage account. + :paramtype storage_account: dict[str, any] + :keyword udr: Setting for diagnosing user defined routing. + :paramtype udr: dict[str, any] """ super(DiagnoseRequestProperties, self).__init__(**kwargs) - self.udr = kwargs.get('udr', None) - self.nsg = kwargs.get('nsg', None) - self.resource_lock = kwargs.get('resource_lock', None) + self.application_insights = kwargs.get('application_insights', None) + self.container_registry = kwargs.get('container_registry', None) self.dns_resolution = kwargs.get('dns_resolution', None) - self.storage_account = kwargs.get('storage_account', None) self.key_vault = kwargs.get('key_vault', None) - self.container_registry = kwargs.get('container_registry', None) - self.application_insights = kwargs.get('application_insights', None) + self.nsg = kwargs.get('nsg', None) self.others = kwargs.get('others', None) + self.required_resource_providers = kwargs.get('required_resource_providers', None) + self.resource_lock = kwargs.get('resource_lock', None) + self.storage_account = kwargs.get('storage_account', None) + self.udr = kwargs.get('udr', None) class DiagnoseResponseResult(msrest.serialization.Model): @@ -10075,7 +10703,7 @@ def __init__( class DiagnoseWorkspaceParameters(msrest.serialization.Model): """Parameters to diagnose a workspace. - :ivar value: Value of Parameters. + :ivar value: :vartype value: ~azure.mgmt.machinelearningservices.models.DiagnoseRequestProperties """ @@ -10088,7 +10716,7 @@ def __init__( **kwargs ): """ - :keyword value: Value of Parameters. + :keyword value: :paramtype value: ~azure.mgmt.machinelearningservices.models.DiagnoseRequestProperties """ super(DiagnoseWorkspaceParameters, self).__init__(**kwargs) @@ -10131,7 +10759,7 @@ def __init__( class Docker(msrest.serialization.Model): - """Docker container configuration. + """Docker. :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -10203,54 +10831,8 @@ def __init__( self.user_name = kwargs.get('user_name', None) -class EncryptionKeyVaultProperties(msrest.serialization.Model): - """EncryptionKeyVaultProperties. - - All required parameters must be populated in order to send to Azure. - - :ivar key_vault_arm_id: Required. The ArmId of the keyVault where the customer owned encryption - key is present. - :vartype key_vault_arm_id: str - :ivar key_identifier: Required. Key vault uri to access the encryption key. - :vartype key_identifier: str - :ivar identity_client_id: For future use - The client id of the identity which will be used to - access key vault. - :vartype identity_client_id: str - """ - - _validation = { - 'key_vault_arm_id': {'required': True}, - 'key_identifier': {'required': True}, - } - - _attribute_map = { - 'key_vault_arm_id': {'key': 'keyVaultArmId', 'type': 'str'}, - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'identity_client_id': {'key': 'identityClientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword key_vault_arm_id: Required. The ArmId of the keyVault where the customer owned - encryption key is present. - :paramtype key_vault_arm_id: str - :keyword key_identifier: Required. Key vault uri to access the encryption key. - :paramtype key_identifier: str - :keyword identity_client_id: For future use - The client id of the identity which will be used - to access key vault. - :paramtype identity_client_id: str - """ - super(EncryptionKeyVaultProperties, self).__init__(**kwargs) - self.key_vault_arm_id = kwargs['key_vault_arm_id'] - self.key_identifier = kwargs['key_identifier'] - self.identity_client_id = kwargs.get('identity_client_id', None) - - -class EncryptionKeyVaultUpdateProperties(msrest.serialization.Model): - """EncryptionKeyVaultUpdateProperties. +class EncryptionKeyVaultUpdateProperties(msrest.serialization.Model): + """EncryptionKeyVaultUpdateProperties. All required parameters must be populated in order to send to Azure. @@ -10283,25 +10865,39 @@ class EncryptionProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. + :ivar cosmos_db_resource_id: The byok cosmosdb account that customer brings to store customer's + data + with encryption. + :vartype cosmos_db_resource_id: str + :ivar identity: Identity to be used with the keyVault. + :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityForCmk + :ivar key_vault_properties: Required. KeyVault details to do the encryption. + :vartype key_vault_properties: ~azure.mgmt.machinelearningservices.models.KeyVaultProperties + :ivar search_account_resource_id: The byok search account that customer brings to store + customer's data + with encryption. + :vartype search_account_resource_id: str :ivar status: Required. Indicates whether or not the encryption is enabled for the workspace. Possible values include: "Enabled", "Disabled". :vartype status: str or ~azure.mgmt.machinelearningservices.models.EncryptionStatus - :ivar identity: The identity that will be used to access the key vault for encryption at rest. - :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityForCmk - :ivar key_vault_properties: Required. Customer Key vault properties. - :vartype key_vault_properties: - ~azure.mgmt.machinelearningservices.models.EncryptionKeyVaultProperties + :ivar storage_account_resource_id: The byok storage account that customer brings to store + customer's data + with encryption. + :vartype storage_account_resource_id: str """ _validation = { - 'status': {'required': True}, 'key_vault_properties': {'required': True}, + 'status': {'required': True}, } _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, + 'cosmos_db_resource_id': {'key': 'cosmosDbResourceId', 'type': 'str'}, 'identity': {'key': 'identity', 'type': 'IdentityForCmk'}, - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'EncryptionKeyVaultProperties'}, + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, + 'search_account_resource_id': {'key': 'searchAccountResourceId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'storage_account_resource_id': {'key': 'storageAccountResourceId', 'type': 'str'}, } def __init__( @@ -10309,20 +10905,33 @@ def __init__( **kwargs ): """ + :keyword cosmos_db_resource_id: The byok cosmosdb account that customer brings to store + customer's data + with encryption. + :paramtype cosmos_db_resource_id: str + :keyword identity: Identity to be used with the keyVault. + :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityForCmk + :keyword key_vault_properties: Required. KeyVault details to do the encryption. + :paramtype key_vault_properties: ~azure.mgmt.machinelearningservices.models.KeyVaultProperties + :keyword search_account_resource_id: The byok search account that customer brings to store + customer's data + with encryption. + :paramtype search_account_resource_id: str :keyword status: Required. Indicates whether or not the encryption is enabled for the workspace. Possible values include: "Enabled", "Disabled". :paramtype status: str or ~azure.mgmt.machinelearningservices.models.EncryptionStatus - :keyword identity: The identity that will be used to access the key vault for encryption at - rest. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityForCmk - :keyword key_vault_properties: Required. Customer Key vault properties. - :paramtype key_vault_properties: - ~azure.mgmt.machinelearningservices.models.EncryptionKeyVaultProperties + :keyword storage_account_resource_id: The byok storage account that customer brings to store + customer's data + with encryption. + :paramtype storage_account_resource_id: str """ super(EncryptionProperty, self).__init__(**kwargs) - self.status = kwargs['status'] + self.cosmos_db_resource_id = kwargs.get('cosmos_db_resource_id', None) self.identity = kwargs.get('identity', None) self.key_vault_properties = kwargs['key_vault_properties'] + self.search_account_resource_id = kwargs.get('search_account_resource_id', None) + self.status = kwargs['status'] + self.storage_account_resource_id = kwargs.get('storage_account_resource_id', None) class EncryptionUpdateProperties(msrest.serialization.Model): @@ -10357,7 +10966,7 @@ def __init__( class Endpoint(msrest.serialization.Model): - """Describes the endpoint configuration for the container. + """Endpoint. :ivar protocol: Protocol over which communication will happen over this endpoint. Possible values include: "tcp", "udp", "http". Default value: "tcp". @@ -10475,32 +11084,24 @@ def __init__( self.token_type = kwargs.get('token_type', None) -class EndpointScheduleAction(ScheduleActionBase): - """EndpointScheduleAction. - - All required parameters must be populated in order to send to Azure. +class EndpointDeploymentModel(msrest.serialization.Model): + """EndpointDeploymentModel. - :ivar action_type: Required. [Required] Specifies the action type of the schedule.Constant - filled by server. Possible values include: "CreateJob", "InvokeBatchEndpoint", "CreateMonitor". - :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType - :ivar endpoint_invocation_definition: Required. [Required] Defines Schedule action definition - details. - - - .. raw:: html - - . - :vartype endpoint_invocation_definition: any + :ivar format: Model format. + :vartype format: str + :ivar name: Model name. + :vartype name: str + :ivar source: Optional. Deployment model source ARM resource ID. + :vartype source: str + :ivar version: Model version. + :vartype version: str """ - _validation = { - 'action_type': {'required': True}, - 'endpoint_invocation_definition': {'required': True}, - } - _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'str'}, - 'endpoint_invocation_definition': {'key': 'endpointInvocationDefinition', 'type': 'object'}, + 'format': {'key': 'format', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, } def __init__( @@ -10508,22 +11109,24 @@ def __init__( **kwargs ): """ - :keyword endpoint_invocation_definition: Required. [Required] Defines Schedule action - definition details. - - - .. raw:: html - - . - :paramtype endpoint_invocation_definition: any + :keyword format: Model format. + :paramtype format: str + :keyword name: Model name. + :paramtype name: str + :keyword source: Optional. Deployment model source ARM resource ID. + :paramtype source: str + :keyword version: Model version. + :paramtype version: str """ - super(EndpointScheduleAction, self).__init__(**kwargs) - self.action_type = 'InvokeBatchEndpoint' # type: str - self.endpoint_invocation_definition = kwargs['endpoint_invocation_definition'] + super(EndpointDeploymentModel, self).__init__(**kwargs) + self.format = kwargs.get('format', None) + self.name = kwargs.get('name', None) + self.source = kwargs.get('source', None) + self.version = kwargs.get('version', None) -class EnvironmentContainer(ProxyResource): - """Azure Resource Manager resource envelope. +class EndpointDeploymentResourcePropertiesBasicResource(Resource): + """EndpointDeploymentResourcePropertiesBasicResource. Variables are only populated by the server, and will be ignored when sending a request. @@ -10540,8 +11143,9 @@ class EnvironmentContainer(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties + :ivar properties: Required. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourceProperties """ _validation = { @@ -10557,7 +11161,7 @@ class EnvironmentContainer(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'EnvironmentContainerProperties'}, + 'properties': {'key': 'properties', 'type': 'EndpointDeploymentResourceProperties'}, } def __init__( @@ -10565,51 +11169,27 @@ def __init__( **kwargs ): """ - :keyword properties: Required. [Required] Additional attributes of the entity. + :keyword properties: Required. :paramtype properties: - ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourceProperties """ - super(EnvironmentContainer, self).__init__(**kwargs) + super(EndpointDeploymentResourcePropertiesBasicResource, self).__init__(**kwargs) self.properties = kwargs['properties'] -class EnvironmentContainerProperties(AssetContainer): - """Container for environment specification versions. - - Variables are only populated by the server, and will be ignored when sending a request. +class EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult(msrest.serialization.Model): + """EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult. - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar latest_version: The latest version inside this container. - :vartype latest_version: str - :ivar next_version: The next auto incremental version. - :vartype next_version: str - :ivar provisioning_state: Provisioning state for the environment container. Possible values - include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] """ - _validation = { - 'latest_version': {'readonly': True}, - 'next_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'latest_version': {'key': 'latestVersion', 'type': 'str'}, - 'next_version': {'key': 'nextVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, } def __init__( @@ -10617,32 +11197,26 @@ def __init__( **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] """ - super(EnvironmentContainerProperties, self).__init__(**kwargs) - self.provisioning_state = None + super(EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) -class EnvironmentContainerResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of EnvironmentContainer entities. +class EndpointKeys(msrest.serialization.Model): + """EndpointKeys. - :ivar next_link: The link to the next page of EnvironmentContainer objects. If null, there are - no additional pages. - :vartype next_link: str - :ivar value: An array of objects of type EnvironmentContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :ivar keys: Dictionary of Keys for the endpoint. + :vartype keys: ~azure.mgmt.machinelearningservices.models.AccountApiKeys """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[EnvironmentContainer]'}, + 'keys': {'key': 'keys', 'type': 'AccountApiKeys'}, } def __init__( @@ -10650,34 +11224,25 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of EnvironmentContainer objects. If null, there - are no additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type EnvironmentContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :keyword keys: Dictionary of Keys for the endpoint. + :paramtype keys: ~azure.mgmt.machinelearningservices.models.AccountApiKeys """ - super(EnvironmentContainerResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) + super(EndpointKeys, self).__init__(**kwargs) + self.keys = kwargs.get('keys', None) -class EnvironmentVariable(msrest.serialization.Model): - """Environment Variables for the container. +class EndpointModelDeprecationProperties(msrest.serialization.Model): + """EndpointModelDeprecationProperties. - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, any] - :ivar type: Type of the Environment Variable. Possible values are: local - For local variable. - Possible values include: "local". Default value: "local". - :vartype type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentVariableType - :ivar value: Value of the Environment variable. - :vartype value: str + :ivar fine_tune: The datetime of deprecation of the fineTune Model. + :vartype fine_tune: ~datetime.datetime + :ivar inference: The datetime of deprecation of the inference Model. + :vartype inference: ~datetime.datetime """ _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, + 'fine_tune': {'key': 'fineTune', 'type': 'iso-8601'}, + 'inference': {'key': 'inference', 'type': 'iso-8601'}, } def __init__( @@ -10685,57 +11250,67 @@ def __init__( **kwargs ): """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, any] - :keyword type: Type of the Environment Variable. Possible values are: local - For local - variable. Possible values include: "local". Default value: "local". - :paramtype type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentVariableType - :keyword value: Value of the Environment variable. - :paramtype value: str + :keyword fine_tune: The datetime of deprecation of the fineTune Model. + :paramtype fine_tune: ~datetime.datetime + :keyword inference: The datetime of deprecation of the inference Model. + :paramtype inference: ~datetime.datetime """ - super(EnvironmentVariable, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.type = kwargs.get('type', "local") - self.value = kwargs.get('value', None) + super(EndpointModelDeprecationProperties, self).__init__(**kwargs) + self.fine_tune = kwargs.get('fine_tune', None) + self.inference = kwargs.get('inference', None) -class EnvironmentVersion(ProxyResource): - """Azure Resource Manager resource envelope. +class EndpointModelProperties(msrest.serialization.Model): + """Endpoint Model properties. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. + :ivar capabilities: The capabilities. + :vartype capabilities: dict[str, str] + :ivar deprecation: + :vartype deprecation: + ~azure.mgmt.machinelearningservices.models.EndpointModelDeprecationProperties + :ivar finetune_capabilities: The capabilities for finetune models. + :vartype finetune_capabilities: dict[str, str] + :ivar format: Deployment model format. + :vartype format: str + :ivar is_default_version: If the model is default version. + :vartype is_default_version: bool + :ivar lifecycle_status: Model lifecycle status. Possible values include: "GenerallyAvailable", + "Preview". + :vartype lifecycle_status: str or + ~azure.mgmt.machinelearningservices.models.ModelLifecycleStatus + :ivar max_capacity: The max capacity. + :vartype max_capacity: int + :ivar name: Deployment model name. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. + :ivar skus: The list of Model Sku. + :vartype skus: list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuProperties] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentVersionProperties + :ivar version: Optional. Deployment model version. If version is not specified, a default + version will be assigned. The default version is different for different models and might + change when there is new version available for a model. Default version for a model could be + found from list models API. + :vartype version: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, 'system_data': {'readonly': True}, - 'properties': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + 'capabilities': {'key': 'capabilities', 'type': '{str}'}, + 'deprecation': {'key': 'deprecation', 'type': 'EndpointModelDeprecationProperties'}, + 'finetune_capabilities': {'key': 'finetuneCapabilities', 'type': '{str}'}, + 'format': {'key': 'format', 'type': 'str'}, + 'is_default_version': {'key': 'isDefaultVersion', 'type': 'bool'}, + 'lifecycle_status': {'key': 'lifecycleStatus', 'type': 'str'}, + 'max_capacity': {'key': 'maxCapacity', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'skus': {'key': 'skus', 'type': '[EndpointModelSkuProperties]'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'EnvironmentVersionProperties'}, + 'version': {'key': 'version', 'type': 'str'}, } def __init__( @@ -10743,95 +11318,60 @@ def __init__( **kwargs ): """ - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentVersionProperties + :keyword capabilities: The capabilities. + :paramtype capabilities: dict[str, str] + :keyword deprecation: + :paramtype deprecation: + ~azure.mgmt.machinelearningservices.models.EndpointModelDeprecationProperties + :keyword finetune_capabilities: The capabilities for finetune models. + :paramtype finetune_capabilities: dict[str, str] + :keyword format: Deployment model format. + :paramtype format: str + :keyword is_default_version: If the model is default version. + :paramtype is_default_version: bool + :keyword lifecycle_status: Model lifecycle status. Possible values include: + "GenerallyAvailable", "Preview". + :paramtype lifecycle_status: str or + ~azure.mgmt.machinelearningservices.models.ModelLifecycleStatus + :keyword max_capacity: The max capacity. + :paramtype max_capacity: int + :keyword name: Deployment model name. + :paramtype name: str + :keyword skus: The list of Model Sku. + :paramtype skus: list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuProperties] + :keyword version: Optional. Deployment model version. If version is not specified, a default + version will be assigned. The default version is different for different models and might + change when there is new version available for a model. Default version for a model could be + found from list models API. + :paramtype version: str """ - super(EnvironmentVersion, self).__init__(**kwargs) - self.properties = kwargs['properties'] + super(EndpointModelProperties, self).__init__(**kwargs) + self.capabilities = kwargs.get('capabilities', None) + self.deprecation = kwargs.get('deprecation', None) + self.finetune_capabilities = kwargs.get('finetune_capabilities', None) + self.format = kwargs.get('format', None) + self.is_default_version = kwargs.get('is_default_version', None) + self.lifecycle_status = kwargs.get('lifecycle_status', None) + self.max_capacity = kwargs.get('max_capacity', None) + self.name = kwargs.get('name', None) + self.skus = kwargs.get('skus', None) + self.system_data = None + self.version = kwargs.get('version', None) -class EnvironmentVersionProperties(AssetBase): - """Environment version details. +class EndpointModels(msrest.serialization.Model): + """EndpointModels. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar auto_rebuild: Defines if image needs to be rebuilt based on base image changes. Possible - values include: "Disabled", "OnBaseImageUpdate". - :vartype auto_rebuild: str or ~azure.mgmt.machinelearningservices.models.AutoRebuildSetting - :ivar build: Configuration settings for Docker build context. - :vartype build: ~azure.mgmt.machinelearningservices.models.BuildContext - :ivar conda_file: Standard configuration file used by Conda that lets you install any kind of - package, including Python, R, and C/C++ packages. - - - .. raw:: html - - . - :vartype conda_file: str - :ivar environment_type: Environment type is either user managed or curated by the Azure ML - service - - - .. raw:: html - - . Possible values include: "Curated", "UserCreated". - :vartype environment_type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentType - :ivar image: Name of the image that will be used for the environment. - - - .. raw:: html - - . - :vartype image: str - :ivar inference_config: Defines configuration specific to inference. - :vartype inference_config: - ~azure.mgmt.machinelearningservices.models.InferenceContainerProperties - :ivar os_type: The OS type of the environment. Possible values include: "Linux", "Windows". - :vartype os_type: str or ~azure.mgmt.machinelearningservices.models.OperatingSystemType - :ivar provisioning_state: Provisioning state for the environment version. Possible values - include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState - :ivar stage: Stage in the environment lifecycle assigned to this environment. - :vartype stage: str - """ - - _validation = { - 'environment_type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } + :ivar next_link: The link to the next page constructed using the continuationToken. If null, + there are no additional pages. + :vartype next_link: str + :ivar value: List of models. + :vartype value: list[~azure.mgmt.machinelearningservices.models.EndpointModelProperties] + """ _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'auto_rebuild': {'key': 'autoRebuild', 'type': 'str'}, - 'build': {'key': 'build', 'type': 'BuildContext'}, - 'conda_file': {'key': 'condaFile', 'type': 'str'}, - 'environment_type': {'key': 'environmentType', 'type': 'str'}, - 'image': {'key': 'image', 'type': 'str'}, - 'inference_config': {'key': 'inferenceConfig', 'type': 'InferenceContainerProperties'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'stage': {'key': 'stage', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EndpointModelProperties]'}, } def __init__( @@ -10839,73 +11379,29 @@ def __init__( **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword auto_rebuild: Defines if image needs to be rebuilt based on base image changes. - Possible values include: "Disabled", "OnBaseImageUpdate". - :paramtype auto_rebuild: str or ~azure.mgmt.machinelearningservices.models.AutoRebuildSetting - :keyword build: Configuration settings for Docker build context. - :paramtype build: ~azure.mgmt.machinelearningservices.models.BuildContext - :keyword conda_file: Standard configuration file used by Conda that lets you install any kind - of package, including Python, R, and C/C++ packages. - - - .. raw:: html - - . - :paramtype conda_file: str - :keyword image: Name of the image that will be used for the environment. - - - .. raw:: html - - . - :paramtype image: str - :keyword inference_config: Defines configuration specific to inference. - :paramtype inference_config: - ~azure.mgmt.machinelearningservices.models.InferenceContainerProperties - :keyword os_type: The OS type of the environment. Possible values include: "Linux", "Windows". - :paramtype os_type: str or ~azure.mgmt.machinelearningservices.models.OperatingSystemType - :keyword stage: Stage in the environment lifecycle assigned to this environment. - :paramtype stage: str + :keyword next_link: The link to the next page constructed using the continuationToken. If + null, there are no additional pages. + :paramtype next_link: str + :keyword value: List of models. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.EndpointModelProperties] """ - super(EnvironmentVersionProperties, self).__init__(**kwargs) - self.auto_rebuild = kwargs.get('auto_rebuild', None) - self.build = kwargs.get('build', None) - self.conda_file = kwargs.get('conda_file', None) - self.environment_type = None - self.image = kwargs.get('image', None) - self.inference_config = kwargs.get('inference_config', None) - self.os_type = kwargs.get('os_type', None) - self.provisioning_state = None - self.stage = kwargs.get('stage', None) + super(EndpointModels, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) -class EnvironmentVersionResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of EnvironmentVersion entities. +class EndpointModelSkuCapacityProperties(msrest.serialization.Model): + """EndpointModelSkuCapacityProperties. - :ivar next_link: The link to the next page of EnvironmentVersion objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type EnvironmentVersion. - :vartype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :ivar default: The default capacity. + :vartype default: int + :ivar maximum: The maximum capacity. + :vartype maximum: int """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[EnvironmentVersion]'}, + 'default': {'key': 'default', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, } def __init__( @@ -10913,36 +11409,42 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of EnvironmentVersion objects. If null, there are - no additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type EnvironmentVersion. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :keyword default: The default capacity. + :paramtype default: int + :keyword maximum: The maximum capacity. + :paramtype maximum: int """ - super(EnvironmentVersionResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) + super(EndpointModelSkuCapacityProperties, self).__init__(**kwargs) + self.default = kwargs.get('default', None) + self.maximum = kwargs.get('maximum', None) -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. +class EndpointModelSkuProperties(msrest.serialization.Model): + """EndpointModelSkuProperties. - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any + :ivar capacity: + :vartype capacity: + ~azure.mgmt.machinelearningservices.models.EndpointModelSkuCapacityProperties + :ivar connection_ids: The list of ARM id for the connection support this SKU. + :vartype connection_ids: list[str] + :ivar deprecation_date: The datetime of deprecation of the model SKU. + :vartype deprecation_date: ~datetime.datetime + :ivar name: The name of the model SKU. + :vartype name: str + :ivar rate_limits: + :vartype rate_limits: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitProperties] + :ivar usage_name: The usage name of the model SKU. + :vartype usage_name: str """ - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + 'capacity': {'key': 'capacity', 'type': 'EndpointModelSkuCapacityProperties'}, + 'connection_ids': {'key': 'connectionIds', 'type': '[str]'}, + 'deprecation_date': {'key': 'deprecationDate', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'rate_limits': {'key': 'rateLimits', 'type': '[EndpointModelSkuRateLimitProperties]'}, + 'usage_name': {'key': 'usageName', 'type': 'str'}, } def __init__( @@ -10950,43 +11452,46 @@ def __init__( **kwargs ): """ + :keyword capacity: + :paramtype capacity: + ~azure.mgmt.machinelearningservices.models.EndpointModelSkuCapacityProperties + :keyword connection_ids: The list of ARM id for the connection support this SKU. + :paramtype connection_ids: list[str] + :keyword deprecation_date: The datetime of deprecation of the model SKU. + :paramtype deprecation_date: ~datetime.datetime + :keyword name: The name of the model SKU. + :paramtype name: str + :keyword rate_limits: + :paramtype rate_limits: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitProperties] + :keyword usage_name: The usage name of the model SKU. + :paramtype usage_name: str """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - + super(EndpointModelSkuProperties, self).__init__(**kwargs) + self.capacity = kwargs.get('capacity', None) + self.connection_ids = kwargs.get('connection_ids', None) + self.deprecation_date = kwargs.get('deprecation_date', None) + self.name = kwargs.get('name', None) + self.rate_limits = kwargs.get('rate_limits', None) + self.usage_name = kwargs.get('usage_name', None) -class ErrorDetail(msrest.serialization.Model): - """The error detail. - Variables are only populated by the server, and will be ignored when sending a request. +class EndpointModelSkuRateLimitProperties(msrest.serialization.Model): + """EndpointModelSkuRateLimitProperties. - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.machinelearningservices.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.machinelearningservices.models.ErrorAdditionalInfo] + :ivar count: The count value of Call Rate Limit. + :vartype count: float + :ivar renewal_period: The renewal period in seconds of Call Rate Limit. + :vartype renewal_period: float + :ivar rules: The call rate limit for the model. + :vartype rules: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitRuleProperties] """ - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + 'count': {'key': 'count', 'type': 'float'}, + 'renewal_period': {'key': 'renewalPeriod', 'type': 'float'}, + 'rules': {'key': 'rules', 'type': '[EndpointModelSkuRateLimitRuleProperties]'}, } def __init__( @@ -10994,24 +11499,32 @@ def __init__( **kwargs ): """ + :keyword count: The count value of Call Rate Limit. + :paramtype count: float + :keyword renewal_period: The renewal period in seconds of Call Rate Limit. + :paramtype renewal_period: float + :keyword rules: The call rate limit for the model. + :paramtype rules: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitRuleProperties] """ - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + super(EndpointModelSkuRateLimitProperties, self).__init__(**kwargs) + self.count = kwargs.get('count', None) + self.renewal_period = kwargs.get('renewal_period', None) + self.rules = kwargs.get('rules', None) -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). +class EndpointModelSkuRateLimitRulePatternProperties(msrest.serialization.Model): + """EndpointModelSkuRateLimitRulePatternProperties. - :ivar error: The error object. - :vartype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail + :ivar method: + :vartype method: str + :ivar path: + :vartype path: str """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, + 'method': {'key': 'method', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, } def __init__( @@ -11019,38 +11532,41 @@ def __init__( **kwargs ): """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail + :keyword method: + :paramtype method: str + :keyword path: + :paramtype path: str """ - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - + super(EndpointModelSkuRateLimitRulePatternProperties, self).__init__(**kwargs) + self.method = kwargs.get('method', None) + self.path = kwargs.get('path', None) -class EstimatedVMPrice(msrest.serialization.Model): - """The estimated price info for using a VM of a particular OS type, tier, etc. - All required parameters must be populated in order to send to Azure. +class EndpointModelSkuRateLimitRuleProperties(msrest.serialization.Model): + """EndpointModelSkuRateLimitRuleProperties. - :ivar retail_price: Required. The price charged for using the VM. - :vartype retail_price: float - :ivar os_type: Required. Operating system type used by the VM. Possible values include: - "Linux", "Windows". - :vartype os_type: str or ~azure.mgmt.machinelearningservices.models.VMPriceOSType - :ivar vm_tier: Required. The type of the VM. Possible values include: "Standard", - "LowPriority", "Spot". - :vartype vm_tier: str or ~azure.mgmt.machinelearningservices.models.VMTier + :ivar count: + :vartype count: float + :ivar dynamic_throttling_enabled: If the dynamic throttling is enabled. + :vartype dynamic_throttling_enabled: bool + :ivar key: + :vartype key: str + :ivar match_patterns: + :vartype match_patterns: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitRulePatternProperties] + :ivar min_count: + :vartype min_count: float + :ivar renewal_period: + :vartype renewal_period: float """ - _validation = { - 'retail_price': {'required': True}, - 'os_type': {'required': True}, - 'vm_tier': {'required': True}, - } - _attribute_map = { - 'retail_price': {'key': 'retailPrice', 'type': 'float'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'vm_tier': {'key': 'vmTier', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'float'}, + 'dynamic_throttling_enabled': {'key': 'dynamicThrottlingEnabled', 'type': 'bool'}, + 'key': {'key': 'key', 'type': 'str'}, + 'match_patterns': {'key': 'matchPatterns', 'type': '[EndpointModelSkuRateLimitRulePatternProperties]'}, + 'min_count': {'key': 'minCount', 'type': 'float'}, + 'renewal_period': {'key': 'renewalPeriod', 'type': 'float'}, } def __init__( @@ -11058,47 +11574,65 @@ def __init__( **kwargs ): """ - :keyword retail_price: Required. The price charged for using the VM. - :paramtype retail_price: float - :keyword os_type: Required. Operating system type used by the VM. Possible values include: - "Linux", "Windows". - :paramtype os_type: str or ~azure.mgmt.machinelearningservices.models.VMPriceOSType - :keyword vm_tier: Required. The type of the VM. Possible values include: "Standard", - "LowPriority", "Spot". - :paramtype vm_tier: str or ~azure.mgmt.machinelearningservices.models.VMTier - """ - super(EstimatedVMPrice, self).__init__(**kwargs) - self.retail_price = kwargs['retail_price'] - self.os_type = kwargs['os_type'] - self.vm_tier = kwargs['vm_tier'] + :keyword count: + :paramtype count: float + :keyword dynamic_throttling_enabled: If the dynamic throttling is enabled. + :paramtype dynamic_throttling_enabled: bool + :keyword key: + :paramtype key: str + :keyword match_patterns: + :paramtype match_patterns: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitRulePatternProperties] + :keyword min_count: + :paramtype min_count: float + :keyword renewal_period: + :paramtype renewal_period: float + """ + super(EndpointModelSkuRateLimitRuleProperties, self).__init__(**kwargs) + self.count = kwargs.get('count', None) + self.dynamic_throttling_enabled = kwargs.get('dynamic_throttling_enabled', None) + self.key = kwargs.get('key', None) + self.match_patterns = kwargs.get('match_patterns', None) + self.min_count = kwargs.get('min_count', None) + self.renewal_period = kwargs.get('renewal_period', None) -class EstimatedVMPrices(msrest.serialization.Model): - """The estimated price info for using a VM. +class EndpointResourcePropertiesBasicResource(Resource): + """EndpointResourcePropertiesBasicResource. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar billing_currency: Required. Three lettered code specifying the currency of the VM price. - Example: USD. Possible values include: "USD". - :vartype billing_currency: str or ~azure.mgmt.machinelearningservices.models.BillingCurrency - :ivar unit_of_measure: Required. The unit of time measurement for the specified VM price. - Example: OneHour. Possible values include: "OneHour". - :vartype unit_of_measure: str or ~azure.mgmt.machinelearningservices.models.UnitOfMeasure - :ivar values: Required. The list of estimated prices for using a VM of a particular OS type, - tier, etc. - :vartype values: list[~azure.mgmt.machinelearningservices.models.EstimatedVMPrice] + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.EndpointResourceProperties """ _validation = { - 'billing_currency': {'required': True}, - 'unit_of_measure': {'required': True}, - 'values': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, } _attribute_map = { - 'billing_currency': {'key': 'billingCurrency', 'type': 'str'}, - 'unit_of_measure': {'key': 'unitOfMeasure', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[EstimatedVMPrice]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'EndpointResourceProperties'}, } def __init__( @@ -11106,31 +11640,26 @@ def __init__( **kwargs ): """ - :keyword billing_currency: Required. Three lettered code specifying the currency of the VM - price. Example: USD. Possible values include: "USD". - :paramtype billing_currency: str or ~azure.mgmt.machinelearningservices.models.BillingCurrency - :keyword unit_of_measure: Required. The unit of time measurement for the specified VM price. - Example: OneHour. Possible values include: "OneHour". - :paramtype unit_of_measure: str or ~azure.mgmt.machinelearningservices.models.UnitOfMeasure - :keyword values: Required. The list of estimated prices for using a VM of a particular OS type, - tier, etc. - :paramtype values: list[~azure.mgmt.machinelearningservices.models.EstimatedVMPrice] + :keyword properties: Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.EndpointResourceProperties """ - super(EstimatedVMPrices, self).__init__(**kwargs) - self.billing_currency = kwargs['billing_currency'] - self.unit_of_measure = kwargs['unit_of_measure'] - self.values = kwargs['values'] + super(EndpointResourcePropertiesBasicResource, self).__init__(**kwargs) + self.properties = kwargs['properties'] -class ExternalFQDNResponse(msrest.serialization.Model): - """ExternalFQDNResponse. +class EndpointResourcePropertiesBasicResourceArmPaginatedResult(msrest.serialization.Model): + """EndpointResourcePropertiesBasicResourceArmPaginatedResult. + :ivar next_link: + :vartype next_link: str :ivar value: - :vartype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoints] + :vartype value: + list[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[FQDNEndpoints]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EndpointResourcePropertiesBasicResource]'}, } def __init__( @@ -11138,14 +11667,65 @@ def __init__( **kwargs ): """ + :keyword next_link: + :paramtype next_link: str :keyword value: - :paramtype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoints] + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] """ - super(ExternalFQDNResponse, self).__init__(**kwargs) + super(EndpointResourcePropertiesBasicResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) -class Feature(ProxyResource): +class EndpointScheduleAction(ScheduleActionBase): + """EndpointScheduleAction. + + All required parameters must be populated in order to send to Azure. + + :ivar action_type: Required. [Required] Specifies the action type of the schedule.Constant + filled by server. Possible values include: "CreateJob", "InvokeBatchEndpoint", "CreateMonitor". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType + :ivar endpoint_invocation_definition: Required. [Required] Defines Schedule action definition + details. + + + .. raw:: html + + . + :vartype endpoint_invocation_definition: any + """ + + _validation = { + 'action_type': {'required': True}, + 'endpoint_invocation_definition': {'required': True}, + } + + _attribute_map = { + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'endpoint_invocation_definition': {'key': 'endpointInvocationDefinition', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword endpoint_invocation_definition: Required. [Required] Defines Schedule action + definition details. + + + .. raw:: html + + . + :paramtype endpoint_invocation_definition: any + """ + super(EndpointScheduleAction, self).__init__(**kwargs) + self.action_type = 'InvokeBatchEndpoint' # type: str + self.endpoint_invocation_definition = kwargs['endpoint_invocation_definition'] + + +class EnvironmentContainer(ProxyResource): """Azure Resource Manager resource envelope. Variables are only populated by the server, and will be ignored when sending a request. @@ -11164,7 +11744,7 @@ class Feature(ProxyResource): information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.FeatureProperties + :vartype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties """ _validation = { @@ -11180,7 +11760,7 @@ class Feature(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'FeatureProperties'}, + 'properties': {'key': 'properties', 'type': 'EnvironmentContainerProperties'}, } def __init__( @@ -11189,62 +11769,50 @@ def __init__( ): """ :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeatureProperties + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties """ - super(Feature, self).__init__(**kwargs) + super(EnvironmentContainer, self).__init__(**kwargs) self.properties = kwargs['properties'] -class FeatureAttributionDriftMonitoringSignal(MonitoringSignalBase): - """FeatureAttributionDriftMonitoringSignal. +class EnvironmentContainerProperties(AssetContainer): + """Container for environment specification versions. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar notification_types: The current notification mode for this signal. - :vartype notification_types: list[str or - ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] - :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. :vartype properties: dict[str, str] - :ivar signal_type: Required. [Required] Specifies the type of signal to monitor.Constant filled - by server. Possible values include: "DataDrift", "PredictionDrift", "DataQuality", - "FeatureAttributionDrift", "Custom". - :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType - :ivar feature_data_type_override: A dictionary that maps feature names to their respective data - types. - :vartype feature_data_type_override: dict[str, str or - ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] - :ivar feature_importance_settings: Required. [Required] The settings for computing feature - importance. - :vartype feature_importance_settings: - ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings - :ivar metric_threshold: Required. [Required] A list of metrics to calculate and their - associated thresholds. - :vartype metric_threshold: - ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetricThreshold - :ivar production_data: Required. [Required] The data which drift will be calculated for. - :vartype production_data: - list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] - :ivar reference_data: Required. [Required] The data to calculate drift against. - :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar latest_version: The latest version inside this container. + :vartype latest_version: str + :ivar next_version: The next auto incremental version. + :vartype next_version: str + :ivar provisioning_state: Provisioning state for the environment container. Possible values + include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ _validation = { - 'signal_type': {'required': True}, - 'feature_importance_settings': {'required': True}, - 'metric_threshold': {'required': True}, - 'production_data': {'required': True}, - 'reference_data': {'required': True}, + 'latest_version': {'readonly': True}, + 'next_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'notification_types': {'key': 'notificationTypes', 'type': '[str]'}, + 'description': {'key': 'description', 'type': 'str'}, 'properties': {'key': 'properties', 'type': '{str}'}, - 'signal_type': {'key': 'signalType', 'type': 'str'}, - 'feature_data_type_override': {'key': 'featureDataTypeOverride', 'type': '{str}'}, - 'feature_importance_settings': {'key': 'featureImportanceSettings', 'type': 'FeatureImportanceSettings'}, - 'metric_threshold': {'key': 'metricThreshold', 'type': 'FeatureAttributionMetricThreshold'}, - 'production_data': {'key': 'productionData', 'type': '[MonitoringInputDataBase]'}, - 'reference_data': {'key': 'referenceData', 'type': 'MonitoringInputDataBase'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'latest_version': {'key': 'latestVersion', 'type': 'str'}, + 'next_version': {'key': 'nextVersion', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } def __init__( @@ -11252,58 +11820,32 @@ def __init__( **kwargs ): """ - :keyword notification_types: The current notification mode for this signal. - :paramtype notification_types: list[str or - ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. :paramtype properties: dict[str, str] - :keyword feature_data_type_override: A dictionary that maps feature names to their respective - data types. - :paramtype feature_data_type_override: dict[str, str or - ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] - :keyword feature_importance_settings: Required. [Required] The settings for computing feature - importance. - :paramtype feature_importance_settings: - ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings - :keyword metric_threshold: Required. [Required] A list of metrics to calculate and their - associated thresholds. - :paramtype metric_threshold: - ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetricThreshold - :keyword production_data: Required. [Required] The data which drift will be calculated for. - :paramtype production_data: - list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] - :keyword reference_data: Required. [Required] The data to calculate drift against. - :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool """ - super(FeatureAttributionDriftMonitoringSignal, self).__init__(**kwargs) - self.signal_type = 'FeatureAttributionDrift' # type: str - self.feature_data_type_override = kwargs.get('feature_data_type_override', None) - self.feature_importance_settings = kwargs['feature_importance_settings'] - self.metric_threshold = kwargs['metric_threshold'] - self.production_data = kwargs['production_data'] - self.reference_data = kwargs['reference_data'] - + super(EnvironmentContainerProperties, self).__init__(**kwargs) + self.provisioning_state = None -class FeatureAttributionMetricThreshold(msrest.serialization.Model): - """FeatureAttributionMetricThreshold. - All required parameters must be populated in order to send to Azure. +class EnvironmentContainerResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of EnvironmentContainer entities. - :ivar metric: Required. [Required] The feature attribution metric to calculate. Possible values - include: "NormalizedDiscountedCumulativeGain". - :vartype metric: str or ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetric - :ivar threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar next_link: The link to the next page of EnvironmentContainer objects. If null, there are + no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type EnvironmentContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] """ - _validation = { - 'metric': {'required': True}, - } - _attribute_map = { - 'metric': {'key': 'metric', 'type': 'str'}, - 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EnvironmentContainer]'}, } def __init__( @@ -11311,108 +11853,34 @@ def __init__( **kwargs ): """ - :keyword metric: Required. [Required] The feature attribution metric to calculate. Possible - values include: "NormalizedDiscountedCumulativeGain". - :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetric - :keyword threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword next_link: The link to the next page of EnvironmentContainer objects. If null, there + are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type EnvironmentContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] """ - super(FeatureAttributionMetricThreshold, self).__init__(**kwargs) - self.metric = kwargs['metric'] - self.threshold = kwargs.get('threshold', None) - - -class FeatureImportanceSettings(msrest.serialization.Model): - """FeatureImportanceSettings. - - :ivar mode: The mode of operation for computing feature importance. Possible values include: - "Disabled", "Enabled". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.FeatureImportanceMode - :ivar target_column: The name of the target column within the input data asset. - :vartype target_column: str - """ - - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'target_column': {'key': 'targetColumn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword mode: The mode of operation for computing feature importance. Possible values include: - "Disabled", "Enabled". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.FeatureImportanceMode - :keyword target_column: The name of the target column within the input data asset. - :paramtype target_column: str - """ - super(FeatureImportanceSettings, self).__init__(**kwargs) - self.mode = kwargs.get('mode', None) - self.target_column = kwargs.get('target_column', None) - - -class FeatureProperties(ResourceBase): - """DTO object representing feature. - - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar data_type: Specifies type. Possible values include: "String", "Integer", "Long", "Float", - "Double", "Binary", "Datetime", "Boolean". - :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType - :ivar feature_name: Specifies name. - :vartype feature_name: str - """ - - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'feature_name': {'key': 'featureName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword data_type: Specifies type. Possible values include: "String", "Integer", "Long", - "Float", "Double", "Binary", "Datetime", "Boolean". - :paramtype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType - :keyword feature_name: Specifies name. - :paramtype feature_name: str - """ - super(FeatureProperties, self).__init__(**kwargs) - self.data_type = kwargs.get('data_type', None) - self.feature_name = kwargs.get('feature_name', None) + super(EnvironmentContainerResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) -class FeatureResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of Feature entities. +class EnvironmentVariable(msrest.serialization.Model): + """EnvironmentVariable. - :ivar next_link: The link to the next page of Feature objects. If null, there are no additional - pages. - :vartype next_link: str - :ivar value: An array of objects of type Feature. - :vartype value: list[~azure.mgmt.machinelearningservices.models.Feature] + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar type: Type of the Environment Variable. Possible values are: local - For local variable. + Possible values include: "local". Default value: "local". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentVariableType + :ivar value: Value of the Environment variable. + :vartype value: str """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Feature]'}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, } def __init__( @@ -11420,18 +11888,22 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of Feature objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type Feature. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.Feature] + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword type: Type of the Environment Variable. Possible values are: local - For local + variable. Possible values include: "local". Default value: "local". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentVariableType + :keyword value: Value of the Environment variable. + :paramtype value: str """ - super(FeatureResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) + super(EnvironmentVariable, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.type = kwargs.get('type', "local") self.value = kwargs.get('value', None) -class FeaturesetContainer(ProxyResource): +class EnvironmentVersion(ProxyResource): """Azure Resource Manager resource envelope. Variables are only populated by the server, and will be ignored when sending a request. @@ -11450,7 +11922,7 @@ class FeaturesetContainer(ProxyResource): information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetContainerProperties + :vartype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentVersionProperties """ _validation = { @@ -11466,7 +11938,7 @@ class FeaturesetContainer(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'FeaturesetContainerProperties'}, + 'properties': {'key': 'properties', 'type': 'EnvironmentVersionProperties'}, } def __init__( @@ -11475,14 +11947,14 @@ def __init__( ): """ :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetContainerProperties + :paramtype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentVersionProperties """ - super(FeaturesetContainer, self).__init__(**kwargs) + super(EnvironmentVersion, self).__init__(**kwargs) self.properties = kwargs['properties'] -class FeaturesetContainerProperties(AssetContainer): - """DTO object representing feature set. +class EnvironmentVersionProperties(AssetBase): + """Environment version details. Variables are only populated by the server, and will be ignored when sending a request. @@ -11492,21 +11964,59 @@ class FeaturesetContainerProperties(AssetContainer): :vartype properties: dict[str, str] :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :vartype tags: dict[str, str] + :ivar is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool :ivar is_archived: Is the asset archived?. :vartype is_archived: bool - :ivar latest_version: The latest version inside this container. - :vartype latest_version: str - :ivar next_version: The next auto incremental version. - :vartype next_version: str - :ivar provisioning_state: Provisioning state for the featureset container. Possible values + :ivar auto_rebuild: Defines if image needs to be rebuilt based on base image changes. Possible + values include: "Disabled", "OnBaseImageUpdate". + :vartype auto_rebuild: str or ~azure.mgmt.machinelearningservices.models.AutoRebuildSetting + :ivar build: Configuration settings for Docker build context. + :vartype build: ~azure.mgmt.machinelearningservices.models.BuildContext + :ivar conda_file: Standard configuration file used by Conda that lets you install any kind of + package, including Python, R, and C/C++ packages. + + + .. raw:: html + + . + :vartype conda_file: str + :ivar environment_type: Environment type is either user managed or curated by the Azure ML + service + + + .. raw:: html + + . Possible values include: "Curated", "UserCreated". + :vartype environment_type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentType + :ivar image: Name of the image that will be used for the environment. + + + .. raw:: html + + . + :vartype image: str + :ivar inference_config: Defines configuration specific to inference. + :vartype inference_config: + ~azure.mgmt.machinelearningservices.models.InferenceContainerProperties + :ivar os_type: The OS type of the environment. Possible values include: "Linux", "Windows". + :vartype os_type: str or ~azure.mgmt.machinelearningservices.models.OperatingSystemType + :ivar provisioning_state: Provisioning state for the environment version. Possible values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar stage: Stage in the environment lifecycle assigned to this environment. + :vartype stage: str """ _validation = { - 'latest_version': {'readonly': True}, - 'next_version': {'readonly': True}, + 'environment_type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -11514,10 +12024,17 @@ class FeaturesetContainerProperties(AssetContainer): 'description': {'key': 'description', 'type': 'str'}, 'properties': {'key': 'properties', 'type': '{str}'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'latest_version': {'key': 'latestVersion', 'type': 'str'}, - 'next_version': {'key': 'nextVersion', 'type': 'str'}, + 'auto_rebuild': {'key': 'autoRebuild', 'type': 'str'}, + 'build': {'key': 'build', 'type': 'BuildContext'}, + 'conda_file': {'key': 'condaFile', 'type': 'str'}, + 'environment_type': {'key': 'environmentType', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'str'}, + 'inference_config': {'key': 'inferenceConfig', 'type': 'InferenceContainerProperties'}, + 'os_type': {'key': 'osType', 'type': 'str'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, } def __init__( @@ -11531,26 +12048,67 @@ def __init__( :paramtype properties: dict[str, str] :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :paramtype tags: dict[str, str] + :keyword is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool + :keyword auto_rebuild: Defines if image needs to be rebuilt based on base image changes. + Possible values include: "Disabled", "OnBaseImageUpdate". + :paramtype auto_rebuild: str or ~azure.mgmt.machinelearningservices.models.AutoRebuildSetting + :keyword build: Configuration settings for Docker build context. + :paramtype build: ~azure.mgmt.machinelearningservices.models.BuildContext + :keyword conda_file: Standard configuration file used by Conda that lets you install any kind + of package, including Python, R, and C/C++ packages. + + + .. raw:: html + + . + :paramtype conda_file: str + :keyword image: Name of the image that will be used for the environment. + + + .. raw:: html + + . + :paramtype image: str + :keyword inference_config: Defines configuration specific to inference. + :paramtype inference_config: + ~azure.mgmt.machinelearningservices.models.InferenceContainerProperties + :keyword os_type: The OS type of the environment. Possible values include: "Linux", "Windows". + :paramtype os_type: str or ~azure.mgmt.machinelearningservices.models.OperatingSystemType + :keyword stage: Stage in the environment lifecycle assigned to this environment. + :paramtype stage: str """ - super(FeaturesetContainerProperties, self).__init__(**kwargs) + super(EnvironmentVersionProperties, self).__init__(**kwargs) + self.auto_rebuild = kwargs.get('auto_rebuild', None) + self.build = kwargs.get('build', None) + self.conda_file = kwargs.get('conda_file', None) + self.environment_type = None + self.image = kwargs.get('image', None) + self.inference_config = kwargs.get('inference_config', None) + self.os_type = kwargs.get('os_type', None) self.provisioning_state = None + self.stage = kwargs.get('stage', None) -class FeaturesetContainerResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of FeaturesetContainer entities. +class EnvironmentVersionResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of EnvironmentVersion entities. - :ivar next_link: The link to the next page of FeaturesetContainer objects. If null, there are - no additional pages. + :ivar next_link: The link to the next page of EnvironmentVersion objects. If null, there are no + additional pages. :vartype next_link: str - :ivar value: An array of objects of type FeaturesetContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + :ivar value: An array of objects of type EnvironmentVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[FeaturesetContainer]'}, + 'value': {'key': 'value', 'type': '[EnvironmentVersion]'}, } def __init__( @@ -11558,26 +12116,36 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of FeaturesetContainer objects. If null, there - are no additional pages. + :keyword next_link: The link to the next page of EnvironmentVersion objects. If null, there are + no additional pages. :paramtype next_link: str - :keyword value: An array of objects of type FeaturesetContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + :keyword value: An array of objects of type EnvironmentVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] """ - super(FeaturesetContainerResourceArmPaginatedResult, self).__init__(**kwargs) + super(EnvironmentVersionResourceArmPaginatedResult, self).__init__(**kwargs) self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) -class FeaturesetSpecification(msrest.serialization.Model): - """DTO object representing specification. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. - :ivar path: Specifies the spec path. - :vartype path: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any """ + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( @@ -11585,49 +12153,43 @@ def __init__( **kwargs ): """ - :keyword path: Specifies the spec path. - :paramtype path: str """ - super(FeaturesetSpecification, self).__init__(**kwargs) - self.path = kwargs.get('path', None) + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class FeaturesetVersion(ProxyResource): - """Azure Resource Manager resource envelope. +class ErrorDetail(msrest.serialization.Model): + """The error detail. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionProperties + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.machinelearningservices.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.machinelearningservices.models.ErrorAdditionalInfo] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'FeaturesetVersionProperties'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( @@ -11635,48 +12197,24 @@ def __init__( **kwargs ): """ - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionProperties """ - super(FeaturesetVersion, self).__init__(**kwargs) - self.properties = kwargs['properties'] + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None -class FeaturesetVersionBackfillRequest(msrest.serialization.Model): - """Request payload for creating a backfill request for a given feature set version. +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :ivar data_availability_status: Specified the data availability status that you want to - backfill. - :vartype data_availability_status: list[str or - ~azure.mgmt.machinelearningservices.models.DataAvailabilityStatus] - :ivar description: Specifies description. - :vartype description: str - :ivar display_name: Specifies description. - :vartype display_name: str - :ivar feature_window: Specifies the backfill feature window to be materialized. - :vartype feature_window: ~azure.mgmt.machinelearningservices.models.FeatureWindow - :ivar job_id: Specify the jobId to retry the failed materialization. - :vartype job_id: str - :ivar properties: Specifies the properties. - :vartype properties: dict[str, str] - :ivar resource: Specifies the compute resource settings. - :vartype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource - :ivar spark_configuration: Specifies the spark compute settings. - :vartype spark_configuration: dict[str, str] - :ivar tags: A set of tags. Specifies the tags. - :vartype tags: dict[str, str] + :ivar error: The error object. + :vartype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail """ _attribute_map = { - 'data_availability_status': {'key': 'dataAvailabilityStatus', 'type': '[str]'}, - 'description': {'key': 'description', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'feature_window': {'key': 'featureWindow', 'type': 'FeatureWindow'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'resource': {'key': 'resource', 'type': 'MaterializationComputeResource'}, - 'spark_configuration': {'key': 'sparkConfiguration', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( @@ -11684,48 +12222,38 @@ def __init__( **kwargs ): """ - :keyword data_availability_status: Specified the data availability status that you want to - backfill. - :paramtype data_availability_status: list[str or - ~azure.mgmt.machinelearningservices.models.DataAvailabilityStatus] - :keyword description: Specifies description. - :paramtype description: str - :keyword display_name: Specifies description. - :paramtype display_name: str - :keyword feature_window: Specifies the backfill feature window to be materialized. - :paramtype feature_window: ~azure.mgmt.machinelearningservices.models.FeatureWindow - :keyword job_id: Specify the jobId to retry the failed materialization. - :paramtype job_id: str - :keyword properties: Specifies the properties. - :paramtype properties: dict[str, str] - :keyword resource: Specifies the compute resource settings. - :paramtype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource - :keyword spark_configuration: Specifies the spark compute settings. - :paramtype spark_configuration: dict[str, str] - :keyword tags: A set of tags. Specifies the tags. - :paramtype tags: dict[str, str] + :keyword error: The error object. + :paramtype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail """ - super(FeaturesetVersionBackfillRequest, self).__init__(**kwargs) - self.data_availability_status = kwargs.get('data_availability_status', None) - self.description = kwargs.get('description', None) - self.display_name = kwargs.get('display_name', None) - self.feature_window = kwargs.get('feature_window', None) - self.job_id = kwargs.get('job_id', None) - self.properties = kwargs.get('properties', None) - self.resource = kwargs.get('resource', None) - self.spark_configuration = kwargs.get('spark_configuration', None) - self.tags = kwargs.get('tags', None) + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) -class FeaturesetVersionBackfillResponse(msrest.serialization.Model): - """Response payload for creating a backfill request for a given feature set version. +class EstimatedVMPrice(msrest.serialization.Model): + """The estimated price info for using a VM of a particular OS type, tier, etc. - :ivar job_ids: List of jobs submitted as part of the backfill request. - :vartype job_ids: list[str] + All required parameters must be populated in order to send to Azure. + + :ivar retail_price: Required. The price charged for using the VM. + :vartype retail_price: float + :ivar os_type: Required. Operating system type used by the VM. Possible values include: + "Linux", "Windows". + :vartype os_type: str or ~azure.mgmt.machinelearningservices.models.VMPriceOSType + :ivar vm_tier: Required. The type of the VM. Possible values include: "Standard", + "LowPriority", "Spot". + :vartype vm_tier: str or ~azure.mgmt.machinelearningservices.models.VMTier """ + _validation = { + 'retail_price': {'required': True}, + 'os_type': {'required': True}, + 'vm_tier': {'required': True}, + } + _attribute_map = { - 'job_ids': {'key': 'jobIds', 'type': '[str]'}, + 'retail_price': {'key': 'retailPrice', 'type': 'float'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'vm_tier': {'key': 'vmTier', 'type': 'str'}, } def __init__( @@ -11733,58 +12261,47 @@ def __init__( **kwargs ): """ - :keyword job_ids: List of jobs submitted as part of the backfill request. - :paramtype job_ids: list[str] + :keyword retail_price: Required. The price charged for using the VM. + :paramtype retail_price: float + :keyword os_type: Required. Operating system type used by the VM. Possible values include: + "Linux", "Windows". + :paramtype os_type: str or ~azure.mgmt.machinelearningservices.models.VMPriceOSType + :keyword vm_tier: Required. The type of the VM. Possible values include: "Standard", + "LowPriority", "Spot". + :paramtype vm_tier: str or ~azure.mgmt.machinelearningservices.models.VMTier """ - super(FeaturesetVersionBackfillResponse, self).__init__(**kwargs) - self.job_ids = kwargs.get('job_ids', None) + super(EstimatedVMPrice, self).__init__(**kwargs) + self.retail_price = kwargs['retail_price'] + self.os_type = kwargs['os_type'] + self.vm_tier = kwargs['vm_tier'] -class FeaturesetVersionProperties(AssetBase): - """DTO object representing feature set version. +class EstimatedVMPrices(msrest.serialization.Model): + """The estimated price info for using a VM. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar entities: Specifies list of entities. - :vartype entities: list[str] - :ivar materialization_settings: Specifies the materialization settings. - :vartype materialization_settings: - ~azure.mgmt.machinelearningservices.models.MaterializationSettings - :ivar provisioning_state: Provisioning state for the featureset version container. Possible - values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState - :ivar specification: Specifies the feature spec details. - :vartype specification: ~azure.mgmt.machinelearningservices.models.FeaturesetSpecification - :ivar stage: Specifies the asset stage. - :vartype stage: str + :ivar billing_currency: Required. Three lettered code specifying the currency of the VM price. + Example: USD. Possible values include: "USD". + :vartype billing_currency: str or ~azure.mgmt.machinelearningservices.models.BillingCurrency + :ivar unit_of_measure: Required. The unit of time measurement for the specified VM price. + Example: OneHour. Possible values include: "OneHour". + :vartype unit_of_measure: str or ~azure.mgmt.machinelearningservices.models.UnitOfMeasure + :ivar values: Required. The list of estimated prices for using a VM of a particular OS type, + tier, etc. + :vartype values: list[~azure.mgmt.machinelearningservices.models.EstimatedVMPrice] """ _validation = { - 'provisioning_state': {'readonly': True}, + 'billing_currency': {'required': True}, + 'unit_of_measure': {'required': True}, + 'values': {'required': True}, } _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'entities': {'key': 'entities', 'type': '[str]'}, - 'materialization_settings': {'key': 'materializationSettings', 'type': 'MaterializationSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'specification': {'key': 'specification', 'type': 'FeaturesetSpecification'}, - 'stage': {'key': 'stage', 'type': 'str'}, + 'billing_currency': {'key': 'billingCurrency', 'type': 'str'}, + 'unit_of_measure': {'key': 'unitOfMeasure', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[EstimatedVMPrice]'}, } def __init__( @@ -11792,47 +12309,31 @@ def __init__( **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword entities: Specifies list of entities. - :paramtype entities: list[str] - :keyword materialization_settings: Specifies the materialization settings. - :paramtype materialization_settings: - ~azure.mgmt.machinelearningservices.models.MaterializationSettings - :keyword specification: Specifies the feature spec details. - :paramtype specification: ~azure.mgmt.machinelearningservices.models.FeaturesetSpecification - :keyword stage: Specifies the asset stage. - :paramtype stage: str + :keyword billing_currency: Required. Three lettered code specifying the currency of the VM + price. Example: USD. Possible values include: "USD". + :paramtype billing_currency: str or ~azure.mgmt.machinelearningservices.models.BillingCurrency + :keyword unit_of_measure: Required. The unit of time measurement for the specified VM price. + Example: OneHour. Possible values include: "OneHour". + :paramtype unit_of_measure: str or ~azure.mgmt.machinelearningservices.models.UnitOfMeasure + :keyword values: Required. The list of estimated prices for using a VM of a particular OS type, + tier, etc. + :paramtype values: list[~azure.mgmt.machinelearningservices.models.EstimatedVMPrice] """ - super(FeaturesetVersionProperties, self).__init__(**kwargs) - self.entities = kwargs.get('entities', None) - self.materialization_settings = kwargs.get('materialization_settings', None) - self.provisioning_state = None - self.specification = kwargs.get('specification', None) - self.stage = kwargs.get('stage', None) + super(EstimatedVMPrices, self).__init__(**kwargs) + self.billing_currency = kwargs['billing_currency'] + self.unit_of_measure = kwargs['unit_of_measure'] + self.values = kwargs['values'] -class FeaturesetVersionResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of FeaturesetVersion entities. +class ExternalFQDNResponse(msrest.serialization.Model): + """ExternalFQDNResponse. - :ivar next_link: The link to the next page of FeaturesetVersion objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type FeaturesetVersion. - :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + :ivar value: + :vartype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpointsPropertyBag] """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[FeaturesetVersion]'}, + 'value': {'key': 'value', 'type': '[FQDNEndpointsPropertyBag]'}, } def __init__( @@ -11840,18 +12341,14 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of FeaturesetVersion objects. If null, there are - no additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type FeaturesetVersion. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + :keyword value: + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpointsPropertyBag] """ - super(FeaturesetVersionResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) + super(ExternalFQDNResponse, self).__init__(**kwargs) self.value = kwargs.get('value', None) -class FeaturestoreEntityContainer(ProxyResource): +class Feature(ProxyResource): """Azure Resource Manager resource envelope. Variables are only populated by the server, and will be ignored when sending a request. @@ -11870,8 +12367,7 @@ class FeaturestoreEntityContainer(ProxyResource): information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: - ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainerProperties + :vartype properties: ~azure.mgmt.machinelearningservices.models.FeatureProperties """ _validation = { @@ -11887,7 +12383,7 @@ class FeaturestoreEntityContainer(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'FeaturestoreEntityContainerProperties'}, + 'properties': {'key': 'properties', 'type': 'FeatureProperties'}, } def __init__( @@ -11896,50 +12392,62 @@ def __init__( ): """ :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: - ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainerProperties + :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeatureProperties """ - super(FeaturestoreEntityContainer, self).__init__(**kwargs) + super(Feature, self).__init__(**kwargs) self.properties = kwargs['properties'] -class FeaturestoreEntityContainerProperties(AssetContainer): - """DTO object representing feature entity. +class FeatureAttributionDriftMonitoringSignal(MonitoringSignalBase): + """FeatureAttributionDriftMonitoringSignal. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. + :ivar notification_types: The current notification mode for this signal. + :vartype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar latest_version: The latest version inside this container. - :vartype latest_version: str - :ivar next_version: The next auto incremental version. - :vartype next_version: str - :ivar provisioning_state: Provisioning state for the featurestore entity container. Possible - values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar signal_type: Required. [Required] Specifies the type of signal to monitor.Constant filled + by server. Possible values include: "DataDrift", "PredictionDrift", "DataQuality", + "FeatureAttributionDrift", "Custom". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar feature_data_type_override: A dictionary that maps feature names to their respective data + types. + :vartype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :ivar feature_importance_settings: Required. [Required] The settings for computing feature + importance. + :vartype feature_importance_settings: + ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings + :ivar metric_threshold: Required. [Required] A list of metrics to calculate and their + associated thresholds. + :vartype metric_threshold: + ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetricThreshold + :ivar production_data: Required. [Required] The data which drift will be calculated for. + :vartype production_data: + list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :ivar reference_data: Required. [Required] The data to calculate drift against. + :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase """ _validation = { - 'latest_version': {'readonly': True}, - 'next_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + 'signal_type': {'required': True}, + 'feature_importance_settings': {'required': True}, + 'metric_threshold': {'required': True}, + 'production_data': {'required': True}, + 'reference_data': {'required': True}, } _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, + 'notification_types': {'key': 'notificationTypes', 'type': '[str]'}, 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'latest_version': {'key': 'latestVersion', 'type': 'str'}, - 'next_version': {'key': 'nextVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'signal_type': {'key': 'signalType', 'type': 'str'}, + 'feature_data_type_override': {'key': 'featureDataTypeOverride', 'type': '{str}'}, + 'feature_importance_settings': {'key': 'featureImportanceSettings', 'type': 'FeatureImportanceSettings'}, + 'metric_threshold': {'key': 'metricThreshold', 'type': 'FeatureAttributionMetricThreshold'}, + 'production_data': {'key': 'productionData', 'type': '[MonitoringInputDataBase]'}, + 'reference_data': {'key': 'referenceData', 'type': 'MonitoringInputDataBase'}, } def __init__( @@ -11947,32 +12455,58 @@ def __init__( **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. + :keyword notification_types: The current notification mode for this signal. + :paramtype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool + :keyword feature_data_type_override: A dictionary that maps feature names to their respective + data types. + :paramtype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :keyword feature_importance_settings: Required. [Required] The settings for computing feature + importance. + :paramtype feature_importance_settings: + ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings + :keyword metric_threshold: Required. [Required] A list of metrics to calculate and their + associated thresholds. + :paramtype metric_threshold: + ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetricThreshold + :keyword production_data: Required. [Required] The data which drift will be calculated for. + :paramtype production_data: + list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :keyword reference_data: Required. [Required] The data to calculate drift against. + :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase """ - super(FeaturestoreEntityContainerProperties, self).__init__(**kwargs) - self.provisioning_state = None + super(FeatureAttributionDriftMonitoringSignal, self).__init__(**kwargs) + self.signal_type = 'FeatureAttributionDrift' # type: str + self.feature_data_type_override = kwargs.get('feature_data_type_override', None) + self.feature_importance_settings = kwargs['feature_importance_settings'] + self.metric_threshold = kwargs['metric_threshold'] + self.production_data = kwargs['production_data'] + self.reference_data = kwargs['reference_data'] -class FeaturestoreEntityContainerResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of FeaturestoreEntityContainer entities. +class FeatureAttributionMetricThreshold(msrest.serialization.Model): + """FeatureAttributionMetricThreshold. - :ivar next_link: The link to the next page of FeaturestoreEntityContainer objects. If null, - there are no additional pages. - :vartype next_link: str - :ivar value: An array of objects of type FeaturestoreEntityContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + All required parameters must be populated in order to send to Azure. + + :ivar metric: Required. [Required] The feature attribution metric to calculate. Possible values + include: "NormalizedDiscountedCumulativeGain". + :vartype metric: str or ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetric + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold """ + _validation = { + 'metric': {'required': True}, + } + _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[FeaturestoreEntityContainer]'}, + 'metric': {'key': 'metric', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, } def __init__( @@ -11980,54 +12514,31 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of FeaturestoreEntityContainer objects. If null, - there are no additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type FeaturestoreEntityContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + :keyword metric: Required. [Required] The feature attribution metric to calculate. Possible + values include: "NormalizedDiscountedCumulativeGain". + :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetric + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold """ - super(FeaturestoreEntityContainerResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class FeaturestoreEntityVersion(ProxyResource): - """Azure Resource Manager resource envelope. + super(FeatureAttributionMetricThreshold, self).__init__(**kwargs) + self.metric = kwargs['metric'] + self.threshold = kwargs.get('threshold', None) - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. +class FeatureImportanceSettings(msrest.serialization.Model): + """FeatureImportanceSettings. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: - ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersionProperties + :ivar mode: The mode of operation for computing feature importance. Possible values include: + "Disabled", "Enabled". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.FeatureImportanceMode + :ivar target_column: The name of the target column within the input data asset. + :vartype target_column: str """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'FeaturestoreEntityVersionProperties'}, + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'target_column': {'key': 'targetColumn', 'type': 'str'}, } def __init__( @@ -12035,18 +12546,19 @@ def __init__( **kwargs ): """ - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: - ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersionProperties + :keyword mode: The mode of operation for computing feature importance. Possible values include: + "Disabled", "Enabled". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.FeatureImportanceMode + :keyword target_column: The name of the target column within the input data asset. + :paramtype target_column: str """ - super(FeaturestoreEntityVersion, self).__init__(**kwargs) - self.properties = kwargs['properties'] - + super(FeatureImportanceSettings, self).__init__(**kwargs) + self.mode = kwargs.get('mode', None) + self.target_column = kwargs.get('target_column', None) -class FeaturestoreEntityVersionProperties(AssetBase): - """DTO object representing feature entity version. - Variables are only populated by the server, and will be ignored when sending a request. +class FeatureProperties(ResourceBase): + """DTO object representing feature. :ivar description: The asset description text. :vartype description: str @@ -12054,33 +12566,19 @@ class FeaturestoreEntityVersionProperties(AssetBase): :vartype properties: dict[str, str] :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :vartype tags: dict[str, str] - :ivar is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar index_columns: Specifies index columns. - :vartype index_columns: list[~azure.mgmt.machinelearningservices.models.IndexColumn] - :ivar provisioning_state: Provisioning state for the featurestore entity version. Possible - values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState - :ivar stage: Specifies the asset stage. - :vartype stage: str + :ivar data_type: Specifies type. Possible values include: "String", "Integer", "Long", "Float", + "Double", "Binary", "Datetime", "Boolean". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType + :ivar feature_name: Specifies name. + :vartype feature_name: str """ - _validation = { - 'provisioning_state': {'readonly': True}, - } - _attribute_map = { 'description': {'key': 'description', 'type': 'str'}, 'properties': {'key': 'properties', 'type': '{str}'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'index_columns': {'key': 'indexColumns', 'type': '[IndexColumn]'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'stage': {'key': 'stage', 'type': 'str'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'feature_name': {'key': 'featureName', 'type': 'str'}, } def __init__( @@ -12094,34 +12592,30 @@ def __init__( :paramtype properties: dict[str, str] :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :paramtype tags: dict[str, str] - :keyword is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword index_columns: Specifies index columns. - :paramtype index_columns: list[~azure.mgmt.machinelearningservices.models.IndexColumn] - :keyword stage: Specifies the asset stage. - :paramtype stage: str + :keyword data_type: Specifies type. Possible values include: "String", "Integer", "Long", + "Float", "Double", "Binary", "Datetime", "Boolean". + :paramtype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType + :keyword feature_name: Specifies name. + :paramtype feature_name: str """ - super(FeaturestoreEntityVersionProperties, self).__init__(**kwargs) - self.index_columns = kwargs.get('index_columns', None) - self.provisioning_state = None - self.stage = kwargs.get('stage', None) + super(FeatureProperties, self).__init__(**kwargs) + self.data_type = kwargs.get('data_type', None) + self.feature_name = kwargs.get('feature_name', None) -class FeaturestoreEntityVersionResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of FeaturestoreEntityVersion entities. +class FeatureResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of Feature entities. - :ivar next_link: The link to the next page of FeaturestoreEntityVersion objects. If null, there - are no additional pages. + :ivar next_link: The link to the next page of Feature objects. If null, there are no additional + pages. :vartype next_link: str - :ivar value: An array of objects of type FeaturestoreEntityVersion. - :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + :ivar value: An array of objects of type Feature. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Feature] """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[FeaturestoreEntityVersion]'}, + 'value': {'key': 'value', 'type': '[Feature]'}, } def __init__( @@ -12129,32 +12623,53 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of FeaturestoreEntityVersion objects. If null, - there are no additional pages. + :keyword next_link: The link to the next page of Feature objects. If null, there are no + additional pages. :paramtype next_link: str - :keyword value: An array of objects of type FeaturestoreEntityVersion. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + :keyword value: An array of objects of type Feature. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.Feature] """ - super(FeaturestoreEntityVersionResourceArmPaginatedResult, self).__init__(**kwargs) + super(FeatureResourceArmPaginatedResult, self).__init__(**kwargs) self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) -class FeatureStoreSettings(msrest.serialization.Model): - """Settings for feature store type workspace. +class FeaturesetContainer(ProxyResource): + """Azure Resource Manager resource envelope. - :ivar compute_runtime: Compute runtime config for feature store type workspace. - :vartype compute_runtime: ~azure.mgmt.machinelearningservices.models.ComputeRuntimeDto - :ivar offline_store_connection_name: - :vartype offline_store_connection_name: str - :ivar online_store_connection_name: - :vartype online_store_connection_name: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetContainerProperties """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + _attribute_map = { - 'compute_runtime': {'key': 'computeRuntime', 'type': 'ComputeRuntimeDto'}, - 'offline_store_connection_name': {'key': 'offlineStoreConnectionName', 'type': 'str'}, - 'online_store_connection_name': {'key': 'onlineStoreConnectionName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'FeaturesetContainerProperties'}, } def __init__( @@ -12162,41 +12677,50 @@ def __init__( **kwargs ): """ - :keyword compute_runtime: Compute runtime config for feature store type workspace. - :paramtype compute_runtime: ~azure.mgmt.machinelearningservices.models.ComputeRuntimeDto - :keyword offline_store_connection_name: - :paramtype offline_store_connection_name: str - :keyword online_store_connection_name: - :paramtype online_store_connection_name: str + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetContainerProperties """ - super(FeatureStoreSettings, self).__init__(**kwargs) - self.compute_runtime = kwargs.get('compute_runtime', None) - self.offline_store_connection_name = kwargs.get('offline_store_connection_name', None) - self.online_store_connection_name = kwargs.get('online_store_connection_name', None) + super(FeaturesetContainer, self).__init__(**kwargs) + self.properties = kwargs['properties'] -class FeatureSubset(MonitoringFeatureFilterBase): - """FeatureSubset. +class FeaturesetContainerProperties(AssetContainer): + """DTO object representing feature set. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar filter_type: Required. [Required] Specifies the feature filter to leverage when selecting - features to calculate metrics over.Constant filled by server. Possible values include: - "AllFeatures", "TopNByAttribution", "FeatureSubset". - :vartype filter_type: str or - ~azure.mgmt.machinelearningservices.models.MonitoringFeatureFilterType - :ivar features: Required. [Required] The list of features to include. - :vartype features: list[str] + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar latest_version: The latest version inside this container. + :vartype latest_version: str + :ivar next_version: The next auto incremental version. + :vartype next_version: str + :ivar provisioning_state: Provisioning state for the featureset container. Possible values + include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ _validation = { - 'filter_type': {'required': True}, - 'features': {'required': True}, + 'latest_version': {'readonly': True}, + 'next_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'filter_type': {'key': 'filterType', 'type': 'str'}, - 'features': {'key': 'features', 'type': '[str]'}, + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'latest_version': {'key': 'latestVersion', 'type': 'str'}, + 'next_version': {'key': 'nextVersion', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } def __init__( @@ -12204,26 +12728,32 @@ def __init__( **kwargs ): """ - :keyword features: Required. [Required] The list of features to include. - :paramtype features: list[str] + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool """ - super(FeatureSubset, self).__init__(**kwargs) - self.filter_type = 'FeatureSubset' # type: str - self.features = kwargs['features'] + super(FeaturesetContainerProperties, self).__init__(**kwargs) + self.provisioning_state = None -class FeatureWindow(msrest.serialization.Model): - """Specifies the feature window. +class FeaturesetContainerResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of FeaturesetContainer entities. - :ivar feature_window_end: Specifies the feature window end time. - :vartype feature_window_end: ~datetime.datetime - :ivar feature_window_start: Specifies the feature window start time. - :vartype feature_window_start: ~datetime.datetime + :ivar next_link: The link to the next page of FeaturesetContainer objects. If null, there are + no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type FeaturesetContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] """ _attribute_map = { - 'feature_window_end': {'key': 'featureWindowEnd', 'type': 'iso-8601'}, - 'feature_window_start': {'key': 'featureWindowStart', 'type': 'iso-8601'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[FeaturesetContainer]'}, } def __init__( @@ -12231,25 +12761,26 @@ def __init__( **kwargs ): """ - :keyword feature_window_end: Specifies the feature window end time. - :paramtype feature_window_end: ~datetime.datetime - :keyword feature_window_start: Specifies the feature window start time. - :paramtype feature_window_start: ~datetime.datetime + :keyword next_link: The link to the next page of FeaturesetContainer objects. If null, there + are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type FeaturesetContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] """ - super(FeatureWindow, self).__init__(**kwargs) - self.feature_window_end = kwargs.get('feature_window_end', None) - self.feature_window_start = kwargs.get('feature_window_start', None) + super(FeaturesetContainerResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) -class FeaturizationSettings(msrest.serialization.Model): - """Featurization Configuration. +class FeaturesetSpecification(msrest.serialization.Model): + """DTO object representing specification. - :ivar dataset_language: Dataset language, useful for the text data. - :vartype dataset_language: str + :ivar path: Specifies the spec path. + :vartype path: str """ _attribute_map = { - 'dataset_language': {'key': 'datasetLanguage', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, } def __init__( @@ -12257,52 +12788,49 @@ def __init__( **kwargs ): """ - :keyword dataset_language: Dataset language, useful for the text data. - :paramtype dataset_language: str - """ - super(FeaturizationSettings, self).__init__(**kwargs) - self.dataset_language = kwargs.get('dataset_language', None) + :keyword path: Specifies the spec path. + :paramtype path: str + """ + super(FeaturesetSpecification, self).__init__(**kwargs) + self.path = kwargs.get('path', None) -class MonitoringInputDataBase(msrest.serialization.Model): - """Monitoring input data base definition. +class FeaturesetVersion(ProxyResource): + """Azure Resource Manager resource envelope. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FixedInputData, RollingInputData, StaticInputData. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar columns: Mapping of column names to special uses. - :vartype columns: dict[str, str] - :ivar data_context: The context metadata of the data source. - :vartype data_context: str - :ivar input_data_type: Required. [Required] Specifies the type of signal to monitor.Constant - filled by server. Possible values include: "Static", "Rolling", "Fixed". - :vartype input_data_type: str or - ~azure.mgmt.machinelearningservices.models.MonitoringInputDataType - :ivar job_input_type: Required. [Required] Specifies the type of job. Possible values include: - "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :ivar uri: Required. [Required] Input Asset URI. - :vartype uri: str + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionProperties """ _validation = { - 'input_data_type': {'required': True}, - 'job_input_type': {'required': True}, - 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, } _attribute_map = { - 'columns': {'key': 'columns', 'type': '{str}'}, - 'data_context': {'key': 'dataContext', 'type': 'str'}, - 'input_data_type': {'key': 'inputDataType', 'type': 'str'}, - 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - } - - _subtype_map = { - 'input_data_type': {'Fixed': 'FixedInputData', 'Rolling': 'RollingInputData', 'Static': 'StaticInputData'} + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'FeaturesetVersionProperties'}, } def __init__( @@ -12310,57 +12838,48 @@ def __init__( **kwargs ): """ - :keyword columns: Mapping of column names to special uses. - :paramtype columns: dict[str, str] - :keyword data_context: The context metadata of the data source. - :paramtype data_context: str - :keyword job_input_type: Required. [Required] Specifies the type of job. Possible values - include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", - "triton_model". - :paramtype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :keyword uri: Required. [Required] Input Asset URI. - :paramtype uri: str + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionProperties """ - super(MonitoringInputDataBase, self).__init__(**kwargs) - self.columns = kwargs.get('columns', None) - self.data_context = kwargs.get('data_context', None) - self.input_data_type = None # type: Optional[str] - self.job_input_type = kwargs['job_input_type'] - self.uri = kwargs['uri'] - + super(FeaturesetVersion, self).__init__(**kwargs) + self.properties = kwargs['properties'] -class FixedInputData(MonitoringInputDataBase): - """Fixed input data definition. - All required parameters must be populated in order to send to Azure. +class FeaturesetVersionBackfillRequest(msrest.serialization.Model): + """Request payload for creating a backfill request for a given feature set version. - :ivar columns: Mapping of column names to special uses. - :vartype columns: dict[str, str] - :ivar data_context: The context metadata of the data source. - :vartype data_context: str - :ivar input_data_type: Required. [Required] Specifies the type of signal to monitor.Constant - filled by server. Possible values include: "Static", "Rolling", "Fixed". - :vartype input_data_type: str or - ~azure.mgmt.machinelearningservices.models.MonitoringInputDataType - :ivar job_input_type: Required. [Required] Specifies the type of job. Possible values include: - "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :ivar uri: Required. [Required] Input Asset URI. - :vartype uri: str + :ivar data_availability_status: Specified the data availability status that you want to + backfill. + :vartype data_availability_status: list[str or + ~azure.mgmt.machinelearningservices.models.DataAvailabilityStatus] + :ivar description: Specifies description. + :vartype description: str + :ivar display_name: Specifies description. + :vartype display_name: str + :ivar feature_window: Specifies the backfill feature window to be materialized. + :vartype feature_window: ~azure.mgmt.machinelearningservices.models.FeatureWindow + :ivar job_id: Specify the jobId to retry the failed materialization. + :vartype job_id: str + :ivar properties: Specifies the properties. + :vartype properties: dict[str, str] + :ivar resource: Specifies the compute resource settings. + :vartype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource + :ivar spark_configuration: Specifies the spark compute settings. + :vartype spark_configuration: dict[str, str] + :ivar tags: A set of tags. Specifies the tags. + :vartype tags: dict[str, str] """ - _validation = { - 'input_data_type': {'required': True}, - 'job_input_type': {'required': True}, - 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, - } - _attribute_map = { - 'columns': {'key': 'columns', 'type': '{str}'}, - 'data_context': {'key': 'dataContext', 'type': 'str'}, - 'input_data_type': {'key': 'inputDataType', 'type': 'str'}, - 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, + 'data_availability_status': {'key': 'dataAvailabilityStatus', 'type': '[str]'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'feature_window': {'key': 'featureWindow', 'type': 'FeatureWindow'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'resource': {'key': 'resource', 'type': 'MaterializationComputeResource'}, + 'spark_configuration': {'key': 'sparkConfiguration', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__( @@ -12368,30 +12887,48 @@ def __init__( **kwargs ): """ - :keyword columns: Mapping of column names to special uses. - :paramtype columns: dict[str, str] - :keyword data_context: The context metadata of the data source. - :paramtype data_context: str - :keyword job_input_type: Required. [Required] Specifies the type of job. Possible values - include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", - "triton_model". - :paramtype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :keyword uri: Required. [Required] Input Asset URI. - :paramtype uri: str + :keyword data_availability_status: Specified the data availability status that you want to + backfill. + :paramtype data_availability_status: list[str or + ~azure.mgmt.machinelearningservices.models.DataAvailabilityStatus] + :keyword description: Specifies description. + :paramtype description: str + :keyword display_name: Specifies description. + :paramtype display_name: str + :keyword feature_window: Specifies the backfill feature window to be materialized. + :paramtype feature_window: ~azure.mgmt.machinelearningservices.models.FeatureWindow + :keyword job_id: Specify the jobId to retry the failed materialization. + :paramtype job_id: str + :keyword properties: Specifies the properties. + :paramtype properties: dict[str, str] + :keyword resource: Specifies the compute resource settings. + :paramtype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource + :keyword spark_configuration: Specifies the spark compute settings. + :paramtype spark_configuration: dict[str, str] + :keyword tags: A set of tags. Specifies the tags. + :paramtype tags: dict[str, str] """ - super(FixedInputData, self).__init__(**kwargs) - self.input_data_type = 'Fixed' # type: str + super(FeaturesetVersionBackfillRequest, self).__init__(**kwargs) + self.data_availability_status = kwargs.get('data_availability_status', None) + self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) + self.feature_window = kwargs.get('feature_window', None) + self.job_id = kwargs.get('job_id', None) + self.properties = kwargs.get('properties', None) + self.resource = kwargs.get('resource', None) + self.spark_configuration = kwargs.get('spark_configuration', None) + self.tags = kwargs.get('tags', None) -class FlavorData(msrest.serialization.Model): - """FlavorData. +class FeaturesetVersionBackfillResponse(msrest.serialization.Model): + """Response payload for creating a backfill request for a given feature set version. - :ivar data: Model flavor-specific data. - :vartype data: dict[str, str] + :ivar job_ids: List of jobs submitted as part of the backfill request. + :vartype job_ids: list[str] """ _attribute_map = { - 'data': {'key': 'data', 'type': '{str}'}, + 'job_ids': {'key': 'jobIds', 'type': '[str]'}, } def __init__( @@ -12399,92 +12936,58 @@ def __init__( **kwargs ): """ - :keyword data: Model flavor-specific data. - :paramtype data: dict[str, str] + :keyword job_ids: List of jobs submitted as part of the backfill request. + :paramtype job_ids: list[str] """ - super(FlavorData, self).__init__(**kwargs) - self.data = kwargs.get('data', None) + super(FeaturesetVersionBackfillResponse, self).__init__(**kwargs) + self.job_ids = kwargs.get('job_ids', None) -class Forecasting(AutoMLVertical, TableVertical): - """Forecasting task in AutoML Table vertical. +class FeaturesetVersionProperties(AssetBase): + """DTO object representing feature set version. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar cv_split_column_names: Columns to use for CVSplit data. - :vartype cv_split_column_names: list[str] - :ivar featurization_settings: Featurization inputs needed for AutoML job. - :vartype featurization_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings - :ivar limit_settings: Execution constraints for AutoMLJob. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings - :ivar n_cross_validations: Number of cross validation folds to be applied on training dataset - when validation dataset is not provided. - :vartype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations - :ivar test_data: Test data input. - :vartype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar test_data_size: The fraction of test dataset that needs to be set aside for validation - purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype test_data_size: float - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar weight_column_name: The name of the sample weight column. Automated ML supports a - weighted column as an input, causing rows in the data to be weighted up or down. - :vartype weight_column_name: str - :ivar log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", - "Info", "Warning", "Error", "Critical". - :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :ivar target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :vartype target_column_name: str - :ivar task_type: Required. [Required] Task type for AutoMLJob.Constant filled by server. - Possible values include: "Classification", "Regression", "Forecasting", "ImageClassification", - "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", - "TextClassification", "TextClassificationMultilabel", "TextNER". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType - :ivar training_data: Required. [Required] Training data input. - :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar forecasting_settings: Forecasting task specific inputs. - :vartype forecasting_settings: ~azure.mgmt.machinelearningservices.models.ForecastingSettings - :ivar primary_metric: Primary metric for forecasting task. Possible values include: - "SpearmanCorrelation", "NormalizedRootMeanSquaredError", "R2Score", - "NormalizedMeanAbsoluteError". - :vartype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ForecastingPrimaryMetrics - :ivar training_settings: Inputs for training phase for an AutoML Job. - :vartype training_settings: - ~azure.mgmt.machinelearningservices.models.ForecastingTrainingSettings + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar entities: Specifies list of entities. + :vartype entities: list[str] + :ivar materialization_settings: Specifies the materialization settings. + :vartype materialization_settings: + ~azure.mgmt.machinelearningservices.models.MaterializationSettings + :ivar provisioning_state: Provisioning state for the featureset version container. Possible + values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar specification: Specifies the feature spec details. + :vartype specification: ~azure.mgmt.machinelearningservices.models.FeaturesetSpecification + :ivar stage: Specifies the asset stage. + :vartype stage: str """ _validation = { - 'task_type': {'required': True}, - 'training_data': {'required': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'cv_split_column_names': {'key': 'cvSplitColumnNames', 'type': '[str]'}, - 'featurization_settings': {'key': 'featurizationSettings', 'type': 'TableVerticalFeaturizationSettings'}, - 'limit_settings': {'key': 'limitSettings', 'type': 'TableVerticalLimitSettings'}, - 'n_cross_validations': {'key': 'nCrossValidations', 'type': 'NCrossValidations'}, - 'test_data': {'key': 'testData', 'type': 'MLTableJobInput'}, - 'test_data_size': {'key': 'testDataSize', 'type': 'float'}, - 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, - 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, - 'weight_column_name': {'key': 'weightColumnName', 'type': 'str'}, - 'log_verbosity': {'key': 'logVerbosity', 'type': 'str'}, - 'target_column_name': {'key': 'targetColumnName', 'type': 'str'}, - 'task_type': {'key': 'taskType', 'type': 'str'}, - 'training_data': {'key': 'trainingData', 'type': 'MLTableJobInput'}, - 'forecasting_settings': {'key': 'forecastingSettings', 'type': 'ForecastingSettings'}, - 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, - 'training_settings': {'key': 'trainingSettings', 'type': 'ForecastingTrainingSettings'}, + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'entities': {'key': 'entities', 'type': '[str]'}, + 'materialization_settings': {'key': 'materializationSettings', 'type': 'MaterializationSettings'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'specification': {'key': 'specification', 'type': 'FeaturesetSpecification'}, + 'stage': {'key': 'stage', 'type': 'str'}, } def __init__( @@ -12492,141 +12995,47 @@ def __init__( **kwargs ): """ - :keyword cv_split_column_names: Columns to use for CVSplit data. - :paramtype cv_split_column_names: list[str] - :keyword featurization_settings: Featurization inputs needed for AutoML job. - :paramtype featurization_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings - :keyword limit_settings: Execution constraints for AutoMLJob. - :paramtype limit_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings - :keyword n_cross_validations: Number of cross validation folds to be applied on training - dataset - when validation dataset is not provided. - :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations - :keyword test_data: Test data input. - :paramtype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword test_data_size: The fraction of test dataset that needs to be set aside for validation - purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype test_data_size: float - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword weight_column_name: The name of the sample weight column. Automated ML supports a - weighted column as an input, causing rows in the data to be weighted up or down. - :paramtype weight_column_name: str - :keyword log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", - "Info", "Warning", "Error", "Critical". - :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :keyword target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :paramtype target_column_name: str - :keyword training_data: Required. [Required] Training data input. - :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword forecasting_settings: Forecasting task specific inputs. - :paramtype forecasting_settings: ~azure.mgmt.machinelearningservices.models.ForecastingSettings - :keyword primary_metric: Primary metric for forecasting task. Possible values include: - "SpearmanCorrelation", "NormalizedRootMeanSquaredError", "R2Score", - "NormalizedMeanAbsoluteError". - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ForecastingPrimaryMetrics - :keyword training_settings: Inputs for training phase for an AutoML Job. - :paramtype training_settings: - ~azure.mgmt.machinelearningservices.models.ForecastingTrainingSettings + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword entities: Specifies list of entities. + :paramtype entities: list[str] + :keyword materialization_settings: Specifies the materialization settings. + :paramtype materialization_settings: + ~azure.mgmt.machinelearningservices.models.MaterializationSettings + :keyword specification: Specifies the feature spec details. + :paramtype specification: ~azure.mgmt.machinelearningservices.models.FeaturesetSpecification + :keyword stage: Specifies the asset stage. + :paramtype stage: str """ - super(Forecasting, self).__init__(**kwargs) - self.cv_split_column_names = kwargs.get('cv_split_column_names', None) - self.featurization_settings = kwargs.get('featurization_settings', None) - self.limit_settings = kwargs.get('limit_settings', None) - self.n_cross_validations = kwargs.get('n_cross_validations', None) - self.test_data = kwargs.get('test_data', None) - self.test_data_size = kwargs.get('test_data_size', None) - self.validation_data = kwargs.get('validation_data', None) - self.validation_data_size = kwargs.get('validation_data_size', None) - self.weight_column_name = kwargs.get('weight_column_name', None) - self.task_type = 'Forecasting' # type: str - self.forecasting_settings = kwargs.get('forecasting_settings', None) - self.primary_metric = kwargs.get('primary_metric', None) - self.training_settings = kwargs.get('training_settings', None) - self.log_verbosity = kwargs.get('log_verbosity', None) - self.target_column_name = kwargs.get('target_column_name', None) - self.training_data = kwargs['training_data'] + super(FeaturesetVersionProperties, self).__init__(**kwargs) + self.entities = kwargs.get('entities', None) + self.materialization_settings = kwargs.get('materialization_settings', None) + self.provisioning_state = None + self.specification = kwargs.get('specification', None) + self.stage = kwargs.get('stage', None) -class ForecastingSettings(msrest.serialization.Model): - """Forecasting specific parameters. +class FeaturesetVersionResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of FeaturesetVersion entities. - :ivar country_or_region_for_holidays: Country or region for holidays for forecasting tasks. - These should be ISO 3166 two-letter country/region codes, for example 'US' or 'GB'. - :vartype country_or_region_for_holidays: str - :ivar cv_step_size: Number of periods between the origin time of one CV fold and the next fold. - For - example, if ``CVStepSize`` = 3 for daily data, the origin time for each fold will be - three days apart. - :vartype cv_step_size: int - :ivar feature_lags: Flag for generating lags for the numeric features with 'auto' or null. - Possible values include: "None", "Auto". - :vartype feature_lags: str or ~azure.mgmt.machinelearningservices.models.FeatureLags - :ivar forecast_horizon: The desired maximum forecast horizon in units of time-series frequency. - :vartype forecast_horizon: ~azure.mgmt.machinelearningservices.models.ForecastHorizon - :ivar frequency: When forecasting, this parameter represents the period with which the forecast - is desired, for example daily, weekly, yearly, etc. The forecast frequency is dataset frequency - by default. - :vartype frequency: str - :ivar seasonality: Set time series seasonality as an integer multiple of the series frequency. - If seasonality is set to 'auto', it will be inferred. - :vartype seasonality: ~azure.mgmt.machinelearningservices.models.Seasonality - :ivar short_series_handling_config: The parameter defining how if AutoML should handle short - time series. Possible values include: "None", "Auto", "Pad", "Drop". - :vartype short_series_handling_config: str or - ~azure.mgmt.machinelearningservices.models.ShortSeriesHandlingConfiguration - :ivar target_aggregate_function: The function to be used to aggregate the time series target - column to conform to a user specified frequency. - If the TargetAggregateFunction is set i.e. not 'None', but the freq parameter is not set, the - error is raised. The possible target aggregation functions are: "sum", "max", "min" and "mean". - Possible values include: "None", "Sum", "Max", "Min", "Mean". - :vartype target_aggregate_function: str or - ~azure.mgmt.machinelearningservices.models.TargetAggregationFunction - :ivar target_lags: The number of past periods to lag from the target column. - :vartype target_lags: ~azure.mgmt.machinelearningservices.models.TargetLags - :ivar target_rolling_window_size: The number of past periods used to create a rolling window - average of the target column. - :vartype target_rolling_window_size: - ~azure.mgmt.machinelearningservices.models.TargetRollingWindowSize - :ivar time_column_name: The name of the time column. This parameter is required when - forecasting to specify the datetime column in the input data used for building the time series - and inferring its frequency. - :vartype time_column_name: str - :ivar time_series_id_column_names: The names of columns used to group a timeseries. It can be - used to create multiple series. - If grain is not defined, the data set is assumed to be one time-series. This parameter is used - with task type forecasting. - :vartype time_series_id_column_names: list[str] - :ivar use_stl: Configure STL Decomposition of the time-series target column. Possible values - include: "None", "Season", "SeasonTrend". - :vartype use_stl: str or ~azure.mgmt.machinelearningservices.models.UseStl + :ivar next_link: The link to the next page of FeaturesetVersion objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type FeaturesetVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] """ _attribute_map = { - 'country_or_region_for_holidays': {'key': 'countryOrRegionForHolidays', 'type': 'str'}, - 'cv_step_size': {'key': 'cvStepSize', 'type': 'int'}, - 'feature_lags': {'key': 'featureLags', 'type': 'str'}, - 'forecast_horizon': {'key': 'forecastHorizon', 'type': 'ForecastHorizon'}, - 'frequency': {'key': 'frequency', 'type': 'str'}, - 'seasonality': {'key': 'seasonality', 'type': 'Seasonality'}, - 'short_series_handling_config': {'key': 'shortSeriesHandlingConfig', 'type': 'str'}, - 'target_aggregate_function': {'key': 'targetAggregateFunction', 'type': 'str'}, - 'target_lags': {'key': 'targetLags', 'type': 'TargetLags'}, - 'target_rolling_window_size': {'key': 'targetRollingWindowSize', 'type': 'TargetRollingWindowSize'}, - 'time_column_name': {'key': 'timeColumnName', 'type': 'str'}, - 'time_series_id_column_names': {'key': 'timeSeriesIdColumnNames', 'type': '[str]'}, - 'use_stl': {'key': 'useStl', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[FeaturesetVersion]'}, } def __init__( @@ -12634,112 +13043,54 @@ def __init__( **kwargs ): """ - :keyword country_or_region_for_holidays: Country or region for holidays for forecasting tasks. - These should be ISO 3166 two-letter country/region codes, for example 'US' or 'GB'. - :paramtype country_or_region_for_holidays: str - :keyword cv_step_size: Number of periods between the origin time of one CV fold and the next - fold. For - example, if ``CVStepSize`` = 3 for daily data, the origin time for each fold will be - three days apart. - :paramtype cv_step_size: int - :keyword feature_lags: Flag for generating lags for the numeric features with 'auto' or null. - Possible values include: "None", "Auto". - :paramtype feature_lags: str or ~azure.mgmt.machinelearningservices.models.FeatureLags - :keyword forecast_horizon: The desired maximum forecast horizon in units of time-series - frequency. - :paramtype forecast_horizon: ~azure.mgmt.machinelearningservices.models.ForecastHorizon - :keyword frequency: When forecasting, this parameter represents the period with which the - forecast is desired, for example daily, weekly, yearly, etc. The forecast frequency is dataset - frequency by default. - :paramtype frequency: str - :keyword seasonality: Set time series seasonality as an integer multiple of the series - frequency. - If seasonality is set to 'auto', it will be inferred. - :paramtype seasonality: ~azure.mgmt.machinelearningservices.models.Seasonality - :keyword short_series_handling_config: The parameter defining how if AutoML should handle short - time series. Possible values include: "None", "Auto", "Pad", "Drop". - :paramtype short_series_handling_config: str or - ~azure.mgmt.machinelearningservices.models.ShortSeriesHandlingConfiguration - :keyword target_aggregate_function: The function to be used to aggregate the time series target - column to conform to a user specified frequency. - If the TargetAggregateFunction is set i.e. not 'None', but the freq parameter is not set, the - error is raised. The possible target aggregation functions are: "sum", "max", "min" and "mean". - Possible values include: "None", "Sum", "Max", "Min", "Mean". - :paramtype target_aggregate_function: str or - ~azure.mgmt.machinelearningservices.models.TargetAggregationFunction - :keyword target_lags: The number of past periods to lag from the target column. - :paramtype target_lags: ~azure.mgmt.machinelearningservices.models.TargetLags - :keyword target_rolling_window_size: The number of past periods used to create a rolling window - average of the target column. - :paramtype target_rolling_window_size: - ~azure.mgmt.machinelearningservices.models.TargetRollingWindowSize - :keyword time_column_name: The name of the time column. This parameter is required when - forecasting to specify the datetime column in the input data used for building the time series - and inferring its frequency. - :paramtype time_column_name: str - :keyword time_series_id_column_names: The names of columns used to group a timeseries. It can - be used to create multiple series. - If grain is not defined, the data set is assumed to be one time-series. This parameter is used - with task type forecasting. - :paramtype time_series_id_column_names: list[str] - :keyword use_stl: Configure STL Decomposition of the time-series target column. Possible values - include: "None", "Season", "SeasonTrend". - :paramtype use_stl: str or ~azure.mgmt.machinelearningservices.models.UseStl + :keyword next_link: The link to the next page of FeaturesetVersion objects. If null, there are + no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type FeaturesetVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] """ - super(ForecastingSettings, self).__init__(**kwargs) - self.country_or_region_for_holidays = kwargs.get('country_or_region_for_holidays', None) - self.cv_step_size = kwargs.get('cv_step_size', None) - self.feature_lags = kwargs.get('feature_lags', None) - self.forecast_horizon = kwargs.get('forecast_horizon', None) - self.frequency = kwargs.get('frequency', None) - self.seasonality = kwargs.get('seasonality', None) - self.short_series_handling_config = kwargs.get('short_series_handling_config', None) - self.target_aggregate_function = kwargs.get('target_aggregate_function', None) - self.target_lags = kwargs.get('target_lags', None) - self.target_rolling_window_size = kwargs.get('target_rolling_window_size', None) - self.time_column_name = kwargs.get('time_column_name', None) - self.time_series_id_column_names = kwargs.get('time_series_id_column_names', None) - self.use_stl = kwargs.get('use_stl', None) + super(FeaturesetVersionResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) -class ForecastingTrainingSettings(TrainingSettings): - """Forecasting Training related configuration. +class FeaturestoreEntityContainer(ProxyResource): + """Azure Resource Manager resource envelope. - :ivar enable_dnn_training: Enable recommendation of DNN models. - :vartype enable_dnn_training: bool - :ivar enable_model_explainability: Flag to turn on explainability on best model. - :vartype enable_model_explainability: bool - :ivar enable_onnx_compatible_models: Flag for enabling onnx compatible models. - :vartype enable_onnx_compatible_models: bool - :ivar enable_stack_ensemble: Enable stack ensemble run. - :vartype enable_stack_ensemble: bool - :ivar enable_vote_ensemble: Enable voting ensemble run. - :vartype enable_vote_ensemble: bool - :ivar ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model - generation, multiple fitted models from the previous child runs are downloaded. - Configure this parameter with a higher value than 300 secs, if more time is needed. - :vartype ensemble_model_download_timeout: ~datetime.timedelta - :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. - :vartype stack_ensemble_settings: - ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings - :ivar allowed_training_algorithms: Allowed models for forecasting task. - :vartype allowed_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.ForecastingModels] - :ivar blocked_training_algorithms: Blocked models for forecasting task. - :vartype blocked_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.ForecastingModels] + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainerProperties """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + _attribute_map = { - 'enable_dnn_training': {'key': 'enableDnnTraining', 'type': 'bool'}, - 'enable_model_explainability': {'key': 'enableModelExplainability', 'type': 'bool'}, - 'enable_onnx_compatible_models': {'key': 'enableOnnxCompatibleModels', 'type': 'bool'}, - 'enable_stack_ensemble': {'key': 'enableStackEnsemble', 'type': 'bool'}, - 'enable_vote_ensemble': {'key': 'enableVoteEnsemble', 'type': 'bool'}, - 'ensemble_model_download_timeout': {'key': 'ensembleModelDownloadTimeout', 'type': 'duration'}, - 'stack_ensemble_settings': {'key': 'stackEnsembleSettings', 'type': 'StackEnsembleSettings'}, - 'allowed_training_algorithms': {'key': 'allowedTrainingAlgorithms', 'type': '[str]'}, - 'blocked_training_algorithms': {'key': 'blockedTrainingAlgorithms', 'type': '[str]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'FeaturestoreEntityContainerProperties'}, } def __init__( @@ -12747,47 +13098,51 @@ def __init__( **kwargs ): """ - :keyword enable_dnn_training: Enable recommendation of DNN models. - :paramtype enable_dnn_training: bool - :keyword enable_model_explainability: Flag to turn on explainability on best model. - :paramtype enable_model_explainability: bool - :keyword enable_onnx_compatible_models: Flag for enabling onnx compatible models. - :paramtype enable_onnx_compatible_models: bool - :keyword enable_stack_ensemble: Enable stack ensemble run. - :paramtype enable_stack_ensemble: bool - :keyword enable_vote_ensemble: Enable voting ensemble run. - :paramtype enable_vote_ensemble: bool - :keyword ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model - generation, multiple fitted models from the previous child runs are downloaded. - Configure this parameter with a higher value than 300 secs, if more time is needed. - :paramtype ensemble_model_download_timeout: ~datetime.timedelta - :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. - :paramtype stack_ensemble_settings: - ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings - :keyword allowed_training_algorithms: Allowed models for forecasting task. - :paramtype allowed_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.ForecastingModels] - :keyword blocked_training_algorithms: Blocked models for forecasting task. - :paramtype blocked_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.ForecastingModels] + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainerProperties """ - super(ForecastingTrainingSettings, self).__init__(**kwargs) - self.allowed_training_algorithms = kwargs.get('allowed_training_algorithms', None) - self.blocked_training_algorithms = kwargs.get('blocked_training_algorithms', None) + super(FeaturestoreEntityContainer, self).__init__(**kwargs) + self.properties = kwargs['properties'] -class FQDNEndpoint(msrest.serialization.Model): - """FQDNEndpoint. +class FeaturestoreEntityContainerProperties(AssetContainer): + """DTO object representing feature entity. - :ivar domain_name: - :vartype domain_name: str - :ivar endpoint_details: - :vartype endpoint_details: list[~azure.mgmt.machinelearningservices.models.FQDNEndpointDetail] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar latest_version: The latest version inside this container. + :vartype latest_version: str + :ivar next_version: The next auto incremental version. + :vartype next_version: str + :ivar provisioning_state: Provisioning state for the featurestore entity container. Possible + values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ + _validation = { + 'latest_version': {'readonly': True}, + 'next_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[FQDNEndpointDetail]'}, + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'latest_version': {'key': 'latestVersion', 'type': 'str'}, + 'next_version': {'key': 'nextVersion', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } def __init__( @@ -12795,26 +13150,32 @@ def __init__( **kwargs ): """ - :keyword domain_name: - :paramtype domain_name: str - :keyword endpoint_details: - :paramtype endpoint_details: - list[~azure.mgmt.machinelearningservices.models.FQDNEndpointDetail] + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool """ - super(FQDNEndpoint, self).__init__(**kwargs) - self.domain_name = kwargs.get('domain_name', None) - self.endpoint_details = kwargs.get('endpoint_details', None) + super(FeaturestoreEntityContainerProperties, self).__init__(**kwargs) + self.provisioning_state = None -class FQDNEndpointDetail(msrest.serialization.Model): - """FQDNEndpointDetail. +class FeaturestoreEntityContainerResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of FeaturestoreEntityContainer entities. - :ivar port: - :vartype port: int + :ivar next_link: The link to the next page of FeaturestoreEntityContainer objects. If null, + there are no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type FeaturestoreEntityContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] """ _attribute_map = { - 'port': {'key': 'port', 'type': 'int'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[FeaturestoreEntityContainer]'}, } def __init__( @@ -12822,22 +13183,54 @@ def __init__( **kwargs ): """ - :keyword port: - :paramtype port: int + :keyword next_link: The link to the next page of FeaturestoreEntityContainer objects. If null, + there are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type FeaturestoreEntityContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] """ - super(FQDNEndpointDetail, self).__init__(**kwargs) - self.port = kwargs.get('port', None) + super(FeaturestoreEntityContainerResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) -class FQDNEndpoints(msrest.serialization.Model): - """FQDNEndpoints. +class FeaturestoreEntityVersion(ProxyResource): + """Azure Resource Manager resource envelope. - :ivar properties: - :vartype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpointsProperties + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersionProperties """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + _attribute_map = { - 'properties': {'key': 'properties', 'type': 'FQDNEndpointsProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'FeaturestoreEntityVersionProperties'}, } def __init__( @@ -12845,25 +13238,52 @@ def __init__( **kwargs ): """ - :keyword properties: - :paramtype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpointsProperties + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersionProperties """ - super(FQDNEndpoints, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) + super(FeaturestoreEntityVersion, self).__init__(**kwargs) + self.properties = kwargs['properties'] -class FQDNEndpointsProperties(msrest.serialization.Model): - """FQDNEndpointsProperties. +class FeaturestoreEntityVersionProperties(AssetBase): + """DTO object representing feature entity version. - :ivar category: - :vartype category: str - :ivar endpoints: - :vartype endpoints: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoint] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar index_columns: Specifies index columns. + :vartype index_columns: list[~azure.mgmt.machinelearningservices.models.IndexColumn] + :ivar provisioning_state: Provisioning state for the featurestore entity version. Possible + values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar stage: Specifies the asset stage. + :vartype stage: str """ + _validation = { + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[FQDNEndpoint]'}, + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'index_columns': {'key': 'indexColumns', 'type': '[IndexColumn]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, } def __init__( @@ -12871,48 +13291,73 @@ def __init__( **kwargs ): """ - :keyword category: - :paramtype category: str - :keyword endpoints: - :paramtype endpoints: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoint] + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword index_columns: Specifies index columns. + :paramtype index_columns: list[~azure.mgmt.machinelearningservices.models.IndexColumn] + :keyword stage: Specifies the asset stage. + :paramtype stage: str """ - super(FQDNEndpointsProperties, self).__init__(**kwargs) - self.category = kwargs.get('category', None) - self.endpoints = kwargs.get('endpoints', None) - - -class OutboundRule(msrest.serialization.Model): - """Outbound Rule for the managed network of a machine learning workspace. + super(FeaturestoreEntityVersionProperties, self).__init__(**kwargs) + self.index_columns = kwargs.get('index_columns', None) + self.provisioning_state = None + self.stage = kwargs.get('stage', None) - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FqdnOutboundRule, PrivateEndpointOutboundRule, ServiceTagOutboundRule. - All required parameters must be populated in order to send to Azure. +class FeaturestoreEntityVersionResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of FeaturestoreEntityVersion entities. - :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Required", "Recommended", "UserDefined", "Dependency". - :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory - :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Possible - values include: "Inactive", "Active". - :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus - :ivar type: Required. Type of a managed network Outbound Rule of a machine learning - workspace.Constant filled by server. Possible values include: "FQDN", "PrivateEndpoint", - "ServiceTag". - :vartype type: str or ~azure.mgmt.machinelearningservices.models.RuleType + :ivar next_link: The link to the next page of FeaturestoreEntityVersion objects. If null, there + are no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type FeaturestoreEntityVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] """ - _validation = { - 'type': {'required': True}, - } - _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[FeaturestoreEntityVersion]'}, } - _subtype_map = { - 'type': {'FQDN': 'FqdnOutboundRule', 'PrivateEndpoint': 'PrivateEndpointOutboundRule', 'ServiceTag': 'ServiceTagOutboundRule'} + def __init__( + self, + **kwargs + ): + """ + :keyword next_link: The link to the next page of FeaturestoreEntityVersion objects. If null, + there are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type FeaturestoreEntityVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + """ + super(FeaturestoreEntityVersionResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class FeatureStoreSettings(msrest.serialization.Model): + """FeatureStoreSettings. + + :ivar compute_runtime: + :vartype compute_runtime: ~azure.mgmt.machinelearningservices.models.ComputeRuntimeDto + :ivar offline_store_connection_name: + :vartype offline_store_connection_name: str + :ivar online_store_connection_name: + :vartype online_store_connection_name: str + """ + + _attribute_map = { + 'compute_runtime': {'key': 'computeRuntime', 'type': 'ComputeRuntimeDto'}, + 'offline_store_connection_name': {'key': 'offlineStoreConnectionName', 'type': 'str'}, + 'online_store_connection_name': {'key': 'onlineStoreConnectionName', 'type': 'str'}, } def __init__( @@ -12920,47 +13365,41 @@ def __init__( **kwargs ): """ - :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Required", "Recommended", "UserDefined", "Dependency". - :paramtype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory - :keyword status: Type of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Inactive", "Active". - :paramtype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :keyword compute_runtime: + :paramtype compute_runtime: ~azure.mgmt.machinelearningservices.models.ComputeRuntimeDto + :keyword offline_store_connection_name: + :paramtype offline_store_connection_name: str + :keyword online_store_connection_name: + :paramtype online_store_connection_name: str """ - super(OutboundRule, self).__init__(**kwargs) - self.category = kwargs.get('category', None) - self.status = kwargs.get('status', None) - self.type = None # type: Optional[str] + super(FeatureStoreSettings, self).__init__(**kwargs) + self.compute_runtime = kwargs.get('compute_runtime', None) + self.offline_store_connection_name = kwargs.get('offline_store_connection_name', None) + self.online_store_connection_name = kwargs.get('online_store_connection_name', None) -class FqdnOutboundRule(OutboundRule): - """FQDN Outbound Rule for the managed network of a machine learning workspace. +class FeatureSubset(MonitoringFeatureFilterBase): + """FeatureSubset. All required parameters must be populated in order to send to Azure. - :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Required", "Recommended", "UserDefined", "Dependency". - :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory - :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Possible - values include: "Inactive", "Active". - :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus - :ivar type: Required. Type of a managed network Outbound Rule of a machine learning - workspace.Constant filled by server. Possible values include: "FQDN", "PrivateEndpoint", - "ServiceTag". - :vartype type: str or ~azure.mgmt.machinelearningservices.models.RuleType - :ivar destination: - :vartype destination: str + :ivar filter_type: Required. [Required] Specifies the feature filter to leverage when selecting + features to calculate metrics over.Constant filled by server. Possible values include: + "AllFeatures", "TopNByAttribution", "FeatureSubset". + :vartype filter_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureFilterType + :ivar features: Required. [Required] The list of features to include. + :vartype features: list[str] """ _validation = { - 'type': {'required': True}, + 'filter_type': {'required': True}, + 'features': {'required': True}, } _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'destination': {'key': 'destination', 'type': 'str'}, + 'filter_type': {'key': 'filterType', 'type': 'str'}, + 'features': {'key': 'features', 'type': '[str]'}, } def __init__( @@ -12968,35 +13407,26 @@ def __init__( **kwargs ): """ - :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Required", "Recommended", "UserDefined", "Dependency". - :paramtype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory - :keyword status: Type of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Inactive", "Active". - :paramtype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus - :keyword destination: - :paramtype destination: str + :keyword features: Required. [Required] The list of features to include. + :paramtype features: list[str] """ - super(FqdnOutboundRule, self).__init__(**kwargs) - self.type = 'FQDN' # type: str - self.destination = kwargs.get('destination', None) + super(FeatureSubset, self).__init__(**kwargs) + self.filter_type = 'FeatureSubset' # type: str + self.features = kwargs['features'] -class GetBlobReferenceForConsumptionDto(msrest.serialization.Model): - """GetBlobReferenceForConsumptionDto. +class FeatureWindow(msrest.serialization.Model): + """Specifies the feature window. - :ivar blob_uri: Blob uri, example: https://blob.windows.core.net/Container/Path. - :vartype blob_uri: str - :ivar credential: Credential info to access storage account. - :vartype credential: ~azure.mgmt.machinelearningservices.models.DataReferenceCredential - :ivar storage_account_arm_id: The ARM id of the storage account. - :vartype storage_account_arm_id: str + :ivar feature_window_end: Specifies the feature window end time. + :vartype feature_window_end: ~datetime.datetime + :ivar feature_window_start: Specifies the feature window start time. + :vartype feature_window_start: ~datetime.datetime """ _attribute_map = { - 'blob_uri': {'key': 'blobUri', 'type': 'str'}, - 'credential': {'key': 'credential', 'type': 'DataReferenceCredential'}, - 'storage_account_arm_id': {'key': 'storageAccountArmId', 'type': 'str'}, + 'feature_window_end': {'key': 'featureWindowEnd', 'type': 'iso-8601'}, + 'feature_window_start': {'key': 'featureWindowStart', 'type': 'iso-8601'}, } def __init__( @@ -13004,31 +13434,25 @@ def __init__( **kwargs ): """ - :keyword blob_uri: Blob uri, example: https://blob.windows.core.net/Container/Path. - :paramtype blob_uri: str - :keyword credential: Credential info to access storage account. - :paramtype credential: ~azure.mgmt.machinelearningservices.models.DataReferenceCredential - :keyword storage_account_arm_id: The ARM id of the storage account. - :paramtype storage_account_arm_id: str + :keyword feature_window_end: Specifies the feature window end time. + :paramtype feature_window_end: ~datetime.datetime + :keyword feature_window_start: Specifies the feature window start time. + :paramtype feature_window_start: ~datetime.datetime """ - super(GetBlobReferenceForConsumptionDto, self).__init__(**kwargs) - self.blob_uri = kwargs.get('blob_uri', None) - self.credential = kwargs.get('credential', None) - self.storage_account_arm_id = kwargs.get('storage_account_arm_id', None) + super(FeatureWindow, self).__init__(**kwargs) + self.feature_window_end = kwargs.get('feature_window_end', None) + self.feature_window_start = kwargs.get('feature_window_start', None) -class GetBlobReferenceSASRequestDto(msrest.serialization.Model): - """BlobReferenceSASRequest for getBlobReferenceSAS API. +class FeaturizationSettings(msrest.serialization.Model): + """Featurization Configuration. - :ivar asset_id: Id of the asset to be accessed. - :vartype asset_id: str - :ivar blob_uri: Blob uri of the asset to be accessed. - :vartype blob_uri: str + :ivar dataset_language: Dataset language, useful for the text data. + :vartype dataset_language: str """ _attribute_map = { - 'asset_id': {'key': 'assetId', 'type': 'str'}, - 'blob_uri': {'key': 'blobUri', 'type': 'str'}, + 'dataset_language': {'key': 'datasetLanguage', 'type': 'str'}, } def __init__( @@ -13036,26 +13460,52 @@ def __init__( **kwargs ): """ - :keyword asset_id: Id of the asset to be accessed. - :paramtype asset_id: str - :keyword blob_uri: Blob uri of the asset to be accessed. - :paramtype blob_uri: str + :keyword dataset_language: Dataset language, useful for the text data. + :paramtype dataset_language: str """ - super(GetBlobReferenceSASRequestDto, self).__init__(**kwargs) - self.asset_id = kwargs.get('asset_id', None) - self.blob_uri = kwargs.get('blob_uri', None) + super(FeaturizationSettings, self).__init__(**kwargs) + self.dataset_language = kwargs.get('dataset_language', None) -class GetBlobReferenceSASResponseDto(msrest.serialization.Model): - """BlobReferenceSASResponse for getBlobReferenceSAS API. +class MonitoringInputDataBase(msrest.serialization.Model): + """Monitoring input data base definition. - :ivar blob_reference_for_consumption: Blob reference for consumption details. - :vartype blob_reference_for_consumption: - ~azure.mgmt.machinelearningservices.models.GetBlobReferenceForConsumptionDto + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: FixedInputData, RollingInputData, StaticInputData. + + All required parameters must be populated in order to send to Azure. + + :ivar columns: Mapping of column names to special uses. + :vartype columns: dict[str, str] + :ivar data_context: The context metadata of the data source. + :vartype data_context: str + :ivar input_data_type: Required. [Required] Specifies the type of signal to monitor.Constant + filled by server. Possible values include: "Static", "Rolling", "Fixed". + :vartype input_data_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringInputDataType + :ivar job_input_type: Required. [Required] Specifies the type of job. Possible values include: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar uri: Required. [Required] Input Asset URI. + :vartype uri: str """ + _validation = { + 'input_data_type': {'required': True}, + 'job_input_type': {'required': True}, + 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + _attribute_map = { - 'blob_reference_for_consumption': {'key': 'blobReferenceForConsumption', 'type': 'GetBlobReferenceForConsumptionDto'}, + 'columns': {'key': 'columns', 'type': '{str}'}, + 'data_context': {'key': 'dataContext', 'type': 'str'}, + 'input_data_type': {'key': 'inputDataType', 'type': 'str'}, + 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + } + + _subtype_map = { + 'input_data_type': {'Fixed': 'FixedInputData', 'Rolling': 'RollingInputData', 'Static': 'StaticInputData'} } def __init__( @@ -13063,32 +13513,57 @@ def __init__( **kwargs ): """ - :keyword blob_reference_for_consumption: Blob reference for consumption details. - :paramtype blob_reference_for_consumption: - ~azure.mgmt.machinelearningservices.models.GetBlobReferenceForConsumptionDto + :keyword columns: Mapping of column names to special uses. + :paramtype columns: dict[str, str] + :keyword data_context: The context metadata of the data source. + :paramtype data_context: str + :keyword job_input_type: Required. [Required] Specifies the type of job. Possible values + include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", + "triton_model". + :paramtype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :keyword uri: Required. [Required] Input Asset URI. + :paramtype uri: str """ - super(GetBlobReferenceSASResponseDto, self).__init__(**kwargs) - self.blob_reference_for_consumption = kwargs.get('blob_reference_for_consumption', None) + super(MonitoringInputDataBase, self).__init__(**kwargs) + self.columns = kwargs.get('columns', None) + self.data_context = kwargs.get('data_context', None) + self.input_data_type = None # type: Optional[str] + self.job_input_type = kwargs['job_input_type'] + self.uri = kwargs['uri'] -class GridSamplingAlgorithm(SamplingAlgorithm): - """Defines a Sampling Algorithm that exhaustively generates every value combination in the space. +class FixedInputData(MonitoringInputDataBase): + """Fixed input data definition. All required parameters must be populated in order to send to Azure. - :ivar sampling_algorithm_type: Required. [Required] The algorithm used for generating - hyperparameter values, along with configuration properties.Constant filled by server. Possible - values include: "Grid", "Random", "Bayesian". - :vartype sampling_algorithm_type: str or - ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + :ivar columns: Mapping of column names to special uses. + :vartype columns: dict[str, str] + :ivar data_context: The context metadata of the data source. + :vartype data_context: str + :ivar input_data_type: Required. [Required] Specifies the type of signal to monitor.Constant + filled by server. Possible values include: "Static", "Rolling", "Fixed". + :vartype input_data_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringInputDataType + :ivar job_input_type: Required. [Required] Specifies the type of job. Possible values include: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar uri: Required. [Required] Input Asset URI. + :vartype uri: str """ _validation = { - 'sampling_algorithm_type': {'required': True}, + 'input_data_type': {'required': True}, + 'job_input_type': {'required': True}, + 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, } _attribute_map = { - 'sampling_algorithm_type': {'key': 'samplingAlgorithmType', 'type': 'str'}, + 'columns': {'key': 'columns', 'type': '{str}'}, + 'data_context': {'key': 'dataContext', 'type': 'str'}, + 'input_data_type': {'key': 'inputDataType', 'type': 'str'}, + 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, } def __init__( @@ -13096,20 +13571,30 @@ def __init__( **kwargs ): """ + :keyword columns: Mapping of column names to special uses. + :paramtype columns: dict[str, str] + :keyword data_context: The context metadata of the data source. + :paramtype data_context: str + :keyword job_input_type: Required. [Required] Specifies the type of job. Possible values + include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", + "triton_model". + :paramtype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :keyword uri: Required. [Required] Input Asset URI. + :paramtype uri: str """ - super(GridSamplingAlgorithm, self).__init__(**kwargs) - self.sampling_algorithm_type = 'Grid' # type: str + super(FixedInputData, self).__init__(**kwargs) + self.input_data_type = 'Fixed' # type: str -class HDInsightSchema(msrest.serialization.Model): - """HDInsightSchema. +class FlavorData(msrest.serialization.Model): + """FlavorData. - :ivar properties: HDInsight compute properties. - :vartype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties + :ivar data: Model flavor-specific data. + :vartype data: dict[str, str] """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'HDInsightProperties'}, + 'data': {'key': 'data', 'type': '{str}'}, } def __init__( @@ -13117,72 +13602,92 @@ def __init__( **kwargs ): """ - :keyword properties: HDInsight compute properties. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties + :keyword data: Model flavor-specific data. + :paramtype data: dict[str, str] """ - super(HDInsightSchema, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - + super(FlavorData, self).__init__(**kwargs) + self.data = kwargs.get('data', None) -class HDInsight(Compute, HDInsightSchema): - """A HDInsight compute. - Variables are only populated by the server, and will be ignored when sending a request. +class Forecasting(AutoMLVertical, TableVertical): + """Forecasting task in AutoML Table vertical. All required parameters must be populated in order to send to Azure. - :ivar properties: HDInsight compute properties. - :vartype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties - :ivar compute_type: Required. The type of compute.Constant filled by server. Possible values - include: "AKS", "Kubernetes", "AmlCompute", "ComputeInstance", "DataFactory", "VirtualMachine", - "HDInsight", "Databricks", "DataLakeAnalytics", "SynapseSpark". - :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.ComputeType - :ivar compute_location: Location for the underlying compute. - :vartype compute_location: str - :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, - Updating, Provisioning, Succeeded, and Failed. Possible values include: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.ProvisioningState - :ivar description: The description of the Machine Learning compute. - :vartype description: str - :ivar created_on: The time at which the compute was created. - :vartype created_on: ~datetime.datetime - :ivar modified_on: The time at which the compute was last modified. - :vartype modified_on: ~datetime.datetime - :ivar resource_id: ARM resource id of the underlying compute. - :vartype resource_id: str - :ivar provisioning_errors: Errors during provisioning. - :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] - :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought - from outside if true, or machine learning service provisioned it if false. - :vartype is_attached_compute: bool - :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI - and AAD exclusively for authentication. - :vartype disable_local_auth: bool + :ivar cv_split_column_names: Columns to use for CVSplit data. + :vartype cv_split_column_names: list[str] + :ivar featurization_settings: Featurization inputs needed for AutoML job. + :vartype featurization_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :ivar limit_settings: Execution constraints for AutoMLJob. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :ivar n_cross_validations: Number of cross validation folds to be applied on training dataset + when validation dataset is not provided. + :vartype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :ivar test_data: Test data input. + :vartype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar test_data_size: The fraction of test dataset that needs to be set aside for validation + purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype test_data_size: float + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar weight_column_name: The name of the sample weight column. Automated ML supports a + weighted column as an input, causing rows in the data to be weighted up or down. + :vartype weight_column_name: str + :ivar log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", + "Info", "Warning", "Error", "Critical". + :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :ivar target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :vartype target_column_name: str + :ivar task_type: Required. [Required] Task type for AutoMLJob.Constant filled by server. + Possible values include: "Classification", "Regression", "Forecasting", "ImageClassification", + "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", + "TextClassification", "TextClassificationMultilabel", "TextNER". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType + :ivar training_data: Required. [Required] Training data input. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar forecasting_settings: Forecasting task specific inputs. + :vartype forecasting_settings: ~azure.mgmt.machinelearningservices.models.ForecastingSettings + :ivar primary_metric: Primary metric for forecasting task. Possible values include: + "SpearmanCorrelation", "NormalizedRootMeanSquaredError", "R2Score", + "NormalizedMeanAbsoluteError". + :vartype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ForecastingPrimaryMetrics + :ivar training_settings: Inputs for training phase for an AutoML Job. + :vartype training_settings: + ~azure.mgmt.machinelearningservices.models.ForecastingTrainingSettings """ _validation = { - 'compute_type': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'created_on': {'readonly': True}, - 'modified_on': {'readonly': True}, - 'provisioning_errors': {'readonly': True}, - 'is_attached_compute': {'readonly': True}, + 'task_type': {'required': True}, + 'training_data': {'required': True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'HDInsightProperties'}, - 'compute_type': {'key': 'computeType', 'type': 'str'}, - 'compute_location': {'key': 'computeLocation', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'created_on': {'key': 'createdOn', 'type': 'iso-8601'}, - 'modified_on': {'key': 'modifiedOn', 'type': 'iso-8601'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'provisioning_errors': {'key': 'provisioningErrors', 'type': '[ErrorResponse]'}, - 'is_attached_compute': {'key': 'isAttachedCompute', 'type': 'bool'}, - 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, + 'cv_split_column_names': {'key': 'cvSplitColumnNames', 'type': '[str]'}, + 'featurization_settings': {'key': 'featurizationSettings', 'type': 'TableVerticalFeaturizationSettings'}, + 'limit_settings': {'key': 'limitSettings', 'type': 'TableVerticalLimitSettings'}, + 'n_cross_validations': {'key': 'nCrossValidations', 'type': 'NCrossValidations'}, + 'test_data': {'key': 'testData', 'type': 'MLTableJobInput'}, + 'test_data_size': {'key': 'testDataSize', 'type': 'float'}, + 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, + 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, + 'weight_column_name': {'key': 'weightColumnName', 'type': 'str'}, + 'log_verbosity': {'key': 'logVerbosity', 'type': 'str'}, + 'target_column_name': {'key': 'targetColumnName', 'type': 'str'}, + 'task_type': {'key': 'taskType', 'type': 'str'}, + 'training_data': {'key': 'trainingData', 'type': 'MLTableJobInput'}, + 'forecasting_settings': {'key': 'forecastingSettings', 'type': 'ForecastingSettings'}, + 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + 'training_settings': {'key': 'trainingSettings', 'type': 'ForecastingTrainingSettings'}, } def __init__( @@ -13190,48 +13695,141 @@ def __init__( **kwargs ): """ - :keyword properties: HDInsight compute properties. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties - :keyword compute_location: Location for the underlying compute. - :paramtype compute_location: str - :keyword description: The description of the Machine Learning compute. - :paramtype description: str - :keyword resource_id: ARM resource id of the underlying compute. - :paramtype resource_id: str - :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only - MSI and AAD exclusively for authentication. - :paramtype disable_local_auth: bool + :keyword cv_split_column_names: Columns to use for CVSplit data. + :paramtype cv_split_column_names: list[str] + :keyword featurization_settings: Featurization inputs needed for AutoML job. + :paramtype featurization_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :keyword n_cross_validations: Number of cross validation folds to be applied on training + dataset + when validation dataset is not provided. + :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :keyword test_data: Test data input. + :paramtype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword test_data_size: The fraction of test dataset that needs to be set aside for validation + purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype test_data_size: float + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword weight_column_name: The name of the sample weight column. Automated ML supports a + weighted column as an input, causing rows in the data to be weighted up or down. + :paramtype weight_column_name: str + :keyword log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", + "Info", "Warning", "Error", "Critical". + :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :keyword target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :paramtype target_column_name: str + :keyword training_data: Required. [Required] Training data input. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword forecasting_settings: Forecasting task specific inputs. + :paramtype forecasting_settings: ~azure.mgmt.machinelearningservices.models.ForecastingSettings + :keyword primary_metric: Primary metric for forecasting task. Possible values include: + "SpearmanCorrelation", "NormalizedRootMeanSquaredError", "R2Score", + "NormalizedMeanAbsoluteError". + :paramtype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ForecastingPrimaryMetrics + :keyword training_settings: Inputs for training phase for an AutoML Job. + :paramtype training_settings: + ~azure.mgmt.machinelearningservices.models.ForecastingTrainingSettings """ - super(HDInsight, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.compute_type = 'HDInsight' # type: str - self.compute_location = kwargs.get('compute_location', None) - self.provisioning_state = None - self.description = kwargs.get('description', None) - self.created_on = None - self.modified_on = None - self.resource_id = kwargs.get('resource_id', None) - self.provisioning_errors = None - self.is_attached_compute = None - self.disable_local_auth = kwargs.get('disable_local_auth', None) + super(Forecasting, self).__init__(**kwargs) + self.cv_split_column_names = kwargs.get('cv_split_column_names', None) + self.featurization_settings = kwargs.get('featurization_settings', None) + self.limit_settings = kwargs.get('limit_settings', None) + self.n_cross_validations = kwargs.get('n_cross_validations', None) + self.test_data = kwargs.get('test_data', None) + self.test_data_size = kwargs.get('test_data_size', None) + self.validation_data = kwargs.get('validation_data', None) + self.validation_data_size = kwargs.get('validation_data_size', None) + self.weight_column_name = kwargs.get('weight_column_name', None) + self.task_type = 'Forecasting' # type: str + self.forecasting_settings = kwargs.get('forecasting_settings', None) + self.primary_metric = kwargs.get('primary_metric', None) + self.training_settings = kwargs.get('training_settings', None) + self.log_verbosity = kwargs.get('log_verbosity', None) + self.target_column_name = kwargs.get('target_column_name', None) + self.training_data = kwargs['training_data'] -class HDInsightProperties(msrest.serialization.Model): - """HDInsight compute properties. +class ForecastingSettings(msrest.serialization.Model): + """Forecasting specific parameters. - :ivar ssh_port: Port open for ssh connections on the master node of the cluster. - :vartype ssh_port: int - :ivar address: Public IP address of the master node of the cluster. - :vartype address: str - :ivar administrator_account: Admin credentials for master node of the cluster. - :vartype administrator_account: - ~azure.mgmt.machinelearningservices.models.VirtualMachineSshCredentials + :ivar country_or_region_for_holidays: Country or region for holidays for forecasting tasks. + These should be ISO 3166 two-letter country/region codes, for example 'US' or 'GB'. + :vartype country_or_region_for_holidays: str + :ivar cv_step_size: Number of periods between the origin time of one CV fold and the next fold. + For + example, if ``CVStepSize`` = 3 for daily data, the origin time for each fold will be + three days apart. + :vartype cv_step_size: int + :ivar feature_lags: Flag for generating lags for the numeric features with 'auto' or null. + Possible values include: "None", "Auto". + :vartype feature_lags: str or ~azure.mgmt.machinelearningservices.models.FeatureLags + :ivar forecast_horizon: The desired maximum forecast horizon in units of time-series frequency. + :vartype forecast_horizon: ~azure.mgmt.machinelearningservices.models.ForecastHorizon + :ivar frequency: When forecasting, this parameter represents the period with which the forecast + is desired, for example daily, weekly, yearly, etc. The forecast frequency is dataset frequency + by default. + :vartype frequency: str + :ivar seasonality: Set time series seasonality as an integer multiple of the series frequency. + If seasonality is set to 'auto', it will be inferred. + :vartype seasonality: ~azure.mgmt.machinelearningservices.models.Seasonality + :ivar short_series_handling_config: The parameter defining how if AutoML should handle short + time series. Possible values include: "None", "Auto", "Pad", "Drop". + :vartype short_series_handling_config: str or + ~azure.mgmt.machinelearningservices.models.ShortSeriesHandlingConfiguration + :ivar target_aggregate_function: The function to be used to aggregate the time series target + column to conform to a user specified frequency. + If the TargetAggregateFunction is set i.e. not 'None', but the freq parameter is not set, the + error is raised. The possible target aggregation functions are: "sum", "max", "min" and "mean". + Possible values include: "None", "Sum", "Max", "Min", "Mean". + :vartype target_aggregate_function: str or + ~azure.mgmt.machinelearningservices.models.TargetAggregationFunction + :ivar target_lags: The number of past periods to lag from the target column. + :vartype target_lags: ~azure.mgmt.machinelearningservices.models.TargetLags + :ivar target_rolling_window_size: The number of past periods used to create a rolling window + average of the target column. + :vartype target_rolling_window_size: + ~azure.mgmt.machinelearningservices.models.TargetRollingWindowSize + :ivar time_column_name: The name of the time column. This parameter is required when + forecasting to specify the datetime column in the input data used for building the time series + and inferring its frequency. + :vartype time_column_name: str + :ivar time_series_id_column_names: The names of columns used to group a timeseries. It can be + used to create multiple series. + If grain is not defined, the data set is assumed to be one time-series. This parameter is used + with task type forecasting. + :vartype time_series_id_column_names: list[str] + :ivar use_stl: Configure STL Decomposition of the time-series target column. Possible values + include: "None", "Season", "SeasonTrend". + :vartype use_stl: str or ~azure.mgmt.machinelearningservices.models.UseStl """ _attribute_map = { - 'ssh_port': {'key': 'sshPort', 'type': 'int'}, - 'address': {'key': 'address', 'type': 'str'}, - 'administrator_account': {'key': 'administratorAccount', 'type': 'VirtualMachineSshCredentials'}, + 'country_or_region_for_holidays': {'key': 'countryOrRegionForHolidays', 'type': 'str'}, + 'cv_step_size': {'key': 'cvStepSize', 'type': 'int'}, + 'feature_lags': {'key': 'featureLags', 'type': 'str'}, + 'forecast_horizon': {'key': 'forecastHorizon', 'type': 'ForecastHorizon'}, + 'frequency': {'key': 'frequency', 'type': 'str'}, + 'seasonality': {'key': 'seasonality', 'type': 'Seasonality'}, + 'short_series_handling_config': {'key': 'shortSeriesHandlingConfig', 'type': 'str'}, + 'target_aggregate_function': {'key': 'targetAggregateFunction', 'type': 'str'}, + 'target_lags': {'key': 'targetLags', 'type': 'TargetLags'}, + 'target_rolling_window_size': {'key': 'targetRollingWindowSize', 'type': 'TargetRollingWindowSize'}, + 'time_column_name': {'key': 'timeColumnName', 'type': 'str'}, + 'time_series_id_column_names': {'key': 'timeSeriesIdColumnNames', 'type': '[str]'}, + 'use_stl': {'key': 'useStl', 'type': 'str'}, } def __init__( @@ -13239,65 +13837,160 @@ def __init__( **kwargs ): """ - :keyword ssh_port: Port open for ssh connections on the master node of the cluster. - :paramtype ssh_port: int - :keyword address: Public IP address of the master node of the cluster. - :paramtype address: str - :keyword administrator_account: Admin credentials for master node of the cluster. - :paramtype administrator_account: - ~azure.mgmt.machinelearningservices.models.VirtualMachineSshCredentials + :keyword country_or_region_for_holidays: Country or region for holidays for forecasting tasks. + These should be ISO 3166 two-letter country/region codes, for example 'US' or 'GB'. + :paramtype country_or_region_for_holidays: str + :keyword cv_step_size: Number of periods between the origin time of one CV fold and the next + fold. For + example, if ``CVStepSize`` = 3 for daily data, the origin time for each fold will be + three days apart. + :paramtype cv_step_size: int + :keyword feature_lags: Flag for generating lags for the numeric features with 'auto' or null. + Possible values include: "None", "Auto". + :paramtype feature_lags: str or ~azure.mgmt.machinelearningservices.models.FeatureLags + :keyword forecast_horizon: The desired maximum forecast horizon in units of time-series + frequency. + :paramtype forecast_horizon: ~azure.mgmt.machinelearningservices.models.ForecastHorizon + :keyword frequency: When forecasting, this parameter represents the period with which the + forecast is desired, for example daily, weekly, yearly, etc. The forecast frequency is dataset + frequency by default. + :paramtype frequency: str + :keyword seasonality: Set time series seasonality as an integer multiple of the series + frequency. + If seasonality is set to 'auto', it will be inferred. + :paramtype seasonality: ~azure.mgmt.machinelearningservices.models.Seasonality + :keyword short_series_handling_config: The parameter defining how if AutoML should handle short + time series. Possible values include: "None", "Auto", "Pad", "Drop". + :paramtype short_series_handling_config: str or + ~azure.mgmt.machinelearningservices.models.ShortSeriesHandlingConfiguration + :keyword target_aggregate_function: The function to be used to aggregate the time series target + column to conform to a user specified frequency. + If the TargetAggregateFunction is set i.e. not 'None', but the freq parameter is not set, the + error is raised. The possible target aggregation functions are: "sum", "max", "min" and "mean". + Possible values include: "None", "Sum", "Max", "Min", "Mean". + :paramtype target_aggregate_function: str or + ~azure.mgmt.machinelearningservices.models.TargetAggregationFunction + :keyword target_lags: The number of past periods to lag from the target column. + :paramtype target_lags: ~azure.mgmt.machinelearningservices.models.TargetLags + :keyword target_rolling_window_size: The number of past periods used to create a rolling window + average of the target column. + :paramtype target_rolling_window_size: + ~azure.mgmt.machinelearningservices.models.TargetRollingWindowSize + :keyword time_column_name: The name of the time column. This parameter is required when + forecasting to specify the datetime column in the input data used for building the time series + and inferring its frequency. + :paramtype time_column_name: str + :keyword time_series_id_column_names: The names of columns used to group a timeseries. It can + be used to create multiple series. + If grain is not defined, the data set is assumed to be one time-series. This parameter is used + with task type forecasting. + :paramtype time_series_id_column_names: list[str] + :keyword use_stl: Configure STL Decomposition of the time-series target column. Possible values + include: "None", "Season", "SeasonTrend". + :paramtype use_stl: str or ~azure.mgmt.machinelearningservices.models.UseStl """ - super(HDInsightProperties, self).__init__(**kwargs) - self.ssh_port = kwargs.get('ssh_port', None) - self.address = kwargs.get('address', None) - self.administrator_account = kwargs.get('administrator_account', None) - - -class IdAssetReference(AssetReferenceBase): - """Reference to an asset via its ARM resource ID. - - All required parameters must be populated in order to send to Azure. - - :ivar reference_type: Required. [Required] Specifies the type of asset reference.Constant - filled by server. Possible values include: "Id", "DataPath", "OutputPath". - :vartype reference_type: str or ~azure.mgmt.machinelearningservices.models.ReferenceType - :ivar asset_id: Required. [Required] ARM resource ID of the asset. - :vartype asset_id: str - """ + super(ForecastingSettings, self).__init__(**kwargs) + self.country_or_region_for_holidays = kwargs.get('country_or_region_for_holidays', None) + self.cv_step_size = kwargs.get('cv_step_size', None) + self.feature_lags = kwargs.get('feature_lags', None) + self.forecast_horizon = kwargs.get('forecast_horizon', None) + self.frequency = kwargs.get('frequency', None) + self.seasonality = kwargs.get('seasonality', None) + self.short_series_handling_config = kwargs.get('short_series_handling_config', None) + self.target_aggregate_function = kwargs.get('target_aggregate_function', None) + self.target_lags = kwargs.get('target_lags', None) + self.target_rolling_window_size = kwargs.get('target_rolling_window_size', None) + self.time_column_name = kwargs.get('time_column_name', None) + self.time_series_id_column_names = kwargs.get('time_series_id_column_names', None) + self.use_stl = kwargs.get('use_stl', None) - _validation = { - 'reference_type': {'required': True}, - 'asset_id': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, - } - _attribute_map = { - 'reference_type': {'key': 'referenceType', 'type': 'str'}, - 'asset_id': {'key': 'assetId', 'type': 'str'}, - } +class ForecastingTrainingSettings(TrainingSettings): + """Forecasting Training related configuration. - def __init__( - self, + :ivar enable_dnn_training: Enable recommendation of DNN models. + :vartype enable_dnn_training: bool + :ivar enable_model_explainability: Flag to turn on explainability on best model. + :vartype enable_model_explainability: bool + :ivar enable_onnx_compatible_models: Flag for enabling onnx compatible models. + :vartype enable_onnx_compatible_models: bool + :ivar enable_stack_ensemble: Enable stack ensemble run. + :vartype enable_stack_ensemble: bool + :ivar enable_vote_ensemble: Enable voting ensemble run. + :vartype enable_vote_ensemble: bool + :ivar ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model + generation, multiple fitted models from the previous child runs are downloaded. + Configure this parameter with a higher value than 300 secs, if more time is needed. + :vartype ensemble_model_download_timeout: ~datetime.timedelta + :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. + :vartype stack_ensemble_settings: + ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :ivar allowed_training_algorithms: Allowed models for forecasting task. + :vartype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ForecastingModels] + :ivar blocked_training_algorithms: Blocked models for forecasting task. + :vartype blocked_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ForecastingModels] + """ + + _attribute_map = { + 'enable_dnn_training': {'key': 'enableDnnTraining', 'type': 'bool'}, + 'enable_model_explainability': {'key': 'enableModelExplainability', 'type': 'bool'}, + 'enable_onnx_compatible_models': {'key': 'enableOnnxCompatibleModels', 'type': 'bool'}, + 'enable_stack_ensemble': {'key': 'enableStackEnsemble', 'type': 'bool'}, + 'enable_vote_ensemble': {'key': 'enableVoteEnsemble', 'type': 'bool'}, + 'ensemble_model_download_timeout': {'key': 'ensembleModelDownloadTimeout', 'type': 'duration'}, + 'stack_ensemble_settings': {'key': 'stackEnsembleSettings', 'type': 'StackEnsembleSettings'}, + 'allowed_training_algorithms': {'key': 'allowedTrainingAlgorithms', 'type': '[str]'}, + 'blocked_training_algorithms': {'key': 'blockedTrainingAlgorithms', 'type': '[str]'}, + } + + def __init__( + self, **kwargs ): """ - :keyword asset_id: Required. [Required] ARM resource ID of the asset. - :paramtype asset_id: str + :keyword enable_dnn_training: Enable recommendation of DNN models. + :paramtype enable_dnn_training: bool + :keyword enable_model_explainability: Flag to turn on explainability on best model. + :paramtype enable_model_explainability: bool + :keyword enable_onnx_compatible_models: Flag for enabling onnx compatible models. + :paramtype enable_onnx_compatible_models: bool + :keyword enable_stack_ensemble: Enable stack ensemble run. + :paramtype enable_stack_ensemble: bool + :keyword enable_vote_ensemble: Enable voting ensemble run. + :paramtype enable_vote_ensemble: bool + :keyword ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model + generation, multiple fitted models from the previous child runs are downloaded. + Configure this parameter with a higher value than 300 secs, if more time is needed. + :paramtype ensemble_model_download_timeout: ~datetime.timedelta + :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. + :paramtype stack_ensemble_settings: + ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :keyword allowed_training_algorithms: Allowed models for forecasting task. + :paramtype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ForecastingModels] + :keyword blocked_training_algorithms: Blocked models for forecasting task. + :paramtype blocked_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ForecastingModels] """ - super(IdAssetReference, self).__init__(**kwargs) - self.reference_type = 'Id' # type: str - self.asset_id = kwargs['asset_id'] + super(ForecastingTrainingSettings, self).__init__(**kwargs) + self.allowed_training_algorithms = kwargs.get('allowed_training_algorithms', None) + self.blocked_training_algorithms = kwargs.get('blocked_training_algorithms', None) -class IdentityForCmk(msrest.serialization.Model): - """Identity that will be used to access key vault for encryption at rest. +class FQDNEndpoint(msrest.serialization.Model): + """FQDNEndpoint. - :ivar user_assigned_identity: The ArmId of the user assigned identity that will be used to - access the customer managed key vault. - :vartype user_assigned_identity: str + :ivar domain_name: + :vartype domain_name: str + :ivar endpoint_details: + :vartype endpoint_details: list[~azure.mgmt.machinelearningservices.models.FQDNEndpointDetail] """ _attribute_map = { - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + 'domain_name': {'key': 'domainName', 'type': 'str'}, + 'endpoint_details': {'key': 'endpointDetails', 'type': '[FQDNEndpointDetail]'}, } def __init__( @@ -13305,24 +13998,26 @@ def __init__( **kwargs ): """ - :keyword user_assigned_identity: The ArmId of the user assigned identity that will be used to - access the customer managed key vault. - :paramtype user_assigned_identity: str + :keyword domain_name: + :paramtype domain_name: str + :keyword endpoint_details: + :paramtype endpoint_details: + list[~azure.mgmt.machinelearningservices.models.FQDNEndpointDetail] """ - super(IdentityForCmk, self).__init__(**kwargs) - self.user_assigned_identity = kwargs.get('user_assigned_identity', None) + super(FQDNEndpoint, self).__init__(**kwargs) + self.domain_name = kwargs.get('domain_name', None) + self.endpoint_details = kwargs.get('endpoint_details', None) -class IdleShutdownSetting(msrest.serialization.Model): - """Stops compute instance after user defined period of inactivity. +class FQDNEndpointDetail(msrest.serialization.Model): + """FQDNEndpointDetail. - :ivar idle_time_before_shutdown: Time is defined in ISO8601 format. Minimum is 15 min, maximum - is 3 days. - :vartype idle_time_before_shutdown: str + :ivar port: + :vartype port: int """ _attribute_map = { - 'idle_time_before_shutdown': {'key': 'idleTimeBeforeShutdown', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, } def __init__( @@ -13330,31 +14025,25 @@ def __init__( **kwargs ): """ - :keyword idle_time_before_shutdown: Time is defined in ISO8601 format. Minimum is 15 min, - maximum is 3 days. - :paramtype idle_time_before_shutdown: str + :keyword port: + :paramtype port: int """ - super(IdleShutdownSetting, self).__init__(**kwargs) - self.idle_time_before_shutdown = kwargs.get('idle_time_before_shutdown', None) + super(FQDNEndpointDetail, self).__init__(**kwargs) + self.port = kwargs.get('port', None) -class Image(msrest.serialization.Model): - """Describes the Image Specifications. +class FQDNEndpoints(msrest.serialization.Model): + """FQDNEndpoints. - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, any] - :ivar type: Type of the image. Possible values are: docker - For docker images. azureml - For - AzureML images. Possible values include: "docker", "azureml". Default value: "docker". - :vartype type: str or ~azure.mgmt.machinelearningservices.models.ImageType - :ivar reference: Image reference. - :vartype reference: str + :ivar category: + :vartype category: str + :ivar endpoints: + :vartype endpoints: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoint] """ _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'reference': {'key': 'reference', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'endpoints': {'key': 'endpoints', 'type': '[FQDNEndpoint]'}, } def __init__( @@ -13362,49 +14051,25 @@ def __init__( **kwargs ): """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, any] - :keyword type: Type of the image. Possible values are: docker - For docker images. azureml - - For AzureML images. Possible values include: "docker", "azureml". Default value: "docker". - :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ImageType - :keyword reference: Image reference. - :paramtype reference: str + :keyword category: + :paramtype category: str + :keyword endpoints: + :paramtype endpoints: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoint] """ - super(Image, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.type = kwargs.get('type', "docker") - self.reference = kwargs.get('reference', None) - + super(FQDNEndpoints, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.endpoints = kwargs.get('endpoints', None) -class ImageVertical(msrest.serialization.Model): - """Abstract class for AutoML tasks that train image (computer vision) models - -such as Image Classification / Image Classification Multilabel / Image Object Detection / Image Instance Segmentation. - All required parameters must be populated in order to send to Azure. +class FQDNEndpointsPropertyBag(msrest.serialization.Model): + """Property bag for FQDN endpoints result. - :ivar limit_settings: Required. [Required] Limit settings for the AutoML job. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float + :ivar properties: + :vartype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpoints """ - _validation = { - 'limit_settings': {'required': True}, - } - _attribute_map = { - 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, - 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, - 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, - 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, + 'properties': {'key': 'properties', 'type': 'FQDNEndpoints'}, } def __init__( @@ -13412,61 +14077,51 @@ def __init__( **kwargs ): """ - :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float + :keyword properties: + :paramtype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpoints """ - super(ImageVertical, self).__init__(**kwargs) - self.limit_settings = kwargs['limit_settings'] - self.sweep_settings = kwargs.get('sweep_settings', None) - self.validation_data = kwargs.get('validation_data', None) - self.validation_data_size = kwargs.get('validation_data_size', None) + super(FQDNEndpointsPropertyBag, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) -class ImageClassificationBase(ImageVertical): - """ImageClassificationBase. +class OutboundRule(msrest.serialization.Model): + """Outbound Rule for the managed network of a machine learning workspace. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: FqdnOutboundRule, PrivateEndpointOutboundRule, ServiceTagOutboundRule. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar limit_settings: Required. [Required] Limit settings for the AutoML job. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar model_settings: Settings used for training the model. - :vartype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification - :ivar search_space: Search space for sampling different combinations of models and their - hyperparameters. - :vartype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Required", "Recommended", "UserDefined", "Dependency". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :ivar parent_rule_names: + :vartype parent_rule_names: list[str] + :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Possible + values include: "Inactive", "Active". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :ivar type: Required. Type of a managed network Outbound Rule of a machine learning + workspace.Constant filled by server. Possible values include: "FQDN", "PrivateEndpoint", + "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.RuleType """ _validation = { - 'limit_settings': {'required': True}, + 'parent_rule_names': {'readonly': True}, + 'type': {'required': True}, } _attribute_map = { - 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, - 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, - 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, - 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, - 'model_settings': {'key': 'modelSettings', 'type': 'ImageModelSettingsClassification'}, - 'search_space': {'key': 'searchSpace', 'type': '[ImageModelDistributionSettingsClassification]'}, + 'category': {'key': 'category', 'type': 'str'}, + 'parent_rule_names': {'key': 'parentRuleNames', 'type': '[str]'}, + 'status': {'key': 'status', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'FQDN': 'FqdnOutboundRule', 'PrivateEndpoint': 'PrivateEndpointOutboundRule', 'ServiceTag': 'ServiceTagOutboundRule'} } def __init__( @@ -13474,92 +14129,54 @@ def __init__( **kwargs ): """ - :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword model_settings: Settings used for training the model. - :paramtype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification - :keyword search_space: Search space for sampling different combinations of models and their - hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Required", "Recommended", "UserDefined", "Dependency". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :keyword status: Type of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Inactive", "Active". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus """ - super(ImageClassificationBase, self).__init__(**kwargs) - self.model_settings = kwargs.get('model_settings', None) - self.search_space = kwargs.get('search_space', None) + super(OutboundRule, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.parent_rule_names = None + self.status = kwargs.get('status', None) + self.type = None # type: Optional[str] -class ImageClassification(AutoMLVertical, ImageClassificationBase): - """Image Classification. Multi-class image classification is used when an image is classified with only a single label -from a set of classes - e.g. each image is classified as either an image of a 'cat' or a 'dog' or a 'duck'. +class FqdnOutboundRule(OutboundRule): + """FQDN Outbound Rule for the managed network of a machine learning workspace. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar limit_settings: Required. [Required] Limit settings for the AutoML job. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar model_settings: Settings used for training the model. - :vartype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification - :ivar search_space: Search space for sampling different combinations of models and their - hyperparameters. - :vartype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] - :ivar log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", - "Info", "Warning", "Error", "Critical". - :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :ivar target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :vartype target_column_name: str - :ivar task_type: Required. [Required] Task type for AutoMLJob.Constant filled by server. - Possible values include: "Classification", "Regression", "Forecasting", "ImageClassification", - "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", - "TextClassification", "TextClassificationMultilabel", "TextNER". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType - :ivar training_data: Required. [Required] Training data input. - :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar primary_metric: Primary metric to optimize for this task. Possible values include: - "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", - "PrecisionScoreWeighted". - :vartype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ClassificationPrimaryMetrics + :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Required", "Recommended", "UserDefined", "Dependency". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :ivar parent_rule_names: + :vartype parent_rule_names: list[str] + :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Possible + values include: "Inactive", "Active". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :ivar type: Required. Type of a managed network Outbound Rule of a machine learning + workspace.Constant filled by server. Possible values include: "FQDN", "PrivateEndpoint", + "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.RuleType + :ivar destination: + :vartype destination: str """ _validation = { - 'limit_settings': {'required': True}, - 'task_type': {'required': True}, - 'training_data': {'required': True}, + 'parent_rule_names': {'readonly': True}, + 'type': {'required': True}, } _attribute_map = { - 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, - 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, - 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, - 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, - 'model_settings': {'key': 'modelSettings', 'type': 'ImageModelSettingsClassification'}, - 'search_space': {'key': 'searchSpace', 'type': '[ImageModelDistributionSettingsClassification]'}, - 'log_verbosity': {'key': 'logVerbosity', 'type': 'str'}, - 'target_column_name': {'key': 'targetColumnName', 'type': 'str'}, - 'task_type': {'key': 'taskType', 'type': 'str'}, - 'training_data': {'key': 'trainingData', 'type': 'MLTableJobInput'}, - 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'parent_rule_names': {'key': 'parentRuleNames', 'type': '[str]'}, + 'status': {'key': 'status', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'destination': {'key': 'destination', 'type': 'str'}, } def __init__( @@ -13567,114 +14184,67 @@ def __init__( **kwargs ): """ - :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword model_settings: Settings used for training the model. - :paramtype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification - :keyword search_space: Search space for sampling different combinations of models and their - hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] - :keyword log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", - "Info", "Warning", "Error", "Critical". - :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :keyword target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :paramtype target_column_name: str - :keyword training_data: Required. [Required] Training data input. - :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword primary_metric: Primary metric to optimize for this task. Possible values include: - "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", - "PrecisionScoreWeighted". - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ClassificationPrimaryMetrics + :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Required", "Recommended", "UserDefined", "Dependency". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :keyword status: Type of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Inactive", "Active". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :keyword destination: + :paramtype destination: str """ - super(ImageClassification, self).__init__(**kwargs) - self.limit_settings = kwargs['limit_settings'] - self.sweep_settings = kwargs.get('sweep_settings', None) - self.validation_data = kwargs.get('validation_data', None) - self.validation_data_size = kwargs.get('validation_data_size', None) - self.model_settings = kwargs.get('model_settings', None) - self.search_space = kwargs.get('search_space', None) - self.task_type = 'ImageClassification' # type: str - self.primary_metric = kwargs.get('primary_metric', None) - self.log_verbosity = kwargs.get('log_verbosity', None) - self.target_column_name = kwargs.get('target_column_name', None) - self.training_data = kwargs['training_data'] - + super(FqdnOutboundRule, self).__init__(**kwargs) + self.type = 'FQDN' # type: str + self.destination = kwargs.get('destination', None) -class ImageClassificationMultilabel(AutoMLVertical, ImageClassificationBase): - """Image Classification Multilabel. Multi-label image classification is used when an image could have one or more labels -from a set of labels - e.g. an image could be labeled with both 'cat' and 'dog'. - All required parameters must be populated in order to send to Azure. +class GetBlobReferenceForConsumptionDto(msrest.serialization.Model): + """GetBlobReferenceForConsumptionDto. - :ivar limit_settings: Required. [Required] Limit settings for the AutoML job. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar model_settings: Settings used for training the model. - :vartype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification - :ivar search_space: Search space for sampling different combinations of models and their - hyperparameters. - :vartype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] - :ivar log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", - "Info", "Warning", "Error", "Critical". - :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :ivar target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :vartype target_column_name: str - :ivar task_type: Required. [Required] Task type for AutoMLJob.Constant filled by server. - Possible values include: "Classification", "Regression", "Forecasting", "ImageClassification", - "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", - "TextClassification", "TextClassificationMultilabel", "TextNER". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType - :ivar training_data: Required. [Required] Training data input. - :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar primary_metric: Primary metric to optimize for this task. Possible values include: - "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", - "PrecisionScoreWeighted", "IOU". - :vartype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ClassificationMultilabelPrimaryMetrics + :ivar blob_uri: Blob uri, example: https://blob.windows.core.net/Container/Path. + :vartype blob_uri: str + :ivar credential: Credential info to access storage account. + :vartype credential: ~azure.mgmt.machinelearningservices.models.DataReferenceCredential + :ivar storage_account_arm_id: The ARM id of the storage account. + :vartype storage_account_arm_id: str """ - _validation = { - 'limit_settings': {'required': True}, - 'task_type': {'required': True}, - 'training_data': {'required': True}, + _attribute_map = { + 'blob_uri': {'key': 'blobUri', 'type': 'str'}, + 'credential': {'key': 'credential', 'type': 'DataReferenceCredential'}, + 'storage_account_arm_id': {'key': 'storageAccountArmId', 'type': 'str'}, } + def __init__( + self, + **kwargs + ): + """ + :keyword blob_uri: Blob uri, example: https://blob.windows.core.net/Container/Path. + :paramtype blob_uri: str + :keyword credential: Credential info to access storage account. + :paramtype credential: ~azure.mgmt.machinelearningservices.models.DataReferenceCredential + :keyword storage_account_arm_id: The ARM id of the storage account. + :paramtype storage_account_arm_id: str + """ + super(GetBlobReferenceForConsumptionDto, self).__init__(**kwargs) + self.blob_uri = kwargs.get('blob_uri', None) + self.credential = kwargs.get('credential', None) + self.storage_account_arm_id = kwargs.get('storage_account_arm_id', None) + + +class GetBlobReferenceSASRequestDto(msrest.serialization.Model): + """BlobReferenceSASRequest for getBlobReferenceSAS API. + + :ivar asset_id: Id of the asset to be accessed. + :vartype asset_id: str + :ivar blob_uri: Blob uri of the asset to be accessed. + :vartype blob_uri: str + """ + _attribute_map = { - 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, - 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, - 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, - 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, - 'model_settings': {'key': 'modelSettings', 'type': 'ImageModelSettingsClassification'}, - 'search_space': {'key': 'searchSpace', 'type': '[ImageModelDistributionSettingsClassification]'}, - 'log_verbosity': {'key': 'logVerbosity', 'type': 'str'}, - 'target_column_name': {'key': 'targetColumnName', 'type': 'str'}, - 'task_type': {'key': 'taskType', 'type': 'str'}, - 'training_data': {'key': 'trainingData', 'type': 'MLTableJobInput'}, - 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + 'asset_id': {'key': 'assetId', 'type': 'str'}, + 'blob_uri': {'key': 'blobUri', 'type': 'str'}, } def __init__( @@ -13682,88 +14252,26 @@ def __init__( **kwargs ): """ - :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword model_settings: Settings used for training the model. - :paramtype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification - :keyword search_space: Search space for sampling different combinations of models and their - hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] - :keyword log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", - "Info", "Warning", "Error", "Critical". - :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :keyword target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :paramtype target_column_name: str - :keyword training_data: Required. [Required] Training data input. - :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword primary_metric: Primary metric to optimize for this task. Possible values include: - "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", - "PrecisionScoreWeighted", "IOU". - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ClassificationMultilabelPrimaryMetrics + :keyword asset_id: Id of the asset to be accessed. + :paramtype asset_id: str + :keyword blob_uri: Blob uri of the asset to be accessed. + :paramtype blob_uri: str """ - super(ImageClassificationMultilabel, self).__init__(**kwargs) - self.limit_settings = kwargs['limit_settings'] - self.sweep_settings = kwargs.get('sweep_settings', None) - self.validation_data = kwargs.get('validation_data', None) - self.validation_data_size = kwargs.get('validation_data_size', None) - self.model_settings = kwargs.get('model_settings', None) - self.search_space = kwargs.get('search_space', None) - self.task_type = 'ImageClassificationMultilabel' # type: str - self.primary_metric = kwargs.get('primary_metric', None) - self.log_verbosity = kwargs.get('log_verbosity', None) - self.target_column_name = kwargs.get('target_column_name', None) - self.training_data = kwargs['training_data'] - + super(GetBlobReferenceSASRequestDto, self).__init__(**kwargs) + self.asset_id = kwargs.get('asset_id', None) + self.blob_uri = kwargs.get('blob_uri', None) -class ImageObjectDetectionBase(ImageVertical): - """ImageObjectDetectionBase. - All required parameters must be populated in order to send to Azure. +class GetBlobReferenceSASResponseDto(msrest.serialization.Model): + """BlobReferenceSASResponse for getBlobReferenceSAS API. - :ivar limit_settings: Required. [Required] Limit settings for the AutoML job. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar model_settings: Settings used for training the model. - :vartype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection - :ivar search_space: Search space for sampling different combinations of models and their - hyperparameters. - :vartype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + :ivar blob_reference_for_consumption: Blob reference for consumption details. + :vartype blob_reference_for_consumption: + ~azure.mgmt.machinelearningservices.models.GetBlobReferenceForConsumptionDto """ - _validation = { - 'limit_settings': {'required': True}, - } - _attribute_map = { - 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, - 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, - 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, - 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, - 'model_settings': {'key': 'modelSettings', 'type': 'ImageModelSettingsObjectDetection'}, - 'search_space': {'key': 'searchSpace', 'type': '[ImageModelDistributionSettingsObjectDetection]'}, + 'blob_reference_for_consumption': {'key': 'blobReferenceForConsumption', 'type': 'GetBlobReferenceForConsumptionDto'}, } def __init__( @@ -13771,91 +14279,32 @@ def __init__( **kwargs ): """ - :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword model_settings: Settings used for training the model. - :paramtype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection - :keyword search_space: Search space for sampling different combinations of models and their - hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + :keyword blob_reference_for_consumption: Blob reference for consumption details. + :paramtype blob_reference_for_consumption: + ~azure.mgmt.machinelearningservices.models.GetBlobReferenceForConsumptionDto """ - super(ImageObjectDetectionBase, self).__init__(**kwargs) - self.model_settings = kwargs.get('model_settings', None) - self.search_space = kwargs.get('search_space', None) + super(GetBlobReferenceSASResponseDto, self).__init__(**kwargs) + self.blob_reference_for_consumption = kwargs.get('blob_reference_for_consumption', None) -class ImageInstanceSegmentation(AutoMLVertical, ImageObjectDetectionBase): - """Image Instance Segmentation. Instance segmentation is used to identify objects in an image at the pixel level, -drawing a polygon around each object in the image. +class GridSamplingAlgorithm(SamplingAlgorithm): + """Defines a Sampling Algorithm that exhaustively generates every value combination in the space. All required parameters must be populated in order to send to Azure. - :ivar limit_settings: Required. [Required] Limit settings for the AutoML job. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar model_settings: Settings used for training the model. - :vartype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection - :ivar search_space: Search space for sampling different combinations of models and their - hyperparameters. - :vartype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] - :ivar log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", - "Info", "Warning", "Error", "Critical". - :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :ivar target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :vartype target_column_name: str - :ivar task_type: Required. [Required] Task type for AutoMLJob.Constant filled by server. - Possible values include: "Classification", "Regression", "Forecasting", "ImageClassification", - "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", - "TextClassification", "TextClassificationMultilabel", "TextNER". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType - :ivar training_data: Required. [Required] Training data input. - :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar primary_metric: Primary metric to optimize for this task. Possible values include: - "MeanAveragePrecision". - :vartype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.InstanceSegmentationPrimaryMetrics + :ivar sampling_algorithm_type: Required. [Required] The algorithm used for generating + hyperparameter values, along with configuration properties.Constant filled by server. Possible + values include: "Grid", "Random", "Bayesian". + :vartype sampling_algorithm_type: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType """ _validation = { - 'limit_settings': {'required': True}, - 'task_type': {'required': True}, - 'training_data': {'required': True}, + 'sampling_algorithm_type': {'required': True}, } _attribute_map = { - 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, - 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, - 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, - 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, - 'model_settings': {'key': 'modelSettings', 'type': 'ImageModelSettingsObjectDetection'}, - 'search_space': {'key': 'searchSpace', 'type': '[ImageModelDistributionSettingsObjectDetection]'}, - 'log_verbosity': {'key': 'logVerbosity', 'type': 'str'}, - 'target_column_name': {'key': 'targetColumnName', 'type': 'str'}, - 'task_type': {'key': 'taskType', 'type': 'str'}, - 'training_data': {'key': 'trainingData', 'type': 'MLTableJobInput'}, - 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + 'sampling_algorithm_type': {'key': 'samplingAlgorithmType', 'type': 'str'}, } def __init__( @@ -13863,66 +14312,20 @@ def __init__( **kwargs ): """ - :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword model_settings: Settings used for training the model. - :paramtype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection - :keyword search_space: Search space for sampling different combinations of models and their - hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] - :keyword log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", - "Info", "Warning", "Error", "Critical". - :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :keyword target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :paramtype target_column_name: str - :keyword training_data: Required. [Required] Training data input. - :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword primary_metric: Primary metric to optimize for this task. Possible values include: - "MeanAveragePrecision". - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.InstanceSegmentationPrimaryMetrics """ - super(ImageInstanceSegmentation, self).__init__(**kwargs) - self.limit_settings = kwargs['limit_settings'] - self.sweep_settings = kwargs.get('sweep_settings', None) - self.validation_data = kwargs.get('validation_data', None) - self.validation_data_size = kwargs.get('validation_data_size', None) - self.model_settings = kwargs.get('model_settings', None) - self.search_space = kwargs.get('search_space', None) - self.task_type = 'ImageInstanceSegmentation' # type: str - self.primary_metric = kwargs.get('primary_metric', None) - self.log_verbosity = kwargs.get('log_verbosity', None) - self.target_column_name = kwargs.get('target_column_name', None) - self.training_data = kwargs['training_data'] + super(GridSamplingAlgorithm, self).__init__(**kwargs) + self.sampling_algorithm_type = 'Grid' # type: str -class ImageLimitSettings(msrest.serialization.Model): - """Limit settings for the AutoML job. +class HDInsightSchema(msrest.serialization.Model): + """HDInsightSchema. - :ivar max_concurrent_trials: Maximum number of concurrent AutoML iterations. - :vartype max_concurrent_trials: int - :ivar max_trials: Maximum number of AutoML iterations. - :vartype max_trials: int - :ivar timeout: AutoML job timeout. - :vartype timeout: ~datetime.timedelta + :ivar properties: HDInsight compute properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties """ _attribute_map = { - 'max_concurrent_trials': {'key': 'maxConcurrentTrials', 'type': 'int'}, - 'max_trials': {'key': 'maxTrials', 'type': 'int'}, - 'timeout': {'key': 'timeout', 'type': 'duration'}, + 'properties': {'key': 'properties', 'type': 'HDInsightProperties'}, } def __init__( @@ -13930,184 +14333,121 @@ def __init__( **kwargs ): """ - :keyword max_concurrent_trials: Maximum number of concurrent AutoML iterations. - :paramtype max_concurrent_trials: int - :keyword max_trials: Maximum number of AutoML iterations. - :paramtype max_trials: int - :keyword timeout: AutoML job timeout. - :paramtype timeout: ~datetime.timedelta + :keyword properties: HDInsight compute properties. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties """ - super(ImageLimitSettings, self).__init__(**kwargs) - self.max_concurrent_trials = kwargs.get('max_concurrent_trials', 1) - self.max_trials = kwargs.get('max_trials', 1) - self.timeout = kwargs.get('timeout', "P7D") + super(HDInsightSchema, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) -class ImageMetadata(msrest.serialization.Model): - """Returns metadata about the operating system image for this compute instance. +class HDInsight(Compute, HDInsightSchema): + """A HDInsight compute. - :ivar current_image_version: Specifies the current operating system image version this compute - instance is running on. - :vartype current_image_version: str - :ivar latest_image_version: Specifies the latest available operating system image version. - :vartype latest_image_version: str - :ivar is_latest_os_image_version: Specifies whether this compute instance is running on the - latest operating system image. - :vartype is_latest_os_image_version: bool - """ + Variables are only populated by the server, and will be ignored when sending a request. - _attribute_map = { - 'current_image_version': {'key': 'currentImageVersion', 'type': 'str'}, - 'latest_image_version': {'key': 'latestImageVersion', 'type': 'str'}, - 'is_latest_os_image_version': {'key': 'isLatestOsImageVersion', 'type': 'bool'}, - } + All required parameters must be populated in order to send to Azure. - def __init__( + :ivar properties: HDInsight compute properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties + :ivar compute_type: Required. The type of compute.Constant filled by server. Possible values + include: "AKS", "Kubernetes", "AmlCompute", "ComputeInstance", "DataFactory", "VirtualMachine", + "HDInsight", "Databricks", "DataLakeAnalytics", "SynapseSpark". + :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.ComputeType + :ivar compute_location: Location for the underlying compute. + :vartype compute_location: str + :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, + Updating, Provisioning, Succeeded, and Failed. Possible values include: "Unknown", "Updating", + "Creating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.ProvisioningState + :ivar description: The description of the Machine Learning compute. + :vartype description: str + :ivar created_on: The time at which the compute was created. + :vartype created_on: ~datetime.datetime + :ivar modified_on: The time at which the compute was last modified. + :vartype modified_on: ~datetime.datetime + :ivar resource_id: ARM resource id of the underlying compute. + :vartype resource_id: str + :ivar provisioning_errors: Errors during provisioning. + :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought + from outside if true, or machine learning service provisioned it if false. + :vartype is_attached_compute: bool + :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI + and AAD exclusively for authentication. + :vartype disable_local_auth: bool + """ + + _validation = { + 'compute_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'created_on': {'readonly': True}, + 'modified_on': {'readonly': True}, + 'provisioning_errors': {'readonly': True}, + 'is_attached_compute': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'HDInsightProperties'}, + 'compute_type': {'key': 'computeType', 'type': 'str'}, + 'compute_location': {'key': 'computeLocation', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'created_on': {'key': 'createdOn', 'type': 'iso-8601'}, + 'modified_on': {'key': 'modifiedOn', 'type': 'iso-8601'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'provisioning_errors': {'key': 'provisioningErrors', 'type': '[ErrorResponse]'}, + 'is_attached_compute': {'key': 'isAttachedCompute', 'type': 'bool'}, + 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, + } + + def __init__( self, **kwargs ): """ - :keyword current_image_version: Specifies the current operating system image version this - compute instance is running on. - :paramtype current_image_version: str - :keyword latest_image_version: Specifies the latest available operating system image version. - :paramtype latest_image_version: str - :keyword is_latest_os_image_version: Specifies whether this compute instance is running on the - latest operating system image. - :paramtype is_latest_os_image_version: bool + :keyword properties: HDInsight compute properties. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties + :keyword compute_location: Location for the underlying compute. + :paramtype compute_location: str + :keyword description: The description of the Machine Learning compute. + :paramtype description: str + :keyword resource_id: ARM resource id of the underlying compute. + :paramtype resource_id: str + :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only + MSI and AAD exclusively for authentication. + :paramtype disable_local_auth: bool """ - super(ImageMetadata, self).__init__(**kwargs) - self.current_image_version = kwargs.get('current_image_version', None) - self.latest_image_version = kwargs.get('latest_image_version', None) - self.is_latest_os_image_version = kwargs.get('is_latest_os_image_version', None) - + super(HDInsight, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.compute_type = 'HDInsight' # type: str + self.compute_location = kwargs.get('compute_location', None) + self.provisioning_state = None + self.description = kwargs.get('description', None) + self.created_on = None + self.modified_on = None + self.resource_id = kwargs.get('resource_id', None) + self.provisioning_errors = None + self.is_attached_compute = None + self.disable_local_auth = kwargs.get('disable_local_auth', None) -class ImageModelDistributionSettings(msrest.serialization.Model): - """Distribution expressions to sweep over values of model settings. -:code:` -Some examples are: -``` -ModelName = "choice('seresnext', 'resnest50')"; -LearningRate = "uniform(0.001, 0.01)"; -LayersToFreeze = "choice(0, 2)"; -```` -All distributions can be specified as distribution_name(min, max) or choice(val1, val2, ..., valn) -where distribution name can be: uniform, quniform, loguniform, etc -For more details on how to compose distribution expressions please check the documentation: -https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters -For more information on the available settings please visit the official documentation: -https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +class HDInsightProperties(msrest.serialization.Model): + """HDInsight compute properties. - :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :vartype ams_gradient: str - :ivar augmentations: Settings for using Augmentations. - :vartype augmentations: str - :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta1: str - :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta2: str - :ivar distributed: Whether to use distributer training. - :vartype distributed: str - :ivar early_stopping: Enable early stopping logic during training. - :vartype early_stopping: str - :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before - primary metric improvement - is tracked for early stopping. Must be a positive integer. - :vartype early_stopping_delay: str - :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :vartype early_stopping_patience: str - :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. - :vartype enable_onnx_normalization: str - :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must - be a positive integer. - :vartype evaluation_frequency: str - :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :vartype gradient_accumulation_step: str - :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype layers_to_freeze: str - :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :vartype learning_rate: str - :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. - :vartype learning_rate_scheduler: str - :ivar model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype model_name: str - :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. - :vartype momentum: str - :ivar nesterov: Enable nesterov when optimizer is 'sgd'. - :vartype nesterov: str - :ivar number_of_epochs: Number of training epochs. Must be a positive integer. - :vartype number_of_epochs: str - :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. - :vartype number_of_workers: str - :ivar optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. - :vartype optimizer: str - :ivar random_seed: Random seed to be used when using deterministic training. - :vartype random_seed: str - :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in - the range [0, 1]. - :vartype step_lr_gamma: str - :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a - positive integer. - :vartype step_lr_step_size: str - :ivar training_batch_size: Training batch size. Must be a positive integer. - :vartype training_batch_size: str - :ivar validation_batch_size: Validation batch size. Must be a positive integer. - :vartype validation_batch_size: str - :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :vartype warmup_cosine_lr_cycles: str - :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :vartype warmup_cosine_lr_warmup_epochs: str - :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be - a float in the range[0, 1]. - :vartype weight_decay: str + :ivar ssh_port: Port open for ssh connections on the master node of the cluster. + :vartype ssh_port: int + :ivar address: Public IP address of the master node of the cluster. + :vartype address: str + :ivar administrator_account: Admin credentials for master node of the cluster. + :vartype administrator_account: + ~azure.mgmt.machinelearningservices.models.VirtualMachineSshCredentials """ _attribute_map = { - 'ams_gradient': {'key': 'amsGradient', 'type': 'str'}, - 'augmentations': {'key': 'augmentations', 'type': 'str'}, - 'beta1': {'key': 'beta1', 'type': 'str'}, - 'beta2': {'key': 'beta2', 'type': 'str'}, - 'distributed': {'key': 'distributed', 'type': 'str'}, - 'early_stopping': {'key': 'earlyStopping', 'type': 'str'}, - 'early_stopping_delay': {'key': 'earlyStoppingDelay', 'type': 'str'}, - 'early_stopping_patience': {'key': 'earlyStoppingPatience', 'type': 'str'}, - 'enable_onnx_normalization': {'key': 'enableOnnxNormalization', 'type': 'str'}, - 'evaluation_frequency': {'key': 'evaluationFrequency', 'type': 'str'}, - 'gradient_accumulation_step': {'key': 'gradientAccumulationStep', 'type': 'str'}, - 'layers_to_freeze': {'key': 'layersToFreeze', 'type': 'str'}, - 'learning_rate': {'key': 'learningRate', 'type': 'str'}, - 'learning_rate_scheduler': {'key': 'learningRateScheduler', 'type': 'str'}, - 'model_name': {'key': 'modelName', 'type': 'str'}, - 'momentum': {'key': 'momentum', 'type': 'str'}, - 'nesterov': {'key': 'nesterov', 'type': 'str'}, - 'number_of_epochs': {'key': 'numberOfEpochs', 'type': 'str'}, - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'str'}, - 'optimizer': {'key': 'optimizer', 'type': 'str'}, - 'random_seed': {'key': 'randomSeed', 'type': 'str'}, - 'step_lr_gamma': {'key': 'stepLRGamma', 'type': 'str'}, - 'step_lr_step_size': {'key': 'stepLRStepSize', 'type': 'str'}, - 'training_batch_size': {'key': 'trainingBatchSize', 'type': 'str'}, - 'validation_batch_size': {'key': 'validationBatchSize', 'type': 'str'}, - 'warmup_cosine_lr_cycles': {'key': 'warmupCosineLRCycles', 'type': 'str'}, - 'warmup_cosine_lr_warmup_epochs': {'key': 'warmupCosineLRWarmupEpochs', 'type': 'str'}, - 'weight_decay': {'key': 'weightDecay', 'type': 'str'}, + 'ssh_port': {'key': 'sshPort', 'type': 'int'}, + 'address': {'key': 'address', 'type': 'str'}, + 'administrator_account': {'key': 'administratorAccount', 'type': 'VirtualMachineSshCredentials'}, } def __init__( @@ -14115,259 +14455,40 @@ def __init__( **kwargs ): """ - :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :paramtype ams_gradient: str - :keyword augmentations: Settings for using Augmentations. - :paramtype augmentations: str - :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta1: str - :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta2: str - :keyword distributed: Whether to use distributer training. - :paramtype distributed: str - :keyword early_stopping: Enable early stopping logic during training. - :paramtype early_stopping: str - :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait - before primary metric improvement - is tracked for early stopping. Must be a positive integer. - :paramtype early_stopping_delay: str - :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :paramtype early_stopping_patience: str - :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. - :paramtype enable_onnx_normalization: str - :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. - Must be a positive integer. - :paramtype evaluation_frequency: str - :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :paramtype gradient_accumulation_step: str - :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive - integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype layers_to_freeze: str - :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :paramtype learning_rate: str - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. - :paramtype learning_rate_scheduler: str - :keyword model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype model_name: str - :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, - 1]. - :paramtype momentum: str - :keyword nesterov: Enable nesterov when optimizer is 'sgd'. - :paramtype nesterov: str - :keyword number_of_epochs: Number of training epochs. Must be a positive integer. - :paramtype number_of_epochs: str - :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. - :paramtype number_of_workers: str - :keyword optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. - :paramtype optimizer: str - :keyword random_seed: Random seed to be used when using deterministic training. - :paramtype random_seed: str - :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float - in the range [0, 1]. - :paramtype step_lr_gamma: str - :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be - a positive integer. - :paramtype step_lr_step_size: str - :keyword training_batch_size: Training batch size. Must be a positive integer. - :paramtype training_batch_size: str - :keyword validation_batch_size: Validation batch size. Must be a positive integer. - :paramtype validation_batch_size: str - :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :paramtype warmup_cosine_lr_cycles: str - :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :paramtype warmup_cosine_lr_warmup_epochs: str - :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must - be a float in the range[0, 1]. - :paramtype weight_decay: str + :keyword ssh_port: Port open for ssh connections on the master node of the cluster. + :paramtype ssh_port: int + :keyword address: Public IP address of the master node of the cluster. + :paramtype address: str + :keyword administrator_account: Admin credentials for master node of the cluster. + :paramtype administrator_account: + ~azure.mgmt.machinelearningservices.models.VirtualMachineSshCredentials """ - super(ImageModelDistributionSettings, self).__init__(**kwargs) - self.ams_gradient = kwargs.get('ams_gradient', None) - self.augmentations = kwargs.get('augmentations', None) - self.beta1 = kwargs.get('beta1', None) - self.beta2 = kwargs.get('beta2', None) - self.distributed = kwargs.get('distributed', None) - self.early_stopping = kwargs.get('early_stopping', None) - self.early_stopping_delay = kwargs.get('early_stopping_delay', None) - self.early_stopping_patience = kwargs.get('early_stopping_patience', None) - self.enable_onnx_normalization = kwargs.get('enable_onnx_normalization', None) - self.evaluation_frequency = kwargs.get('evaluation_frequency', None) - self.gradient_accumulation_step = kwargs.get('gradient_accumulation_step', None) - self.layers_to_freeze = kwargs.get('layers_to_freeze', None) - self.learning_rate = kwargs.get('learning_rate', None) - self.learning_rate_scheduler = kwargs.get('learning_rate_scheduler', None) - self.model_name = kwargs.get('model_name', None) - self.momentum = kwargs.get('momentum', None) - self.nesterov = kwargs.get('nesterov', None) - self.number_of_epochs = kwargs.get('number_of_epochs', None) - self.number_of_workers = kwargs.get('number_of_workers', None) - self.optimizer = kwargs.get('optimizer', None) - self.random_seed = kwargs.get('random_seed', None) - self.step_lr_gamma = kwargs.get('step_lr_gamma', None) - self.step_lr_step_size = kwargs.get('step_lr_step_size', None) - self.training_batch_size = kwargs.get('training_batch_size', None) - self.validation_batch_size = kwargs.get('validation_batch_size', None) - self.warmup_cosine_lr_cycles = kwargs.get('warmup_cosine_lr_cycles', None) - self.warmup_cosine_lr_warmup_epochs = kwargs.get('warmup_cosine_lr_warmup_epochs', None) - self.weight_decay = kwargs.get('weight_decay', None) + super(HDInsightProperties, self).__init__(**kwargs) + self.ssh_port = kwargs.get('ssh_port', None) + self.address = kwargs.get('address', None) + self.administrator_account = kwargs.get('administrator_account', None) -class ImageModelDistributionSettingsClassification(ImageModelDistributionSettings): - """Distribution expressions to sweep over values of model settings. +class IdAssetReference(AssetReferenceBase): + """Reference to an asset via its ARM resource ID. -:code:` -Some examples are: -``` -ModelName = "choice('seresnext', 'resnest50')"; -LearningRate = "uniform(0.001, 0.01)"; -LayersToFreeze = "choice(0, 2)"; -```` -For more details on how to compose distribution expressions please check the documentation: -https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters -For more information on the available settings please visit the official documentation: -https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + All required parameters must be populated in order to send to Azure. - :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :vartype ams_gradient: str - :ivar augmentations: Settings for using Augmentations. - :vartype augmentations: str - :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta1: str - :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta2: str - :ivar distributed: Whether to use distributer training. - :vartype distributed: str - :ivar early_stopping: Enable early stopping logic during training. - :vartype early_stopping: str - :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before - primary metric improvement - is tracked for early stopping. Must be a positive integer. - :vartype early_stopping_delay: str - :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :vartype early_stopping_patience: str - :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. - :vartype enable_onnx_normalization: str - :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must - be a positive integer. - :vartype evaluation_frequency: str - :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :vartype gradient_accumulation_step: str - :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype layers_to_freeze: str - :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :vartype learning_rate: str - :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. - :vartype learning_rate_scheduler: str - :ivar model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype model_name: str - :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. - :vartype momentum: str - :ivar nesterov: Enable nesterov when optimizer is 'sgd'. - :vartype nesterov: str - :ivar number_of_epochs: Number of training epochs. Must be a positive integer. - :vartype number_of_epochs: str - :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. - :vartype number_of_workers: str - :ivar optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. - :vartype optimizer: str - :ivar random_seed: Random seed to be used when using deterministic training. - :vartype random_seed: str - :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in - the range [0, 1]. - :vartype step_lr_gamma: str - :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a - positive integer. - :vartype step_lr_step_size: str - :ivar training_batch_size: Training batch size. Must be a positive integer. - :vartype training_batch_size: str - :ivar validation_batch_size: Validation batch size. Must be a positive integer. - :vartype validation_batch_size: str - :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :vartype warmup_cosine_lr_cycles: str - :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :vartype warmup_cosine_lr_warmup_epochs: str - :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be - a float in the range[0, 1]. - :vartype weight_decay: str - :ivar training_crop_size: Image crop size that is input to the neural network for the training - dataset. Must be a positive integer. - :vartype training_crop_size: str - :ivar validation_crop_size: Image crop size that is input to the neural network for the - validation dataset. Must be a positive integer. - :vartype validation_crop_size: str - :ivar validation_resize_size: Image size to which to resize before cropping for validation - dataset. Must be a positive integer. - :vartype validation_resize_size: str - :ivar weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. - 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be - 0 or 1 or 2. - :vartype weighted_loss: str + :ivar reference_type: Required. [Required] Specifies the type of asset reference.Constant + filled by server. Possible values include: "Id", "DataPath", "OutputPath". + :vartype reference_type: str or ~azure.mgmt.machinelearningservices.models.ReferenceType + :ivar asset_id: Required. [Required] ARM resource ID of the asset. + :vartype asset_id: str """ + _validation = { + 'reference_type': {'required': True}, + 'asset_id': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + _attribute_map = { - 'ams_gradient': {'key': 'amsGradient', 'type': 'str'}, - 'augmentations': {'key': 'augmentations', 'type': 'str'}, - 'beta1': {'key': 'beta1', 'type': 'str'}, - 'beta2': {'key': 'beta2', 'type': 'str'}, - 'distributed': {'key': 'distributed', 'type': 'str'}, - 'early_stopping': {'key': 'earlyStopping', 'type': 'str'}, - 'early_stopping_delay': {'key': 'earlyStoppingDelay', 'type': 'str'}, - 'early_stopping_patience': {'key': 'earlyStoppingPatience', 'type': 'str'}, - 'enable_onnx_normalization': {'key': 'enableOnnxNormalization', 'type': 'str'}, - 'evaluation_frequency': {'key': 'evaluationFrequency', 'type': 'str'}, - 'gradient_accumulation_step': {'key': 'gradientAccumulationStep', 'type': 'str'}, - 'layers_to_freeze': {'key': 'layersToFreeze', 'type': 'str'}, - 'learning_rate': {'key': 'learningRate', 'type': 'str'}, - 'learning_rate_scheduler': {'key': 'learningRateScheduler', 'type': 'str'}, - 'model_name': {'key': 'modelName', 'type': 'str'}, - 'momentum': {'key': 'momentum', 'type': 'str'}, - 'nesterov': {'key': 'nesterov', 'type': 'str'}, - 'number_of_epochs': {'key': 'numberOfEpochs', 'type': 'str'}, - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'str'}, - 'optimizer': {'key': 'optimizer', 'type': 'str'}, - 'random_seed': {'key': 'randomSeed', 'type': 'str'}, - 'step_lr_gamma': {'key': 'stepLRGamma', 'type': 'str'}, - 'step_lr_step_size': {'key': 'stepLRStepSize', 'type': 'str'}, - 'training_batch_size': {'key': 'trainingBatchSize', 'type': 'str'}, - 'validation_batch_size': {'key': 'validationBatchSize', 'type': 'str'}, - 'warmup_cosine_lr_cycles': {'key': 'warmupCosineLRCycles', 'type': 'str'}, - 'warmup_cosine_lr_warmup_epochs': {'key': 'warmupCosineLRWarmupEpochs', 'type': 'str'}, - 'weight_decay': {'key': 'weightDecay', 'type': 'str'}, - 'training_crop_size': {'key': 'trainingCropSize', 'type': 'str'}, - 'validation_crop_size': {'key': 'validationCropSize', 'type': 'str'}, - 'validation_resize_size': {'key': 'validationResizeSize', 'type': 'str'}, - 'weighted_loss': {'key': 'weightedLoss', 'type': 'str'}, + 'reference_type': {'key': 'referenceType', 'type': 'str'}, + 'asset_id': {'key': 'assetId', 'type': 'str'}, } def __init__( @@ -14375,296 +14496,49 @@ def __init__( **kwargs ): """ - :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :paramtype ams_gradient: str - :keyword augmentations: Settings for using Augmentations. - :paramtype augmentations: str - :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta1: str - :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta2: str - :keyword distributed: Whether to use distributer training. - :paramtype distributed: str - :keyword early_stopping: Enable early stopping logic during training. - :paramtype early_stopping: str - :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait - before primary metric improvement - is tracked for early stopping. Must be a positive integer. - :paramtype early_stopping_delay: str - :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :paramtype early_stopping_patience: str - :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. - :paramtype enable_onnx_normalization: str - :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. - Must be a positive integer. - :paramtype evaluation_frequency: str - :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :paramtype gradient_accumulation_step: str - :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive - integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype layers_to_freeze: str - :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :paramtype learning_rate: str - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. - :paramtype learning_rate_scheduler: str - :keyword model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype model_name: str - :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, - 1]. - :paramtype momentum: str - :keyword nesterov: Enable nesterov when optimizer is 'sgd'. - :paramtype nesterov: str - :keyword number_of_epochs: Number of training epochs. Must be a positive integer. - :paramtype number_of_epochs: str - :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. - :paramtype number_of_workers: str - :keyword optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. - :paramtype optimizer: str - :keyword random_seed: Random seed to be used when using deterministic training. - :paramtype random_seed: str - :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float - in the range [0, 1]. - :paramtype step_lr_gamma: str - :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be - a positive integer. - :paramtype step_lr_step_size: str - :keyword training_batch_size: Training batch size. Must be a positive integer. - :paramtype training_batch_size: str - :keyword validation_batch_size: Validation batch size. Must be a positive integer. - :paramtype validation_batch_size: str - :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :paramtype warmup_cosine_lr_cycles: str - :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :paramtype warmup_cosine_lr_warmup_epochs: str - :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must - be a float in the range[0, 1]. - :paramtype weight_decay: str - :keyword training_crop_size: Image crop size that is input to the neural network for the - training dataset. Must be a positive integer. - :paramtype training_crop_size: str - :keyword validation_crop_size: Image crop size that is input to the neural network for the - validation dataset. Must be a positive integer. - :paramtype validation_crop_size: str - :keyword validation_resize_size: Image size to which to resize before cropping for validation - dataset. Must be a positive integer. - :paramtype validation_resize_size: str - :keyword weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. - 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be - 0 or 1 or 2. - :paramtype weighted_loss: str + :keyword asset_id: Required. [Required] ARM resource ID of the asset. + :paramtype asset_id: str """ - super(ImageModelDistributionSettingsClassification, self).__init__(**kwargs) - self.training_crop_size = kwargs.get('training_crop_size', None) - self.validation_crop_size = kwargs.get('validation_crop_size', None) - self.validation_resize_size = kwargs.get('validation_resize_size', None) - self.weighted_loss = kwargs.get('weighted_loss', None) + super(IdAssetReference, self).__init__(**kwargs) + self.reference_type = 'Id' # type: str + self.asset_id = kwargs['asset_id'] -class ImageModelDistributionSettingsObjectDetection(ImageModelDistributionSettings): - """Distribution expressions to sweep over values of model settings. +class IdentityForCmk(msrest.serialization.Model): + """Identity object used for encryption. -:code:` -Some examples are: -``` -ModelName = "choice('seresnext', 'resnest50')"; -LearningRate = "uniform(0.001, 0.01)"; -LayersToFreeze = "choice(0, 2)"; -```` -For more details on how to compose distribution expressions please check the documentation: -https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters -For more information on the available settings please visit the official documentation: -https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :ivar user_assigned_identity: UserAssignedIdentity to be used to fetch the encryption key from + keyVault. + :vartype user_assigned_identity: str + """ - :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :vartype ams_gradient: str - :ivar augmentations: Settings for using Augmentations. - :vartype augmentations: str - :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta1: str - :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta2: str - :ivar distributed: Whether to use distributer training. - :vartype distributed: str - :ivar early_stopping: Enable early stopping logic during training. - :vartype early_stopping: str - :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before - primary metric improvement - is tracked for early stopping. Must be a positive integer. - :vartype early_stopping_delay: str - :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :vartype early_stopping_patience: str - :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. - :vartype enable_onnx_normalization: str - :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must - be a positive integer. - :vartype evaluation_frequency: str - :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :vartype gradient_accumulation_step: str - :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype layers_to_freeze: str - :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :vartype learning_rate: str - :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. - :vartype learning_rate_scheduler: str - :ivar model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype model_name: str - :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. - :vartype momentum: str - :ivar nesterov: Enable nesterov when optimizer is 'sgd'. - :vartype nesterov: str - :ivar number_of_epochs: Number of training epochs. Must be a positive integer. - :vartype number_of_epochs: str - :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. - :vartype number_of_workers: str - :ivar optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. - :vartype optimizer: str - :ivar random_seed: Random seed to be used when using deterministic training. - :vartype random_seed: str - :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in - the range [0, 1]. - :vartype step_lr_gamma: str - :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a - positive integer. - :vartype step_lr_step_size: str - :ivar training_batch_size: Training batch size. Must be a positive integer. - :vartype training_batch_size: str - :ivar validation_batch_size: Validation batch size. Must be a positive integer. - :vartype validation_batch_size: str - :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :vartype warmup_cosine_lr_cycles: str - :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :vartype warmup_cosine_lr_warmup_epochs: str - :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be - a float in the range[0, 1]. - :vartype weight_decay: str - :ivar box_detections_per_image: Maximum number of detections per image, for all classes. Must - be a positive integer. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype box_detections_per_image: str - :ivar box_score_threshold: During inference, only return proposals with a classification score - greater than - BoxScoreThreshold. Must be a float in the range[0, 1]. - :vartype box_score_threshold: str - :ivar image_size: Image size for train and validation. Must be a positive integer. - Note: The training run may get into CUDA OOM if the size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. - :vartype image_size: str - :ivar max_size: Maximum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype max_size: str - :ivar min_size: Minimum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype min_size: str - :ivar model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. - Note: training run may get into CUDA OOM if the model size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. - :vartype model_size: str - :ivar multi_scale: Enable multi-scale image by varying image size by +/- 50%. - Note: training run may get into CUDA OOM if no sufficient GPU memory. - Note: This settings is only supported for the 'yolov5' algorithm. - :vartype multi_scale: str - :ivar nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be - float in the range [0, 1]. - :vartype nms_iou_threshold: str - :ivar tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must not - be - None to enable small object detection logic. A string containing two integers in mxn format. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype tile_grid_size: str - :ivar tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be float - in the range [0, 1). - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype tile_overlap_ratio: str - :ivar tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging - predictions from tiles and image. - Used in validation/ inference. Must be float in the range [0, 1]. - Note: This settings is not supported for the 'yolov5' algorithm. - NMS: Non-maximum suppression. - :vartype tile_predictions_nms_threshold: str - :ivar validation_iou_threshold: IOU threshold to use when computing validation metric. Must be - float in the range [0, 1]. - :vartype validation_iou_threshold: str - :ivar validation_metric_type: Metric computation method to use for validation metrics. Must be - 'none', 'coco', 'voc', or 'coco_voc'. - :vartype validation_metric_type: str + _attribute_map = { + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword user_assigned_identity: UserAssignedIdentity to be used to fetch the encryption key + from keyVault. + :paramtype user_assigned_identity: str + """ + super(IdentityForCmk, self).__init__(**kwargs) + self.user_assigned_identity = kwargs.get('user_assigned_identity', None) + + +class IdleShutdownSetting(msrest.serialization.Model): + """Stops compute instance after user defined period of inactivity. + + :ivar idle_time_before_shutdown: Time is defined in ISO8601 format. Minimum is 15 min, maximum + is 3 days. + :vartype idle_time_before_shutdown: str """ _attribute_map = { - 'ams_gradient': {'key': 'amsGradient', 'type': 'str'}, - 'augmentations': {'key': 'augmentations', 'type': 'str'}, - 'beta1': {'key': 'beta1', 'type': 'str'}, - 'beta2': {'key': 'beta2', 'type': 'str'}, - 'distributed': {'key': 'distributed', 'type': 'str'}, - 'early_stopping': {'key': 'earlyStopping', 'type': 'str'}, - 'early_stopping_delay': {'key': 'earlyStoppingDelay', 'type': 'str'}, - 'early_stopping_patience': {'key': 'earlyStoppingPatience', 'type': 'str'}, - 'enable_onnx_normalization': {'key': 'enableOnnxNormalization', 'type': 'str'}, - 'evaluation_frequency': {'key': 'evaluationFrequency', 'type': 'str'}, - 'gradient_accumulation_step': {'key': 'gradientAccumulationStep', 'type': 'str'}, - 'layers_to_freeze': {'key': 'layersToFreeze', 'type': 'str'}, - 'learning_rate': {'key': 'learningRate', 'type': 'str'}, - 'learning_rate_scheduler': {'key': 'learningRateScheduler', 'type': 'str'}, - 'model_name': {'key': 'modelName', 'type': 'str'}, - 'momentum': {'key': 'momentum', 'type': 'str'}, - 'nesterov': {'key': 'nesterov', 'type': 'str'}, - 'number_of_epochs': {'key': 'numberOfEpochs', 'type': 'str'}, - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'str'}, - 'optimizer': {'key': 'optimizer', 'type': 'str'}, - 'random_seed': {'key': 'randomSeed', 'type': 'str'}, - 'step_lr_gamma': {'key': 'stepLRGamma', 'type': 'str'}, - 'step_lr_step_size': {'key': 'stepLRStepSize', 'type': 'str'}, - 'training_batch_size': {'key': 'trainingBatchSize', 'type': 'str'}, - 'validation_batch_size': {'key': 'validationBatchSize', 'type': 'str'}, - 'warmup_cosine_lr_cycles': {'key': 'warmupCosineLRCycles', 'type': 'str'}, - 'warmup_cosine_lr_warmup_epochs': {'key': 'warmupCosineLRWarmupEpochs', 'type': 'str'}, - 'weight_decay': {'key': 'weightDecay', 'type': 'str'}, - 'box_detections_per_image': {'key': 'boxDetectionsPerImage', 'type': 'str'}, - 'box_score_threshold': {'key': 'boxScoreThreshold', 'type': 'str'}, - 'image_size': {'key': 'imageSize', 'type': 'str'}, - 'max_size': {'key': 'maxSize', 'type': 'str'}, - 'min_size': {'key': 'minSize', 'type': 'str'}, - 'model_size': {'key': 'modelSize', 'type': 'str'}, - 'multi_scale': {'key': 'multiScale', 'type': 'str'}, - 'nms_iou_threshold': {'key': 'nmsIouThreshold', 'type': 'str'}, - 'tile_grid_size': {'key': 'tileGridSize', 'type': 'str'}, - 'tile_overlap_ratio': {'key': 'tileOverlapRatio', 'type': 'str'}, - 'tile_predictions_nms_threshold': {'key': 'tilePredictionsNmsThreshold', 'type': 'str'}, - 'validation_iou_threshold': {'key': 'validationIouThreshold', 'type': 'str'}, - 'validation_metric_type': {'key': 'validationMetricType', 'type': 'str'}, + 'idle_time_before_shutdown': {'key': 'idleTimeBeforeShutdown', 'type': 'str'}, } def __init__( @@ -14672,283 +14546,35 @@ def __init__( **kwargs ): """ - :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :paramtype ams_gradient: str - :keyword augmentations: Settings for using Augmentations. - :paramtype augmentations: str - :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta1: str - :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta2: str - :keyword distributed: Whether to use distributer training. - :paramtype distributed: str - :keyword early_stopping: Enable early stopping logic during training. - :paramtype early_stopping: str - :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait - before primary metric improvement - is tracked for early stopping. Must be a positive integer. - :paramtype early_stopping_delay: str - :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :paramtype early_stopping_patience: str - :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. - :paramtype enable_onnx_normalization: str - :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. - Must be a positive integer. - :paramtype evaluation_frequency: str - :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :paramtype gradient_accumulation_step: str - :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive - integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype layers_to_freeze: str - :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :paramtype learning_rate: str - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. - :paramtype learning_rate_scheduler: str - :keyword model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype model_name: str - :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, - 1]. - :paramtype momentum: str - :keyword nesterov: Enable nesterov when optimizer is 'sgd'. - :paramtype nesterov: str - :keyword number_of_epochs: Number of training epochs. Must be a positive integer. - :paramtype number_of_epochs: str - :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. - :paramtype number_of_workers: str - :keyword optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. - :paramtype optimizer: str - :keyword random_seed: Random seed to be used when using deterministic training. - :paramtype random_seed: str - :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float - in the range [0, 1]. - :paramtype step_lr_gamma: str - :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be - a positive integer. - :paramtype step_lr_step_size: str - :keyword training_batch_size: Training batch size. Must be a positive integer. - :paramtype training_batch_size: str - :keyword validation_batch_size: Validation batch size. Must be a positive integer. - :paramtype validation_batch_size: str - :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :paramtype warmup_cosine_lr_cycles: str - :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :paramtype warmup_cosine_lr_warmup_epochs: str - :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must - be a float in the range[0, 1]. - :paramtype weight_decay: str - :keyword box_detections_per_image: Maximum number of detections per image, for all classes. - Must be a positive integer. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype box_detections_per_image: str - :keyword box_score_threshold: During inference, only return proposals with a classification - score greater than - BoxScoreThreshold. Must be a float in the range[0, 1]. - :paramtype box_score_threshold: str - :keyword image_size: Image size for train and validation. Must be a positive integer. - Note: The training run may get into CUDA OOM if the size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. - :paramtype image_size: str - :keyword max_size: Maximum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype max_size: str - :keyword min_size: Minimum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype min_size: str - :keyword model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. - Note: training run may get into CUDA OOM if the model size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. - :paramtype model_size: str - :keyword multi_scale: Enable multi-scale image by varying image size by +/- 50%. - Note: training run may get into CUDA OOM if no sufficient GPU memory. - Note: This settings is only supported for the 'yolov5' algorithm. - :paramtype multi_scale: str - :keyword nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be - float in the range [0, 1]. - :paramtype nms_iou_threshold: str - :keyword tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must - not be - None to enable small object detection logic. A string containing two integers in mxn format. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype tile_grid_size: str - :keyword tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be - float in the range [0, 1). - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype tile_overlap_ratio: str - :keyword tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging - predictions from tiles and image. - Used in validation/ inference. Must be float in the range [0, 1]. - Note: This settings is not supported for the 'yolov5' algorithm. - NMS: Non-maximum suppression. - :paramtype tile_predictions_nms_threshold: str - :keyword validation_iou_threshold: IOU threshold to use when computing validation metric. Must - be float in the range [0, 1]. - :paramtype validation_iou_threshold: str - :keyword validation_metric_type: Metric computation method to use for validation metrics. Must - be 'none', 'coco', 'voc', or 'coco_voc'. - :paramtype validation_metric_type: str + :keyword idle_time_before_shutdown: Time is defined in ISO8601 format. Minimum is 15 min, + maximum is 3 days. + :paramtype idle_time_before_shutdown: str """ - super(ImageModelDistributionSettingsObjectDetection, self).__init__(**kwargs) - self.box_detections_per_image = kwargs.get('box_detections_per_image', None) - self.box_score_threshold = kwargs.get('box_score_threshold', None) - self.image_size = kwargs.get('image_size', None) - self.max_size = kwargs.get('max_size', None) - self.min_size = kwargs.get('min_size', None) - self.model_size = kwargs.get('model_size', None) - self.multi_scale = kwargs.get('multi_scale', None) - self.nms_iou_threshold = kwargs.get('nms_iou_threshold', None) - self.tile_grid_size = kwargs.get('tile_grid_size', None) - self.tile_overlap_ratio = kwargs.get('tile_overlap_ratio', None) - self.tile_predictions_nms_threshold = kwargs.get('tile_predictions_nms_threshold', None) - self.validation_iou_threshold = kwargs.get('validation_iou_threshold', None) - self.validation_metric_type = kwargs.get('validation_metric_type', None) + super(IdleShutdownSetting, self).__init__(**kwargs) + self.idle_time_before_shutdown = kwargs.get('idle_time_before_shutdown', None) -class ImageModelSettings(msrest.serialization.Model): - """Settings used for training the model. -For more information on the available settings please visit the official documentation: -https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +class Image(msrest.serialization.Model): + """Image. - :ivar advanced_settings: Settings for advanced scenarios. - :vartype advanced_settings: str - :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :vartype ams_gradient: bool - :ivar augmentations: Settings for using Augmentations. - :vartype augmentations: str - :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta1: float - :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta2: float - :ivar checkpoint_frequency: Frequency to store model checkpoints. Must be a positive integer. - :vartype checkpoint_frequency: int - :ivar checkpoint_model: The pretrained checkpoint model for incremental training. - :vartype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput - :ivar checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for - incremental training. - :vartype checkpoint_run_id: str - :ivar distributed: Whether to use distributed training. - :vartype distributed: bool - :ivar early_stopping: Enable early stopping logic during training. - :vartype early_stopping: bool - :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before - primary metric improvement - is tracked for early stopping. Must be a positive integer. - :vartype early_stopping_delay: int - :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :vartype early_stopping_patience: int - :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. - :vartype enable_onnx_normalization: bool - :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must - be a positive integer. - :vartype evaluation_frequency: int - :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :vartype gradient_accumulation_step: int - :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype layers_to_freeze: int - :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :vartype learning_rate: float - :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Possible values include: "None", "WarmupCosine", "Step". - :vartype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.LearningRateScheduler - :ivar model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype model_name: str - :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. - :vartype momentum: float - :ivar nesterov: Enable nesterov when optimizer is 'sgd'. - :vartype nesterov: bool - :ivar number_of_epochs: Number of training epochs. Must be a positive integer. - :vartype number_of_epochs: int - :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. - :vartype number_of_workers: int - :ivar optimizer: Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw". - :vartype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer - :ivar random_seed: Random seed to be used when using deterministic training. - :vartype random_seed: int - :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in - the range [0, 1]. - :vartype step_lr_gamma: float - :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a - positive integer. - :vartype step_lr_step_size: int - :ivar training_batch_size: Training batch size. Must be a positive integer. - :vartype training_batch_size: int - :ivar validation_batch_size: Validation batch size. Must be a positive integer. - :vartype validation_batch_size: int - :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :vartype warmup_cosine_lr_cycles: float - :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :vartype warmup_cosine_lr_warmup_epochs: int - :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be - a float in the range[0, 1]. - :vartype weight_decay: float + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar type: Type of the image. Possible values are: docker - For docker images. azureml - For + AzureML Environment images (custom and curated). Possible values include: "docker", "azureml". + Default value: "docker". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.ImageType + :ivar reference: Image reference URL if type is docker. Environment name if type is azureml. + :vartype reference: str + :ivar version: Version of image being used. If latest then skip this field. + :vartype version: str """ _attribute_map = { - 'advanced_settings': {'key': 'advancedSettings', 'type': 'str'}, - 'ams_gradient': {'key': 'amsGradient', 'type': 'bool'}, - 'augmentations': {'key': 'augmentations', 'type': 'str'}, - 'beta1': {'key': 'beta1', 'type': 'float'}, - 'beta2': {'key': 'beta2', 'type': 'float'}, - 'checkpoint_frequency': {'key': 'checkpointFrequency', 'type': 'int'}, - 'checkpoint_model': {'key': 'checkpointModel', 'type': 'MLFlowModelJobInput'}, - 'checkpoint_run_id': {'key': 'checkpointRunId', 'type': 'str'}, - 'distributed': {'key': 'distributed', 'type': 'bool'}, - 'early_stopping': {'key': 'earlyStopping', 'type': 'bool'}, - 'early_stopping_delay': {'key': 'earlyStoppingDelay', 'type': 'int'}, - 'early_stopping_patience': {'key': 'earlyStoppingPatience', 'type': 'int'}, - 'enable_onnx_normalization': {'key': 'enableOnnxNormalization', 'type': 'bool'}, - 'evaluation_frequency': {'key': 'evaluationFrequency', 'type': 'int'}, - 'gradient_accumulation_step': {'key': 'gradientAccumulationStep', 'type': 'int'}, - 'layers_to_freeze': {'key': 'layersToFreeze', 'type': 'int'}, - 'learning_rate': {'key': 'learningRate', 'type': 'float'}, - 'learning_rate_scheduler': {'key': 'learningRateScheduler', 'type': 'str'}, - 'model_name': {'key': 'modelName', 'type': 'str'}, - 'momentum': {'key': 'momentum', 'type': 'float'}, - 'nesterov': {'key': 'nesterov', 'type': 'bool'}, - 'number_of_epochs': {'key': 'numberOfEpochs', 'type': 'int'}, - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, - 'optimizer': {'key': 'optimizer', 'type': 'str'}, - 'random_seed': {'key': 'randomSeed', 'type': 'int'}, - 'step_lr_gamma': {'key': 'stepLRGamma', 'type': 'float'}, - 'step_lr_step_size': {'key': 'stepLRStepSize', 'type': 'int'}, - 'training_batch_size': {'key': 'trainingBatchSize', 'type': 'int'}, - 'validation_batch_size': {'key': 'validationBatchSize', 'type': 'int'}, - 'warmup_cosine_lr_cycles': {'key': 'warmupCosineLRCycles', 'type': 'float'}, - 'warmup_cosine_lr_warmup_epochs': {'key': 'warmupCosineLRWarmupEpochs', 'type': 'int'}, - 'weight_decay': {'key': 'weightDecay', 'type': 'float'}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'type': {'key': 'type', 'type': 'str'}, + 'reference': {'key': 'reference', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, } def __init__( @@ -14956,278 +14582,53 @@ def __init__( **kwargs ): """ - :keyword advanced_settings: Settings for advanced scenarios. - :paramtype advanced_settings: str - :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :paramtype ams_gradient: bool - :keyword augmentations: Settings for using Augmentations. - :paramtype augmentations: str - :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta1: float - :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta2: float - :keyword checkpoint_frequency: Frequency to store model checkpoints. Must be a positive - integer. - :paramtype checkpoint_frequency: int - :keyword checkpoint_model: The pretrained checkpoint model for incremental training. - :paramtype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput - :keyword checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for - incremental training. - :paramtype checkpoint_run_id: str - :keyword distributed: Whether to use distributed training. - :paramtype distributed: bool - :keyword early_stopping: Enable early stopping logic during training. - :paramtype early_stopping: bool - :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait - before primary metric improvement - is tracked for early stopping. Must be a positive integer. - :paramtype early_stopping_delay: int - :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :paramtype early_stopping_patience: int - :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. - :paramtype enable_onnx_normalization: bool - :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. - Must be a positive integer. - :paramtype evaluation_frequency: int - :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :paramtype gradient_accumulation_step: int - :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive - integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype layers_to_freeze: int - :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :paramtype learning_rate: float - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Possible values include: "None", "WarmupCosine", "Step". - :paramtype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.LearningRateScheduler - :keyword model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype model_name: str - :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, - 1]. - :paramtype momentum: float - :keyword nesterov: Enable nesterov when optimizer is 'sgd'. - :paramtype nesterov: bool - :keyword number_of_epochs: Number of training epochs. Must be a positive integer. - :paramtype number_of_epochs: int - :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. - :paramtype number_of_workers: int - :keyword optimizer: Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw". - :paramtype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer - :keyword random_seed: Random seed to be used when using deterministic training. - :paramtype random_seed: int - :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float - in the range [0, 1]. - :paramtype step_lr_gamma: float - :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be - a positive integer. - :paramtype step_lr_step_size: int - :keyword training_batch_size: Training batch size. Must be a positive integer. - :paramtype training_batch_size: int - :keyword validation_batch_size: Validation batch size. Must be a positive integer. - :paramtype validation_batch_size: int - :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :paramtype warmup_cosine_lr_cycles: float - :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :paramtype warmup_cosine_lr_warmup_epochs: int - :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must - be a float in the range[0, 1]. - :paramtype weight_decay: float + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword type: Type of the image. Possible values are: docker - For docker images. azureml - + For AzureML Environment images (custom and curated). Possible values include: "docker", + "azureml". Default value: "docker". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ImageType + :keyword reference: Image reference URL if type is docker. Environment name if type is azureml. + :paramtype reference: str + :keyword version: Version of image being used. If latest then skip this field. + :paramtype version: str """ - super(ImageModelSettings, self).__init__(**kwargs) - self.advanced_settings = kwargs.get('advanced_settings', None) - self.ams_gradient = kwargs.get('ams_gradient', None) - self.augmentations = kwargs.get('augmentations', None) - self.beta1 = kwargs.get('beta1', None) - self.beta2 = kwargs.get('beta2', None) - self.checkpoint_frequency = kwargs.get('checkpoint_frequency', None) - self.checkpoint_model = kwargs.get('checkpoint_model', None) - self.checkpoint_run_id = kwargs.get('checkpoint_run_id', None) - self.distributed = kwargs.get('distributed', None) - self.early_stopping = kwargs.get('early_stopping', None) - self.early_stopping_delay = kwargs.get('early_stopping_delay', None) - self.early_stopping_patience = kwargs.get('early_stopping_patience', None) - self.enable_onnx_normalization = kwargs.get('enable_onnx_normalization', None) - self.evaluation_frequency = kwargs.get('evaluation_frequency', None) - self.gradient_accumulation_step = kwargs.get('gradient_accumulation_step', None) - self.layers_to_freeze = kwargs.get('layers_to_freeze', None) - self.learning_rate = kwargs.get('learning_rate', None) - self.learning_rate_scheduler = kwargs.get('learning_rate_scheduler', None) - self.model_name = kwargs.get('model_name', None) - self.momentum = kwargs.get('momentum', None) - self.nesterov = kwargs.get('nesterov', None) - self.number_of_epochs = kwargs.get('number_of_epochs', None) - self.number_of_workers = kwargs.get('number_of_workers', None) - self.optimizer = kwargs.get('optimizer', None) - self.random_seed = kwargs.get('random_seed', None) - self.step_lr_gamma = kwargs.get('step_lr_gamma', None) - self.step_lr_step_size = kwargs.get('step_lr_step_size', None) - self.training_batch_size = kwargs.get('training_batch_size', None) - self.validation_batch_size = kwargs.get('validation_batch_size', None) - self.warmup_cosine_lr_cycles = kwargs.get('warmup_cosine_lr_cycles', None) - self.warmup_cosine_lr_warmup_epochs = kwargs.get('warmup_cosine_lr_warmup_epochs', None) - self.weight_decay = kwargs.get('weight_decay', None) + super(Image, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.type = kwargs.get('type', "docker") + self.reference = kwargs.get('reference', None) + self.version = kwargs.get('version', None) -class ImageModelSettingsClassification(ImageModelSettings): - """Settings used for training the model. -For more information on the available settings please visit the official documentation: -https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +class ImageVertical(msrest.serialization.Model): + """Abstract class for AutoML tasks that train image (computer vision) models - +such as Image Classification / Image Classification Multilabel / Image Object Detection / Image Instance Segmentation. - :ivar advanced_settings: Settings for advanced scenarios. - :vartype advanced_settings: str - :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :vartype ams_gradient: bool - :ivar augmentations: Settings for using Augmentations. - :vartype augmentations: str - :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta1: float - :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta2: float - :ivar checkpoint_frequency: Frequency to store model checkpoints. Must be a positive integer. - :vartype checkpoint_frequency: int - :ivar checkpoint_model: The pretrained checkpoint model for incremental training. - :vartype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput - :ivar checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for - incremental training. - :vartype checkpoint_run_id: str - :ivar distributed: Whether to use distributed training. - :vartype distributed: bool - :ivar early_stopping: Enable early stopping logic during training. - :vartype early_stopping: bool - :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before - primary metric improvement - is tracked for early stopping. Must be a positive integer. - :vartype early_stopping_delay: int - :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :vartype early_stopping_patience: int - :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. - :vartype enable_onnx_normalization: bool - :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must - be a positive integer. - :vartype evaluation_frequency: int - :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :vartype gradient_accumulation_step: int - :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype layers_to_freeze: int - :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :vartype learning_rate: float - :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Possible values include: "None", "WarmupCosine", "Step". - :vartype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.LearningRateScheduler - :ivar model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype model_name: str - :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. - :vartype momentum: float - :ivar nesterov: Enable nesterov when optimizer is 'sgd'. - :vartype nesterov: bool - :ivar number_of_epochs: Number of training epochs. Must be a positive integer. - :vartype number_of_epochs: int - :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. - :vartype number_of_workers: int - :ivar optimizer: Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw". - :vartype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer - :ivar random_seed: Random seed to be used when using deterministic training. - :vartype random_seed: int - :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in - the range [0, 1]. - :vartype step_lr_gamma: float - :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a - positive integer. - :vartype step_lr_step_size: int - :ivar training_batch_size: Training batch size. Must be a positive integer. - :vartype training_batch_size: int - :ivar validation_batch_size: Validation batch size. Must be a positive integer. - :vartype validation_batch_size: int - :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :vartype warmup_cosine_lr_cycles: float - :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :vartype warmup_cosine_lr_warmup_epochs: int - :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be - a float in the range[0, 1]. - :vartype weight_decay: float - :ivar training_crop_size: Image crop size that is input to the neural network for the training - dataset. Must be a positive integer. - :vartype training_crop_size: int - :ivar validation_crop_size: Image crop size that is input to the neural network for the - validation dataset. Must be a positive integer. - :vartype validation_crop_size: int - :ivar validation_resize_size: Image size to which to resize before cropping for validation - dataset. Must be a positive integer. - :vartype validation_resize_size: int - :ivar weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. - 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be - 0 or 1 or 2. - :vartype weighted_loss: int + All required parameters must be populated in order to send to Azure. + + :ivar limit_settings: Required. [Required] Limit settings for the AutoML job. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float """ + _validation = { + 'limit_settings': {'required': True}, + } + _attribute_map = { - 'advanced_settings': {'key': 'advancedSettings', 'type': 'str'}, - 'ams_gradient': {'key': 'amsGradient', 'type': 'bool'}, - 'augmentations': {'key': 'augmentations', 'type': 'str'}, - 'beta1': {'key': 'beta1', 'type': 'float'}, - 'beta2': {'key': 'beta2', 'type': 'float'}, - 'checkpoint_frequency': {'key': 'checkpointFrequency', 'type': 'int'}, - 'checkpoint_model': {'key': 'checkpointModel', 'type': 'MLFlowModelJobInput'}, - 'checkpoint_run_id': {'key': 'checkpointRunId', 'type': 'str'}, - 'distributed': {'key': 'distributed', 'type': 'bool'}, - 'early_stopping': {'key': 'earlyStopping', 'type': 'bool'}, - 'early_stopping_delay': {'key': 'earlyStoppingDelay', 'type': 'int'}, - 'early_stopping_patience': {'key': 'earlyStoppingPatience', 'type': 'int'}, - 'enable_onnx_normalization': {'key': 'enableOnnxNormalization', 'type': 'bool'}, - 'evaluation_frequency': {'key': 'evaluationFrequency', 'type': 'int'}, - 'gradient_accumulation_step': {'key': 'gradientAccumulationStep', 'type': 'int'}, - 'layers_to_freeze': {'key': 'layersToFreeze', 'type': 'int'}, - 'learning_rate': {'key': 'learningRate', 'type': 'float'}, - 'learning_rate_scheduler': {'key': 'learningRateScheduler', 'type': 'str'}, - 'model_name': {'key': 'modelName', 'type': 'str'}, - 'momentum': {'key': 'momentum', 'type': 'float'}, - 'nesterov': {'key': 'nesterov', 'type': 'bool'}, - 'number_of_epochs': {'key': 'numberOfEpochs', 'type': 'int'}, - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, - 'optimizer': {'key': 'optimizer', 'type': 'str'}, - 'random_seed': {'key': 'randomSeed', 'type': 'int'}, - 'step_lr_gamma': {'key': 'stepLRGamma', 'type': 'float'}, - 'step_lr_step_size': {'key': 'stepLRStepSize', 'type': 'int'}, - 'training_batch_size': {'key': 'trainingBatchSize', 'type': 'int'}, - 'validation_batch_size': {'key': 'validationBatchSize', 'type': 'int'}, - 'warmup_cosine_lr_cycles': {'key': 'warmupCosineLRCycles', 'type': 'float'}, - 'warmup_cosine_lr_warmup_epochs': {'key': 'warmupCosineLRWarmupEpochs', 'type': 'int'}, - 'weight_decay': {'key': 'weightDecay', 'type': 'float'}, - 'training_crop_size': {'key': 'trainingCropSize', 'type': 'int'}, - 'validation_crop_size': {'key': 'validationCropSize', 'type': 'int'}, - 'validation_resize_size': {'key': 'validationResizeSize', 'type': 'int'}, - 'weighted_loss': {'key': 'weightedLoss', 'type': 'int'}, + 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, + 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, + 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, + 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, } def __init__( @@ -15235,312 +14636,61 @@ def __init__( **kwargs ): """ - :keyword advanced_settings: Settings for advanced scenarios. - :paramtype advanced_settings: str - :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :paramtype ams_gradient: bool - :keyword augmentations: Settings for using Augmentations. - :paramtype augmentations: str - :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta1: float - :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta2: float - :keyword checkpoint_frequency: Frequency to store model checkpoints. Must be a positive - integer. - :paramtype checkpoint_frequency: int - :keyword checkpoint_model: The pretrained checkpoint model for incremental training. - :paramtype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput - :keyword checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for - incremental training. - :paramtype checkpoint_run_id: str - :keyword distributed: Whether to use distributed training. - :paramtype distributed: bool - :keyword early_stopping: Enable early stopping logic during training. - :paramtype early_stopping: bool - :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait - before primary metric improvement - is tracked for early stopping. Must be a positive integer. - :paramtype early_stopping_delay: int - :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :paramtype early_stopping_patience: int - :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. - :paramtype enable_onnx_normalization: bool - :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. - Must be a positive integer. - :paramtype evaluation_frequency: int - :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :paramtype gradient_accumulation_step: int - :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive - integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype layers_to_freeze: int - :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :paramtype learning_rate: float - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Possible values include: "None", "WarmupCosine", "Step". - :paramtype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.LearningRateScheduler - :keyword model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype model_name: str - :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, - 1]. - :paramtype momentum: float - :keyword nesterov: Enable nesterov when optimizer is 'sgd'. - :paramtype nesterov: bool - :keyword number_of_epochs: Number of training epochs. Must be a positive integer. - :paramtype number_of_epochs: int - :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. - :paramtype number_of_workers: int - :keyword optimizer: Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw". - :paramtype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer - :keyword random_seed: Random seed to be used when using deterministic training. - :paramtype random_seed: int - :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float - in the range [0, 1]. - :paramtype step_lr_gamma: float - :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be - a positive integer. - :paramtype step_lr_step_size: int - :keyword training_batch_size: Training batch size. Must be a positive integer. - :paramtype training_batch_size: int - :keyword validation_batch_size: Validation batch size. Must be a positive integer. - :paramtype validation_batch_size: int - :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :paramtype warmup_cosine_lr_cycles: float - :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :paramtype warmup_cosine_lr_warmup_epochs: int - :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must - be a float in the range[0, 1]. - :paramtype weight_decay: float - :keyword training_crop_size: Image crop size that is input to the neural network for the - training dataset. Must be a positive integer. - :paramtype training_crop_size: int - :keyword validation_crop_size: Image crop size that is input to the neural network for the - validation dataset. Must be a positive integer. - :paramtype validation_crop_size: int - :keyword validation_resize_size: Image size to which to resize before cropping for validation - dataset. Must be a positive integer. - :paramtype validation_resize_size: int - :keyword weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. - 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be - 0 or 1 or 2. - :paramtype weighted_loss: int + :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float """ - super(ImageModelSettingsClassification, self).__init__(**kwargs) - self.training_crop_size = kwargs.get('training_crop_size', None) - self.validation_crop_size = kwargs.get('validation_crop_size', None) - self.validation_resize_size = kwargs.get('validation_resize_size', None) - self.weighted_loss = kwargs.get('weighted_loss', None) + super(ImageVertical, self).__init__(**kwargs) + self.limit_settings = kwargs['limit_settings'] + self.sweep_settings = kwargs.get('sweep_settings', None) + self.validation_data = kwargs.get('validation_data', None) + self.validation_data_size = kwargs.get('validation_data_size', None) -class ImageModelSettingsObjectDetection(ImageModelSettings): - """Settings used for training the model. -For more information on the available settings please visit the official documentation: -https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +class ImageClassificationBase(ImageVertical): + """ImageClassificationBase. - :ivar advanced_settings: Settings for advanced scenarios. - :vartype advanced_settings: str - :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :vartype ams_gradient: bool - :ivar augmentations: Settings for using Augmentations. - :vartype augmentations: str - :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta1: float - :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta2: float - :ivar checkpoint_frequency: Frequency to store model checkpoints. Must be a positive integer. - :vartype checkpoint_frequency: int - :ivar checkpoint_model: The pretrained checkpoint model for incremental training. - :vartype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput - :ivar checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for - incremental training. - :vartype checkpoint_run_id: str - :ivar distributed: Whether to use distributed training. - :vartype distributed: bool - :ivar early_stopping: Enable early stopping logic during training. - :vartype early_stopping: bool - :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before - primary metric improvement - is tracked for early stopping. Must be a positive integer. - :vartype early_stopping_delay: int - :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :vartype early_stopping_patience: int - :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. - :vartype enable_onnx_normalization: bool - :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must - be a positive integer. - :vartype evaluation_frequency: int - :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :vartype gradient_accumulation_step: int - :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype layers_to_freeze: int - :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :vartype learning_rate: float - :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Possible values include: "None", "WarmupCosine", "Step". - :vartype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.LearningRateScheduler - :ivar model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype model_name: str - :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. - :vartype momentum: float - :ivar nesterov: Enable nesterov when optimizer is 'sgd'. - :vartype nesterov: bool - :ivar number_of_epochs: Number of training epochs. Must be a positive integer. - :vartype number_of_epochs: int - :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. - :vartype number_of_workers: int - :ivar optimizer: Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw". - :vartype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer - :ivar random_seed: Random seed to be used when using deterministic training. - :vartype random_seed: int - :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in - the range [0, 1]. - :vartype step_lr_gamma: float - :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a - positive integer. - :vartype step_lr_step_size: int - :ivar training_batch_size: Training batch size. Must be a positive integer. - :vartype training_batch_size: int - :ivar validation_batch_size: Validation batch size. Must be a positive integer. - :vartype validation_batch_size: int - :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :vartype warmup_cosine_lr_cycles: float - :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :vartype warmup_cosine_lr_warmup_epochs: int - :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be - a float in the range[0, 1]. - :vartype weight_decay: float - :ivar box_detections_per_image: Maximum number of detections per image, for all classes. Must - be a positive integer. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype box_detections_per_image: int - :ivar box_score_threshold: During inference, only return proposals with a classification score - greater than - BoxScoreThreshold. Must be a float in the range[0, 1]. - :vartype box_score_threshold: float - :ivar image_size: Image size for train and validation. Must be a positive integer. - Note: The training run may get into CUDA OOM if the size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. - :vartype image_size: int - :ivar max_size: Maximum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype max_size: int - :ivar min_size: Minimum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype min_size: int - :ivar model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. - Note: training run may get into CUDA OOM if the model size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. Possible values include: - "None", "Small", "Medium", "Large", "ExtraLarge". - :vartype model_size: str or ~azure.mgmt.machinelearningservices.models.ModelSize - :ivar multi_scale: Enable multi-scale image by varying image size by +/- 50%. - Note: training run may get into CUDA OOM if no sufficient GPU memory. - Note: This settings is only supported for the 'yolov5' algorithm. - :vartype multi_scale: bool - :ivar nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be a - float in the range [0, 1]. - :vartype nms_iou_threshold: float - :ivar tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must not - be - None to enable small object detection logic. A string containing two integers in mxn format. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype tile_grid_size: str - :ivar tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be float - in the range [0, 1). - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype tile_overlap_ratio: float - :ivar tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging - predictions from tiles and image. - Used in validation/ inference. Must be float in the range [0, 1]. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype tile_predictions_nms_threshold: float - :ivar validation_iou_threshold: IOU threshold to use when computing validation metric. Must be - float in the range [0, 1]. - :vartype validation_iou_threshold: float - :ivar validation_metric_type: Metric computation method to use for validation metrics. Possible - values include: "None", "Coco", "Voc", "CocoVoc". - :vartype validation_metric_type: str or - ~azure.mgmt.machinelearningservices.models.ValidationMetricType + All required parameters must be populated in order to send to Azure. + + :ivar limit_settings: Required. [Required] Limit settings for the AutoML job. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar model_settings: Settings used for training the model. + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] """ + _validation = { + 'limit_settings': {'required': True}, + } + _attribute_map = { - 'advanced_settings': {'key': 'advancedSettings', 'type': 'str'}, - 'ams_gradient': {'key': 'amsGradient', 'type': 'bool'}, - 'augmentations': {'key': 'augmentations', 'type': 'str'}, - 'beta1': {'key': 'beta1', 'type': 'float'}, - 'beta2': {'key': 'beta2', 'type': 'float'}, - 'checkpoint_frequency': {'key': 'checkpointFrequency', 'type': 'int'}, - 'checkpoint_model': {'key': 'checkpointModel', 'type': 'MLFlowModelJobInput'}, - 'checkpoint_run_id': {'key': 'checkpointRunId', 'type': 'str'}, - 'distributed': {'key': 'distributed', 'type': 'bool'}, - 'early_stopping': {'key': 'earlyStopping', 'type': 'bool'}, - 'early_stopping_delay': {'key': 'earlyStoppingDelay', 'type': 'int'}, - 'early_stopping_patience': {'key': 'earlyStoppingPatience', 'type': 'int'}, - 'enable_onnx_normalization': {'key': 'enableOnnxNormalization', 'type': 'bool'}, - 'evaluation_frequency': {'key': 'evaluationFrequency', 'type': 'int'}, - 'gradient_accumulation_step': {'key': 'gradientAccumulationStep', 'type': 'int'}, - 'layers_to_freeze': {'key': 'layersToFreeze', 'type': 'int'}, - 'learning_rate': {'key': 'learningRate', 'type': 'float'}, - 'learning_rate_scheduler': {'key': 'learningRateScheduler', 'type': 'str'}, - 'model_name': {'key': 'modelName', 'type': 'str'}, - 'momentum': {'key': 'momentum', 'type': 'float'}, - 'nesterov': {'key': 'nesterov', 'type': 'bool'}, - 'number_of_epochs': {'key': 'numberOfEpochs', 'type': 'int'}, - 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, - 'optimizer': {'key': 'optimizer', 'type': 'str'}, - 'random_seed': {'key': 'randomSeed', 'type': 'int'}, - 'step_lr_gamma': {'key': 'stepLRGamma', 'type': 'float'}, - 'step_lr_step_size': {'key': 'stepLRStepSize', 'type': 'int'}, - 'training_batch_size': {'key': 'trainingBatchSize', 'type': 'int'}, - 'validation_batch_size': {'key': 'validationBatchSize', 'type': 'int'}, - 'warmup_cosine_lr_cycles': {'key': 'warmupCosineLRCycles', 'type': 'float'}, - 'warmup_cosine_lr_warmup_epochs': {'key': 'warmupCosineLRWarmupEpochs', 'type': 'int'}, - 'weight_decay': {'key': 'weightDecay', 'type': 'float'}, - 'box_detections_per_image': {'key': 'boxDetectionsPerImage', 'type': 'int'}, - 'box_score_threshold': {'key': 'boxScoreThreshold', 'type': 'float'}, - 'image_size': {'key': 'imageSize', 'type': 'int'}, - 'max_size': {'key': 'maxSize', 'type': 'int'}, - 'min_size': {'key': 'minSize', 'type': 'int'}, - 'model_size': {'key': 'modelSize', 'type': 'str'}, - 'multi_scale': {'key': 'multiScale', 'type': 'bool'}, - 'nms_iou_threshold': {'key': 'nmsIouThreshold', 'type': 'float'}, - 'tile_grid_size': {'key': 'tileGridSize', 'type': 'str'}, - 'tile_overlap_ratio': {'key': 'tileOverlapRatio', 'type': 'float'}, - 'tile_predictions_nms_threshold': {'key': 'tilePredictionsNmsThreshold', 'type': 'float'}, - 'validation_iou_threshold': {'key': 'validationIouThreshold', 'type': 'float'}, - 'validation_metric_type': {'key': 'validationMetricType', 'type': 'str'}, + 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, + 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, + 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, + 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, + 'model_settings': {'key': 'modelSettings', 'type': 'ImageModelSettingsClassification'}, + 'search_space': {'key': 'searchSpace', 'type': '[ImageModelDistributionSettingsClassification]'}, } def __init__( @@ -15548,170 +14698,33 @@ def __init__( **kwargs ): """ - :keyword advanced_settings: Settings for advanced scenarios. - :paramtype advanced_settings: str - :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :paramtype ams_gradient: bool - :keyword augmentations: Settings for using Augmentations. - :paramtype augmentations: str - :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta1: float - :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta2: float - :keyword checkpoint_frequency: Frequency to store model checkpoints. Must be a positive - integer. - :paramtype checkpoint_frequency: int - :keyword checkpoint_model: The pretrained checkpoint model for incremental training. - :paramtype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput - :keyword checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for - incremental training. - :paramtype checkpoint_run_id: str - :keyword distributed: Whether to use distributed training. - :paramtype distributed: bool - :keyword early_stopping: Enable early stopping logic during training. - :paramtype early_stopping: bool - :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait - before primary metric improvement - is tracked for early stopping. Must be a positive integer. - :paramtype early_stopping_delay: int - :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :paramtype early_stopping_patience: int - :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. - :paramtype enable_onnx_normalization: bool - :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. - Must be a positive integer. - :paramtype evaluation_frequency: int - :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :paramtype gradient_accumulation_step: int - :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive - integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype layers_to_freeze: int - :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :paramtype learning_rate: float - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Possible values include: "None", "WarmupCosine", "Step". - :paramtype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.LearningRateScheduler - :keyword model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype model_name: str - :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, - 1]. - :paramtype momentum: float - :keyword nesterov: Enable nesterov when optimizer is 'sgd'. - :paramtype nesterov: bool - :keyword number_of_epochs: Number of training epochs. Must be a positive integer. - :paramtype number_of_epochs: int - :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. - :paramtype number_of_workers: int - :keyword optimizer: Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw". - :paramtype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer - :keyword random_seed: Random seed to be used when using deterministic training. - :paramtype random_seed: int - :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float - in the range [0, 1]. - :paramtype step_lr_gamma: float - :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be - a positive integer. - :paramtype step_lr_step_size: int - :keyword training_batch_size: Training batch size. Must be a positive integer. - :paramtype training_batch_size: int - :keyword validation_batch_size: Validation batch size. Must be a positive integer. - :paramtype validation_batch_size: int - :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :paramtype warmup_cosine_lr_cycles: float - :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :paramtype warmup_cosine_lr_warmup_epochs: int - :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must - be a float in the range[0, 1]. - :paramtype weight_decay: float - :keyword box_detections_per_image: Maximum number of detections per image, for all classes. - Must be a positive integer. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype box_detections_per_image: int - :keyword box_score_threshold: During inference, only return proposals with a classification - score greater than - BoxScoreThreshold. Must be a float in the range[0, 1]. - :paramtype box_score_threshold: float - :keyword image_size: Image size for train and validation. Must be a positive integer. - Note: The training run may get into CUDA OOM if the size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. - :paramtype image_size: int - :keyword max_size: Maximum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype max_size: int - :keyword min_size: Minimum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype min_size: int - :keyword model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. - Note: training run may get into CUDA OOM if the model size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. Possible values include: - "None", "Small", "Medium", "Large", "ExtraLarge". - :paramtype model_size: str or ~azure.mgmt.machinelearningservices.models.ModelSize - :keyword multi_scale: Enable multi-scale image by varying image size by +/- 50%. - Note: training run may get into CUDA OOM if no sufficient GPU memory. - Note: This settings is only supported for the 'yolov5' algorithm. - :paramtype multi_scale: bool - :keyword nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be - a float in the range [0, 1]. - :paramtype nms_iou_threshold: float - :keyword tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must - not be - None to enable small object detection logic. A string containing two integers in mxn format. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype tile_grid_size: str - :keyword tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be - float in the range [0, 1). - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype tile_overlap_ratio: float - :keyword tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging - predictions from tiles and image. - Used in validation/ inference. Must be float in the range [0, 1]. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype tile_predictions_nms_threshold: float - :keyword validation_iou_threshold: IOU threshold to use when computing validation metric. Must - be float in the range [0, 1]. - :paramtype validation_iou_threshold: float - :keyword validation_metric_type: Metric computation method to use for validation metrics. - Possible values include: "None", "Coco", "Voc", "CocoVoc". - :paramtype validation_metric_type: str or - ~azure.mgmt.machinelearningservices.models.ValidationMetricType + :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword model_settings: Settings used for training the model. + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] """ - super(ImageModelSettingsObjectDetection, self).__init__(**kwargs) - self.box_detections_per_image = kwargs.get('box_detections_per_image', None) - self.box_score_threshold = kwargs.get('box_score_threshold', None) - self.image_size = kwargs.get('image_size', None) - self.max_size = kwargs.get('max_size', None) - self.min_size = kwargs.get('min_size', None) - self.model_size = kwargs.get('model_size', None) - self.multi_scale = kwargs.get('multi_scale', None) - self.nms_iou_threshold = kwargs.get('nms_iou_threshold', None) - self.tile_grid_size = kwargs.get('tile_grid_size', None) - self.tile_overlap_ratio = kwargs.get('tile_overlap_ratio', None) - self.tile_predictions_nms_threshold = kwargs.get('tile_predictions_nms_threshold', None) - self.validation_iou_threshold = kwargs.get('validation_iou_threshold', None) - self.validation_metric_type = kwargs.get('validation_metric_type', None) + super(ImageClassificationBase, self).__init__(**kwargs) + self.model_settings = kwargs.get('model_settings', None) + self.search_space = kwargs.get('search_space', None) -class ImageObjectDetection(AutoMLVertical, ImageObjectDetectionBase): - """Image Object Detection. Object detection is used to identify objects in an image and locate each object with a -bounding box e.g. locate all dogs and cats in an image and draw a bounding box around each. +class ImageClassification(AutoMLVertical, ImageClassificationBase): + """Image Classification. Multi-class image classification is used when an image is classified with only a single label +from a set of classes - e.g. each image is classified as either an image of a 'cat' or a 'dog' or a 'duck'. All required parameters must be populated in order to send to Azure. @@ -15728,11 +14741,11 @@ class ImageObjectDetection(AutoMLVertical, ImageObjectDetectionBase): :vartype validation_data_size: float :ivar model_settings: Settings used for training the model. :vartype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification :ivar search_space: Search space for sampling different combinations of models and their hyperparameters. :vartype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] :ivar log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", "Info", "Warning", "Error", "Critical". :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity @@ -15747,29 +14760,3126 @@ class ImageObjectDetection(AutoMLVertical, ImageObjectDetectionBase): :ivar training_data: Required. [Required] Training data input. :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :ivar primary_metric: Primary metric to optimize for this task. Possible values include: - "MeanAveragePrecision". + "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", + "PrecisionScoreWeighted". :vartype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ObjectDetectionPrimaryMetrics + ~azure.mgmt.machinelearningservices.models.ClassificationPrimaryMetrics + """ + + _validation = { + 'limit_settings': {'required': True}, + 'task_type': {'required': True}, + 'training_data': {'required': True}, + } + + _attribute_map = { + 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, + 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, + 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, + 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, + 'model_settings': {'key': 'modelSettings', 'type': 'ImageModelSettingsClassification'}, + 'search_space': {'key': 'searchSpace', 'type': '[ImageModelDistributionSettingsClassification]'}, + 'log_verbosity': {'key': 'logVerbosity', 'type': 'str'}, + 'target_column_name': {'key': 'targetColumnName', 'type': 'str'}, + 'task_type': {'key': 'taskType', 'type': 'str'}, + 'training_data': {'key': 'trainingData', 'type': 'MLTableJobInput'}, + 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword model_settings: Settings used for training the model. + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + :keyword log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", + "Info", "Warning", "Error", "Critical". + :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :keyword target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :paramtype target_column_name: str + :keyword training_data: Required. [Required] Training data input. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword primary_metric: Primary metric to optimize for this task. Possible values include: + "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", + "PrecisionScoreWeighted". + :paramtype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ClassificationPrimaryMetrics + """ + super(ImageClassification, self).__init__(**kwargs) + self.limit_settings = kwargs['limit_settings'] + self.sweep_settings = kwargs.get('sweep_settings', None) + self.validation_data = kwargs.get('validation_data', None) + self.validation_data_size = kwargs.get('validation_data_size', None) + self.model_settings = kwargs.get('model_settings', None) + self.search_space = kwargs.get('search_space', None) + self.task_type = 'ImageClassification' # type: str + self.primary_metric = kwargs.get('primary_metric', None) + self.log_verbosity = kwargs.get('log_verbosity', None) + self.target_column_name = kwargs.get('target_column_name', None) + self.training_data = kwargs['training_data'] + + +class ImageClassificationMultilabel(AutoMLVertical, ImageClassificationBase): + """Image Classification Multilabel. Multi-label image classification is used when an image could have one or more labels +from a set of labels - e.g. an image could be labeled with both 'cat' and 'dog'. + + All required parameters must be populated in order to send to Azure. + + :ivar limit_settings: Required. [Required] Limit settings for the AutoML job. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar model_settings: Settings used for training the model. + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + :ivar log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", + "Info", "Warning", "Error", "Critical". + :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :ivar target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :vartype target_column_name: str + :ivar task_type: Required. [Required] Task type for AutoMLJob.Constant filled by server. + Possible values include: "Classification", "Regression", "Forecasting", "ImageClassification", + "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", + "TextClassification", "TextClassificationMultilabel", "TextNER". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType + :ivar training_data: Required. [Required] Training data input. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar primary_metric: Primary metric to optimize for this task. Possible values include: + "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", + "PrecisionScoreWeighted", "IOU". + :vartype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ClassificationMultilabelPrimaryMetrics + """ + + _validation = { + 'limit_settings': {'required': True}, + 'task_type': {'required': True}, + 'training_data': {'required': True}, + } + + _attribute_map = { + 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, + 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, + 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, + 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, + 'model_settings': {'key': 'modelSettings', 'type': 'ImageModelSettingsClassification'}, + 'search_space': {'key': 'searchSpace', 'type': '[ImageModelDistributionSettingsClassification]'}, + 'log_verbosity': {'key': 'logVerbosity', 'type': 'str'}, + 'target_column_name': {'key': 'targetColumnName', 'type': 'str'}, + 'task_type': {'key': 'taskType', 'type': 'str'}, + 'training_data': {'key': 'trainingData', 'type': 'MLTableJobInput'}, + 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword model_settings: Settings used for training the model. + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + :keyword log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", + "Info", "Warning", "Error", "Critical". + :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :keyword target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :paramtype target_column_name: str + :keyword training_data: Required. [Required] Training data input. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword primary_metric: Primary metric to optimize for this task. Possible values include: + "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", + "PrecisionScoreWeighted", "IOU". + :paramtype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ClassificationMultilabelPrimaryMetrics + """ + super(ImageClassificationMultilabel, self).__init__(**kwargs) + self.limit_settings = kwargs['limit_settings'] + self.sweep_settings = kwargs.get('sweep_settings', None) + self.validation_data = kwargs.get('validation_data', None) + self.validation_data_size = kwargs.get('validation_data_size', None) + self.model_settings = kwargs.get('model_settings', None) + self.search_space = kwargs.get('search_space', None) + self.task_type = 'ImageClassificationMultilabel' # type: str + self.primary_metric = kwargs.get('primary_metric', None) + self.log_verbosity = kwargs.get('log_verbosity', None) + self.target_column_name = kwargs.get('target_column_name', None) + self.training_data = kwargs['training_data'] + + +class ImageObjectDetectionBase(ImageVertical): + """ImageObjectDetectionBase. + + All required parameters must be populated in order to send to Azure. + + :ivar limit_settings: Required. [Required] Limit settings for the AutoML job. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar model_settings: Settings used for training the model. + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + """ + + _validation = { + 'limit_settings': {'required': True}, + } + + _attribute_map = { + 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, + 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, + 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, + 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, + 'model_settings': {'key': 'modelSettings', 'type': 'ImageModelSettingsObjectDetection'}, + 'search_space': {'key': 'searchSpace', 'type': '[ImageModelDistributionSettingsObjectDetection]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword model_settings: Settings used for training the model. + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + """ + super(ImageObjectDetectionBase, self).__init__(**kwargs) + self.model_settings = kwargs.get('model_settings', None) + self.search_space = kwargs.get('search_space', None) + + +class ImageInstanceSegmentation(AutoMLVertical, ImageObjectDetectionBase): + """Image Instance Segmentation. Instance segmentation is used to identify objects in an image at the pixel level, +drawing a polygon around each object in the image. + + All required parameters must be populated in order to send to Azure. + + :ivar limit_settings: Required. [Required] Limit settings for the AutoML job. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar model_settings: Settings used for training the model. + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + :ivar log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", + "Info", "Warning", "Error", "Critical". + :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :ivar target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :vartype target_column_name: str + :ivar task_type: Required. [Required] Task type for AutoMLJob.Constant filled by server. + Possible values include: "Classification", "Regression", "Forecasting", "ImageClassification", + "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", + "TextClassification", "TextClassificationMultilabel", "TextNER". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType + :ivar training_data: Required. [Required] Training data input. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar primary_metric: Primary metric to optimize for this task. Possible values include: + "MeanAveragePrecision". + :vartype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.InstanceSegmentationPrimaryMetrics + """ + + _validation = { + 'limit_settings': {'required': True}, + 'task_type': {'required': True}, + 'training_data': {'required': True}, + } + + _attribute_map = { + 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, + 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, + 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, + 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, + 'model_settings': {'key': 'modelSettings', 'type': 'ImageModelSettingsObjectDetection'}, + 'search_space': {'key': 'searchSpace', 'type': '[ImageModelDistributionSettingsObjectDetection]'}, + 'log_verbosity': {'key': 'logVerbosity', 'type': 'str'}, + 'target_column_name': {'key': 'targetColumnName', 'type': 'str'}, + 'task_type': {'key': 'taskType', 'type': 'str'}, + 'training_data': {'key': 'trainingData', 'type': 'MLTableJobInput'}, + 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword model_settings: Settings used for training the model. + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + :keyword log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", + "Info", "Warning", "Error", "Critical". + :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :keyword target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :paramtype target_column_name: str + :keyword training_data: Required. [Required] Training data input. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword primary_metric: Primary metric to optimize for this task. Possible values include: + "MeanAveragePrecision". + :paramtype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.InstanceSegmentationPrimaryMetrics + """ + super(ImageInstanceSegmentation, self).__init__(**kwargs) + self.limit_settings = kwargs['limit_settings'] + self.sweep_settings = kwargs.get('sweep_settings', None) + self.validation_data = kwargs.get('validation_data', None) + self.validation_data_size = kwargs.get('validation_data_size', None) + self.model_settings = kwargs.get('model_settings', None) + self.search_space = kwargs.get('search_space', None) + self.task_type = 'ImageInstanceSegmentation' # type: str + self.primary_metric = kwargs.get('primary_metric', None) + self.log_verbosity = kwargs.get('log_verbosity', None) + self.target_column_name = kwargs.get('target_column_name', None) + self.training_data = kwargs['training_data'] + + +class ImageLimitSettings(msrest.serialization.Model): + """Limit settings for the AutoML job. + + :ivar max_concurrent_trials: Maximum number of concurrent AutoML iterations. + :vartype max_concurrent_trials: int + :ivar max_trials: Maximum number of AutoML iterations. + :vartype max_trials: int + :ivar timeout: AutoML job timeout. + :vartype timeout: ~datetime.timedelta + """ + + _attribute_map = { + 'max_concurrent_trials': {'key': 'maxConcurrentTrials', 'type': 'int'}, + 'max_trials': {'key': 'maxTrials', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'duration'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword max_concurrent_trials: Maximum number of concurrent AutoML iterations. + :paramtype max_concurrent_trials: int + :keyword max_trials: Maximum number of AutoML iterations. + :paramtype max_trials: int + :keyword timeout: AutoML job timeout. + :paramtype timeout: ~datetime.timedelta + """ + super(ImageLimitSettings, self).__init__(**kwargs) + self.max_concurrent_trials = kwargs.get('max_concurrent_trials', 1) + self.max_trials = kwargs.get('max_trials', 1) + self.timeout = kwargs.get('timeout', "P7D") + + +class ImageMetadata(msrest.serialization.Model): + """Returns metadata about the operating system image for this compute instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar current_image_version: Specifies the current operating system image version this compute + instance is running on. + :vartype current_image_version: str + :ivar latest_image_version: Specifies the latest available operating system image version. + :vartype latest_image_version: str + :ivar is_latest_os_image_version: Specifies whether this compute instance is running on the + latest operating system image. + :vartype is_latest_os_image_version: bool + :ivar os_patching_status: Metadata about the os patching. + :vartype os_patching_status: ~azure.mgmt.machinelearningservices.models.OsPatchingStatus + """ + + _validation = { + 'os_patching_status': {'readonly': True}, + } + + _attribute_map = { + 'current_image_version': {'key': 'currentImageVersion', 'type': 'str'}, + 'latest_image_version': {'key': 'latestImageVersion', 'type': 'str'}, + 'is_latest_os_image_version': {'key': 'isLatestOsImageVersion', 'type': 'bool'}, + 'os_patching_status': {'key': 'osPatchingStatus', 'type': 'OsPatchingStatus'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword current_image_version: Specifies the current operating system image version this + compute instance is running on. + :paramtype current_image_version: str + :keyword latest_image_version: Specifies the latest available operating system image version. + :paramtype latest_image_version: str + :keyword is_latest_os_image_version: Specifies whether this compute instance is running on the + latest operating system image. + :paramtype is_latest_os_image_version: bool + """ + super(ImageMetadata, self).__init__(**kwargs) + self.current_image_version = kwargs.get('current_image_version', None) + self.latest_image_version = kwargs.get('latest_image_version', None) + self.is_latest_os_image_version = kwargs.get('is_latest_os_image_version', None) + self.os_patching_status = None + + +class ImageModelDistributionSettings(msrest.serialization.Model): + """Distribution expressions to sweep over values of model settings. + +:code:` +Some examples are: +``` +ModelName = "choice('seresnext', 'resnest50')"; +LearningRate = "uniform(0.001, 0.01)"; +LayersToFreeze = "choice(0, 2)"; +```` +All distributions can be specified as distribution_name(min, max) or choice(val1, val2, ..., valn) +where distribution name can be: uniform, quniform, loguniform, etc +For more details on how to compose distribution expressions please check the documentation: +https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters +For more information on the available settings please visit the official documentation: +https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + + :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :vartype ams_gradient: str + :ivar augmentations: Settings for using Augmentations. + :vartype augmentations: str + :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta1: str + :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta2: str + :ivar distributed: Whether to use distributer training. + :vartype distributed: str + :ivar early_stopping: Enable early stopping logic during training. + :vartype early_stopping: str + :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before + primary metric improvement + is tracked for early stopping. Must be a positive integer. + :vartype early_stopping_delay: str + :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :vartype early_stopping_patience: str + :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. + :vartype enable_onnx_normalization: str + :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must + be a positive integer. + :vartype evaluation_frequency: str + :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :vartype gradient_accumulation_step: str + :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype layers_to_freeze: str + :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :vartype learning_rate: str + :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. + :vartype learning_rate_scheduler: str + :ivar model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype model_name: str + :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + :vartype momentum: str + :ivar nesterov: Enable nesterov when optimizer is 'sgd'. + :vartype nesterov: str + :ivar number_of_epochs: Number of training epochs. Must be a positive integer. + :vartype number_of_epochs: str + :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. + :vartype number_of_workers: str + :ivar optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + :vartype optimizer: str + :ivar random_seed: Random seed to be used when using deterministic training. + :vartype random_seed: str + :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in + the range [0, 1]. + :vartype step_lr_gamma: str + :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a + positive integer. + :vartype step_lr_step_size: str + :ivar training_batch_size: Training batch size. Must be a positive integer. + :vartype training_batch_size: str + :ivar validation_batch_size: Validation batch size. Must be a positive integer. + :vartype validation_batch_size: str + :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :vartype warmup_cosine_lr_cycles: str + :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :vartype warmup_cosine_lr_warmup_epochs: str + :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be + a float in the range[0, 1]. + :vartype weight_decay: str + """ + + _attribute_map = { + 'ams_gradient': {'key': 'amsGradient', 'type': 'str'}, + 'augmentations': {'key': 'augmentations', 'type': 'str'}, + 'beta1': {'key': 'beta1', 'type': 'str'}, + 'beta2': {'key': 'beta2', 'type': 'str'}, + 'distributed': {'key': 'distributed', 'type': 'str'}, + 'early_stopping': {'key': 'earlyStopping', 'type': 'str'}, + 'early_stopping_delay': {'key': 'earlyStoppingDelay', 'type': 'str'}, + 'early_stopping_patience': {'key': 'earlyStoppingPatience', 'type': 'str'}, + 'enable_onnx_normalization': {'key': 'enableOnnxNormalization', 'type': 'str'}, + 'evaluation_frequency': {'key': 'evaluationFrequency', 'type': 'str'}, + 'gradient_accumulation_step': {'key': 'gradientAccumulationStep', 'type': 'str'}, + 'layers_to_freeze': {'key': 'layersToFreeze', 'type': 'str'}, + 'learning_rate': {'key': 'learningRate', 'type': 'str'}, + 'learning_rate_scheduler': {'key': 'learningRateScheduler', 'type': 'str'}, + 'model_name': {'key': 'modelName', 'type': 'str'}, + 'momentum': {'key': 'momentum', 'type': 'str'}, + 'nesterov': {'key': 'nesterov', 'type': 'str'}, + 'number_of_epochs': {'key': 'numberOfEpochs', 'type': 'str'}, + 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'str'}, + 'optimizer': {'key': 'optimizer', 'type': 'str'}, + 'random_seed': {'key': 'randomSeed', 'type': 'str'}, + 'step_lr_gamma': {'key': 'stepLRGamma', 'type': 'str'}, + 'step_lr_step_size': {'key': 'stepLRStepSize', 'type': 'str'}, + 'training_batch_size': {'key': 'trainingBatchSize', 'type': 'str'}, + 'validation_batch_size': {'key': 'validationBatchSize', 'type': 'str'}, + 'warmup_cosine_lr_cycles': {'key': 'warmupCosineLRCycles', 'type': 'str'}, + 'warmup_cosine_lr_warmup_epochs': {'key': 'warmupCosineLRWarmupEpochs', 'type': 'str'}, + 'weight_decay': {'key': 'weightDecay', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :paramtype ams_gradient: str + :keyword augmentations: Settings for using Augmentations. + :paramtype augmentations: str + :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta1: str + :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta2: str + :keyword distributed: Whether to use distributer training. + :paramtype distributed: str + :keyword early_stopping: Enable early stopping logic during training. + :paramtype early_stopping: str + :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait + before primary metric improvement + is tracked for early stopping. Must be a positive integer. + :paramtype early_stopping_delay: str + :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :paramtype early_stopping_patience: str + :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. + :paramtype enable_onnx_normalization: str + :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. + Must be a positive integer. + :paramtype evaluation_frequency: str + :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :paramtype gradient_accumulation_step: str + :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive + integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype layers_to_freeze: str + :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :paramtype learning_rate: str + :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. + :paramtype learning_rate_scheduler: str + :keyword model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype model_name: str + :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, + 1]. + :paramtype momentum: str + :keyword nesterov: Enable nesterov when optimizer is 'sgd'. + :paramtype nesterov: str + :keyword number_of_epochs: Number of training epochs. Must be a positive integer. + :paramtype number_of_epochs: str + :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. + :paramtype number_of_workers: str + :keyword optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + :paramtype optimizer: str + :keyword random_seed: Random seed to be used when using deterministic training. + :paramtype random_seed: str + :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float + in the range [0, 1]. + :paramtype step_lr_gamma: str + :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be + a positive integer. + :paramtype step_lr_step_size: str + :keyword training_batch_size: Training batch size. Must be a positive integer. + :paramtype training_batch_size: str + :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :paramtype validation_batch_size: str + :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :paramtype warmup_cosine_lr_cycles: str + :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :paramtype warmup_cosine_lr_warmup_epochs: str + :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must + be a float in the range[0, 1]. + :paramtype weight_decay: str + """ + super(ImageModelDistributionSettings, self).__init__(**kwargs) + self.ams_gradient = kwargs.get('ams_gradient', None) + self.augmentations = kwargs.get('augmentations', None) + self.beta1 = kwargs.get('beta1', None) + self.beta2 = kwargs.get('beta2', None) + self.distributed = kwargs.get('distributed', None) + self.early_stopping = kwargs.get('early_stopping', None) + self.early_stopping_delay = kwargs.get('early_stopping_delay', None) + self.early_stopping_patience = kwargs.get('early_stopping_patience', None) + self.enable_onnx_normalization = kwargs.get('enable_onnx_normalization', None) + self.evaluation_frequency = kwargs.get('evaluation_frequency', None) + self.gradient_accumulation_step = kwargs.get('gradient_accumulation_step', None) + self.layers_to_freeze = kwargs.get('layers_to_freeze', None) + self.learning_rate = kwargs.get('learning_rate', None) + self.learning_rate_scheduler = kwargs.get('learning_rate_scheduler', None) + self.model_name = kwargs.get('model_name', None) + self.momentum = kwargs.get('momentum', None) + self.nesterov = kwargs.get('nesterov', None) + self.number_of_epochs = kwargs.get('number_of_epochs', None) + self.number_of_workers = kwargs.get('number_of_workers', None) + self.optimizer = kwargs.get('optimizer', None) + self.random_seed = kwargs.get('random_seed', None) + self.step_lr_gamma = kwargs.get('step_lr_gamma', None) + self.step_lr_step_size = kwargs.get('step_lr_step_size', None) + self.training_batch_size = kwargs.get('training_batch_size', None) + self.validation_batch_size = kwargs.get('validation_batch_size', None) + self.warmup_cosine_lr_cycles = kwargs.get('warmup_cosine_lr_cycles', None) + self.warmup_cosine_lr_warmup_epochs = kwargs.get('warmup_cosine_lr_warmup_epochs', None) + self.weight_decay = kwargs.get('weight_decay', None) + + +class ImageModelDistributionSettingsClassification(ImageModelDistributionSettings): + """Distribution expressions to sweep over values of model settings. + +:code:` +Some examples are: +``` +ModelName = "choice('seresnext', 'resnest50')"; +LearningRate = "uniform(0.001, 0.01)"; +LayersToFreeze = "choice(0, 2)"; +```` +For more details on how to compose distribution expressions please check the documentation: +https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters +For more information on the available settings please visit the official documentation: +https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + + :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :vartype ams_gradient: str + :ivar augmentations: Settings for using Augmentations. + :vartype augmentations: str + :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta1: str + :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta2: str + :ivar distributed: Whether to use distributer training. + :vartype distributed: str + :ivar early_stopping: Enable early stopping logic during training. + :vartype early_stopping: str + :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before + primary metric improvement + is tracked for early stopping. Must be a positive integer. + :vartype early_stopping_delay: str + :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :vartype early_stopping_patience: str + :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. + :vartype enable_onnx_normalization: str + :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must + be a positive integer. + :vartype evaluation_frequency: str + :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :vartype gradient_accumulation_step: str + :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype layers_to_freeze: str + :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :vartype learning_rate: str + :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. + :vartype learning_rate_scheduler: str + :ivar model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype model_name: str + :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + :vartype momentum: str + :ivar nesterov: Enable nesterov when optimizer is 'sgd'. + :vartype nesterov: str + :ivar number_of_epochs: Number of training epochs. Must be a positive integer. + :vartype number_of_epochs: str + :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. + :vartype number_of_workers: str + :ivar optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + :vartype optimizer: str + :ivar random_seed: Random seed to be used when using deterministic training. + :vartype random_seed: str + :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in + the range [0, 1]. + :vartype step_lr_gamma: str + :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a + positive integer. + :vartype step_lr_step_size: str + :ivar training_batch_size: Training batch size. Must be a positive integer. + :vartype training_batch_size: str + :ivar validation_batch_size: Validation batch size. Must be a positive integer. + :vartype validation_batch_size: str + :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :vartype warmup_cosine_lr_cycles: str + :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :vartype warmup_cosine_lr_warmup_epochs: str + :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be + a float in the range[0, 1]. + :vartype weight_decay: str + :ivar training_crop_size: Image crop size that is input to the neural network for the training + dataset. Must be a positive integer. + :vartype training_crop_size: str + :ivar validation_crop_size: Image crop size that is input to the neural network for the + validation dataset. Must be a positive integer. + :vartype validation_crop_size: str + :ivar validation_resize_size: Image size to which to resize before cropping for validation + dataset. Must be a positive integer. + :vartype validation_resize_size: str + :ivar weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. + 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be + 0 or 1 or 2. + :vartype weighted_loss: str + """ + + _attribute_map = { + 'ams_gradient': {'key': 'amsGradient', 'type': 'str'}, + 'augmentations': {'key': 'augmentations', 'type': 'str'}, + 'beta1': {'key': 'beta1', 'type': 'str'}, + 'beta2': {'key': 'beta2', 'type': 'str'}, + 'distributed': {'key': 'distributed', 'type': 'str'}, + 'early_stopping': {'key': 'earlyStopping', 'type': 'str'}, + 'early_stopping_delay': {'key': 'earlyStoppingDelay', 'type': 'str'}, + 'early_stopping_patience': {'key': 'earlyStoppingPatience', 'type': 'str'}, + 'enable_onnx_normalization': {'key': 'enableOnnxNormalization', 'type': 'str'}, + 'evaluation_frequency': {'key': 'evaluationFrequency', 'type': 'str'}, + 'gradient_accumulation_step': {'key': 'gradientAccumulationStep', 'type': 'str'}, + 'layers_to_freeze': {'key': 'layersToFreeze', 'type': 'str'}, + 'learning_rate': {'key': 'learningRate', 'type': 'str'}, + 'learning_rate_scheduler': {'key': 'learningRateScheduler', 'type': 'str'}, + 'model_name': {'key': 'modelName', 'type': 'str'}, + 'momentum': {'key': 'momentum', 'type': 'str'}, + 'nesterov': {'key': 'nesterov', 'type': 'str'}, + 'number_of_epochs': {'key': 'numberOfEpochs', 'type': 'str'}, + 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'str'}, + 'optimizer': {'key': 'optimizer', 'type': 'str'}, + 'random_seed': {'key': 'randomSeed', 'type': 'str'}, + 'step_lr_gamma': {'key': 'stepLRGamma', 'type': 'str'}, + 'step_lr_step_size': {'key': 'stepLRStepSize', 'type': 'str'}, + 'training_batch_size': {'key': 'trainingBatchSize', 'type': 'str'}, + 'validation_batch_size': {'key': 'validationBatchSize', 'type': 'str'}, + 'warmup_cosine_lr_cycles': {'key': 'warmupCosineLRCycles', 'type': 'str'}, + 'warmup_cosine_lr_warmup_epochs': {'key': 'warmupCosineLRWarmupEpochs', 'type': 'str'}, + 'weight_decay': {'key': 'weightDecay', 'type': 'str'}, + 'training_crop_size': {'key': 'trainingCropSize', 'type': 'str'}, + 'validation_crop_size': {'key': 'validationCropSize', 'type': 'str'}, + 'validation_resize_size': {'key': 'validationResizeSize', 'type': 'str'}, + 'weighted_loss': {'key': 'weightedLoss', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :paramtype ams_gradient: str + :keyword augmentations: Settings for using Augmentations. + :paramtype augmentations: str + :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta1: str + :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta2: str + :keyword distributed: Whether to use distributer training. + :paramtype distributed: str + :keyword early_stopping: Enable early stopping logic during training. + :paramtype early_stopping: str + :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait + before primary metric improvement + is tracked for early stopping. Must be a positive integer. + :paramtype early_stopping_delay: str + :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :paramtype early_stopping_patience: str + :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. + :paramtype enable_onnx_normalization: str + :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. + Must be a positive integer. + :paramtype evaluation_frequency: str + :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :paramtype gradient_accumulation_step: str + :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive + integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype layers_to_freeze: str + :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :paramtype learning_rate: str + :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. + :paramtype learning_rate_scheduler: str + :keyword model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype model_name: str + :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, + 1]. + :paramtype momentum: str + :keyword nesterov: Enable nesterov when optimizer is 'sgd'. + :paramtype nesterov: str + :keyword number_of_epochs: Number of training epochs. Must be a positive integer. + :paramtype number_of_epochs: str + :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. + :paramtype number_of_workers: str + :keyword optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + :paramtype optimizer: str + :keyword random_seed: Random seed to be used when using deterministic training. + :paramtype random_seed: str + :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float + in the range [0, 1]. + :paramtype step_lr_gamma: str + :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be + a positive integer. + :paramtype step_lr_step_size: str + :keyword training_batch_size: Training batch size. Must be a positive integer. + :paramtype training_batch_size: str + :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :paramtype validation_batch_size: str + :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :paramtype warmup_cosine_lr_cycles: str + :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :paramtype warmup_cosine_lr_warmup_epochs: str + :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must + be a float in the range[0, 1]. + :paramtype weight_decay: str + :keyword training_crop_size: Image crop size that is input to the neural network for the + training dataset. Must be a positive integer. + :paramtype training_crop_size: str + :keyword validation_crop_size: Image crop size that is input to the neural network for the + validation dataset. Must be a positive integer. + :paramtype validation_crop_size: str + :keyword validation_resize_size: Image size to which to resize before cropping for validation + dataset. Must be a positive integer. + :paramtype validation_resize_size: str + :keyword weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. + 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be + 0 or 1 or 2. + :paramtype weighted_loss: str + """ + super(ImageModelDistributionSettingsClassification, self).__init__(**kwargs) + self.training_crop_size = kwargs.get('training_crop_size', None) + self.validation_crop_size = kwargs.get('validation_crop_size', None) + self.validation_resize_size = kwargs.get('validation_resize_size', None) + self.weighted_loss = kwargs.get('weighted_loss', None) + + +class ImageModelDistributionSettingsObjectDetection(ImageModelDistributionSettings): + """Distribution expressions to sweep over values of model settings. + +:code:` +Some examples are: +``` +ModelName = "choice('seresnext', 'resnest50')"; +LearningRate = "uniform(0.001, 0.01)"; +LayersToFreeze = "choice(0, 2)"; +```` +For more details on how to compose distribution expressions please check the documentation: +https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters +For more information on the available settings please visit the official documentation: +https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + + :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :vartype ams_gradient: str + :ivar augmentations: Settings for using Augmentations. + :vartype augmentations: str + :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta1: str + :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta2: str + :ivar distributed: Whether to use distributer training. + :vartype distributed: str + :ivar early_stopping: Enable early stopping logic during training. + :vartype early_stopping: str + :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before + primary metric improvement + is tracked for early stopping. Must be a positive integer. + :vartype early_stopping_delay: str + :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :vartype early_stopping_patience: str + :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. + :vartype enable_onnx_normalization: str + :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must + be a positive integer. + :vartype evaluation_frequency: str + :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :vartype gradient_accumulation_step: str + :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype layers_to_freeze: str + :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :vartype learning_rate: str + :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. + :vartype learning_rate_scheduler: str + :ivar model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype model_name: str + :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + :vartype momentum: str + :ivar nesterov: Enable nesterov when optimizer is 'sgd'. + :vartype nesterov: str + :ivar number_of_epochs: Number of training epochs. Must be a positive integer. + :vartype number_of_epochs: str + :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. + :vartype number_of_workers: str + :ivar optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + :vartype optimizer: str + :ivar random_seed: Random seed to be used when using deterministic training. + :vartype random_seed: str + :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in + the range [0, 1]. + :vartype step_lr_gamma: str + :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a + positive integer. + :vartype step_lr_step_size: str + :ivar training_batch_size: Training batch size. Must be a positive integer. + :vartype training_batch_size: str + :ivar validation_batch_size: Validation batch size. Must be a positive integer. + :vartype validation_batch_size: str + :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :vartype warmup_cosine_lr_cycles: str + :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :vartype warmup_cosine_lr_warmup_epochs: str + :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be + a float in the range[0, 1]. + :vartype weight_decay: str + :ivar box_detections_per_image: Maximum number of detections per image, for all classes. Must + be a positive integer. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype box_detections_per_image: str + :ivar box_score_threshold: During inference, only return proposals with a classification score + greater than + BoxScoreThreshold. Must be a float in the range[0, 1]. + :vartype box_score_threshold: str + :ivar image_size: Image size for train and validation. Must be a positive integer. + Note: The training run may get into CUDA OOM if the size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. + :vartype image_size: str + :ivar max_size: Maximum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype max_size: str + :ivar min_size: Minimum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype min_size: str + :ivar model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. + Note: training run may get into CUDA OOM if the model size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. + :vartype model_size: str + :ivar multi_scale: Enable multi-scale image by varying image size by +/- 50%. + Note: training run may get into CUDA OOM if no sufficient GPU memory. + Note: This settings is only supported for the 'yolov5' algorithm. + :vartype multi_scale: str + :ivar nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be + float in the range [0, 1]. + :vartype nms_iou_threshold: str + :ivar tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must not + be + None to enable small object detection logic. A string containing two integers in mxn format. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype tile_grid_size: str + :ivar tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be float + in the range [0, 1). + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype tile_overlap_ratio: str + :ivar tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging + predictions from tiles and image. + Used in validation/ inference. Must be float in the range [0, 1]. + Note: This settings is not supported for the 'yolov5' algorithm. + NMS: Non-maximum suppression. + :vartype tile_predictions_nms_threshold: str + :ivar validation_iou_threshold: IOU threshold to use when computing validation metric. Must be + float in the range [0, 1]. + :vartype validation_iou_threshold: str + :ivar validation_metric_type: Metric computation method to use for validation metrics. Must be + 'none', 'coco', 'voc', or 'coco_voc'. + :vartype validation_metric_type: str + """ + + _attribute_map = { + 'ams_gradient': {'key': 'amsGradient', 'type': 'str'}, + 'augmentations': {'key': 'augmentations', 'type': 'str'}, + 'beta1': {'key': 'beta1', 'type': 'str'}, + 'beta2': {'key': 'beta2', 'type': 'str'}, + 'distributed': {'key': 'distributed', 'type': 'str'}, + 'early_stopping': {'key': 'earlyStopping', 'type': 'str'}, + 'early_stopping_delay': {'key': 'earlyStoppingDelay', 'type': 'str'}, + 'early_stopping_patience': {'key': 'earlyStoppingPatience', 'type': 'str'}, + 'enable_onnx_normalization': {'key': 'enableOnnxNormalization', 'type': 'str'}, + 'evaluation_frequency': {'key': 'evaluationFrequency', 'type': 'str'}, + 'gradient_accumulation_step': {'key': 'gradientAccumulationStep', 'type': 'str'}, + 'layers_to_freeze': {'key': 'layersToFreeze', 'type': 'str'}, + 'learning_rate': {'key': 'learningRate', 'type': 'str'}, + 'learning_rate_scheduler': {'key': 'learningRateScheduler', 'type': 'str'}, + 'model_name': {'key': 'modelName', 'type': 'str'}, + 'momentum': {'key': 'momentum', 'type': 'str'}, + 'nesterov': {'key': 'nesterov', 'type': 'str'}, + 'number_of_epochs': {'key': 'numberOfEpochs', 'type': 'str'}, + 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'str'}, + 'optimizer': {'key': 'optimizer', 'type': 'str'}, + 'random_seed': {'key': 'randomSeed', 'type': 'str'}, + 'step_lr_gamma': {'key': 'stepLRGamma', 'type': 'str'}, + 'step_lr_step_size': {'key': 'stepLRStepSize', 'type': 'str'}, + 'training_batch_size': {'key': 'trainingBatchSize', 'type': 'str'}, + 'validation_batch_size': {'key': 'validationBatchSize', 'type': 'str'}, + 'warmup_cosine_lr_cycles': {'key': 'warmupCosineLRCycles', 'type': 'str'}, + 'warmup_cosine_lr_warmup_epochs': {'key': 'warmupCosineLRWarmupEpochs', 'type': 'str'}, + 'weight_decay': {'key': 'weightDecay', 'type': 'str'}, + 'box_detections_per_image': {'key': 'boxDetectionsPerImage', 'type': 'str'}, + 'box_score_threshold': {'key': 'boxScoreThreshold', 'type': 'str'}, + 'image_size': {'key': 'imageSize', 'type': 'str'}, + 'max_size': {'key': 'maxSize', 'type': 'str'}, + 'min_size': {'key': 'minSize', 'type': 'str'}, + 'model_size': {'key': 'modelSize', 'type': 'str'}, + 'multi_scale': {'key': 'multiScale', 'type': 'str'}, + 'nms_iou_threshold': {'key': 'nmsIouThreshold', 'type': 'str'}, + 'tile_grid_size': {'key': 'tileGridSize', 'type': 'str'}, + 'tile_overlap_ratio': {'key': 'tileOverlapRatio', 'type': 'str'}, + 'tile_predictions_nms_threshold': {'key': 'tilePredictionsNmsThreshold', 'type': 'str'}, + 'validation_iou_threshold': {'key': 'validationIouThreshold', 'type': 'str'}, + 'validation_metric_type': {'key': 'validationMetricType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :paramtype ams_gradient: str + :keyword augmentations: Settings for using Augmentations. + :paramtype augmentations: str + :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta1: str + :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta2: str + :keyword distributed: Whether to use distributer training. + :paramtype distributed: str + :keyword early_stopping: Enable early stopping logic during training. + :paramtype early_stopping: str + :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait + before primary metric improvement + is tracked for early stopping. Must be a positive integer. + :paramtype early_stopping_delay: str + :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :paramtype early_stopping_patience: str + :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. + :paramtype enable_onnx_normalization: str + :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. + Must be a positive integer. + :paramtype evaluation_frequency: str + :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :paramtype gradient_accumulation_step: str + :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive + integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype layers_to_freeze: str + :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :paramtype learning_rate: str + :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. + :paramtype learning_rate_scheduler: str + :keyword model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype model_name: str + :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, + 1]. + :paramtype momentum: str + :keyword nesterov: Enable nesterov when optimizer is 'sgd'. + :paramtype nesterov: str + :keyword number_of_epochs: Number of training epochs. Must be a positive integer. + :paramtype number_of_epochs: str + :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. + :paramtype number_of_workers: str + :keyword optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + :paramtype optimizer: str + :keyword random_seed: Random seed to be used when using deterministic training. + :paramtype random_seed: str + :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float + in the range [0, 1]. + :paramtype step_lr_gamma: str + :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be + a positive integer. + :paramtype step_lr_step_size: str + :keyword training_batch_size: Training batch size. Must be a positive integer. + :paramtype training_batch_size: str + :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :paramtype validation_batch_size: str + :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :paramtype warmup_cosine_lr_cycles: str + :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :paramtype warmup_cosine_lr_warmup_epochs: str + :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must + be a float in the range[0, 1]. + :paramtype weight_decay: str + :keyword box_detections_per_image: Maximum number of detections per image, for all classes. + Must be a positive integer. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype box_detections_per_image: str + :keyword box_score_threshold: During inference, only return proposals with a classification + score greater than + BoxScoreThreshold. Must be a float in the range[0, 1]. + :paramtype box_score_threshold: str + :keyword image_size: Image size for train and validation. Must be a positive integer. + Note: The training run may get into CUDA OOM if the size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. + :paramtype image_size: str + :keyword max_size: Maximum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype max_size: str + :keyword min_size: Minimum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype min_size: str + :keyword model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. + Note: training run may get into CUDA OOM if the model size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. + :paramtype model_size: str + :keyword multi_scale: Enable multi-scale image by varying image size by +/- 50%. + Note: training run may get into CUDA OOM if no sufficient GPU memory. + Note: This settings is only supported for the 'yolov5' algorithm. + :paramtype multi_scale: str + :keyword nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be + float in the range [0, 1]. + :paramtype nms_iou_threshold: str + :keyword tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must + not be + None to enable small object detection logic. A string containing two integers in mxn format. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype tile_grid_size: str + :keyword tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be + float in the range [0, 1). + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype tile_overlap_ratio: str + :keyword tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging + predictions from tiles and image. + Used in validation/ inference. Must be float in the range [0, 1]. + Note: This settings is not supported for the 'yolov5' algorithm. + NMS: Non-maximum suppression. + :paramtype tile_predictions_nms_threshold: str + :keyword validation_iou_threshold: IOU threshold to use when computing validation metric. Must + be float in the range [0, 1]. + :paramtype validation_iou_threshold: str + :keyword validation_metric_type: Metric computation method to use for validation metrics. Must + be 'none', 'coco', 'voc', or 'coco_voc'. + :paramtype validation_metric_type: str + """ + super(ImageModelDistributionSettingsObjectDetection, self).__init__(**kwargs) + self.box_detections_per_image = kwargs.get('box_detections_per_image', None) + self.box_score_threshold = kwargs.get('box_score_threshold', None) + self.image_size = kwargs.get('image_size', None) + self.max_size = kwargs.get('max_size', None) + self.min_size = kwargs.get('min_size', None) + self.model_size = kwargs.get('model_size', None) + self.multi_scale = kwargs.get('multi_scale', None) + self.nms_iou_threshold = kwargs.get('nms_iou_threshold', None) + self.tile_grid_size = kwargs.get('tile_grid_size', None) + self.tile_overlap_ratio = kwargs.get('tile_overlap_ratio', None) + self.tile_predictions_nms_threshold = kwargs.get('tile_predictions_nms_threshold', None) + self.validation_iou_threshold = kwargs.get('validation_iou_threshold', None) + self.validation_metric_type = kwargs.get('validation_metric_type', None) + + +class ImageModelSettings(msrest.serialization.Model): + """Settings used for training the model. +For more information on the available settings please visit the official documentation: +https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + + :ivar advanced_settings: Settings for advanced scenarios. + :vartype advanced_settings: str + :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :vartype ams_gradient: bool + :ivar augmentations: Settings for using Augmentations. + :vartype augmentations: str + :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta1: float + :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta2: float + :ivar checkpoint_frequency: Frequency to store model checkpoints. Must be a positive integer. + :vartype checkpoint_frequency: int + :ivar checkpoint_model: The pretrained checkpoint model for incremental training. + :vartype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :ivar checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for + incremental training. + :vartype checkpoint_run_id: str + :ivar distributed: Whether to use distributed training. + :vartype distributed: bool + :ivar early_stopping: Enable early stopping logic during training. + :vartype early_stopping: bool + :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before + primary metric improvement + is tracked for early stopping. Must be a positive integer. + :vartype early_stopping_delay: int + :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :vartype early_stopping_patience: int + :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. + :vartype enable_onnx_normalization: bool + :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must + be a positive integer. + :vartype evaluation_frequency: int + :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :vartype gradient_accumulation_step: int + :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype layers_to_freeze: int + :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :vartype learning_rate: float + :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. Possible values include: "None", "WarmupCosine", "Step". + :vartype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.LearningRateScheduler + :ivar model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype model_name: str + :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + :vartype momentum: float + :ivar nesterov: Enable nesterov when optimizer is 'sgd'. + :vartype nesterov: bool + :ivar number_of_epochs: Number of training epochs. Must be a positive integer. + :vartype number_of_epochs: int + :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. + :vartype number_of_workers: int + :ivar optimizer: Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw". + :vartype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer + :ivar random_seed: Random seed to be used when using deterministic training. + :vartype random_seed: int + :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in + the range [0, 1]. + :vartype step_lr_gamma: float + :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a + positive integer. + :vartype step_lr_step_size: int + :ivar training_batch_size: Training batch size. Must be a positive integer. + :vartype training_batch_size: int + :ivar validation_batch_size: Validation batch size. Must be a positive integer. + :vartype validation_batch_size: int + :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :vartype warmup_cosine_lr_cycles: float + :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :vartype warmup_cosine_lr_warmup_epochs: int + :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be + a float in the range[0, 1]. + :vartype weight_decay: float + """ + + _attribute_map = { + 'advanced_settings': {'key': 'advancedSettings', 'type': 'str'}, + 'ams_gradient': {'key': 'amsGradient', 'type': 'bool'}, + 'augmentations': {'key': 'augmentations', 'type': 'str'}, + 'beta1': {'key': 'beta1', 'type': 'float'}, + 'beta2': {'key': 'beta2', 'type': 'float'}, + 'checkpoint_frequency': {'key': 'checkpointFrequency', 'type': 'int'}, + 'checkpoint_model': {'key': 'checkpointModel', 'type': 'MLFlowModelJobInput'}, + 'checkpoint_run_id': {'key': 'checkpointRunId', 'type': 'str'}, + 'distributed': {'key': 'distributed', 'type': 'bool'}, + 'early_stopping': {'key': 'earlyStopping', 'type': 'bool'}, + 'early_stopping_delay': {'key': 'earlyStoppingDelay', 'type': 'int'}, + 'early_stopping_patience': {'key': 'earlyStoppingPatience', 'type': 'int'}, + 'enable_onnx_normalization': {'key': 'enableOnnxNormalization', 'type': 'bool'}, + 'evaluation_frequency': {'key': 'evaluationFrequency', 'type': 'int'}, + 'gradient_accumulation_step': {'key': 'gradientAccumulationStep', 'type': 'int'}, + 'layers_to_freeze': {'key': 'layersToFreeze', 'type': 'int'}, + 'learning_rate': {'key': 'learningRate', 'type': 'float'}, + 'learning_rate_scheduler': {'key': 'learningRateScheduler', 'type': 'str'}, + 'model_name': {'key': 'modelName', 'type': 'str'}, + 'momentum': {'key': 'momentum', 'type': 'float'}, + 'nesterov': {'key': 'nesterov', 'type': 'bool'}, + 'number_of_epochs': {'key': 'numberOfEpochs', 'type': 'int'}, + 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, + 'optimizer': {'key': 'optimizer', 'type': 'str'}, + 'random_seed': {'key': 'randomSeed', 'type': 'int'}, + 'step_lr_gamma': {'key': 'stepLRGamma', 'type': 'float'}, + 'step_lr_step_size': {'key': 'stepLRStepSize', 'type': 'int'}, + 'training_batch_size': {'key': 'trainingBatchSize', 'type': 'int'}, + 'validation_batch_size': {'key': 'validationBatchSize', 'type': 'int'}, + 'warmup_cosine_lr_cycles': {'key': 'warmupCosineLRCycles', 'type': 'float'}, + 'warmup_cosine_lr_warmup_epochs': {'key': 'warmupCosineLRWarmupEpochs', 'type': 'int'}, + 'weight_decay': {'key': 'weightDecay', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword advanced_settings: Settings for advanced scenarios. + :paramtype advanced_settings: str + :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :paramtype ams_gradient: bool + :keyword augmentations: Settings for using Augmentations. + :paramtype augmentations: str + :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta1: float + :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta2: float + :keyword checkpoint_frequency: Frequency to store model checkpoints. Must be a positive + integer. + :paramtype checkpoint_frequency: int + :keyword checkpoint_model: The pretrained checkpoint model for incremental training. + :paramtype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :keyword checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for + incremental training. + :paramtype checkpoint_run_id: str + :keyword distributed: Whether to use distributed training. + :paramtype distributed: bool + :keyword early_stopping: Enable early stopping logic during training. + :paramtype early_stopping: bool + :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait + before primary metric improvement + is tracked for early stopping. Must be a positive integer. + :paramtype early_stopping_delay: int + :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :paramtype early_stopping_patience: int + :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. + :paramtype enable_onnx_normalization: bool + :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. + Must be a positive integer. + :paramtype evaluation_frequency: int + :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :paramtype gradient_accumulation_step: int + :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive + integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype layers_to_freeze: int + :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :paramtype learning_rate: float + :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. Possible values include: "None", "WarmupCosine", "Step". + :paramtype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.LearningRateScheduler + :keyword model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype model_name: str + :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, + 1]. + :paramtype momentum: float + :keyword nesterov: Enable nesterov when optimizer is 'sgd'. + :paramtype nesterov: bool + :keyword number_of_epochs: Number of training epochs. Must be a positive integer. + :paramtype number_of_epochs: int + :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. + :paramtype number_of_workers: int + :keyword optimizer: Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw". + :paramtype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer + :keyword random_seed: Random seed to be used when using deterministic training. + :paramtype random_seed: int + :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float + in the range [0, 1]. + :paramtype step_lr_gamma: float + :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be + a positive integer. + :paramtype step_lr_step_size: int + :keyword training_batch_size: Training batch size. Must be a positive integer. + :paramtype training_batch_size: int + :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :paramtype validation_batch_size: int + :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :paramtype warmup_cosine_lr_cycles: float + :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :paramtype warmup_cosine_lr_warmup_epochs: int + :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must + be a float in the range[0, 1]. + :paramtype weight_decay: float + """ + super(ImageModelSettings, self).__init__(**kwargs) + self.advanced_settings = kwargs.get('advanced_settings', None) + self.ams_gradient = kwargs.get('ams_gradient', None) + self.augmentations = kwargs.get('augmentations', None) + self.beta1 = kwargs.get('beta1', None) + self.beta2 = kwargs.get('beta2', None) + self.checkpoint_frequency = kwargs.get('checkpoint_frequency', None) + self.checkpoint_model = kwargs.get('checkpoint_model', None) + self.checkpoint_run_id = kwargs.get('checkpoint_run_id', None) + self.distributed = kwargs.get('distributed', None) + self.early_stopping = kwargs.get('early_stopping', None) + self.early_stopping_delay = kwargs.get('early_stopping_delay', None) + self.early_stopping_patience = kwargs.get('early_stopping_patience', None) + self.enable_onnx_normalization = kwargs.get('enable_onnx_normalization', None) + self.evaluation_frequency = kwargs.get('evaluation_frequency', None) + self.gradient_accumulation_step = kwargs.get('gradient_accumulation_step', None) + self.layers_to_freeze = kwargs.get('layers_to_freeze', None) + self.learning_rate = kwargs.get('learning_rate', None) + self.learning_rate_scheduler = kwargs.get('learning_rate_scheduler', None) + self.model_name = kwargs.get('model_name', None) + self.momentum = kwargs.get('momentum', None) + self.nesterov = kwargs.get('nesterov', None) + self.number_of_epochs = kwargs.get('number_of_epochs', None) + self.number_of_workers = kwargs.get('number_of_workers', None) + self.optimizer = kwargs.get('optimizer', None) + self.random_seed = kwargs.get('random_seed', None) + self.step_lr_gamma = kwargs.get('step_lr_gamma', None) + self.step_lr_step_size = kwargs.get('step_lr_step_size', None) + self.training_batch_size = kwargs.get('training_batch_size', None) + self.validation_batch_size = kwargs.get('validation_batch_size', None) + self.warmup_cosine_lr_cycles = kwargs.get('warmup_cosine_lr_cycles', None) + self.warmup_cosine_lr_warmup_epochs = kwargs.get('warmup_cosine_lr_warmup_epochs', None) + self.weight_decay = kwargs.get('weight_decay', None) + + +class ImageModelSettingsClassification(ImageModelSettings): + """Settings used for training the model. +For more information on the available settings please visit the official documentation: +https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + + :ivar advanced_settings: Settings for advanced scenarios. + :vartype advanced_settings: str + :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :vartype ams_gradient: bool + :ivar augmentations: Settings for using Augmentations. + :vartype augmentations: str + :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta1: float + :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta2: float + :ivar checkpoint_frequency: Frequency to store model checkpoints. Must be a positive integer. + :vartype checkpoint_frequency: int + :ivar checkpoint_model: The pretrained checkpoint model for incremental training. + :vartype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :ivar checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for + incremental training. + :vartype checkpoint_run_id: str + :ivar distributed: Whether to use distributed training. + :vartype distributed: bool + :ivar early_stopping: Enable early stopping logic during training. + :vartype early_stopping: bool + :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before + primary metric improvement + is tracked for early stopping. Must be a positive integer. + :vartype early_stopping_delay: int + :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :vartype early_stopping_patience: int + :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. + :vartype enable_onnx_normalization: bool + :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must + be a positive integer. + :vartype evaluation_frequency: int + :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :vartype gradient_accumulation_step: int + :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype layers_to_freeze: int + :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :vartype learning_rate: float + :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. Possible values include: "None", "WarmupCosine", "Step". + :vartype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.LearningRateScheduler + :ivar model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype model_name: str + :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + :vartype momentum: float + :ivar nesterov: Enable nesterov when optimizer is 'sgd'. + :vartype nesterov: bool + :ivar number_of_epochs: Number of training epochs. Must be a positive integer. + :vartype number_of_epochs: int + :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. + :vartype number_of_workers: int + :ivar optimizer: Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw". + :vartype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer + :ivar random_seed: Random seed to be used when using deterministic training. + :vartype random_seed: int + :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in + the range [0, 1]. + :vartype step_lr_gamma: float + :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a + positive integer. + :vartype step_lr_step_size: int + :ivar training_batch_size: Training batch size. Must be a positive integer. + :vartype training_batch_size: int + :ivar validation_batch_size: Validation batch size. Must be a positive integer. + :vartype validation_batch_size: int + :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :vartype warmup_cosine_lr_cycles: float + :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :vartype warmup_cosine_lr_warmup_epochs: int + :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be + a float in the range[0, 1]. + :vartype weight_decay: float + :ivar training_crop_size: Image crop size that is input to the neural network for the training + dataset. Must be a positive integer. + :vartype training_crop_size: int + :ivar validation_crop_size: Image crop size that is input to the neural network for the + validation dataset. Must be a positive integer. + :vartype validation_crop_size: int + :ivar validation_resize_size: Image size to which to resize before cropping for validation + dataset. Must be a positive integer. + :vartype validation_resize_size: int + :ivar weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. + 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be + 0 or 1 or 2. + :vartype weighted_loss: int + """ + + _attribute_map = { + 'advanced_settings': {'key': 'advancedSettings', 'type': 'str'}, + 'ams_gradient': {'key': 'amsGradient', 'type': 'bool'}, + 'augmentations': {'key': 'augmentations', 'type': 'str'}, + 'beta1': {'key': 'beta1', 'type': 'float'}, + 'beta2': {'key': 'beta2', 'type': 'float'}, + 'checkpoint_frequency': {'key': 'checkpointFrequency', 'type': 'int'}, + 'checkpoint_model': {'key': 'checkpointModel', 'type': 'MLFlowModelJobInput'}, + 'checkpoint_run_id': {'key': 'checkpointRunId', 'type': 'str'}, + 'distributed': {'key': 'distributed', 'type': 'bool'}, + 'early_stopping': {'key': 'earlyStopping', 'type': 'bool'}, + 'early_stopping_delay': {'key': 'earlyStoppingDelay', 'type': 'int'}, + 'early_stopping_patience': {'key': 'earlyStoppingPatience', 'type': 'int'}, + 'enable_onnx_normalization': {'key': 'enableOnnxNormalization', 'type': 'bool'}, + 'evaluation_frequency': {'key': 'evaluationFrequency', 'type': 'int'}, + 'gradient_accumulation_step': {'key': 'gradientAccumulationStep', 'type': 'int'}, + 'layers_to_freeze': {'key': 'layersToFreeze', 'type': 'int'}, + 'learning_rate': {'key': 'learningRate', 'type': 'float'}, + 'learning_rate_scheduler': {'key': 'learningRateScheduler', 'type': 'str'}, + 'model_name': {'key': 'modelName', 'type': 'str'}, + 'momentum': {'key': 'momentum', 'type': 'float'}, + 'nesterov': {'key': 'nesterov', 'type': 'bool'}, + 'number_of_epochs': {'key': 'numberOfEpochs', 'type': 'int'}, + 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, + 'optimizer': {'key': 'optimizer', 'type': 'str'}, + 'random_seed': {'key': 'randomSeed', 'type': 'int'}, + 'step_lr_gamma': {'key': 'stepLRGamma', 'type': 'float'}, + 'step_lr_step_size': {'key': 'stepLRStepSize', 'type': 'int'}, + 'training_batch_size': {'key': 'trainingBatchSize', 'type': 'int'}, + 'validation_batch_size': {'key': 'validationBatchSize', 'type': 'int'}, + 'warmup_cosine_lr_cycles': {'key': 'warmupCosineLRCycles', 'type': 'float'}, + 'warmup_cosine_lr_warmup_epochs': {'key': 'warmupCosineLRWarmupEpochs', 'type': 'int'}, + 'weight_decay': {'key': 'weightDecay', 'type': 'float'}, + 'training_crop_size': {'key': 'trainingCropSize', 'type': 'int'}, + 'validation_crop_size': {'key': 'validationCropSize', 'type': 'int'}, + 'validation_resize_size': {'key': 'validationResizeSize', 'type': 'int'}, + 'weighted_loss': {'key': 'weightedLoss', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword advanced_settings: Settings for advanced scenarios. + :paramtype advanced_settings: str + :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :paramtype ams_gradient: bool + :keyword augmentations: Settings for using Augmentations. + :paramtype augmentations: str + :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta1: float + :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta2: float + :keyword checkpoint_frequency: Frequency to store model checkpoints. Must be a positive + integer. + :paramtype checkpoint_frequency: int + :keyword checkpoint_model: The pretrained checkpoint model for incremental training. + :paramtype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :keyword checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for + incremental training. + :paramtype checkpoint_run_id: str + :keyword distributed: Whether to use distributed training. + :paramtype distributed: bool + :keyword early_stopping: Enable early stopping logic during training. + :paramtype early_stopping: bool + :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait + before primary metric improvement + is tracked for early stopping. Must be a positive integer. + :paramtype early_stopping_delay: int + :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :paramtype early_stopping_patience: int + :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. + :paramtype enable_onnx_normalization: bool + :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. + Must be a positive integer. + :paramtype evaluation_frequency: int + :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :paramtype gradient_accumulation_step: int + :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive + integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype layers_to_freeze: int + :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :paramtype learning_rate: float + :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. Possible values include: "None", "WarmupCosine", "Step". + :paramtype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.LearningRateScheduler + :keyword model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype model_name: str + :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, + 1]. + :paramtype momentum: float + :keyword nesterov: Enable nesterov when optimizer is 'sgd'. + :paramtype nesterov: bool + :keyword number_of_epochs: Number of training epochs. Must be a positive integer. + :paramtype number_of_epochs: int + :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. + :paramtype number_of_workers: int + :keyword optimizer: Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw". + :paramtype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer + :keyword random_seed: Random seed to be used when using deterministic training. + :paramtype random_seed: int + :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float + in the range [0, 1]. + :paramtype step_lr_gamma: float + :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be + a positive integer. + :paramtype step_lr_step_size: int + :keyword training_batch_size: Training batch size. Must be a positive integer. + :paramtype training_batch_size: int + :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :paramtype validation_batch_size: int + :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :paramtype warmup_cosine_lr_cycles: float + :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :paramtype warmup_cosine_lr_warmup_epochs: int + :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must + be a float in the range[0, 1]. + :paramtype weight_decay: float + :keyword training_crop_size: Image crop size that is input to the neural network for the + training dataset. Must be a positive integer. + :paramtype training_crop_size: int + :keyword validation_crop_size: Image crop size that is input to the neural network for the + validation dataset. Must be a positive integer. + :paramtype validation_crop_size: int + :keyword validation_resize_size: Image size to which to resize before cropping for validation + dataset. Must be a positive integer. + :paramtype validation_resize_size: int + :keyword weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. + 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be + 0 or 1 or 2. + :paramtype weighted_loss: int + """ + super(ImageModelSettingsClassification, self).__init__(**kwargs) + self.training_crop_size = kwargs.get('training_crop_size', None) + self.validation_crop_size = kwargs.get('validation_crop_size', None) + self.validation_resize_size = kwargs.get('validation_resize_size', None) + self.weighted_loss = kwargs.get('weighted_loss', None) + + +class ImageModelSettingsObjectDetection(ImageModelSettings): + """Settings used for training the model. +For more information on the available settings please visit the official documentation: +https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + + :ivar advanced_settings: Settings for advanced scenarios. + :vartype advanced_settings: str + :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :vartype ams_gradient: bool + :ivar augmentations: Settings for using Augmentations. + :vartype augmentations: str + :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta1: float + :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta2: float + :ivar checkpoint_frequency: Frequency to store model checkpoints. Must be a positive integer. + :vartype checkpoint_frequency: int + :ivar checkpoint_model: The pretrained checkpoint model for incremental training. + :vartype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :ivar checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for + incremental training. + :vartype checkpoint_run_id: str + :ivar distributed: Whether to use distributed training. + :vartype distributed: bool + :ivar early_stopping: Enable early stopping logic during training. + :vartype early_stopping: bool + :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before + primary metric improvement + is tracked for early stopping. Must be a positive integer. + :vartype early_stopping_delay: int + :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :vartype early_stopping_patience: int + :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. + :vartype enable_onnx_normalization: bool + :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must + be a positive integer. + :vartype evaluation_frequency: int + :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :vartype gradient_accumulation_step: int + :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype layers_to_freeze: int + :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :vartype learning_rate: float + :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. Possible values include: "None", "WarmupCosine", "Step". + :vartype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.LearningRateScheduler + :ivar model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype model_name: str + :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + :vartype momentum: float + :ivar nesterov: Enable nesterov when optimizer is 'sgd'. + :vartype nesterov: bool + :ivar number_of_epochs: Number of training epochs. Must be a positive integer. + :vartype number_of_epochs: int + :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. + :vartype number_of_workers: int + :ivar optimizer: Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw". + :vartype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer + :ivar random_seed: Random seed to be used when using deterministic training. + :vartype random_seed: int + :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in + the range [0, 1]. + :vartype step_lr_gamma: float + :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a + positive integer. + :vartype step_lr_step_size: int + :ivar training_batch_size: Training batch size. Must be a positive integer. + :vartype training_batch_size: int + :ivar validation_batch_size: Validation batch size. Must be a positive integer. + :vartype validation_batch_size: int + :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :vartype warmup_cosine_lr_cycles: float + :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :vartype warmup_cosine_lr_warmup_epochs: int + :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be + a float in the range[0, 1]. + :vartype weight_decay: float + :ivar box_detections_per_image: Maximum number of detections per image, for all classes. Must + be a positive integer. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype box_detections_per_image: int + :ivar box_score_threshold: During inference, only return proposals with a classification score + greater than + BoxScoreThreshold. Must be a float in the range[0, 1]. + :vartype box_score_threshold: float + :ivar image_size: Image size for train and validation. Must be a positive integer. + Note: The training run may get into CUDA OOM if the size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. + :vartype image_size: int + :ivar max_size: Maximum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype max_size: int + :ivar min_size: Minimum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype min_size: int + :ivar model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. + Note: training run may get into CUDA OOM if the model size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. Possible values include: + "None", "Small", "Medium", "Large", "ExtraLarge". + :vartype model_size: str or ~azure.mgmt.machinelearningservices.models.ModelSize + :ivar multi_scale: Enable multi-scale image by varying image size by +/- 50%. + Note: training run may get into CUDA OOM if no sufficient GPU memory. + Note: This settings is only supported for the 'yolov5' algorithm. + :vartype multi_scale: bool + :ivar nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be a + float in the range [0, 1]. + :vartype nms_iou_threshold: float + :ivar tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must not + be + None to enable small object detection logic. A string containing two integers in mxn format. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype tile_grid_size: str + :ivar tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be float + in the range [0, 1). + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype tile_overlap_ratio: float + :ivar tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging + predictions from tiles and image. + Used in validation/ inference. Must be float in the range [0, 1]. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype tile_predictions_nms_threshold: float + :ivar validation_iou_threshold: IOU threshold to use when computing validation metric. Must be + float in the range [0, 1]. + :vartype validation_iou_threshold: float + :ivar validation_metric_type: Metric computation method to use for validation metrics. Possible + values include: "None", "Coco", "Voc", "CocoVoc". + :vartype validation_metric_type: str or + ~azure.mgmt.machinelearningservices.models.ValidationMetricType + """ + + _attribute_map = { + 'advanced_settings': {'key': 'advancedSettings', 'type': 'str'}, + 'ams_gradient': {'key': 'amsGradient', 'type': 'bool'}, + 'augmentations': {'key': 'augmentations', 'type': 'str'}, + 'beta1': {'key': 'beta1', 'type': 'float'}, + 'beta2': {'key': 'beta2', 'type': 'float'}, + 'checkpoint_frequency': {'key': 'checkpointFrequency', 'type': 'int'}, + 'checkpoint_model': {'key': 'checkpointModel', 'type': 'MLFlowModelJobInput'}, + 'checkpoint_run_id': {'key': 'checkpointRunId', 'type': 'str'}, + 'distributed': {'key': 'distributed', 'type': 'bool'}, + 'early_stopping': {'key': 'earlyStopping', 'type': 'bool'}, + 'early_stopping_delay': {'key': 'earlyStoppingDelay', 'type': 'int'}, + 'early_stopping_patience': {'key': 'earlyStoppingPatience', 'type': 'int'}, + 'enable_onnx_normalization': {'key': 'enableOnnxNormalization', 'type': 'bool'}, + 'evaluation_frequency': {'key': 'evaluationFrequency', 'type': 'int'}, + 'gradient_accumulation_step': {'key': 'gradientAccumulationStep', 'type': 'int'}, + 'layers_to_freeze': {'key': 'layersToFreeze', 'type': 'int'}, + 'learning_rate': {'key': 'learningRate', 'type': 'float'}, + 'learning_rate_scheduler': {'key': 'learningRateScheduler', 'type': 'str'}, + 'model_name': {'key': 'modelName', 'type': 'str'}, + 'momentum': {'key': 'momentum', 'type': 'float'}, + 'nesterov': {'key': 'nesterov', 'type': 'bool'}, + 'number_of_epochs': {'key': 'numberOfEpochs', 'type': 'int'}, + 'number_of_workers': {'key': 'numberOfWorkers', 'type': 'int'}, + 'optimizer': {'key': 'optimizer', 'type': 'str'}, + 'random_seed': {'key': 'randomSeed', 'type': 'int'}, + 'step_lr_gamma': {'key': 'stepLRGamma', 'type': 'float'}, + 'step_lr_step_size': {'key': 'stepLRStepSize', 'type': 'int'}, + 'training_batch_size': {'key': 'trainingBatchSize', 'type': 'int'}, + 'validation_batch_size': {'key': 'validationBatchSize', 'type': 'int'}, + 'warmup_cosine_lr_cycles': {'key': 'warmupCosineLRCycles', 'type': 'float'}, + 'warmup_cosine_lr_warmup_epochs': {'key': 'warmupCosineLRWarmupEpochs', 'type': 'int'}, + 'weight_decay': {'key': 'weightDecay', 'type': 'float'}, + 'box_detections_per_image': {'key': 'boxDetectionsPerImage', 'type': 'int'}, + 'box_score_threshold': {'key': 'boxScoreThreshold', 'type': 'float'}, + 'image_size': {'key': 'imageSize', 'type': 'int'}, + 'max_size': {'key': 'maxSize', 'type': 'int'}, + 'min_size': {'key': 'minSize', 'type': 'int'}, + 'model_size': {'key': 'modelSize', 'type': 'str'}, + 'multi_scale': {'key': 'multiScale', 'type': 'bool'}, + 'nms_iou_threshold': {'key': 'nmsIouThreshold', 'type': 'float'}, + 'tile_grid_size': {'key': 'tileGridSize', 'type': 'str'}, + 'tile_overlap_ratio': {'key': 'tileOverlapRatio', 'type': 'float'}, + 'tile_predictions_nms_threshold': {'key': 'tilePredictionsNmsThreshold', 'type': 'float'}, + 'validation_iou_threshold': {'key': 'validationIouThreshold', 'type': 'float'}, + 'validation_metric_type': {'key': 'validationMetricType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword advanced_settings: Settings for advanced scenarios. + :paramtype advanced_settings: str + :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :paramtype ams_gradient: bool + :keyword augmentations: Settings for using Augmentations. + :paramtype augmentations: str + :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta1: float + :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta2: float + :keyword checkpoint_frequency: Frequency to store model checkpoints. Must be a positive + integer. + :paramtype checkpoint_frequency: int + :keyword checkpoint_model: The pretrained checkpoint model for incremental training. + :paramtype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :keyword checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for + incremental training. + :paramtype checkpoint_run_id: str + :keyword distributed: Whether to use distributed training. + :paramtype distributed: bool + :keyword early_stopping: Enable early stopping logic during training. + :paramtype early_stopping: bool + :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait + before primary metric improvement + is tracked for early stopping. Must be a positive integer. + :paramtype early_stopping_delay: int + :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :paramtype early_stopping_patience: int + :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. + :paramtype enable_onnx_normalization: bool + :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. + Must be a positive integer. + :paramtype evaluation_frequency: int + :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :paramtype gradient_accumulation_step: int + :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive + integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype layers_to_freeze: int + :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :paramtype learning_rate: float + :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. Possible values include: "None", "WarmupCosine", "Step". + :paramtype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.LearningRateScheduler + :keyword model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype model_name: str + :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, + 1]. + :paramtype momentum: float + :keyword nesterov: Enable nesterov when optimizer is 'sgd'. + :paramtype nesterov: bool + :keyword number_of_epochs: Number of training epochs. Must be a positive integer. + :paramtype number_of_epochs: int + :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. + :paramtype number_of_workers: int + :keyword optimizer: Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw". + :paramtype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer + :keyword random_seed: Random seed to be used when using deterministic training. + :paramtype random_seed: int + :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float + in the range [0, 1]. + :paramtype step_lr_gamma: float + :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be + a positive integer. + :paramtype step_lr_step_size: int + :keyword training_batch_size: Training batch size. Must be a positive integer. + :paramtype training_batch_size: int + :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :paramtype validation_batch_size: int + :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :paramtype warmup_cosine_lr_cycles: float + :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :paramtype warmup_cosine_lr_warmup_epochs: int + :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must + be a float in the range[0, 1]. + :paramtype weight_decay: float + :keyword box_detections_per_image: Maximum number of detections per image, for all classes. + Must be a positive integer. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype box_detections_per_image: int + :keyword box_score_threshold: During inference, only return proposals with a classification + score greater than + BoxScoreThreshold. Must be a float in the range[0, 1]. + :paramtype box_score_threshold: float + :keyword image_size: Image size for train and validation. Must be a positive integer. + Note: The training run may get into CUDA OOM if the size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. + :paramtype image_size: int + :keyword max_size: Maximum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype max_size: int + :keyword min_size: Minimum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype min_size: int + :keyword model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. + Note: training run may get into CUDA OOM if the model size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. Possible values include: + "None", "Small", "Medium", "Large", "ExtraLarge". + :paramtype model_size: str or ~azure.mgmt.machinelearningservices.models.ModelSize + :keyword multi_scale: Enable multi-scale image by varying image size by +/- 50%. + Note: training run may get into CUDA OOM if no sufficient GPU memory. + Note: This settings is only supported for the 'yolov5' algorithm. + :paramtype multi_scale: bool + :keyword nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be + a float in the range [0, 1]. + :paramtype nms_iou_threshold: float + :keyword tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must + not be + None to enable small object detection logic. A string containing two integers in mxn format. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype tile_grid_size: str + :keyword tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be + float in the range [0, 1). + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype tile_overlap_ratio: float + :keyword tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging + predictions from tiles and image. + Used in validation/ inference. Must be float in the range [0, 1]. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype tile_predictions_nms_threshold: float + :keyword validation_iou_threshold: IOU threshold to use when computing validation metric. Must + be float in the range [0, 1]. + :paramtype validation_iou_threshold: float + :keyword validation_metric_type: Metric computation method to use for validation metrics. + Possible values include: "None", "Coco", "Voc", "CocoVoc". + :paramtype validation_metric_type: str or + ~azure.mgmt.machinelearningservices.models.ValidationMetricType + """ + super(ImageModelSettingsObjectDetection, self).__init__(**kwargs) + self.box_detections_per_image = kwargs.get('box_detections_per_image', None) + self.box_score_threshold = kwargs.get('box_score_threshold', None) + self.image_size = kwargs.get('image_size', None) + self.max_size = kwargs.get('max_size', None) + self.min_size = kwargs.get('min_size', None) + self.model_size = kwargs.get('model_size', None) + self.multi_scale = kwargs.get('multi_scale', None) + self.nms_iou_threshold = kwargs.get('nms_iou_threshold', None) + self.tile_grid_size = kwargs.get('tile_grid_size', None) + self.tile_overlap_ratio = kwargs.get('tile_overlap_ratio', None) + self.tile_predictions_nms_threshold = kwargs.get('tile_predictions_nms_threshold', None) + self.validation_iou_threshold = kwargs.get('validation_iou_threshold', None) + self.validation_metric_type = kwargs.get('validation_metric_type', None) + + +class ImageObjectDetection(AutoMLVertical, ImageObjectDetectionBase): + """Image Object Detection. Object detection is used to identify objects in an image and locate each object with a +bounding box e.g. locate all dogs and cats in an image and draw a bounding box around each. + + All required parameters must be populated in order to send to Azure. + + :ivar limit_settings: Required. [Required] Limit settings for the AutoML job. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar model_settings: Settings used for training the model. + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + :ivar log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", + "Info", "Warning", "Error", "Critical". + :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :ivar target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :vartype target_column_name: str + :ivar task_type: Required. [Required] Task type for AutoMLJob.Constant filled by server. + Possible values include: "Classification", "Regression", "Forecasting", "ImageClassification", + "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", + "TextClassification", "TextClassificationMultilabel", "TextNER". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType + :ivar training_data: Required. [Required] Training data input. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar primary_metric: Primary metric to optimize for this task. Possible values include: + "MeanAveragePrecision". + :vartype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ObjectDetectionPrimaryMetrics + """ + + _validation = { + 'limit_settings': {'required': True}, + 'task_type': {'required': True}, + 'training_data': {'required': True}, + } + + _attribute_map = { + 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, + 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, + 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, + 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, + 'model_settings': {'key': 'modelSettings', 'type': 'ImageModelSettingsObjectDetection'}, + 'search_space': {'key': 'searchSpace', 'type': '[ImageModelDistributionSettingsObjectDetection]'}, + 'log_verbosity': {'key': 'logVerbosity', 'type': 'str'}, + 'target_column_name': {'key': 'targetColumnName', 'type': 'str'}, + 'task_type': {'key': 'taskType', 'type': 'str'}, + 'training_data': {'key': 'trainingData', 'type': 'MLTableJobInput'}, + 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword model_settings: Settings used for training the model. + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + :keyword log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", + "Info", "Warning", "Error", "Critical". + :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :keyword target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :paramtype target_column_name: str + :keyword training_data: Required. [Required] Training data input. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword primary_metric: Primary metric to optimize for this task. Possible values include: + "MeanAveragePrecision". + :paramtype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ObjectDetectionPrimaryMetrics + """ + super(ImageObjectDetection, self).__init__(**kwargs) + self.limit_settings = kwargs['limit_settings'] + self.sweep_settings = kwargs.get('sweep_settings', None) + self.validation_data = kwargs.get('validation_data', None) + self.validation_data_size = kwargs.get('validation_data_size', None) + self.model_settings = kwargs.get('model_settings', None) + self.search_space = kwargs.get('search_space', None) + self.task_type = 'ImageObjectDetection' # type: str + self.primary_metric = kwargs.get('primary_metric', None) + self.log_verbosity = kwargs.get('log_verbosity', None) + self.target_column_name = kwargs.get('target_column_name', None) + self.training_data = kwargs['training_data'] + + +class ImageSweepSettings(msrest.serialization.Model): + """Model sweeping and hyperparameter sweeping related settings. + + All required parameters must be populated in order to send to Azure. + + :ivar early_termination: Type of early termination policy. + :vartype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy + :ivar sampling_algorithm: Required. [Required] Type of the hyperparameter sampling algorithms. + Possible values include: "Grid", "Random", "Bayesian". + :vartype sampling_algorithm: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + """ + + _validation = { + 'sampling_algorithm': {'required': True}, + } + + _attribute_map = { + 'early_termination': {'key': 'earlyTermination', 'type': 'EarlyTerminationPolicy'}, + 'sampling_algorithm': {'key': 'samplingAlgorithm', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword early_termination: Type of early termination policy. + :paramtype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy + :keyword sampling_algorithm: Required. [Required] Type of the hyperparameter sampling + algorithms. Possible values include: "Grid", "Random", "Bayesian". + :paramtype sampling_algorithm: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + """ + super(ImageSweepSettings, self).__init__(**kwargs) + self.early_termination = kwargs.get('early_termination', None) + self.sampling_algorithm = kwargs['sampling_algorithm'] + + +class IndexColumn(msrest.serialization.Model): + """DTO object representing index column. + + :ivar column_name: Specifies the column name. + :vartype column_name: str + :ivar data_type: Specifies the data type. Possible values include: "String", "Integer", "Long", + "Float", "Double", "Binary", "Datetime", "Boolean". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType + """ + + _attribute_map = { + 'column_name': {'key': 'columnName', 'type': 'str'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword column_name: Specifies the column name. + :paramtype column_name: str + :keyword data_type: Specifies the data type. Possible values include: "String", "Integer", + "Long", "Float", "Double", "Binary", "Datetime", "Boolean". + :paramtype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType + """ + super(IndexColumn, self).__init__(**kwargs) + self.column_name = kwargs.get('column_name', None) + self.data_type = kwargs.get('data_type', None) + + +class InferenceContainerProperties(msrest.serialization.Model): + """InferenceContainerProperties. + + :ivar liveness_route: The route to check the liveness of the inference server container. + :vartype liveness_route: ~azure.mgmt.machinelearningservices.models.Route + :ivar readiness_route: The route to check the readiness of the inference server container. + :vartype readiness_route: ~azure.mgmt.machinelearningservices.models.Route + :ivar scoring_route: The port to send the scoring requests to, within the inference server + container. + :vartype scoring_route: ~azure.mgmt.machinelearningservices.models.Route + """ + + _attribute_map = { + 'liveness_route': {'key': 'livenessRoute', 'type': 'Route'}, + 'readiness_route': {'key': 'readinessRoute', 'type': 'Route'}, + 'scoring_route': {'key': 'scoringRoute', 'type': 'Route'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword liveness_route: The route to check the liveness of the inference server container. + :paramtype liveness_route: ~azure.mgmt.machinelearningservices.models.Route + :keyword readiness_route: The route to check the readiness of the inference server container. + :paramtype readiness_route: ~azure.mgmt.machinelearningservices.models.Route + :keyword scoring_route: The port to send the scoring requests to, within the inference server + container. + :paramtype scoring_route: ~azure.mgmt.machinelearningservices.models.Route + """ + super(InferenceContainerProperties, self).__init__(**kwargs) + self.liveness_route = kwargs.get('liveness_route', None) + self.readiness_route = kwargs.get('readiness_route', None) + self.scoring_route = kwargs.get('scoring_route', None) + + +class InstanceTypeSchema(msrest.serialization.Model): + """Instance type schema. + + :ivar node_selector: Node Selector. + :vartype node_selector: dict[str, str] + :ivar resources: Resource requests/limits for this instance type. + :vartype resources: ~azure.mgmt.machinelearningservices.models.InstanceTypeSchemaResources + """ + + _attribute_map = { + 'node_selector': {'key': 'nodeSelector', 'type': '{str}'}, + 'resources': {'key': 'resources', 'type': 'InstanceTypeSchemaResources'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword node_selector: Node Selector. + :paramtype node_selector: dict[str, str] + :keyword resources: Resource requests/limits for this instance type. + :paramtype resources: ~azure.mgmt.machinelearningservices.models.InstanceTypeSchemaResources + """ + super(InstanceTypeSchema, self).__init__(**kwargs) + self.node_selector = kwargs.get('node_selector', None) + self.resources = kwargs.get('resources', None) + + +class InstanceTypeSchemaResources(msrest.serialization.Model): + """Resource requests/limits for this instance type. + + :ivar requests: Resource requests for this instance type. + :vartype requests: dict[str, str] + :ivar limits: Resource limits for this instance type. + :vartype limits: dict[str, str] + """ + + _attribute_map = { + 'requests': {'key': 'requests', 'type': '{str}'}, + 'limits': {'key': 'limits', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword requests: Resource requests for this instance type. + :paramtype requests: dict[str, str] + :keyword limits: Resource limits for this instance type. + :paramtype limits: dict[str, str] + """ + super(InstanceTypeSchemaResources, self).__init__(**kwargs) + self.requests = kwargs.get('requests', None) + self.limits = kwargs.get('limits', None) + + +class JobBase(ProxyResource): + """Azure Resource Manager resource envelope. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'JobBaseProperties'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + """ + super(JobBase, self).__init__(**kwargs) + self.properties = kwargs['properties'] + + +class JobBaseResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of JobBase entities. + + :ivar next_link: The link to the next page of JobBase objects. If null, there are no additional + pages. + :vartype next_link: str + :ivar value: An array of objects of type JobBase. + :vartype value: list[~azure.mgmt.machinelearningservices.models.JobBase] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[JobBase]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword next_link: The link to the next page of JobBase objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type JobBase. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.JobBase] + """ + super(JobBaseResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class JobResourceConfiguration(ResourceConfiguration): + """JobResourceConfiguration. + + :ivar instance_count: Optional number of instances or nodes used by the compute target. + :vartype instance_count: int + :ivar instance_type: Optional type of VM used as supported by the compute target. + :vartype instance_type: str + :ivar properties: Additional properties bag. + :vartype properties: dict[str, any] + :ivar docker_args: Extra arguments to pass to the Docker run command. This would override any + parameters that have already been set by the system, or in this section. This parameter is only + supported for Azure ML compute types. + :vartype docker_args: str + :ivar shm_size: Size of the docker container's shared memory block. This should be in the + format of (number)(unit) where number as to be greater than 0 and the unit can be one of + b(bytes), k(kilobytes), m(megabytes), or g(gigabytes). + :vartype shm_size: str + """ + + _validation = { + 'shm_size': {'pattern': r'\d+[bBkKmMgG]'}, + } + + _attribute_map = { + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + 'instance_type': {'key': 'instanceType', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{object}'}, + 'docker_args': {'key': 'dockerArgs', 'type': 'str'}, + 'shm_size': {'key': 'shmSize', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword instance_count: Optional number of instances or nodes used by the compute target. + :paramtype instance_count: int + :keyword instance_type: Optional type of VM used as supported by the compute target. + :paramtype instance_type: str + :keyword properties: Additional properties bag. + :paramtype properties: dict[str, any] + :keyword docker_args: Extra arguments to pass to the Docker run command. This would override + any parameters that have already been set by the system, or in this section. This parameter is + only supported for Azure ML compute types. + :paramtype docker_args: str + :keyword shm_size: Size of the docker container's shared memory block. This should be in the + format of (number)(unit) where number as to be greater than 0 and the unit can be one of + b(bytes), k(kilobytes), m(megabytes), or g(gigabytes). + :paramtype shm_size: str + """ + super(JobResourceConfiguration, self).__init__(**kwargs) + self.docker_args = kwargs.get('docker_args', None) + self.shm_size = kwargs.get('shm_size', "2g") + + +class JobScheduleAction(ScheduleActionBase): + """JobScheduleAction. + + All required parameters must be populated in order to send to Azure. + + :ivar action_type: Required. [Required] Specifies the action type of the schedule.Constant + filled by server. Possible values include: "CreateJob", "InvokeBatchEndpoint", "CreateMonitor". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType + :ivar job_definition: Required. [Required] Defines Schedule action definition details. + :vartype job_definition: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + """ + + _validation = { + 'action_type': {'required': True}, + 'job_definition': {'required': True}, + } + + _attribute_map = { + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'job_definition': {'key': 'jobDefinition', 'type': 'JobBaseProperties'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword job_definition: Required. [Required] Defines Schedule action definition details. + :paramtype job_definition: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + """ + super(JobScheduleAction, self).__init__(**kwargs) + self.action_type = 'CreateJob' # type: str + self.job_definition = kwargs['job_definition'] + + +class JobService(msrest.serialization.Model): + """Job endpoint definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: Url for endpoint. + :vartype endpoint: str + :ivar error_message: Any error in the service. + :vartype error_message: str + :ivar job_service_type: Endpoint type. + :vartype job_service_type: str + :ivar nodes: Nodes that user would like to start the service on. + If Nodes is not set or set to null, the service will only be started on leader node. + :vartype nodes: ~azure.mgmt.machinelearningservices.models.Nodes + :ivar port: Port for endpoint. + :vartype port: int + :ivar properties: Additional properties to set on the endpoint. + :vartype properties: dict[str, str] + :ivar status: Status of endpoint. + :vartype status: str + """ + + _validation = { + 'error_message': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + 'job_service_type': {'key': 'jobServiceType', 'type': 'str'}, + 'nodes': {'key': 'nodes', 'type': 'Nodes'}, + 'port': {'key': 'port', 'type': 'int'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword endpoint: Url for endpoint. + :paramtype endpoint: str + :keyword job_service_type: Endpoint type. + :paramtype job_service_type: str + :keyword nodes: Nodes that user would like to start the service on. + If Nodes is not set or set to null, the service will only be started on leader node. + :paramtype nodes: ~azure.mgmt.machinelearningservices.models.Nodes + :keyword port: Port for endpoint. + :paramtype port: int + :keyword properties: Additional properties to set on the endpoint. + :paramtype properties: dict[str, str] + """ + super(JobService, self).__init__(**kwargs) + self.endpoint = kwargs.get('endpoint', None) + self.error_message = None + self.job_service_type = kwargs.get('job_service_type', None) + self.nodes = kwargs.get('nodes', None) + self.port = kwargs.get('port', None) + self.properties = kwargs.get('properties', None) + self.status = None + + +class JupyterKernelConfig(msrest.serialization.Model): + """Jupyter kernel configuration. + + :ivar argv: Argument to the the runtime. + :vartype argv: list[str] + :ivar display_name: Display name of the kernel. + :vartype display_name: str + :ivar language: Language of the kernel [Example value: python]. + :vartype language: str + """ + + _attribute_map = { + 'argv': {'key': 'argv', 'type': '[str]'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword argv: Argument to the the runtime. + :paramtype argv: list[str] + :keyword display_name: Display name of the kernel. + :paramtype display_name: str + :keyword language: Language of the kernel [Example value: python]. + :paramtype language: str + """ + super(JupyterKernelConfig, self).__init__(**kwargs) + self.argv = kwargs.get('argv', None) + self.display_name = kwargs.get('display_name', None) + self.language = kwargs.get('language', None) + + +class KeyVaultProperties(msrest.serialization.Model): + """Customer Key vault properties. + + All required parameters must be populated in order to send to Azure. + + :ivar identity_client_id: Currently, we support only SystemAssigned MSI. + We need this when we support UserAssignedIdentities. + :vartype identity_client_id: str + :ivar key_identifier: Required. KeyVault key identifier to encrypt the data. + :vartype key_identifier: str + :ivar key_vault_arm_id: Required. KeyVault Arm Id that contains the data encryption key. + :vartype key_vault_arm_id: str + """ + + _validation = { + 'key_identifier': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'key_vault_arm_id': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'identity_client_id': {'key': 'identityClientId', 'type': 'str'}, + 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, + 'key_vault_arm_id': {'key': 'keyVaultArmId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword identity_client_id: Currently, we support only SystemAssigned MSI. + We need this when we support UserAssignedIdentities. + :paramtype identity_client_id: str + :keyword key_identifier: Required. KeyVault key identifier to encrypt the data. + :paramtype key_identifier: str + :keyword key_vault_arm_id: Required. KeyVault Arm Id that contains the data encryption key. + :paramtype key_vault_arm_id: str + """ + super(KeyVaultProperties, self).__init__(**kwargs) + self.identity_client_id = kwargs.get('identity_client_id', None) + self.key_identifier = kwargs['key_identifier'] + self.key_vault_arm_id = kwargs['key_vault_arm_id'] + + +class KubernetesSchema(msrest.serialization.Model): + """Kubernetes Compute Schema. + + :ivar properties: Properties of Kubernetes. + :vartype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'KubernetesProperties'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: Properties of Kubernetes. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + """ + super(KubernetesSchema, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class Kubernetes(Compute, KubernetesSchema): + """A Machine Learning compute based on Kubernetes Compute. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar properties: Properties of Kubernetes. + :vartype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + :ivar compute_type: Required. The type of compute.Constant filled by server. Possible values + include: "AKS", "Kubernetes", "AmlCompute", "ComputeInstance", "DataFactory", "VirtualMachine", + "HDInsight", "Databricks", "DataLakeAnalytics", "SynapseSpark". + :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.ComputeType + :ivar compute_location: Location for the underlying compute. + :vartype compute_location: str + :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, + Updating, Provisioning, Succeeded, and Failed. Possible values include: "Unknown", "Updating", + "Creating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.ProvisioningState + :ivar description: The description of the Machine Learning compute. + :vartype description: str + :ivar created_on: The time at which the compute was created. + :vartype created_on: ~datetime.datetime + :ivar modified_on: The time at which the compute was last modified. + :vartype modified_on: ~datetime.datetime + :ivar resource_id: ARM resource id of the underlying compute. + :vartype resource_id: str + :ivar provisioning_errors: Errors during provisioning. + :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought + from outside if true, or machine learning service provisioned it if false. + :vartype is_attached_compute: bool + :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI + and AAD exclusively for authentication. + :vartype disable_local_auth: bool + """ + + _validation = { + 'compute_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'created_on': {'readonly': True}, + 'modified_on': {'readonly': True}, + 'provisioning_errors': {'readonly': True}, + 'is_attached_compute': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'KubernetesProperties'}, + 'compute_type': {'key': 'computeType', 'type': 'str'}, + 'compute_location': {'key': 'computeLocation', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'created_on': {'key': 'createdOn', 'type': 'iso-8601'}, + 'modified_on': {'key': 'modifiedOn', 'type': 'iso-8601'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'provisioning_errors': {'key': 'provisioningErrors', 'type': '[ErrorResponse]'}, + 'is_attached_compute': {'key': 'isAttachedCompute', 'type': 'bool'}, + 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: Properties of Kubernetes. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + :keyword compute_location: Location for the underlying compute. + :paramtype compute_location: str + :keyword description: The description of the Machine Learning compute. + :paramtype description: str + :keyword resource_id: ARM resource id of the underlying compute. + :paramtype resource_id: str + :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only + MSI and AAD exclusively for authentication. + :paramtype disable_local_auth: bool + """ + super(Kubernetes, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.compute_type = 'Kubernetes' # type: str + self.compute_location = kwargs.get('compute_location', None) + self.provisioning_state = None + self.description = kwargs.get('description', None) + self.created_on = None + self.modified_on = None + self.resource_id = kwargs.get('resource_id', None) + self.provisioning_errors = None + self.is_attached_compute = None + self.disable_local_auth = kwargs.get('disable_local_auth', None) + + +class OnlineDeploymentProperties(EndpointDeploymentPropertiesBase): + """OnlineDeploymentProperties. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: KubernetesOnlineDeployment, ManagedOnlineDeployment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar code_configuration: Code configuration for the endpoint deployment. + :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + :ivar description: Description of the endpoint deployment. + :vartype description: str + :ivar environment_id: ARM resource ID or AssetId of the environment specification for the + endpoint deployment. + :vartype environment_id: str + :ivar environment_variables: Environment variables configuration for the deployment. + :vartype environment_variables: dict[str, str] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar app_insights_enabled: If true, enables Application Insights logging. + :vartype app_insights_enabled: bool + :ivar data_collector: The mdc configuration, we disable mdc when it's null. + :vartype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :ivar egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", + "Disabled". + :vartype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :ivar endpoint_compute_type: Required. [Required] The compute type of the endpoint.Constant + filled by server. Possible values include: "Managed", "Kubernetes", "AzureMLCompute". + :vartype endpoint_compute_type: str or + ~azure.mgmt.machinelearningservices.models.EndpointComputeType + :ivar instance_type: Compute instance type. + :vartype instance_type: str + :ivar liveness_probe: Liveness probe monitors the health of the container regularly. + :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar model: The URI path to the model. + :vartype model: str + :ivar model_mount_path: The path to mount the model in custom container. + :vartype model_mount_path: str + :ivar provisioning_state: Provisioning state for the endpoint deployment. Possible values + include: "Creating", "Deleting", "Scaling", "Updating", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DeploymentProvisioningState + :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar request_settings: Request settings for the deployment. + :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :ivar scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + """ + + _validation = { + 'endpoint_compute_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'code_configuration': {'key': 'codeConfiguration', 'type': 'CodeConfiguration'}, + 'description': {'key': 'description', 'type': 'str'}, + 'environment_id': {'key': 'environmentId', 'type': 'str'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'app_insights_enabled': {'key': 'appInsightsEnabled', 'type': 'bool'}, + 'data_collector': {'key': 'dataCollector', 'type': 'DataCollector'}, + 'egress_public_network_access': {'key': 'egressPublicNetworkAccess', 'type': 'str'}, + 'endpoint_compute_type': {'key': 'endpointComputeType', 'type': 'str'}, + 'instance_type': {'key': 'instanceType', 'type': 'str'}, + 'liveness_probe': {'key': 'livenessProbe', 'type': 'ProbeSettings'}, + 'model': {'key': 'model', 'type': 'str'}, + 'model_mount_path': {'key': 'modelMountPath', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'readiness_probe': {'key': 'readinessProbe', 'type': 'ProbeSettings'}, + 'request_settings': {'key': 'requestSettings', 'type': 'OnlineRequestSettings'}, + 'scale_settings': {'key': 'scaleSettings', 'type': 'OnlineScaleSettings'}, + } + + _subtype_map = { + 'endpoint_compute_type': {'Kubernetes': 'KubernetesOnlineDeployment', 'Managed': 'ManagedOnlineDeployment'} + } + + def __init__( + self, + **kwargs + ): + """ + :keyword code_configuration: Code configuration for the endpoint deployment. + :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + :keyword description: Description of the endpoint deployment. + :paramtype description: str + :keyword environment_id: ARM resource ID or AssetId of the environment specification for the + endpoint deployment. + :paramtype environment_id: str + :keyword environment_variables: Environment variables configuration for the deployment. + :paramtype environment_variables: dict[str, str] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword app_insights_enabled: If true, enables Application Insights logging. + :paramtype app_insights_enabled: bool + :keyword data_collector: The mdc configuration, we disable mdc when it's null. + :paramtype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :keyword egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", + "Disabled". + :paramtype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :keyword instance_type: Compute instance type. + :paramtype instance_type: str + :keyword liveness_probe: Liveness probe monitors the health of the container regularly. + :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword model: The URI path to the model. + :paramtype model: str + :keyword model_mount_path: The path to mount the model in custom container. + :paramtype model_mount_path: str + :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword request_settings: Request settings for the deployment. + :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :keyword scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + """ + super(OnlineDeploymentProperties, self).__init__(**kwargs) + self.app_insights_enabled = kwargs.get('app_insights_enabled', False) + self.data_collector = kwargs.get('data_collector', None) + self.egress_public_network_access = kwargs.get('egress_public_network_access', None) + self.endpoint_compute_type = 'OnlineDeploymentProperties' # type: str + self.instance_type = kwargs.get('instance_type', None) + self.liveness_probe = kwargs.get('liveness_probe', None) + self.model = kwargs.get('model', None) + self.model_mount_path = kwargs.get('model_mount_path', None) + self.provisioning_state = None + self.readiness_probe = kwargs.get('readiness_probe', None) + self.request_settings = kwargs.get('request_settings', None) + self.scale_settings = kwargs.get('scale_settings', None) + + +class KubernetesOnlineDeployment(OnlineDeploymentProperties): + """Properties specific to a KubernetesOnlineDeployment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar code_configuration: Code configuration for the endpoint deployment. + :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + :ivar description: Description of the endpoint deployment. + :vartype description: str + :ivar environment_id: ARM resource ID or AssetId of the environment specification for the + endpoint deployment. + :vartype environment_id: str + :ivar environment_variables: Environment variables configuration for the deployment. + :vartype environment_variables: dict[str, str] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar app_insights_enabled: If true, enables Application Insights logging. + :vartype app_insights_enabled: bool + :ivar data_collector: The mdc configuration, we disable mdc when it's null. + :vartype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :ivar egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", + "Disabled". + :vartype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :ivar endpoint_compute_type: Required. [Required] The compute type of the endpoint.Constant + filled by server. Possible values include: "Managed", "Kubernetes", "AzureMLCompute". + :vartype endpoint_compute_type: str or + ~azure.mgmt.machinelearningservices.models.EndpointComputeType + :ivar instance_type: Compute instance type. + :vartype instance_type: str + :ivar liveness_probe: Liveness probe monitors the health of the container regularly. + :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar model: The URI path to the model. + :vartype model: str + :ivar model_mount_path: The path to mount the model in custom container. + :vartype model_mount_path: str + :ivar provisioning_state: Provisioning state for the endpoint deployment. Possible values + include: "Creating", "Deleting", "Scaling", "Updating", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DeploymentProvisioningState + :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar request_settings: Request settings for the deployment. + :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :ivar scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + :ivar container_resource_requirements: The resource requirements for the container (cpu and + memory). + :vartype container_resource_requirements: + ~azure.mgmt.machinelearningservices.models.ContainerResourceRequirements """ _validation = { - 'limit_settings': {'required': True}, - 'task_type': {'required': True}, - 'training_data': {'required': True}, + 'endpoint_compute_type': {'required': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'limit_settings': {'key': 'limitSettings', 'type': 'ImageLimitSettings'}, - 'sweep_settings': {'key': 'sweepSettings', 'type': 'ImageSweepSettings'}, - 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, - 'validation_data_size': {'key': 'validationDataSize', 'type': 'float'}, - 'model_settings': {'key': 'modelSettings', 'type': 'ImageModelSettingsObjectDetection'}, - 'search_space': {'key': 'searchSpace', 'type': '[ImageModelDistributionSettingsObjectDetection]'}, - 'log_verbosity': {'key': 'logVerbosity', 'type': 'str'}, - 'target_column_name': {'key': 'targetColumnName', 'type': 'str'}, - 'task_type': {'key': 'taskType', 'type': 'str'}, - 'training_data': {'key': 'trainingData', 'type': 'MLTableJobInput'}, - 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + 'code_configuration': {'key': 'codeConfiguration', 'type': 'CodeConfiguration'}, + 'description': {'key': 'description', 'type': 'str'}, + 'environment_id': {'key': 'environmentId', 'type': 'str'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'app_insights_enabled': {'key': 'appInsightsEnabled', 'type': 'bool'}, + 'data_collector': {'key': 'dataCollector', 'type': 'DataCollector'}, + 'egress_public_network_access': {'key': 'egressPublicNetworkAccess', 'type': 'str'}, + 'endpoint_compute_type': {'key': 'endpointComputeType', 'type': 'str'}, + 'instance_type': {'key': 'instanceType', 'type': 'str'}, + 'liveness_probe': {'key': 'livenessProbe', 'type': 'ProbeSettings'}, + 'model': {'key': 'model', 'type': 'str'}, + 'model_mount_path': {'key': 'modelMountPath', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'readiness_probe': {'key': 'readinessProbe', 'type': 'ProbeSettings'}, + 'request_settings': {'key': 'requestSettings', 'type': 'OnlineRequestSettings'}, + 'scale_settings': {'key': 'scaleSettings', 'type': 'OnlineScaleSettings'}, + 'container_resource_requirements': {'key': 'containerResourceRequirements', 'type': 'ContainerResourceRequirements'}, } def __init__( @@ -15777,71 +17887,85 @@ def __init__( **kwargs ): """ - :keyword limit_settings: Required. [Required] Limit settings for the AutoML job. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword model_settings: Settings used for training the model. - :paramtype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection - :keyword search_space: Search space for sampling different combinations of models and their - hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] - :keyword log_verbosity: Log verbosity for the job. Possible values include: "NotSet", "Debug", - "Info", "Warning", "Error", "Critical". - :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :keyword target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :paramtype target_column_name: str - :keyword training_data: Required. [Required] Training data input. - :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword primary_metric: Primary metric to optimize for this task. Possible values include: - "MeanAveragePrecision". - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ObjectDetectionPrimaryMetrics + :keyword code_configuration: Code configuration for the endpoint deployment. + :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + :keyword description: Description of the endpoint deployment. + :paramtype description: str + :keyword environment_id: ARM resource ID or AssetId of the environment specification for the + endpoint deployment. + :paramtype environment_id: str + :keyword environment_variables: Environment variables configuration for the deployment. + :paramtype environment_variables: dict[str, str] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword app_insights_enabled: If true, enables Application Insights logging. + :paramtype app_insights_enabled: bool + :keyword data_collector: The mdc configuration, we disable mdc when it's null. + :paramtype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :keyword egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", + "Disabled". + :paramtype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :keyword instance_type: Compute instance type. + :paramtype instance_type: str + :keyword liveness_probe: Liveness probe monitors the health of the container regularly. + :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword model: The URI path to the model. + :paramtype model: str + :keyword model_mount_path: The path to mount the model in custom container. + :paramtype model_mount_path: str + :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword request_settings: Request settings for the deployment. + :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :keyword scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + :keyword container_resource_requirements: The resource requirements for the container (cpu and + memory). + :paramtype container_resource_requirements: + ~azure.mgmt.machinelearningservices.models.ContainerResourceRequirements """ - super(ImageObjectDetection, self).__init__(**kwargs) - self.limit_settings = kwargs['limit_settings'] - self.sweep_settings = kwargs.get('sweep_settings', None) - self.validation_data = kwargs.get('validation_data', None) - self.validation_data_size = kwargs.get('validation_data_size', None) - self.model_settings = kwargs.get('model_settings', None) - self.search_space = kwargs.get('search_space', None) - self.task_type = 'ImageObjectDetection' # type: str - self.primary_metric = kwargs.get('primary_metric', None) - self.log_verbosity = kwargs.get('log_verbosity', None) - self.target_column_name = kwargs.get('target_column_name', None) - self.training_data = kwargs['training_data'] - + super(KubernetesOnlineDeployment, self).__init__(**kwargs) + self.endpoint_compute_type = 'Kubernetes' # type: str + self.container_resource_requirements = kwargs.get('container_resource_requirements', None) -class ImageSweepSettings(msrest.serialization.Model): - """Model sweeping and hyperparameter sweeping related settings. - All required parameters must be populated in order to send to Azure. +class KubernetesProperties(msrest.serialization.Model): + """Kubernetes properties. - :ivar early_termination: Type of early termination policy. - :vartype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy - :ivar sampling_algorithm: Required. [Required] Type of the hyperparameter sampling algorithms. - Possible values include: "Grid", "Random", "Bayesian". - :vartype sampling_algorithm: str or - ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + :ivar relay_connection_string: Relay connection string. + :vartype relay_connection_string: str + :ivar service_bus_connection_string: ServiceBus connection string. + :vartype service_bus_connection_string: str + :ivar extension_principal_id: Extension principal-id. + :vartype extension_principal_id: str + :ivar extension_instance_release_train: Extension instance release train. + :vartype extension_instance_release_train: str + :ivar vc_name: VC name. + :vartype vc_name: str + :ivar namespace: Compute namespace. + :vartype namespace: str + :ivar default_instance_type: Default instance type. + :vartype default_instance_type: str + :ivar instance_types: Instance Type Schema. + :vartype instance_types: dict[str, + ~azure.mgmt.machinelearningservices.models.InstanceTypeSchema] """ - _validation = { - 'sampling_algorithm': {'required': True}, - } - _attribute_map = { - 'early_termination': {'key': 'earlyTermination', 'type': 'EarlyTerminationPolicy'}, - 'sampling_algorithm': {'key': 'samplingAlgorithm', 'type': 'str'}, + 'relay_connection_string': {'key': 'relayConnectionString', 'type': 'str'}, + 'service_bus_connection_string': {'key': 'serviceBusConnectionString', 'type': 'str'}, + 'extension_principal_id': {'key': 'extensionPrincipalId', 'type': 'str'}, + 'extension_instance_release_train': {'key': 'extensionInstanceReleaseTrain', 'type': 'str'}, + 'vc_name': {'key': 'vcName', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'default_instance_type': {'key': 'defaultInstanceType', 'type': 'str'}, + 'instance_types': {'key': 'instanceTypes', 'type': '{InstanceTypeSchema}'}, } def __init__( @@ -15849,31 +17973,62 @@ def __init__( **kwargs ): """ - :keyword early_termination: Type of early termination policy. - :paramtype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy - :keyword sampling_algorithm: Required. [Required] Type of the hyperparameter sampling - algorithms. Possible values include: "Grid", "Random", "Bayesian". - :paramtype sampling_algorithm: str or - ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + :keyword relay_connection_string: Relay connection string. + :paramtype relay_connection_string: str + :keyword service_bus_connection_string: ServiceBus connection string. + :paramtype service_bus_connection_string: str + :keyword extension_principal_id: Extension principal-id. + :paramtype extension_principal_id: str + :keyword extension_instance_release_train: Extension instance release train. + :paramtype extension_instance_release_train: str + :keyword vc_name: VC name. + :paramtype vc_name: str + :keyword namespace: Compute namespace. + :paramtype namespace: str + :keyword default_instance_type: Default instance type. + :paramtype default_instance_type: str + :keyword instance_types: Instance Type Schema. + :paramtype instance_types: dict[str, + ~azure.mgmt.machinelearningservices.models.InstanceTypeSchema] """ - super(ImageSweepSettings, self).__init__(**kwargs) - self.early_termination = kwargs.get('early_termination', None) - self.sampling_algorithm = kwargs['sampling_algorithm'] + super(KubernetesProperties, self).__init__(**kwargs) + self.relay_connection_string = kwargs.get('relay_connection_string', None) + self.service_bus_connection_string = kwargs.get('service_bus_connection_string', None) + self.extension_principal_id = kwargs.get('extension_principal_id', None) + self.extension_instance_release_train = kwargs.get('extension_instance_release_train', None) + self.vc_name = kwargs.get('vc_name', None) + self.namespace = kwargs.get('namespace', "default") + self.default_instance_type = kwargs.get('default_instance_type', None) + self.instance_types = kwargs.get('instance_types', None) -class IndexColumn(msrest.serialization.Model): - """DTO object representing index column. +class OneLakeArtifact(msrest.serialization.Model): + """OneLake artifact (data source) configuration. - :ivar column_name: Specifies the column name. - :vartype column_name: str - :ivar data_type: Specifies the data type. Possible values include: "String", "Integer", "Long", - "Float", "Double", "Binary", "Datetime", "Boolean". - :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: LakeHouseArtifact. + + All required parameters must be populated in order to send to Azure. + + :ivar artifact_name: Required. [Required] OneLake artifact name. + :vartype artifact_name: str + :ivar artifact_type: Required. [Required] OneLake artifact type.Constant filled by server. + Possible values include: "LakeHouse". + :vartype artifact_type: str or ~azure.mgmt.machinelearningservices.models.OneLakeArtifactType """ + _validation = { + 'artifact_name': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'artifact_type': {'required': True}, + } + _attribute_map = { - 'column_name': {'key': 'columnName', 'type': 'str'}, - 'data_type': {'key': 'dataType', 'type': 'str'}, + 'artifact_name': {'key': 'artifactName', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + } + + _subtype_map = { + 'artifact_type': {'LakeHouse': 'LakeHouseArtifact'} } def __init__( @@ -15881,33 +18036,34 @@ def __init__( **kwargs ): """ - :keyword column_name: Specifies the column name. - :paramtype column_name: str - :keyword data_type: Specifies the data type. Possible values include: "String", "Integer", - "Long", "Float", "Double", "Binary", "Datetime", "Boolean". - :paramtype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType + :keyword artifact_name: Required. [Required] OneLake artifact name. + :paramtype artifact_name: str """ - super(IndexColumn, self).__init__(**kwargs) - self.column_name = kwargs.get('column_name', None) - self.data_type = kwargs.get('data_type', None) + super(OneLakeArtifact, self).__init__(**kwargs) + self.artifact_name = kwargs['artifact_name'] + self.artifact_type = None # type: Optional[str] -class InferenceContainerProperties(msrest.serialization.Model): - """InferenceContainerProperties. +class LakeHouseArtifact(OneLakeArtifact): + """LakeHouseArtifact. - :ivar liveness_route: The route to check the liveness of the inference server container. - :vartype liveness_route: ~azure.mgmt.machinelearningservices.models.Route - :ivar readiness_route: The route to check the readiness of the inference server container. - :vartype readiness_route: ~azure.mgmt.machinelearningservices.models.Route - :ivar scoring_route: The port to send the scoring requests to, within the inference server - container. - :vartype scoring_route: ~azure.mgmt.machinelearningservices.models.Route + All required parameters must be populated in order to send to Azure. + + :ivar artifact_name: Required. [Required] OneLake artifact name. + :vartype artifact_name: str + :ivar artifact_type: Required. [Required] OneLake artifact type.Constant filled by server. + Possible values include: "LakeHouse". + :vartype artifact_type: str or ~azure.mgmt.machinelearningservices.models.OneLakeArtifactType """ + _validation = { + 'artifact_name': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'artifact_type': {'required': True}, + } + _attribute_map = { - 'liveness_route': {'key': 'livenessRoute', 'type': 'Route'}, - 'readiness_route': {'key': 'readinessRoute', 'type': 'Route'}, - 'scoring_route': {'key': 'scoringRoute', 'type': 'Route'}, + 'artifact_name': {'key': 'artifactName', 'type': 'str'}, + 'artifact_type': {'key': 'artifactType', 'type': 'str'}, } def __init__( @@ -15915,32 +18071,33 @@ def __init__( **kwargs ): """ - :keyword liveness_route: The route to check the liveness of the inference server container. - :paramtype liveness_route: ~azure.mgmt.machinelearningservices.models.Route - :keyword readiness_route: The route to check the readiness of the inference server container. - :paramtype readiness_route: ~azure.mgmt.machinelearningservices.models.Route - :keyword scoring_route: The port to send the scoring requests to, within the inference server - container. - :paramtype scoring_route: ~azure.mgmt.machinelearningservices.models.Route + :keyword artifact_name: Required. [Required] OneLake artifact name. + :paramtype artifact_name: str """ - super(InferenceContainerProperties, self).__init__(**kwargs) - self.liveness_route = kwargs.get('liveness_route', None) - self.readiness_route = kwargs.get('readiness_route', None) - self.scoring_route = kwargs.get('scoring_route', None) + super(LakeHouseArtifact, self).__init__(**kwargs) + self.artifact_type = 'LakeHouse' # type: str -class InstanceTypeSchema(msrest.serialization.Model): - """Instance type schema. +class ListAmlUserFeatureResult(msrest.serialization.Model): + """The List Aml user feature operation response. - :ivar node_selector: Node Selector. - :vartype node_selector: dict[str, str] - :ivar resources: Resource requests/limits for this instance type. - :vartype resources: ~azure.mgmt.machinelearningservices.models.InstanceTypeSchemaResources + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of AML user facing features. + :vartype value: list[~azure.mgmt.machinelearningservices.models.AmlUserFeature] + :ivar next_link: The URI to fetch the next page of AML user features information. Call + ListNext() with this to fetch the next page of AML user features information. + :vartype next_link: str """ + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + _attribute_map = { - 'node_selector': {'key': 'nodeSelector', 'type': '{str}'}, - 'resources': {'key': 'resources', 'type': 'InstanceTypeSchemaResources'}, + 'value': {'key': 'value', 'type': '[AmlUserFeature]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( @@ -15948,28 +18105,31 @@ def __init__( **kwargs ): """ - :keyword node_selector: Node Selector. - :paramtype node_selector: dict[str, str] - :keyword resources: Resource requests/limits for this instance type. - :paramtype resources: ~azure.mgmt.machinelearningservices.models.InstanceTypeSchemaResources """ - super(InstanceTypeSchema, self).__init__(**kwargs) - self.node_selector = kwargs.get('node_selector', None) - self.resources = kwargs.get('resources', None) + super(ListAmlUserFeatureResult, self).__init__(**kwargs) + self.value = None + self.next_link = None -class InstanceTypeSchemaResources(msrest.serialization.Model): - """Resource requests/limits for this instance type. +class ListNotebookKeysResult(msrest.serialization.Model): + """ListNotebookKeysResult. - :ivar requests: Resource requests for this instance type. - :vartype requests: dict[str, str] - :ivar limits: Resource limits for this instance type. - :vartype limits: dict[str, str] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_access_key: The primary access key of the Notebook. + :vartype primary_access_key: str + :ivar secondary_access_key: The secondary access key of the Notebook. + :vartype secondary_access_key: str """ + _validation = { + 'primary_access_key': {'readonly': True}, + 'secondary_access_key': {'readonly': True}, + } + _attribute_map = { - 'requests': {'key': 'requests', 'type': '{str}'}, - 'limits': {'key': 'limits', 'type': '{str}'}, + 'primary_access_key': {'key': 'primaryAccessKey', 'type': 'str'}, + 'secondary_access_key': {'key': 'secondaryAccessKey', 'type': 'str'}, } def __init__( @@ -15977,52 +18137,27 @@ def __init__( **kwargs ): """ - :keyword requests: Resource requests for this instance type. - :paramtype requests: dict[str, str] - :keyword limits: Resource limits for this instance type. - :paramtype limits: dict[str, str] """ - super(InstanceTypeSchemaResources, self).__init__(**kwargs) - self.requests = kwargs.get('requests', None) - self.limits = kwargs.get('limits', None) + super(ListNotebookKeysResult, self).__init__(**kwargs) + self.primary_access_key = None + self.secondary_access_key = None -class JobBase(ProxyResource): - """Azure Resource Manager resource envelope. +class ListStorageAccountKeysResult(msrest.serialization.Model): + """ListStorageAccountKeysResult. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + :ivar user_storage_key: The access key of the storage. + :vartype user_storage_key: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, + 'user_storage_key': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'JobBaseProperties'}, + 'user_storage_key': {'key': 'userStorageKey', 'type': 'str'}, } def __init__( @@ -16030,26 +18165,31 @@ def __init__( **kwargs ): """ - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.JobBaseProperties """ - super(JobBase, self).__init__(**kwargs) - self.properties = kwargs['properties'] + super(ListStorageAccountKeysResult, self).__init__(**kwargs) + self.user_storage_key = None -class JobBaseResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of JobBase entities. +class ListUsagesResult(msrest.serialization.Model): + """The List Usages operation response. - :ivar next_link: The link to the next page of JobBase objects. If null, there are no additional - pages. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of AML resource usages. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Usage] + :ivar next_link: The URI to fetch the next page of AML resource usage information. Call + ListNext() with this to fetch the next page of AML resource usage information. :vartype next_link: str - :ivar value: An array of objects of type JobBase. - :vartype value: list[~azure.mgmt.machinelearningservices.models.JobBase] """ + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + _attribute_map = { + 'value': {'key': 'value', 'type': '[Usage]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[JobBase]'}, } def __init__( @@ -16057,46 +18197,43 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of JobBase objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type JobBase. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.JobBase] """ - super(JobBaseResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) + super(ListUsagesResult, self).__init__(**kwargs) + self.value = None + self.next_link = None -class JobResourceConfiguration(ResourceConfiguration): - """JobResourceConfiguration. +class ListWorkspaceKeysResult(msrest.serialization.Model): + """ListWorkspaceKeysResult. - :ivar instance_count: Optional number of instances or nodes used by the compute target. - :vartype instance_count: int - :ivar instance_type: Optional type of VM used as supported by the compute target. - :vartype instance_type: str - :ivar properties: Additional properties bag. - :vartype properties: dict[str, any] - :ivar docker_args: Extra arguments to pass to the Docker run command. This would override any - parameters that have already been set by the system, or in this section. This parameter is only - supported for Azure ML compute types. - :vartype docker_args: str - :ivar shm_size: Size of the docker container's shared memory block. This should be in the - format of (number)(unit) where number as to be greater than 0 and the unit can be one of - b(bytes), k(kilobytes), m(megabytes), or g(gigabytes). - :vartype shm_size: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar app_insights_instrumentation_key: The access key of the workspace app insights. + :vartype app_insights_instrumentation_key: str + :ivar container_registry_credentials: + :vartype container_registry_credentials: + ~azure.mgmt.machinelearningservices.models.RegistryListCredentialsResult + :ivar notebook_access_keys: + :vartype notebook_access_keys: + ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult + :ivar user_storage_arm_id: The arm Id key of the workspace storage. + :vartype user_storage_arm_id: str + :ivar user_storage_key: The access key of the workspace storage. + :vartype user_storage_key: str """ _validation = { - 'shm_size': {'pattern': r'\d+[bBkKmMgG]'}, + 'app_insights_instrumentation_key': {'readonly': True}, + 'user_storage_arm_id': {'readonly': True}, + 'user_storage_key': {'readonly': True}, } _attribute_map = { - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{object}'}, - 'docker_args': {'key': 'dockerArgs', 'type': 'str'}, - 'shm_size': {'key': 'shmSize', 'type': 'str'}, + 'app_insights_instrumentation_key': {'key': 'appInsightsInstrumentationKey', 'type': 'str'}, + 'container_registry_credentials': {'key': 'containerRegistryCredentials', 'type': 'RegistryListCredentialsResult'}, + 'notebook_access_keys': {'key': 'notebookAccessKeys', 'type': 'ListNotebookKeysResult'}, + 'user_storage_arm_id': {'key': 'userStorageArmId', 'type': 'str'}, + 'user_storage_key': {'key': 'userStorageKey', 'type': 'str'}, } def __init__( @@ -16104,46 +18241,41 @@ def __init__( **kwargs ): """ - :keyword instance_count: Optional number of instances or nodes used by the compute target. - :paramtype instance_count: int - :keyword instance_type: Optional type of VM used as supported by the compute target. - :paramtype instance_type: str - :keyword properties: Additional properties bag. - :paramtype properties: dict[str, any] - :keyword docker_args: Extra arguments to pass to the Docker run command. This would override - any parameters that have already been set by the system, or in this section. This parameter is - only supported for Azure ML compute types. - :paramtype docker_args: str - :keyword shm_size: Size of the docker container's shared memory block. This should be in the - format of (number)(unit) where number as to be greater than 0 and the unit can be one of - b(bytes), k(kilobytes), m(megabytes), or g(gigabytes). - :paramtype shm_size: str + :keyword container_registry_credentials: + :paramtype container_registry_credentials: + ~azure.mgmt.machinelearningservices.models.RegistryListCredentialsResult + :keyword notebook_access_keys: + :paramtype notebook_access_keys: + ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult """ - super(JobResourceConfiguration, self).__init__(**kwargs) - self.docker_args = kwargs.get('docker_args', None) - self.shm_size = kwargs.get('shm_size', "2g") + super(ListWorkspaceKeysResult, self).__init__(**kwargs) + self.app_insights_instrumentation_key = None + self.container_registry_credentials = kwargs.get('container_registry_credentials', None) + self.notebook_access_keys = kwargs.get('notebook_access_keys', None) + self.user_storage_arm_id = None + self.user_storage_key = None -class JobScheduleAction(ScheduleActionBase): - """JobScheduleAction. +class ListWorkspaceQuotas(msrest.serialization.Model): + """The List WorkspaceQuotasByVMFamily operation response. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar action_type: Required. [Required] Specifies the action type of the schedule.Constant - filled by server. Possible values include: "CreateJob", "InvokeBatchEndpoint", "CreateMonitor". - :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType - :ivar job_definition: Required. [Required] Defines Schedule action definition details. - :vartype job_definition: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + :ivar value: The list of Workspace Quotas by VM Family. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ResourceQuota] + :ivar next_link: The URI to fetch the next page of workspace quota information by VM Family. + Call ListNext() with this to fetch the next page of Workspace Quota information. + :vartype next_link: str """ _validation = { - 'action_type': {'required': True}, - 'job_definition': {'required': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'str'}, - 'job_definition': {'key': 'jobDefinition', 'type': 'JobBaseProperties'}, + 'value': {'key': 'value', 'type': '[ResourceQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( @@ -16151,49 +18283,36 @@ def __init__( **kwargs ): """ - :keyword job_definition: Required. [Required] Defines Schedule action definition details. - :paramtype job_definition: ~azure.mgmt.machinelearningservices.models.JobBaseProperties - """ - super(JobScheduleAction, self).__init__(**kwargs) - self.action_type = 'CreateJob' # type: str - self.job_definition = kwargs['job_definition'] + """ + super(ListWorkspaceQuotas, self).__init__(**kwargs) + self.value = None + self.next_link = None -class JobService(msrest.serialization.Model): - """Job endpoint definition. +class LiteralJobInput(JobInput): + """Literal input type. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar endpoint: Url for endpoint. - :vartype endpoint: str - :ivar error_message: Any error in the service. - :vartype error_message: str - :ivar job_service_type: Endpoint type. - :vartype job_service_type: str - :ivar nodes: Nodes that user would like to start the service on. - If Nodes is not set or set to null, the service will only be started on leader node. - :vartype nodes: ~azure.mgmt.machinelearningservices.models.Nodes - :ivar port: Port for endpoint. - :vartype port: int - :ivar properties: Additional properties to set on the endpoint. - :vartype properties: dict[str, str] - :ivar status: Status of endpoint. - :vartype status: str + :ivar description: Description for the input. + :vartype description: str + :ivar job_input_type: Required. [Required] Specifies the type of job.Constant filled by server. + Possible values include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", + "mlflow_model", "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar value: Required. [Required] Literal value for the input. + :vartype value: str """ _validation = { - 'error_message': {'readonly': True}, - 'status': {'readonly': True}, + 'job_input_type': {'required': True}, + 'value': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, } _attribute_map = { - 'endpoint': {'key': 'endpoint', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'job_service_type': {'key': 'jobServiceType', 'type': 'str'}, - 'nodes': {'key': 'nodes', 'type': 'Nodes'}, - 'port': {'key': 'port', 'type': 'int'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, } def __init__( @@ -16201,37 +18320,37 @@ def __init__( **kwargs ): """ - :keyword endpoint: Url for endpoint. - :paramtype endpoint: str - :keyword job_service_type: Endpoint type. - :paramtype job_service_type: str - :keyword nodes: Nodes that user would like to start the service on. - If Nodes is not set or set to null, the service will only be started on leader node. - :paramtype nodes: ~azure.mgmt.machinelearningservices.models.Nodes - :keyword port: Port for endpoint. - :paramtype port: int - :keyword properties: Additional properties to set on the endpoint. - :paramtype properties: dict[str, str] + :keyword description: Description for the input. + :paramtype description: str + :keyword value: Required. [Required] Literal value for the input. + :paramtype value: str """ - super(JobService, self).__init__(**kwargs) - self.endpoint = kwargs.get('endpoint', None) - self.error_message = None - self.job_service_type = kwargs.get('job_service_type', None) - self.nodes = kwargs.get('nodes', None) - self.port = kwargs.get('port', None) - self.properties = kwargs.get('properties', None) - self.status = None + super(LiteralJobInput, self).__init__(**kwargs) + self.job_input_type = 'literal' # type: str + self.value = kwargs['value'] -class KubernetesSchema(msrest.serialization.Model): - """Kubernetes Compute Schema. +class ManagedComputeIdentity(MonitorComputeIdentityBase): + """Managed compute identity definition. - :ivar properties: Properties of Kubernetes. - :vartype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + All required parameters must be populated in order to send to Azure. + + :ivar compute_identity_type: Required. [Required] Specifies the type of identity to use within + the monitoring jobs.Constant filled by server. Possible values include: "AmlToken", + "ManagedIdentity". + :vartype compute_identity_type: str or + ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityType + :ivar identity: The identity which will be leveraged by the monitoring jobs. + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity """ + _validation = { + 'compute_identity_type': {'required': True}, + } + _attribute_map = { - 'properties': {'key': 'properties', 'type': 'KubernetesProperties'}, + 'compute_identity_type': {'key': 'computeIdentityType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, } def __init__( @@ -16239,72 +18358,43 @@ def __init__( **kwargs ): """ - :keyword properties: Properties of Kubernetes. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + :keyword identity: The identity which will be leveraged by the monitoring jobs. + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity """ - super(KubernetesSchema, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - + super(ManagedComputeIdentity, self).__init__(**kwargs) + self.compute_identity_type = 'ManagedIdentity' # type: str + self.identity = kwargs.get('identity', None) -class Kubernetes(Compute, KubernetesSchema): - """A Machine Learning compute based on Kubernetes Compute. - Variables are only populated by the server, and will be ignored when sending a request. +class ManagedIdentity(IdentityConfiguration): + """Managed identity configuration. All required parameters must be populated in order to send to Azure. - :ivar properties: Properties of Kubernetes. - :vartype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties - :ivar compute_type: Required. The type of compute.Constant filled by server. Possible values - include: "AKS", "Kubernetes", "AmlCompute", "ComputeInstance", "DataFactory", "VirtualMachine", - "HDInsight", "Databricks", "DataLakeAnalytics", "SynapseSpark". - :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.ComputeType - :ivar compute_location: Location for the underlying compute. - :vartype compute_location: str - :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, - Updating, Provisioning, Succeeded, and Failed. Possible values include: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.ProvisioningState - :ivar description: The description of the Machine Learning compute. - :vartype description: str - :ivar created_on: The time at which the compute was created. - :vartype created_on: ~datetime.datetime - :ivar modified_on: The time at which the compute was last modified. - :vartype modified_on: ~datetime.datetime - :ivar resource_id: ARM resource id of the underlying compute. + :ivar identity_type: Required. [Required] Specifies the type of identity framework.Constant + filled by server. Possible values include: "Managed", "AMLToken", "UserIdentity". + :vartype identity_type: str or + ~azure.mgmt.machinelearningservices.models.IdentityConfigurationType + :ivar client_id: Specifies a user-assigned identity by client ID. For system-assigned, do not + set this field. + :vartype client_id: str + :ivar object_id: Specifies a user-assigned identity by object ID. For system-assigned, do not + set this field. + :vartype object_id: str + :ivar resource_id: Specifies a user-assigned identity by ARM resource ID. For system-assigned, + do not set this field. :vartype resource_id: str - :ivar provisioning_errors: Errors during provisioning. - :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] - :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought - from outside if true, or machine learning service provisioned it if false. - :vartype is_attached_compute: bool - :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI - and AAD exclusively for authentication. - :vartype disable_local_auth: bool """ _validation = { - 'compute_type': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'created_on': {'readonly': True}, - 'modified_on': {'readonly': True}, - 'provisioning_errors': {'readonly': True}, - 'is_attached_compute': {'readonly': True}, + 'identity_type': {'required': True}, } _attribute_map = { - 'properties': {'key': 'properties', 'type': 'KubernetesProperties'}, - 'compute_type': {'key': 'computeType', 'type': 'str'}, - 'compute_location': {'key': 'computeLocation', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'created_on': {'key': 'createdOn', 'type': 'iso-8601'}, - 'modified_on': {'key': 'modifiedOn', 'type': 'iso-8601'}, + 'identity_type': {'key': 'identityType', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'provisioning_errors': {'key': 'provisioningErrors', 'type': '[ErrorResponse]'}, - 'is_attached_compute': {'key': 'isAttachedCompute', 'type': 'bool'}, - 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, } def __init__( @@ -16312,117 +18402,102 @@ def __init__( **kwargs ): """ - :keyword properties: Properties of Kubernetes. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties - :keyword compute_location: Location for the underlying compute. - :paramtype compute_location: str - :keyword description: The description of the Machine Learning compute. - :paramtype description: str - :keyword resource_id: ARM resource id of the underlying compute. + :keyword client_id: Specifies a user-assigned identity by client ID. For system-assigned, do + not set this field. + :paramtype client_id: str + :keyword object_id: Specifies a user-assigned identity by object ID. For system-assigned, do + not set this field. + :paramtype object_id: str + :keyword resource_id: Specifies a user-assigned identity by ARM resource ID. For + system-assigned, do not set this field. :paramtype resource_id: str - :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only - MSI and AAD exclusively for authentication. - :paramtype disable_local_auth: bool """ - super(Kubernetes, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.compute_type = 'Kubernetes' # type: str - self.compute_location = kwargs.get('compute_location', None) - self.provisioning_state = None - self.description = kwargs.get('description', None) - self.created_on = None - self.modified_on = None + super(ManagedIdentity, self).__init__(**kwargs) + self.identity_type = 'Managed' # type: str + self.client_id = kwargs.get('client_id', None) + self.object_id = kwargs.get('object_id', None) self.resource_id = kwargs.get('resource_id', None) - self.provisioning_errors = None - self.is_attached_compute = None - self.disable_local_auth = kwargs.get('disable_local_auth', None) - -class OnlineDeploymentProperties(EndpointDeploymentPropertiesBase): - """OnlineDeploymentProperties. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: KubernetesOnlineDeployment, ManagedOnlineDeployment. +class ManagedIdentityAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """ManagedIdentityAuthTypeWorkspaceConnectionProperties. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar code_configuration: Code configuration for the endpoint deployment. - :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration - :ivar description: Description of the endpoint deployment. - :vartype description: str - :ivar environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. - :vartype environment_id: str - :ivar environment_variables: Environment variables configuration for the deployment. - :vartype environment_variables: dict[str, str] - :ivar properties: Property dictionary. Properties can be added, but not removed or altered. - :vartype properties: dict[str, str] - :ivar app_insights_enabled: If true, enables Application Insights logging. - :vartype app_insights_enabled: bool - :ivar data_collector: The mdc configuration, we disable mdc when it's null. - :vartype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector - :ivar egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", - "Disabled". - :vartype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :ivar endpoint_compute_type: Required. [Required] The compute type of the endpoint.Constant - filled by server. Possible values include: "Managed", "Kubernetes", "AzureMLCompute". - :vartype endpoint_compute_type: str or - ~azure.mgmt.machinelearningservices.models.EndpointComputeType - :ivar instance_type: Compute instance type. - :vartype instance_type: str - :ivar liveness_probe: Liveness probe monitors the health of the container regularly. - :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :ivar model: The URI path to the model. - :vartype model: str - :ivar model_mount_path: The path to mount the model in custom container. - :vartype model_mount_path: str - :ivar provisioning_state: Provisioning state for the endpoint deployment. Possible values - include: "Creating", "Deleting", "Scaling", "Updating", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.DeploymentProvisioningState - :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :ivar request_settings: Request settings for the deployment. - :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :ivar scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + :ivar auth_type: Required. Authentication type of the connection target.Constant filled by + server. Possible values include: "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", + "AccountKey", "ServicePrincipal", "AccessKey", "ApiKey", "CustomKeys", "OAuth2", "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Possible values include: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", + "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", + "Serverless". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionManagedIdentity """ _validation = { - 'endpoint_compute_type': {'required': True}, - 'provisioning_state': {'readonly': True}, + 'auth_type': {'required': True}, + 'created_by_workspace_arm_id': {'readonly': True}, + 'group': {'readonly': True}, } _attribute_map = { - 'code_configuration': {'key': 'codeConfiguration', 'type': 'CodeConfiguration'}, - 'description': {'key': 'description', 'type': 'str'}, - 'environment_id': {'key': 'environmentId', 'type': 'str'}, - 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'app_insights_enabled': {'key': 'appInsightsEnabled', 'type': 'bool'}, - 'data_collector': {'key': 'dataCollector', 'type': 'DataCollector'}, - 'egress_public_network_access': {'key': 'egressPublicNetworkAccess', 'type': 'str'}, - 'endpoint_compute_type': {'key': 'endpointComputeType', 'type': 'str'}, - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'liveness_probe': {'key': 'livenessProbe', 'type': 'ProbeSettings'}, - 'model': {'key': 'model', 'type': 'str'}, - 'model_mount_path': {'key': 'modelMountPath', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'readiness_probe': {'key': 'readinessProbe', 'type': 'ProbeSettings'}, - 'request_settings': {'key': 'requestSettings', 'type': 'OnlineRequestSettings'}, - 'scale_settings': {'key': 'scaleSettings', 'type': 'OnlineScaleSettings'}, - } - - _subtype_map = { - 'endpoint_compute_type': {'Kubernetes': 'KubernetesOnlineDeployment', 'Managed': 'ManagedOnlineDeployment'} + 'auth_type': {'key': 'authType', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, + 'group': {'key': 'group', 'type': 'str'}, + 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, + 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, + 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionManagedIdentity'}, } def __init__( @@ -16430,143 +18505,130 @@ def __init__( **kwargs ): """ - :keyword code_configuration: Code configuration for the endpoint deployment. - :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration - :keyword description: Description of the endpoint deployment. - :paramtype description: str - :keyword environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. - :paramtype environment_id: str - :keyword environment_variables: Environment variables configuration for the deployment. - :paramtype environment_variables: dict[str, str] - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. - :paramtype properties: dict[str, str] - :keyword app_insights_enabled: If true, enables Application Insights logging. - :paramtype app_insights_enabled: bool - :keyword data_collector: The mdc configuration, we disable mdc when it's null. - :paramtype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector - :keyword egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", - "Disabled". - :paramtype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :keyword instance_type: Compute instance type. - :paramtype instance_type: str - :keyword liveness_probe: Liveness probe monitors the health of the container regularly. - :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword model: The URI path to the model. - :paramtype model: str - :keyword model_mount_path: The path to mount the model in custom container. - :paramtype model_mount_path: str - :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword request_settings: Request settings for the deployment. - :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :keyword scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + :keyword category: Category of the connection. Possible values include: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", + "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", + "Serverless". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionManagedIdentity """ - super(OnlineDeploymentProperties, self).__init__(**kwargs) - self.app_insights_enabled = kwargs.get('app_insights_enabled', False) - self.data_collector = kwargs.get('data_collector', None) - self.egress_public_network_access = kwargs.get('egress_public_network_access', None) - self.endpoint_compute_type = 'OnlineDeploymentProperties' # type: str - self.instance_type = kwargs.get('instance_type', None) - self.liveness_probe = kwargs.get('liveness_probe', None) - self.model = kwargs.get('model', None) - self.model_mount_path = kwargs.get('model_mount_path', None) - self.provisioning_state = None - self.readiness_probe = kwargs.get('readiness_probe', None) - self.request_settings = kwargs.get('request_settings', None) - self.scale_settings = kwargs.get('scale_settings', None) - + super(ManagedIdentityAuthTypeWorkspaceConnectionProperties, self).__init__(**kwargs) + self.auth_type = 'ManagedIdentity' # type: str + self.credentials = kwargs.get('credentials', None) -class KubernetesOnlineDeployment(OnlineDeploymentProperties): - """Properties specific to a KubernetesOnlineDeployment. - Variables are only populated by the server, and will be ignored when sending a request. +class ManagedIdentityCredential(DataReferenceCredential): + """Credential for user managed identity. All required parameters must be populated in order to send to Azure. - :ivar code_configuration: Code configuration for the endpoint deployment. - :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration - :ivar description: Description of the endpoint deployment. - :vartype description: str - :ivar environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. - :vartype environment_id: str - :ivar environment_variables: Environment variables configuration for the deployment. - :vartype environment_variables: dict[str, str] - :ivar properties: Property dictionary. Properties can be added, but not removed or altered. - :vartype properties: dict[str, str] - :ivar app_insights_enabled: If true, enables Application Insights logging. - :vartype app_insights_enabled: bool - :ivar data_collector: The mdc configuration, we disable mdc when it's null. - :vartype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector - :ivar egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", - "Disabled". - :vartype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :ivar endpoint_compute_type: Required. [Required] The compute type of the endpoint.Constant - filled by server. Possible values include: "Managed", "Kubernetes", "AzureMLCompute". - :vartype endpoint_compute_type: str or - ~azure.mgmt.machinelearningservices.models.EndpointComputeType - :ivar instance_type: Compute instance type. - :vartype instance_type: str - :ivar liveness_probe: Liveness probe monitors the health of the container regularly. - :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :ivar model: The URI path to the model. - :vartype model: str - :ivar model_mount_path: The path to mount the model in custom container. - :vartype model_mount_path: str - :ivar provisioning_state: Provisioning state for the endpoint deployment. Possible values - include: "Creating", "Deleting", "Scaling", "Updating", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.DeploymentProvisioningState - :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :ivar request_settings: Request settings for the deployment. - :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :ivar scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings - :ivar container_resource_requirements: The resource requirements for the container (cpu and - memory). - :vartype container_resource_requirements: - ~azure.mgmt.machinelearningservices.models.ContainerResourceRequirements + :ivar credential_type: Required. [Required] Credential type used to authentication with + storage.Constant filled by server. Possible values include: "SAS", "DockerCredentials", + "ManagedIdentity", "NoCredentials". + :vartype credential_type: str or + ~azure.mgmt.machinelearningservices.models.DataReferenceCredentialType + :ivar managed_identity_type: ManagedIdentityCredential identity type. + :vartype managed_identity_type: str + :ivar user_managed_identity_client_id: ClientId for the UAMI. For ManagedIdentityType = + SystemManaged, this field is null. + :vartype user_managed_identity_client_id: str + :ivar user_managed_identity_principal_id: PrincipalId for the UAMI. For ManagedIdentityType = + SystemManaged, this field is null. + :vartype user_managed_identity_principal_id: str + :ivar user_managed_identity_resource_id: Full arm scope for the Id. For ManagedIdentityType = + SystemManaged, this field is null. + :vartype user_managed_identity_resource_id: str + :ivar user_managed_identity_tenant_id: TenantId for the UAMI. For ManagedIdentityType = + SystemManaged, this field is null. + :vartype user_managed_identity_tenant_id: str """ - _validation = { - 'endpoint_compute_type': {'required': True}, - 'provisioning_state': {'readonly': True}, - } + _validation = { + 'credential_type': {'required': True}, + } + + _attribute_map = { + 'credential_type': {'key': 'credentialType', 'type': 'str'}, + 'managed_identity_type': {'key': 'managedIdentityType', 'type': 'str'}, + 'user_managed_identity_client_id': {'key': 'userManagedIdentityClientId', 'type': 'str'}, + 'user_managed_identity_principal_id': {'key': 'userManagedIdentityPrincipalId', 'type': 'str'}, + 'user_managed_identity_resource_id': {'key': 'userManagedIdentityResourceId', 'type': 'str'}, + 'user_managed_identity_tenant_id': {'key': 'userManagedIdentityTenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword managed_identity_type: ManagedIdentityCredential identity type. + :paramtype managed_identity_type: str + :keyword user_managed_identity_client_id: ClientId for the UAMI. For ManagedIdentityType = + SystemManaged, this field is null. + :paramtype user_managed_identity_client_id: str + :keyword user_managed_identity_principal_id: PrincipalId for the UAMI. For ManagedIdentityType + = SystemManaged, this field is null. + :paramtype user_managed_identity_principal_id: str + :keyword user_managed_identity_resource_id: Full arm scope for the Id. For ManagedIdentityType + = SystemManaged, this field is null. + :paramtype user_managed_identity_resource_id: str + :keyword user_managed_identity_tenant_id: TenantId for the UAMI. For ManagedIdentityType = + SystemManaged, this field is null. + :paramtype user_managed_identity_tenant_id: str + """ + super(ManagedIdentityCredential, self).__init__(**kwargs) + self.credential_type = 'ManagedIdentity' # type: str + self.managed_identity_type = kwargs.get('managed_identity_type', None) + self.user_managed_identity_client_id = kwargs.get('user_managed_identity_client_id', None) + self.user_managed_identity_principal_id = kwargs.get('user_managed_identity_principal_id', None) + self.user_managed_identity_resource_id = kwargs.get('user_managed_identity_resource_id', None) + self.user_managed_identity_tenant_id = kwargs.get('user_managed_identity_tenant_id', None) + + +class ManagedNetworkProvisionOptions(msrest.serialization.Model): + """Managed Network Provisioning options for managed network of a machine learning workspace. + + :ivar include_spark: + :vartype include_spark: bool + """ _attribute_map = { - 'code_configuration': {'key': 'codeConfiguration', 'type': 'CodeConfiguration'}, - 'description': {'key': 'description', 'type': 'str'}, - 'environment_id': {'key': 'environmentId', 'type': 'str'}, - 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'app_insights_enabled': {'key': 'appInsightsEnabled', 'type': 'bool'}, - 'data_collector': {'key': 'dataCollector', 'type': 'DataCollector'}, - 'egress_public_network_access': {'key': 'egressPublicNetworkAccess', 'type': 'str'}, - 'endpoint_compute_type': {'key': 'endpointComputeType', 'type': 'str'}, - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'liveness_probe': {'key': 'livenessProbe', 'type': 'ProbeSettings'}, - 'model': {'key': 'model', 'type': 'str'}, - 'model_mount_path': {'key': 'modelMountPath', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'readiness_probe': {'key': 'readinessProbe', 'type': 'ProbeSettings'}, - 'request_settings': {'key': 'requestSettings', 'type': 'OnlineRequestSettings'}, - 'scale_settings': {'key': 'scaleSettings', 'type': 'OnlineScaleSettings'}, - 'container_resource_requirements': {'key': 'containerResourceRequirements', 'type': 'ContainerResourceRequirements'}, + 'include_spark': {'key': 'includeSpark', 'type': 'bool'}, } def __init__( @@ -16574,85 +18636,26 @@ def __init__( **kwargs ): """ - :keyword code_configuration: Code configuration for the endpoint deployment. - :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration - :keyword description: Description of the endpoint deployment. - :paramtype description: str - :keyword environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. - :paramtype environment_id: str - :keyword environment_variables: Environment variables configuration for the deployment. - :paramtype environment_variables: dict[str, str] - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. - :paramtype properties: dict[str, str] - :keyword app_insights_enabled: If true, enables Application Insights logging. - :paramtype app_insights_enabled: bool - :keyword data_collector: The mdc configuration, we disable mdc when it's null. - :paramtype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector - :keyword egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", - "Disabled". - :paramtype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :keyword instance_type: Compute instance type. - :paramtype instance_type: str - :keyword liveness_probe: Liveness probe monitors the health of the container regularly. - :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword model: The URI path to the model. - :paramtype model: str - :keyword model_mount_path: The path to mount the model in custom container. - :paramtype model_mount_path: str - :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword request_settings: Request settings for the deployment. - :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :keyword scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings - :keyword container_resource_requirements: The resource requirements for the container (cpu and - memory). - :paramtype container_resource_requirements: - ~azure.mgmt.machinelearningservices.models.ContainerResourceRequirements + :keyword include_spark: + :paramtype include_spark: bool """ - super(KubernetesOnlineDeployment, self).__init__(**kwargs) - self.endpoint_compute_type = 'Kubernetes' # type: str - self.container_resource_requirements = kwargs.get('container_resource_requirements', None) + super(ManagedNetworkProvisionOptions, self).__init__(**kwargs) + self.include_spark = kwargs.get('include_spark', None) -class KubernetesProperties(msrest.serialization.Model): - """Kubernetes properties. +class ManagedNetworkProvisionStatus(msrest.serialization.Model): + """Status of the Provisioning for the managed network of a machine learning workspace. - :ivar relay_connection_string: Relay connection string. - :vartype relay_connection_string: str - :ivar service_bus_connection_string: ServiceBus connection string. - :vartype service_bus_connection_string: str - :ivar extension_principal_id: Extension principal-id. - :vartype extension_principal_id: str - :ivar extension_instance_release_train: Extension instance release train. - :vartype extension_instance_release_train: str - :ivar vc_name: VC name. - :vartype vc_name: str - :ivar namespace: Compute namespace. - :vartype namespace: str - :ivar default_instance_type: Default instance type. - :vartype default_instance_type: str - :ivar instance_types: Instance Type Schema. - :vartype instance_types: dict[str, - ~azure.mgmt.machinelearningservices.models.InstanceTypeSchema] + :ivar spark_ready: + :vartype spark_ready: bool + :ivar status: Status for the managed network of a machine learning workspace. Possible values + include: "Inactive", "Active". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.ManagedNetworkStatus """ _attribute_map = { - 'relay_connection_string': {'key': 'relayConnectionString', 'type': 'str'}, - 'service_bus_connection_string': {'key': 'serviceBusConnectionString', 'type': 'str'}, - 'extension_principal_id': {'key': 'extensionPrincipalId', 'type': 'str'}, - 'extension_instance_release_train': {'key': 'extensionInstanceReleaseTrain', 'type': 'str'}, - 'vc_name': {'key': 'vcName', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'default_instance_type': {'key': 'defaultInstanceType', 'type': 'str'}, - 'instance_types': {'key': 'instanceTypes', 'type': '{InstanceTypeSchema}'}, + 'spark_ready': {'key': 'sparkReady', 'type': 'bool'}, + 'status': {'key': 'status', 'type': 'str'}, } def __init__( @@ -16660,62 +18663,48 @@ def __init__( **kwargs ): """ - :keyword relay_connection_string: Relay connection string. - :paramtype relay_connection_string: str - :keyword service_bus_connection_string: ServiceBus connection string. - :paramtype service_bus_connection_string: str - :keyword extension_principal_id: Extension principal-id. - :paramtype extension_principal_id: str - :keyword extension_instance_release_train: Extension instance release train. - :paramtype extension_instance_release_train: str - :keyword vc_name: VC name. - :paramtype vc_name: str - :keyword namespace: Compute namespace. - :paramtype namespace: str - :keyword default_instance_type: Default instance type. - :paramtype default_instance_type: str - :keyword instance_types: Instance Type Schema. - :paramtype instance_types: dict[str, - ~azure.mgmt.machinelearningservices.models.InstanceTypeSchema] + :keyword spark_ready: + :paramtype spark_ready: bool + :keyword status: Status for the managed network of a machine learning workspace. Possible + values include: "Inactive", "Active". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.ManagedNetworkStatus """ - super(KubernetesProperties, self).__init__(**kwargs) - self.relay_connection_string = kwargs.get('relay_connection_string', None) - self.service_bus_connection_string = kwargs.get('service_bus_connection_string', None) - self.extension_principal_id = kwargs.get('extension_principal_id', None) - self.extension_instance_release_train = kwargs.get('extension_instance_release_train', None) - self.vc_name = kwargs.get('vc_name', None) - self.namespace = kwargs.get('namespace', "default") - self.default_instance_type = kwargs.get('default_instance_type', None) - self.instance_types = kwargs.get('instance_types', None) - + super(ManagedNetworkProvisionStatus, self).__init__(**kwargs) + self.spark_ready = kwargs.get('spark_ready', None) + self.status = kwargs.get('status', None) -class OneLakeArtifact(msrest.serialization.Model): - """OneLake artifact (data source) configuration. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: LakeHouseArtifact. +class ManagedNetworkSettings(msrest.serialization.Model): + """Managed Network settings for a machine learning workspace. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar artifact_name: Required. [Required] OneLake artifact name. - :vartype artifact_name: str - :ivar artifact_type: Required. [Required] OneLake artifact type.Constant filled by server. - Possible values include: "LakeHouse". - :vartype artifact_type: str or ~azure.mgmt.machinelearningservices.models.OneLakeArtifactType + :ivar isolation_mode: Isolation mode for the managed network of a machine learning workspace. + Possible values include: "Disabled", "AllowInternetOutbound", "AllowOnlyApprovedOutbound". + :vartype isolation_mode: str or ~azure.mgmt.machinelearningservices.models.IsolationMode + :ivar network_id: + :vartype network_id: str + :ivar outbound_rules: Dictionary of :code:``. + :vartype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + :ivar status: Status of the Provisioning for the managed network of a machine learning + workspace. + :vartype status: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus + :ivar changeable_isolation_modes: + :vartype changeable_isolation_modes: list[str or + ~azure.mgmt.machinelearningservices.models.IsolationMode] """ _validation = { - 'artifact_name': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, - 'artifact_type': {'required': True}, + 'network_id': {'readonly': True}, + 'changeable_isolation_modes': {'readonly': True}, } _attribute_map = { - 'artifact_name': {'key': 'artifactName', 'type': 'str'}, - 'artifact_type': {'key': 'artifactType', 'type': 'str'}, - } - - _subtype_map = { - 'artifact_type': {'LakeHouse': 'LakeHouseArtifact'} + 'isolation_mode': {'key': 'isolationMode', 'type': 'str'}, + 'network_id': {'key': 'networkId', 'type': 'str'}, + 'outbound_rules': {'key': 'outboundRules', 'type': '{OutboundRule}'}, + 'status': {'key': 'status', 'type': 'ManagedNetworkProvisionStatus'}, + 'changeable_isolation_modes': {'key': 'changeableIsolationModes', 'type': '[str]'}, } def __init__( @@ -16723,34 +18712,102 @@ def __init__( **kwargs ): """ - :keyword artifact_name: Required. [Required] OneLake artifact name. - :paramtype artifact_name: str + :keyword isolation_mode: Isolation mode for the managed network of a machine learning + workspace. Possible values include: "Disabled", "AllowInternetOutbound", + "AllowOnlyApprovedOutbound". + :paramtype isolation_mode: str or ~azure.mgmt.machinelearningservices.models.IsolationMode + :keyword outbound_rules: Dictionary of :code:``. + :paramtype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + :keyword status: Status of the Provisioning for the managed network of a machine learning + workspace. + :paramtype status: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus """ - super(OneLakeArtifact, self).__init__(**kwargs) - self.artifact_name = kwargs['artifact_name'] - self.artifact_type = None # type: Optional[str] + super(ManagedNetworkSettings, self).__init__(**kwargs) + self.isolation_mode = kwargs.get('isolation_mode', None) + self.network_id = None + self.outbound_rules = kwargs.get('outbound_rules', None) + self.status = kwargs.get('status', None) + self.changeable_isolation_modes = None -class LakeHouseArtifact(OneLakeArtifact): - """LakeHouseArtifact. +class ManagedOnlineDeployment(OnlineDeploymentProperties): + """Properties specific to a ManagedOnlineDeployment. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar artifact_name: Required. [Required] OneLake artifact name. - :vartype artifact_name: str - :ivar artifact_type: Required. [Required] OneLake artifact type.Constant filled by server. - Possible values include: "LakeHouse". - :vartype artifact_type: str or ~azure.mgmt.machinelearningservices.models.OneLakeArtifactType + :ivar code_configuration: Code configuration for the endpoint deployment. + :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + :ivar description: Description of the endpoint deployment. + :vartype description: str + :ivar environment_id: ARM resource ID or AssetId of the environment specification for the + endpoint deployment. + :vartype environment_id: str + :ivar environment_variables: Environment variables configuration for the deployment. + :vartype environment_variables: dict[str, str] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar app_insights_enabled: If true, enables Application Insights logging. + :vartype app_insights_enabled: bool + :ivar data_collector: The mdc configuration, we disable mdc when it's null. + :vartype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :ivar egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", + "Disabled". + :vartype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :ivar endpoint_compute_type: Required. [Required] The compute type of the endpoint.Constant + filled by server. Possible values include: "Managed", "Kubernetes", "AzureMLCompute". + :vartype endpoint_compute_type: str or + ~azure.mgmt.machinelearningservices.models.EndpointComputeType + :ivar instance_type: Compute instance type. + :vartype instance_type: str + :ivar liveness_probe: Liveness probe monitors the health of the container regularly. + :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar model: The URI path to the model. + :vartype model: str + :ivar model_mount_path: The path to mount the model in custom container. + :vartype model_mount_path: str + :ivar provisioning_state: Provisioning state for the endpoint deployment. Possible values + include: "Creating", "Deleting", "Scaling", "Updating", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DeploymentProvisioningState + :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar request_settings: Request settings for the deployment. + :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :ivar scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings """ _validation = { - 'artifact_name': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, - 'artifact_type': {'required': True}, + 'endpoint_compute_type': {'required': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'artifact_name': {'key': 'artifactName', 'type': 'str'}, - 'artifact_type': {'key': 'artifactType', 'type': 'str'}, + 'code_configuration': {'key': 'codeConfiguration', 'type': 'CodeConfiguration'}, + 'description': {'key': 'description', 'type': 'str'}, + 'environment_id': {'key': 'environmentId', 'type': 'str'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'app_insights_enabled': {'key': 'appInsightsEnabled', 'type': 'bool'}, + 'data_collector': {'key': 'dataCollector', 'type': 'DataCollector'}, + 'egress_public_network_access': {'key': 'egressPublicNetworkAccess', 'type': 'str'}, + 'endpoint_compute_type': {'key': 'endpointComputeType', 'type': 'str'}, + 'instance_type': {'key': 'instanceType', 'type': 'str'}, + 'liveness_probe': {'key': 'livenessProbe', 'type': 'ProbeSettings'}, + 'model': {'key': 'model', 'type': 'str'}, + 'model_mount_path': {'key': 'modelMountPath', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'readiness_probe': {'key': 'readinessProbe', 'type': 'ProbeSettings'}, + 'request_settings': {'key': 'requestSettings', 'type': 'OnlineRequestSettings'}, + 'scale_settings': {'key': 'scaleSettings', 'type': 'OnlineScaleSettings'}, } def __init__( @@ -16758,33 +18815,84 @@ def __init__( **kwargs ): """ - :keyword artifact_name: Required. [Required] OneLake artifact name. - :paramtype artifact_name: str + :keyword code_configuration: Code configuration for the endpoint deployment. + :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + :keyword description: Description of the endpoint deployment. + :paramtype description: str + :keyword environment_id: ARM resource ID or AssetId of the environment specification for the + endpoint deployment. + :paramtype environment_id: str + :keyword environment_variables: Environment variables configuration for the deployment. + :paramtype environment_variables: dict[str, str] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword app_insights_enabled: If true, enables Application Insights logging. + :paramtype app_insights_enabled: bool + :keyword data_collector: The mdc configuration, we disable mdc when it's null. + :paramtype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :keyword egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", + "Disabled". + :paramtype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :keyword instance_type: Compute instance type. + :paramtype instance_type: str + :keyword liveness_probe: Liveness probe monitors the health of the container regularly. + :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword model: The URI path to the model. + :paramtype model: str + :keyword model_mount_path: The path to mount the model in custom container. + :paramtype model_mount_path: str + :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword request_settings: Request settings for the deployment. + :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :keyword scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings """ - super(LakeHouseArtifact, self).__init__(**kwargs) - self.artifact_type = 'LakeHouse' # type: str + super(ManagedOnlineDeployment, self).__init__(**kwargs) + self.endpoint_compute_type = 'Managed' # type: str -class ListAmlUserFeatureResult(msrest.serialization.Model): - """The List Aml user feature operation response. +class ManagedOnlineEndpointDeploymentResourceProperties(EndpointDeploymentResourceProperties): + """ManagedOnlineEndpointDeploymentResourceProperties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of AML user facing features. - :vartype value: list[~azure.mgmt.machinelearningservices.models.AmlUserFeature] - :ivar next_link: The URI to fetch the next page of AML user features information. Call - ListNext() with this to fetch the next page of AML user features information. - :vartype next_link: str + All required parameters must be populated in order to send to Azure. + + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Required. Kind of the deployment.Constant filled by server. + :vartype type: str + :ivar endpoint_compute_type: Enum to determine endpoint compute type. Possible values include: + "Managed", "Kubernetes", "AzureMLCompute". + :vartype endpoint_compute_type: str or + ~azure.mgmt.machinelearningservices.models.EndpointComputeType + :ivar model: + :vartype model: str """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[AmlUserFeature]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'endpoint_compute_type': {'key': 'endpointComputeType', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'str'}, } def __init__( @@ -16792,31 +18900,94 @@ def __init__( **kwargs ): """ + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword endpoint_compute_type: Enum to determine endpoint compute type. Possible values + include: "Managed", "Kubernetes", "AzureMLCompute". + :paramtype endpoint_compute_type: str or + ~azure.mgmt.machinelearningservices.models.EndpointComputeType + :keyword model: + :paramtype model: str """ - super(ListAmlUserFeatureResult, self).__init__(**kwargs) - self.value = None - self.next_link = None + super(ManagedOnlineEndpointDeploymentResourceProperties, self).__init__(**kwargs) + self.type = 'managedOnlineEndpoint' # type: str + self.endpoint_compute_type = kwargs.get('endpoint_compute_type', None) + self.model = kwargs.get('model', None) -class ListNotebookKeysResult(msrest.serialization.Model): - """ListNotebookKeysResult. +class ManagedOnlineEndpointResourceProperties(EndpointResourceProperties): + """ManagedOnlineEndpointResourceProperties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar primary_access_key: - :vartype primary_access_key: str - :ivar secondary_access_key: - :vartype secondary_access_key: str + All required parameters must be populated in order to send to Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Required. Type of the endpoint.Constant filled by server. Possible values + include: "Azure.OpenAI", "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", + "managedOnlineEndpoint", "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool + :ivar auth_mode: Enum to determine endpoint authentication mode. Possible values include: + "AMLToken", "Key", "AADToken". + :vartype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode + :ivar compute: + :vartype compute: str + :ivar description: + :vartype description: str + :ivar mirror_traffic: Dictionary of :code:``. + :vartype mirror_traffic: dict[str, int] + :ivar scoring_uri: + :vartype scoring_uri: str + :ivar traffic: Dictionary of :code:``. + :vartype traffic: dict[str, int] """ _validation = { - 'primary_access_key': {'readonly': True}, - 'secondary_access_key': {'readonly': True}, + 'endpoint_type': {'required': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'primary_access_key': {'key': 'primaryAccessKey', 'type': 'str'}, - 'secondary_access_key': {'key': 'secondaryAccessKey', 'type': 'str'}, + 'associated_resource_id': {'key': 'associatedResourceId', 'type': 'str'}, + 'deployments': {'key': 'deployments', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'should_create_ai_services_endpoint': {'key': 'shouldCreateAiServicesEndpoint', 'type': 'bool'}, + 'auth_mode': {'key': 'authMode', 'type': 'str'}, + 'compute': {'key': 'compute', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'mirror_traffic': {'key': 'mirrorTraffic', 'type': '{int}'}, + 'scoring_uri': {'key': 'scoringUri', 'type': 'str'}, + 'traffic': {'key': 'traffic', 'type': '{int}'}, } def __init__( @@ -16824,27 +18995,66 @@ def __init__( **kwargs ): """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + :keyword auth_mode: Enum to determine endpoint authentication mode. Possible values include: + "AMLToken", "Key", "AADToken". + :paramtype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode + :keyword compute: + :paramtype compute: str + :keyword description: + :paramtype description: str + :keyword mirror_traffic: Dictionary of :code:``. + :paramtype mirror_traffic: dict[str, int] + :keyword scoring_uri: + :paramtype scoring_uri: str + :keyword traffic: Dictionary of :code:``. + :paramtype traffic: dict[str, int] """ - super(ListNotebookKeysResult, self).__init__(**kwargs) - self.primary_access_key = None - self.secondary_access_key = None + super(ManagedOnlineEndpointResourceProperties, self).__init__(**kwargs) + self.endpoint_type = 'managedOnlineEndpoint' # type: str + self.auth_mode = kwargs.get('auth_mode', None) + self.compute = kwargs.get('compute', None) + self.description = kwargs.get('description', None) + self.mirror_traffic = kwargs.get('mirror_traffic', None) + self.scoring_uri = kwargs.get('scoring_uri', None) + self.traffic = kwargs.get('traffic', None) -class ListStorageAccountKeysResult(msrest.serialization.Model): - """ListStorageAccountKeysResult. +class ManagedResourceGroupAssignedIdentities(msrest.serialization.Model): + """Details for managed resource group assigned identities. Variables are only populated by the server, and will be ignored when sending a request. - :ivar user_storage_key: - :vartype user_storage_key: str + :ivar principal_id: Identity principal Id. + :vartype principal_id: str """ _validation = { - 'user_storage_key': {'readonly': True}, + 'principal_id': {'readonly': True}, } _attribute_map = { - 'user_storage_key': {'key': 'userStorageKey', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, } def __init__( @@ -16853,30 +19063,20 @@ def __init__( ): """ """ - super(ListStorageAccountKeysResult, self).__init__(**kwargs) - self.user_storage_key = None - + super(ManagedResourceGroupAssignedIdentities, self).__init__(**kwargs) + self.principal_id = None -class ListUsagesResult(msrest.serialization.Model): - """The List Usages operation response. - Variables are only populated by the server, and will be ignored when sending a request. +class ManagedResourceGroupSettings(msrest.serialization.Model): + """Managed resource group settings. - :ivar value: The list of AML resource usages. - :vartype value: list[~azure.mgmt.machinelearningservices.models.Usage] - :ivar next_link: The URI to fetch the next page of AML resource usage information. Call - ListNext() with this to fetch the next page of AML resource usage information. - :vartype next_link: str + :ivar assigned_identities: List of assigned identities for the managed resource group. + :vartype assigned_identities: + list[~azure.mgmt.machinelearningservices.models.ManagedResourceGroupAssignedIdentities] """ - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'assigned_identities': {'key': 'assignedIdentities', 'type': '[ManagedResourceGroupAssignedIdentities]'}, } def __init__( @@ -16884,45 +19084,50 @@ def __init__( **kwargs ): """ + :keyword assigned_identities: List of assigned identities for the managed resource group. + :paramtype assigned_identities: + list[~azure.mgmt.machinelearningservices.models.ManagedResourceGroupAssignedIdentities] """ - super(ListUsagesResult, self).__init__(**kwargs) - self.value = None - self.next_link = None + super(ManagedResourceGroupSettings, self).__init__(**kwargs) + self.assigned_identities = kwargs.get('assigned_identities', None) -class ListWorkspaceKeysResult(msrest.serialization.Model): - """ListWorkspaceKeysResult. +class ManagedServiceIdentity(msrest.serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). Variables are only populated by the server, and will be ignored when sending a request. - :ivar user_storage_key: - :vartype user_storage_key: str - :ivar user_storage_resource_id: - :vartype user_storage_resource_id: str - :ivar app_insights_instrumentation_key: - :vartype app_insights_instrumentation_key: str - :ivar container_registry_credentials: - :vartype container_registry_credentials: - ~azure.mgmt.machinelearningservices.models.RegistryListCredentialsResult - :ivar notebook_access_keys: - :vartype notebook_access_keys: - ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult + All required parameters must be populated in order to send to Azure. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Required. Type of managed service identity (where both SystemAssigned and + UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] """ _validation = { - 'user_storage_key': {'readonly': True}, - 'user_storage_resource_id': {'readonly': True}, - 'app_insights_instrumentation_key': {'readonly': True}, - 'container_registry_credentials': {'readonly': True}, - 'notebook_access_keys': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'type': {'required': True}, } _attribute_map = { - 'user_storage_key': {'key': 'userStorageKey', 'type': 'str'}, - 'user_storage_resource_id': {'key': 'userStorageResourceId', 'type': 'str'}, - 'app_insights_instrumentation_key': {'key': 'appInsightsInstrumentationKey', 'type': 'str'}, - 'container_registry_credentials': {'key': 'containerRegistryCredentials', 'type': 'RegistryListCredentialsResult'}, - 'notebook_access_keys': {'key': 'notebookAccessKeys', 'type': 'ListNotebookKeysResult'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, } def __init__( @@ -16930,35 +19135,47 @@ def __init__( **kwargs ): """ - """ - super(ListWorkspaceKeysResult, self).__init__(**kwargs) - self.user_storage_key = None - self.user_storage_resource_id = None - self.app_insights_instrumentation_key = None - self.container_registry_credentials = None - self.notebook_access_keys = None + :keyword type: Required. Type of managed service identity (where both SystemAssigned and + UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] + """ + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs['type'] + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) -class ListWorkspaceQuotas(msrest.serialization.Model): - """The List WorkspaceQuotasByVMFamily operation response. +class MarketplacePlan(msrest.serialization.Model): + """MarketplacePlan. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of Workspace Quotas by VM Family. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ResourceQuota] - :ivar next_link: The URI to fetch the next page of workspace quota information by VM Family. - Call ListNext() with this to fetch the next page of Workspace Quota information. - :vartype next_link: str + :ivar offer_id: The identifying name of the Offer of the Marketplace Plan. + :vartype offer_id: str + :ivar plan_id: The identifying name of the Plan of the Marketplace Plan. + :vartype plan_id: str + :ivar publisher_id: The identifying name of the Publisher of the Marketplace Plan. + :vartype publisher_id: str """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + 'offer_id': {'readonly': True}, + 'plan_id': {'readonly': True}, + 'publisher_id': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceQuota]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'offer_id': {'key': 'offerId', 'type': 'str'}, + 'plan_id': {'key': 'planId', 'type': 'str'}, + 'publisher_id': {'key': 'publisherId', 'type': 'str'}, } def __init__( @@ -16967,35 +19184,49 @@ def __init__( ): """ """ - super(ListWorkspaceQuotas, self).__init__(**kwargs) - self.value = None - self.next_link = None + super(MarketplacePlan, self).__init__(**kwargs) + self.offer_id = None + self.plan_id = None + self.publisher_id = None -class LiteralJobInput(JobInput): - """Literal input type. +class MarketplaceSubscription(ProxyResource): + """Azure Resource Manager resource envelope. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar description: Description for the input. - :vartype description: str - :ivar job_input_type: Required. [Required] Specifies the type of job.Constant filled by server. - Possible values include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", - "mlflow_model", "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :ivar value: Required. [Required] Literal value for the input. - :vartype value: str + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.MarketplaceSubscriptionProperties """ _validation = { - 'job_input_type': {'required': True}, - 'value': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, } _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'MarketplaceSubscriptionProperties'}, } def __init__( @@ -17003,37 +19234,48 @@ def __init__( **kwargs ): """ - :keyword description: Description for the input. - :paramtype description: str - :keyword value: Required. [Required] Literal value for the input. - :paramtype value: str + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.MarketplaceSubscriptionProperties """ - super(LiteralJobInput, self).__init__(**kwargs) - self.job_input_type = 'literal' # type: str - self.value = kwargs['value'] + super(MarketplaceSubscription, self).__init__(**kwargs) + self.properties = kwargs['properties'] -class ManagedComputeIdentity(MonitorComputeIdentityBase): - """Managed compute identity definition. +class MarketplaceSubscriptionProperties(msrest.serialization.Model): + """MarketplaceSubscriptionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar compute_identity_type: Required. [Required] Specifies the type of identity to use within - the monitoring jobs.Constant filled by server. Possible values include: "AmlToken", - "ManagedIdentity". - :vartype compute_identity_type: str or - ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityType - :ivar identity: The identity which will be leveraged by the monitoring jobs. - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar marketplace_plan: Marketplace Plan associated with the Marketplace Subscription. + :vartype marketplace_plan: ~azure.mgmt.machinelearningservices.models.MarketplacePlan + :ivar marketplace_subscription_status: Current status of the Marketplace Subscription. Possible + values include: "Subscribed", "Suspended", "Unsubscribed". + :vartype marketplace_subscription_status: str or + ~azure.mgmt.machinelearningservices.models.MarketplaceSubscriptionStatus + :ivar model_id: Required. [Required] Target Marketplace Model ID to create a Marketplace + Subscription for. + :vartype model_id: str + :ivar provisioning_state: Provisioning State of the Marketplace Subscription. Possible values + include: "Creating", "Deleting", "Succeeded", "Failed", "Updating", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.MarketplaceSubscriptionProvisioningState """ _validation = { - 'compute_identity_type': {'required': True}, + 'marketplace_plan': {'readonly': True}, + 'marketplace_subscription_status': {'readonly': True}, + 'model_id': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'compute_identity_type': {'key': 'computeIdentityType', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'marketplace_plan': {'key': 'marketplacePlan', 'type': 'MarketplacePlan'}, + 'marketplace_subscription_status': {'key': 'marketplaceSubscriptionStatus', 'type': 'str'}, + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } def __init__( @@ -17041,43 +19283,30 @@ def __init__( **kwargs ): """ - :keyword identity: The identity which will be leveraged by the monitoring jobs. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword model_id: Required. [Required] Target Marketplace Model ID to create a Marketplace + Subscription for. + :paramtype model_id: str """ - super(ManagedComputeIdentity, self).__init__(**kwargs) - self.compute_identity_type = 'ManagedIdentity' # type: str - self.identity = kwargs.get('identity', None) - + super(MarketplaceSubscriptionProperties, self).__init__(**kwargs) + self.marketplace_plan = None + self.marketplace_subscription_status = None + self.model_id = kwargs['model_id'] + self.provisioning_state = None -class ManagedIdentity(IdentityConfiguration): - """Managed identity configuration. - All required parameters must be populated in order to send to Azure. +class MarketplaceSubscriptionResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of MarketplaceSubscription entities. - :ivar identity_type: Required. [Required] Specifies the type of identity framework.Constant - filled by server. Possible values include: "Managed", "AMLToken", "UserIdentity". - :vartype identity_type: str or - ~azure.mgmt.machinelearningservices.models.IdentityConfigurationType - :ivar client_id: Specifies a user-assigned identity by client ID. For system-assigned, do not - set this field. - :vartype client_id: str - :ivar object_id: Specifies a user-assigned identity by object ID. For system-assigned, do not - set this field. - :vartype object_id: str - :ivar resource_id: Specifies a user-assigned identity by ARM resource ID. For system-assigned, - do not set this field. - :vartype resource_id: str + :ivar next_link: The link to the next page of MarketplaceSubscription objects. If null, there + are no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type MarketplaceSubscription. + :vartype value: list[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] """ - _validation = { - 'identity_type': {'required': True}, - } - _attribute_map = { - 'identity_type': {'key': 'identityType', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[MarketplaceSubscription]'}, } def __init__( @@ -17085,96 +19314,26 @@ def __init__( **kwargs ): """ - :keyword client_id: Specifies a user-assigned identity by client ID. For system-assigned, do - not set this field. - :paramtype client_id: str - :keyword object_id: Specifies a user-assigned identity by object ID. For system-assigned, do - not set this field. - :paramtype object_id: str - :keyword resource_id: Specifies a user-assigned identity by ARM resource ID. For - system-assigned, do not set this field. - :paramtype resource_id: str + :keyword next_link: The link to the next page of MarketplaceSubscription objects. If null, + there are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type MarketplaceSubscription. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] """ - super(ManagedIdentity, self).__init__(**kwargs) - self.identity_type = 'Managed' # type: str - self.client_id = kwargs.get('client_id', None) - self.object_id = kwargs.get('object_id', None) - self.resource_id = kwargs.get('resource_id', None) - - -class ManagedIdentityAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """ManagedIdentityAuthTypeWorkspaceConnectionProperties. - - Variables are only populated by the server, and will be ignored when sending a request. + super(MarketplaceSubscriptionResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) - All required parameters must be populated in order to send to Azure. - :ivar auth_type: Required. Authentication type of the connection target.Constant filled by - server. Possible values include: "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", - "AccountKey", "ServicePrincipal", "AccessKey", "ApiKey", "CustomKeys", "OAuth2", "AAD". - :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType - :ivar category: Category of the connection. Possible values include: "PythonFeed", - "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", - "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", - "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", - "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", - "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", - "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", - "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", - "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", - "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", - "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", - "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", - "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", - "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", - "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", - "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". - :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :ivar created_by_workspace_arm_id: - :vartype created_by_workspace_arm_id: str - :ivar expiry_time: - :vartype expiry_time: ~datetime.datetime - :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", - "Database", "NoSQL", "File", "GenericProtocol", "ServicesAndApps". - :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup - :ivar is_shared_to_all: - :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str - :ivar metadata: Store user metadata for this connection. - :vartype metadata: dict[str, str] - :ivar shared_user_list: - :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :ivar credentials: - :vartype credentials: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionManagedIdentity - """ +class MaterializationComputeResource(msrest.serialization.Model): + """DTO object representing compute resource. - _validation = { - 'auth_type': {'required': True}, - 'created_by_workspace_arm_id': {'readonly': True}, - 'group': {'readonly': True}, - } + :ivar instance_type: Specifies the instance type. + :vartype instance_type: str + """ _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, - 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, - 'group': {'key': 'group', 'type': 'str'}, - 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, - 'metadata': {'key': 'metadata', 'type': '{str}'}, - 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionManagedIdentity'}, + 'instance_type': {'key': 'instanceType', 'type': 'str'}, } def __init__( @@ -17182,86 +19341,35 @@ def __init__( **kwargs ): """ - :keyword category: Category of the connection. Possible values include: "PythonFeed", - "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", - "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", - "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", - "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", - "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", - "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", - "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", - "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", - "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", - "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", - "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", - "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", - "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", - "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", - "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". - :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :keyword expiry_time: - :paramtype expiry_time: ~datetime.datetime - :keyword is_shared_to_all: - :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str - :keyword metadata: Store user metadata for this connection. - :paramtype metadata: dict[str, str] - :keyword shared_user_list: - :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :keyword credentials: - :paramtype credentials: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionManagedIdentity + :keyword instance_type: Specifies the instance type. + :paramtype instance_type: str """ - super(ManagedIdentityAuthTypeWorkspaceConnectionProperties, self).__init__(**kwargs) - self.auth_type = 'ManagedIdentity' # type: str - self.credentials = kwargs.get('credentials', None) - + super(MaterializationComputeResource, self).__init__(**kwargs) + self.instance_type = kwargs.get('instance_type', None) -class ManagedIdentityCredential(DataReferenceCredential): - """Credential for user managed identity. - All required parameters must be populated in order to send to Azure. +class MaterializationSettings(msrest.serialization.Model): + """MaterializationSettings. - :ivar credential_type: Required. [Required] Credential type used to authentication with - storage.Constant filled by server. Possible values include: "SAS", "DockerCredentials", - "ManagedIdentity", "NoCredentials". - :vartype credential_type: str or - ~azure.mgmt.machinelearningservices.models.DataReferenceCredentialType - :ivar managed_identity_type: ManagedIdentityCredential identity type. - :vartype managed_identity_type: str - :ivar user_managed_identity_client_id: ClientId for the UAMI. For ManagedIdentityType = - SystemManaged, this field is null. - :vartype user_managed_identity_client_id: str - :ivar user_managed_identity_principal_id: PrincipalId for the UAMI. For ManagedIdentityType = - SystemManaged, this field is null. - :vartype user_managed_identity_principal_id: str - :ivar user_managed_identity_resource_id: Full arm scope for the Id. For ManagedIdentityType = - SystemManaged, this field is null. - :vartype user_managed_identity_resource_id: str - :ivar user_managed_identity_tenant_id: TenantId for the UAMI. For ManagedIdentityType = - SystemManaged, this field is null. - :vartype user_managed_identity_tenant_id: str + :ivar notification: Specifies the notification details. + :vartype notification: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :ivar resource: Specifies the compute resource settings. + :vartype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource + :ivar schedule: Specifies the schedule details. + :vartype schedule: ~azure.mgmt.machinelearningservices.models.RecurrenceTrigger + :ivar spark_configuration: Specifies the spark compute settings. + :vartype spark_configuration: dict[str, str] + :ivar store_type: Specifies the stores to which materialization should happen. Possible values + include: "None", "Online", "Offline", "OnlineAndOffline". + :vartype store_type: str or ~azure.mgmt.machinelearningservices.models.MaterializationStoreType """ - _validation = { - 'credential_type': {'required': True}, - } - _attribute_map = { - 'credential_type': {'key': 'credentialType', 'type': 'str'}, - 'managed_identity_type': {'key': 'managedIdentityType', 'type': 'str'}, - 'user_managed_identity_client_id': {'key': 'userManagedIdentityClientId', 'type': 'str'}, - 'user_managed_identity_principal_id': {'key': 'userManagedIdentityPrincipalId', 'type': 'str'}, - 'user_managed_identity_resource_id': {'key': 'userManagedIdentityResourceId', 'type': 'str'}, - 'user_managed_identity_tenant_id': {'key': 'userManagedIdentityTenantId', 'type': 'str'}, + 'notification': {'key': 'notification', 'type': 'NotificationSetting'}, + 'resource': {'key': 'resource', 'type': 'MaterializationComputeResource'}, + 'schedule': {'key': 'schedule', 'type': 'RecurrenceTrigger'}, + 'spark_configuration': {'key': 'sparkConfiguration', 'type': '{str}'}, + 'store_type': {'key': 'storeType', 'type': 'str'}, } def __init__( @@ -17269,39 +19377,50 @@ def __init__( **kwargs ): """ - :keyword managed_identity_type: ManagedIdentityCredential identity type. - :paramtype managed_identity_type: str - :keyword user_managed_identity_client_id: ClientId for the UAMI. For ManagedIdentityType = - SystemManaged, this field is null. - :paramtype user_managed_identity_client_id: str - :keyword user_managed_identity_principal_id: PrincipalId for the UAMI. For ManagedIdentityType - = SystemManaged, this field is null. - :paramtype user_managed_identity_principal_id: str - :keyword user_managed_identity_resource_id: Full arm scope for the Id. For ManagedIdentityType - = SystemManaged, this field is null. - :paramtype user_managed_identity_resource_id: str - :keyword user_managed_identity_tenant_id: TenantId for the UAMI. For ManagedIdentityType = - SystemManaged, this field is null. - :paramtype user_managed_identity_tenant_id: str + :keyword notification: Specifies the notification details. + :paramtype notification: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :keyword resource: Specifies the compute resource settings. + :paramtype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource + :keyword schedule: Specifies the schedule details. + :paramtype schedule: ~azure.mgmt.machinelearningservices.models.RecurrenceTrigger + :keyword spark_configuration: Specifies the spark compute settings. + :paramtype spark_configuration: dict[str, str] + :keyword store_type: Specifies the stores to which materialization should happen. Possible + values include: "None", "Online", "Offline", "OnlineAndOffline". + :paramtype store_type: str or + ~azure.mgmt.machinelearningservices.models.MaterializationStoreType """ - super(ManagedIdentityCredential, self).__init__(**kwargs) - self.credential_type = 'ManagedIdentity' # type: str - self.managed_identity_type = kwargs.get('managed_identity_type', None) - self.user_managed_identity_client_id = kwargs.get('user_managed_identity_client_id', None) - self.user_managed_identity_principal_id = kwargs.get('user_managed_identity_principal_id', None) - self.user_managed_identity_resource_id = kwargs.get('user_managed_identity_resource_id', None) - self.user_managed_identity_tenant_id = kwargs.get('user_managed_identity_tenant_id', None) + super(MaterializationSettings, self).__init__(**kwargs) + self.notification = kwargs.get('notification', None) + self.resource = kwargs.get('resource', None) + self.schedule = kwargs.get('schedule', None) + self.spark_configuration = kwargs.get('spark_configuration', None) + self.store_type = kwargs.get('store_type', None) -class ManagedNetworkProvisionOptions(msrest.serialization.Model): - """Managed Network Provisioning options for managed network of a machine learning workspace. +class MedianStoppingPolicy(EarlyTerminationPolicy): + """Defines an early termination policy based on running averages of the primary metric of all runs. - :ivar include_spark: - :vartype include_spark: bool + All required parameters must be populated in order to send to Azure. + + :ivar delay_evaluation: Number of intervals by which to delay the first evaluation. + :vartype delay_evaluation: int + :ivar evaluation_interval: Interval (number of runs) between policy evaluations. + :vartype evaluation_interval: int + :ivar policy_type: Required. [Required] Name of policy configuration.Constant filled by server. + Possible values include: "Bandit", "MedianStopping", "TruncationSelection". + :vartype policy_type: str or + ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicyType """ + _validation = { + 'policy_type': {'required': True}, + } + _attribute_map = { - 'include_spark': {'key': 'includeSpark', 'type': 'bool'}, + 'delay_evaluation': {'key': 'delayEvaluation', 'type': 'int'}, + 'evaluation_interval': {'key': 'evaluationInterval', 'type': 'int'}, + 'policy_type': {'key': 'policyType', 'type': 'str'}, } def __init__( @@ -17309,26 +19428,43 @@ def __init__( **kwargs ): """ - :keyword include_spark: - :paramtype include_spark: bool + :keyword delay_evaluation: Number of intervals by which to delay the first evaluation. + :paramtype delay_evaluation: int + :keyword evaluation_interval: Interval (number of runs) between policy evaluations. + :paramtype evaluation_interval: int """ - super(ManagedNetworkProvisionOptions, self).__init__(**kwargs) - self.include_spark = kwargs.get('include_spark', None) + super(MedianStoppingPolicy, self).__init__(**kwargs) + self.policy_type = 'MedianStopping' # type: str -class ManagedNetworkProvisionStatus(msrest.serialization.Model): - """Status of the Provisioning for the managed network of a machine learning workspace. +class MLFlowModelJobInput(JobInput, AssetJobInput): + """MLFlowModelJobInput. - :ivar spark_ready: - :vartype spark_ready: bool - :ivar status: Status for the managed network of a machine learning workspace. Possible values - include: "Inactive", "Active". - :vartype status: str or ~azure.mgmt.machinelearningservices.models.ManagedNetworkStatus + All required parameters must be populated in order to send to Azure. + + :ivar mode: Input Asset Delivery Mode. Possible values include: "ReadOnlyMount", + "ReadWriteMount", "Download", "Direct", "EvalMount", "EvalDownload". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode + :ivar uri: Required. [Required] Input Asset URI. + :vartype uri: str + :ivar description: Description for the input. + :vartype description: str + :ivar job_input_type: Required. [Required] Specifies the type of job.Constant filled by server. + Possible values include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", + "mlflow_model", "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType """ + _validation = { + 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'job_input_type': {'required': True}, + } + _attribute_map = { - 'spark_ready': {'key': 'sparkReady', 'type': 'bool'}, - 'status': {'key': 'status', 'type': 'str'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, } def __init__( @@ -17336,43 +19472,48 @@ def __init__( **kwargs ): """ - :keyword spark_ready: - :paramtype spark_ready: bool - :keyword status: Status for the managed network of a machine learning workspace. Possible - values include: "Inactive", "Active". - :paramtype status: str or ~azure.mgmt.machinelearningservices.models.ManagedNetworkStatus + :keyword mode: Input Asset Delivery Mode. Possible values include: "ReadOnlyMount", + "ReadWriteMount", "Download", "Direct", "EvalMount", "EvalDownload". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode + :keyword uri: Required. [Required] Input Asset URI. + :paramtype uri: str + :keyword description: Description for the input. + :paramtype description: str """ - super(ManagedNetworkProvisionStatus, self).__init__(**kwargs) - self.spark_ready = kwargs.get('spark_ready', None) - self.status = kwargs.get('status', None) + super(MLFlowModelJobInput, self).__init__(**kwargs) + self.mode = kwargs.get('mode', None) + self.uri = kwargs['uri'] + self.job_input_type = 'mlflow_model' # type: str + self.description = kwargs.get('description', None) -class ManagedNetworkSettings(msrest.serialization.Model): - """Managed Network settings for a machine learning workspace. +class MLFlowModelJobOutput(JobOutput, AssetJobOutput): + """MLFlowModelJobOutput. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar isolation_mode: Isolation mode for the managed network of a machine learning workspace. - Possible values include: "Disabled", "AllowInternetOutbound", "AllowOnlyApprovedOutbound". - :vartype isolation_mode: str or ~azure.mgmt.machinelearningservices.models.IsolationMode - :ivar network_id: - :vartype network_id: str - :ivar outbound_rules: Dictionary of :code:``. - :vartype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] - :ivar status: Status of the Provisioning for the managed network of a machine learning - workspace. - :vartype status: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus + :ivar mode: Output Asset Delivery Mode. Possible values include: "ReadWriteMount", "Upload", + "Direct". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :ivar uri: Output Asset URI. + :vartype uri: str + :ivar description: Description for the output. + :vartype description: str + :ivar job_output_type: Required. [Required] Specifies the type of job.Constant filled by + server. Possible values include: "uri_file", "uri_folder", "mltable", "custom_model", + "mlflow_model", "triton_model". + :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType """ _validation = { - 'network_id': {'readonly': True}, + 'job_output_type': {'required': True}, } _attribute_map = { - 'isolation_mode': {'key': 'isolationMode', 'type': 'str'}, - 'network_id': {'key': 'networkId', 'type': 'str'}, - 'outbound_rules': {'key': 'outboundRules', 'type': '{OutboundRule}'}, - 'status': {'key': 'status', 'type': 'ManagedNetworkProvisionStatus'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'job_output_type': {'key': 'jobOutputType', 'type': 'str'}, } def __init__( @@ -17380,101 +19521,60 @@ def __init__( **kwargs ): """ - :keyword isolation_mode: Isolation mode for the managed network of a machine learning - workspace. Possible values include: "Disabled", "AllowInternetOutbound", - "AllowOnlyApprovedOutbound". - :paramtype isolation_mode: str or ~azure.mgmt.machinelearningservices.models.IsolationMode - :keyword outbound_rules: Dictionary of :code:``. - :paramtype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] - :keyword status: Status of the Provisioning for the managed network of a machine learning - workspace. - :paramtype status: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus + :keyword mode: Output Asset Delivery Mode. Possible values include: "ReadWriteMount", "Upload", + "Direct". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :keyword uri: Output Asset URI. + :paramtype uri: str + :keyword description: Description for the output. + :paramtype description: str """ - super(ManagedNetworkSettings, self).__init__(**kwargs) - self.isolation_mode = kwargs.get('isolation_mode', None) - self.network_id = None - self.outbound_rules = kwargs.get('outbound_rules', None) - self.status = kwargs.get('status', None) - + super(MLFlowModelJobOutput, self).__init__(**kwargs) + self.mode = kwargs.get('mode', None) + self.uri = kwargs.get('uri', None) + self.job_output_type = 'mlflow_model' # type: str + self.description = kwargs.get('description', None) -class ManagedOnlineDeployment(OnlineDeploymentProperties): - """Properties specific to a ManagedOnlineDeployment. - Variables are only populated by the server, and will be ignored when sending a request. +class MLTableData(DataVersionBaseProperties): + """MLTable data definition. All required parameters must be populated in order to send to Azure. - :ivar code_configuration: Code configuration for the endpoint deployment. - :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration - :ivar description: Description of the endpoint deployment. + :ivar description: The asset description text. :vartype description: str - :ivar environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. - :vartype environment_id: str - :ivar environment_variables: Environment variables configuration for the deployment. - :vartype environment_variables: dict[str, str] - :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :ivar properties: The asset property dictionary. :vartype properties: dict[str, str] - :ivar app_insights_enabled: If true, enables Application Insights logging. - :vartype app_insights_enabled: bool - :ivar data_collector: The mdc configuration, we disable mdc when it's null. - :vartype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector - :ivar egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", - "Disabled". - :vartype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :ivar endpoint_compute_type: Required. [Required] The compute type of the endpoint.Constant - filled by server. Possible values include: "Managed", "Kubernetes", "AzureMLCompute". - :vartype endpoint_compute_type: str or - ~azure.mgmt.machinelearningservices.models.EndpointComputeType - :ivar instance_type: Compute instance type. - :vartype instance_type: str - :ivar liveness_probe: Liveness probe monitors the health of the container regularly. - :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :ivar model: The URI path to the model. - :vartype model: str - :ivar model_mount_path: The path to mount the model in custom container. - :vartype model_mount_path: str - :ivar provisioning_state: Provisioning state for the endpoint deployment. Possible values - include: "Creating", "Deleting", "Scaling", "Updating", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.DeploymentProvisioningState - :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :ivar request_settings: Request settings for the deployment. - :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :ivar scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar data_type: Required. [Required] Specifies the type of data.Constant filled by server. + Possible values include: "uri_file", "uri_folder", "mltable". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.DataType + :ivar data_uri: Required. [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. + :vartype data_uri: str + :ivar referenced_uris: Uris referenced in the MLTable definition (required for lineage). + :vartype referenced_uris: list[str] """ _validation = { - 'endpoint_compute_type': {'required': True}, - 'provisioning_state': {'readonly': True}, + 'data_type': {'required': True}, + 'data_uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, } _attribute_map = { - 'code_configuration': {'key': 'codeConfiguration', 'type': 'CodeConfiguration'}, 'description': {'key': 'description', 'type': 'str'}, - 'environment_id': {'key': 'environmentId', 'type': 'str'}, - 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, 'properties': {'key': 'properties', 'type': '{str}'}, - 'app_insights_enabled': {'key': 'appInsightsEnabled', 'type': 'bool'}, - 'data_collector': {'key': 'dataCollector', 'type': 'DataCollector'}, - 'egress_public_network_access': {'key': 'egressPublicNetworkAccess', 'type': 'str'}, - 'endpoint_compute_type': {'key': 'endpointComputeType', 'type': 'str'}, - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'liveness_probe': {'key': 'livenessProbe', 'type': 'ProbeSettings'}, - 'model': {'key': 'model', 'type': 'str'}, - 'model_mount_path': {'key': 'modelMountPath', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'readiness_probe': {'key': 'readinessProbe', 'type': 'ProbeSettings'}, - 'request_settings': {'key': 'requestSettings', 'type': 'OnlineRequestSettings'}, - 'scale_settings': {'key': 'scaleSettings', 'type': 'OnlineScaleSettings'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'data_uri': {'key': 'dataUri', 'type': 'str'}, + 'referenced_uris': {'key': 'referencedUris', 'type': '[str]'}, } def __init__( @@ -17482,85 +19582,55 @@ def __init__( **kwargs ): """ - :keyword code_configuration: Code configuration for the endpoint deployment. - :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration - :keyword description: Description of the endpoint deployment. + :keyword description: The asset description text. :paramtype description: str - :keyword environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. - :paramtype environment_id: str - :keyword environment_variables: Environment variables configuration for the deployment. - :paramtype environment_variables: dict[str, str] - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :keyword properties: The asset property dictionary. :paramtype properties: dict[str, str] - :keyword app_insights_enabled: If true, enables Application Insights logging. - :paramtype app_insights_enabled: bool - :keyword data_collector: The mdc configuration, we disable mdc when it's null. - :paramtype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector - :keyword egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", - "Disabled". - :paramtype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :keyword instance_type: Compute instance type. - :paramtype instance_type: str - :keyword liveness_probe: Liveness probe monitors the health of the container regularly. - :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword model: The URI path to the model. - :paramtype model: str - :keyword model_mount_path: The path to mount the model in custom container. - :paramtype model_mount_path: str - :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword request_settings: Request settings for the deployment. - :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :keyword scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword data_uri: Required. [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. + :paramtype data_uri: str + :keyword referenced_uris: Uris referenced in the MLTable definition (required for lineage). + :paramtype referenced_uris: list[str] """ - super(ManagedOnlineDeployment, self).__init__(**kwargs) - self.endpoint_compute_type = 'Managed' # type: str - + super(MLTableData, self).__init__(**kwargs) + self.data_type = 'mltable' # type: str + self.referenced_uris = kwargs.get('referenced_uris', None) -class ManagedServiceIdentity(msrest.serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - Variables are only populated by the server, and will be ignored when sending a request. +class MLTableJobInput(JobInput, AssetJobInput): + """MLTableJobInput. All required parameters must be populated in order to send to Azure. - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Required. Type of managed service identity (where both SystemAssigned and - UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] + :ivar mode: Input Asset Delivery Mode. Possible values include: "ReadOnlyMount", + "ReadWriteMount", "Download", "Direct", "EvalMount", "EvalDownload". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode + :ivar uri: Required. [Required] Input Asset URI. + :vartype uri: str + :ivar description: Description for the input. + :vartype description: str + :ivar job_input_type: Required. [Required] Specifies the type of job.Constant filled by server. + Possible values include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", + "mlflow_model", "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True}, + 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'job_input_type': {'required': True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, } def __init__( @@ -17568,47 +19638,48 @@ def __init__( **kwargs ): """ - :keyword type: Required. Type of managed service identity (where both SystemAssigned and - UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] + :keyword mode: Input Asset Delivery Mode. Possible values include: "ReadOnlyMount", + "ReadWriteMount", "Download", "Direct", "EvalMount", "EvalDownload". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode + :keyword uri: Required. [Required] Input Asset URI. + :paramtype uri: str + :keyword description: Description for the input. + :paramtype description: str """ - super(ManagedServiceIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs['type'] - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + super(MLTableJobInput, self).__init__(**kwargs) + self.mode = kwargs.get('mode', None) + self.uri = kwargs['uri'] + self.job_input_type = 'mltable' # type: str + self.description = kwargs.get('description', None) -class MarketplacePlan(msrest.serialization.Model): - """MarketplacePlan. +class MLTableJobOutput(JobOutput, AssetJobOutput): + """MLTableJobOutput. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar offer_id: The identifying name of the Offer of the Marketplace Plan. - :vartype offer_id: str - :ivar plan_id: The identifying name of the Plan of the Marketplace Plan. - :vartype plan_id: str - :ivar publisher_id: The identifying name of the Publisher of the Marketplace Plan. - :vartype publisher_id: str + :ivar mode: Output Asset Delivery Mode. Possible values include: "ReadWriteMount", "Upload", + "Direct". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :ivar uri: Output Asset URI. + :vartype uri: str + :ivar description: Description for the output. + :vartype description: str + :ivar job_output_type: Required. [Required] Specifies the type of job.Constant filled by + server. Possible values include: "uri_file", "uri_folder", "mltable", "custom_model", + "mlflow_model", "triton_model". + :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType """ _validation = { - 'offer_id': {'readonly': True}, - 'plan_id': {'readonly': True}, - 'publisher_id': {'readonly': True}, + 'job_output_type': {'required': True}, } _attribute_map = { - 'offer_id': {'key': 'offerId', 'type': 'str'}, - 'plan_id': {'key': 'planId', 'type': 'str'}, - 'publisher_id': {'key': 'publisherId', 'type': 'str'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'job_output_type': {'key': 'jobOutputType', 'type': 'str'}, } def __init__( @@ -17616,14 +19687,22 @@ def __init__( **kwargs ): """ + :keyword mode: Output Asset Delivery Mode. Possible values include: "ReadWriteMount", "Upload", + "Direct". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :keyword uri: Output Asset URI. + :paramtype uri: str + :keyword description: Description for the output. + :paramtype description: str """ - super(MarketplacePlan, self).__init__(**kwargs) - self.offer_id = None - self.plan_id = None - self.publisher_id = None + super(MLTableJobOutput, self).__init__(**kwargs) + self.mode = kwargs.get('mode', None) + self.uri = kwargs.get('uri', None) + self.job_output_type = 'mltable' # type: str + self.description = kwargs.get('description', None) -class MarketplaceSubscription(ProxyResource): +class ModelContainer(ProxyResource): """Azure Resource Manager resource envelope. Variables are only populated by the server, and will be ignored when sending a request. @@ -17642,8 +19721,7 @@ class MarketplaceSubscription(ProxyResource): information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: - ~azure.mgmt.machinelearningservices.models.MarketplaceSubscriptionProperties + :vartype properties: ~azure.mgmt.machinelearningservices.models.ModelContainerProperties """ _validation = { @@ -17659,7 +19737,7 @@ class MarketplaceSubscription(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'MarketplaceSubscriptionProperties'}, + 'properties': {'key': 'properties', 'type': 'ModelContainerProperties'}, } def __init__( @@ -17668,46 +19746,48 @@ def __init__( ): """ :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: - ~azure.mgmt.machinelearningservices.models.MarketplaceSubscriptionProperties + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelContainerProperties """ - super(MarketplaceSubscription, self).__init__(**kwargs) + super(ModelContainer, self).__init__(**kwargs) self.properties = kwargs['properties'] -class MarketplaceSubscriptionProperties(msrest.serialization.Model): - """MarketplaceSubscriptionProperties. +class ModelContainerProperties(AssetContainer): + """ModelContainerProperties. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar marketplace_plan: Marketplace Plan associated with the Marketplace Subscription. - :vartype marketplace_plan: ~azure.mgmt.machinelearningservices.models.MarketplacePlan - :ivar marketplace_subscription_status: Current status of the Marketplace Subscription. Possible - values include: "Subscribed", "Suspended", "Unsubscribed". - :vartype marketplace_subscription_status: str or - ~azure.mgmt.machinelearningservices.models.MarketplaceSubscriptionStatus - :ivar model_id: Required. [Required] Target Marketplace Model ID to create a Marketplace - Subscription for. - :vartype model_id: str - :ivar provisioning_state: Provisioning State of the Marketplace Subscription. Possible values - include: "Creating", "Deleting", "Succeeded", "Failed", "Updating", "Canceled". + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar latest_version: The latest version inside this container. + :vartype latest_version: str + :ivar next_version: The next auto incremental version. + :vartype next_version: str + :ivar provisioning_state: Provisioning state for the model container. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.MarketplaceSubscriptionProvisioningState + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ _validation = { - 'marketplace_plan': {'readonly': True}, - 'marketplace_subscription_status': {'readonly': True}, - 'model_id': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'latest_version': {'readonly': True}, + 'next_version': {'readonly': True}, 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'marketplace_plan': {'key': 'marketplacePlan', 'type': 'MarketplacePlan'}, - 'marketplace_subscription_status': {'key': 'marketplaceSubscriptionStatus', 'type': 'str'}, - 'model_id': {'key': 'modelId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'latest_version': {'key': 'latestVersion', 'type': 'str'}, + 'next_version': {'key': 'nextVersion', 'type': 'str'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } @@ -17716,30 +19796,32 @@ def __init__( **kwargs ): """ - :keyword model_id: Required. [Required] Target Marketplace Model ID to create a Marketplace - Subscription for. - :paramtype model_id: str + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool """ - super(MarketplaceSubscriptionProperties, self).__init__(**kwargs) - self.marketplace_plan = None - self.marketplace_subscription_status = None - self.model_id = kwargs['model_id'] + super(ModelContainerProperties, self).__init__(**kwargs) self.provisioning_state = None -class MarketplaceSubscriptionResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of MarketplaceSubscription entities. +class ModelContainerResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of ModelContainer entities. - :ivar next_link: The link to the next page of MarketplaceSubscription objects. If null, there - are no additional pages. + :ivar next_link: The link to the next page of ModelContainer objects. If null, there are no + additional pages. :vartype next_link: str - :ivar value: An array of objects of type MarketplaceSubscription. - :vartype value: list[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] + :ivar value: An array of objects of type ModelContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ModelContainer] """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[MarketplaceSubscription]'}, + 'value': {'key': 'value', 'type': '[ModelContainer]'}, } def __init__( @@ -17747,157 +19829,26 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of MarketplaceSubscription objects. If null, - there are no additional pages. + :keyword next_link: The link to the next page of ModelContainer objects. If null, there are no + additional pages. :paramtype next_link: str - :keyword value: An array of objects of type MarketplaceSubscription. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] - """ - super(MarketplaceSubscriptionResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class MaterializationComputeResource(msrest.serialization.Model): - """DTO object representing compute resource. - - :ivar instance_type: Specifies the instance type. - :vartype instance_type: str - """ - - _attribute_map = { - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword instance_type: Specifies the instance type. - :paramtype instance_type: str - """ - super(MaterializationComputeResource, self).__init__(**kwargs) - self.instance_type = kwargs.get('instance_type', None) - - -class MaterializationSettings(msrest.serialization.Model): - """MaterializationSettings. - - :ivar notification: Specifies the notification details. - :vartype notification: ~azure.mgmt.machinelearningservices.models.NotificationSetting - :ivar resource: Specifies the compute resource settings. - :vartype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource - :ivar schedule: Specifies the schedule details. - :vartype schedule: ~azure.mgmt.machinelearningservices.models.RecurrenceTrigger - :ivar spark_configuration: Specifies the spark compute settings. - :vartype spark_configuration: dict[str, str] - :ivar store_type: Specifies the stores to which materialization should happen. Possible values - include: "None", "Online", "Offline", "OnlineAndOffline". - :vartype store_type: str or ~azure.mgmt.machinelearningservices.models.MaterializationStoreType - """ - - _attribute_map = { - 'notification': {'key': 'notification', 'type': 'NotificationSetting'}, - 'resource': {'key': 'resource', 'type': 'MaterializationComputeResource'}, - 'schedule': {'key': 'schedule', 'type': 'RecurrenceTrigger'}, - 'spark_configuration': {'key': 'sparkConfiguration', 'type': '{str}'}, - 'store_type': {'key': 'storeType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword notification: Specifies the notification details. - :paramtype notification: ~azure.mgmt.machinelearningservices.models.NotificationSetting - :keyword resource: Specifies the compute resource settings. - :paramtype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource - :keyword schedule: Specifies the schedule details. - :paramtype schedule: ~azure.mgmt.machinelearningservices.models.RecurrenceTrigger - :keyword spark_configuration: Specifies the spark compute settings. - :paramtype spark_configuration: dict[str, str] - :keyword store_type: Specifies the stores to which materialization should happen. Possible - values include: "None", "Online", "Offline", "OnlineAndOffline". - :paramtype store_type: str or - ~azure.mgmt.machinelearningservices.models.MaterializationStoreType - """ - super(MaterializationSettings, self).__init__(**kwargs) - self.notification = kwargs.get('notification', None) - self.resource = kwargs.get('resource', None) - self.schedule = kwargs.get('schedule', None) - self.spark_configuration = kwargs.get('spark_configuration', None) - self.store_type = kwargs.get('store_type', None) - - -class MedianStoppingPolicy(EarlyTerminationPolicy): - """Defines an early termination policy based on running averages of the primary metric of all runs. - - All required parameters must be populated in order to send to Azure. - - :ivar delay_evaluation: Number of intervals by which to delay the first evaluation. - :vartype delay_evaluation: int - :ivar evaluation_interval: Interval (number of runs) between policy evaluations. - :vartype evaluation_interval: int - :ivar policy_type: Required. [Required] Name of policy configuration.Constant filled by server. - Possible values include: "Bandit", "MedianStopping", "TruncationSelection". - :vartype policy_type: str or - ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicyType - """ - - _validation = { - 'policy_type': {'required': True}, - } - - _attribute_map = { - 'delay_evaluation': {'key': 'delayEvaluation', 'type': 'int'}, - 'evaluation_interval': {'key': 'evaluationInterval', 'type': 'int'}, - 'policy_type': {'key': 'policyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword delay_evaluation: Number of intervals by which to delay the first evaluation. - :paramtype delay_evaluation: int - :keyword evaluation_interval: Interval (number of runs) between policy evaluations. - :paramtype evaluation_interval: int + :keyword value: An array of objects of type ModelContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.ModelContainer] """ - super(MedianStoppingPolicy, self).__init__(**kwargs) - self.policy_type = 'MedianStopping' # type: str - + super(ModelContainerResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) -class MLFlowModelJobInput(JobInput, AssetJobInput): - """MLFlowModelJobInput. - All required parameters must be populated in order to send to Azure. +class ModelSettings(msrest.serialization.Model): + """ModelSettings. - :ivar mode: Input Asset Delivery Mode. Possible values include: "ReadOnlyMount", - "ReadWriteMount", "Download", "Direct", "EvalMount", "EvalDownload". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode - :ivar uri: Required. [Required] Input Asset URI. - :vartype uri: str - :ivar description: Description for the input. - :vartype description: str - :ivar job_input_type: Required. [Required] Specifies the type of job.Constant filled by server. - Possible values include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", - "mlflow_model", "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar model_id: The unique model identifier that this ServerlessEndpoint should provision. + :vartype model_id: str """ - _validation = { - 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, - 'job_input_type': {'required': True}, - } - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, + 'model_id': {'key': 'modelId', 'type': 'str'}, } def __init__( @@ -17905,48 +19856,49 @@ def __init__( **kwargs ): """ - :keyword mode: Input Asset Delivery Mode. Possible values include: "ReadOnlyMount", - "ReadWriteMount", "Download", "Direct", "EvalMount", "EvalDownload". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode - :keyword uri: Required. [Required] Input Asset URI. - :paramtype uri: str - :keyword description: Description for the input. - :paramtype description: str + :keyword model_id: The unique model identifier that this ServerlessEndpoint should provision. + :paramtype model_id: str """ - super(MLFlowModelJobInput, self).__init__(**kwargs) - self.mode = kwargs.get('mode', None) - self.uri = kwargs['uri'] - self.job_input_type = 'mlflow_model' # type: str - self.description = kwargs.get('description', None) + super(ModelSettings, self).__init__(**kwargs) + self.model_id = kwargs.get('model_id', None) -class MLFlowModelJobOutput(JobOutput, AssetJobOutput): - """MLFlowModelJobOutput. +class ModelVersion(ProxyResource): + """Azure Resource Manager resource envelope. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar mode: Output Asset Delivery Mode. Possible values include: "ReadWriteMount", "Upload", - "Direct". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode - :ivar uri: Output Asset URI. - :vartype uri: str - :ivar description: Description for the output. - :vartype description: str - :ivar job_output_type: Required. [Required] Specifies the type of job.Constant filled by - server. Possible values include: "uri_file", "uri_folder", "mltable", "custom_model", - "mlflow_model", "triton_model". - :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.ModelVersionProperties """ _validation = { - 'job_output_type': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, } _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'job_output_type': {'key': 'jobOutputType', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ModelVersionProperties'}, } def __init__( @@ -17954,25 +19906,17 @@ def __init__( **kwargs ): """ - :keyword mode: Output Asset Delivery Mode. Possible values include: "ReadWriteMount", "Upload", - "Direct". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode - :keyword uri: Output Asset URI. - :paramtype uri: str - :keyword description: Description for the output. - :paramtype description: str + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelVersionProperties """ - super(MLFlowModelJobOutput, self).__init__(**kwargs) - self.mode = kwargs.get('mode', None) - self.uri = kwargs.get('uri', None) - self.job_output_type = 'mlflow_model' # type: str - self.description = kwargs.get('description', None) + super(ModelVersion, self).__init__(**kwargs) + self.properties = kwargs['properties'] -class MLTableData(DataVersionBaseProperties): - """MLTable data definition. +class ModelVersionProperties(AssetBase): + """Model asset version details. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. :ivar description: The asset description text. :vartype description: str @@ -17984,19 +19928,24 @@ class MLTableData(DataVersionBaseProperties): :vartype is_anonymous: bool :ivar is_archived: Is the asset archived?. :vartype is_archived: bool - :ivar data_type: Required. [Required] Specifies the type of data.Constant filled by server. - Possible values include: "uri_file", "uri_folder", "mltable". - :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.DataType - :ivar data_uri: Required. [Required] Uri of the data. Example: - https://go.microsoft.com/fwlink/?linkid=2202330. - :vartype data_uri: str - :ivar referenced_uris: Uris referenced in the MLTable definition (required for lineage). - :vartype referenced_uris: list[str] + :ivar flavors: Mapping of model flavors to their properties. + :vartype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] + :ivar job_name: Name of the training job which produced this model. + :vartype job_name: str + :ivar model_type: The storage format for this entity. Used for NCD. + :vartype model_type: str + :ivar model_uri: The URI path to the model contents. + :vartype model_uri: str + :ivar provisioning_state: Provisioning state for the model version. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar stage: Stage in the model lifecycle assigned to this model. + :vartype stage: str """ _validation = { - 'data_type': {'required': True}, - 'data_uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { @@ -18005,9 +19954,12 @@ class MLTableData(DataVersionBaseProperties): 'tags': {'key': 'tags', 'type': '{str}'}, 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'data_uri': {'key': 'dataUri', 'type': 'str'}, - 'referenced_uris': {'key': 'referencedUris', 'type': '[str]'}, + 'flavors': {'key': 'flavors', 'type': '{FlavorData}'}, + 'job_name': {'key': 'jobName', 'type': 'str'}, + 'model_type': {'key': 'modelType', 'type': 'str'}, + 'model_uri': {'key': 'modelUri', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, } def __init__( @@ -18025,45 +19977,120 @@ def __init__( :paramtype is_anonymous: bool :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool - :keyword data_uri: Required. [Required] Uri of the data. Example: - https://go.microsoft.com/fwlink/?linkid=2202330. - :paramtype data_uri: str - :keyword referenced_uris: Uris referenced in the MLTable definition (required for lineage). - :paramtype referenced_uris: list[str] + :keyword flavors: Mapping of model flavors to their properties. + :paramtype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] + :keyword job_name: Name of the training job which produced this model. + :paramtype job_name: str + :keyword model_type: The storage format for this entity. Used for NCD. + :paramtype model_type: str + :keyword model_uri: The URI path to the model contents. + :paramtype model_uri: str + :keyword stage: Stage in the model lifecycle assigned to this model. + :paramtype stage: str """ - super(MLTableData, self).__init__(**kwargs) - self.data_type = 'mltable' # type: str - self.referenced_uris = kwargs.get('referenced_uris', None) + super(ModelVersionProperties, self).__init__(**kwargs) + self.flavors = kwargs.get('flavors', None) + self.job_name = kwargs.get('job_name', None) + self.model_type = kwargs.get('model_type', None) + self.model_uri = kwargs.get('model_uri', None) + self.provisioning_state = None + self.stage = kwargs.get('stage', None) -class MLTableJobInput(JobInput, AssetJobInput): - """MLTableJobInput. +class ModelVersionResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of ModelVersion entities. + + :ivar next_link: The link to the next page of ModelVersion objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type ModelVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ModelVersion] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[ModelVersion]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword next_link: The link to the next page of ModelVersion objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type ModelVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.ModelVersion] + """ + super(ModelVersionResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class MonitorComputeConfigurationBase(msrest.serialization.Model): + """Monitor compute configuration base definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MonitorServerlessSparkCompute. All required parameters must be populated in order to send to Azure. - :ivar mode: Input Asset Delivery Mode. Possible values include: "ReadOnlyMount", - "ReadWriteMount", "Download", "Direct", "EvalMount", "EvalDownload". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode - :ivar uri: Required. [Required] Input Asset URI. - :vartype uri: str - :ivar description: Description for the input. - :vartype description: str - :ivar job_input_type: Required. [Required] Specifies the type of job.Constant filled by server. - Possible values include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", - "mlflow_model", "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar compute_type: Required. [Required] Specifies the type of signal to monitor.Constant + filled by server. Possible values include: "ServerlessSpark". + :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.MonitorComputeType + """ + + _validation = { + 'compute_type': {'required': True}, + } + + _attribute_map = { + 'compute_type': {'key': 'computeType', 'type': 'str'}, + } + + _subtype_map = { + 'compute_type': {'ServerlessSpark': 'MonitorServerlessSparkCompute'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(MonitorComputeConfigurationBase, self).__init__(**kwargs) + self.compute_type = None # type: Optional[str] + + +class MonitorDefinition(msrest.serialization.Model): + """MonitorDefinition. + + All required parameters must be populated in order to send to Azure. + + :ivar alert_notification_settings: The monitor's notification settings. + :vartype alert_notification_settings: + ~azure.mgmt.machinelearningservices.models.MonitorNotificationSettings + :ivar compute_configuration: Required. [Required] The ARM resource ID of the compute resource + to run the monitoring job on. + :vartype compute_configuration: + ~azure.mgmt.machinelearningservices.models.MonitorComputeConfigurationBase + :ivar monitoring_target: The entities targeted by the monitor. + :vartype monitoring_target: ~azure.mgmt.machinelearningservices.models.MonitoringTarget + :ivar signals: Required. [Required] The signals to monitor. + :vartype signals: dict[str, ~azure.mgmt.machinelearningservices.models.MonitoringSignalBase] """ _validation = { - 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, - 'job_input_type': {'required': True}, + 'compute_configuration': {'required': True}, + 'signals': {'required': True}, } _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, + 'alert_notification_settings': {'key': 'alertNotificationSettings', 'type': 'MonitorNotificationSettings'}, + 'compute_configuration': {'key': 'computeConfiguration', 'type': 'MonitorComputeConfigurationBase'}, + 'monitoring_target': {'key': 'monitoringTarget', 'type': 'MonitoringTarget'}, + 'signals': {'key': 'signals', 'type': '{MonitoringSignalBase}'}, } def __init__( @@ -18071,48 +20098,34 @@ def __init__( **kwargs ): """ - :keyword mode: Input Asset Delivery Mode. Possible values include: "ReadOnlyMount", - "ReadWriteMount", "Download", "Direct", "EvalMount", "EvalDownload". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode - :keyword uri: Required. [Required] Input Asset URI. - :paramtype uri: str - :keyword description: Description for the input. - :paramtype description: str + :keyword alert_notification_settings: The monitor's notification settings. + :paramtype alert_notification_settings: + ~azure.mgmt.machinelearningservices.models.MonitorNotificationSettings + :keyword compute_configuration: Required. [Required] The ARM resource ID of the compute + resource to run the monitoring job on. + :paramtype compute_configuration: + ~azure.mgmt.machinelearningservices.models.MonitorComputeConfigurationBase + :keyword monitoring_target: The entities targeted by the monitor. + :paramtype monitoring_target: ~azure.mgmt.machinelearningservices.models.MonitoringTarget + :keyword signals: Required. [Required] The signals to monitor. + :paramtype signals: dict[str, ~azure.mgmt.machinelearningservices.models.MonitoringSignalBase] """ - super(MLTableJobInput, self).__init__(**kwargs) - self.mode = kwargs.get('mode', None) - self.uri = kwargs['uri'] - self.job_input_type = 'mltable' # type: str - self.description = kwargs.get('description', None) - + super(MonitorDefinition, self).__init__(**kwargs) + self.alert_notification_settings = kwargs.get('alert_notification_settings', None) + self.compute_configuration = kwargs['compute_configuration'] + self.monitoring_target = kwargs.get('monitoring_target', None) + self.signals = kwargs['signals'] -class MLTableJobOutput(JobOutput, AssetJobOutput): - """MLTableJobOutput. - All required parameters must be populated in order to send to Azure. +class MonitorEmailNotificationSettings(msrest.serialization.Model): + """MonitorEmailNotificationSettings. - :ivar mode: Output Asset Delivery Mode. Possible values include: "ReadWriteMount", "Upload", - "Direct". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode - :ivar uri: Output Asset URI. - :vartype uri: str - :ivar description: Description for the output. - :vartype description: str - :ivar job_output_type: Required. [Required] Specifies the type of job.Constant filled by - server. Possible values include: "uri_file", "uri_folder", "mltable", "custom_model", - "mlflow_model", "triton_model". - :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType + :ivar emails: The email recipient list which has a limitation of 499 characters in total. + :vartype emails: list[str] """ - _validation = { - 'job_output_type': {'required': True}, - } - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'job_output_type': {'key': 'jobOutputType', 'type': 'str'}, + 'emails': {'key': 'emails', 'type': '[str]'}, } def __init__( @@ -18120,57 +20133,35 @@ def __init__( **kwargs ): """ - :keyword mode: Output Asset Delivery Mode. Possible values include: "ReadWriteMount", "Upload", - "Direct". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode - :keyword uri: Output Asset URI. - :paramtype uri: str - :keyword description: Description for the output. - :paramtype description: str + :keyword emails: The email recipient list which has a limitation of 499 characters in total. + :paramtype emails: list[str] """ - super(MLTableJobOutput, self).__init__(**kwargs) - self.mode = kwargs.get('mode', None) - self.uri = kwargs.get('uri', None) - self.job_output_type = 'mltable' # type: str - self.description = kwargs.get('description', None) - + super(MonitorEmailNotificationSettings, self).__init__(**kwargs) + self.emails = kwargs.get('emails', None) -class ModelContainer(ProxyResource): - """Azure Resource Manager resource envelope. - Variables are only populated by the server, and will be ignored when sending a request. +class MonitoringTarget(msrest.serialization.Model): + """Monitoring target definition. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ModelContainerProperties + :ivar deployment_id: Reference to the deployment asset targeted by this monitor. + :vartype deployment_id: str + :ivar model_id: Reference to the model asset targeted by this monitor. + :vartype model_id: str + :ivar task_type: Required. [Required] The machine learning task type of the monitored model. + Possible values include: "Classification", "Regression". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.ModelTaskType """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, + 'task_type': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'ModelContainerProperties'}, + 'deployment_id': {'key': 'deploymentId', 'type': 'str'}, + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'task_type': {'key': 'taskType', 'type': 'str'}, } def __init__( @@ -18178,50 +20169,29 @@ def __init__( **kwargs ): """ - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelContainerProperties + :keyword deployment_id: Reference to the deployment asset targeted by this monitor. + :paramtype deployment_id: str + :keyword model_id: Reference to the model asset targeted by this monitor. + :paramtype model_id: str + :keyword task_type: Required. [Required] The machine learning task type of the monitored model. + Possible values include: "Classification", "Regression". + :paramtype task_type: str or ~azure.mgmt.machinelearningservices.models.ModelTaskType """ - super(ModelContainer, self).__init__(**kwargs) - self.properties = kwargs['properties'] - + super(MonitoringTarget, self).__init__(**kwargs) + self.deployment_id = kwargs.get('deployment_id', None) + self.model_id = kwargs.get('model_id', None) + self.task_type = kwargs['task_type'] -class ModelContainerProperties(AssetContainer): - """ModelContainerProperties. - Variables are only populated by the server, and will be ignored when sending a request. +class MonitoringThreshold(msrest.serialization.Model): + """MonitoringThreshold. - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar latest_version: The latest version inside this container. - :vartype latest_version: str - :ivar next_version: The next auto incremental version. - :vartype next_version: str - :ivar provisioning_state: Provisioning state for the model container. Possible values include: - "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar value: The threshold value. If null, the set default is dependent on the metric type. + :vartype value: float """ - _validation = { - 'latest_version': {'readonly': True}, - 'next_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'latest_version': {'key': 'latestVersion', 'type': 'str'}, - 'next_version': {'key': 'nextVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'float'}, } def __init__( @@ -18229,32 +20199,23 @@ def __init__( **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool + :keyword value: The threshold value. If null, the set default is dependent on the metric type. + :paramtype value: float """ - super(ModelContainerProperties, self).__init__(**kwargs) - self.provisioning_state = None + super(MonitoringThreshold, self).__init__(**kwargs) + self.value = kwargs.get('value', None) -class ModelContainerResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of ModelContainer entities. +class MonitorNotificationSettings(msrest.serialization.Model): + """MonitorNotificationSettings. - :ivar next_link: The link to the next page of ModelContainer objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type ModelContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ModelContainer] + :ivar email_notification_settings: The AML notification email settings. + :vartype email_notification_settings: + ~azure.mgmt.machinelearningservices.models.MonitorEmailNotificationSettings """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ModelContainer]'}, + 'email_notification_settings': {'key': 'emailNotificationSettings', 'type': 'MonitorEmailNotificationSettings'}, } def __init__( @@ -18262,26 +20223,44 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of ModelContainer objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type ModelContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.ModelContainer] + :keyword email_notification_settings: The AML notification email settings. + :paramtype email_notification_settings: + ~azure.mgmt.machinelearningservices.models.MonitorEmailNotificationSettings """ - super(ModelContainerResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) + super(MonitorNotificationSettings, self).__init__(**kwargs) + self.email_notification_settings = kwargs.get('email_notification_settings', None) -class ModelSettings(msrest.serialization.Model): - """ModelSettings. +class MonitorServerlessSparkCompute(MonitorComputeConfigurationBase): + """Monitor serverless spark compute definition. - :ivar model_id: The unique model identifier that this ServerlessEndpoint should provision. - :vartype model_id: str + All required parameters must be populated in order to send to Azure. + + :ivar compute_type: Required. [Required] Specifies the type of signal to monitor.Constant + filled by server. Possible values include: "ServerlessSpark". + :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.MonitorComputeType + :ivar compute_identity: Required. [Required] The identity scheme leveraged to by the spark jobs + running on serverless Spark. + :vartype compute_identity: + ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityBase + :ivar instance_type: Required. [Required] The instance type running the Spark job. + :vartype instance_type: str + :ivar runtime_version: Required. [Required] The Spark runtime version. + :vartype runtime_version: str """ + _validation = { + 'compute_type': {'required': True}, + 'compute_identity': {'required': True}, + 'instance_type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'runtime_version': {'required': True, 'min_length': 1, 'pattern': r'^[0-9]+\.[0-9]+$'}, + } + _attribute_map = { - 'model_id': {'key': 'modelId', 'type': 'str'}, + 'compute_type': {'key': 'computeType', 'type': 'str'}, + 'compute_identity': {'key': 'computeIdentity', 'type': 'MonitorComputeIdentityBase'}, + 'instance_type': {'key': 'instanceType', 'type': 'str'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, } def __init__( @@ -18289,49 +20268,41 @@ def __init__( **kwargs ): """ - :keyword model_id: The unique model identifier that this ServerlessEndpoint should provision. - :paramtype model_id: str + :keyword compute_identity: Required. [Required] The identity scheme leveraged to by the spark + jobs running on serverless Spark. + :paramtype compute_identity: + ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityBase + :keyword instance_type: Required. [Required] The instance type running the Spark job. + :paramtype instance_type: str + :keyword runtime_version: Required. [Required] The Spark runtime version. + :paramtype runtime_version: str """ - super(ModelSettings, self).__init__(**kwargs) - self.model_id = kwargs.get('model_id', None) - + super(MonitorServerlessSparkCompute, self).__init__(**kwargs) + self.compute_type = 'ServerlessSpark' # type: str + self.compute_identity = kwargs['compute_identity'] + self.instance_type = kwargs['instance_type'] + self.runtime_version = kwargs['runtime_version'] -class ModelVersion(ProxyResource): - """Azure Resource Manager resource envelope. - Variables are only populated by the server, and will be ignored when sending a request. +class Mpi(DistributionConfiguration): + """MPI distribution configuration. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ModelVersionProperties + :ivar distribution_type: Required. [Required] Specifies the type of distribution + framework.Constant filled by server. Possible values include: "PyTorch", "TensorFlow", "Mpi". + :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType + :ivar process_count_per_instance: Number of processes per MPI node. + :vartype process_count_per_instance: int """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, + 'distribution_type': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'ModelVersionProperties'}, + 'distribution_type': {'key': 'distributionType', 'type': 'str'}, + 'process_count_per_instance': {'key': 'processCountPerInstance', 'type': 'int'}, } def __init__( @@ -18339,60 +20310,31 @@ def __init__( **kwargs ): """ - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelVersionProperties + :keyword process_count_per_instance: Number of processes per MPI node. + :paramtype process_count_per_instance: int """ - super(ModelVersion, self).__init__(**kwargs) - self.properties = kwargs['properties'] - + super(Mpi, self).__init__(**kwargs) + self.distribution_type = 'Mpi' # type: str + self.process_count_per_instance = kwargs.get('process_count_per_instance', None) -class ModelVersionProperties(AssetBase): - """Model asset version details. - Variables are only populated by the server, and will be ignored when sending a request. +class NlpVertical(msrest.serialization.Model): + """Abstract class for NLP related AutoML tasks. +NLP - Natural Language Processing. - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar flavors: Mapping of model flavors to their properties. - :vartype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] - :ivar job_name: Name of the training job which produced this model. - :vartype job_name: str - :ivar model_type: The storage format for this entity. Used for NCD. - :vartype model_type: str - :ivar model_uri: The URI path to the model contents. - :vartype model_uri: str - :ivar provisioning_state: Provisioning state for the model version. Possible values include: - "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState - :ivar stage: Stage in the model lifecycle assigned to this model. - :vartype stage: str + :ivar featurization_settings: Featurization inputs needed for AutoML job. + :vartype featurization_settings: + ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :ivar limit_settings: Execution constraints for AutoMLJob. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput """ - _validation = { - 'provisioning_state': {'readonly': True}, - } - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'flavors': {'key': 'flavors', 'type': '{FlavorData}'}, - 'job_name': {'key': 'jobName', 'type': 'str'}, - 'model_type': {'key': 'modelType', 'type': 'str'}, - 'model_uri': {'key': 'modelUri', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'stage': {'key': 'stage', 'type': 'str'}, + 'featurization_settings': {'key': 'featurizationSettings', 'type': 'NlpVerticalFeaturizationSettings'}, + 'limit_settings': {'key': 'limitSettings', 'type': 'NlpVerticalLimitSettings'}, + 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, } def __init__( @@ -18400,49 +20342,29 @@ def __init__( **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword flavors: Mapping of model flavors to their properties. - :paramtype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] - :keyword job_name: Name of the training job which produced this model. - :paramtype job_name: str - :keyword model_type: The storage format for this entity. Used for NCD. - :paramtype model_type: str - :keyword model_uri: The URI path to the model contents. - :paramtype model_uri: str - :keyword stage: Stage in the model lifecycle assigned to this model. - :paramtype stage: str + :keyword featurization_settings: Featurization inputs needed for AutoML job. + :paramtype featurization_settings: + ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput """ - super(ModelVersionProperties, self).__init__(**kwargs) - self.flavors = kwargs.get('flavors', None) - self.job_name = kwargs.get('job_name', None) - self.model_type = kwargs.get('model_type', None) - self.model_uri = kwargs.get('model_uri', None) - self.provisioning_state = None - self.stage = kwargs.get('stage', None) + super(NlpVertical, self).__init__(**kwargs) + self.featurization_settings = kwargs.get('featurization_settings', None) + self.limit_settings = kwargs.get('limit_settings', None) + self.validation_data = kwargs.get('validation_data', None) -class ModelVersionResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of ModelVersion entities. +class NlpVerticalFeaturizationSettings(FeaturizationSettings): + """NlpVerticalFeaturizationSettings. - :ivar next_link: The link to the next page of ModelVersion objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type ModelVersion. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ModelVersion] + :ivar dataset_language: Dataset language, useful for the text data. + :vartype dataset_language: str """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ModelVersion]'}, + 'dataset_language': {'key': 'datasetLanguage', 'type': 'str'}, } def __init__( @@ -18450,40 +20372,27 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of ModelVersion objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type ModelVersion. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.ModelVersion] + :keyword dataset_language: Dataset language, useful for the text data. + :paramtype dataset_language: str """ - super(ModelVersionResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class MonitorComputeConfigurationBase(msrest.serialization.Model): - """Monitor compute configuration base definition. + super(NlpVerticalFeaturizationSettings, self).__init__(**kwargs) - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: MonitorServerlessSparkCompute. - All required parameters must be populated in order to send to Azure. +class NlpVerticalLimitSettings(msrest.serialization.Model): + """Job execution constraints. - :ivar compute_type: Required. [Required] Specifies the type of signal to monitor.Constant - filled by server. Possible values include: "ServerlessSpark". - :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.MonitorComputeType + :ivar max_concurrent_trials: Maximum Concurrent AutoML iterations. + :vartype max_concurrent_trials: int + :ivar max_trials: Number of AutoML iterations. + :vartype max_trials: int + :ivar timeout: AutoML job timeout. + :vartype timeout: ~datetime.timedelta """ - _validation = { - 'compute_type': {'required': True}, - } - _attribute_map = { - 'compute_type': {'key': 'computeType', 'type': 'str'}, - } - - _subtype_map = { - 'compute_type': {'ServerlessSpark': 'MonitorServerlessSparkCompute'} + 'max_concurrent_trials': {'key': 'maxConcurrentTrials', 'type': 'int'}, + 'max_trials': {'key': 'maxTrials', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'duration'}, } def __init__( @@ -18491,39 +20400,54 @@ def __init__( **kwargs ): """ + :keyword max_concurrent_trials: Maximum Concurrent AutoML iterations. + :paramtype max_concurrent_trials: int + :keyword max_trials: Number of AutoML iterations. + :paramtype max_trials: int + :keyword timeout: AutoML job timeout. + :paramtype timeout: ~datetime.timedelta """ - super(MonitorComputeConfigurationBase, self).__init__(**kwargs) - self.compute_type = None # type: Optional[str] + super(NlpVerticalLimitSettings, self).__init__(**kwargs) + self.max_concurrent_trials = kwargs.get('max_concurrent_trials', 1) + self.max_trials = kwargs.get('max_trials', 1) + self.timeout = kwargs.get('timeout', "P7D") -class MonitorDefinition(msrest.serialization.Model): - """MonitorDefinition. +class NodeStateCounts(msrest.serialization.Model): + """Counts of various compute node states on the amlCompute. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar alert_notification_settings: The monitor's notification settings. - :vartype alert_notification_settings: - ~azure.mgmt.machinelearningservices.models.MonitorNotificationSettings - :ivar compute_configuration: Required. [Required] The ARM resource ID of the compute resource - to run the monitoring job on. - :vartype compute_configuration: - ~azure.mgmt.machinelearningservices.models.MonitorComputeConfigurationBase - :ivar monitoring_target: The entities targeted by the monitor. - :vartype monitoring_target: ~azure.mgmt.machinelearningservices.models.MonitoringTarget - :ivar signals: Required. [Required] The signals to monitor. - :vartype signals: dict[str, ~azure.mgmt.machinelearningservices.models.MonitoringSignalBase] + :ivar idle_node_count: Number of compute nodes in idle state. + :vartype idle_node_count: int + :ivar running_node_count: Number of compute nodes which are running jobs. + :vartype running_node_count: int + :ivar preparing_node_count: Number of compute nodes which are being prepared. + :vartype preparing_node_count: int + :ivar unusable_node_count: Number of compute nodes which are in unusable state. + :vartype unusable_node_count: int + :ivar leaving_node_count: Number of compute nodes which are leaving the amlCompute. + :vartype leaving_node_count: int + :ivar preempted_node_count: Number of compute nodes which are in preempted state. + :vartype preempted_node_count: int """ _validation = { - 'compute_configuration': {'required': True}, - 'signals': {'required': True}, + 'idle_node_count': {'readonly': True}, + 'running_node_count': {'readonly': True}, + 'preparing_node_count': {'readonly': True}, + 'unusable_node_count': {'readonly': True}, + 'leaving_node_count': {'readonly': True}, + 'preempted_node_count': {'readonly': True}, } _attribute_map = { - 'alert_notification_settings': {'key': 'alertNotificationSettings', 'type': 'MonitorNotificationSettings'}, - 'compute_configuration': {'key': 'computeConfiguration', 'type': 'MonitorComputeConfigurationBase'}, - 'monitoring_target': {'key': 'monitoringTarget', 'type': 'MonitoringTarget'}, - 'signals': {'key': 'signals', 'type': '{MonitoringSignalBase}'}, + 'idle_node_count': {'key': 'idleNodeCount', 'type': 'int'}, + 'running_node_count': {'key': 'runningNodeCount', 'type': 'int'}, + 'preparing_node_count': {'key': 'preparingNodeCount', 'type': 'int'}, + 'unusable_node_count': {'key': 'unusableNodeCount', 'type': 'int'}, + 'leaving_node_count': {'key': 'leavingNodeCount', 'type': 'int'}, + 'preempted_node_count': {'key': 'preemptedNodeCount', 'type': 'int'}, } def __init__( @@ -18531,34 +20455,91 @@ def __init__( **kwargs ): """ - :keyword alert_notification_settings: The monitor's notification settings. - :paramtype alert_notification_settings: - ~azure.mgmt.machinelearningservices.models.MonitorNotificationSettings - :keyword compute_configuration: Required. [Required] The ARM resource ID of the compute - resource to run the monitoring job on. - :paramtype compute_configuration: - ~azure.mgmt.machinelearningservices.models.MonitorComputeConfigurationBase - :keyword monitoring_target: The entities targeted by the monitor. - :paramtype monitoring_target: ~azure.mgmt.machinelearningservices.models.MonitoringTarget - :keyword signals: Required. [Required] The signals to monitor. - :paramtype signals: dict[str, ~azure.mgmt.machinelearningservices.models.MonitoringSignalBase] """ - super(MonitorDefinition, self).__init__(**kwargs) - self.alert_notification_settings = kwargs.get('alert_notification_settings', None) - self.compute_configuration = kwargs['compute_configuration'] - self.monitoring_target = kwargs.get('monitoring_target', None) - self.signals = kwargs['signals'] + super(NodeStateCounts, self).__init__(**kwargs) + self.idle_node_count = None + self.running_node_count = None + self.preparing_node_count = None + self.unusable_node_count = None + self.leaving_node_count = None + self.preempted_node_count = None -class MonitorEmailNotificationSettings(msrest.serialization.Model): - """MonitorEmailNotificationSettings. +class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """NoneAuthTypeWorkspaceConnectionProperties. - :ivar emails: The email recipient list which has a limitation of 499 characters in total. - :vartype emails: list[str] + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar auth_type: Required. Authentication type of the connection target.Constant filled by + server. Possible values include: "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", + "AccountKey", "ServicePrincipal", "AccessKey", "ApiKey", "CustomKeys", "OAuth2", "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Possible values include: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", + "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", + "Serverless". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool """ + _validation = { + 'auth_type': {'required': True}, + 'created_by_workspace_arm_id': {'readonly': True}, + 'group': {'readonly': True}, + } + _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, + 'auth_type': {'key': 'authType', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, + 'group': {'key': 'group', 'type': 'str'}, + 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, + 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, } def __init__( @@ -18566,35 +20547,66 @@ def __init__( **kwargs ): """ - :keyword emails: The email recipient list which has a limitation of 499 characters in total. - :paramtype emails: list[str] + :keyword category: Category of the connection. Possible values include: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", + "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", + "Serverless". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool """ - super(MonitorEmailNotificationSettings, self).__init__(**kwargs) - self.emails = kwargs.get('emails', None) + super(NoneAuthTypeWorkspaceConnectionProperties, self).__init__(**kwargs) + self.auth_type = 'None' # type: str -class MonitoringTarget(msrest.serialization.Model): - """Monitoring target definition. +class NoneDatastoreCredentials(DatastoreCredentials): + """Empty/none datastore credentials. All required parameters must be populated in order to send to Azure. - :ivar deployment_id: Reference to the deployment asset targeted by this monitor. - :vartype deployment_id: str - :ivar model_id: Reference to the model asset targeted by this monitor. - :vartype model_id: str - :ivar task_type: Required. [Required] The machine learning task type of the monitored model. - Possible values include: "Classification", "Regression". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.ModelTaskType + :ivar credentials_type: Required. [Required] Credential type used to authentication with + storage.Constant filled by server. Possible values include: "AccountKey", "Certificate", + "None", "Sas", "ServicePrincipal". + :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType """ _validation = { - 'task_type': {'required': True}, + 'credentials_type': {'required': True}, } _attribute_map = { - 'deployment_id': {'key': 'deploymentId', 'type': 'str'}, - 'model_id': {'key': 'modelId', 'type': 'str'}, - 'task_type': {'key': 'taskType', 'type': 'str'}, + 'credentials_type': {'key': 'credentialsType', 'type': 'str'}, } def __init__( @@ -18602,53 +20614,54 @@ def __init__( **kwargs ): """ - :keyword deployment_id: Reference to the deployment asset targeted by this monitor. - :paramtype deployment_id: str - :keyword model_id: Reference to the model asset targeted by this monitor. - :paramtype model_id: str - :keyword task_type: Required. [Required] The machine learning task type of the monitored model. - Possible values include: "Classification", "Regression". - :paramtype task_type: str or ~azure.mgmt.machinelearningservices.models.ModelTaskType """ - super(MonitoringTarget, self).__init__(**kwargs) - self.deployment_id = kwargs.get('deployment_id', None) - self.model_id = kwargs.get('model_id', None) - self.task_type = kwargs['task_type'] + super(NoneDatastoreCredentials, self).__init__(**kwargs) + self.credentials_type = 'None' # type: str -class MonitoringThreshold(msrest.serialization.Model): - """MonitoringThreshold. +class NotebookAccessTokenResult(msrest.serialization.Model): + """NotebookAccessTokenResult. - :ivar value: The threshold value. If null, the set default is dependent on the metric type. - :vartype value: float + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar access_token: + :vartype access_token: str + :ivar expires_in: + :vartype expires_in: int + :ivar host_name: + :vartype host_name: str + :ivar notebook_resource_id: + :vartype notebook_resource_id: str + :ivar public_dns: + :vartype public_dns: str + :ivar refresh_token: + :vartype refresh_token: str + :ivar scope: + :vartype scope: str + :ivar token_type: + :vartype token_type: str """ - _attribute_map = { - 'value': {'key': 'value', 'type': 'float'}, + _validation = { + 'access_token': {'readonly': True}, + 'expires_in': {'readonly': True}, + 'host_name': {'readonly': True}, + 'notebook_resource_id': {'readonly': True}, + 'public_dns': {'readonly': True}, + 'refresh_token': {'readonly': True}, + 'scope': {'readonly': True}, + 'token_type': {'readonly': True}, } - def __init__( - self, - **kwargs - ): - """ - :keyword value: The threshold value. If null, the set default is dependent on the metric type. - :paramtype value: float - """ - super(MonitoringThreshold, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class MonitorNotificationSettings(msrest.serialization.Model): - """MonitorNotificationSettings. - - :ivar email_notification_settings: The AML notification email settings. - :vartype email_notification_settings: - ~azure.mgmt.machinelearningservices.models.MonitorEmailNotificationSettings - """ - _attribute_map = { - 'email_notification_settings': {'key': 'emailNotificationSettings', 'type': 'MonitorEmailNotificationSettings'}, + 'access_token': {'key': 'accessToken', 'type': 'str'}, + 'expires_in': {'key': 'expiresIn', 'type': 'int'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'notebook_resource_id': {'key': 'notebookResourceId', 'type': 'str'}, + 'public_dns': {'key': 'publicDns', 'type': 'str'}, + 'refresh_token': {'key': 'refreshToken', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'}, + 'token_type': {'key': 'tokenType', 'type': 'str'}, } def __init__( @@ -18656,44 +20669,30 @@ def __init__( **kwargs ): """ - :keyword email_notification_settings: The AML notification email settings. - :paramtype email_notification_settings: - ~azure.mgmt.machinelearningservices.models.MonitorEmailNotificationSettings """ - super(MonitorNotificationSettings, self).__init__(**kwargs) - self.email_notification_settings = kwargs.get('email_notification_settings', None) - + super(NotebookAccessTokenResult, self).__init__(**kwargs) + self.access_token = None + self.expires_in = None + self.host_name = None + self.notebook_resource_id = None + self.public_dns = None + self.refresh_token = None + self.scope = None + self.token_type = None -class MonitorServerlessSparkCompute(MonitorComputeConfigurationBase): - """Monitor serverless spark compute definition. - All required parameters must be populated in order to send to Azure. +class NotebookPreparationError(msrest.serialization.Model): + """NotebookPreparationError. - :ivar compute_type: Required. [Required] Specifies the type of signal to monitor.Constant - filled by server. Possible values include: "ServerlessSpark". - :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.MonitorComputeType - :ivar compute_identity: Required. [Required] The identity scheme leveraged to by the spark jobs - running on serverless Spark. - :vartype compute_identity: - ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityBase - :ivar instance_type: Required. [Required] The instance type running the Spark job. - :vartype instance_type: str - :ivar runtime_version: Required. [Required] The Spark runtime version. - :vartype runtime_version: str + :ivar error_message: + :vartype error_message: str + :ivar status_code: + :vartype status_code: int """ - _validation = { - 'compute_type': {'required': True}, - 'compute_identity': {'required': True}, - 'instance_type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, - 'runtime_version': {'required': True, 'min_length': 1, 'pattern': r'^[0-9]+\.[0-9]+$'}, - } - _attribute_map = { - 'compute_type': {'key': 'computeType', 'type': 'str'}, - 'compute_identity': {'key': 'computeIdentity', 'type': 'MonitorComputeIdentityBase'}, - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'int'}, } def __init__( @@ -18701,41 +20700,35 @@ def __init__( **kwargs ): """ - :keyword compute_identity: Required. [Required] The identity scheme leveraged to by the spark - jobs running on serverless Spark. - :paramtype compute_identity: - ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityBase - :keyword instance_type: Required. [Required] The instance type running the Spark job. - :paramtype instance_type: str - :keyword runtime_version: Required. [Required] The Spark runtime version. - :paramtype runtime_version: str + :keyword error_message: + :paramtype error_message: str + :keyword status_code: + :paramtype status_code: int """ - super(MonitorServerlessSparkCompute, self).__init__(**kwargs) - self.compute_type = 'ServerlessSpark' # type: str - self.compute_identity = kwargs['compute_identity'] - self.instance_type = kwargs['instance_type'] - self.runtime_version = kwargs['runtime_version'] - + super(NotebookPreparationError, self).__init__(**kwargs) + self.error_message = kwargs.get('error_message', None) + self.status_code = kwargs.get('status_code', None) -class Mpi(DistributionConfiguration): - """MPI distribution configuration. - All required parameters must be populated in order to send to Azure. +class NotebookResourceInfo(msrest.serialization.Model): + """NotebookResourceInfo. - :ivar distribution_type: Required. [Required] Specifies the type of distribution - framework.Constant filled by server. Possible values include: "PyTorch", "TensorFlow", "Mpi". - :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType - :ivar process_count_per_instance: Number of processes per MPI node. - :vartype process_count_per_instance: int + :ivar fqdn: + :vartype fqdn: str + :ivar is_private_link_enabled: + :vartype is_private_link_enabled: bool + :ivar notebook_preparation_error: The error that occurs when preparing notebook. + :vartype notebook_preparation_error: + ~azure.mgmt.machinelearningservices.models.NotebookPreparationError + :ivar resource_id: the data plane resourceId that used to initialize notebook component. + :vartype resource_id: str """ - _validation = { - 'distribution_type': {'required': True}, - } - _attribute_map = { - 'distribution_type': {'key': 'distributionType', 'type': 'str'}, - 'process_count_per_instance': {'key': 'processCountPerInstance', 'type': 'int'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + 'is_private_link_enabled': {'key': 'isPrivateLinkEnabled', 'type': 'bool'}, + 'notebook_preparation_error': {'key': 'notebookPreparationError', 'type': 'NotebookPreparationError'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, } def __init__( @@ -18743,31 +20736,41 @@ def __init__( **kwargs ): """ - :keyword process_count_per_instance: Number of processes per MPI node. - :paramtype process_count_per_instance: int + :keyword fqdn: + :paramtype fqdn: str + :keyword is_private_link_enabled: + :paramtype is_private_link_enabled: bool + :keyword notebook_preparation_error: The error that occurs when preparing notebook. + :paramtype notebook_preparation_error: + ~azure.mgmt.machinelearningservices.models.NotebookPreparationError + :keyword resource_id: the data plane resourceId that used to initialize notebook component. + :paramtype resource_id: str """ - super(Mpi, self).__init__(**kwargs) - self.distribution_type = 'Mpi' # type: str - self.process_count_per_instance = kwargs.get('process_count_per_instance', None) + super(NotebookResourceInfo, self).__init__(**kwargs) + self.fqdn = kwargs.get('fqdn', None) + self.is_private_link_enabled = kwargs.get('is_private_link_enabled', None) + self.notebook_preparation_error = kwargs.get('notebook_preparation_error', None) + self.resource_id = kwargs.get('resource_id', None) -class NlpVertical(msrest.serialization.Model): - """Abstract class for NLP related AutoML tasks. -NLP - Natural Language Processing. +class NotificationSetting(msrest.serialization.Model): + """Configuration for notification. - :ivar featurization_settings: Featurization inputs needed for AutoML job. - :vartype featurization_settings: - ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings - :ivar limit_settings: Execution constraints for AutoMLJob. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar email_on: Send email notification to user on specified notification type. + :vartype email_on: list[str or + ~azure.mgmt.machinelearningservices.models.EmailNotificationEnableType] + :ivar emails: This is the email recipient list which has a limitation of 499 characters in + total concat with comma separator. + :vartype emails: list[str] + :ivar webhooks: Send webhook callback to a service. Key is a user-provided name for the + webhook. + :vartype webhooks: dict[str, ~azure.mgmt.machinelearningservices.models.Webhook] """ _attribute_map = { - 'featurization_settings': {'key': 'featurizationSettings', 'type': 'NlpVerticalFeaturizationSettings'}, - 'limit_settings': {'key': 'limitSettings', 'type': 'NlpVerticalLimitSettings'}, - 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, + 'email_on': {'key': 'emailOn', 'type': '[str]'}, + 'emails': {'key': 'emails', 'type': '[str]'}, + 'webhooks': {'key': 'webhooks', 'type': '{Webhook}'}, } def __init__( @@ -18775,29 +20778,48 @@ def __init__( **kwargs ): """ - :keyword featurization_settings: Featurization inputs needed for AutoML job. - :paramtype featurization_settings: - ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings - :keyword limit_settings: Execution constraints for AutoMLJob. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword email_on: Send email notification to user on specified notification type. + :paramtype email_on: list[str or + ~azure.mgmt.machinelearningservices.models.EmailNotificationEnableType] + :keyword emails: This is the email recipient list which has a limitation of 499 characters in + total concat with comma separator. + :paramtype emails: list[str] + :keyword webhooks: Send webhook callback to a service. Key is a user-provided name for the + webhook. + :paramtype webhooks: dict[str, ~azure.mgmt.machinelearningservices.models.Webhook] """ - super(NlpVertical, self).__init__(**kwargs) - self.featurization_settings = kwargs.get('featurization_settings', None) - self.limit_settings = kwargs.get('limit_settings', None) - self.validation_data = kwargs.get('validation_data', None) + super(NotificationSetting, self).__init__(**kwargs) + self.email_on = kwargs.get('email_on', None) + self.emails = kwargs.get('emails', None) + self.webhooks = kwargs.get('webhooks', None) -class NlpVerticalFeaturizationSettings(FeaturizationSettings): - """NlpVerticalFeaturizationSettings. +class NumericalDataDriftMetricThreshold(DataDriftMetricThresholdBase): + """NumericalDataDriftMetricThreshold. - :ivar dataset_language: Dataset language, useful for the text data. - :vartype dataset_language: str + All required parameters must be populated in order to send to Azure. + + :ivar data_type: Required. [Required] Specifies the data type of the metric threshold.Constant + filled by server. Possible values include: "Numerical", "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar metric: Required. [Required] The numerical data drift metric to calculate. Possible + values include: "JensenShannonDistance", "PopulationStabilityIndex", + "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". + :vartype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataDriftMetric """ + _validation = { + 'data_type': {'required': True}, + 'metric': {'required': True}, + } + _attribute_map = { - 'dataset_language': {'key': 'datasetLanguage', 'type': 'str'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, + 'metric': {'key': 'metric', 'type': 'str'}, } def __init__( @@ -18805,27 +20827,44 @@ def __init__( **kwargs ): """ - :keyword dataset_language: Dataset language, useful for the text data. - :paramtype dataset_language: str + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword metric: Required. [Required] The numerical data drift metric to calculate. Possible + values include: "JensenShannonDistance", "PopulationStabilityIndex", + "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". + :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataDriftMetric """ - super(NlpVerticalFeaturizationSettings, self).__init__(**kwargs) + super(NumericalDataDriftMetricThreshold, self).__init__(**kwargs) + self.data_type = 'Numerical' # type: str + self.metric = kwargs['metric'] -class NlpVerticalLimitSettings(msrest.serialization.Model): - """Job execution constraints. +class NumericalDataQualityMetricThreshold(DataQualityMetricThresholdBase): + """NumericalDataQualityMetricThreshold. - :ivar max_concurrent_trials: Maximum Concurrent AutoML iterations. - :vartype max_concurrent_trials: int - :ivar max_trials: Number of AutoML iterations. - :vartype max_trials: int - :ivar timeout: AutoML job timeout. - :vartype timeout: ~datetime.timedelta + All required parameters must be populated in order to send to Azure. + + :ivar data_type: Required. [Required] Specifies the data type of the metric threshold.Constant + filled by server. Possible values include: "Numerical", "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar metric: Required. [Required] The numerical data quality metric to calculate. Possible + values include: "NullValueRate", "DataTypeErrorRate", "OutOfBoundsRate". + :vartype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataQualityMetric """ + _validation = { + 'data_type': {'required': True}, + 'metric': {'required': True}, + } + _attribute_map = { - 'max_concurrent_trials': {'key': 'maxConcurrentTrials', 'type': 'int'}, - 'max_trials': {'key': 'maxTrials', 'type': 'int'}, - 'timeout': {'key': 'timeout', 'type': 'duration'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, + 'metric': {'key': 'metric', 'type': 'str'}, } def __init__( @@ -18833,54 +20872,45 @@ def __init__( **kwargs ): """ - :keyword max_concurrent_trials: Maximum Concurrent AutoML iterations. - :paramtype max_concurrent_trials: int - :keyword max_trials: Number of AutoML iterations. - :paramtype max_trials: int - :keyword timeout: AutoML job timeout. - :paramtype timeout: ~datetime.timedelta + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword metric: Required. [Required] The numerical data quality metric to calculate. Possible + values include: "NullValueRate", "DataTypeErrorRate", "OutOfBoundsRate". + :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataQualityMetric """ - super(NlpVerticalLimitSettings, self).__init__(**kwargs) - self.max_concurrent_trials = kwargs.get('max_concurrent_trials', 1) - self.max_trials = kwargs.get('max_trials', 1) - self.timeout = kwargs.get('timeout', "P7D") - + super(NumericalDataQualityMetricThreshold, self).__init__(**kwargs) + self.data_type = 'Numerical' # type: str + self.metric = kwargs['metric'] -class NodeStateCounts(msrest.serialization.Model): - """Counts of various compute node states on the amlCompute. - Variables are only populated by the server, and will be ignored when sending a request. +class NumericalPredictionDriftMetricThreshold(PredictionDriftMetricThresholdBase): + """NumericalPredictionDriftMetricThreshold. - :ivar idle_node_count: Number of compute nodes in idle state. - :vartype idle_node_count: int - :ivar running_node_count: Number of compute nodes which are running jobs. - :vartype running_node_count: int - :ivar preparing_node_count: Number of compute nodes which are being prepared. - :vartype preparing_node_count: int - :ivar unusable_node_count: Number of compute nodes which are in unusable state. - :vartype unusable_node_count: int - :ivar leaving_node_count: Number of compute nodes which are leaving the amlCompute. - :vartype leaving_node_count: int - :ivar preempted_node_count: Number of compute nodes which are in preempted state. - :vartype preempted_node_count: int + All required parameters must be populated in order to send to Azure. + + :ivar data_type: Required. [Required] Specifies the data type of the metric threshold.Constant + filled by server. Possible values include: "Numerical", "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar metric: Required. [Required] The numerical prediction drift metric to calculate. Possible + values include: "JensenShannonDistance", "PopulationStabilityIndex", + "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". + :vartype metric: str or + ~azure.mgmt.machinelearningservices.models.NumericalPredictionDriftMetric """ _validation = { - 'idle_node_count': {'readonly': True}, - 'running_node_count': {'readonly': True}, - 'preparing_node_count': {'readonly': True}, - 'unusable_node_count': {'readonly': True}, - 'leaving_node_count': {'readonly': True}, - 'preempted_node_count': {'readonly': True}, + 'data_type': {'required': True}, + 'metric': {'required': True}, } _attribute_map = { - 'idle_node_count': {'key': 'idleNodeCount', 'type': 'int'}, - 'running_node_count': {'key': 'runningNodeCount', 'type': 'int'}, - 'preparing_node_count': {'key': 'preparingNodeCount', 'type': 'int'}, - 'unusable_node_count': {'key': 'unusableNodeCount', 'type': 'int'}, - 'leaving_node_count': {'key': 'leavingNodeCount', 'type': 'int'}, - 'preempted_node_count': {'key': 'preemptedNodeCount', 'type': 'int'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, + 'metric': {'key': 'metric', 'type': 'str'}, } def __init__( @@ -18888,18 +20918,22 @@ def __init__( **kwargs ): """ + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword metric: Required. [Required] The numerical prediction drift metric to calculate. + Possible values include: "JensenShannonDistance", "PopulationStabilityIndex", + "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". + :paramtype metric: str or + ~azure.mgmt.machinelearningservices.models.NumericalPredictionDriftMetric """ - super(NodeStateCounts, self).__init__(**kwargs) - self.idle_node_count = None - self.running_node_count = None - self.preparing_node_count = None - self.unusable_node_count = None - self.leaving_node_count = None - self.preempted_node_count = None + super(NumericalPredictionDriftMetricThreshold, self).__init__(**kwargs) + self.data_type = 'Numerical' # type: str + self.metric = kwargs['metric'] -class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """NoneAuthTypeWorkspaceConnectionProperties. +class OAuth2AuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """OAuth2AuthTypeWorkspaceConnectionProperties. Variables are only populated by the server, and will be ignored when sending a request. @@ -18911,7 +20945,7 @@ class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2) :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -18926,10 +20960,12 @@ class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2) "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -18937,16 +20973,21 @@ class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2) :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionOAuth2 """ _validation = { @@ -18959,14 +21000,17 @@ class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2) 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, + 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionOAuth2'}, } def __init__( @@ -18976,7 +21020,7 @@ def __init__( """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -18991,45 +21035,216 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionOAuth2 """ - super(NoneAuthTypeWorkspaceConnectionProperties, self).__init__(**kwargs) - self.auth_type = 'None' # type: str + super(OAuth2AuthTypeWorkspaceConnectionProperties, self).__init__(**kwargs) + self.auth_type = 'OAuth2' # type: str + self.credentials = kwargs.get('credentials', None) -class NoneDatastoreCredentials(DatastoreCredentials): - """Empty/none datastore credentials. +class Objective(msrest.serialization.Model): + """Optimization objective. All required parameters must be populated in order to send to Azure. - :ivar credentials_type: Required. [Required] Credential type used to authentication with - storage.Constant filled by server. Possible values include: "AccountKey", "Certificate", - "None", "Sas", "ServicePrincipal". - :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType + :ivar goal: Required. [Required] Defines supported metric goals for hyperparameter tuning. + Possible values include: "Minimize", "Maximize". + :vartype goal: str or ~azure.mgmt.machinelearningservices.models.Goal + :ivar primary_metric: Required. [Required] Name of the metric to optimize. + :vartype primary_metric: str """ _validation = { - 'credentials_type': {'required': True}, + 'goal': {'required': True}, + 'primary_metric': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, } _attribute_map = { - 'credentials_type': {'key': 'credentialsType', 'type': 'str'}, + 'goal': {'key': 'goal', 'type': 'str'}, + 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword goal: Required. [Required] Defines supported metric goals for hyperparameter tuning. + Possible values include: "Minimize", "Maximize". + :paramtype goal: str or ~azure.mgmt.machinelearningservices.models.Goal + :keyword primary_metric: Required. [Required] Name of the metric to optimize. + :paramtype primary_metric: str + """ + super(Objective, self).__init__(**kwargs) + self.goal = kwargs['goal'] + self.primary_metric = kwargs['primary_metric'] + + +class OneLakeDatastore(DatastoreProperties): + """OneLake (Trident) datastore configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar credentials: Required. [Required] Account credentials. + :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :ivar datastore_type: Required. [Required] Storage type backing the datastore.Constant filled + by server. Possible values include: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", + "AzureFile", "OneLake". + :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType + :ivar is_default: Readonly property to indicate if datastore is the workspace default + datastore. + :vartype is_default: bool + :ivar artifact: Required. [Required] OneLake artifact backing the datastore. + :vartype artifact: ~azure.mgmt.machinelearningservices.models.OneLakeArtifact + :ivar endpoint: OneLake endpoint to use for the datastore. + :vartype endpoint: str + :ivar one_lake_workspace_name: Required. [Required] OneLake workspace name. + :vartype one_lake_workspace_name: str + :ivar service_data_access_auth_identity: Indicates which identity to use to authenticate + service data access to customer's storage. Possible values include: "None", + "WorkspaceSystemAssignedIdentity", "WorkspaceUserAssignedIdentity". + :vartype service_data_access_auth_identity: str or + ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity + """ + + _validation = { + 'credentials': {'required': True}, + 'datastore_type': {'required': True}, + 'is_default': {'readonly': True}, + 'artifact': {'required': True}, + 'one_lake_workspace_name': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'credentials': {'key': 'credentials', 'type': 'DatastoreCredentials'}, + 'datastore_type': {'key': 'datastoreType', 'type': 'str'}, + 'is_default': {'key': 'isDefault', 'type': 'bool'}, + 'artifact': {'key': 'artifact', 'type': 'OneLakeArtifact'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'one_lake_workspace_name': {'key': 'oneLakeWorkspaceName', 'type': 'str'}, + 'service_data_access_auth_identity': {'key': 'serviceDataAccessAuthIdentity', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword credentials: Required. [Required] Account credentials. + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :keyword artifact: Required. [Required] OneLake artifact backing the datastore. + :paramtype artifact: ~azure.mgmt.machinelearningservices.models.OneLakeArtifact + :keyword endpoint: OneLake endpoint to use for the datastore. + :paramtype endpoint: str + :keyword one_lake_workspace_name: Required. [Required] OneLake workspace name. + :paramtype one_lake_workspace_name: str + :keyword service_data_access_auth_identity: Indicates which identity to use to authenticate + service data access to customer's storage. Possible values include: "None", + "WorkspaceSystemAssignedIdentity", "WorkspaceUserAssignedIdentity". + :paramtype service_data_access_auth_identity: str or + ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity + """ + super(OneLakeDatastore, self).__init__(**kwargs) + self.datastore_type = 'OneLake' # type: str + self.artifact = kwargs['artifact'] + self.endpoint = kwargs.get('endpoint', None) + self.one_lake_workspace_name = kwargs['one_lake_workspace_name'] + self.service_data_access_auth_identity = kwargs.get('service_data_access_auth_identity', None) + + +class OnlineDeployment(TrackedResource): + """OnlineDeployment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.OnlineDeploymentProperties + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OnlineDeploymentProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, } def __init__( @@ -19037,54 +21252,40 @@ def __init__( **kwargs ): """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :paramtype kind: str + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.OnlineDeploymentProperties + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku """ - super(NoneDatastoreCredentials, self).__init__(**kwargs) - self.credentials_type = 'None' # type: str - + super(OnlineDeployment, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.kind = kwargs.get('kind', None) + self.properties = kwargs['properties'] + self.sku = kwargs.get('sku', None) -class NotebookAccessTokenResult(msrest.serialization.Model): - """NotebookAccessTokenResult. - Variables are only populated by the server, and will be ignored when sending a request. +class OnlineDeploymentTrackedResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of OnlineDeployment entities. - :ivar notebook_resource_id: - :vartype notebook_resource_id: str - :ivar host_name: - :vartype host_name: str - :ivar public_dns: - :vartype public_dns: str - :ivar access_token: - :vartype access_token: str - :ivar token_type: - :vartype token_type: str - :ivar expires_in: - :vartype expires_in: int - :ivar refresh_token: - :vartype refresh_token: str - :ivar scope: - :vartype scope: str + :ivar next_link: The link to the next page of OnlineDeployment objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type OnlineDeployment. + :vartype value: list[~azure.mgmt.machinelearningservices.models.OnlineDeployment] """ - _validation = { - 'notebook_resource_id': {'readonly': True}, - 'host_name': {'readonly': True}, - 'public_dns': {'readonly': True}, - 'access_token': {'readonly': True}, - 'token_type': {'readonly': True}, - 'expires_in': {'readonly': True}, - 'refresh_token': {'readonly': True}, - 'scope': {'readonly': True}, - } - _attribute_map = { - 'notebook_resource_id': {'key': 'notebookResourceId', 'type': 'str'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'public_dns': {'key': 'publicDns', 'type': 'str'}, - 'access_token': {'key': 'accessToken', 'type': 'str'}, - 'token_type': {'key': 'tokenType', 'type': 'str'}, - 'expires_in': {'key': 'expiresIn', 'type': 'int'}, - 'refresh_token': {'key': 'refreshToken', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[OnlineDeployment]'}, } def __init__( @@ -19092,30 +21293,70 @@ def __init__( **kwargs ): """ + :keyword next_link: The link to the next page of OnlineDeployment objects. If null, there are + no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type OnlineDeployment. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.OnlineDeployment] """ - super(NotebookAccessTokenResult, self).__init__(**kwargs) - self.notebook_resource_id = None - self.host_name = None - self.public_dns = None - self.access_token = None - self.token_type = None - self.expires_in = None - self.refresh_token = None - self.scope = None + super(OnlineDeploymentTrackedResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) -class NotebookPreparationError(msrest.serialization.Model): - """NotebookPreparationError. +class OnlineEndpoint(TrackedResource): + """OnlineEndpoint. - :ivar error_message: - :vartype error_message: str - :ivar status_code: - :vartype status_code: int + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.OnlineEndpointProperties + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'properties': {'required': True}, + } + _attribute_map = { - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OnlineEndpointProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, } def __init__( @@ -19123,32 +21364,88 @@ def __init__( **kwargs ): """ - :keyword error_message: - :paramtype error_message: str - :keyword status_code: - :paramtype status_code: int + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :paramtype kind: str + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.OnlineEndpointProperties + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku """ - super(NotebookPreparationError, self).__init__(**kwargs) - self.error_message = kwargs.get('error_message', None) - self.status_code = kwargs.get('status_code', None) + super(OnlineEndpoint, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.kind = kwargs.get('kind', None) + self.properties = kwargs['properties'] + self.sku = kwargs.get('sku', None) -class NotebookResourceInfo(msrest.serialization.Model): - """NotebookResourceInfo. +class OnlineEndpointProperties(EndpointPropertiesBase): + """Online endpoint configuration. - :ivar fqdn: - :vartype fqdn: str - :ivar resource_id: the data plane resourceId that used to initialize notebook component. - :vartype resource_id: str - :ivar notebook_preparation_error: The error that occurs when preparing notebook. - :vartype notebook_preparation_error: - ~azure.mgmt.machinelearningservices.models.NotebookPreparationError + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar auth_mode: Required. [Required] Use 'Key' for key based authentication and 'AMLToken' for + Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. + Possible values include: "AMLToken", "Key", "AADToken". + :vartype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode + :ivar description: Description of the inference endpoint. + :vartype description: str + :ivar keys: EndpointAuthKeys to set initially on an Endpoint. + This property will always be returned as null. AuthKey values must be retrieved using the + ListKeys API. + :vartype keys: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar scoring_uri: Endpoint URI. + :vartype scoring_uri: str + :ivar swagger_uri: Endpoint Swagger URI. + :vartype swagger_uri: str + :ivar compute: ARM resource ID of the compute if it exists. + optional. + :vartype compute: str + :ivar mirror_traffic: Percentage of traffic to be mirrored to each deployment without using + returned scoring. Traffic values need to sum to utmost 50. + :vartype mirror_traffic: dict[str, int] + :ivar provisioning_state: Provisioning state for the endpoint. Possible values include: + "Creating", "Deleting", "Succeeded", "Failed", "Updating", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.EndpointProvisioningState + :ivar public_network_access: Set to "Enabled" for endpoints that should allow public access + when Private Link is enabled. Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :ivar traffic: Percentage of traffic from endpoint to divert to each deployment. Traffic values + need to sum to 100. + :vartype traffic: dict[str, int] """ + _validation = { + 'auth_mode': {'required': True}, + 'scoring_uri': {'readonly': True}, + 'swagger_uri': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'notebook_preparation_error': {'key': 'notebookPreparationError', 'type': 'NotebookPreparationError'}, + 'auth_mode': {'key': 'authMode', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'keys': {'key': 'keys', 'type': 'EndpointAuthKeys'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'scoring_uri': {'key': 'scoringUri', 'type': 'str'}, + 'swagger_uri': {'key': 'swaggerUri', 'type': 'str'}, + 'compute': {'key': 'compute', 'type': 'str'}, + 'mirror_traffic': {'key': 'mirrorTraffic', 'type': '{int}'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'traffic': {'key': 'traffic', 'type': '{int}'}, } def __init__( @@ -19156,38 +21453,53 @@ def __init__( **kwargs ): """ - :keyword fqdn: - :paramtype fqdn: str - :keyword resource_id: the data plane resourceId that used to initialize notebook component. - :paramtype resource_id: str - :keyword notebook_preparation_error: The error that occurs when preparing notebook. - :paramtype notebook_preparation_error: - ~azure.mgmt.machinelearningservices.models.NotebookPreparationError + :keyword auth_mode: Required. [Required] Use 'Key' for key based authentication and 'AMLToken' + for Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' + does. Possible values include: "AMLToken", "Key", "AADToken". + :paramtype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode + :keyword description: Description of the inference endpoint. + :paramtype description: str + :keyword keys: EndpointAuthKeys to set initially on an Endpoint. + This property will always be returned as null. AuthKey values must be retrieved using the + ListKeys API. + :paramtype keys: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword compute: ARM resource ID of the compute if it exists. + optional. + :paramtype compute: str + :keyword mirror_traffic: Percentage of traffic to be mirrored to each deployment without using + returned scoring. Traffic values need to sum to utmost 50. + :paramtype mirror_traffic: dict[str, int] + :keyword public_network_access: Set to "Enabled" for endpoints that should allow public access + when Private Link is enabled. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :keyword traffic: Percentage of traffic from endpoint to divert to each deployment. Traffic + values need to sum to 100. + :paramtype traffic: dict[str, int] """ - super(NotebookResourceInfo, self).__init__(**kwargs) - self.fqdn = kwargs.get('fqdn', None) - self.resource_id = kwargs.get('resource_id', None) - self.notebook_preparation_error = kwargs.get('notebook_preparation_error', None) + super(OnlineEndpointProperties, self).__init__(**kwargs) + self.compute = kwargs.get('compute', None) + self.mirror_traffic = kwargs.get('mirror_traffic', None) + self.provisioning_state = None + self.public_network_access = kwargs.get('public_network_access', None) + self.traffic = kwargs.get('traffic', None) -class NotificationSetting(msrest.serialization.Model): - """Configuration for notification. +class OnlineEndpointTrackedResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of OnlineEndpoint entities. - :ivar email_on: Send email notification to user on specified notification type. - :vartype email_on: list[str or - ~azure.mgmt.machinelearningservices.models.EmailNotificationEnableType] - :ivar emails: This is the email recipient list which has a limitation of 499 characters in - total concat with comma separator. - :vartype emails: list[str] - :ivar webhooks: Send webhook callback to a service. Key is a user-provided name for the - webhook. - :vartype webhooks: dict[str, ~azure.mgmt.machinelearningservices.models.Webhook] + :ivar next_link: The link to the next page of OnlineEndpoint objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type OnlineEndpoint. + :vartype value: list[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] """ _attribute_map = { - 'email_on': {'key': 'emailOn', 'type': '[str]'}, - 'emails': {'key': 'emails', 'type': '[str]'}, - 'webhooks': {'key': 'webhooks', 'type': '{Webhook}'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[OnlineEndpoint]'}, } def __init__( @@ -19195,48 +21507,37 @@ def __init__( **kwargs ): """ - :keyword email_on: Send email notification to user on specified notification type. - :paramtype email_on: list[str or - ~azure.mgmt.machinelearningservices.models.EmailNotificationEnableType] - :keyword emails: This is the email recipient list which has a limitation of 499 characters in - total concat with comma separator. - :paramtype emails: list[str] - :keyword webhooks: Send webhook callback to a service. Key is a user-provided name for the - webhook. - :paramtype webhooks: dict[str, ~azure.mgmt.machinelearningservices.models.Webhook] + :keyword next_link: The link to the next page of OnlineEndpoint objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type OnlineEndpoint. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] """ - super(NotificationSetting, self).__init__(**kwargs) - self.email_on = kwargs.get('email_on', None) - self.emails = kwargs.get('emails', None) - self.webhooks = kwargs.get('webhooks', None) - + super(OnlineEndpointTrackedResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) -class NumericalDataDriftMetricThreshold(DataDriftMetricThresholdBase): - """NumericalDataDriftMetricThreshold. - All required parameters must be populated in order to send to Azure. +class OnlineRequestSettings(msrest.serialization.Model): + """Online deployment scoring requests configuration. - :ivar data_type: Required. [Required] Specifies the data type of the metric threshold.Constant - filled by server. Possible values include: "Numerical", "Categorical". - :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType - :ivar threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - :ivar metric: Required. [Required] The numerical data drift metric to calculate. Possible - values include: "JensenShannonDistance", "PopulationStabilityIndex", - "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". - :vartype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataDriftMetric + :ivar max_concurrent_requests_per_instance: The number of maximum concurrent requests per node + allowed per deployment. Defaults to 1. + :vartype max_concurrent_requests_per_instance: int + :ivar max_queue_wait: (Deprecated for Managed Online Endpoints) The maximum amount of time a + request will stay in the queue in ISO 8601 format. + Defaults to 500ms. + (Now increase ``request_timeout_ms`` to account for any networking/queue delays). + :vartype max_queue_wait: ~datetime.timedelta + :ivar request_timeout: The scoring timeout in ISO 8601 format. + Defaults to 5000ms. + :vartype request_timeout: ~datetime.timedelta """ - _validation = { - 'data_type': {'required': True}, - 'metric': {'required': True}, - } - _attribute_map = { - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, - 'metric': {'key': 'metric', 'type': 'str'}, + 'max_concurrent_requests_per_instance': {'key': 'maxConcurrentRequestsPerInstance', 'type': 'int'}, + 'max_queue_wait': {'key': 'maxQueueWait', 'type': 'duration'}, + 'request_timeout': {'key': 'requestTimeout', 'type': 'duration'}, } def __init__( @@ -19244,44 +21545,63 @@ def __init__( **kwargs ): """ - :keyword threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - :keyword metric: Required. [Required] The numerical data drift metric to calculate. Possible - values include: "JensenShannonDistance", "PopulationStabilityIndex", - "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". - :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataDriftMetric + :keyword max_concurrent_requests_per_instance: The number of maximum concurrent requests per + node allowed per deployment. Defaults to 1. + :paramtype max_concurrent_requests_per_instance: int + :keyword max_queue_wait: (Deprecated for Managed Online Endpoints) The maximum amount of time a + request will stay in the queue in ISO 8601 format. + Defaults to 500ms. + (Now increase ``request_timeout_ms`` to account for any networking/queue delays). + :paramtype max_queue_wait: ~datetime.timedelta + :keyword request_timeout: The scoring timeout in ISO 8601 format. + Defaults to 5000ms. + :paramtype request_timeout: ~datetime.timedelta """ - super(NumericalDataDriftMetricThreshold, self).__init__(**kwargs) - self.data_type = 'Numerical' # type: str - self.metric = kwargs['metric'] + super(OnlineRequestSettings, self).__init__(**kwargs) + self.max_concurrent_requests_per_instance = kwargs.get('max_concurrent_requests_per_instance', 1) + self.max_queue_wait = kwargs.get('max_queue_wait', "PT0.5S") + self.request_timeout = kwargs.get('request_timeout', "PT5S") -class NumericalDataQualityMetricThreshold(DataQualityMetricThresholdBase): - """NumericalDataQualityMetricThreshold. +class OpenAIEndpointDeploymentResourceProperties(EndpointDeploymentResourceProperties, CognitiveServiceEndpointDeploymentResourceProperties): + """OpenAIEndpointDeploymentResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar data_type: Required. [Required] Specifies the data type of the metric threshold.Constant - filled by server. Possible values include: "Numerical", "Categorical". - :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType - :ivar threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - :ivar metric: Required. [Required] The numerical data quality metric to calculate. Possible - values include: "NullValueRate", "DataTypeErrorRate", "OutOfBoundsRate". - :vartype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataQualityMetric + :ivar model: Required. Model used for the endpoint deployment. + :vartype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar version_upgrade_option: Deployment model version upgrade option. Possible values include: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Required. Kind of the deployment.Constant filled by server. + :vartype type: str """ _validation = { - 'data_type': {'required': True}, - 'metric': {'required': True}, + 'model': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, } _attribute_map = { - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, - 'metric': {'key': 'metric', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'EndpointDeploymentModel'}, + 'rai_policy_name': {'key': 'raiPolicyName', 'type': 'str'}, + 'version_upgrade_option': {'key': 'versionUpgradeOption', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( @@ -19289,45 +21609,80 @@ def __init__( **kwargs ): """ - :keyword threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - :keyword metric: Required. [Required] The numerical data quality metric to calculate. Possible - values include: "NullValueRate", "DataTypeErrorRate", "OutOfBoundsRate". - :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataQualityMetric + :keyword model: Required. Model used for the endpoint deployment. + :paramtype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :keyword rai_policy_name: The name of RAI policy. + :paramtype rai_policy_name: str + :keyword version_upgrade_option: Deployment model version upgrade option. Possible values + include: "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :paramtype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str """ - super(NumericalDataQualityMetricThreshold, self).__init__(**kwargs) - self.data_type = 'Numerical' # type: str - self.metric = kwargs['metric'] + super(OpenAIEndpointDeploymentResourceProperties, self).__init__(**kwargs) + self.model = kwargs['model'] + self.rai_policy_name = kwargs.get('rai_policy_name', None) + self.version_upgrade_option = kwargs.get('version_upgrade_option', None) + self.type = 'Azure.OpenAI' # type: str + self.failure_reason = kwargs.get('failure_reason', None) + self.provisioning_state = None -class NumericalPredictionDriftMetricThreshold(PredictionDriftMetricThresholdBase): - """NumericalPredictionDriftMetricThreshold. +class OpenAIEndpointResourceProperties(EndpointResourceProperties): + """OpenAIEndpointResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar data_type: Required. [Required] Specifies the data type of the metric threshold.Constant - filled by server. Possible values include: "Numerical", "Categorical". - :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType - :ivar threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - :ivar metric: Required. [Required] The numerical prediction drift metric to calculate. Possible - values include: "JensenShannonDistance", "PopulationStabilityIndex", - "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". - :vartype metric: str or - ~azure.mgmt.machinelearningservices.models.NumericalPredictionDriftMetric + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Required. Type of the endpoint.Constant filled by server. Possible values + include: "Azure.OpenAI", "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", + "managedOnlineEndpoint", "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool """ _validation = { - 'data_type': {'required': True}, - 'metric': {'required': True}, + 'endpoint_type': {'required': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, - 'metric': {'key': 'metric', 'type': 'str'}, + 'associated_resource_id': {'key': 'associatedResourceId', 'type': 'str'}, + 'deployments': {'key': 'deployments', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'should_create_ai_services_endpoint': {'key': 'shouldCreateAiServicesEndpoint', 'type': 'bool'}, } def __init__( @@ -19335,93 +21690,67 @@ def __init__( **kwargs ): """ - :keyword threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - :keyword metric: Required. [Required] The numerical prediction drift metric to calculate. - Possible values include: "JensenShannonDistance", "PopulationStabilityIndex", - "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". - :paramtype metric: str or - ~azure.mgmt.machinelearningservices.models.NumericalPredictionDriftMetric - """ - super(NumericalPredictionDriftMetricThreshold, self).__init__(**kwargs) - self.data_type = 'Numerical' # type: str - self.metric = kwargs['metric'] - - -class OAuth2AuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """OAuth2AuthTypeWorkspaceConnectionProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar auth_type: Required. Authentication type of the connection target.Constant filled by - server. Possible values include: "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", - "AccountKey", "ServicePrincipal", "AccessKey", "ApiKey", "CustomKeys", "OAuth2", "AAD". - :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType - :ivar category: Category of the connection. Possible values include: "PythonFeed", - "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", - "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", - "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", - "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", - "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", - "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", - "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", - "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", - "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", - "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", - "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", - "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", - "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", - "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", - "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". - :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :ivar created_by_workspace_arm_id: - :vartype created_by_workspace_arm_id: str - :ivar expiry_time: - :vartype expiry_time: ~datetime.datetime - :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", - "Database", "NoSQL", "File", "GenericProtocol", "ServicesAndApps". - :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup - :ivar is_shared_to_all: - :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str - :ivar metadata: Store user metadata for this connection. - :vartype metadata: dict[str, str] - :ivar shared_user_list: - :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :ivar credentials: ClientId and ClientSecret are required. Other properties are optional - depending on each OAuth2 provider's implementation. - :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionOAuth2 + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + """ + super(OpenAIEndpointResourceProperties, self).__init__(**kwargs) + self.endpoint_type = 'Azure.OpenAI' # type: str + + +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.machinelearningservices.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~azure.mgmt.machinelearningservices.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ActionType """ _validation = { - 'auth_type': {'required': True}, - 'created_by_workspace_arm_id': {'readonly': True}, - 'group': {'readonly': True}, + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, } _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, - 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, - 'group': {'key': 'group', 'type': 'str'}, - 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, - 'metadata': {'key': 'metadata', 'type': '{str}'}, - 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionOAuth2'}, + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, } def __init__( @@ -19429,69 +21758,48 @@ def __init__( **kwargs ): """ - :keyword category: Category of the connection. Possible values include: "PythonFeed", - "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", - "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", - "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", - "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", - "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", - "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", - "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", - "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", - "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", - "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", - "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", - "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", - "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", - "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", - "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". - :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :keyword expiry_time: - :paramtype expiry_time: ~datetime.datetime - :keyword is_shared_to_all: - :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str - :keyword metadata: Store user metadata for this connection. - :paramtype metadata: dict[str, str] - :keyword shared_user_list: - :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :keyword credentials: ClientId and ClientSecret are required. Other properties are optional - depending on each OAuth2 provider's implementation. - :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionOAuth2 + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.machinelearningservices.models.OperationDisplay """ - super(OAuth2AuthTypeWorkspaceConnectionProperties, self).__init__(**kwargs) - self.auth_type = 'OAuth2' # type: str - self.credentials = kwargs.get('credentials', None) + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = kwargs.get('display', None) + self.origin = None + self.action_type = None -class Objective(msrest.serialization.Model): - """Optimization objective. +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar goal: Required. [Required] Defines supported metric goals for hyperparameter tuning. - Possible values include: "Minimize", "Maximize". - :vartype goal: str or ~azure.mgmt.machinelearningservices.models.Goal - :ivar primary_metric: Required. [Required] Name of the metric to optimize. - :vartype primary_metric: str + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str """ _validation = { - 'goal': {'required': True}, - 'primary_metric': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, } _attribute_map = { - 'goal': {'key': 'goal', 'type': 'str'}, - 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, } def __init__( @@ -19499,71 +21807,33 @@ def __init__( **kwargs ): """ - :keyword goal: Required. [Required] Defines supported metric goals for hyperparameter tuning. - Possible values include: "Minimize", "Maximize". - :paramtype goal: str or ~azure.mgmt.machinelearningservices.models.Goal - :keyword primary_metric: Required. [Required] Name of the metric to optimize. - :paramtype primary_metric: str """ - super(Objective, self).__init__(**kwargs) - self.goal = kwargs['goal'] - self.primary_metric = kwargs['primary_metric'] + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None -class OneLakeDatastore(DatastoreProperties): - """OneLake (Trident) datastore configuration. +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar credentials: Required. [Required] Account credentials. - :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials - :ivar datastore_type: Required. [Required] Storage type backing the datastore.Constant filled - by server. Possible values include: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", - "AzureFile", "OneLake". - :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType - :ivar is_default: Readonly property to indicate if datastore is the workspace default - datastore. - :vartype is_default: bool - :ivar artifact: Required. [Required] OneLake artifact backing the datastore. - :vartype artifact: ~azure.mgmt.machinelearningservices.models.OneLakeArtifact - :ivar endpoint: OneLake endpoint to use for the datastore. - :vartype endpoint: str - :ivar one_lake_workspace_name: Required. [Required] OneLake workspace name. - :vartype one_lake_workspace_name: str - :ivar service_data_access_auth_identity: Indicates which identity to use to authenticate - service data access to customer's storage. Possible values include: "None", - "WorkspaceSystemAssignedIdentity", "WorkspaceUserAssignedIdentity". - :vartype service_data_access_auth_identity: str or - ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ _validation = { - 'credentials': {'required': True}, - 'datastore_type': {'required': True}, - 'is_default': {'readonly': True}, - 'artifact': {'required': True}, - 'one_lake_workspace_name': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'credentials': {'key': 'credentials', 'type': 'DatastoreCredentials'}, - 'datastore_type': {'key': 'datastoreType', 'type': 'str'}, - 'is_default': {'key': 'isDefault', 'type': 'bool'}, - 'artifact': {'key': 'artifact', 'type': 'OneLakeArtifact'}, - 'endpoint': {'key': 'endpoint', 'type': 'str'}, - 'one_lake_workspace_name': {'key': 'oneLakeWorkspaceName', 'type': 'str'}, - 'service_data_access_auth_identity': {'key': 'serviceDataAccessAuthIdentity', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( @@ -19571,36 +21841,65 @@ def __init__( **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword credentials: Required. [Required] Account credentials. - :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials - :keyword artifact: Required. [Required] OneLake artifact backing the datastore. - :paramtype artifact: ~azure.mgmt.machinelearningservices.models.OneLakeArtifact - :keyword endpoint: OneLake endpoint to use for the datastore. - :paramtype endpoint: str - :keyword one_lake_workspace_name: Required. [Required] OneLake workspace name. - :paramtype one_lake_workspace_name: str - :keyword service_data_access_auth_identity: Indicates which identity to use to authenticate - service data access to customer's storage. Possible values include: "None", - "WorkspaceSystemAssignedIdentity", "WorkspaceUserAssignedIdentity". - :paramtype service_data_access_auth_identity: str or - ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity """ - super(OneLakeDatastore, self).__init__(**kwargs) - self.datastore_type = 'OneLake' # type: str - self.artifact = kwargs['artifact'] - self.endpoint = kwargs.get('endpoint', None) - self.one_lake_workspace_name = kwargs['one_lake_workspace_name'] - self.service_data_access_auth_identity = kwargs.get('service_data_access_auth_identity', None) + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None -class OnlineDeployment(TrackedResource): - """OnlineDeployment. +class OsPatchingStatus(msrest.serialization.Model): + """Returns metadata about the os patching. + + :ivar patch_status: The os patching status. Possible values include: "CompletedWithWarnings", + "Failed", "InProgress", "Succeeded", "Unknown". + :vartype patch_status: str or ~azure.mgmt.machinelearningservices.models.PatchStatus + :ivar latest_patch_time: Time of the latest os patching. + :vartype latest_patch_time: str + :ivar reboot_pending: Specifies whether this compute instance is pending for reboot to finish + os patching. + :vartype reboot_pending: bool + :ivar scheduled_reboot_time: Time of scheduled reboot. + :vartype scheduled_reboot_time: str + :ivar os_patching_errors: Collection of errors encountered when doing os patching. + :vartype os_patching_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + """ + + _attribute_map = { + 'patch_status': {'key': 'patchStatus', 'type': 'str'}, + 'latest_patch_time': {'key': 'latestPatchTime', 'type': 'str'}, + 'reboot_pending': {'key': 'rebootPending', 'type': 'bool'}, + 'scheduled_reboot_time': {'key': 'scheduledRebootTime', 'type': 'str'}, + 'os_patching_errors': {'key': 'osPatchingErrors', 'type': '[ErrorResponse]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword patch_status: The os patching status. Possible values include: + "CompletedWithWarnings", "Failed", "InProgress", "Succeeded", "Unknown". + :paramtype patch_status: str or ~azure.mgmt.machinelearningservices.models.PatchStatus + :keyword latest_patch_time: Time of the latest os patching. + :paramtype latest_patch_time: str + :keyword reboot_pending: Specifies whether this compute instance is pending for reboot to + finish os patching. + :paramtype reboot_pending: bool + :keyword scheduled_reboot_time: Time of scheduled reboot. + :paramtype scheduled_reboot_time: str + :keyword os_patching_errors: Collection of errors encountered when doing os patching. + :paramtype os_patching_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + """ + super(OsPatchingStatus, self).__init__(**kwargs) + self.patch_status = kwargs.get('patch_status', None) + self.latest_patch_time = kwargs.get('latest_patch_time', None) + self.reboot_pending = kwargs.get('reboot_pending', None) + self.scheduled_reboot_time = kwargs.get('scheduled_reboot_time', None) + self.os_patching_errors = kwargs.get('os_patching_errors', None) + + +class OutboundRuleBasicResource(Resource): + """OutboundRuleBasicResource. Variables are only populated by the server, and will be ignored when sending a request. @@ -19612,24 +21911,14 @@ class OnlineDeployment(TrackedResource): :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. - :vartype location: str - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type. - :vartype kind: str - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.OnlineDeploymentProperties - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. Outbound Rule for the managed network of a machine learning + workspace. + :vartype properties: ~azure.mgmt.machinelearningservices.models.OutboundRule """ _validation = { @@ -19637,7 +21926,6 @@ class OnlineDeployment(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, - 'location': {'required': True}, 'properties': {'required': True}, } @@ -19646,12 +21934,7 @@ class OnlineDeployment(TrackedResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OnlineDeploymentProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, + 'properties': {'key': 'properties', 'type': 'OutboundRule'}, } def __init__( @@ -19659,40 +21942,28 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. - :paramtype location: str - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type. - :paramtype kind: str - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.OnlineDeploymentProperties - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword properties: Required. Outbound Rule for the managed network of a machine learning + workspace. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.OutboundRule """ - super(OnlineDeployment, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) + super(OutboundRuleBasicResource, self).__init__(**kwargs) self.properties = kwargs['properties'] - self.sku = kwargs.get('sku', None) -class OnlineDeploymentTrackedResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of OnlineDeployment entities. +class OutboundRuleListResult(msrest.serialization.Model): + """List of outbound rules for the managed network of a machine learning workspace. - :ivar next_link: The link to the next page of OnlineDeployment objects. If null, there are no - additional pages. + :ivar next_link: The link to the next page constructed using the continuationToken. If null, + there are no additional pages. :vartype next_link: str - :ivar value: An array of objects of type OnlineDeployment. - :vartype value: list[~azure.mgmt.machinelearningservices.models.OnlineDeployment] + :ivar value: The list of machine learning workspaces. Since this list may be incomplete, the + nextLink field should be used to request the next list of machine learning workspaces. + :vartype value: list[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[OnlineDeployment]'}, + 'value': {'key': 'value', 'type': '[OutboundRuleBasicResource]'}, } def __init__( @@ -19700,70 +21971,40 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of OnlineDeployment objects. If null, there are - no additional pages. + :keyword next_link: The link to the next page constructed using the continuationToken. If + null, there are no additional pages. :paramtype next_link: str - :keyword value: An array of objects of type OnlineDeployment. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.OnlineDeployment] + :keyword value: The list of machine learning workspaces. Since this list may be incomplete, the + nextLink field should be used to request the next list of machine learning workspaces. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] """ - super(OnlineDeploymentTrackedResourceArmPaginatedResult, self).__init__(**kwargs) + super(OutboundRuleListResult, self).__init__(**kwargs) self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) -class OnlineEndpoint(TrackedResource): - """OnlineEndpoint. - - Variables are only populated by the server, and will be ignored when sending a request. +class OutputPathAssetReference(AssetReferenceBase): + """Reference to an asset via its path in a job output. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. - :vartype location: str - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type. - :vartype kind: str - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.OnlineEndpointProperties - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar reference_type: Required. [Required] Specifies the type of asset reference.Constant + filled by server. Possible values include: "Id", "DataPath", "OutputPath". + :vartype reference_type: str or ~azure.mgmt.machinelearningservices.models.ReferenceType + :ivar job_id: ARM resource ID of the job. + :vartype job_id: str + :ivar path: The path of the file/directory in the job output. + :vartype path: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'properties': {'required': True}, + 'reference_type': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OnlineEndpointProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, + 'reference_type': {'key': 'referenceType', 'type': 'str'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, } def __init__( @@ -19771,142 +22012,81 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. - :paramtype location: str - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type. - :paramtype kind: str - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.OnlineEndpointProperties - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword job_id: ARM resource ID of the job. + :paramtype job_id: str + :keyword path: The path of the file/directory in the job output. + :paramtype path: str """ - super(OnlineEndpoint, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.properties = kwargs['properties'] - self.sku = kwargs.get('sku', None) + super(OutputPathAssetReference, self).__init__(**kwargs) + self.reference_type = 'OutputPath' # type: str + self.job_id = kwargs.get('job_id', None) + self.path = kwargs.get('path', None) -class OnlineEndpointProperties(EndpointPropertiesBase): - """Online endpoint configuration. +class PaginatedComputeResourcesList(msrest.serialization.Model): + """Paginated list of Machine Learning compute objects wrapped in ARM resource envelope. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar value: An array of Machine Learning compute objects wrapped in ARM resource envelope. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ComputeResource] + :ivar next_link: A continuation link (absolute URI) to the next page of results in the list. + :vartype next_link: str + """ - All required parameters must be populated in order to send to Azure. + _attribute_map = { + 'value': {'key': 'value', 'type': '[ComputeResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } - :ivar auth_mode: Required. [Required] Use 'Key' for key based authentication and 'AMLToken' for - Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. - Possible values include: "AMLToken", "Key", "AADToken". - :vartype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode - :ivar description: Description of the inference endpoint. + def __init__( + self, + **kwargs + ): + """ + :keyword value: An array of Machine Learning compute objects wrapped in ARM resource envelope. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.ComputeResource] + :keyword next_link: A continuation link (absolute URI) to the next page of results in the list. + :paramtype next_link: str + """ + super(PaginatedComputeResourcesList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PartialBatchDeployment(msrest.serialization.Model): + """Mutable batch inference settings per deployment. + + :ivar description: Description of the endpoint deployment. :vartype description: str - :ivar keys: EndpointAuthKeys to set initially on an Endpoint. - This property will always be returned as null. AuthKey values must be retrieved using the - ListKeys API. - :vartype keys: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys - :ivar properties: Property dictionary. Properties can be added, but not removed or altered. - :vartype properties: dict[str, str] - :ivar scoring_uri: Endpoint URI. - :vartype scoring_uri: str - :ivar swagger_uri: Endpoint Swagger URI. - :vartype swagger_uri: str - :ivar compute: ARM resource ID of the compute if it exists. - optional. - :vartype compute: str - :ivar mirror_traffic: Percentage of traffic to be mirrored to each deployment without using - returned scoring. Traffic values need to sum to utmost 50. - :vartype mirror_traffic: dict[str, int] - :ivar provisioning_state: Provisioning state for the endpoint. Possible values include: - "Creating", "Deleting", "Succeeded", "Failed", "Updating", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.EndpointProvisioningState - :ivar public_network_access: Set to "Enabled" for endpoints that should allow public access - when Private Link is enabled. Possible values include: "Enabled", "Disabled". - :vartype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType - :ivar traffic: Percentage of traffic from endpoint to divert to each deployment. Traffic values - need to sum to 100. - :vartype traffic: dict[str, int] """ - _validation = { - 'auth_mode': {'required': True}, - 'scoring_uri': {'readonly': True}, - 'swagger_uri': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - _attribute_map = { - 'auth_mode': {'key': 'authMode', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'keys': {'key': 'keys', 'type': 'EndpointAuthKeys'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'scoring_uri': {'key': 'scoringUri', 'type': 'str'}, - 'swagger_uri': {'key': 'swaggerUri', 'type': 'str'}, - 'compute': {'key': 'compute', 'type': 'str'}, - 'mirror_traffic': {'key': 'mirrorTraffic', 'type': '{int}'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'traffic': {'key': 'traffic', 'type': '{int}'}, } def __init__( self, **kwargs - ): - """ - :keyword auth_mode: Required. [Required] Use 'Key' for key based authentication and 'AMLToken' - for Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' - does. Possible values include: "AMLToken", "Key", "AADToken". - :paramtype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode - :keyword description: Description of the inference endpoint. - :paramtype description: str - :keyword keys: EndpointAuthKeys to set initially on an Endpoint. - This property will always be returned as null. AuthKey values must be retrieved using the - ListKeys API. - :paramtype keys: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. - :paramtype properties: dict[str, str] - :keyword compute: ARM resource ID of the compute if it exists. - optional. - :paramtype compute: str - :keyword mirror_traffic: Percentage of traffic to be mirrored to each deployment without using - returned scoring. Traffic values need to sum to utmost 50. - :paramtype mirror_traffic: dict[str, int] - :keyword public_network_access: Set to "Enabled" for endpoints that should allow public access - when Private Link is enabled. Possible values include: "Enabled", "Disabled". - :paramtype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType - :keyword traffic: Percentage of traffic from endpoint to divert to each deployment. Traffic - values need to sum to 100. - :paramtype traffic: dict[str, int] + ): """ - super(OnlineEndpointProperties, self).__init__(**kwargs) - self.compute = kwargs.get('compute', None) - self.mirror_traffic = kwargs.get('mirror_traffic', None) - self.provisioning_state = None - self.public_network_access = kwargs.get('public_network_access', None) - self.traffic = kwargs.get('traffic', None) + :keyword description: Description of the endpoint deployment. + :paramtype description: str + """ + super(PartialBatchDeployment, self).__init__(**kwargs) + self.description = kwargs.get('description', None) -class OnlineEndpointTrackedResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of OnlineEndpoint entities. +class PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties(msrest.serialization.Model): + """Strictly used in update requests. - :ivar next_link: The link to the next page of OnlineEndpoint objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type OnlineEndpoint. - :vartype value: list[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] + :ivar properties: Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[OnlineEndpoint]'}, + 'properties': {'key': 'properties', 'type': 'PartialBatchDeployment'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__( @@ -19914,37 +22094,33 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page of OnlineEndpoint objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type OnlineEndpoint. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] + :keyword properties: Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] """ - super(OnlineEndpointTrackedResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) + super(PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.tags = kwargs.get('tags', None) -class OnlineRequestSettings(msrest.serialization.Model): - """Online deployment scoring requests configuration. +class PartialManagedServiceIdentity(msrest.serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). - :ivar max_concurrent_requests_per_instance: The number of maximum concurrent requests per node - allowed per deployment. Defaults to 1. - :vartype max_concurrent_requests_per_instance: int - :ivar max_queue_wait: (Deprecated for Managed Online Endpoints) The maximum amount of time a - request will stay in the queue in ISO 8601 format. - Defaults to 500ms. - (Now increase ``request_timeout_ms`` to account for any networking/queue delays). - :vartype max_queue_wait: ~datetime.timedelta - :ivar request_timeout: The scoring timeout in ISO 8601 format. - Defaults to 5000ms. - :vartype request_timeout: ~datetime.timedelta + :ivar type: Managed service identity (system assigned and/or user assigned identities). + Possible values include: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, any] """ _attribute_map = { - 'max_concurrent_requests_per_instance': {'key': 'maxConcurrentRequestsPerInstance', 'type': 'int'}, - 'max_queue_wait': {'key': 'maxQueueWait', 'type': 'duration'}, - 'request_timeout': {'key': 'requestTimeout', 'type': 'duration'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{object}'}, } def __init__( @@ -19952,59 +22128,30 @@ def __init__( **kwargs ): """ - :keyword max_concurrent_requests_per_instance: The number of maximum concurrent requests per - node allowed per deployment. Defaults to 1. - :paramtype max_concurrent_requests_per_instance: int - :keyword max_queue_wait: (Deprecated for Managed Online Endpoints) The maximum amount of time a - request will stay in the queue in ISO 8601 format. - Defaults to 500ms. - (Now increase ``request_timeout_ms`` to account for any networking/queue delays). - :paramtype max_queue_wait: ~datetime.timedelta - :keyword request_timeout: The scoring timeout in ISO 8601 format. - Defaults to 5000ms. - :paramtype request_timeout: ~datetime.timedelta + :keyword type: Managed service identity (system assigned and/or user assigned identities). + Possible values include: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, any] """ - super(OnlineRequestSettings, self).__init__(**kwargs) - self.max_concurrent_requests_per_instance = kwargs.get('max_concurrent_requests_per_instance', 1) - self.max_queue_wait = kwargs.get('max_queue_wait', "PT0.5S") - self.request_timeout = kwargs.get('request_timeout', "PT5S") - + super(PartialManagedServiceIdentity, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) -class Operation(msrest.serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - Variables are only populated by the server, and will be ignored when sending a request. +class PartialMinimalTrackedResource(msrest.serialization.Model): + """Strictly used in update requests. - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.machinelearningservices.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", - "system", "user,system". - :vartype origin: str or ~azure.mgmt.machinelearningservices.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ActionType + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ - _validation = { - 'name': {'readonly': True}, - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - 'action_type': {'readonly': True}, - } - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__( @@ -20012,48 +22159,25 @@ def __init__( **kwargs ): """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.machinelearningservices.models.OperationDisplay + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] """ - super(Operation, self).__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = kwargs.get('display', None) - self.origin = None - self.action_type = None - + super(PartialMinimalTrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) -class OperationDisplay(msrest.serialization.Model): - """Localized display information for this particular operation. - Variables are only populated by the server, and will be ignored when sending a request. +class PartialMinimalTrackedResourceWithIdentity(PartialMinimalTrackedResource): + """Strictly used in update requests. - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity """ - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, - } - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'PartialManagedServiceIdentity'}, } def __init__( @@ -20061,33 +22185,27 @@ def __init__( **kwargs ): """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity """ - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - + super(PartialMinimalTrackedResourceWithIdentity, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) -class OperationListResult(msrest.serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - Variables are only populated by the server, and will be ignored when sending a request. +class PartialMinimalTrackedResourceWithSku(PartialMinimalTrackedResource): + """Strictly used in update requests. - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.machinelearningservices.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku """ - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'PartialSku'}, } def __init__( @@ -20095,49 +22213,65 @@ def __init__( **kwargs ): """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku """ - super(OperationListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None + super(PartialMinimalTrackedResourceWithSku, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) -class OutboundRuleBasicResource(Resource): - """Outbound Rule Basic Resource for the managed network of a machine learning workspace. +class PartialMinimalTrackedResourceWithSkuAndIdentity(PartialMinimalTrackedResource): + """Strictly used in update requests. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'PartialManagedServiceIdentity'}, + 'sku': {'key': 'sku', 'type': 'PartialSku'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + """ + super(PartialMinimalTrackedResourceWithSkuAndIdentity, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.sku = kwargs.get('sku', None) - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. +class PartialRegistryPartialTrackedResource(msrest.serialization.Model): + """Strictly used in update requests. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. Outbound Rule for the managed network of a machine learning - workspace. - :vartype properties: ~azure.mgmt.machinelearningservices.models.OutboundRule + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: + ~azure.mgmt.machinelearningservices.models.RegistryPartialManagedServiceIdentity + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'OutboundRule'}, + 'identity': {'key': 'identity', 'type': 'RegistryPartialManagedServiceIdentity'}, + 'sku': {'key': 'sku', 'type': 'PartialSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__( @@ -20145,28 +22279,46 @@ def __init__( **kwargs ): """ - :keyword properties: Required. Outbound Rule for the managed network of a machine learning - workspace. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.OutboundRule + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: + ~azure.mgmt.machinelearningservices.models.RegistryPartialManagedServiceIdentity + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] """ - super(OutboundRuleBasicResource, self).__init__(**kwargs) - self.properties = kwargs['properties'] + super(PartialRegistryPartialTrackedResource, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.sku = kwargs.get('sku', None) + self.tags = kwargs.get('tags', None) -class OutboundRuleListResult(msrest.serialization.Model): - """List of outbound rules for the managed network of a machine learning workspace. +class PartialSku(msrest.serialization.Model): + """Common SKU definition. - :ivar next_link: The link to the next page constructed using the continuationToken. If null, - there are no additional pages. - :vartype next_link: str - :ivar value: The list of machine learning workspaces. Since this list may be incomplete, the - nextLink field should be used to request the next list of machine learning workspaces. - :vartype value: list[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] + :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :vartype capacity: int + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. + :vartype name: str + :ivar size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :vartype size: str + :ivar tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :vartype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[OutboundRuleBasicResource]'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, } def __init__( @@ -20174,40 +22326,49 @@ def __init__( **kwargs ): """ - :keyword next_link: The link to the next page constructed using the continuationToken. If - null, there are no additional pages. - :paramtype next_link: str - :keyword value: The list of machine learning workspaces. Since this list may be incomplete, the - nextLink field should be used to request the next list of machine learning workspaces. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] + :keyword capacity: If the SKU supports scale out/in then the capacity integer should be + included. If scale out/in is not possible for the resource this may be omitted. + :paramtype capacity: int + :keyword family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. + :paramtype name: str + :keyword size: The SKU size. When the name field is the combination of tier and some other + value, this would be the standalone code. + :paramtype size: str + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :paramtype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier """ - super(OutboundRuleListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) + super(PartialSku, self).__init__(**kwargs) + self.capacity = kwargs.get('capacity', None) + self.family = kwargs.get('family', None) + self.name = kwargs.get('name', None) + self.size = kwargs.get('size', None) + self.tier = kwargs.get('tier', None) -class OutputPathAssetReference(AssetReferenceBase): - """Reference to an asset via its path in a job output. +class Password(msrest.serialization.Model): + """Password. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar reference_type: Required. [Required] Specifies the type of asset reference.Constant - filled by server. Possible values include: "Id", "DataPath", "OutputPath". - :vartype reference_type: str or ~azure.mgmt.machinelearningservices.models.ReferenceType - :ivar job_id: ARM resource ID of the job. - :vartype job_id: str - :ivar path: The path of the file/directory in the job output. - :vartype path: str + :ivar name: + :vartype name: str + :ivar value: + :vartype value: str """ _validation = { - 'reference_type': {'required': True}, + 'name': {'readonly': True}, + 'value': {'readonly': True}, } _attribute_map = { - 'reference_type': {'key': 'referenceType', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'path': {'key': 'path', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, } def __init__( @@ -20215,29 +22376,91 @@ def __init__( **kwargs ): """ - :keyword job_id: ARM resource ID of the job. - :paramtype job_id: str - :keyword path: The path of the file/directory in the job output. - :paramtype path: str """ - super(OutputPathAssetReference, self).__init__(**kwargs) - self.reference_type = 'OutputPath' # type: str - self.job_id = kwargs.get('job_id', None) - self.path = kwargs.get('path', None) + super(Password, self).__init__(**kwargs) + self.name = None + self.value = None -class PaginatedComputeResourcesList(msrest.serialization.Model): - """Paginated list of Machine Learning compute objects wrapped in ARM resource envelope. +class PATAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """PATAuthTypeWorkspaceConnectionProperties. - :ivar value: An array of Machine Learning compute objects wrapped in ARM resource envelope. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ComputeResource] - :ivar next_link: A continuation link (absolute URI) to the next page of results in the list. - :vartype next_link: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar auth_type: Required. Authentication type of the connection target.Constant filled by + server. Possible values include: "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", + "AccountKey", "ServicePrincipal", "AccessKey", "ApiKey", "CustomKeys", "OAuth2", "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Possible values include: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", + "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", + "Serverless". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken """ + _validation = { + 'auth_type': {'required': True}, + 'created_by_workspace_arm_id': {'readonly': True}, + 'group': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[ComputeResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'auth_type': {'key': 'authType', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, + 'group': {'key': 'group', 'type': 'str'}, + 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, + 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, + 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionPersonalAccessToken'}, } def __init__( @@ -20245,25 +22468,77 @@ def __init__( **kwargs ): """ - :keyword value: An array of Machine Learning compute objects wrapped in ARM resource envelope. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.ComputeResource] - :keyword next_link: A continuation link (absolute URI) to the next page of results in the list. - :paramtype next_link: str + :keyword category: Category of the connection. Possible values include: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", + "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", + "Serverless". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken """ - super(PaginatedComputeResourcesList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) + super(PATAuthTypeWorkspaceConnectionProperties, self).__init__(**kwargs) + self.auth_type = 'PAT' # type: str + self.credentials = kwargs.get('credentials', None) -class PartialBatchDeployment(msrest.serialization.Model): - """Mutable batch inference settings per deployment. +class PendingUploadCredentialDto(msrest.serialization.Model): + """PendingUploadCredentialDto. - :ivar description: Description of the endpoint deployment. - :vartype description: str + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: SASCredentialDto. + + All required parameters must be populated in order to send to Azure. + + :ivar credential_type: Required. [Required] Credential type used to authentication with + storage.Constant filled by server. Possible values include: "SAS". + :vartype credential_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadCredentialType """ + _validation = { + 'credential_type': {'required': True}, + } + _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, + 'credential_type': {'key': 'credentialType', 'type': 'str'}, + } + + _subtype_map = { + 'credential_type': {'SAS': 'SASCredentialDto'} } def __init__( @@ -20271,25 +22546,25 @@ def __init__( **kwargs ): """ - :keyword description: Description of the endpoint deployment. - :paramtype description: str """ - super(PartialBatchDeployment, self).__init__(**kwargs) - self.description = kwargs.get('description', None) + super(PendingUploadCredentialDto, self).__init__(**kwargs) + self.credential_type = None # type: Optional[str] -class PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties(msrest.serialization.Model): - """Strictly used in update requests. +class PendingUploadRequestDto(msrest.serialization.Model): + """PendingUploadRequestDto. - :ivar properties: Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] + :ivar pending_upload_id: If PendingUploadId = null then random guid will be used. + :vartype pending_upload_id: str + :ivar pending_upload_type: TemporaryBlobReference is the only supported type. Possible values + include: "None", "TemporaryBlobReference". + :vartype pending_upload_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadType """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'PartialBatchDeployment'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'pending_upload_id': {'key': 'pendingUploadId', 'type': 'str'}, + 'pending_upload_type': {'key': 'pendingUploadType', 'type': 'str'}, } def __init__( @@ -20297,33 +22572,36 @@ def __init__( **kwargs ): """ - :keyword properties: Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] + :keyword pending_upload_id: If PendingUploadId = null then random guid will be used. + :paramtype pending_upload_id: str + :keyword pending_upload_type: TemporaryBlobReference is the only supported type. Possible + values include: "None", "TemporaryBlobReference". + :paramtype pending_upload_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadType """ - super(PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.tags = kwargs.get('tags', None) + super(PendingUploadRequestDto, self).__init__(**kwargs) + self.pending_upload_id = kwargs.get('pending_upload_id', None) + self.pending_upload_type = kwargs.get('pending_upload_type', None) -class PartialManagedServiceIdentity(msrest.serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). +class PendingUploadResponseDto(msrest.serialization.Model): + """PendingUploadResponseDto. - :ivar type: Managed service identity (system assigned and/or user assigned identities). - Possible values include: "None", "SystemAssigned", "UserAssigned", - "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, any] + :ivar blob_reference_for_consumption: Container level read, write, list SAS. + :vartype blob_reference_for_consumption: + ~azure.mgmt.machinelearningservices.models.BlobReferenceForConsumptionDto + :ivar pending_upload_id: ID for this upload request. + :vartype pending_upload_id: str + :ivar pending_upload_type: TemporaryBlobReference is the only supported type. Possible values + include: "None", "TemporaryBlobReference". + :vartype pending_upload_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadType """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{object}'}, + 'blob_reference_for_consumption': {'key': 'blobReferenceForConsumption', 'type': 'BlobReferenceForConsumptionDto'}, + 'pending_upload_id': {'key': 'pendingUploadId', 'type': 'str'}, + 'pending_upload_type': {'key': 'pendingUploadType', 'type': 'str'}, } def __init__( @@ -20331,30 +22609,31 @@ def __init__( **kwargs ): """ - :keyword type: Managed service identity (system assigned and/or user assigned identities). - Possible values include: "None", "SystemAssigned", "UserAssigned", - "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, any] + :keyword blob_reference_for_consumption: Container level read, write, list SAS. + :paramtype blob_reference_for_consumption: + ~azure.mgmt.machinelearningservices.models.BlobReferenceForConsumptionDto + :keyword pending_upload_id: ID for this upload request. + :paramtype pending_upload_id: str + :keyword pending_upload_type: TemporaryBlobReference is the only supported type. Possible + values include: "None", "TemporaryBlobReference". + :paramtype pending_upload_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadType """ - super(PartialManagedServiceIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + super(PendingUploadResponseDto, self).__init__(**kwargs) + self.blob_reference_for_consumption = kwargs.get('blob_reference_for_consumption', None) + self.pending_upload_id = kwargs.get('pending_upload_id', None) + self.pending_upload_type = kwargs.get('pending_upload_type', None) -class PartialMinimalTrackedResource(msrest.serialization.Model): - """Strictly used in update requests. +class PersonalComputeInstanceSettings(msrest.serialization.Model): + """Settings for a personal compute instance. - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] + :ivar assigned_user: A user explicitly assigned to a personal compute instance. + :vartype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + 'assigned_user': {'key': 'assignedUser', 'type': 'AssignedUser'}, } def __init__( @@ -20362,25 +22641,89 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] + :keyword assigned_user: A user explicitly assigned to a personal compute instance. + :paramtype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser """ - super(PartialMinimalTrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) + super(PersonalComputeInstanceSettings, self).__init__(**kwargs) + self.assigned_user = kwargs.get('assigned_user', None) -class PartialMinimalTrackedResourceWithIdentity(PartialMinimalTrackedResource): - """Strictly used in update requests. +class PipelineJob(JobBaseProperties): + """Pipeline Job definition: defines generic to MFE attributes. - :ivar tags: A set of tags. Resource tags. + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :vartype tags: dict[str, str] - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :ivar component_id: ARM resource ID of the component resource. + :vartype component_id: str + :ivar compute_id: ARM resource ID of the compute resource. + :vartype compute_id: str + :ivar display_name: Display name of job. + :vartype display_name: str + :ivar experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :vartype experiment_name: str + :ivar identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar job_type: Required. [Required] Specifies the type of job.Constant filled by server. + Possible values include: "AutoML", "Command", "Sweep", "Pipeline", "Spark". + :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType + :ivar notification_setting: Notification setting for the job. + :vartype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :ivar services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :ivar status: Status of the job. Possible values include: "NotStarted", "Starting", + "Provisioning", "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", + "Failed", "Canceled", "NotResponding", "Paused", "Unknown". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :ivar inputs: Inputs for the pipeline job. + :vartype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] + :ivar jobs: Jobs construct the Pipeline Job. + :vartype jobs: dict[str, any] + :ivar outputs: Outputs for the pipeline job. + :vartype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :ivar settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. + :vartype settings: any + :ivar source_job_id: ARM resource ID of source job. + :vartype source_job_id: str """ + _validation = { + 'job_type': {'required': True}, + 'status': {'readonly': True}, + } + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'PartialManagedServiceIdentity'}, + 'component_id': {'key': 'componentId', 'type': 'str'}, + 'compute_id': {'key': 'computeId', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'experiment_name': {'key': 'experimentName', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'IdentityConfiguration'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'job_type': {'key': 'jobType', 'type': 'str'}, + 'notification_setting': {'key': 'notificationSetting', 'type': 'NotificationSetting'}, + 'services': {'key': 'services', 'type': '{JobService}'}, + 'status': {'key': 'status', 'type': 'str'}, + 'inputs': {'key': 'inputs', 'type': '{JobInput}'}, + 'jobs': {'key': 'jobs', 'type': '{object}'}, + 'outputs': {'key': 'outputs', 'type': '{JobOutput}'}, + 'settings': {'key': 'settings', 'type': 'object'}, + 'source_job_id': {'key': 'sourceJobId', 'type': 'str'}, } def __init__( @@ -20388,27 +22731,95 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :paramtype tags: dict[str, str] - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :keyword component_id: ARM resource ID of the component resource. + :paramtype component_id: str + :keyword compute_id: ARM resource ID of the compute resource. + :paramtype compute_id: str + :keyword display_name: Display name of job. + :paramtype display_name: str + :keyword experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :paramtype experiment_name: str + :keyword identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword notification_setting: Notification setting for the job. + :paramtype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :keyword services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :paramtype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :keyword inputs: Inputs for the pipeline job. + :paramtype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] + :keyword jobs: Jobs construct the Pipeline Job. + :paramtype jobs: dict[str, any] + :keyword outputs: Outputs for the pipeline job. + :paramtype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :keyword settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. + :paramtype settings: any + :keyword source_job_id: ARM resource ID of source job. + :paramtype source_job_id: str """ - super(PartialMinimalTrackedResourceWithIdentity, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) + super(PipelineJob, self).__init__(**kwargs) + self.job_type = 'Pipeline' # type: str + self.inputs = kwargs.get('inputs', None) + self.jobs = kwargs.get('jobs', None) + self.outputs = kwargs.get('outputs', None) + self.settings = kwargs.get('settings', None) + self.source_job_id = kwargs.get('source_job_id', None) -class PartialMinimalTrackedResourceWithSku(PartialMinimalTrackedResource): - """Strictly used in update requests. +class PredictionDriftMonitoringSignal(MonitoringSignalBase): + """PredictionDriftMonitoringSignal. - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + All required parameters must be populated in order to send to Azure. + + :ivar notification_types: The current notification mode for this signal. + :vartype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar signal_type: Required. [Required] Specifies the type of signal to monitor.Constant filled + by server. Possible values include: "DataDrift", "PredictionDrift", "DataQuality", + "FeatureAttributionDrift", "Custom". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar feature_data_type_override: A dictionary that maps feature names to their respective data + types. + :vartype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :ivar metric_thresholds: Required. [Required] A list of metrics to calculate and their + associated thresholds. + :vartype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.PredictionDriftMetricThresholdBase] + :ivar production_data: Required. [Required] The data which drift will be calculated for. + :vartype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :ivar reference_data: Required. [Required] The data to calculate drift against. + :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase """ + _validation = { + 'signal_type': {'required': True}, + 'metric_thresholds': {'required': True}, + 'production_data': {'required': True}, + 'reference_data': {'required': True}, + } + _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'PartialSku'}, + 'notification_types': {'key': 'notificationTypes', 'type': '[str]'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'signal_type': {'key': 'signalType', 'type': 'str'}, + 'feature_data_type_override': {'key': 'featureDataTypeOverride', 'type': '{str}'}, + 'metric_thresholds': {'key': 'metricThresholds', 'type': '[PredictionDriftMetricThresholdBase]'}, + 'production_data': {'key': 'productionData', 'type': 'MonitoringInputDataBase'}, + 'reference_data': {'key': 'referenceData', 'type': 'MonitoringInputDataBase'}, } def __init__( @@ -20416,30 +22827,47 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + :keyword notification_types: The current notification mode for this signal. + :paramtype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword feature_data_type_override: A dictionary that maps feature names to their respective + data types. + :paramtype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :keyword metric_thresholds: Required. [Required] A list of metrics to calculate and their + associated thresholds. + :paramtype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.PredictionDriftMetricThresholdBase] + :keyword production_data: Required. [Required] The data which drift will be calculated for. + :paramtype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :keyword reference_data: Required. [Required] The data to calculate drift against. + :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase """ - super(PartialMinimalTrackedResourceWithSku, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) + super(PredictionDriftMonitoringSignal, self).__init__(**kwargs) + self.signal_type = 'PredictionDrift' # type: str + self.feature_data_type_override = kwargs.get('feature_data_type_override', None) + self.metric_thresholds = kwargs['metric_thresholds'] + self.production_data = kwargs['production_data'] + self.reference_data = kwargs['reference_data'] -class PartialMinimalTrackedResourceWithSkuAndIdentity(PartialMinimalTrackedResource): - """Strictly used in update requests. +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str """ + _validation = { + 'id': {'readonly': True}, + } + _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'PartialManagedServiceIdentity'}, - 'sku': {'key': 'sku', 'type': 'PartialSku'}, + 'id': {'key': 'id', 'type': 'str'}, } def __init__( @@ -20447,34 +22875,67 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku """ - super(PartialMinimalTrackedResourceWithSkuAndIdentity, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.sku = kwargs.get('sku', None) + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None -class PartialRegistryPartialTrackedResource(msrest.serialization.Model): - """Strictly used in update requests. +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: - ~azure.mgmt.machinelearningservices.models.RegistryPartialManagedServiceIdentity - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku - :ivar tags: A set of tags. Resource tags. + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar location: Same as workspace location. + :vartype location: str + :ivar sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar tags: A set of tags. Dictionary of :code:``. :vartype tags: dict[str, str] + :ivar private_endpoint: The Private Endpoint resource. + :vartype private_endpoint: + ~azure.mgmt.machinelearningservices.models.WorkspacePrivateEndpointResource + :ivar private_link_service_connection_state: The connection state. + :vartype private_link_service_connection_state: + ~azure.mgmt.machinelearningservices.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnectionProvisioningState """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + _attribute_map = { - 'identity': {'key': 'identity', 'type': 'RegistryPartialManagedServiceIdentity'}, - 'sku': {'key': 'sku', 'type': 'PartialSku'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'WorkspacePrivateEndpointResource'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( @@ -20483,45 +22944,44 @@ def __init__( ): """ :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: - ~azure.mgmt.machinelearningservices.models.RegistryPartialManagedServiceIdentity - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku - :keyword tags: A set of tags. Resource tags. + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword location: Same as workspace location. + :paramtype location: str + :keyword sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword tags: A set of tags. Dictionary of :code:``. :paramtype tags: dict[str, str] + :keyword private_endpoint: The Private Endpoint resource. + :paramtype private_endpoint: + ~azure.mgmt.machinelearningservices.models.WorkspacePrivateEndpointResource + :keyword private_link_service_connection_state: The connection state. + :paramtype private_link_service_connection_state: + ~azure.mgmt.machinelearningservices.models.PrivateLinkServiceConnectionState + :keyword provisioning_state: The current provisioning state. Possible values include: + "Succeeded", "Creating", "Deleting", "Failed". + :paramtype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnectionProvisioningState """ - super(PartialRegistryPartialTrackedResource, self).__init__(**kwargs) + super(PrivateEndpointConnection, self).__init__(**kwargs) self.identity = kwargs.get('identity', None) + self.location = kwargs.get('location', None) self.sku = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = kwargs.get('provisioning_state', None) -class PartialSku(msrest.serialization.Model): - """Common SKU definition. +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connection associated with the specified workspace. - :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :vartype capacity: int - :ivar family: If the service has different generations of hardware, for the same SKU, then that - can be captured here. - :vartype family: str - :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. - :vartype name: str - :ivar size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :vartype size: str - :ivar tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] """ _attribute_map = { - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, } def __init__( @@ -20529,49 +22989,32 @@ def __init__( **kwargs ): """ - :keyword capacity: If the SKU supports scale out/in then the capacity integer should be - included. If scale out/in is not possible for the resource this may be omitted. - :paramtype capacity: int - :keyword family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :paramtype family: str - :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. - :paramtype name: str - :keyword size: The SKU size. When the name field is the combination of tier and some other - value, this would be the standalone code. - :paramtype size: str - :keyword tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", - "Standard", "Premium". - :paramtype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] """ - super(PartialSku, self).__init__(**kwargs) - self.capacity = kwargs.get('capacity', None) - self.family = kwargs.get('family', None) - self.name = kwargs.get('name', None) - self.size = kwargs.get('size', None) - self.tier = kwargs.get('tier', None) - + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) -class Password(msrest.serialization.Model): - """Password. - Variables are only populated by the server, and will be ignored when sending a request. +class PrivateEndpointDestination(msrest.serialization.Model): + """Private Endpoint destination for a Private Endpoint Outbound Rule for the managed network of a machine learning workspace. - :ivar name: - :vartype name: str - :ivar value: - :vartype value: str + :ivar service_resource_id: + :vartype service_resource_id: str + :ivar spark_enabled: + :vartype spark_enabled: bool + :ivar spark_status: Type of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Inactive", "Active". + :vartype spark_status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :ivar subresource_target: + :vartype subresource_target: str """ - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, + 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, + 'spark_enabled': {'key': 'sparkEnabled', 'type': 'bool'}, + 'spark_status': {'key': 'sparkStatus', 'type': 'str'}, + 'subresource_target': {'key': 'subresourceTarget', 'type': 'str'}, } def __init__( @@ -20579,85 +23022,61 @@ def __init__( **kwargs ): """ + :keyword service_resource_id: + :paramtype service_resource_id: str + :keyword spark_enabled: + :paramtype spark_enabled: bool + :keyword spark_status: Type of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Inactive", "Active". + :paramtype spark_status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :keyword subresource_target: + :paramtype subresource_target: str """ - super(Password, self).__init__(**kwargs) - self.name = None - self.value = None + super(PrivateEndpointDestination, self).__init__(**kwargs) + self.service_resource_id = kwargs.get('service_resource_id', None) + self.spark_enabled = kwargs.get('spark_enabled', None) + self.spark_status = kwargs.get('spark_status', None) + self.subresource_target = kwargs.get('subresource_target', None) -class PATAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """PATAuthTypeWorkspaceConnectionProperties. +class PrivateEndpointOutboundRule(OutboundRule): + """Private Endpoint Outbound Rule for the managed network of a machine learning workspace. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar auth_type: Required. Authentication type of the connection target.Constant filled by - server. Possible values include: "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", - "AccountKey", "ServicePrincipal", "AccessKey", "ApiKey", "CustomKeys", "OAuth2", "AAD". - :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType - :ivar category: Category of the connection. Possible values include: "PythonFeed", - "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", - "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", - "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", - "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", - "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", - "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", - "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", - "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", - "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", - "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", - "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", - "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", - "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", - "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", - "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". - :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :ivar created_by_workspace_arm_id: - :vartype created_by_workspace_arm_id: str - :ivar expiry_time: - :vartype expiry_time: ~datetime.datetime - :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", - "Database", "NoSQL", "File", "GenericProtocol", "ServicesAndApps". - :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup - :ivar is_shared_to_all: - :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str - :ivar metadata: Store user metadata for this connection. - :vartype metadata: dict[str, str] - :ivar shared_user_list: - :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :ivar credentials: - :vartype credentials: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken + :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Required", "Recommended", "UserDefined", "Dependency". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :ivar parent_rule_names: + :vartype parent_rule_names: list[str] + :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Possible + values include: "Inactive", "Active". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :ivar type: Required. Type of a managed network Outbound Rule of a machine learning + workspace.Constant filled by server. Possible values include: "FQDN", "PrivateEndpoint", + "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.RuleType + :ivar destination: Private Endpoint destination for a Private Endpoint Outbound Rule for the + managed network of a machine learning workspace. + :vartype destination: ~azure.mgmt.machinelearningservices.models.PrivateEndpointDestination + :ivar fqdns: + :vartype fqdns: list[str] """ _validation = { - 'auth_type': {'required': True}, - 'created_by_workspace_arm_id': {'readonly': True}, - 'group': {'readonly': True}, + 'parent_rule_names': {'readonly': True}, + 'type': {'required': True}, } _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, - 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, - 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, - 'group': {'key': 'group', 'type': 'str'}, - 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, - 'metadata': {'key': 'metadata', 'type': '{str}'}, - 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionPersonalAccessToken'}, + 'parent_rule_names': {'key': 'parentRuleNames', 'type': '[str]'}, + 'status': {'key': 'status', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'destination': {'key': 'destination', 'type': 'PrivateEndpointDestination'}, + 'fqdns': {'key': 'fqdns', 'type': '[str]'}, } def __init__( @@ -20665,73 +23084,42 @@ def __init__( **kwargs ): """ - :keyword category: Category of the connection. Possible values include: "PythonFeed", - "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", - "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", - "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", - "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", - "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", - "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", - "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", - "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", - "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", - "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", - "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", - "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", - "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", - "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", - "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". - :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :keyword expiry_time: - :paramtype expiry_time: ~datetime.datetime - :keyword is_shared_to_all: - :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str - :keyword metadata: Store user metadata for this connection. - :paramtype metadata: dict[str, str] - :keyword shared_user_list: - :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :keyword credentials: - :paramtype credentials: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken + :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Required", "Recommended", "UserDefined", "Dependency". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :keyword status: Type of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Inactive", "Active". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :keyword destination: Private Endpoint destination for a Private Endpoint Outbound Rule for the + managed network of a machine learning workspace. + :paramtype destination: ~azure.mgmt.machinelearningservices.models.PrivateEndpointDestination + :keyword fqdns: + :paramtype fqdns: list[str] """ - super(PATAuthTypeWorkspaceConnectionProperties, self).__init__(**kwargs) - self.auth_type = 'PAT' # type: str - self.credentials = kwargs.get('credentials', None) - + super(PrivateEndpointOutboundRule, self).__init__(**kwargs) + self.type = 'PrivateEndpoint' # type: str + self.destination = kwargs.get('destination', None) + self.fqdns = kwargs.get('fqdns', None) -class PendingUploadCredentialDto(msrest.serialization.Model): - """PendingUploadCredentialDto. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: SASCredentialDto. +class PrivateEndpointResource(PrivateEndpoint): + """The PE network resource that is linked to this PE connection. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar credential_type: Required. [Required] Credential type used to authentication with - storage.Constant filled by server. Possible values include: "SAS". - :vartype credential_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadCredentialType + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + :ivar subnet_arm_id: The subnetId that the private endpoint is connected to. + :vartype subnet_arm_id: str """ _validation = { - 'credential_type': {'required': True}, + 'id': {'readonly': True}, } _attribute_map = { - 'credential_type': {'key': 'credentialType', 'type': 'str'}, - } - - _subtype_map = { - 'credential_type': {'SAS': 'SASCredentialDto'} + 'id': {'key': 'id', 'type': 'str'}, + 'subnet_arm_id': {'key': 'subnetArmId', 'type': 'str'}, } def __init__( @@ -20739,25 +23127,65 @@ def __init__( **kwargs ): """ + :keyword subnet_arm_id: The subnetId that the private endpoint is connected to. + :paramtype subnet_arm_id: str """ - super(PendingUploadCredentialDto, self).__init__(**kwargs) - self.credential_type = None # type: Optional[str] + super(PrivateEndpointResource, self).__init__(**kwargs) + self.subnet_arm_id = kwargs.get('subnet_arm_id', None) -class PendingUploadRequestDto(msrest.serialization.Model): - """PendingUploadRequestDto. +class PrivateLinkResource(Resource): + """A private link resource. - :ivar pending_upload_id: If PendingUploadId = null then random guid will be used. - :vartype pending_upload_id: str - :ivar pending_upload_type: TemporaryBlobReference is the only supported type. Possible values - include: "None", "TemporaryBlobReference". - :vartype pending_upload_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadType + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar location: Same as workspace location. + :vartype location: str + :ivar sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar tags: A set of tags. Dictionary of :code:``. + :vartype tags: dict[str, str] + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + _attribute_map = { - 'pending_upload_id': {'key': 'pendingUploadId', 'type': 'str'}, - 'pending_upload_type': {'key': 'pendingUploadType', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, } def __init__( @@ -20765,36 +23193,41 @@ def __init__( **kwargs ): """ - :keyword pending_upload_id: If PendingUploadId = null then random guid will be used. - :paramtype pending_upload_id: str - :keyword pending_upload_type: TemporaryBlobReference is the only supported type. Possible - values include: "None", "TemporaryBlobReference". - :paramtype pending_upload_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadType + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword location: Same as workspace location. + :paramtype location: str + :keyword sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword tags: A set of tags. Dictionary of :code:``. + :paramtype tags: dict[str, str] + :keyword group_id: The private link resource group id. + :paramtype group_id: str + :keyword required_members: The private link resource required member names. + :paramtype required_members: list[str] + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] """ - super(PendingUploadRequestDto, self).__init__(**kwargs) - self.pending_upload_id = kwargs.get('pending_upload_id', None) - self.pending_upload_type = kwargs.get('pending_upload_type', None) + super(PrivateLinkResource, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.location = kwargs.get('location', None) + self.sku = kwargs.get('sku', None) + self.tags = kwargs.get('tags', None) + self.group_id = kwargs.get('group_id', None) + self.required_members = kwargs.get('required_members', None) + self.required_zone_names = kwargs.get('required_zone_names', None) -class PendingUploadResponseDto(msrest.serialization.Model): - """PendingUploadResponseDto. +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. - :ivar blob_reference_for_consumption: Container level read, write, list SAS. - :vartype blob_reference_for_consumption: - ~azure.mgmt.machinelearningservices.models.BlobReferenceForConsumptionDto - :ivar pending_upload_id: ID for this upload request. - :vartype pending_upload_id: str - :ivar pending_upload_type: TemporaryBlobReference is the only supported type. Possible values - include: "None", "TemporaryBlobReference". - :vartype pending_upload_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadType + :ivar value: + :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] """ _attribute_map = { - 'blob_reference_for_consumption': {'key': 'blobReferenceForConsumption', 'type': 'BlobReferenceForConsumptionDto'}, - 'pending_upload_id': {'key': 'pendingUploadId', 'type': 'str'}, - 'pending_upload_type': {'key': 'pendingUploadType', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, } def __init__( @@ -20802,31 +23235,31 @@ def __init__( **kwargs ): """ - :keyword blob_reference_for_consumption: Container level read, write, list SAS. - :paramtype blob_reference_for_consumption: - ~azure.mgmt.machinelearningservices.models.BlobReferenceForConsumptionDto - :keyword pending_upload_id: ID for this upload request. - :paramtype pending_upload_id: str - :keyword pending_upload_type: TemporaryBlobReference is the only supported type. Possible - values include: "None", "TemporaryBlobReference". - :paramtype pending_upload_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadType + :keyword value: + :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] """ - super(PendingUploadResponseDto, self).__init__(**kwargs) - self.blob_reference_for_consumption = kwargs.get('blob_reference_for_consumption', None) - self.pending_upload_id = kwargs.get('pending_upload_id', None) - self.pending_upload_type = kwargs.get('pending_upload_type', None) + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) -class PersonalComputeInstanceSettings(msrest.serialization.Model): - """Settings for a personal compute instance. +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. - :ivar assigned_user: A user explicitly assigned to a personal compute instance. - :vartype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser + :ivar actions_required: Some RP chose "None". Other RPs use this for region expansion. + :vartype actions_required: str + :ivar description: User-defined message that, per NRP doc, may be used for approval-related + message. + :vartype description: str + :ivar status: Connection status of the service consumer with the service provider. Possible + values include: "Approved", "Pending", "Rejected", "Disconnected", "Timeout". + :vartype status: str or + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ _attribute_map = { - 'assigned_user': {'key': 'assignedUser', 'type': 'AssignedUser'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, } def __init__( @@ -20834,89 +23267,43 @@ def __init__( **kwargs ): """ - :keyword assigned_user: A user explicitly assigned to a personal compute instance. - :paramtype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser + :keyword actions_required: Some RP chose "None". Other RPs use this for region expansion. + :paramtype actions_required: str + :keyword description: User-defined message that, per NRP doc, may be used for approval-related + message. + :paramtype description: str + :keyword status: Connection status of the service consumer with the service provider. Possible + values include: "Approved", "Pending", "Rejected", "Disconnected", "Timeout". + :paramtype status: str or + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ - super(PersonalComputeInstanceSettings, self).__init__(**kwargs) - self.assigned_user = kwargs.get('assigned_user', None) - - -class PipelineJob(JobBaseProperties): - """Pipeline Job definition: defines generic to MFE attributes. + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.actions_required = kwargs.get('actions_required', None) + self.description = kwargs.get('description', None) + self.status = kwargs.get('status', None) - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. +class ProbeSettings(msrest.serialization.Model): + """Deployment container liveness/readiness probe configuration. - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar component_id: ARM resource ID of the component resource. - :vartype component_id: str - :ivar compute_id: ARM resource ID of the compute resource. - :vartype compute_id: str - :ivar display_name: Display name of job. - :vartype display_name: str - :ivar experiment_name: The name of the experiment the job belongs to. If not set, the job is - placed in the "Default" experiment. - :vartype experiment_name: str - :ivar identity: Identity configuration. If set, this should be one of AmlToken, - ManagedIdentity, UserIdentity or null. - Defaults to AmlToken if null. - :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar job_type: Required. [Required] Specifies the type of job.Constant filled by server. - Possible values include: "AutoML", "Command", "Sweep", "Pipeline", "Spark". - :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType - :ivar notification_setting: Notification setting for the job. - :vartype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting - :ivar services: List of JobEndpoints. - For local jobs, a job endpoint will have an endpoint value of FileStreamObject. - :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] - :ivar status: Status of the job. Possible values include: "NotStarted", "Starting", - "Provisioning", "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", - "Failed", "Canceled", "NotResponding", "Paused", "Unknown". - :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus - :ivar inputs: Inputs for the pipeline job. - :vartype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] - :ivar jobs: Jobs construct the Pipeline Job. - :vartype jobs: dict[str, any] - :ivar outputs: Outputs for the pipeline job. - :vartype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] - :ivar settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. - :vartype settings: any - :ivar source_job_id: ARM resource ID of source job. - :vartype source_job_id: str + :ivar failure_threshold: The number of failures to allow before returning an unhealthy status. + :vartype failure_threshold: int + :ivar initial_delay: The delay before the first probe in ISO 8601 format. + :vartype initial_delay: ~datetime.timedelta + :ivar period: The length of time between probes in ISO 8601 format. + :vartype period: ~datetime.timedelta + :ivar success_threshold: The number of successful probes before returning a healthy status. + :vartype success_threshold: int + :ivar timeout: The probe timeout in ISO 8601 format. + :vartype timeout: ~datetime.timedelta """ - _validation = { - 'job_type': {'required': True}, - 'status': {'readonly': True}, - } - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'component_id': {'key': 'componentId', 'type': 'str'}, - 'compute_id': {'key': 'computeId', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'experiment_name': {'key': 'experimentName', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'IdentityConfiguration'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'notification_setting': {'key': 'notificationSetting', 'type': 'NotificationSetting'}, - 'services': {'key': 'services', 'type': '{JobService}'}, - 'status': {'key': 'status', 'type': 'str'}, - 'inputs': {'key': 'inputs', 'type': '{JobInput}'}, - 'jobs': {'key': 'jobs', 'type': '{object}'}, - 'outputs': {'key': 'outputs', 'type': '{JobOutput}'}, - 'settings': {'key': 'settings', 'type': 'object'}, - 'source_job_id': {'key': 'sourceJobId', 'type': 'str'}, + 'failure_threshold': {'key': 'failureThreshold', 'type': 'int'}, + 'initial_delay': {'key': 'initialDelay', 'type': 'duration'}, + 'period': {'key': 'period', 'type': 'duration'}, + 'success_threshold': {'key': 'successThreshold', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'duration'}, } def __init__( @@ -20924,95 +23311,45 @@ def __init__( **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword component_id: ARM resource ID of the component resource. - :paramtype component_id: str - :keyword compute_id: ARM resource ID of the compute resource. - :paramtype compute_id: str - :keyword display_name: Display name of job. - :paramtype display_name: str - :keyword experiment_name: The name of the experiment the job belongs to. If not set, the job is - placed in the "Default" experiment. - :paramtype experiment_name: str - :keyword identity: Identity configuration. If set, this should be one of AmlToken, - ManagedIdentity, UserIdentity or null. - Defaults to AmlToken if null. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword notification_setting: Notification setting for the job. - :paramtype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting - :keyword services: List of JobEndpoints. - For local jobs, a job endpoint will have an endpoint value of FileStreamObject. - :paramtype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] - :keyword inputs: Inputs for the pipeline job. - :paramtype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] - :keyword jobs: Jobs construct the Pipeline Job. - :paramtype jobs: dict[str, any] - :keyword outputs: Outputs for the pipeline job. - :paramtype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] - :keyword settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. - :paramtype settings: any - :keyword source_job_id: ARM resource ID of source job. - :paramtype source_job_id: str + :keyword failure_threshold: The number of failures to allow before returning an unhealthy + status. + :paramtype failure_threshold: int + :keyword initial_delay: The delay before the first probe in ISO 8601 format. + :paramtype initial_delay: ~datetime.timedelta + :keyword period: The length of time between probes in ISO 8601 format. + :paramtype period: ~datetime.timedelta + :keyword success_threshold: The number of successful probes before returning a healthy status. + :paramtype success_threshold: int + :keyword timeout: The probe timeout in ISO 8601 format. + :paramtype timeout: ~datetime.timedelta """ - super(PipelineJob, self).__init__(**kwargs) - self.job_type = 'Pipeline' # type: str - self.inputs = kwargs.get('inputs', None) - self.jobs = kwargs.get('jobs', None) - self.outputs = kwargs.get('outputs', None) - self.settings = kwargs.get('settings', None) - self.source_job_id = kwargs.get('source_job_id', None) - - -class PredictionDriftMonitoringSignal(MonitoringSignalBase): - """PredictionDriftMonitoringSignal. + super(ProbeSettings, self).__init__(**kwargs) + self.failure_threshold = kwargs.get('failure_threshold', 30) + self.initial_delay = kwargs.get('initial_delay', None) + self.period = kwargs.get('period', "PT10S") + self.success_threshold = kwargs.get('success_threshold', 1) + self.timeout = kwargs.get('timeout', "PT2S") - All required parameters must be populated in order to send to Azure. - :ivar notification_types: The current notification mode for this signal. - :vartype notification_types: list[str or - ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] - :ivar properties: Property dictionary. Properties can be added, but not removed or altered. - :vartype properties: dict[str, str] - :ivar signal_type: Required. [Required] Specifies the type of signal to monitor.Constant filled - by server. Possible values include: "DataDrift", "PredictionDrift", "DataQuality", - "FeatureAttributionDrift", "Custom". - :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType - :ivar feature_data_type_override: A dictionary that maps feature names to their respective data - types. - :vartype feature_data_type_override: dict[str, str or - ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] - :ivar metric_thresholds: Required. [Required] A list of metrics to calculate and their - associated thresholds. - :vartype metric_thresholds: - list[~azure.mgmt.machinelearningservices.models.PredictionDriftMetricThresholdBase] - :ivar production_data: Required. [Required] The data which drift will be calculated for. - :vartype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase - :ivar reference_data: Required. [Required] The data to calculate drift against. - :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase +class PyTorch(DistributionConfiguration): + """PyTorch distribution configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar distribution_type: Required. [Required] Specifies the type of distribution + framework.Constant filled by server. Possible values include: "PyTorch", "TensorFlow", "Mpi". + :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType + :ivar process_count_per_instance: Number of processes per node. + :vartype process_count_per_instance: int """ _validation = { - 'signal_type': {'required': True}, - 'metric_thresholds': {'required': True}, - 'production_data': {'required': True}, - 'reference_data': {'required': True}, + 'distribution_type': {'required': True}, } _attribute_map = { - 'notification_types': {'key': 'notificationTypes', 'type': '[str]'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'signal_type': {'key': 'signalType', 'type': 'str'}, - 'feature_data_type_override': {'key': 'featureDataTypeOverride', 'type': '{str}'}, - 'metric_thresholds': {'key': 'metricThresholds', 'type': '[PredictionDriftMetricThresholdBase]'}, - 'production_data': {'key': 'productionData', 'type': 'MonitoringInputDataBase'}, - 'reference_data': {'key': 'referenceData', 'type': 'MonitoringInputDataBase'}, + 'distribution_type': {'key': 'distributionType', 'type': 'str'}, + 'process_count_per_instance': {'key': 'processCountPerInstance', 'type': 'int'}, } def __init__( @@ -21020,47 +23357,24 @@ def __init__( **kwargs ): """ - :keyword notification_types: The current notification mode for this signal. - :paramtype notification_types: list[str or - ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. - :paramtype properties: dict[str, str] - :keyword feature_data_type_override: A dictionary that maps feature names to their respective - data types. - :paramtype feature_data_type_override: dict[str, str or - ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] - :keyword metric_thresholds: Required. [Required] A list of metrics to calculate and their - associated thresholds. - :paramtype metric_thresholds: - list[~azure.mgmt.machinelearningservices.models.PredictionDriftMetricThresholdBase] - :keyword production_data: Required. [Required] The data which drift will be calculated for. - :paramtype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase - :keyword reference_data: Required. [Required] The data to calculate drift against. - :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :keyword process_count_per_instance: Number of processes per node. + :paramtype process_count_per_instance: int """ - super(PredictionDriftMonitoringSignal, self).__init__(**kwargs) - self.signal_type = 'PredictionDrift' # type: str - self.feature_data_type_override = kwargs.get('feature_data_type_override', None) - self.metric_thresholds = kwargs['metric_thresholds'] - self.production_data = kwargs['production_data'] - self.reference_data = kwargs['reference_data'] - + super(PyTorch, self).__init__(**kwargs) + self.distribution_type = 'PyTorch' # type: str + self.process_count_per_instance = kwargs.get('process_count_per_instance', None) -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - Variables are only populated by the server, and will be ignored when sending a request. +class QueueSettings(msrest.serialization.Model): + """QueueSettings. - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str + :ivar job_tier: Controls the compute job tier. Possible values include: "Null", "Spot", + "Basic", "Standard", "Premium". + :vartype job_tier: str or ~azure.mgmt.machinelearningservices.models.JobTier """ - _validation = { - 'id': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + 'job_tier': {'key': 'jobTier', 'type': 'str'}, } def __init__( @@ -21068,67 +23382,32 @@ def __init__( **kwargs ): """ + :keyword job_tier: Controls the compute job tier. Possible values include: "Null", "Spot", + "Basic", "Standard", "Premium". + :paramtype job_tier: str or ~azure.mgmt.machinelearningservices.models.JobTier """ - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - + super(QueueSettings, self).__init__(**kwargs) + self.job_tier = kwargs.get('job_tier', None) -class PrivateEndpointConnection(Resource): - """The Private Endpoint Connection resource. - Variables are only populated by the server, and will be ignored when sending a request. +class QuotaBaseProperties(msrest.serialization.Model): + """The properties for Quota update or retrieval. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Specifies the resource ID. :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: Specifies the resource type. :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar private_endpoint: The resource of private end point. - :vartype private_endpoint: ~azure.mgmt.machinelearningservices.models.PrivateEndpoint - :ivar private_link_service_connection_state: A collection of information about the state of the - connection between service consumer and provider. - :vartype private_link_service_connection_state: - ~azure.mgmt.machinelearningservices.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnectionProvisioningState + :ivar limit: The maximum permitted quota of the resource. + :vartype limit: long + :ivar unit: An enum describing the unit of quota measurement. Possible values include: "Count". + :vartype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'unit': {'key': 'unit', 'type': 'str'}, } def __init__( @@ -21136,40 +23415,35 @@ def __init__( **kwargs ): """ - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword private_endpoint: The resource of private end point. - :paramtype private_endpoint: ~azure.mgmt.machinelearningservices.models.PrivateEndpoint - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.machinelearningservices.models.PrivateLinkServiceConnectionState + :keyword id: Specifies the resource ID. + :paramtype id: str + :keyword type: Specifies the resource type. + :paramtype type: str + :keyword limit: The maximum permitted quota of the resource. + :paramtype limit: long + :keyword unit: An enum describing the unit of quota measurement. Possible values include: + "Count". + :paramtype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit """ - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None + super(QuotaBaseProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.limit = kwargs.get('limit', None) + self.unit = kwargs.get('unit', None) -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """List of private endpoint connection associated with the specified workspace. +class QuotaUpdateParameters(msrest.serialization.Model): + """Quota update parameters. - :ivar value: Array of private endpoint connections. - :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] + :ivar value: The list for update quota. + :vartype value: list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] + :ivar location: Region of workspace quota to be updated. + :vartype location: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'value': {'key': 'value', 'type': '[QuotaBaseProperties]'}, + 'location': {'key': 'location', 'type': 'str'}, } def __init__( @@ -21177,32 +23451,28 @@ def __init__( **kwargs ): """ - :keyword value: Array of private endpoint connections. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] + :keyword value: The list for update quota. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] + :keyword location: Region of workspace quota to be updated. + :paramtype location: str """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super(QuotaUpdateParameters, self).__init__(**kwargs) self.value = kwargs.get('value', None) + self.location = kwargs.get('location', None) -class PrivateEndpointDestination(msrest.serialization.Model): - """Private Endpoint destination for a Private Endpoint Outbound Rule for the managed network of a machine learning workspace. +class RaiBlocklistConfig(msrest.serialization.Model): + """Azure OpenAI blocklist config. - :ivar service_resource_id: - :vartype service_resource_id: str - :ivar spark_enabled: - :vartype spark_enabled: bool - :ivar spark_status: Type of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Inactive", "Active". - :vartype spark_status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus - :ivar subresource_target: - :vartype subresource_target: str + :ivar blocking: If blocking would occur. + :vartype blocking: bool + :ivar blocklist_name: Name of ContentFilter. + :vartype blocklist_name: str """ _attribute_map = { - 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, - 'spark_enabled': {'key': 'sparkEnabled', 'type': 'bool'}, - 'spark_status': {'key': 'sparkStatus', 'type': 'str'}, - 'subresource_target': {'key': 'subresourceTarget', 'type': 'str'}, + 'blocking': {'key': 'blocking', 'type': 'bool'}, + 'blocklist_name': {'key': 'blocklistName', 'type': 'str'}, } def __init__( @@ -21210,92 +23480,57 @@ def __init__( **kwargs ): """ - :keyword service_resource_id: - :paramtype service_resource_id: str - :keyword spark_enabled: - :paramtype spark_enabled: bool - :keyword spark_status: Type of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Inactive", "Active". - :paramtype spark_status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus - :keyword subresource_target: - :paramtype subresource_target: str + :keyword blocking: If blocking would occur. + :paramtype blocking: bool + :keyword blocklist_name: Name of ContentFilter. + :paramtype blocklist_name: str """ - super(PrivateEndpointDestination, self).__init__(**kwargs) - self.service_resource_id = kwargs.get('service_resource_id', None) - self.spark_enabled = kwargs.get('spark_enabled', None) - self.spark_status = kwargs.get('spark_status', None) - self.subresource_target = kwargs.get('subresource_target', None) - + super(RaiBlocklistConfig, self).__init__(**kwargs) + self.blocking = kwargs.get('blocking', None) + self.blocklist_name = kwargs.get('blocklist_name', None) -class PrivateEndpointOutboundRule(OutboundRule): - """Private Endpoint Outbound Rule for the managed network of a machine learning workspace. - All required parameters must be populated in order to send to Azure. +class RaiBlocklistItemBulkRequest(msrest.serialization.Model): + """The Cognitive Services RaiBlocklist Item request body. - :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Required", "Recommended", "UserDefined", "Dependency". - :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory - :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Possible - values include: "Inactive", "Active". - :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus - :ivar type: Required. Type of a managed network Outbound Rule of a machine learning - workspace.Constant filled by server. Possible values include: "FQDN", "PrivateEndpoint", - "ServiceTag". - :vartype type: str or ~azure.mgmt.machinelearningservices.models.RuleType - :ivar destination: Private Endpoint destination for a Private Endpoint Outbound Rule for the - managed network of a machine learning workspace. - :vartype destination: ~azure.mgmt.machinelearningservices.models.PrivateEndpointDestination + :ivar name: + :vartype name: str + :ivar properties: Properties of Cognitive Services RaiBlocklist Item. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemProperties """ - _validation = { - 'type': {'required': True}, - } - _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'destination': {'key': 'destination', 'type': 'PrivateEndpointDestination'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Required", "Recommended", "UserDefined", "Dependency". - :paramtype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory - :keyword status: Type of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Inactive", "Active". - :paramtype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus - :keyword destination: Private Endpoint destination for a Private Endpoint Outbound Rule for the - managed network of a machine learning workspace. - :paramtype destination: ~azure.mgmt.machinelearningservices.models.PrivateEndpointDestination - """ - super(PrivateEndpointOutboundRule, self).__init__(**kwargs) - self.type = 'PrivateEndpoint' # type: str - self.destination = kwargs.get('destination', None) + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RaiBlocklistItemProperties'}, + } + def __init__( + self, + **kwargs + ): + """ + :keyword name: + :paramtype name: str + :keyword properties: Properties of Cognitive Services RaiBlocklist Item. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemProperties + """ + super(RaiBlocklistItemBulkRequest, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) -class PrivateEndpointResource(PrivateEndpoint): - """The PE network resource that is linked to this PE connection. - Variables are only populated by the server, and will be ignored when sending a request. +class RaiBlocklistItemProperties(msrest.serialization.Model): + """RAI Custom Blocklist Item properties. - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - :ivar subnet_arm_id: The subnetId that the private endpoint is connected to. - :vartype subnet_arm_id: str + :ivar is_regex: If the pattern is a regex pattern. + :vartype is_regex: bool + :ivar pattern: Pattern to match against. + :vartype pattern: str """ - _validation = { - 'id': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'subnet_arm_id': {'key': 'subnetArmId', 'type': 'str'}, + 'is_regex': {'key': 'isRegex', 'type': 'bool'}, + 'pattern': {'key': 'pattern', 'type': 'str'}, } def __init__( @@ -21303,18 +23538,23 @@ def __init__( **kwargs ): """ - :keyword subnet_arm_id: The subnetId that the private endpoint is connected to. - :paramtype subnet_arm_id: str + :keyword is_regex: If the pattern is a regex pattern. + :paramtype is_regex: bool + :keyword pattern: Pattern to match against. + :paramtype pattern: str """ - super(PrivateEndpointResource, self).__init__(**kwargs) - self.subnet_arm_id = kwargs.get('subnet_arm_id', None) + super(RaiBlocklistItemProperties, self).__init__(**kwargs) + self.is_regex = kwargs.get('is_regex', None) + self.pattern = kwargs.get('pattern', None) -class PrivateLinkResource(Resource): - """A private link resource. +class RaiBlocklistItemPropertiesBasicResource(Resource): + """RaiBlocklistItemPropertiesBasicResource. Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str @@ -21326,20 +23566,8 @@ class PrivateLinkResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource Private link DNS zone name. - :vartype required_zone_names: list[str] + :ivar properties: Required. RAI Custom Blocklist Item properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemProperties """ _validation = { @@ -21347,8 +23575,7 @@ class PrivateLinkResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, + 'properties': {'required': True}, } _attribute_map = { @@ -21356,13 +23583,7 @@ class PrivateLinkResource(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + 'properties': {'key': 'properties', 'type': 'RaiBlocklistItemProperties'}, } def __init__( @@ -21370,36 +23591,26 @@ def __init__( **kwargs ): """ - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword required_zone_names: The private link resource Private link DNS zone name. - :paramtype required_zone_names: list[str] + :keyword properties: Required. RAI Custom Blocklist Item properties. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemProperties """ - super(PrivateLinkResource, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) + super(RaiBlocklistItemPropertiesBasicResource, self).__init__(**kwargs) + self.properties = kwargs['properties'] -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. +class RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult(msrest.serialization.Model): + """RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult. - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[RaiBlocklistItemPropertiesBasicResource]'}, } def __init__( @@ -21407,32 +23618,26 @@ def __init__( **kwargs ): """ - :keyword value: Array of private link resources. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] """ - super(PrivateLinkResourceListResult, self).__init__(**kwargs) + super(RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. +class RaiBlocklistProperties(msrest.serialization.Model): + """RAI Custom Blocklist properties. - :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected", "Disconnected", - "Timeout". - :vartype status: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointServiceConnectionStatus - :ivar description: The reason for approval/rejection of the connection. + :ivar description: Description of the block list. :vartype description: str - :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :vartype actions_required: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -21440,44 +23645,49 @@ def __init__( **kwargs ): """ - :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Possible values include: "Pending", "Approved", "Rejected", - "Disconnected", "Timeout". - :paramtype status: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointServiceConnectionStatus - :keyword description: The reason for approval/rejection of the connection. + :keyword description: Description of the block list. :paramtype description: str - :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :paramtype actions_required: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) + super(RaiBlocklistProperties, self).__init__(**kwargs) self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) -class ProbeSettings(msrest.serialization.Model): - """Deployment container liveness/readiness probe configuration. +class RaiBlocklistPropertiesBasicResource(Resource): + """RaiBlocklistPropertiesBasicResource. - :ivar failure_threshold: The number of failures to allow before returning an unhealthy status. - :vartype failure_threshold: int - :ivar initial_delay: The delay before the first probe in ISO 8601 format. - :vartype initial_delay: ~datetime.timedelta - :ivar period: The length of time between probes in ISO 8601 format. - :vartype period: ~datetime.timedelta - :ivar success_threshold: The number of successful probes before returning a healthy status. - :vartype success_threshold: int - :ivar timeout: The probe timeout in ISO 8601 format. - :vartype timeout: ~datetime.timedelta + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. RAI Custom Blocklist properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistProperties """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + _attribute_map = { - 'failure_threshold': {'key': 'failureThreshold', 'type': 'int'}, - 'initial_delay': {'key': 'initialDelay', 'type': 'duration'}, - 'period': {'key': 'period', 'type': 'duration'}, - 'success_threshold': {'key': 'successThreshold', 'type': 'int'}, - 'timeout': {'key': 'timeout', 'type': 'duration'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'RaiBlocklistProperties'}, } def __init__( @@ -21485,45 +23695,68 @@ def __init__( **kwargs ): """ - :keyword failure_threshold: The number of failures to allow before returning an unhealthy - status. - :paramtype failure_threshold: int - :keyword initial_delay: The delay before the first probe in ISO 8601 format. - :paramtype initial_delay: ~datetime.timedelta - :keyword period: The length of time between probes in ISO 8601 format. - :paramtype period: ~datetime.timedelta - :keyword success_threshold: The number of successful probes before returning a healthy status. - :paramtype success_threshold: int - :keyword timeout: The probe timeout in ISO 8601 format. - :paramtype timeout: ~datetime.timedelta + :keyword properties: Required. RAI Custom Blocklist properties. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistProperties """ - super(ProbeSettings, self).__init__(**kwargs) - self.failure_threshold = kwargs.get('failure_threshold', 30) - self.initial_delay = kwargs.get('initial_delay', None) - self.period = kwargs.get('period', "PT10S") - self.success_threshold = kwargs.get('success_threshold', 1) - self.timeout = kwargs.get('timeout', "PT2S") - + super(RaiBlocklistPropertiesBasicResource, self).__init__(**kwargs) + self.properties = kwargs['properties'] -class PyTorch(DistributionConfiguration): - """PyTorch distribution configuration. - All required parameters must be populated in order to send to Azure. +class RaiBlocklistPropertiesBasicResourceArmPaginatedResult(msrest.serialization.Model): + """RaiBlocklistPropertiesBasicResourceArmPaginatedResult. - :ivar distribution_type: Required. [Required] Specifies the type of distribution - framework.Constant filled by server. Possible values include: "PyTorch", "TensorFlow", "Mpi". - :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType - :ivar process_count_per_instance: Number of processes per node. - :vartype process_count_per_instance: int + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] """ - _validation = { - 'distribution_type': {'required': True}, + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[RaiBlocklistPropertiesBasicResource]'}, } + def __init__( + self, + **kwargs + ): + """ + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] + """ + super(RaiBlocklistPropertiesBasicResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class RaiPolicyContentFilter(msrest.serialization.Model): + """Azure OpenAI Content Filter. + + :ivar allowed_content_level: Level at which content is filtered. Possible values include: + "Low", "Medium", "High". + :vartype allowed_content_level: str or + ~azure.mgmt.machinelearningservices.models.AllowedContentLevel + :ivar blocking: If blocking would occur. + :vartype blocking: bool + :ivar enabled: If the ContentFilter is enabled. + :vartype enabled: bool + :ivar name: Name of ContentFilter. + :vartype name: str + :ivar source: Content source to apply the Content Filters. Possible values include: "Prompt", + "Completion". + :vartype source: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyContentSource + """ + _attribute_map = { - 'distribution_type': {'key': 'distributionType', 'type': 'str'}, - 'process_count_per_instance': {'key': 'processCountPerInstance', 'type': 'int'}, + 'allowed_content_level': {'key': 'allowedContentLevel', 'type': 'str'}, + 'blocking': {'key': 'blocking', 'type': 'bool'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, } def __init__( @@ -21531,24 +23764,55 @@ def __init__( **kwargs ): """ - :keyword process_count_per_instance: Number of processes per node. - :paramtype process_count_per_instance: int + :keyword allowed_content_level: Level at which content is filtered. Possible values include: + "Low", "Medium", "High". + :paramtype allowed_content_level: str or + ~azure.mgmt.machinelearningservices.models.AllowedContentLevel + :keyword blocking: If blocking would occur. + :paramtype blocking: bool + :keyword enabled: If the ContentFilter is enabled. + :paramtype enabled: bool + :keyword name: Name of ContentFilter. + :paramtype name: str + :keyword source: Content source to apply the Content Filters. Possible values include: + "Prompt", "Completion". + :paramtype source: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyContentSource """ - super(PyTorch, self).__init__(**kwargs) - self.distribution_type = 'PyTorch' # type: str - self.process_count_per_instance = kwargs.get('process_count_per_instance', None) + super(RaiPolicyContentFilter, self).__init__(**kwargs) + self.allowed_content_level = kwargs.get('allowed_content_level', None) + self.blocking = kwargs.get('blocking', None) + self.enabled = kwargs.get('enabled', None) + self.name = kwargs.get('name', None) + self.source = kwargs.get('source', None) -class QueueSettings(msrest.serialization.Model): - """QueueSettings. +class RaiPolicyProperties(msrest.serialization.Model): + """Azure OpenAI Content Filters properties. - :ivar job_tier: Controls the compute job tier. Possible values include: "Null", "Spot", - "Basic", "Standard", "Premium". - :vartype job_tier: str or ~azure.mgmt.machinelearningservices.models.JobTier + :ivar base_policy_name: Name of the base Content Filters. + :vartype base_policy_name: str + :ivar completion_blocklists: + :vartype completion_blocklists: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistConfig] + :ivar content_filters: + :vartype content_filters: + list[~azure.mgmt.machinelearningservices.models.RaiPolicyContentFilter] + :ivar mode: Content Filters mode. Possible values include: "Default", "Deferred", "Blocking". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyMode + :ivar prompt_blocklists: + :vartype prompt_blocklists: list[~azure.mgmt.machinelearningservices.models.RaiBlocklistConfig] + :ivar type: Content Filters policy type. Possible values include: "UserManaged", + "SystemManaged". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyType """ _attribute_map = { - 'job_tier': {'key': 'jobTier', 'type': 'str'}, + 'base_policy_name': {'key': 'basePolicyName', 'type': 'str'}, + 'completion_blocklists': {'key': 'completionBlocklists', 'type': '[RaiBlocklistConfig]'}, + 'content_filters': {'key': 'contentFilters', 'type': '[RaiPolicyContentFilter]'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'prompt_blocklists': {'key': 'promptBlocklists', 'type': '[RaiBlocklistConfig]'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( @@ -21556,32 +23820,69 @@ def __init__( **kwargs ): """ - :keyword job_tier: Controls the compute job tier. Possible values include: "Null", "Spot", - "Basic", "Standard", "Premium". - :paramtype job_tier: str or ~azure.mgmt.machinelearningservices.models.JobTier + :keyword base_policy_name: Name of the base Content Filters. + :paramtype base_policy_name: str + :keyword completion_blocklists: + :paramtype completion_blocklists: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistConfig] + :keyword content_filters: + :paramtype content_filters: + list[~azure.mgmt.machinelearningservices.models.RaiPolicyContentFilter] + :keyword mode: Content Filters mode. Possible values include: "Default", "Deferred", + "Blocking". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyMode + :keyword prompt_blocklists: + :paramtype prompt_blocklists: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistConfig] + :keyword type: Content Filters policy type. Possible values include: "UserManaged", + "SystemManaged". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyType """ - super(QueueSettings, self).__init__(**kwargs) - self.job_tier = kwargs.get('job_tier', None) + super(RaiPolicyProperties, self).__init__(**kwargs) + self.base_policy_name = kwargs.get('base_policy_name', None) + self.completion_blocklists = kwargs.get('completion_blocklists', None) + self.content_filters = kwargs.get('content_filters', None) + self.mode = kwargs.get('mode', None) + self.prompt_blocklists = kwargs.get('prompt_blocklists', None) + self.type = kwargs.get('type', None) -class QuotaBaseProperties(msrest.serialization.Model): - """The properties for Quota update or retrieval. +class RaiPolicyPropertiesBasicResource(Resource): + """Azure OpenAI Content Filters resource. - :ivar id: Specifies the resource ID. + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar type: Specifies the resource type. + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar limit: The maximum permitted quota of the resource. - :vartype limit: long - :ivar unit: An enum describing the unit of quota measurement. Possible values include: "Count". - :vartype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. Azure OpenAI Content Filters properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RaiPolicyProperties """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'unit': {'key': 'unit', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'RaiPolicyProperties'}, } def __init__( @@ -21589,35 +23890,26 @@ def __init__( **kwargs ): """ - :keyword id: Specifies the resource ID. - :paramtype id: str - :keyword type: Specifies the resource type. - :paramtype type: str - :keyword limit: The maximum permitted quota of the resource. - :paramtype limit: long - :keyword unit: An enum describing the unit of quota measurement. Possible values include: - "Count". - :paramtype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit + :keyword properties: Required. Azure OpenAI Content Filters properties. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RaiPolicyProperties """ - super(QuotaBaseProperties, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.type = kwargs.get('type', None) - self.limit = kwargs.get('limit', None) - self.unit = kwargs.get('unit', None) + super(RaiPolicyPropertiesBasicResource, self).__init__(**kwargs) + self.properties = kwargs['properties'] -class QuotaUpdateParameters(msrest.serialization.Model): - """Quota update parameters. +class RaiPolicyPropertiesBasicResourceArmPaginatedResult(msrest.serialization.Model): + """Azure OpenAI Content Filters resource list. - :ivar value: The list for update quota. - :vartype value: list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] - :ivar location: Region of workspace quota to be updated. - :vartype location: str + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[QuotaBaseProperties]'}, - 'location': {'key': 'location', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[RaiPolicyPropertiesBasicResource]'}, } def __init__( @@ -21625,14 +23917,15 @@ def __init__( **kwargs ): """ - :keyword value: The list for update quota. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] - :keyword location: Region of workspace quota to be updated. - :paramtype location: str + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] """ - super(QuotaUpdateParameters, self).__init__(**kwargs) + super(RaiPolicyPropertiesBasicResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) - self.location = kwargs.get('location', None) class RandomSamplingAlgorithm(SamplingAlgorithm): @@ -21896,6 +24189,29 @@ def __init__( self.key_value = kwargs.get('key_value', None) +class RegenerateServiceAccountKeyContent(msrest.serialization.Model): + """RegenerateServiceAccountKeyContent. + + :ivar key_name: Possible values include: "Key1", "Key2". + :vartype key_name: str or ~azure.mgmt.machinelearningservices.models.ServiceAccountKeyName + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword key_name: Possible values include: "Key1", "Key2". + :paramtype key_name: str or ~azure.mgmt.machinelearningservices.models.ServiceAccountKeyName + """ + super(RegenerateServiceAccountKeyContent, self).__init__(**kwargs) + self.key_name = kwargs.get('key_name', None) + + class Registry(TrackedResource): """Registry. @@ -21932,6 +24248,9 @@ class Registry(TrackedResource): :ivar managed_resource_group: ResourceId of the managed RG if the registry has system created resources. :vartype managed_resource_group: ~azure.mgmt.machinelearningservices.models.ArmResourceId + :ivar managed_resource_group_settings: Managed resource group specific settings. + :vartype managed_resource_group_settings: + ~azure.mgmt.machinelearningservices.models.ManagedResourceGroupSettings :ivar ml_flow_registry_uri: MLFlow Registry URI for the Registry. :vartype ml_flow_registry_uri: str :ivar registry_private_endpoint_connections: Private endpoint connections info used for pending @@ -21967,6 +24286,7 @@ class Registry(TrackedResource): 'discovery_url': {'key': 'properties.discoveryUrl', 'type': 'str'}, 'intellectual_property_publisher': {'key': 'properties.intellectualPropertyPublisher', 'type': 'str'}, 'managed_resource_group': {'key': 'properties.managedResourceGroup', 'type': 'ArmResourceId'}, + 'managed_resource_group_settings': {'key': 'properties.managedResourceGroupSettings', 'type': 'ManagedResourceGroupSettings'}, 'ml_flow_registry_uri': {'key': 'properties.mlFlowRegistryUri', 'type': 'str'}, 'registry_private_endpoint_connections': {'key': 'properties.registryPrivateEndpointConnections', 'type': '[RegistryPrivateEndpointConnection]'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, @@ -21996,6 +24316,9 @@ def __init__( :keyword managed_resource_group: ResourceId of the managed RG if the registry has system created resources. :paramtype managed_resource_group: ~azure.mgmt.machinelearningservices.models.ArmResourceId + :keyword managed_resource_group_settings: Managed resource group specific settings. + :paramtype managed_resource_group_settings: + ~azure.mgmt.machinelearningservices.models.ManagedResourceGroupSettings :keyword ml_flow_registry_uri: MLFlow Registry URI for the Registry. :paramtype ml_flow_registry_uri: str :keyword registry_private_endpoint_connections: Private endpoint connections info used for @@ -22016,6 +24339,7 @@ def __init__( self.discovery_url = kwargs.get('discovery_url', None) self.intellectual_property_publisher = kwargs.get('intellectual_property_publisher', None) self.managed_resource_group = kwargs.get('managed_resource_group', None) + self.managed_resource_group_settings = kwargs.get('managed_resource_group_settings', None) self.ml_flow_registry_uri = kwargs.get('ml_flow_registry_uri', None) self.registry_private_endpoint_connections = kwargs.get('registry_private_endpoint_connections', None) self.public_network_access = kwargs.get('public_network_access', None) @@ -22027,12 +24351,12 @@ class RegistryListCredentialsResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar location: + :ivar location: The location of the workspace ACR. :vartype location: str - :ivar username: - :vartype username: str :ivar passwords: :vartype passwords: list[~azure.mgmt.machinelearningservices.models.Password] + :ivar username: The username of the workspace ACR. + :vartype username: str """ _validation = { @@ -22042,8 +24366,8 @@ class RegistryListCredentialsResult(msrest.serialization.Model): _attribute_map = { 'location': {'key': 'location', 'type': 'str'}, - 'username': {'key': 'username', 'type': 'str'}, 'passwords': {'key': 'passwords', 'type': '[Password]'}, + 'username': {'key': 'username', 'type': 'str'}, } def __init__( @@ -22056,8 +24380,8 @@ def __init__( """ super(RegistryListCredentialsResult, self).__init__(**kwargs) self.location = None - self.username = None self.passwords = kwargs.get('passwords', None) + self.username = None class RegistryPartialManagedServiceIdentity(ManagedServiceIdentity): @@ -22187,7 +24511,7 @@ class RegistryPrivateLinkServiceConnectionState(msrest.serialization.Model): message. :vartype description: str :ivar status: Connection status of the service consumer with the service provider. Possible - values include: "Approved", "Pending", "Rejected", "Disconnected". + values include: "Approved", "Pending", "Rejected", "Disconnected", "Timeout". :vartype status: str or ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ @@ -22209,7 +24533,7 @@ def __init__( message. :paramtype description: str :keyword status: Connection status of the service consumer with the service provider. Possible - values include: "Approved", "Pending", "Rejected", "Disconnected". + values include: "Approved", "Pending", "Rejected", "Disconnected", "Timeout". :paramtype status: str or ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ @@ -22535,6 +24859,29 @@ def __init__( self.capture_headers = kwargs.get('capture_headers', None) +class ResizeSchema(msrest.serialization.Model): + """Schema for Compute Instance resize. + + :ivar target_vm_size: The name of the virtual machine size. + :vartype target_vm_size: str + """ + + _attribute_map = { + 'target_vm_size': {'key': 'targetVMSize', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword target_vm_size: The name of the virtual machine size. + :paramtype target_vm_size: str + """ + super(ResizeSchema, self).__init__(**kwargs) + self.target_vm_size = kwargs.get('target_vm_size', None) + + class ResourceId(msrest.serialization.Model): """Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet. @@ -22774,7 +25121,7 @@ class SASAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -22789,10 +25136,12 @@ class SASAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -22800,16 +25149,18 @@ class SASAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionSharedAccessSignature @@ -22825,14 +25176,16 @@ class SASAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionSharedAccessSignature'}, } @@ -22843,7 +25196,7 @@ def __init__( """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -22858,23 +25211,27 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionSharedAccessSignature @@ -23289,7 +25646,7 @@ def __init__( class ScriptReference(msrest.serialization.Model): """Script reference. - :ivar script_source: The storage source of the script: workspace. + :ivar script_source: The storage source of the script: inline, workspace. :vartype script_source: str :ivar script_data: The location of scripts in the mounted volume. :vartype script_data: str @@ -23311,7 +25668,7 @@ def __init__( **kwargs ): """ - :keyword script_source: The storage source of the script: workspace. + :keyword script_source: The storage source of the script: inline, workspace. :paramtype script_source: str :keyword script_data: The location of scripts in the mounted volume. :paramtype script_data: str @@ -23397,8 +25754,198 @@ class ServerlessComputeSettings(msrest.serialization.Model): """ _attribute_map = { - 'serverless_compute_custom_subnet': {'key': 'serverlessComputeCustomSubnet', 'type': 'str'}, - 'serverless_compute_no_public_ip': {'key': 'serverlessComputeNoPublicIP', 'type': 'bool'}, + 'serverless_compute_custom_subnet': {'key': 'serverlessComputeCustomSubnet', 'type': 'str'}, + 'serverless_compute_no_public_ip': {'key': 'serverlessComputeNoPublicIP', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword serverless_compute_custom_subnet: The resource ID of an existing virtual network + subnet in which serverless compute nodes should be deployed. + :paramtype serverless_compute_custom_subnet: str + :keyword serverless_compute_no_public_ip: The flag to signal if serverless compute nodes + deployed in custom vNet would have no public IP addresses for a workspace with private + endpoint. + :paramtype serverless_compute_no_public_ip: bool + """ + super(ServerlessComputeSettings, self).__init__(**kwargs) + self.serverless_compute_custom_subnet = kwargs.get('serverless_compute_custom_subnet', None) + self.serverless_compute_no_public_ip = kwargs.get('serverless_compute_no_public_ip', None) + + +class ServerlessEndpoint(TrackedResource): + """ServerlessEndpoint. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.ServerlessEndpointProperties + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ServerlessEndpointProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :paramtype kind: str + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ServerlessEndpointProperties + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + """ + super(ServerlessEndpoint, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.kind = kwargs.get('kind', None) + self.properties = kwargs['properties'] + self.sku = kwargs.get('sku', None) + + +class ServerlessEndpointCapacityReservation(msrest.serialization.Model): + """ServerlessEndpointCapacityReservation. + + All required parameters must be populated in order to send to Azure. + + :ivar capacity_reservation_group_id: Required. + :vartype capacity_reservation_group_id: str + :ivar endpoint_reserved_capacity: + :vartype endpoint_reserved_capacity: int + """ + + _validation = { + 'capacity_reservation_group_id': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'capacity_reservation_group_id': {'key': 'capacityReservationGroupId', 'type': 'str'}, + 'endpoint_reserved_capacity': {'key': 'endpointReservedCapacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword capacity_reservation_group_id: Required. + :paramtype capacity_reservation_group_id: str + :keyword endpoint_reserved_capacity: + :paramtype endpoint_reserved_capacity: int + """ + super(ServerlessEndpointCapacityReservation, self).__init__(**kwargs) + self.capacity_reservation_group_id = kwargs['capacity_reservation_group_id'] + self.endpoint_reserved_capacity = kwargs.get('endpoint_reserved_capacity', None) + + +class ServerlessEndpointContentSafety(msrest.serialization.Model): + """ServerlessEndpointContentSafety. + + All required parameters must be populated in order to send to Azure. + + :ivar content_safety_status: Required. Specifies the status of content safety. Possible values + include: "Enabled", "Disabled". + :vartype content_safety_status: str or + ~azure.mgmt.machinelearningservices.models.ContentSafetyStatus + """ + + _validation = { + 'content_safety_status': {'required': True}, + } + + _attribute_map = { + 'content_safety_status': {'key': 'contentSafetyStatus', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword content_safety_status: Required. Specifies the status of content safety. Possible + values include: "Enabled", "Disabled". + :paramtype content_safety_status: str or + ~azure.mgmt.machinelearningservices.models.ContentSafetyStatus + """ + super(ServerlessEndpointContentSafety, self).__init__(**kwargs) + self.content_safety_status = kwargs['content_safety_status'] + + +class ServerlessEndpointInferenceEndpoint(msrest.serialization.Model): + """ServerlessEndpointInferenceEndpoint. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar headers: Dictionary of :code:``. + :vartype headers: dict[str, str] + :ivar uri: Required. + :vartype uri: str + """ + + _validation = { + 'headers': {'readonly': True}, + 'uri': {'required': True}, + } + + _attribute_map = { + 'headers': {'key': 'headers', 'type': '{str}'}, + 'uri': {'key': 'uri', 'type': 'str'}, } def __init__( @@ -23406,72 +25953,29 @@ def __init__( **kwargs ): """ - :keyword serverless_compute_custom_subnet: The resource ID of an existing virtual network - subnet in which serverless compute nodes should be deployed. - :paramtype serverless_compute_custom_subnet: str - :keyword serverless_compute_no_public_ip: The flag to signal if serverless compute nodes - deployed in custom vNet would have no public IP addresses for a workspace with private - endpoint. - :paramtype serverless_compute_no_public_ip: bool + :keyword uri: Required. + :paramtype uri: str """ - super(ServerlessComputeSettings, self).__init__(**kwargs) - self.serverless_compute_custom_subnet = kwargs.get('serverless_compute_custom_subnet', None) - self.serverless_compute_no_public_ip = kwargs.get('serverless_compute_no_public_ip', None) - + super(ServerlessEndpointInferenceEndpoint, self).__init__(**kwargs) + self.headers = None + self.uri = kwargs['uri'] -class ServerlessEndpoint(TrackedResource): - """ServerlessEndpoint. - Variables are only populated by the server, and will be ignored when sending a request. +class ServerlessEndpointModelSettings(msrest.serialization.Model): + """ServerlessEndpointModelSettings. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. - :vartype location: str - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type. - :vartype kind: str - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ServerlessEndpointProperties - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar model_id: Required. + :vartype model_id: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'properties': {'required': True}, + 'model_id': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ServerlessEndpointProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, + 'model_id': {'key': 'modelId', 'type': 'str'}, } def __init__( @@ -23479,25 +25983,11 @@ def __init__( **kwargs ): """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. - :paramtype location: str - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type. - :paramtype kind: str - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ServerlessEndpointProperties - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword model_id: Required. + :paramtype model_id: str """ - super(ServerlessEndpoint, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.properties = kwargs['properties'] - self.sku = kwargs.get('sku', None) + super(ServerlessEndpointModelSettings, self).__init__(**kwargs) + self.model_id = kwargs['model_id'] class ServerlessEndpointProperties(msrest.serialization.Model): @@ -23579,6 +26069,163 @@ def __init__( self.provisioning_state = None +class ServerlessEndpointResourceProperties(EndpointResourceProperties): + """ServerlessEndpointResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Required. Type of the endpoint.Constant filled by server. Possible values + include: "Azure.OpenAI", "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", + "managedOnlineEndpoint", "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool + :ivar auth_mode: Possible values include: "Key". + :vartype auth_mode: str or + ~azure.mgmt.machinelearningservices.models.ServerlessInferenceEndpointAuthMode + :ivar capacity_reservation: + :vartype capacity_reservation: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointCapacityReservation + :ivar content_safety: + :vartype content_safety: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointContentSafety + :ivar endpoint_state: State of the Serverless Endpoint. Possible values include: "Unknown", + "Creating", "Deleting", "Suspending", "Reinstating", "Online", "Suspended", "CreationFailed", + "DeletionFailed". + :vartype endpoint_state: str or + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointState + :ivar inference_endpoint: + :vartype inference_endpoint: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointInferenceEndpoint + :ivar marketplace_subscription_id: + :vartype marketplace_subscription_id: str + :ivar metadata: Anything. + :vartype metadata: any + :ivar model_settings: + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointModelSettings + :ivar offer: + :vartype offer: ~azure.mgmt.machinelearningservices.models.ServerlessOffer + """ + + _validation = { + 'endpoint_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'associated_resource_id': {'key': 'associatedResourceId', 'type': 'str'}, + 'deployments': {'key': 'deployments', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'should_create_ai_services_endpoint': {'key': 'shouldCreateAiServicesEndpoint', 'type': 'bool'}, + 'auth_mode': {'key': 'authMode', 'type': 'str'}, + 'capacity_reservation': {'key': 'capacityReservation', 'type': 'ServerlessEndpointCapacityReservation'}, + 'content_safety': {'key': 'contentSafety', 'type': 'ServerlessEndpointContentSafety'}, + 'endpoint_state': {'key': 'endpointState', 'type': 'str'}, + 'inference_endpoint': {'key': 'inferenceEndpoint', 'type': 'ServerlessEndpointInferenceEndpoint'}, + 'marketplace_subscription_id': {'key': 'marketplaceSubscriptionId', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': 'object'}, + 'model_settings': {'key': 'modelSettings', 'type': 'ServerlessEndpointModelSettings'}, + 'offer': {'key': 'offer', 'type': 'ServerlessOffer'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + :keyword auth_mode: Possible values include: "Key". + :paramtype auth_mode: str or + ~azure.mgmt.machinelearningservices.models.ServerlessInferenceEndpointAuthMode + :keyword capacity_reservation: + :paramtype capacity_reservation: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointCapacityReservation + :keyword content_safety: + :paramtype content_safety: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointContentSafety + :keyword endpoint_state: State of the Serverless Endpoint. Possible values include: "Unknown", + "Creating", "Deleting", "Suspending", "Reinstating", "Online", "Suspended", "CreationFailed", + "DeletionFailed". + :paramtype endpoint_state: str or + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointState + :keyword inference_endpoint: + :paramtype inference_endpoint: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointInferenceEndpoint + :keyword marketplace_subscription_id: + :paramtype marketplace_subscription_id: str + :keyword metadata: Anything. + :paramtype metadata: any + :keyword model_settings: + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointModelSettings + :keyword offer: + :paramtype offer: ~azure.mgmt.machinelearningservices.models.ServerlessOffer + """ + super(ServerlessEndpointResourceProperties, self).__init__(**kwargs) + self.endpoint_type = 'serverlessEndpoint' # type: str + self.auth_mode = kwargs.get('auth_mode', None) + self.capacity_reservation = kwargs.get('capacity_reservation', None) + self.content_safety = kwargs.get('content_safety', None) + self.endpoint_state = kwargs.get('endpoint_state', None) + self.inference_endpoint = kwargs.get('inference_endpoint', None) + self.marketplace_subscription_id = kwargs.get('marketplace_subscription_id', None) + self.metadata = kwargs.get('metadata', None) + self.model_settings = kwargs.get('model_settings', None) + self.offer = kwargs.get('offer', None) + + class ServerlessEndpointTrackedResourceArmPaginatedResult(msrest.serialization.Model): """A paginated list of ServerlessEndpoint entities. @@ -23648,10 +26295,46 @@ def __init__( self.uri = kwargs['uri'] +class ServerlessOffer(msrest.serialization.Model): + """ServerlessOffer. + + All required parameters must be populated in order to send to Azure. + + :ivar offer_name: Required. + :vartype offer_name: str + :ivar publisher: Required. + :vartype publisher: str + """ + + _validation = { + 'offer_name': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'publisher': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'offer_name': {'key': 'offerName', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword offer_name: Required. + :paramtype offer_name: str + :keyword publisher: Required. + :paramtype publisher: str + """ + super(ServerlessOffer, self).__init__(**kwargs) + self.offer_name = kwargs['offer_name'] + self.publisher = kwargs['publisher'] + + class ServiceManagedResourcesSettings(msrest.serialization.Model): """ServiceManagedResourcesSettings. - :ivar cosmos_db: The settings for the service managed cosmosdb account. + :ivar cosmos_db: :vartype cosmos_db: ~azure.mgmt.machinelearningservices.models.CosmosDbSettings """ @@ -23664,7 +26347,7 @@ def __init__( **kwargs ): """ - :keyword cosmos_db: The settings for the service managed cosmosdb account. + :keyword cosmos_db: :paramtype cosmos_db: ~azure.mgmt.machinelearningservices.models.CosmosDbSettings """ super(ServiceManagedResourcesSettings, self).__init__(**kwargs) @@ -23684,7 +26367,7 @@ class ServicePrincipalAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -23699,10 +26382,12 @@ class ServicePrincipalAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -23710,16 +26395,18 @@ class ServicePrincipalAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionServicePrincipal @@ -23735,14 +26422,16 @@ class ServicePrincipalAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionServicePrincipal'}, } @@ -23753,7 +26442,7 @@ def __init__( """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -23768,23 +26457,27 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionServicePrincipal @@ -23946,11 +26639,15 @@ def __init__( class ServiceTagOutboundRule(OutboundRule): """Service Tag Outbound Rule for the managed network of a machine learning workspace. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. Possible values include: "Required", "Recommended", "UserDefined", "Dependency". :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :ivar parent_rule_names: + :vartype parent_rule_names: list[str] :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Possible values include: "Inactive", "Active". :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus @@ -23964,11 +26661,13 @@ class ServiceTagOutboundRule(OutboundRule): """ _validation = { + 'parent_rule_names': {'readonly': True}, 'type': {'required': True}, } _attribute_map = { 'category': {'key': 'category', 'type': 'str'}, + 'parent_rule_names': {'key': 'parentRuleNames', 'type': '[str]'}, 'status': {'key': 'status', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'destination': {'key': 'destination', 'type': 'ServiceTagDestination'}, @@ -24022,23 +26721,22 @@ class SharedPrivateLinkResource(msrest.serialization.Model): :ivar name: Unique name of the private link. :vartype name: str - :ivar private_link_resource_id: The resource id that private link links to. - :vartype private_link_resource_id: str - :ivar group_id: The private link resource group id. + :ivar group_id: group id of the private link. :vartype group_id: str + :ivar private_link_resource_id: the resource id that private link links to. + :vartype private_link_resource_id: str :ivar request_message: Request message. :vartype request_message: str - :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected", "Disconnected", - "Timeout". + :ivar status: Connection status of the service consumer with the service provider. Possible + values include: "Approved", "Pending", "Rejected", "Disconnected", "Timeout". :vartype status: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointServiceConnectionStatus + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, 'request_message': {'key': 'properties.requestMessage', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, } @@ -24050,22 +26748,21 @@ def __init__( """ :keyword name: Unique name of the private link. :paramtype name: str - :keyword private_link_resource_id: The resource id that private link links to. - :paramtype private_link_resource_id: str - :keyword group_id: The private link resource group id. + :keyword group_id: group id of the private link. :paramtype group_id: str + :keyword private_link_resource_id: the resource id that private link links to. + :paramtype private_link_resource_id: str :keyword request_message: Request message. :paramtype request_message: str - :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Possible values include: "Pending", "Approved", "Rejected", - "Disconnected", "Timeout". + :keyword status: Connection status of the service consumer with the service provider. Possible + values include: "Approved", "Pending", "Rejected", "Disconnected", "Timeout". :paramtype status: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointServiceConnectionStatus + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ super(SharedPrivateLinkResource, self).__init__(**kwargs) self.name = kwargs.get('name', None) - self.private_link_resource_id = kwargs.get('private_link_resource_id', None) self.group_id = kwargs.get('group_id', None) + self.private_link_resource_id = kwargs.get('private_link_resource_id', None) self.request_message = kwargs.get('request_message', None) self.status = kwargs.get('status', None) @@ -24609,6 +27306,159 @@ def __init__( self.runtime_version = kwargs.get('runtime_version', "3.1") +class SpeechEndpointDeploymentResourceProperties(EndpointDeploymentResourceProperties, CognitiveServiceEndpointDeploymentResourceProperties): + """SpeechEndpointDeploymentResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar model: Required. Model used for the endpoint deployment. + :vartype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar version_upgrade_option: Deployment model version upgrade option. Possible values include: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Required. Kind of the deployment.Constant filled by server. + :vartype type: str + """ + + _validation = { + 'model': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'model': {'key': 'model', 'type': 'EndpointDeploymentModel'}, + 'rai_policy_name': {'key': 'raiPolicyName', 'type': 'str'}, + 'version_upgrade_option': {'key': 'versionUpgradeOption', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword model: Required. Model used for the endpoint deployment. + :paramtype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :keyword rai_policy_name: The name of RAI policy. + :paramtype rai_policy_name: str + :keyword version_upgrade_option: Deployment model version upgrade option. Possible values + include: "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :paramtype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + """ + super(SpeechEndpointDeploymentResourceProperties, self).__init__(**kwargs) + self.model = kwargs['model'] + self.rai_policy_name = kwargs.get('rai_policy_name', None) + self.version_upgrade_option = kwargs.get('version_upgrade_option', None) + self.type = 'Azure.Speech' # type: str + self.failure_reason = kwargs.get('failure_reason', None) + self.provisioning_state = None + + +class SpeechEndpointResourceProperties(EndpointResourceProperties): + """SpeechEndpointResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Required. Type of the endpoint.Constant filled by server. Possible values + include: "Azure.OpenAI", "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", + "managedOnlineEndpoint", "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool + """ + + _validation = { + 'endpoint_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'associated_resource_id': {'key': 'associatedResourceId', 'type': 'str'}, + 'deployments': {'key': 'deployments', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'should_create_ai_services_endpoint': {'key': 'shouldCreateAiServicesEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + """ + super(SpeechEndpointResourceProperties, self).__init__(**kwargs) + self.endpoint_type = 'Azure.Speech' # type: str + + class SslConfiguration(msrest.serialization.Model): """The ssl configuration for scoring. @@ -25879,7 +28729,7 @@ def __init__( class TmpfsOptions(msrest.serialization.Model): - """Describes the tmpfs options for the container. + """TmpfsOptions. :ivar size: Mention the Tmpfs size. :vartype size: int @@ -26807,7 +29657,7 @@ class UsernamePasswordAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -26822,10 +29672,12 @@ class UsernamePasswordAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -26833,16 +29685,18 @@ class UsernamePasswordAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUsernamePassword @@ -26858,14 +29712,16 @@ class UsernamePasswordAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionUsernamePassword'}, } @@ -26876,7 +29732,7 @@ def __init__( """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -26891,23 +29747,27 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUsernamePassword @@ -27329,7 +30189,7 @@ def __init__( class VolumeDefinition(msrest.serialization.Model): - """Describes the volume configuration for the container. + """VolumeDefinition. :ivar type: Type of Volume Definition. Possible Values: bind,volume,tmpfs,npipe. Possible values include: "bind", "volume", "tmpfs", "npipe". Default value: "bind". @@ -27397,7 +30257,7 @@ def __init__( class VolumeOptions(msrest.serialization.Model): - """Describes the volume options for the container. + """VolumeOptions. :ivar nocopy: Indicate whether volume is nocopy. :vartype nocopy: bool @@ -27435,101 +30295,128 @@ class Workspace(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar identity: The identity of the resource. + :ivar identity: Managed service identity (system assigned and/or user assigned identities). :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity :ivar kind: :vartype kind: str - :ivar location: Specifies the location of the resource. + :ivar location: :vartype location: str - :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. + :ivar sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar workspace_id: The immutable id associated with this workspace. - :vartype workspace_id: str - :ivar description: The description of this workspace. - :vartype description: str - :ivar friendly_name: The friendly name for this workspace. This name in mutable. - :vartype friendly_name: str - :ivar key_vault: ARM id of the key vault associated with this workspace. This cannot be changed - once the workspace has been created. - :vartype key_vault: str + :ivar tags: A set of tags. Dictionary of :code:``. + :vartype tags: dict[str, str] + :ivar allow_public_access_when_behind_vnet: The flag to indicate whether to allow public access + when behind VNet. + :vartype allow_public_access_when_behind_vnet: bool + :ivar allow_role_assignment_on_rg: The flag to indicate whether we will do role assignment for + the workspace MSI on resource group level. + :vartype allow_role_assignment_on_rg: bool :ivar application_insights: ARM id of the application insights associated with this workspace. :vartype application_insights: str + :ivar associated_workspaces: + :vartype associated_workspaces: list[str] + :ivar container_registries: + :vartype container_registries: list[str] :ivar container_registry: ARM id of the container registry associated with this workspace. :vartype container_registry: str - :ivar storage_account: ARM id of the storage account associated with this workspace. This - cannot be changed once the workspace has been created. - :vartype storage_account: str + :ivar description: The description of this workspace. + :vartype description: str :ivar discovery_url: Url for the discovery service to identify regional endpoints for machine learning experimentation services. :vartype discovery_url: str - :ivar provisioning_state: The current deployment state of workspace resource. The - provisioningState is to indicate states for resource provisioning. Possible values include: - "Unknown", "Updating", "Creating", "Deleting", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.ProvisioningState - :ivar encryption: The encryption settings of Azure ML workspace. + :ivar enable_data_isolation: + :vartype enable_data_isolation: bool + :ivar enable_service_side_cmk_encryption: + :vartype enable_service_side_cmk_encryption: bool + :ivar enable_simplified_cmk: Flag to tell if simplified CMK should be enabled for this + workspace. + :vartype enable_simplified_cmk: bool + :ivar enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterials should be + enabled for this workspace. + :vartype enable_software_bill_of_materials: bool + :ivar encryption: :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionProperty + :ivar existing_workspaces: + :vartype existing_workspaces: list[str] + :ivar feature_store_settings: Settings for feature store type workspace. + :vartype feature_store_settings: + ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :ivar friendly_name: The friendly name for this workspace. This name in mutable. + :vartype friendly_name: str :ivar hbi_workspace: The flag to signal HBI data in the workspace and reduce diagnostic data collected by the service. :vartype hbi_workspace: bool - :ivar service_provisioned_resource_group: The name of the managed resource group created by - workspace RP in customer subscription if the workspace is CMK workspace. - :vartype service_provisioned_resource_group: str - :ivar private_link_count: Count of private connections in the workspace. - :vartype private_link_count: int + :ivar hub_resource_id: + :vartype hub_resource_id: str :ivar image_build_compute: The compute name for image build. :vartype image_build_compute: str - :ivar allow_public_access_when_behind_vnet: The flag to indicate whether to allow public access - when behind VNet. - :vartype allow_public_access_when_behind_vnet: bool - :ivar public_network_access: Whether requests from Public Network are allowed. Possible values - include: "Enabled", "Disabled". - :vartype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccess + :ivar ip_allowlist: The list of IPv4 addresses that are allowed to access the workspace. + :vartype ip_allowlist: list[str] + :ivar key_vault: ARM id of the key vault associated with this workspace. This cannot be changed + once the workspace has been created. + :vartype key_vault: str + :ivar key_vaults: + :vartype key_vaults: list[str] + :ivar managed_network: Managed Network settings for a machine learning workspace. + :vartype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings + :ivar ml_flow_tracking_uri: The URI associated with this workspace that machine learning flow + must point at to set up tracking. + :vartype ml_flow_tracking_uri: str + :ivar notebook_info: The notebook info of Azure ML workspace. + :vartype notebook_info: ~azure.mgmt.machinelearningservices.models.NotebookResourceInfo + :ivar primary_user_assigned_identity: The user assigned identity resource id that represents + the workspace identity. + :vartype primary_user_assigned_identity: str :ivar private_endpoint_connections: The list of private endpoint connections in the workspace. :vartype private_endpoint_connections: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] - :ivar serverless_compute_settings: Settings for serverless compute created in the workspace. + :ivar private_link_count: Count of private connections in the workspace. + :vartype private_link_count: int + :ivar provisioning_state: The current deployment state of workspace resource. The + provisioningState is to indicate states for resource provisioning. Possible values include: + "Unknown", "Updating", "Creating", "Deleting", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.ProvisioningState + :ivar public_network_access: Whether requests from Public Network are allowed. Possible values + include: "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :ivar serverless_compute_settings: Settings for serverless compute in a workspace. :vartype serverless_compute_settings: ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings + :ivar service_managed_resources_settings: The service managed resource settings. + :vartype service_managed_resources_settings: + ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :ivar service_provisioned_resource_group: The name of the managed resource group created by + workspace RP in customer subscription if the workspace is CMK workspace. + :vartype service_provisioned_resource_group: str :ivar shared_private_link_resources: The list of shared private link resources in this workspace. :vartype shared_private_link_resources: list[~azure.mgmt.machinelearningservices.models.SharedPrivateLinkResource] - :ivar notebook_info: The notebook info of Azure ML workspace. - :vartype notebook_info: ~azure.mgmt.machinelearningservices.models.NotebookResourceInfo - :ivar service_managed_resources_settings: The service managed resource settings. - :vartype service_managed_resources_settings: - ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings - :ivar primary_user_assigned_identity: The user assigned identity resource id that represents - the workspace identity. - :vartype primary_user_assigned_identity: str - :ivar tenant_id: The tenant id associated with this workspace. - :vartype tenant_id: str + :ivar soft_delete_retention_in_days: Retention time in days after workspace get soft deleted. + :vartype soft_delete_retention_in_days: int + :ivar storage_account: ARM id of the storage account associated with this workspace. This + cannot be changed once the workspace has been created. + :vartype storage_account: str + :ivar storage_accounts: + :vartype storage_accounts: list[str] :ivar storage_hns_enabled: If the storage associated with the workspace has hierarchical namespace(HNS) enabled. :vartype storage_hns_enabled: bool - :ivar ml_flow_tracking_uri: The URI associated with this workspace that machine learning flow - must point at to set up tracking. - :vartype ml_flow_tracking_uri: str + :ivar system_datastores_auth_mode: The auth mode used for accessing the system datastores of + the workspace. + :vartype system_datastores_auth_mode: str + :ivar tenant_id: The tenant id associated with this workspace. + :vartype tenant_id: str :ivar v1_legacy_mode: Enabling v1_legacy_mode may prevent you from using features provided by the v2 API. :vartype v1_legacy_mode: bool - :ivar managed_network: Managed Network settings for a machine learning workspace. - :vartype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings - :ivar feature_store_settings: Settings for feature store type workspace. - :vartype feature_store_settings: - ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings - :ivar associated_workspaces: - :vartype associated_workspaces: list[str] - :ivar enable_data_isolation: - :vartype enable_data_isolation: bool - :ivar hub_resource_id: - :vartype hub_resource_id: str :ivar workspace_hub_config: WorkspaceHub's configuration object. :vartype workspace_hub_config: ~azure.mgmt.machinelearningservices.models.WorkspaceHubConfig + :ivar workspace_id: The immutable id associated with this workspace. + :vartype workspace_id: str """ _validation = { @@ -27537,15 +30424,15 @@ class Workspace(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, - 'workspace_id': {'readonly': True}, + 'ml_flow_tracking_uri': {'readonly': True}, + 'notebook_info': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'private_link_count': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'service_provisioned_resource_group': {'readonly': True}, - 'private_link_count': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'notebook_info': {'readonly': True}, - 'tenant_id': {'readonly': True}, 'storage_hns_enabled': {'readonly': True}, - 'ml_flow_tracking_uri': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'workspace_id': {'readonly': True}, } _attribute_map = { @@ -27556,40 +30443,51 @@ class Workspace(Resource): 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'kind': {'key': 'kind', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'Sku'}, - 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'key_vault': {'key': 'properties.keyVault', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'allow_public_access_when_behind_vnet': {'key': 'properties.allowPublicAccessWhenBehindVnet', 'type': 'bool'}, + 'allow_role_assignment_on_rg': {'key': 'properties.allowRoleAssignmentOnRG', 'type': 'bool'}, 'application_insights': {'key': 'properties.applicationInsights', 'type': 'str'}, + 'associated_workspaces': {'key': 'properties.associatedWorkspaces', 'type': '[str]'}, + 'container_registries': {'key': 'properties.containerRegistries', 'type': '[str]'}, 'container_registry': {'key': 'properties.containerRegistry', 'type': 'str'}, - 'storage_account': {'key': 'properties.storageAccount', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, 'discovery_url': {'key': 'properties.discoveryUrl', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'enable_data_isolation': {'key': 'properties.enableDataIsolation', 'type': 'bool'}, + 'enable_service_side_cmk_encryption': {'key': 'properties.enableServiceSideCMKEncryption', 'type': 'bool'}, + 'enable_simplified_cmk': {'key': 'properties.enableSimplifiedCmk', 'type': 'bool'}, + 'enable_software_bill_of_materials': {'key': 'properties.enableSoftwareBillOfMaterials', 'type': 'bool'}, 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, + 'existing_workspaces': {'key': 'properties.existingWorkspaces', 'type': '[str]'}, + 'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, 'hbi_workspace': {'key': 'properties.hbiWorkspace', 'type': 'bool'}, - 'service_provisioned_resource_group': {'key': 'properties.serviceProvisionedResourceGroup', 'type': 'str'}, - 'private_link_count': {'key': 'properties.privateLinkCount', 'type': 'int'}, + 'hub_resource_id': {'key': 'properties.hubResourceId', 'type': 'str'}, 'image_build_compute': {'key': 'properties.imageBuildCompute', 'type': 'str'}, - 'allow_public_access_when_behind_vnet': {'key': 'properties.allowPublicAccessWhenBehindVnet', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'ip_allowlist': {'key': 'properties.ipAllowlist', 'type': '[str]'}, + 'key_vault': {'key': 'properties.keyVault', 'type': 'str'}, + 'key_vaults': {'key': 'properties.keyVaults', 'type': '[str]'}, + 'managed_network': {'key': 'properties.managedNetwork', 'type': 'ManagedNetworkSettings'}, + 'ml_flow_tracking_uri': {'key': 'properties.mlFlowTrackingUri', 'type': 'str'}, + 'notebook_info': {'key': 'properties.notebookInfo', 'type': 'NotebookResourceInfo'}, + 'primary_user_assigned_identity': {'key': 'properties.primaryUserAssignedIdentity', 'type': 'str'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'private_link_count': {'key': 'properties.privateLinkCount', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'serverless_compute_settings': {'key': 'properties.serverlessComputeSettings', 'type': 'ServerlessComputeSettings'}, - 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, - 'notebook_info': {'key': 'properties.notebookInfo', 'type': 'NotebookResourceInfo'}, 'service_managed_resources_settings': {'key': 'properties.serviceManagedResourcesSettings', 'type': 'ServiceManagedResourcesSettings'}, - 'primary_user_assigned_identity': {'key': 'properties.primaryUserAssignedIdentity', 'type': 'str'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'service_provisioned_resource_group': {'key': 'properties.serviceProvisionedResourceGroup', 'type': 'str'}, + 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, + 'soft_delete_retention_in_days': {'key': 'properties.softDeleteRetentionInDays', 'type': 'int'}, + 'storage_account': {'key': 'properties.storageAccount', 'type': 'str'}, + 'storage_accounts': {'key': 'properties.storageAccounts', 'type': '[str]'}, 'storage_hns_enabled': {'key': 'properties.storageHnsEnabled', 'type': 'bool'}, - 'ml_flow_tracking_uri': {'key': 'properties.mlFlowTrackingUri', 'type': 'str'}, + 'system_datastores_auth_mode': {'key': 'properties.systemDatastoresAuthMode', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, 'v1_legacy_mode': {'key': 'properties.v1LegacyMode', 'type': 'bool'}, - 'managed_network': {'key': 'properties.managedNetwork', 'type': 'ManagedNetworkSettings'}, - 'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'}, - 'associated_workspaces': {'key': 'properties.associatedWorkspaces', 'type': '[str]'}, - 'enable_data_isolation': {'key': 'properties.enableDataIsolation', 'type': 'bool'}, - 'hub_resource_id': {'key': 'properties.hubResourceId', 'type': 'str'}, 'workspace_hub_config': {'key': 'properties.workspaceHubConfig', 'type': 'WorkspaceHubConfig'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, } def __init__( @@ -27597,75 +30495,103 @@ def __init__( **kwargs ): """ - :keyword identity: The identity of the resource. + :keyword identity: Managed service identity (system assigned and/or user assigned identities). :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity :keyword kind: :paramtype kind: str - :keyword location: Specifies the location of the resource. + :keyword location: :paramtype location: str - :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. + :keyword sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword description: The description of this workspace. - :paramtype description: str - :keyword friendly_name: The friendly name for this workspace. This name in mutable. - :paramtype friendly_name: str - :keyword key_vault: ARM id of the key vault associated with this workspace. This cannot be - changed once the workspace has been created. - :paramtype key_vault: str + :keyword tags: A set of tags. Dictionary of :code:``. + :paramtype tags: dict[str, str] + :keyword allow_public_access_when_behind_vnet: The flag to indicate whether to allow public + access when behind VNet. + :paramtype allow_public_access_when_behind_vnet: bool + :keyword allow_role_assignment_on_rg: The flag to indicate whether we will do role assignment + for the workspace MSI on resource group level. + :paramtype allow_role_assignment_on_rg: bool :keyword application_insights: ARM id of the application insights associated with this workspace. :paramtype application_insights: str + :keyword associated_workspaces: + :paramtype associated_workspaces: list[str] + :keyword container_registries: + :paramtype container_registries: list[str] :keyword container_registry: ARM id of the container registry associated with this workspace. :paramtype container_registry: str - :keyword storage_account: ARM id of the storage account associated with this workspace. This - cannot be changed once the workspace has been created. - :paramtype storage_account: str + :keyword description: The description of this workspace. + :paramtype description: str :keyword discovery_url: Url for the discovery service to identify regional endpoints for machine learning experimentation services. :paramtype discovery_url: str - :keyword encryption: The encryption settings of Azure ML workspace. + :keyword enable_data_isolation: + :paramtype enable_data_isolation: bool + :keyword enable_service_side_cmk_encryption: + :paramtype enable_service_side_cmk_encryption: bool + :keyword enable_simplified_cmk: Flag to tell if simplified CMK should be enabled for this + workspace. + :paramtype enable_simplified_cmk: bool + :keyword enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterials should be + enabled for this workspace. + :paramtype enable_software_bill_of_materials: bool + :keyword encryption: :paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionProperty + :keyword existing_workspaces: + :paramtype existing_workspaces: list[str] + :keyword feature_store_settings: Settings for feature store type workspace. + :paramtype feature_store_settings: + ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :keyword friendly_name: The friendly name for this workspace. This name in mutable. + :paramtype friendly_name: str :keyword hbi_workspace: The flag to signal HBI data in the workspace and reduce diagnostic data collected by the service. :paramtype hbi_workspace: bool + :keyword hub_resource_id: + :paramtype hub_resource_id: str :keyword image_build_compute: The compute name for image build. :paramtype image_build_compute: str - :keyword allow_public_access_when_behind_vnet: The flag to indicate whether to allow public - access when behind VNet. - :paramtype allow_public_access_when_behind_vnet: bool + :keyword ip_allowlist: The list of IPv4 addresses that are allowed to access the workspace. + :paramtype ip_allowlist: list[str] + :keyword key_vault: ARM id of the key vault associated with this workspace. This cannot be + changed once the workspace has been created. + :paramtype key_vault: str + :keyword key_vaults: + :paramtype key_vaults: list[str] + :keyword managed_network: Managed Network settings for a machine learning workspace. + :paramtype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings + :keyword primary_user_assigned_identity: The user assigned identity resource id that represents + the workspace identity. + :paramtype primary_user_assigned_identity: str :keyword public_network_access: Whether requests from Public Network are allowed. Possible values include: "Enabled", "Disabled". :paramtype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccess - :keyword serverless_compute_settings: Settings for serverless compute created in the workspace. + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :keyword serverless_compute_settings: Settings for serverless compute in a workspace. :paramtype serverless_compute_settings: ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings + :keyword service_managed_resources_settings: The service managed resource settings. + :paramtype service_managed_resources_settings: + ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings :keyword shared_private_link_resources: The list of shared private link resources in this workspace. :paramtype shared_private_link_resources: list[~azure.mgmt.machinelearningservices.models.SharedPrivateLinkResource] - :keyword service_managed_resources_settings: The service managed resource settings. - :paramtype service_managed_resources_settings: - ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings - :keyword primary_user_assigned_identity: The user assigned identity resource id that represents - the workspace identity. - :paramtype primary_user_assigned_identity: str + :keyword soft_delete_retention_in_days: Retention time in days after workspace get soft + deleted. + :paramtype soft_delete_retention_in_days: int + :keyword storage_account: ARM id of the storage account associated with this workspace. This + cannot be changed once the workspace has been created. + :paramtype storage_account: str + :keyword storage_accounts: + :paramtype storage_accounts: list[str] + :keyword system_datastores_auth_mode: The auth mode used for accessing the system datastores of + the workspace. + :paramtype system_datastores_auth_mode: str :keyword v1_legacy_mode: Enabling v1_legacy_mode may prevent you from using features provided by the v2 API. :paramtype v1_legacy_mode: bool - :keyword managed_network: Managed Network settings for a machine learning workspace. - :paramtype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings - :keyword feature_store_settings: Settings for feature store type workspace. - :paramtype feature_store_settings: - ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings - :keyword associated_workspaces: - :paramtype associated_workspaces: list[str] - :keyword enable_data_isolation: - :paramtype enable_data_isolation: bool - :keyword hub_resource_id: - :paramtype hub_resource_id: str :keyword workspace_hub_config: WorkspaceHub's configuration object. :paramtype workspace_hub_config: ~azure.mgmt.machinelearningservices.models.WorkspaceHubConfig """ @@ -27673,40 +30599,51 @@ def __init__( self.identity = kwargs.get('identity', None) self.kind = kwargs.get('kind', None) self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) self.sku = kwargs.get('sku', None) - self.workspace_id = None - self.description = kwargs.get('description', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.key_vault = kwargs.get('key_vault', None) + self.tags = kwargs.get('tags', None) + self.allow_public_access_when_behind_vnet = kwargs.get('allow_public_access_when_behind_vnet', None) + self.allow_role_assignment_on_rg = kwargs.get('allow_role_assignment_on_rg', None) self.application_insights = kwargs.get('application_insights', None) + self.associated_workspaces = kwargs.get('associated_workspaces', None) + self.container_registries = kwargs.get('container_registries', None) self.container_registry = kwargs.get('container_registry', None) - self.storage_account = kwargs.get('storage_account', None) + self.description = kwargs.get('description', None) self.discovery_url = kwargs.get('discovery_url', None) - self.provisioning_state = None + self.enable_data_isolation = kwargs.get('enable_data_isolation', None) + self.enable_service_side_cmk_encryption = kwargs.get('enable_service_side_cmk_encryption', None) + self.enable_simplified_cmk = kwargs.get('enable_simplified_cmk', None) + self.enable_software_bill_of_materials = kwargs.get('enable_software_bill_of_materials', None) self.encryption = kwargs.get('encryption', None) - self.hbi_workspace = kwargs.get('hbi_workspace', False) - self.service_provisioned_resource_group = None - self.private_link_count = None + self.existing_workspaces = kwargs.get('existing_workspaces', None) + self.feature_store_settings = kwargs.get('feature_store_settings', None) + self.friendly_name = kwargs.get('friendly_name', None) + self.hbi_workspace = kwargs.get('hbi_workspace', None) + self.hub_resource_id = kwargs.get('hub_resource_id', None) self.image_build_compute = kwargs.get('image_build_compute', None) - self.allow_public_access_when_behind_vnet = kwargs.get('allow_public_access_when_behind_vnet', False) - self.public_network_access = kwargs.get('public_network_access', None) + self.ip_allowlist = kwargs.get('ip_allowlist', None) + self.key_vault = kwargs.get('key_vault', None) + self.key_vaults = kwargs.get('key_vaults', None) + self.managed_network = kwargs.get('managed_network', None) + self.ml_flow_tracking_uri = None + self.notebook_info = None + self.primary_user_assigned_identity = kwargs.get('primary_user_assigned_identity', None) self.private_endpoint_connections = None + self.private_link_count = None + self.provisioning_state = None + self.public_network_access = kwargs.get('public_network_access', None) self.serverless_compute_settings = kwargs.get('serverless_compute_settings', None) - self.shared_private_link_resources = kwargs.get('shared_private_link_resources', None) - self.notebook_info = None self.service_managed_resources_settings = kwargs.get('service_managed_resources_settings', None) - self.primary_user_assigned_identity = kwargs.get('primary_user_assigned_identity', None) - self.tenant_id = None + self.service_provisioned_resource_group = None + self.shared_private_link_resources = kwargs.get('shared_private_link_resources', None) + self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', None) + self.storage_account = kwargs.get('storage_account', None) + self.storage_accounts = kwargs.get('storage_accounts', None) self.storage_hns_enabled = None - self.ml_flow_tracking_uri = None - self.v1_legacy_mode = kwargs.get('v1_legacy_mode', False) - self.managed_network = kwargs.get('managed_network', None) - self.feature_store_settings = kwargs.get('feature_store_settings', None) - self.associated_workspaces = kwargs.get('associated_workspaces', None) - self.enable_data_isolation = kwargs.get('enable_data_isolation', None) - self.hub_resource_id = kwargs.get('hub_resource_id', None) + self.system_datastores_auth_mode = kwargs.get('system_datastores_auth_mode', None) + self.tenant_id = None + self.v1_legacy_mode = kwargs.get('v1_legacy_mode', None) self.workspace_hub_config = kwargs.get('workspace_hub_config', None) + self.workspace_id = None class WorkspaceConnectionAccessKey(msrest.serialization.Model): @@ -27739,7 +30676,7 @@ def __init__( class WorkspaceConnectionAccountKey(msrest.serialization.Model): - """WorkspaceConnectionAccountKey. + """Account key object for workspace connection credential. :ivar key: :vartype key: str @@ -27787,15 +30724,15 @@ def __init__( class WorkspaceConnectionManagedIdentity(msrest.serialization.Model): """WorkspaceConnectionManagedIdentity. - :ivar resource_id: - :vartype resource_id: str :ivar client_id: :vartype client_id: str + :ivar resource_id: + :vartype resource_id: str """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, } def __init__( @@ -27803,14 +30740,14 @@ def __init__( **kwargs ): """ - :keyword resource_id: - :paramtype resource_id: str :keyword client_id: :paramtype client_id: str + :keyword resource_id: + :paramtype resource_id: str """ super(WorkspaceConnectionManagedIdentity, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) self.client_id = kwargs.get('client_id', None) + self.resource_id = kwargs.get('resource_id', None) class WorkspaceConnectionOAuth2(msrest.serialization.Model): @@ -27962,22 +30899,16 @@ def __init__( class WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult(msrest.serialization.Model): """WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult. - Variables are only populated by the server, and will be ignored when sending a request. - + :ivar next_link: + :vartype next_link: str :ivar value: :vartype value: list[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource] - :ivar next_link: - :vartype next_link: str """ - _validation = { - 'next_link': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkspaceConnectionPropertiesV2BasicResource]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[WorkspaceConnectionPropertiesV2BasicResource]'}, } def __init__( @@ -27985,13 +30916,15 @@ def __init__( **kwargs ): """ + :keyword next_link: + :paramtype next_link: str :keyword value: :paramtype value: list[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource] """ super(WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) - self.next_link = None class WorkspaceConnectionServicePrincipal(msrest.serialization.Model): @@ -28052,22 +30985,48 @@ def __init__( self.sas = kwargs.get('sas', None) +class WorkspaceConnectionUpdateParameter(msrest.serialization.Model): + """The properties that the machine learning workspace connection will be updated with. + + :ivar properties: The properties that the machine learning workspace connection will be updated + with. + :vartype properties: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2 + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'WorkspaceConnectionPropertiesV2'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: The properties that the machine learning workspace connection will be + updated with. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2 + """ + super(WorkspaceConnectionUpdateParameter, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + class WorkspaceConnectionUsernamePassword(msrest.serialization.Model): """WorkspaceConnectionUsernamePassword. - :ivar username: - :vartype username: str :ivar password: :vartype password: str :ivar security_token: Optional, required by connections like SalesForce for extra security in addition to UsernamePassword. :vartype security_token: str + :ivar username: + :vartype username: str """ _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, 'password': {'key': 'password', 'type': 'str'}, 'security_token': {'key': 'securityToken', 'type': 'str'}, + 'username': {'key': 'username', 'type': 'str'}, } def __init__( @@ -28075,18 +31034,18 @@ def __init__( **kwargs ): """ - :keyword username: - :paramtype username: str :keyword password: :paramtype password: str :keyword security_token: Optional, required by connections like SalesForce for extra security in addition to UsernamePassword. :paramtype security_token: str + :keyword username: + :paramtype username: str """ super(WorkspaceConnectionUsernamePassword, self).__init__(**kwargs) - self.username = kwargs.get('username', None) self.password = kwargs.get('password', None) self.security_token = kwargs.get('security_token', None) + self.username = kwargs.get('username', None) class WorkspaceHubConfig(msrest.serialization.Model): @@ -28121,17 +31080,17 @@ def __init__( class WorkspaceListResult(msrest.serialization.Model): """The result of a request to list machine learning workspaces. + :ivar next_link: The link to the next page constructed using the continuationToken. If null, + there are no additional pages. + :vartype next_link: str :ivar value: The list of machine learning workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning workspaces. :vartype value: list[~azure.mgmt.machinelearningservices.models.Workspace] - :ivar next_link: The URI that can be used to request the next list of machine learning - workspaces. - :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Workspace]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Workspace]'}, } def __init__( @@ -28139,82 +31098,129 @@ def __init__( **kwargs ): """ + :keyword next_link: The link to the next page constructed using the continuationToken. If + null, there are no additional pages. + :paramtype next_link: str :keyword value: The list of machine learning workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning workspaces. :paramtype value: list[~azure.mgmt.machinelearningservices.models.Workspace] - :keyword next_link: The URI that can be used to request the next list of machine learning - workspaces. - :paramtype next_link: str """ super(WorkspaceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class WorkspacePrivateEndpointResource(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: e.g. + /subscriptions/{networkSubscriptionId}/resourceGroups/{rgName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}. + :vartype id: str + :ivar subnet_arm_id: The subnetId that the private endpoint is connected to. + :vartype subnet_arm_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'subnet_arm_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'subnet_arm_id': {'key': 'subnetArmId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(WorkspacePrivateEndpointResource, self).__init__(**kwargs) + self.id = None + self.subnet_arm_id = None class WorkspaceUpdateParameters(msrest.serialization.Model): """The parameters for updating a machine learning workspace. + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku :ivar tags: A set of tags. The resource tags for the machine learning workspace. :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar allow_role_assignment_on_rg: + :vartype allow_role_assignment_on_rg: bool + :ivar application_insights: ARM id of the application insights associated with this workspace. + :vartype application_insights: str + :ivar container_registry: ARM id of the container registry associated with this workspace. + :vartype container_registry: str :ivar description: The description of this workspace. :vartype description: str - :ivar friendly_name: The friendly name for this workspace. + :ivar enable_data_isolation: + :vartype enable_data_isolation: bool + :ivar enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterials should be + enabled for this workspace. + :vartype enable_software_bill_of_materials: bool + :ivar encryption: + :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties + :ivar feature_store_settings: Settings for feature store type workspace. + :vartype feature_store_settings: + ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :ivar friendly_name: The friendly name for this workspace. This name in mutable. :vartype friendly_name: str :ivar image_build_compute: The compute name for image build. :vartype image_build_compute: str - :ivar service_managed_resources_settings: The service managed resource settings. - :vartype service_managed_resources_settings: - ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :ivar ip_allowlist: The list of IPv4 addresses that are allowed to access the workspace. + :vartype ip_allowlist: list[str] + :ivar managed_network: Managed Network settings for a machine learning workspace. + :vartype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings :ivar primary_user_assigned_identity: The user assigned identity resource id that represents the workspace identity. :vartype primary_user_assigned_identity: str - :ivar serverless_compute_settings: Settings for serverless compute created in the workspace. - :vartype serverless_compute_settings: - ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings :ivar public_network_access: Whether requests from Public Network are allowed. Possible values include: "Enabled", "Disabled". :vartype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccess - :ivar application_insights: ARM id of the application insights associated with this workspace. - :vartype application_insights: str - :ivar container_registry: ARM id of the container registry associated with this workspace. - :vartype container_registry: str - :ivar feature_store_settings: Settings for feature store type workspace. - :vartype feature_store_settings: - ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings - :ivar managed_network: Managed Network settings for a machine learning workspace. - :vartype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings - :ivar enable_data_isolation: - :vartype enable_data_isolation: bool + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :ivar serverless_compute_settings: Settings for serverless compute in a workspace. + :vartype serverless_compute_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings + :ivar service_managed_resources_settings: The service managed resource settings. + :vartype service_managed_resources_settings: + ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :ivar soft_delete_retention_in_days: Retention time in days after workspace get soft deleted. + :vartype soft_delete_retention_in_days: int :ivar v1_legacy_mode: Enabling v1_legacy_mode may prevent you from using features provided by the v2 API. :vartype v1_legacy_mode: bool - :ivar encryption: - :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'allow_role_assignment_on_rg': {'key': 'properties.allowRoleAssignmentOnRG', 'type': 'bool'}, + 'application_insights': {'key': 'properties.applicationInsights', 'type': 'str'}, + 'container_registry': {'key': 'properties.containerRegistry', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'enable_data_isolation': {'key': 'properties.enableDataIsolation', 'type': 'bool'}, + 'enable_software_bill_of_materials': {'key': 'properties.enableSoftwareBillOfMaterials', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionUpdateProperties'}, + 'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'}, 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, 'image_build_compute': {'key': 'properties.imageBuildCompute', 'type': 'str'}, - 'service_managed_resources_settings': {'key': 'properties.serviceManagedResourcesSettings', 'type': 'ServiceManagedResourcesSettings'}, + 'ip_allowlist': {'key': 'properties.ipAllowlist', 'type': '[str]'}, + 'managed_network': {'key': 'properties.managedNetwork', 'type': 'ManagedNetworkSettings'}, 'primary_user_assigned_identity': {'key': 'properties.primaryUserAssignedIdentity', 'type': 'str'}, - 'serverless_compute_settings': {'key': 'properties.serverlessComputeSettings', 'type': 'ServerlessComputeSettings'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'application_insights': {'key': 'properties.applicationInsights', 'type': 'str'}, - 'container_registry': {'key': 'properties.containerRegistry', 'type': 'str'}, - 'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'}, - 'managed_network': {'key': 'properties.managedNetwork', 'type': 'ManagedNetworkSettings'}, - 'enable_data_isolation': {'key': 'properties.enableDataIsolation', 'type': 'bool'}, + 'serverless_compute_settings': {'key': 'properties.serverlessComputeSettings', 'type': 'ServerlessComputeSettings'}, + 'service_managed_resources_settings': {'key': 'properties.serviceManagedResourcesSettings', 'type': 'ServiceManagedResourcesSettings'}, + 'soft_delete_retention_in_days': {'key': 'properties.softDeleteRetentionInDays', 'type': 'int'}, 'v1_legacy_mode': {'key': 'properties.v1LegacyMode', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionUpdateProperties'}, } def __init__( @@ -28222,64 +31228,79 @@ def __init__( **kwargs ): """ + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku :keyword tags: A set of tags. The resource tags for the machine learning workspace. :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword allow_role_assignment_on_rg: + :paramtype allow_role_assignment_on_rg: bool + :keyword application_insights: ARM id of the application insights associated with this + workspace. + :paramtype application_insights: str + :keyword container_registry: ARM id of the container registry associated with this workspace. + :paramtype container_registry: str :keyword description: The description of this workspace. :paramtype description: str - :keyword friendly_name: The friendly name for this workspace. + :keyword enable_data_isolation: + :paramtype enable_data_isolation: bool + :keyword enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterials should be + enabled for this workspace. + :paramtype enable_software_bill_of_materials: bool + :keyword encryption: + :paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties + :keyword feature_store_settings: Settings for feature store type workspace. + :paramtype feature_store_settings: + ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :keyword friendly_name: The friendly name for this workspace. This name in mutable. :paramtype friendly_name: str :keyword image_build_compute: The compute name for image build. :paramtype image_build_compute: str - :keyword service_managed_resources_settings: The service managed resource settings. - :paramtype service_managed_resources_settings: - ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :keyword ip_allowlist: The list of IPv4 addresses that are allowed to access the workspace. + :paramtype ip_allowlist: list[str] + :keyword managed_network: Managed Network settings for a machine learning workspace. + :paramtype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings :keyword primary_user_assigned_identity: The user assigned identity resource id that represents the workspace identity. :paramtype primary_user_assigned_identity: str - :keyword serverless_compute_settings: Settings for serverless compute created in the workspace. - :paramtype serverless_compute_settings: - ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings :keyword public_network_access: Whether requests from Public Network are allowed. Possible values include: "Enabled", "Disabled". :paramtype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccess - :keyword application_insights: ARM id of the application insights associated with this - workspace. - :paramtype application_insights: str - :keyword container_registry: ARM id of the container registry associated with this workspace. - :paramtype container_registry: str - :keyword feature_store_settings: Settings for feature store type workspace. - :paramtype feature_store_settings: - ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings - :keyword managed_network: Managed Network settings for a machine learning workspace. - :paramtype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings - :keyword enable_data_isolation: - :paramtype enable_data_isolation: bool + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :keyword serverless_compute_settings: Settings for serverless compute in a workspace. + :paramtype serverless_compute_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings + :keyword service_managed_resources_settings: The service managed resource settings. + :paramtype service_managed_resources_settings: + ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :keyword soft_delete_retention_in_days: Retention time in days after workspace get soft + deleted. + :paramtype soft_delete_retention_in_days: int :keyword v1_legacy_mode: Enabling v1_legacy_mode may prevent you from using features provided by the v2 API. :paramtype v1_legacy_mode: bool - :keyword encryption: - :paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties """ super(WorkspaceUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) self.identity = kwargs.get('identity', None) + self.sku = kwargs.get('sku', None) + self.tags = kwargs.get('tags', None) + self.allow_role_assignment_on_rg = kwargs.get('allow_role_assignment_on_rg', None) + self.application_insights = kwargs.get('application_insights', None) + self.container_registry = kwargs.get('container_registry', None) self.description = kwargs.get('description', None) + self.enable_data_isolation = kwargs.get('enable_data_isolation', None) + self.enable_software_bill_of_materials = kwargs.get('enable_software_bill_of_materials', None) + self.encryption = kwargs.get('encryption', None) + self.feature_store_settings = kwargs.get('feature_store_settings', None) self.friendly_name = kwargs.get('friendly_name', None) self.image_build_compute = kwargs.get('image_build_compute', None) - self.service_managed_resources_settings = kwargs.get('service_managed_resources_settings', None) + self.ip_allowlist = kwargs.get('ip_allowlist', None) + self.managed_network = kwargs.get('managed_network', None) self.primary_user_assigned_identity = kwargs.get('primary_user_assigned_identity', None) - self.serverless_compute_settings = kwargs.get('serverless_compute_settings', None) self.public_network_access = kwargs.get('public_network_access', None) - self.application_insights = kwargs.get('application_insights', None) - self.container_registry = kwargs.get('container_registry', None) - self.feature_store_settings = kwargs.get('feature_store_settings', None) - self.managed_network = kwargs.get('managed_network', None) - self.enable_data_isolation = kwargs.get('enable_data_isolation', None) + self.serverless_compute_settings = kwargs.get('serverless_compute_settings', None) + self.service_managed_resources_settings = kwargs.get('service_managed_resources_settings', None) + self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', None) self.v1_legacy_mode = kwargs.get('v1_legacy_mode', None) - self.encryption = kwargs.get('encryption', None) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/_models_py3.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/_models_py3.py index 5e6a202e33abe..bccf637396e9e 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/_models_py3.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/models/_models_py3.py @@ -31,7 +31,7 @@ class WorkspaceConnectionPropertiesV2(msrest.serialization.Model): :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -46,10 +46,12 @@ class WorkspaceConnectionPropertiesV2(msrest.serialization.Model): "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -57,16 +59,18 @@ class WorkspaceConnectionPropertiesV2(msrest.serialization.Model): :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool """ _validation = { @@ -79,14 +83,16 @@ class WorkspaceConnectionPropertiesV2(msrest.serialization.Model): 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, } _subtype_map = { @@ -97,19 +103,21 @@ def __init__( self, *, category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, **kwargs ): """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -124,36 +132,42 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool """ super(WorkspaceConnectionPropertiesV2, self).__init__(**kwargs) self.auth_type = None # type: Optional[str] self.category = category self.created_by_workspace_arm_id = None + self.error = error self.expiry_time = expiry_time self.group = None self.is_shared_to_all = is_shared_to_all - self.target = target self.metadata = metadata + self.pe_requirement = pe_requirement + self.pe_status = pe_status self.shared_user_list = shared_user_list - self.value = value - self.value_format = value_format + self.target = target + self.use_workspace_managed_identity = use_workspace_managed_identity class AADAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): @@ -169,7 +183,7 @@ class AADAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -184,10 +198,12 @@ class AADAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -195,16 +211,18 @@ class AADAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool """ _validation = { @@ -217,33 +235,37 @@ class AADAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, } def __init__( self, *, category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, **kwargs ): """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -258,25 +280,29 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool """ - super(AADAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, target=target, metadata=metadata, shared_user_list=shared_user_list, value=value, value_format=value_format, **kwargs) + super(AADAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, error=error, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, metadata=metadata, pe_requirement=pe_requirement, pe_status=pe_status, shared_user_list=shared_user_list, target=target, use_workspace_managed_identity=use_workspace_managed_identity, **kwargs) self.auth_type = 'AAD' # type: str @@ -293,7 +319,7 @@ class AccessKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionProperti :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -308,10 +334,12 @@ class AccessKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionProperti "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -319,16 +347,18 @@ class AccessKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionProperti :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccessKey """ @@ -343,14 +373,16 @@ class AccessKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionProperti 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionAccessKey'}, } @@ -358,20 +390,22 @@ def __init__( self, *, category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, credentials: Optional["WorkspaceConnectionAccessKey"] = None, **kwargs ): """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -386,31 +420,67 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccessKey """ - super(AccessKeyAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, target=target, metadata=metadata, shared_user_list=shared_user_list, value=value, value_format=value_format, **kwargs) + super(AccessKeyAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, error=error, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, metadata=metadata, pe_requirement=pe_requirement, pe_status=pe_status, shared_user_list=shared_user_list, target=target, use_workspace_managed_identity=use_workspace_managed_identity, **kwargs) self.auth_type = 'AccessKey' # type: str self.credentials = credentials +class AccountApiKeys(msrest.serialization.Model): + """AccountApiKeys. + + :ivar key1: + :vartype key1: str + :ivar key2: + :vartype key2: str + """ + + _attribute_map = { + 'key1': {'key': 'key1', 'type': 'str'}, + 'key2': {'key': 'key2', 'type': 'str'}, + } + + def __init__( + self, + *, + key1: Optional[str] = None, + key2: Optional[str] = None, + **kwargs + ): + """ + :keyword key1: + :paramtype key1: str + :keyword key2: + :paramtype key2: str + """ + super(AccountApiKeys, self).__init__(**kwargs) + self.key1 = key1 + self.key2 = key2 + + class AccountKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): """This connection type covers the account key connection for Azure storage. @@ -424,7 +494,7 @@ class AccountKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropert :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -439,10 +509,12 @@ class AccountKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropert "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -450,17 +522,19 @@ class AccountKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropert :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :ivar credentials: + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: Account key object for workspace connection credential. :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccountKey """ @@ -474,14 +548,16 @@ class AccountKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropert 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionAccountKey'}, } @@ -489,20 +565,22 @@ def __init__( self, *, category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, credentials: Optional["WorkspaceConnectionAccountKey"] = None, **kwargs ): """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -517,28 +595,32 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :keyword credentials: + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: Account key object for workspace connection credential. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccountKey """ - super(AccountKeyAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, target=target, metadata=metadata, shared_user_list=shared_user_list, value=value, value_format=value_format, **kwargs) + super(AccountKeyAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, error=error, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, metadata=metadata, pe_requirement=pe_requirement, pe_status=pe_status, shared_user_list=shared_user_list, target=target, use_workspace_managed_identity=use_workspace_managed_identity, **kwargs) self.auth_type = 'AccountKey' # type: str self.credentials = credentials @@ -2012,7 +2094,7 @@ class ApiKeyAuthWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -2027,10 +2109,12 @@ class ApiKeyAuthWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -2038,16 +2122,18 @@ class ApiKeyAuthWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: Api key object for workspace connection credential. :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionApiKey """ @@ -2062,14 +2148,16 @@ class ApiKeyAuthWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionApiKey'}, } @@ -2077,20 +2165,22 @@ def __init__( self, *, category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, credentials: Optional["WorkspaceConnectionApiKey"] = None, **kwargs ): """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -2105,27 +2195,31 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: Api key object for workspace connection credential. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionApiKey """ - super(ApiKeyAuthWorkspaceConnectionProperties, self).__init__(category=category, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, target=target, metadata=metadata, shared_user_list=shared_user_list, value=value, value_format=value_format, **kwargs) + super(ApiKeyAuthWorkspaceConnectionProperties, self).__init__(category=category, error=error, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, metadata=metadata, pe_requirement=pe_requirement, pe_status=pe_status, shared_user_list=shared_user_list, target=target, use_workspace_managed_identity=use_workspace_managed_identity, **kwargs) self.auth_type = 'ApiKey' # type: str self.credentials = credentials @@ -4899,7 +4993,7 @@ def __init__( class BindOptions(msrest.serialization.Model): - """Describes the bind options for the container. + """BindOptions. :ivar propagation: Type of Bind Option. :vartype propagation: str @@ -5040,6 +5134,59 @@ def __init__( self.dockerfile_path = dockerfile_path +class CapacityConfig(msrest.serialization.Model): + """The capacity configuration. + + :ivar minimum: The minimum capacity. + :vartype minimum: int + :ivar maximum: The maximum capacity. + :vartype maximum: int + :ivar step: The minimal incremental between allowed values for capacity. + :vartype step: int + :ivar default: The default capacity. + :vartype default: int + :ivar allowed_values: The array of allowed values for capacity. + :vartype allowed_values: list[int] + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'step': {'key': 'step', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + 'allowed_values': {'key': 'allowedValues', 'type': '[int]'}, + } + + def __init__( + self, + *, + minimum: Optional[int] = None, + maximum: Optional[int] = None, + step: Optional[int] = None, + default: Optional[int] = None, + allowed_values: Optional[List[int]] = None, + **kwargs + ): + """ + :keyword minimum: The minimum capacity. + :paramtype minimum: int + :keyword maximum: The maximum capacity. + :paramtype maximum: int + :keyword step: The minimal incremental between allowed values for capacity. + :paramtype step: int + :keyword default: The default capacity. + :paramtype default: int + :keyword allowed_values: The array of allowed values for capacity. + :paramtype allowed_values: list[int] + """ + super(CapacityConfig, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + self.step = step + self.default = default + self.allowed_values = allowed_values + + class DataDriftMetricThresholdBase(msrest.serialization.Model): """DataDriftMetricThresholdBase. @@ -6266,6 +6413,108 @@ def __init__( self.value = value +class CognitiveServiceEndpointDeploymentResourceProperties(msrest.serialization.Model): + """CognitiveServiceEndpointDeploymentResourceProperties. + + All required parameters must be populated in order to send to Azure. + + :ivar model: Required. Model used for the endpoint deployment. + :vartype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar version_upgrade_option: Deployment model version upgrade option. Possible values include: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + """ + + _validation = { + 'model': {'required': True}, + } + + _attribute_map = { + 'model': {'key': 'model', 'type': 'EndpointDeploymentModel'}, + 'rai_policy_name': {'key': 'raiPolicyName', 'type': 'str'}, + 'version_upgrade_option': {'key': 'versionUpgradeOption', 'type': 'str'}, + } + + def __init__( + self, + *, + model: "EndpointDeploymentModel", + rai_policy_name: Optional[str] = None, + version_upgrade_option: Optional[Union[str, "DeploymentModelVersionUpgradeOption"]] = None, + **kwargs + ): + """ + :keyword model: Required. Model used for the endpoint deployment. + :paramtype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :keyword rai_policy_name: The name of RAI policy. + :paramtype rai_policy_name: str + :keyword version_upgrade_option: Deployment model version upgrade option. Possible values + include: "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :paramtype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + """ + super(CognitiveServiceEndpointDeploymentResourceProperties, self).__init__(**kwargs) + self.model = model + self.rai_policy_name = rai_policy_name + self.version_upgrade_option = version_upgrade_option + + +class CognitiveServicesSku(msrest.serialization.Model): + """CognitiveServicesSku. + + :ivar capacity: + :vartype capacity: int + :ivar family: + :vartype family: str + :ivar name: + :vartype name: str + :ivar size: + :vartype size: str + :ivar tier: + :vartype tier: str + """ + + _attribute_map = { + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + capacity: Optional[int] = None, + family: Optional[str] = None, + name: Optional[str] = None, + size: Optional[str] = None, + tier: Optional[str] = None, + **kwargs + ): + """ + :keyword capacity: + :paramtype capacity: int + :keyword family: + :paramtype family: str + :keyword name: + :paramtype name: str + :keyword size: + :paramtype size: str + :keyword tier: + :paramtype tier: str + """ + super(CognitiveServicesSku, self).__init__(**kwargs) + self.capacity = capacity + self.family = family + self.name = name + self.size = size + self.tier = tier + + class Collection(msrest.serialization.Model): """Collection. @@ -7107,6 +7356,34 @@ def __init__( self.endpoint_uri = endpoint_uri +class ComputeInstanceAutologgerSettings(msrest.serialization.Model): + """Specifies settings for autologger. + + :ivar mlflow_autologger: Indicates whether mlflow autologger is enabled for notebooks. Possible + values include: "Enabled", "Disabled". + :vartype mlflow_autologger: str or ~azure.mgmt.machinelearningservices.models.MlflowAutologger + """ + + _attribute_map = { + 'mlflow_autologger': {'key': 'mlflowAutologger', 'type': 'str'}, + } + + def __init__( + self, + *, + mlflow_autologger: Optional[Union[str, "MlflowAutologger"]] = None, + **kwargs + ): + """ + :keyword mlflow_autologger: Indicates whether mlflow autologger is enabled for notebooks. + Possible values include: "Enabled", "Disabled". + :paramtype mlflow_autologger: str or + ~azure.mgmt.machinelearningservices.models.MlflowAutologger + """ + super(ComputeInstanceAutologgerSettings, self).__init__(**kwargs) + self.mlflow_autologger = mlflow_autologger + + class ComputeInstanceConnectivityEndpoints(msrest.serialization.Model): """Defines all connectivity endpoints and properties for an ComputeInstance. @@ -7306,6 +7583,8 @@ class ComputeInstanceDataMount(msrest.serialization.Model): :vartype mount_name: str :ivar mount_action: Mount Action. Possible values include: "Mount", "Unmount". :vartype mount_action: str or ~azure.mgmt.machinelearningservices.models.MountAction + :ivar mount_mode: Mount Mode. Possible values include: "ReadOnly", "ReadWrite". + :vartype mount_mode: str or ~azure.mgmt.machinelearningservices.models.MountMode :ivar created_by: who this data mount created by. :vartype created_by: str :ivar mount_path: Path of this data mount. @@ -7324,6 +7603,7 @@ class ComputeInstanceDataMount(msrest.serialization.Model): 'source_type': {'key': 'sourceType', 'type': 'str'}, 'mount_name': {'key': 'mountName', 'type': 'str'}, 'mount_action': {'key': 'mountAction', 'type': 'str'}, + 'mount_mode': {'key': 'mountMode', 'type': 'str'}, 'created_by': {'key': 'createdBy', 'type': 'str'}, 'mount_path': {'key': 'mountPath', 'type': 'str'}, 'mount_state': {'key': 'mountState', 'type': 'str'}, @@ -7338,6 +7618,7 @@ def __init__( source_type: Optional[Union[str, "SourceType"]] = None, mount_name: Optional[str] = None, mount_action: Optional[Union[str, "MountAction"]] = None, + mount_mode: Optional[Union[str, "MountMode"]] = None, created_by: Optional[str] = None, mount_path: Optional[str] = None, mount_state: Optional[Union[str, "MountState"]] = None, @@ -7354,6 +7635,8 @@ def __init__( :paramtype mount_name: str :keyword mount_action: Mount Action. Possible values include: "Mount", "Unmount". :paramtype mount_action: str or ~azure.mgmt.machinelearningservices.models.MountAction + :keyword mount_mode: Mount Mode. Possible values include: "ReadOnly", "ReadWrite". + :paramtype mount_mode: str or ~azure.mgmt.machinelearningservices.models.MountMode :keyword created_by: who this data mount created by. :paramtype created_by: str :keyword mount_path: Path of this data mount. @@ -7371,6 +7654,7 @@ def __init__( self.source_type = source_type self.mount_name = mount_name self.mount_action = mount_action + self.mount_mode = mount_mode self.created_by = created_by self.mount_path = mount_path self.mount_state = mount_state @@ -7414,12 +7698,13 @@ class ComputeInstanceLastOperation(msrest.serialization.Model): """The last operation on ComputeInstance. :ivar operation_name: Name of the last operation. Possible values include: "Create", "Start", - "Stop", "Restart", "Reimage", "Delete". + "Stop", "Restart", "Resize", "Reimage", "Delete". :vartype operation_name: str or ~azure.mgmt.machinelearningservices.models.OperationName :ivar operation_time: Time of the last operation. :vartype operation_time: ~datetime.datetime :ivar operation_status: Operation status. Possible values include: "InProgress", "Succeeded", - "CreateFailed", "StartFailed", "StopFailed", "RestartFailed", "ReimageFailed", "DeleteFailed". + "CreateFailed", "StartFailed", "StopFailed", "RestartFailed", "ResizeFailed", "ReimageFailed", + "DeleteFailed". :vartype operation_status: str or ~azure.mgmt.machinelearningservices.models.OperationStatus :ivar operation_trigger: Trigger of operation. Possible values include: "User", "Schedule", "IdleShutdown". @@ -7444,13 +7729,13 @@ def __init__( ): """ :keyword operation_name: Name of the last operation. Possible values include: "Create", - "Start", "Stop", "Restart", "Reimage", "Delete". + "Start", "Stop", "Restart", "Resize", "Reimage", "Delete". :paramtype operation_name: str or ~azure.mgmt.machinelearningservices.models.OperationName :keyword operation_time: Time of the last operation. :paramtype operation_time: ~datetime.datetime :keyword operation_status: Operation status. Possible values include: "InProgress", - "Succeeded", "CreateFailed", "StartFailed", "StopFailed", "RestartFailed", "ReimageFailed", - "DeleteFailed". + "Succeeded", "CreateFailed", "StartFailed", "StopFailed", "RestartFailed", "ResizeFailed", + "ReimageFailed", "DeleteFailed". :paramtype operation_status: str or ~azure.mgmt.machinelearningservices.models.OperationStatus :keyword operation_trigger: Trigger of operation. Possible values include: "User", "Schedule", "IdleShutdown". @@ -7480,6 +7765,9 @@ class ComputeInstanceProperties(msrest.serialization.Model): value: "Shared". :vartype application_sharing_policy: str or ~azure.mgmt.machinelearningservices.models.ApplicationSharingPolicy + :ivar autologger_settings: Specifies settings for autologger. + :vartype autologger_settings: + ~azure.mgmt.machinelearningservices.models.ComputeInstanceAutologgerSettings :ivar ssh_settings: Specifies policy and settings for SSH access. :vartype ssh_settings: ~azure.mgmt.machinelearningservices.models.ComputeInstanceSshSettings :ivar custom_services: List of Custom Services added to the compute. @@ -7500,13 +7788,24 @@ class ComputeInstanceProperties(msrest.serialization.Model): :ivar errors: Collection of errors encountered on this ComputeInstance. :vartype errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] :ivar state: The current state of this ComputeInstance. Possible values include: "Creating", - "CreateFailed", "Deleting", "Running", "Restarting", "JobRunning", "SettingUp", "SetupFailed", - "Starting", "Stopped", "Stopping", "UserSettingUp", "UserSetupFailed", "Unknown", "Unusable". + "CreateFailed", "Deleting", "Running", "Restarting", "Resizing", "JobRunning", "SettingUp", + "SetupFailed", "Starting", "Stopped", "Stopping", "UserSettingUp", "UserSetupFailed", + "Unknown", "Unusable". :vartype state: str or ~azure.mgmt.machinelearningservices.models.ComputeInstanceState :ivar compute_instance_authorization_type: The Compute Instance Authorization type. Available values are personal (default). Possible values include: "personal". Default value: "personal". :vartype compute_instance_authorization_type: str or ~azure.mgmt.machinelearningservices.models.ComputeInstanceAuthorizationType + :ivar enable_os_patching: Enable Auto OS Patching. Possible values are: true, false. + :vartype enable_os_patching: bool + :ivar enable_root_access: Enable root access. Possible values are: true, false. + :vartype enable_root_access: bool + :ivar enable_sso: Enable SSO (single sign on). Possible values are: true, false. + :vartype enable_sso: bool + :ivar release_quota_on_stop: Release quota if compute instance stopped. Possible values are: + true - release quota if compute instance stopped. false - don't release quota when compute + instance stopped. + :vartype release_quota_on_stop: bool :ivar personal_compute_instance_settings: Settings for a personal compute instance. :vartype personal_compute_instance_settings: ~azure.mgmt.machinelearningservices.models.PersonalComputeInstanceSettings @@ -7517,6 +7816,9 @@ class ComputeInstanceProperties(msrest.serialization.Model): ~azure.mgmt.machinelearningservices.models.ComputeInstanceLastOperation :ivar schedules: The list of schedules to be applied on the computes. :vartype schedules: ~azure.mgmt.machinelearningservices.models.ComputeSchedules + :ivar idle_time_before_shutdown: Stops compute instance after user defined period of + inactivity. Time is defined in ISO8601 format. Minimum is 15 min, maximum is 3 days. + :vartype idle_time_before_shutdown: str :ivar enable_node_public_ip: Enable or disable node public IP address provisioning. Possible values are: Possible values are: true - Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will have a private endpoint and no @@ -7550,6 +7852,7 @@ class ComputeInstanceProperties(msrest.serialization.Model): 'vm_size': {'key': 'vmSize', 'type': 'str'}, 'subnet': {'key': 'subnet', 'type': 'ResourceId'}, 'application_sharing_policy': {'key': 'applicationSharingPolicy', 'type': 'str'}, + 'autologger_settings': {'key': 'autologgerSettings', 'type': 'ComputeInstanceAutologgerSettings'}, 'ssh_settings': {'key': 'sshSettings', 'type': 'ComputeInstanceSshSettings'}, 'custom_services': {'key': 'customServices', 'type': '[CustomService]'}, 'os_image_metadata': {'key': 'osImageMetadata', 'type': 'ImageMetadata'}, @@ -7559,10 +7862,15 @@ class ComputeInstanceProperties(msrest.serialization.Model): 'errors': {'key': 'errors', 'type': '[ErrorResponse]'}, 'state': {'key': 'state', 'type': 'str'}, 'compute_instance_authorization_type': {'key': 'computeInstanceAuthorizationType', 'type': 'str'}, + 'enable_os_patching': {'key': 'enableOSPatching', 'type': 'bool'}, + 'enable_root_access': {'key': 'enableRootAccess', 'type': 'bool'}, + 'enable_sso': {'key': 'enableSSO', 'type': 'bool'}, + 'release_quota_on_stop': {'key': 'releaseQuotaOnStop', 'type': 'bool'}, 'personal_compute_instance_settings': {'key': 'personalComputeInstanceSettings', 'type': 'PersonalComputeInstanceSettings'}, 'setup_scripts': {'key': 'setupScripts', 'type': 'SetupScripts'}, 'last_operation': {'key': 'lastOperation', 'type': 'ComputeInstanceLastOperation'}, 'schedules': {'key': 'schedules', 'type': 'ComputeSchedules'}, + 'idle_time_before_shutdown': {'key': 'idleTimeBeforeShutdown', 'type': 'str'}, 'enable_node_public_ip': {'key': 'enableNodePublicIp', 'type': 'bool'}, 'containers': {'key': 'containers', 'type': '[ComputeInstanceContainer]'}, 'data_disks': {'key': 'dataDisks', 'type': '[ComputeInstanceDataDisk]'}, @@ -7576,12 +7884,18 @@ def __init__( vm_size: Optional[str] = None, subnet: Optional["ResourceId"] = None, application_sharing_policy: Optional[Union[str, "ApplicationSharingPolicy"]] = "Shared", + autologger_settings: Optional["ComputeInstanceAutologgerSettings"] = None, ssh_settings: Optional["ComputeInstanceSshSettings"] = None, custom_services: Optional[List["CustomService"]] = None, compute_instance_authorization_type: Optional[Union[str, "ComputeInstanceAuthorizationType"]] = "personal", + enable_os_patching: Optional[bool] = False, + enable_root_access: Optional[bool] = True, + enable_sso: Optional[bool] = True, + release_quota_on_stop: Optional[bool] = False, personal_compute_instance_settings: Optional["PersonalComputeInstanceSettings"] = None, setup_scripts: Optional["SetupScripts"] = None, schedules: Optional["ComputeSchedules"] = None, + idle_time_before_shutdown: Optional[str] = None, enable_node_public_ip: Optional[bool] = None, **kwargs ): @@ -7597,6 +7911,9 @@ def __init__( value: "Shared". :paramtype application_sharing_policy: str or ~azure.mgmt.machinelearningservices.models.ApplicationSharingPolicy + :keyword autologger_settings: Specifies settings for autologger. + :paramtype autologger_settings: + ~azure.mgmt.machinelearningservices.models.ComputeInstanceAutologgerSettings :keyword ssh_settings: Specifies policy and settings for SSH access. :paramtype ssh_settings: ~azure.mgmt.machinelearningservices.models.ComputeInstanceSshSettings :keyword custom_services: List of Custom Services added to the compute. @@ -7606,6 +7923,16 @@ def __init__( "personal". :paramtype compute_instance_authorization_type: str or ~azure.mgmt.machinelearningservices.models.ComputeInstanceAuthorizationType + :keyword enable_os_patching: Enable Auto OS Patching. Possible values are: true, false. + :paramtype enable_os_patching: bool + :keyword enable_root_access: Enable root access. Possible values are: true, false. + :paramtype enable_root_access: bool + :keyword enable_sso: Enable SSO (single sign on). Possible values are: true, false. + :paramtype enable_sso: bool + :keyword release_quota_on_stop: Release quota if compute instance stopped. Possible values are: + true - release quota if compute instance stopped. false - don't release quota when compute + instance stopped. + :paramtype release_quota_on_stop: bool :keyword personal_compute_instance_settings: Settings for a personal compute instance. :paramtype personal_compute_instance_settings: ~azure.mgmt.machinelearningservices.models.PersonalComputeInstanceSettings @@ -7613,6 +7940,9 @@ def __init__( :paramtype setup_scripts: ~azure.mgmt.machinelearningservices.models.SetupScripts :keyword schedules: The list of schedules to be applied on the computes. :paramtype schedules: ~azure.mgmt.machinelearningservices.models.ComputeSchedules + :keyword idle_time_before_shutdown: Stops compute instance after user defined period of + inactivity. Time is defined in ISO8601 format. Minimum is 15 min, maximum is 3 days. + :paramtype idle_time_before_shutdown: str :keyword enable_node_public_ip: Enable or disable node public IP address provisioning. Possible values are: Possible values are: true - Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will have a private endpoint and no @@ -7623,6 +7953,7 @@ def __init__( self.vm_size = vm_size self.subnet = subnet self.application_sharing_policy = application_sharing_policy + self.autologger_settings = autologger_settings self.ssh_settings = ssh_settings self.custom_services = custom_services self.os_image_metadata = None @@ -7632,10 +7963,15 @@ def __init__( self.errors = None self.state = None self.compute_instance_authorization_type = compute_instance_authorization_type + self.enable_os_patching = enable_os_patching + self.enable_root_access = enable_root_access + self.enable_sso = enable_sso + self.release_quota_on_stop = release_quota_on_stop self.personal_compute_instance_settings = personal_compute_instance_settings self.setup_scripts = setup_scripts self.last_operation = None self.schedules = schedules + self.idle_time_before_shutdown = idle_time_before_shutdown self.enable_node_public_ip = enable_node_public_ip self.containers = None self.data_disks = None @@ -7883,7 +8219,7 @@ def __init__( class ComputeRuntimeDto(msrest.serialization.Model): - """Compute runtime config for feature store type workspace. + """ComputeRuntimeDto. :ivar spark_runtime_version: :vartype spark_runtime_version: str @@ -8131,32 +8467,360 @@ def __init__( self.content_safety_status = content_safety_status -class CosmosDbSettings(msrest.serialization.Model): - """CosmosDbSettings. +class EndpointDeploymentResourceProperties(msrest.serialization.Model): + """EndpointDeploymentResourceProperties. - :ivar collections_throughput: The throughput of the collections in cosmosdb database. - :vartype collections_throughput: int + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ContentSafetyEndpointDeploymentResourceProperties, OpenAIEndpointDeploymentResourceProperties, SpeechEndpointDeploymentResourceProperties, ManagedOnlineEndpointDeploymentResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Required. Kind of the deployment.Constant filled by server. + :vartype type: str """ + _validation = { + 'provisioning_state': {'readonly': True}, + 'type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + _attribute_map = { - 'collections_throughput': {'key': 'collectionsThroughput', 'type': 'int'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Azure.ContentSafety': 'ContentSafetyEndpointDeploymentResourceProperties', 'Azure.OpenAI': 'OpenAIEndpointDeploymentResourceProperties', 'Azure.Speech': 'SpeechEndpointDeploymentResourceProperties', 'managedOnlineEndpoint': 'ManagedOnlineEndpointDeploymentResourceProperties'} } def __init__( self, *, - collections_throughput: Optional[int] = None, + failure_reason: Optional[str] = None, **kwargs ): """ - :keyword collections_throughput: The throughput of the collections in cosmosdb database. - :paramtype collections_throughput: int + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str """ - super(CosmosDbSettings, self).__init__(**kwargs) - self.collections_throughput = collections_throughput + super(EndpointDeploymentResourceProperties, self).__init__(**kwargs) + self.failure_reason = failure_reason + self.provisioning_state = None + self.type = None # type: Optional[str] -class ScheduleActionBase(msrest.serialization.Model): +class ContentSafetyEndpointDeploymentResourceProperties(EndpointDeploymentResourceProperties, CognitiveServiceEndpointDeploymentResourceProperties): + """ContentSafetyEndpointDeploymentResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar model: Required. Model used for the endpoint deployment. + :vartype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar version_upgrade_option: Deployment model version upgrade option. Possible values include: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Required. Kind of the deployment.Constant filled by server. + :vartype type: str + """ + + _validation = { + 'model': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'model': {'key': 'model', 'type': 'EndpointDeploymentModel'}, + 'rai_policy_name': {'key': 'raiPolicyName', 'type': 'str'}, + 'version_upgrade_option': {'key': 'versionUpgradeOption', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + model: "EndpointDeploymentModel", + rai_policy_name: Optional[str] = None, + version_upgrade_option: Optional[Union[str, "DeploymentModelVersionUpgradeOption"]] = None, + failure_reason: Optional[str] = None, + **kwargs + ): + """ + :keyword model: Required. Model used for the endpoint deployment. + :paramtype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :keyword rai_policy_name: The name of RAI policy. + :paramtype rai_policy_name: str + :keyword version_upgrade_option: Deployment model version upgrade option. Possible values + include: "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :paramtype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + """ + super(ContentSafetyEndpointDeploymentResourceProperties, self).__init__(failure_reason=failure_reason, model=model, rai_policy_name=rai_policy_name, version_upgrade_option=version_upgrade_option, **kwargs) + self.model = model + self.rai_policy_name = rai_policy_name + self.version_upgrade_option = version_upgrade_option + self.type = 'Azure.ContentSafety' # type: str + self.failure_reason = failure_reason + self.provisioning_state = None + + +class EndpointResourceProperties(msrest.serialization.Model): + """EndpointResourceProperties. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ContentSafetyEndpointResourceProperties, OpenAIEndpointResourceProperties, SpeechEndpointResourceProperties, ManagedOnlineEndpointResourceProperties, ServerlessEndpointResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Required. Type of the endpoint.Constant filled by server. Possible values + include: "Azure.OpenAI", "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", + "managedOnlineEndpoint", "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool + """ + + _validation = { + 'endpoint_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'associated_resource_id': {'key': 'associatedResourceId', 'type': 'str'}, + 'deployments': {'key': 'deployments', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'should_create_ai_services_endpoint': {'key': 'shouldCreateAiServicesEndpoint', 'type': 'bool'}, + } + + _subtype_map = { + 'endpoint_type': {'Azure.ContentSafety': 'ContentSafetyEndpointResourceProperties', 'Azure.OpenAI': 'OpenAIEndpointResourceProperties', 'Azure.Speech': 'SpeechEndpointResourceProperties', 'managedOnlineEndpoint': 'ManagedOnlineEndpointResourceProperties', 'serverlessEndpoint': 'ServerlessEndpointResourceProperties'} + } + + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + deployments: Optional[List["EndpointDeploymentResourcePropertiesBasicResource"]] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + should_create_ai_services_endpoint: Optional[bool] = None, + **kwargs + ): + """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + """ + super(EndpointResourceProperties, self).__init__(**kwargs) + self.associated_resource_id = associated_resource_id + self.deployments = deployments + self.endpoint_type = None # type: Optional[str] + self.endpoint_uri = endpoint_uri + self.failure_reason = failure_reason + self.location = location + self.name = name + self.provisioning_state = None + self.should_create_ai_services_endpoint = should_create_ai_services_endpoint + + +class ContentSafetyEndpointResourceProperties(EndpointResourceProperties): + """ContentSafetyEndpointResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Required. Type of the endpoint.Constant filled by server. Possible values + include: "Azure.OpenAI", "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", + "managedOnlineEndpoint", "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool + """ + + _validation = { + 'endpoint_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'associated_resource_id': {'key': 'associatedResourceId', 'type': 'str'}, + 'deployments': {'key': 'deployments', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'should_create_ai_services_endpoint': {'key': 'shouldCreateAiServicesEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + deployments: Optional[List["EndpointDeploymentResourcePropertiesBasicResource"]] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + should_create_ai_services_endpoint: Optional[bool] = None, + **kwargs + ): + """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + """ + super(ContentSafetyEndpointResourceProperties, self).__init__(associated_resource_id=associated_resource_id, deployments=deployments, endpoint_uri=endpoint_uri, failure_reason=failure_reason, location=location, name=name, should_create_ai_services_endpoint=should_create_ai_services_endpoint, **kwargs) + self.endpoint_type = 'Azure.ContentSafety' # type: str + + +class CosmosDbSettings(msrest.serialization.Model): + """CosmosDbSettings. + + :ivar collections_throughput: + :vartype collections_throughput: int + """ + + _attribute_map = { + 'collections_throughput': {'key': 'collectionsThroughput', 'type': 'int'}, + } + + def __init__( + self, + *, + collections_throughput: Optional[int] = None, + **kwargs + ): + """ + :keyword collections_throughput: + :paramtype collections_throughput: int + """ + super(CosmosDbSettings, self).__init__(**kwargs) + self.collections_throughput = collections_throughput + + +class ScheduleActionBase(msrest.serialization.Model): """ScheduleActionBase. You probably want to use the sub-classes and not this class directly. Known @@ -8490,7 +9154,7 @@ class CustomKeysWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -8505,10 +9169,12 @@ class CustomKeysWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -8516,16 +9182,18 @@ class CustomKeysWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: Custom Keys credential object. :vartype credentials: ~azure.mgmt.machinelearningservices.models.CustomKeys """ @@ -8540,14 +9208,16 @@ class CustomKeysWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'CustomKeys'}, } @@ -8555,20 +9225,22 @@ def __init__( self, *, category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, credentials: Optional["CustomKeys"] = None, **kwargs ): """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -8583,27 +9255,31 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: Custom Keys credential object. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.CustomKeys """ - super(CustomKeysWorkspaceConnectionProperties, self).__init__(category=category, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, target=target, metadata=metadata, shared_user_list=shared_user_list, value=value, value_format=value_format, **kwargs) + super(CustomKeysWorkspaceConnectionProperties, self).__init__(category=category, error=error, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, metadata=metadata, pe_requirement=pe_requirement, pe_status=pe_status, shared_user_list=shared_user_list, target=target, use_workspace_managed_identity=use_workspace_managed_identity, **kwargs) self.auth_type = 'CustomKeys' # type: str self.credentials = credentials @@ -9075,6 +9751,8 @@ class CustomService(msrest.serialization.Model): :vartype endpoints: list[~azure.mgmt.machinelearningservices.models.Endpoint] :ivar volumes: Configuring the volumes for the container. :vartype volumes: list[~azure.mgmt.machinelearningservices.models.VolumeDefinition] + :ivar kernel: Describes the jupyter kernel settings for the image if its a custom environment. + :vartype kernel: ~azure.mgmt.machinelearningservices.models.JupyterKernelConfig """ _attribute_map = { @@ -9085,6 +9763,7 @@ class CustomService(msrest.serialization.Model): 'docker': {'key': 'docker', 'type': 'Docker'}, 'endpoints': {'key': 'endpoints', 'type': '[Endpoint]'}, 'volumes': {'key': 'volumes', 'type': '[VolumeDefinition]'}, + 'kernel': {'key': 'kernel', 'type': 'JupyterKernelConfig'}, } def __init__( @@ -9097,6 +9776,7 @@ def __init__( docker: Optional["Docker"] = None, endpoints: Optional[List["Endpoint"]] = None, volumes: Optional[List["VolumeDefinition"]] = None, + kernel: Optional["JupyterKernelConfig"] = None, **kwargs ): """ @@ -9116,6 +9796,9 @@ def __init__( :paramtype endpoints: list[~azure.mgmt.machinelearningservices.models.Endpoint] :keyword volumes: Configuring the volumes for the container. :paramtype volumes: list[~azure.mgmt.machinelearningservices.models.VolumeDefinition] + :keyword kernel: Describes the jupyter kernel settings for the image if its a custom + environment. + :paramtype kernel: ~azure.mgmt.machinelearningservices.models.JupyterKernelConfig """ super(CustomService, self).__init__(**kwargs) self.additional_properties = additional_properties @@ -9125,6 +9808,7 @@ def __init__( self.docker = docker self.endpoints = endpoints self.volumes = volumes + self.kernel = kernel class CustomTargetLags(TargetLags): @@ -10600,82 +11284,91 @@ def __init__( class DiagnoseRequestProperties(msrest.serialization.Model): """DiagnoseRequestProperties. - :ivar udr: Setting for diagnosing user defined routing. - :vartype udr: dict[str, any] - :ivar nsg: Setting for diagnosing network security group. - :vartype nsg: dict[str, any] - :ivar resource_lock: Setting for diagnosing resource lock. - :vartype resource_lock: dict[str, any] + :ivar application_insights: Setting for diagnosing dependent application insights. + :vartype application_insights: dict[str, any] + :ivar container_registry: Setting for diagnosing dependent container registry. + :vartype container_registry: dict[str, any] :ivar dns_resolution: Setting for diagnosing dns resolution. :vartype dns_resolution: dict[str, any] - :ivar storage_account: Setting for diagnosing dependent storage account. - :vartype storage_account: dict[str, any] :ivar key_vault: Setting for diagnosing dependent key vault. :vartype key_vault: dict[str, any] - :ivar container_registry: Setting for diagnosing dependent container registry. - :vartype container_registry: dict[str, any] - :ivar application_insights: Setting for diagnosing dependent application insights. - :vartype application_insights: dict[str, any] + :ivar nsg: Setting for diagnosing network security group. + :vartype nsg: dict[str, any] :ivar others: Setting for diagnosing unclassified category of problems. :vartype others: dict[str, any] + :ivar required_resource_providers: Setting for diagnosing the presence of required resource + providers in the workspace. + :vartype required_resource_providers: dict[str, any] + :ivar resource_lock: Setting for diagnosing resource lock. + :vartype resource_lock: dict[str, any] + :ivar storage_account: Setting for diagnosing dependent storage account. + :vartype storage_account: dict[str, any] + :ivar udr: Setting for diagnosing user defined routing. + :vartype udr: dict[str, any] """ _attribute_map = { - 'udr': {'key': 'udr', 'type': '{object}'}, - 'nsg': {'key': 'nsg', 'type': '{object}'}, - 'resource_lock': {'key': 'resourceLock', 'type': '{object}'}, + 'application_insights': {'key': 'applicationInsights', 'type': '{object}'}, + 'container_registry': {'key': 'containerRegistry', 'type': '{object}'}, 'dns_resolution': {'key': 'dnsResolution', 'type': '{object}'}, - 'storage_account': {'key': 'storageAccount', 'type': '{object}'}, 'key_vault': {'key': 'keyVault', 'type': '{object}'}, - 'container_registry': {'key': 'containerRegistry', 'type': '{object}'}, - 'application_insights': {'key': 'applicationInsights', 'type': '{object}'}, + 'nsg': {'key': 'nsg', 'type': '{object}'}, 'others': {'key': 'others', 'type': '{object}'}, + 'required_resource_providers': {'key': 'requiredResourceProviders', 'type': '{object}'}, + 'resource_lock': {'key': 'resourceLock', 'type': '{object}'}, + 'storage_account': {'key': 'storageAccount', 'type': '{object}'}, + 'udr': {'key': 'udr', 'type': '{object}'}, } def __init__( self, *, - udr: Optional[Dict[str, Any]] = None, - nsg: Optional[Dict[str, Any]] = None, - resource_lock: Optional[Dict[str, Any]] = None, + application_insights: Optional[Dict[str, Any]] = None, + container_registry: Optional[Dict[str, Any]] = None, dns_resolution: Optional[Dict[str, Any]] = None, - storage_account: Optional[Dict[str, Any]] = None, key_vault: Optional[Dict[str, Any]] = None, - container_registry: Optional[Dict[str, Any]] = None, - application_insights: Optional[Dict[str, Any]] = None, + nsg: Optional[Dict[str, Any]] = None, others: Optional[Dict[str, Any]] = None, + required_resource_providers: Optional[Dict[str, Any]] = None, + resource_lock: Optional[Dict[str, Any]] = None, + storage_account: Optional[Dict[str, Any]] = None, + udr: Optional[Dict[str, Any]] = None, **kwargs ): """ - :keyword udr: Setting for diagnosing user defined routing. - :paramtype udr: dict[str, any] - :keyword nsg: Setting for diagnosing network security group. - :paramtype nsg: dict[str, any] - :keyword resource_lock: Setting for diagnosing resource lock. - :paramtype resource_lock: dict[str, any] + :keyword application_insights: Setting for diagnosing dependent application insights. + :paramtype application_insights: dict[str, any] + :keyword container_registry: Setting for diagnosing dependent container registry. + :paramtype container_registry: dict[str, any] :keyword dns_resolution: Setting for diagnosing dns resolution. :paramtype dns_resolution: dict[str, any] - :keyword storage_account: Setting for diagnosing dependent storage account. - :paramtype storage_account: dict[str, any] :keyword key_vault: Setting for diagnosing dependent key vault. :paramtype key_vault: dict[str, any] - :keyword container_registry: Setting for diagnosing dependent container registry. - :paramtype container_registry: dict[str, any] - :keyword application_insights: Setting for diagnosing dependent application insights. - :paramtype application_insights: dict[str, any] + :keyword nsg: Setting for diagnosing network security group. + :paramtype nsg: dict[str, any] :keyword others: Setting for diagnosing unclassified category of problems. :paramtype others: dict[str, any] + :keyword required_resource_providers: Setting for diagnosing the presence of required resource + providers in the workspace. + :paramtype required_resource_providers: dict[str, any] + :keyword resource_lock: Setting for diagnosing resource lock. + :paramtype resource_lock: dict[str, any] + :keyword storage_account: Setting for diagnosing dependent storage account. + :paramtype storage_account: dict[str, any] + :keyword udr: Setting for diagnosing user defined routing. + :paramtype udr: dict[str, any] """ super(DiagnoseRequestProperties, self).__init__(**kwargs) - self.udr = udr - self.nsg = nsg - self.resource_lock = resource_lock + self.application_insights = application_insights + self.container_registry = container_registry self.dns_resolution = dns_resolution - self.storage_account = storage_account self.key_vault = key_vault - self.container_registry = container_registry - self.application_insights = application_insights + self.nsg = nsg self.others = others + self.required_resource_providers = required_resource_providers + self.resource_lock = resource_lock + self.storage_account = storage_account + self.udr = udr class DiagnoseResponseResult(msrest.serialization.Model): @@ -10838,7 +11531,7 @@ def __init__( class DiagnoseWorkspaceParameters(msrest.serialization.Model): """Parameters to diagnose a workspace. - :ivar value: Value of Parameters. + :ivar value: :vartype value: ~azure.mgmt.machinelearningservices.models.DiagnoseRequestProperties """ @@ -10853,7 +11546,7 @@ def __init__( **kwargs ): """ - :keyword value: Value of Parameters. + :keyword value: :paramtype value: ~azure.mgmt.machinelearningservices.models.DiagnoseRequestProperties """ super(DiagnoseWorkspaceParameters, self).__init__(**kwargs) @@ -10896,7 +11589,7 @@ def __init__( class Docker(msrest.serialization.Model): - """Docker container configuration. + """Docker. :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -10974,84 +11667,34 @@ def __init__( self.user_name = user_name -class EncryptionKeyVaultProperties(msrest.serialization.Model): - """EncryptionKeyVaultProperties. +class EncryptionKeyVaultUpdateProperties(msrest.serialization.Model): + """EncryptionKeyVaultUpdateProperties. All required parameters must be populated in order to send to Azure. - :ivar key_vault_arm_id: Required. The ArmId of the keyVault where the customer owned encryption - key is present. - :vartype key_vault_arm_id: str - :ivar key_identifier: Required. Key vault uri to access the encryption key. + :ivar key_identifier: Required. :vartype key_identifier: str - :ivar identity_client_id: For future use - The client id of the identity which will be used to - access key vault. - :vartype identity_client_id: str """ _validation = { - 'key_vault_arm_id': {'required': True}, - 'key_identifier': {'required': True}, + 'key_identifier': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, } _attribute_map = { - 'key_vault_arm_id': {'key': 'keyVaultArmId', 'type': 'str'}, 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'identity_client_id': {'key': 'identityClientId', 'type': 'str'}, } def __init__( self, *, - key_vault_arm_id: str, key_identifier: str, - identity_client_id: Optional[str] = None, **kwargs ): """ - :keyword key_vault_arm_id: Required. The ArmId of the keyVault where the customer owned - encryption key is present. - :paramtype key_vault_arm_id: str - :keyword key_identifier: Required. Key vault uri to access the encryption key. + :keyword key_identifier: Required. :paramtype key_identifier: str - :keyword identity_client_id: For future use - The client id of the identity which will be used - to access key vault. - :paramtype identity_client_id: str """ - super(EncryptionKeyVaultProperties, self).__init__(**kwargs) - self.key_vault_arm_id = key_vault_arm_id - self.key_identifier = key_identifier - self.identity_client_id = identity_client_id - - -class EncryptionKeyVaultUpdateProperties(msrest.serialization.Model): - """EncryptionKeyVaultUpdateProperties. - - All required parameters must be populated in order to send to Azure. - - :ivar key_identifier: Required. - :vartype key_identifier: str - """ - - _validation = { - 'key_identifier': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, - } - - _attribute_map = { - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - } - - def __init__( - self, - *, - key_identifier: str, - **kwargs - ): - """ - :keyword key_identifier: Required. - :paramtype key_identifier: str - """ - super(EncryptionKeyVaultUpdateProperties, self).__init__(**kwargs) + super(EncryptionKeyVaultUpdateProperties, self).__init__(**kwargs) self.key_identifier = key_identifier @@ -11060,50 +11703,80 @@ class EncryptionProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. + :ivar cosmos_db_resource_id: The byok cosmosdb account that customer brings to store customer's + data + with encryption. + :vartype cosmos_db_resource_id: str + :ivar identity: Identity to be used with the keyVault. + :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityForCmk + :ivar key_vault_properties: Required. KeyVault details to do the encryption. + :vartype key_vault_properties: ~azure.mgmt.machinelearningservices.models.KeyVaultProperties + :ivar search_account_resource_id: The byok search account that customer brings to store + customer's data + with encryption. + :vartype search_account_resource_id: str :ivar status: Required. Indicates whether or not the encryption is enabled for the workspace. Possible values include: "Enabled", "Disabled". :vartype status: str or ~azure.mgmt.machinelearningservices.models.EncryptionStatus - :ivar identity: The identity that will be used to access the key vault for encryption at rest. - :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityForCmk - :ivar key_vault_properties: Required. Customer Key vault properties. - :vartype key_vault_properties: - ~azure.mgmt.machinelearningservices.models.EncryptionKeyVaultProperties + :ivar storage_account_resource_id: The byok storage account that customer brings to store + customer's data + with encryption. + :vartype storage_account_resource_id: str """ _validation = { - 'status': {'required': True}, 'key_vault_properties': {'required': True}, + 'status': {'required': True}, } _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, + 'cosmos_db_resource_id': {'key': 'cosmosDbResourceId', 'type': 'str'}, 'identity': {'key': 'identity', 'type': 'IdentityForCmk'}, - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'EncryptionKeyVaultProperties'}, + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, + 'search_account_resource_id': {'key': 'searchAccountResourceId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'storage_account_resource_id': {'key': 'storageAccountResourceId', 'type': 'str'}, } def __init__( self, *, + key_vault_properties: "KeyVaultProperties", status: Union[str, "EncryptionStatus"], - key_vault_properties: "EncryptionKeyVaultProperties", + cosmos_db_resource_id: Optional[str] = None, identity: Optional["IdentityForCmk"] = None, + search_account_resource_id: Optional[str] = None, + storage_account_resource_id: Optional[str] = None, **kwargs ): """ + :keyword cosmos_db_resource_id: The byok cosmosdb account that customer brings to store + customer's data + with encryption. + :paramtype cosmos_db_resource_id: str + :keyword identity: Identity to be used with the keyVault. + :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityForCmk + :keyword key_vault_properties: Required. KeyVault details to do the encryption. + :paramtype key_vault_properties: ~azure.mgmt.machinelearningservices.models.KeyVaultProperties + :keyword search_account_resource_id: The byok search account that customer brings to store + customer's data + with encryption. + :paramtype search_account_resource_id: str :keyword status: Required. Indicates whether or not the encryption is enabled for the workspace. Possible values include: "Enabled", "Disabled". :paramtype status: str or ~azure.mgmt.machinelearningservices.models.EncryptionStatus - :keyword identity: The identity that will be used to access the key vault for encryption at - rest. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityForCmk - :keyword key_vault_properties: Required. Customer Key vault properties. - :paramtype key_vault_properties: - ~azure.mgmt.machinelearningservices.models.EncryptionKeyVaultProperties + :keyword storage_account_resource_id: The byok storage account that customer brings to store + customer's data + with encryption. + :paramtype storage_account_resource_id: str """ super(EncryptionProperty, self).__init__(**kwargs) - self.status = status + self.cosmos_db_resource_id = cosmos_db_resource_id self.identity = identity self.key_vault_properties = key_vault_properties + self.search_account_resource_id = search_account_resource_id + self.status = status + self.storage_account_resource_id = storage_account_resource_id class EncryptionUpdateProperties(msrest.serialization.Model): @@ -11140,7 +11813,7 @@ def __init__( class Endpoint(msrest.serialization.Model): - """Describes the endpoint configuration for the container. + """Endpoint. :ivar protocol: Protocol over which communication will happen over this endpoint. Possible values include: "tcp", "udp", "http". Default value: "tcp". @@ -11272,57 +11945,54 @@ def __init__( self.token_type = token_type -class EndpointScheduleAction(ScheduleActionBase): - """EndpointScheduleAction. - - All required parameters must be populated in order to send to Azure. +class EndpointDeploymentModel(msrest.serialization.Model): + """EndpointDeploymentModel. - :ivar action_type: Required. [Required] Specifies the action type of the schedule.Constant - filled by server. Possible values include: "CreateJob", "InvokeBatchEndpoint", "CreateMonitor". - :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType - :ivar endpoint_invocation_definition: Required. [Required] Defines Schedule action definition - details. - - - .. raw:: html - - . - :vartype endpoint_invocation_definition: any + :ivar format: Model format. + :vartype format: str + :ivar name: Model name. + :vartype name: str + :ivar source: Optional. Deployment model source ARM resource ID. + :vartype source: str + :ivar version: Model version. + :vartype version: str """ - _validation = { - 'action_type': {'required': True}, - 'endpoint_invocation_definition': {'required': True}, - } - _attribute_map = { - 'action_type': {'key': 'actionType', 'type': 'str'}, - 'endpoint_invocation_definition': {'key': 'endpointInvocationDefinition', 'type': 'object'}, + 'format': {'key': 'format', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, } def __init__( self, *, - endpoint_invocation_definition: Any, + format: Optional[str] = None, + name: Optional[str] = None, + source: Optional[str] = None, + version: Optional[str] = None, **kwargs ): """ - :keyword endpoint_invocation_definition: Required. [Required] Defines Schedule action - definition details. - - - .. raw:: html - - . - :paramtype endpoint_invocation_definition: any + :keyword format: Model format. + :paramtype format: str + :keyword name: Model name. + :paramtype name: str + :keyword source: Optional. Deployment model source ARM resource ID. + :paramtype source: str + :keyword version: Model version. + :paramtype version: str """ - super(EndpointScheduleAction, self).__init__(**kwargs) - self.action_type = 'InvokeBatchEndpoint' # type: str - self.endpoint_invocation_definition = endpoint_invocation_definition + super(EndpointDeploymentModel, self).__init__(**kwargs) + self.format = format + self.name = name + self.source = source + self.version = version -class EnvironmentContainer(ProxyResource): - """Azure Resource Manager resource envelope. +class EndpointDeploymentResourcePropertiesBasicResource(Resource): + """EndpointDeploymentResourcePropertiesBasicResource. Variables are only populated by the server, and will be ignored when sending a request. @@ -11339,8 +12009,9 @@ class EnvironmentContainer(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties + :ivar properties: Required. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourceProperties """ _validation = { @@ -11356,639 +12027,626 @@ class EnvironmentContainer(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'EnvironmentContainerProperties'}, + 'properties': {'key': 'properties', 'type': 'EndpointDeploymentResourceProperties'}, } def __init__( self, *, - properties: "EnvironmentContainerProperties", + properties: "EndpointDeploymentResourceProperties", **kwargs ): """ - :keyword properties: Required. [Required] Additional attributes of the entity. + :keyword properties: Required. :paramtype properties: - ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourceProperties """ - super(EnvironmentContainer, self).__init__(**kwargs) + super(EndpointDeploymentResourcePropertiesBasicResource, self).__init__(**kwargs) self.properties = properties -class EnvironmentContainerProperties(AssetContainer): - """Container for environment specification versions. - - Variables are only populated by the server, and will be ignored when sending a request. +class EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult(msrest.serialization.Model): + """EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult. - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar latest_version: The latest version inside this container. - :vartype latest_version: str - :ivar next_version: The next auto incremental version. - :vartype next_version: str - :ivar provisioning_state: Provisioning state for the environment container. Possible values - include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] """ - _validation = { - 'latest_version': {'readonly': True}, - 'next_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'latest_version': {'key': 'latestVersion', 'type': 'str'}, - 'next_version': {'key': 'nextVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, } def __init__( self, *, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_archived: Optional[bool] = False, + next_link: Optional[str] = None, + value: Optional[List["EndpointDeploymentResourcePropertiesBasicResource"]] = None, **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] """ - super(EnvironmentContainerProperties, self).__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) - self.provisioning_state = None + super(EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value -class EnvironmentContainerResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of EnvironmentContainer entities. +class EndpointKeys(msrest.serialization.Model): + """EndpointKeys. - :ivar next_link: The link to the next page of EnvironmentContainer objects. If null, there are - no additional pages. - :vartype next_link: str - :ivar value: An array of objects of type EnvironmentContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :ivar keys: Dictionary of Keys for the endpoint. + :vartype keys: ~azure.mgmt.machinelearningservices.models.AccountApiKeys """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[EnvironmentContainer]'}, + 'keys': {'key': 'keys', 'type': 'AccountApiKeys'}, } def __init__( self, *, - next_link: Optional[str] = None, - value: Optional[List["EnvironmentContainer"]] = None, + keys: Optional["AccountApiKeys"] = None, **kwargs ): """ - :keyword next_link: The link to the next page of EnvironmentContainer objects. If null, there - are no additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type EnvironmentContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :keyword keys: Dictionary of Keys for the endpoint. + :paramtype keys: ~azure.mgmt.machinelearningservices.models.AccountApiKeys """ - super(EnvironmentContainerResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = next_link - self.value = value + super(EndpointKeys, self).__init__(**kwargs) + self.keys = keys -class EnvironmentVariable(msrest.serialization.Model): - """Environment Variables for the container. +class EndpointModelDeprecationProperties(msrest.serialization.Model): + """EndpointModelDeprecationProperties. - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, any] - :ivar type: Type of the Environment Variable. Possible values are: local - For local variable. - Possible values include: "local". Default value: "local". - :vartype type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentVariableType - :ivar value: Value of the Environment variable. - :vartype value: str + :ivar fine_tune: The datetime of deprecation of the fineTune Model. + :vartype fine_tune: ~datetime.datetime + :ivar inference: The datetime of deprecation of the inference Model. + :vartype inference: ~datetime.datetime """ _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, + 'fine_tune': {'key': 'fineTune', 'type': 'iso-8601'}, + 'inference': {'key': 'inference', 'type': 'iso-8601'}, } def __init__( self, *, - additional_properties: Optional[Dict[str, Any]] = None, - type: Optional[Union[str, "EnvironmentVariableType"]] = "local", - value: Optional[str] = None, + fine_tune: Optional[datetime.datetime] = None, + inference: Optional[datetime.datetime] = None, **kwargs ): """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, any] - :keyword type: Type of the Environment Variable. Possible values are: local - For local - variable. Possible values include: "local". Default value: "local". - :paramtype type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentVariableType - :keyword value: Value of the Environment variable. - :paramtype value: str + :keyword fine_tune: The datetime of deprecation of the fineTune Model. + :paramtype fine_tune: ~datetime.datetime + :keyword inference: The datetime of deprecation of the inference Model. + :paramtype inference: ~datetime.datetime """ - super(EnvironmentVariable, self).__init__(**kwargs) - self.additional_properties = additional_properties - self.type = type - self.value = value + super(EndpointModelDeprecationProperties, self).__init__(**kwargs) + self.fine_tune = fine_tune + self.inference = inference -class EnvironmentVersion(ProxyResource): - """Azure Resource Manager resource envelope. +class EndpointModelProperties(msrest.serialization.Model): + """Endpoint Model properties. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. + :ivar capabilities: The capabilities. + :vartype capabilities: dict[str, str] + :ivar deprecation: + :vartype deprecation: + ~azure.mgmt.machinelearningservices.models.EndpointModelDeprecationProperties + :ivar finetune_capabilities: The capabilities for finetune models. + :vartype finetune_capabilities: dict[str, str] + :ivar format: Deployment model format. + :vartype format: str + :ivar is_default_version: If the model is default version. + :vartype is_default_version: bool + :ivar lifecycle_status: Model lifecycle status. Possible values include: "GenerallyAvailable", + "Preview". + :vartype lifecycle_status: str or + ~azure.mgmt.machinelearningservices.models.ModelLifecycleStatus + :ivar max_capacity: The max capacity. + :vartype max_capacity: int + :ivar name: Deployment model name. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. + :ivar skus: The list of Model Sku. + :vartype skus: list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuProperties] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentVersionProperties + :ivar version: Optional. Deployment model version. If version is not specified, a default + version will be assigned. The default version is different for different models and might + change when there is new version available for a model. Default version for a model could be + found from list models API. + :vartype version: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, 'system_data': {'readonly': True}, - 'properties': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + 'capabilities': {'key': 'capabilities', 'type': '{str}'}, + 'deprecation': {'key': 'deprecation', 'type': 'EndpointModelDeprecationProperties'}, + 'finetune_capabilities': {'key': 'finetuneCapabilities', 'type': '{str}'}, + 'format': {'key': 'format', 'type': 'str'}, + 'is_default_version': {'key': 'isDefaultVersion', 'type': 'bool'}, + 'lifecycle_status': {'key': 'lifecycleStatus', 'type': 'str'}, + 'max_capacity': {'key': 'maxCapacity', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'skus': {'key': 'skus', 'type': '[EndpointModelSkuProperties]'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'EnvironmentVersionProperties'}, + 'version': {'key': 'version', 'type': 'str'}, } def __init__( self, *, - properties: "EnvironmentVersionProperties", + capabilities: Optional[Dict[str, str]] = None, + deprecation: Optional["EndpointModelDeprecationProperties"] = None, + finetune_capabilities: Optional[Dict[str, str]] = None, + format: Optional[str] = None, + is_default_version: Optional[bool] = None, + lifecycle_status: Optional[Union[str, "ModelLifecycleStatus"]] = None, + max_capacity: Optional[int] = None, + name: Optional[str] = None, + skus: Optional[List["EndpointModelSkuProperties"]] = None, + version: Optional[str] = None, **kwargs ): """ - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentVersionProperties + :keyword capabilities: The capabilities. + :paramtype capabilities: dict[str, str] + :keyword deprecation: + :paramtype deprecation: + ~azure.mgmt.machinelearningservices.models.EndpointModelDeprecationProperties + :keyword finetune_capabilities: The capabilities for finetune models. + :paramtype finetune_capabilities: dict[str, str] + :keyword format: Deployment model format. + :paramtype format: str + :keyword is_default_version: If the model is default version. + :paramtype is_default_version: bool + :keyword lifecycle_status: Model lifecycle status. Possible values include: + "GenerallyAvailable", "Preview". + :paramtype lifecycle_status: str or + ~azure.mgmt.machinelearningservices.models.ModelLifecycleStatus + :keyword max_capacity: The max capacity. + :paramtype max_capacity: int + :keyword name: Deployment model name. + :paramtype name: str + :keyword skus: The list of Model Sku. + :paramtype skus: list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuProperties] + :keyword version: Optional. Deployment model version. If version is not specified, a default + version will be assigned. The default version is different for different models and might + change when there is new version available for a model. Default version for a model could be + found from list models API. + :paramtype version: str """ - super(EnvironmentVersion, self).__init__(**kwargs) - self.properties = properties + super(EndpointModelProperties, self).__init__(**kwargs) + self.capabilities = capabilities + self.deprecation = deprecation + self.finetune_capabilities = finetune_capabilities + self.format = format + self.is_default_version = is_default_version + self.lifecycle_status = lifecycle_status + self.max_capacity = max_capacity + self.name = name + self.skus = skus + self.system_data = None + self.version = version -class EnvironmentVersionProperties(AssetBase): - """Environment version details. +class EndpointModels(msrest.serialization.Model): + """EndpointModels. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar auto_rebuild: Defines if image needs to be rebuilt based on base image changes. Possible - values include: "Disabled", "OnBaseImageUpdate". - :vartype auto_rebuild: str or ~azure.mgmt.machinelearningservices.models.AutoRebuildSetting - :ivar build: Configuration settings for Docker build context. - :vartype build: ~azure.mgmt.machinelearningservices.models.BuildContext - :ivar conda_file: Standard configuration file used by Conda that lets you install any kind of - package, including Python, R, and C/C++ packages. - - - .. raw:: html - - . - :vartype conda_file: str - :ivar environment_type: Environment type is either user managed or curated by the Azure ML - service - - - .. raw:: html - - . Possible values include: "Curated", "UserCreated". - :vartype environment_type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentType - :ivar image: Name of the image that will be used for the environment. - - - .. raw:: html - - . - :vartype image: str - :ivar inference_config: Defines configuration specific to inference. - :vartype inference_config: - ~azure.mgmt.machinelearningservices.models.InferenceContainerProperties - :ivar os_type: The OS type of the environment. Possible values include: "Linux", "Windows". - :vartype os_type: str or ~azure.mgmt.machinelearningservices.models.OperatingSystemType - :ivar provisioning_state: Provisioning state for the environment version. Possible values - include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState - :ivar stage: Stage in the environment lifecycle assigned to this environment. - :vartype stage: str - """ - - _validation = { - 'environment_type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } + :ivar next_link: The link to the next page constructed using the continuationToken. If null, + there are no additional pages. + :vartype next_link: str + :ivar value: List of models. + :vartype value: list[~azure.mgmt.machinelearningservices.models.EndpointModelProperties] + """ _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'auto_rebuild': {'key': 'autoRebuild', 'type': 'str'}, - 'build': {'key': 'build', 'type': 'BuildContext'}, - 'conda_file': {'key': 'condaFile', 'type': 'str'}, - 'environment_type': {'key': 'environmentType', 'type': 'str'}, - 'image': {'key': 'image', 'type': 'str'}, - 'inference_config': {'key': 'inferenceConfig', 'type': 'InferenceContainerProperties'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'stage': {'key': 'stage', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EndpointModelProperties]'}, } def __init__( self, *, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_anonymous: Optional[bool] = False, - is_archived: Optional[bool] = False, - auto_rebuild: Optional[Union[str, "AutoRebuildSetting"]] = None, - build: Optional["BuildContext"] = None, - conda_file: Optional[str] = None, - image: Optional[str] = None, - inference_config: Optional["InferenceContainerProperties"] = None, - os_type: Optional[Union[str, "OperatingSystemType"]] = None, - stage: Optional[str] = None, + next_link: Optional[str] = None, + value: Optional[List["EndpointModelProperties"]] = None, **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword auto_rebuild: Defines if image needs to be rebuilt based on base image changes. - Possible values include: "Disabled", "OnBaseImageUpdate". - :paramtype auto_rebuild: str or ~azure.mgmt.machinelearningservices.models.AutoRebuildSetting - :keyword build: Configuration settings for Docker build context. - :paramtype build: ~azure.mgmt.machinelearningservices.models.BuildContext - :keyword conda_file: Standard configuration file used by Conda that lets you install any kind - of package, including Python, R, and C/C++ packages. - - - .. raw:: html - - . - :paramtype conda_file: str - :keyword image: Name of the image that will be used for the environment. - - - .. raw:: html - - . - :paramtype image: str - :keyword inference_config: Defines configuration specific to inference. - :paramtype inference_config: - ~azure.mgmt.machinelearningservices.models.InferenceContainerProperties - :keyword os_type: The OS type of the environment. Possible values include: "Linux", "Windows". - :paramtype os_type: str or ~azure.mgmt.machinelearningservices.models.OperatingSystemType - :keyword stage: Stage in the environment lifecycle assigned to this environment. - :paramtype stage: str + :keyword next_link: The link to the next page constructed using the continuationToken. If + null, there are no additional pages. + :paramtype next_link: str + :keyword value: List of models. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.EndpointModelProperties] """ - super(EnvironmentVersionProperties, self).__init__(description=description, properties=properties, tags=tags, is_anonymous=is_anonymous, is_archived=is_archived, **kwargs) - self.auto_rebuild = auto_rebuild - self.build = build - self.conda_file = conda_file - self.environment_type = None - self.image = image - self.inference_config = inference_config - self.os_type = os_type - self.provisioning_state = None - self.stage = stage + super(EndpointModels, self).__init__(**kwargs) + self.next_link = next_link + self.value = value -class EnvironmentVersionResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of EnvironmentVersion entities. +class EndpointModelSkuCapacityProperties(msrest.serialization.Model): + """EndpointModelSkuCapacityProperties. - :ivar next_link: The link to the next page of EnvironmentVersion objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type EnvironmentVersion. - :vartype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :ivar default: The default capacity. + :vartype default: int + :ivar maximum: The maximum capacity. + :vartype maximum: int """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[EnvironmentVersion]'}, + 'default': {'key': 'default', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, } def __init__( self, *, - next_link: Optional[str] = None, - value: Optional[List["EnvironmentVersion"]] = None, + default: Optional[int] = None, + maximum: Optional[int] = None, **kwargs ): """ - :keyword next_link: The link to the next page of EnvironmentVersion objects. If null, there are - no additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type EnvironmentVersion. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :keyword default: The default capacity. + :paramtype default: int + :keyword maximum: The maximum capacity. + :paramtype maximum: int """ - super(EnvironmentVersionResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = next_link - self.value = value - + super(EndpointModelSkuCapacityProperties, self).__init__(**kwargs) + self.default = default + self.maximum = maximum -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - Variables are only populated by the server, and will be ignored when sending a request. +class EndpointModelSkuProperties(msrest.serialization.Model): + """EndpointModelSkuProperties. - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any + :ivar capacity: + :vartype capacity: + ~azure.mgmt.machinelearningservices.models.EndpointModelSkuCapacityProperties + :ivar connection_ids: The list of ARM id for the connection support this SKU. + :vartype connection_ids: list[str] + :ivar deprecation_date: The datetime of deprecation of the model SKU. + :vartype deprecation_date: ~datetime.datetime + :ivar name: The name of the model SKU. + :vartype name: str + :ivar rate_limits: + :vartype rate_limits: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitProperties] + :ivar usage_name: The usage name of the model SKU. + :vartype usage_name: str """ - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + 'capacity': {'key': 'capacity', 'type': 'EndpointModelSkuCapacityProperties'}, + 'connection_ids': {'key': 'connectionIds', 'type': '[str]'}, + 'deprecation_date': {'key': 'deprecationDate', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'rate_limits': {'key': 'rateLimits', 'type': '[EndpointModelSkuRateLimitProperties]'}, + 'usage_name': {'key': 'usageName', 'type': 'str'}, } def __init__( self, + *, + capacity: Optional["EndpointModelSkuCapacityProperties"] = None, + connection_ids: Optional[List[str]] = None, + deprecation_date: Optional[datetime.datetime] = None, + name: Optional[str] = None, + rate_limits: Optional[List["EndpointModelSkuRateLimitProperties"]] = None, + usage_name: Optional[str] = None, **kwargs ): """ + :keyword capacity: + :paramtype capacity: + ~azure.mgmt.machinelearningservices.models.EndpointModelSkuCapacityProperties + :keyword connection_ids: The list of ARM id for the connection support this SKU. + :paramtype connection_ids: list[str] + :keyword deprecation_date: The datetime of deprecation of the model SKU. + :paramtype deprecation_date: ~datetime.datetime + :keyword name: The name of the model SKU. + :paramtype name: str + :keyword rate_limits: + :paramtype rate_limits: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitProperties] + :keyword usage_name: The usage name of the model SKU. + :paramtype usage_name: str """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - + super(EndpointModelSkuProperties, self).__init__(**kwargs) + self.capacity = capacity + self.connection_ids = connection_ids + self.deprecation_date = deprecation_date + self.name = name + self.rate_limits = rate_limits + self.usage_name = usage_name -class ErrorDetail(msrest.serialization.Model): - """The error detail. - Variables are only populated by the server, and will be ignored when sending a request. +class EndpointModelSkuRateLimitProperties(msrest.serialization.Model): + """EndpointModelSkuRateLimitProperties. - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.machinelearningservices.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.machinelearningservices.models.ErrorAdditionalInfo] + :ivar count: The count value of Call Rate Limit. + :vartype count: float + :ivar renewal_period: The renewal period in seconds of Call Rate Limit. + :vartype renewal_period: float + :ivar rules: The call rate limit for the model. + :vartype rules: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitRuleProperties] """ - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + 'count': {'key': 'count', 'type': 'float'}, + 'renewal_period': {'key': 'renewalPeriod', 'type': 'float'}, + 'rules': {'key': 'rules', 'type': '[EndpointModelSkuRateLimitRuleProperties]'}, } def __init__( self, + *, + count: Optional[float] = None, + renewal_period: Optional[float] = None, + rules: Optional[List["EndpointModelSkuRateLimitRuleProperties"]] = None, **kwargs ): """ + :keyword count: The count value of Call Rate Limit. + :paramtype count: float + :keyword renewal_period: The renewal period in seconds of Call Rate Limit. + :paramtype renewal_period: float + :keyword rules: The call rate limit for the model. + :paramtype rules: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitRuleProperties] """ - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + super(EndpointModelSkuRateLimitProperties, self).__init__(**kwargs) + self.count = count + self.renewal_period = renewal_period + self.rules = rules -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). +class EndpointModelSkuRateLimitRulePatternProperties(msrest.serialization.Model): + """EndpointModelSkuRateLimitRulePatternProperties. - :ivar error: The error object. - :vartype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail + :ivar method: + :vartype method: str + :ivar path: + :vartype path: str """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, + 'method': {'key': 'method', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, } def __init__( self, *, - error: Optional["ErrorDetail"] = None, + method: Optional[str] = None, + path: Optional[str] = None, **kwargs ): """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail + :keyword method: + :paramtype method: str + :keyword path: + :paramtype path: str """ - super(ErrorResponse, self).__init__(**kwargs) - self.error = error + super(EndpointModelSkuRateLimitRulePatternProperties, self).__init__(**kwargs) + self.method = method + self.path = path -class EstimatedVMPrice(msrest.serialization.Model): - """The estimated price info for using a VM of a particular OS type, tier, etc. +class EndpointModelSkuRateLimitRuleProperties(msrest.serialization.Model): + """EndpointModelSkuRateLimitRuleProperties. - All required parameters must be populated in order to send to Azure. - - :ivar retail_price: Required. The price charged for using the VM. - :vartype retail_price: float - :ivar os_type: Required. Operating system type used by the VM. Possible values include: - "Linux", "Windows". - :vartype os_type: str or ~azure.mgmt.machinelearningservices.models.VMPriceOSType - :ivar vm_tier: Required. The type of the VM. Possible values include: "Standard", - "LowPriority", "Spot". - :vartype vm_tier: str or ~azure.mgmt.machinelearningservices.models.VMTier - """ - - _validation = { - 'retail_price': {'required': True}, - 'os_type': {'required': True}, - 'vm_tier': {'required': True}, - } + :ivar count: + :vartype count: float + :ivar dynamic_throttling_enabled: If the dynamic throttling is enabled. + :vartype dynamic_throttling_enabled: bool + :ivar key: + :vartype key: str + :ivar match_patterns: + :vartype match_patterns: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitRulePatternProperties] + :ivar min_count: + :vartype min_count: float + :ivar renewal_period: + :vartype renewal_period: float + """ _attribute_map = { - 'retail_price': {'key': 'retailPrice', 'type': 'float'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'vm_tier': {'key': 'vmTier', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'float'}, + 'dynamic_throttling_enabled': {'key': 'dynamicThrottlingEnabled', 'type': 'bool'}, + 'key': {'key': 'key', 'type': 'str'}, + 'match_patterns': {'key': 'matchPatterns', 'type': '[EndpointModelSkuRateLimitRulePatternProperties]'}, + 'min_count': {'key': 'minCount', 'type': 'float'}, + 'renewal_period': {'key': 'renewalPeriod', 'type': 'float'}, } def __init__( self, *, - retail_price: float, - os_type: Union[str, "VMPriceOSType"], - vm_tier: Union[str, "VMTier"], + count: Optional[float] = None, + dynamic_throttling_enabled: Optional[bool] = None, + key: Optional[str] = None, + match_patterns: Optional[List["EndpointModelSkuRateLimitRulePatternProperties"]] = None, + min_count: Optional[float] = None, + renewal_period: Optional[float] = None, **kwargs ): """ - :keyword retail_price: Required. The price charged for using the VM. - :paramtype retail_price: float - :keyword os_type: Required. Operating system type used by the VM. Possible values include: - "Linux", "Windows". - :paramtype os_type: str or ~azure.mgmt.machinelearningservices.models.VMPriceOSType - :keyword vm_tier: Required. The type of the VM. Possible values include: "Standard", - "LowPriority", "Spot". - :paramtype vm_tier: str or ~azure.mgmt.machinelearningservices.models.VMTier - """ - super(EstimatedVMPrice, self).__init__(**kwargs) - self.retail_price = retail_price - self.os_type = os_type - self.vm_tier = vm_tier + :keyword count: + :paramtype count: float + :keyword dynamic_throttling_enabled: If the dynamic throttling is enabled. + :paramtype dynamic_throttling_enabled: bool + :keyword key: + :paramtype key: str + :keyword match_patterns: + :paramtype match_patterns: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitRulePatternProperties] + :keyword min_count: + :paramtype min_count: float + :keyword renewal_period: + :paramtype renewal_period: float + """ + super(EndpointModelSkuRateLimitRuleProperties, self).__init__(**kwargs) + self.count = count + self.dynamic_throttling_enabled = dynamic_throttling_enabled + self.key = key + self.match_patterns = match_patterns + self.min_count = min_count + self.renewal_period = renewal_period -class EstimatedVMPrices(msrest.serialization.Model): - """The estimated price info for using a VM. +class EndpointResourcePropertiesBasicResource(Resource): + """EndpointResourcePropertiesBasicResource. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar billing_currency: Required. Three lettered code specifying the currency of the VM price. - Example: USD. Possible values include: "USD". - :vartype billing_currency: str or ~azure.mgmt.machinelearningservices.models.BillingCurrency - :ivar unit_of_measure: Required. The unit of time measurement for the specified VM price. - Example: OneHour. Possible values include: "OneHour". - :vartype unit_of_measure: str or ~azure.mgmt.machinelearningservices.models.UnitOfMeasure - :ivar values: Required. The list of estimated prices for using a VM of a particular OS type, - tier, etc. - :vartype values: list[~azure.mgmt.machinelearningservices.models.EstimatedVMPrice] + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.EndpointResourceProperties """ _validation = { - 'billing_currency': {'required': True}, - 'unit_of_measure': {'required': True}, - 'values': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, } _attribute_map = { - 'billing_currency': {'key': 'billingCurrency', 'type': 'str'}, - 'unit_of_measure': {'key': 'unitOfMeasure', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[EstimatedVMPrice]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'EndpointResourceProperties'}, } def __init__( self, *, - billing_currency: Union[str, "BillingCurrency"], - unit_of_measure: Union[str, "UnitOfMeasure"], - values: List["EstimatedVMPrice"], + properties: "EndpointResourceProperties", **kwargs ): """ - :keyword billing_currency: Required. Three lettered code specifying the currency of the VM - price. Example: USD. Possible values include: "USD". - :paramtype billing_currency: str or ~azure.mgmt.machinelearningservices.models.BillingCurrency - :keyword unit_of_measure: Required. The unit of time measurement for the specified VM price. - Example: OneHour. Possible values include: "OneHour". - :paramtype unit_of_measure: str or ~azure.mgmt.machinelearningservices.models.UnitOfMeasure - :keyword values: Required. The list of estimated prices for using a VM of a particular OS type, - tier, etc. - :paramtype values: list[~azure.mgmt.machinelearningservices.models.EstimatedVMPrice] + :keyword properties: Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.EndpointResourceProperties """ - super(EstimatedVMPrices, self).__init__(**kwargs) - self.billing_currency = billing_currency - self.unit_of_measure = unit_of_measure - self.values = values + super(EndpointResourcePropertiesBasicResource, self).__init__(**kwargs) + self.properties = properties -class ExternalFQDNResponse(msrest.serialization.Model): - """ExternalFQDNResponse. +class EndpointResourcePropertiesBasicResourceArmPaginatedResult(msrest.serialization.Model): + """EndpointResourcePropertiesBasicResourceArmPaginatedResult. + :ivar next_link: + :vartype next_link: str :ivar value: - :vartype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoints] + :vartype value: + list[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[FQDNEndpoints]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EndpointResourcePropertiesBasicResource]'}, } def __init__( self, *, - value: Optional[List["FQDNEndpoints"]] = None, + next_link: Optional[str] = None, + value: Optional[List["EndpointResourcePropertiesBasicResource"]] = None, **kwargs ): """ + :keyword next_link: + :paramtype next_link: str :keyword value: - :paramtype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoints] + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] """ - super(ExternalFQDNResponse, self).__init__(**kwargs) + super(EndpointResourcePropertiesBasicResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link self.value = value -class Feature(ProxyResource): +class EndpointScheduleAction(ScheduleActionBase): + """EndpointScheduleAction. + + All required parameters must be populated in order to send to Azure. + + :ivar action_type: Required. [Required] Specifies the action type of the schedule.Constant + filled by server. Possible values include: "CreateJob", "InvokeBatchEndpoint", "CreateMonitor". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType + :ivar endpoint_invocation_definition: Required. [Required] Defines Schedule action definition + details. + + + .. raw:: html + + . + :vartype endpoint_invocation_definition: any + """ + + _validation = { + 'action_type': {'required': True}, + 'endpoint_invocation_definition': {'required': True}, + } + + _attribute_map = { + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'endpoint_invocation_definition': {'key': 'endpointInvocationDefinition', 'type': 'object'}, + } + + def __init__( + self, + *, + endpoint_invocation_definition: Any, + **kwargs + ): + """ + :keyword endpoint_invocation_definition: Required. [Required] Defines Schedule action + definition details. + + + .. raw:: html + + . + :paramtype endpoint_invocation_definition: any + """ + super(EndpointScheduleAction, self).__init__(**kwargs) + self.action_type = 'InvokeBatchEndpoint' # type: str + self.endpoint_invocation_definition = endpoint_invocation_definition + + +class EnvironmentContainer(ProxyResource): """Azure Resource Manager resource envelope. Variables are only populated by the server, and will be ignored when sending a request. @@ -12007,7 +12665,7 @@ class Feature(ProxyResource): information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.FeatureProperties + :vartype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties """ _validation = { @@ -12023,283 +12681,164 @@ class Feature(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'FeatureProperties'}, + 'properties': {'key': 'properties', 'type': 'EnvironmentContainerProperties'}, } def __init__( self, *, - properties: "FeatureProperties", + properties: "EnvironmentContainerProperties", **kwargs ): """ :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeatureProperties + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties """ - super(Feature, self).__init__(**kwargs) + super(EnvironmentContainer, self).__init__(**kwargs) self.properties = properties -class FeatureAttributionDriftMonitoringSignal(MonitoringSignalBase): - """FeatureAttributionDriftMonitoringSignal. +class EnvironmentContainerProperties(AssetContainer): + """Container for environment specification versions. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar notification_types: The current notification mode for this signal. - :vartype notification_types: list[str or - ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] - :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. :vartype properties: dict[str, str] - :ivar signal_type: Required. [Required] Specifies the type of signal to monitor.Constant filled - by server. Possible values include: "DataDrift", "PredictionDrift", "DataQuality", - "FeatureAttributionDrift", "Custom". - :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType - :ivar feature_data_type_override: A dictionary that maps feature names to their respective data - types. - :vartype feature_data_type_override: dict[str, str or - ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] - :ivar feature_importance_settings: Required. [Required] The settings for computing feature - importance. - :vartype feature_importance_settings: - ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings - :ivar metric_threshold: Required. [Required] A list of metrics to calculate and their - associated thresholds. - :vartype metric_threshold: - ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetricThreshold - :ivar production_data: Required. [Required] The data which drift will be calculated for. - :vartype production_data: - list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] - :ivar reference_data: Required. [Required] The data to calculate drift against. - :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar latest_version: The latest version inside this container. + :vartype latest_version: str + :ivar next_version: The next auto incremental version. + :vartype next_version: str + :ivar provisioning_state: Provisioning state for the environment container. Possible values + include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ _validation = { - 'signal_type': {'required': True}, - 'feature_importance_settings': {'required': True}, - 'metric_threshold': {'required': True}, - 'production_data': {'required': True}, - 'reference_data': {'required': True}, + 'latest_version': {'readonly': True}, + 'next_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'notification_types': {'key': 'notificationTypes', 'type': '[str]'}, + 'description': {'key': 'description', 'type': 'str'}, 'properties': {'key': 'properties', 'type': '{str}'}, - 'signal_type': {'key': 'signalType', 'type': 'str'}, - 'feature_data_type_override': {'key': 'featureDataTypeOverride', 'type': '{str}'}, - 'feature_importance_settings': {'key': 'featureImportanceSettings', 'type': 'FeatureImportanceSettings'}, - 'metric_threshold': {'key': 'metricThreshold', 'type': 'FeatureAttributionMetricThreshold'}, - 'production_data': {'key': 'productionData', 'type': '[MonitoringInputDataBase]'}, - 'reference_data': {'key': 'referenceData', 'type': 'MonitoringInputDataBase'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'latest_version': {'key': 'latestVersion', 'type': 'str'}, + 'next_version': {'key': 'nextVersion', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } def __init__( self, *, - feature_importance_settings: "FeatureImportanceSettings", - metric_threshold: "FeatureAttributionMetricThreshold", - production_data: List["MonitoringInputDataBase"], - reference_data: "MonitoringInputDataBase", - notification_types: Optional[List[Union[str, "MonitoringNotificationType"]]] = None, + description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, - feature_data_type_override: Optional[Dict[str, Union[str, "MonitoringFeatureDataType"]]] = None, + tags: Optional[Dict[str, str]] = None, + is_archived: Optional[bool] = False, **kwargs ): """ - :keyword notification_types: The current notification mode for this signal. - :paramtype notification_types: list[str or - ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. :paramtype properties: dict[str, str] - :keyword feature_data_type_override: A dictionary that maps feature names to their respective - data types. - :paramtype feature_data_type_override: dict[str, str or - ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] - :keyword feature_importance_settings: Required. [Required] The settings for computing feature - importance. - :paramtype feature_importance_settings: - ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings - :keyword metric_threshold: Required. [Required] A list of metrics to calculate and their - associated thresholds. - :paramtype metric_threshold: - ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetricThreshold - :keyword production_data: Required. [Required] The data which drift will be calculated for. - :paramtype production_data: - list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] - :keyword reference_data: Required. [Required] The data to calculate drift against. - :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase - """ - super(FeatureAttributionDriftMonitoringSignal, self).__init__(notification_types=notification_types, properties=properties, **kwargs) - self.signal_type = 'FeatureAttributionDrift' # type: str - self.feature_data_type_override = feature_data_type_override - self.feature_importance_settings = feature_importance_settings - self.metric_threshold = metric_threshold - self.production_data = production_data - self.reference_data = reference_data - - -class FeatureAttributionMetricThreshold(msrest.serialization.Model): - """FeatureAttributionMetricThreshold. - - All required parameters must be populated in order to send to Azure. - - :ivar metric: Required. [Required] The feature attribution metric to calculate. Possible values - include: "NormalizedDiscountedCumulativeGain". - :vartype metric: str or ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetric - :ivar threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - """ - - _validation = { - 'metric': {'required': True}, - } - - _attribute_map = { - 'metric': {'key': 'metric', 'type': 'str'}, - 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, - } - - def __init__( - self, - *, - metric: Union[str, "FeatureAttributionMetric"], - threshold: Optional["MonitoringThreshold"] = None, - **kwargs - ): - """ - :keyword metric: Required. [Required] The feature attribution metric to calculate. Possible - values include: "NormalizedDiscountedCumulativeGain". - :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetric - :keyword threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - """ - super(FeatureAttributionMetricThreshold, self).__init__(**kwargs) - self.metric = metric - self.threshold = threshold - - -class FeatureImportanceSettings(msrest.serialization.Model): - """FeatureImportanceSettings. - - :ivar mode: The mode of operation for computing feature importance. Possible values include: - "Disabled", "Enabled". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.FeatureImportanceMode - :ivar target_column: The name of the target column within the input data asset. - :vartype target_column: str - """ - - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'target_column': {'key': 'targetColumn', 'type': 'str'}, - } - - def __init__( - self, - *, - mode: Optional[Union[str, "FeatureImportanceMode"]] = None, - target_column: Optional[str] = None, - **kwargs - ): - """ - :keyword mode: The mode of operation for computing feature importance. Possible values include: - "Disabled", "Enabled". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.FeatureImportanceMode - :keyword target_column: The name of the target column within the input data asset. - :paramtype target_column: str + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool """ - super(FeatureImportanceSettings, self).__init__(**kwargs) - self.mode = mode - self.target_column = target_column + super(EnvironmentContainerProperties, self).__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) + self.provisioning_state = None -class FeatureProperties(ResourceBase): - """DTO object representing feature. +class EnvironmentContainerResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of EnvironmentContainer entities. - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar data_type: Specifies type. Possible values include: "String", "Integer", "Long", "Float", - "Double", "Binary", "Datetime", "Boolean". - :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType - :ivar feature_name: Specifies name. - :vartype feature_name: str + :ivar next_link: The link to the next page of EnvironmentContainer objects. If null, there are + no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type EnvironmentContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] """ _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'feature_name': {'key': 'featureName', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[EnvironmentContainer]'}, } def __init__( self, *, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - data_type: Optional[Union[str, "FeatureDataType"]] = None, - feature_name: Optional[str] = None, + next_link: Optional[str] = None, + value: Optional[List["EnvironmentContainer"]] = None, **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword data_type: Specifies type. Possible values include: "String", "Integer", "Long", - "Float", "Double", "Binary", "Datetime", "Boolean". - :paramtype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType - :keyword feature_name: Specifies name. - :paramtype feature_name: str + :keyword next_link: The link to the next page of EnvironmentContainer objects. If null, there + are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type EnvironmentContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] """ - super(FeatureProperties, self).__init__(description=description, properties=properties, tags=tags, **kwargs) - self.data_type = data_type - self.feature_name = feature_name + super(EnvironmentContainerResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value -class FeatureResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of Feature entities. +class EnvironmentVariable(msrest.serialization.Model): + """EnvironmentVariable. - :ivar next_link: The link to the next page of Feature objects. If null, there are no additional - pages. - :vartype next_link: str - :ivar value: An array of objects of type Feature. - :vartype value: list[~azure.mgmt.machinelearningservices.models.Feature] + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar type: Type of the Environment Variable. Possible values are: local - For local variable. + Possible values include: "local". Default value: "local". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentVariableType + :ivar value: Value of the Environment variable. + :vartype value: str """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Feature]'}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, } def __init__( self, *, - next_link: Optional[str] = None, - value: Optional[List["Feature"]] = None, + additional_properties: Optional[Dict[str, Any]] = None, + type: Optional[Union[str, "EnvironmentVariableType"]] = "local", + value: Optional[str] = None, **kwargs ): """ - :keyword next_link: The link to the next page of Feature objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type Feature. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.Feature] + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword type: Type of the Environment Variable. Possible values are: local - For local + variable. Possible values include: "local". Default value: "local". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentVariableType + :keyword value: Value of the Environment variable. + :paramtype value: str """ - super(FeatureResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = next_link + super(EnvironmentVariable, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.type = type self.value = value -class FeaturesetContainer(ProxyResource): +class EnvironmentVersion(ProxyResource): """Azure Resource Manager resource envelope. Variables are only populated by the server, and will be ignored when sending a request. @@ -12318,7 +12857,7 @@ class FeaturesetContainer(ProxyResource): information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetContainerProperties + :vartype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentVersionProperties """ _validation = { @@ -12334,25 +12873,25 @@ class FeaturesetContainer(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'FeaturesetContainerProperties'}, + 'properties': {'key': 'properties', 'type': 'EnvironmentVersionProperties'}, } def __init__( self, *, - properties: "FeaturesetContainerProperties", + properties: "EnvironmentVersionProperties", **kwargs ): """ :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetContainerProperties + :paramtype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentVersionProperties """ - super(FeaturesetContainer, self).__init__(**kwargs) + super(EnvironmentVersion, self).__init__(**kwargs) self.properties = properties -class FeaturesetContainerProperties(AssetContainer): - """DTO object representing feature set. +class EnvironmentVersionProperties(AssetBase): + """Environment version details. Variables are only populated by the server, and will be ignored when sending a request. @@ -12362,403 +12901,419 @@ class FeaturesetContainerProperties(AssetContainer): :vartype properties: dict[str, str] :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :vartype tags: dict[str, str] + :ivar is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool :ivar is_archived: Is the asset archived?. :vartype is_archived: bool - :ivar latest_version: The latest version inside this container. - :vartype latest_version: str - :ivar next_version: The next auto incremental version. - :vartype next_version: str - :ivar provisioning_state: Provisioning state for the featureset container. Possible values - include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState - """ - - _validation = { - 'latest_version': {'readonly': True}, - 'next_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'latest_version': {'key': 'latestVersion', 'type': 'str'}, - 'next_version': {'key': 'nextVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - *, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_archived: Optional[bool] = False, - **kwargs - ): - """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] + :ivar auto_rebuild: Defines if image needs to be rebuilt based on base image changes. Possible + values include: "Disabled", "OnBaseImageUpdate". + :vartype auto_rebuild: str or ~azure.mgmt.machinelearningservices.models.AutoRebuildSetting + :ivar build: Configuration settings for Docker build context. + :vartype build: ~azure.mgmt.machinelearningservices.models.BuildContext + :ivar conda_file: Standard configuration file used by Conda that lets you install any kind of + package, including Python, R, and C/C++ packages. + + + .. raw:: html + + . + :vartype conda_file: str + :ivar environment_type: Environment type is either user managed or curated by the Azure ML + service + + + .. raw:: html + + . Possible values include: "Curated", "UserCreated". + :vartype environment_type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentType + :ivar image: Name of the image that will be used for the environment. + + + .. raw:: html + + . + :vartype image: str + :ivar inference_config: Defines configuration specific to inference. + :vartype inference_config: + ~azure.mgmt.machinelearningservices.models.InferenceContainerProperties + :ivar os_type: The OS type of the environment. Possible values include: "Linux", "Windows". + :vartype os_type: str or ~azure.mgmt.machinelearningservices.models.OperatingSystemType + :ivar provisioning_state: Provisioning state for the environment version. Possible values + include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar stage: Stage in the environment lifecycle assigned to this environment. + :vartype stage: str + """ + + _validation = { + 'environment_type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'auto_rebuild': {'key': 'autoRebuild', 'type': 'str'}, + 'build': {'key': 'build', 'type': 'BuildContext'}, + 'conda_file': {'key': 'condaFile', 'type': 'str'}, + 'environment_type': {'key': 'environmentType', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'str'}, + 'inference_config': {'key': 'inferenceConfig', 'type': 'InferenceContainerProperties'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_anonymous: Optional[bool] = False, + is_archived: Optional[bool] = False, + auto_rebuild: Optional[Union[str, "AutoRebuildSetting"]] = None, + build: Optional["BuildContext"] = None, + conda_file: Optional[str] = None, + image: Optional[str] = None, + inference_config: Optional["InferenceContainerProperties"] = None, + os_type: Optional[Union[str, "OperatingSystemType"]] = None, + stage: Optional[str] = None, + **kwargs + ): + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :paramtype tags: dict[str, str] + :keyword is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool + :keyword auto_rebuild: Defines if image needs to be rebuilt based on base image changes. + Possible values include: "Disabled", "OnBaseImageUpdate". + :paramtype auto_rebuild: str or ~azure.mgmt.machinelearningservices.models.AutoRebuildSetting + :keyword build: Configuration settings for Docker build context. + :paramtype build: ~azure.mgmt.machinelearningservices.models.BuildContext + :keyword conda_file: Standard configuration file used by Conda that lets you install any kind + of package, including Python, R, and C/C++ packages. + + + .. raw:: html + + . + :paramtype conda_file: str + :keyword image: Name of the image that will be used for the environment. + + + .. raw:: html + + . + :paramtype image: str + :keyword inference_config: Defines configuration specific to inference. + :paramtype inference_config: + ~azure.mgmt.machinelearningservices.models.InferenceContainerProperties + :keyword os_type: The OS type of the environment. Possible values include: "Linux", "Windows". + :paramtype os_type: str or ~azure.mgmt.machinelearningservices.models.OperatingSystemType + :keyword stage: Stage in the environment lifecycle assigned to this environment. + :paramtype stage: str """ - super(FeaturesetContainerProperties, self).__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) + super(EnvironmentVersionProperties, self).__init__(description=description, properties=properties, tags=tags, is_anonymous=is_anonymous, is_archived=is_archived, **kwargs) + self.auto_rebuild = auto_rebuild + self.build = build + self.conda_file = conda_file + self.environment_type = None + self.image = image + self.inference_config = inference_config + self.os_type = os_type self.provisioning_state = None + self.stage = stage -class FeaturesetContainerResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of FeaturesetContainer entities. +class EnvironmentVersionResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of EnvironmentVersion entities. - :ivar next_link: The link to the next page of FeaturesetContainer objects. If null, there are - no additional pages. + :ivar next_link: The link to the next page of EnvironmentVersion objects. If null, there are no + additional pages. :vartype next_link: str - :ivar value: An array of objects of type FeaturesetContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + :ivar value: An array of objects of type EnvironmentVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[FeaturesetContainer]'}, + 'value': {'key': 'value', 'type': '[EnvironmentVersion]'}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["FeaturesetContainer"]] = None, + value: Optional[List["EnvironmentVersion"]] = None, **kwargs ): """ - :keyword next_link: The link to the next page of FeaturesetContainer objects. If null, there - are no additional pages. + :keyword next_link: The link to the next page of EnvironmentVersion objects. If null, there are + no additional pages. :paramtype next_link: str - :keyword value: An array of objects of type FeaturesetContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + :keyword value: An array of objects of type EnvironmentVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] """ - super(FeaturesetContainerResourceArmPaginatedResult, self).__init__(**kwargs) + super(EnvironmentVersionResourceArmPaginatedResult, self).__init__(**kwargs) self.next_link = next_link self.value = value -class FeaturesetSpecification(msrest.serialization.Model): - """DTO object representing specification. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. - :ivar path: Specifies the spec path. - :vartype path: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any """ + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, - *, - path: Optional[str] = None, **kwargs ): """ - :keyword path: Specifies the spec path. - :paramtype path: str """ - super(FeaturesetSpecification, self).__init__(**kwargs) - self.path = path + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class FeaturesetVersion(ProxyResource): - """Azure Resource Manager resource envelope. +class ErrorDetail(msrest.serialization.Model): + """The error detail. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionProperties + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.machinelearningservices.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.machinelearningservices.models.ErrorAdditionalInfo] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'FeaturesetVersionProperties'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( self, - *, - properties: "FeaturesetVersionProperties", **kwargs ): """ - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionProperties """ - super(FeaturesetVersion, self).__init__(**kwargs) - self.properties = properties + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None -class FeaturesetVersionBackfillRequest(msrest.serialization.Model): - """Request payload for creating a backfill request for a given feature set version. +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :ivar data_availability_status: Specified the data availability status that you want to - backfill. - :vartype data_availability_status: list[str or - ~azure.mgmt.machinelearningservices.models.DataAvailabilityStatus] - :ivar description: Specifies description. - :vartype description: str - :ivar display_name: Specifies description. - :vartype display_name: str - :ivar feature_window: Specifies the backfill feature window to be materialized. - :vartype feature_window: ~azure.mgmt.machinelearningservices.models.FeatureWindow - :ivar job_id: Specify the jobId to retry the failed materialization. - :vartype job_id: str - :ivar properties: Specifies the properties. - :vartype properties: dict[str, str] - :ivar resource: Specifies the compute resource settings. - :vartype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource - :ivar spark_configuration: Specifies the spark compute settings. - :vartype spark_configuration: dict[str, str] - :ivar tags: A set of tags. Specifies the tags. - :vartype tags: dict[str, str] + :ivar error: The error object. + :vartype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail """ _attribute_map = { - 'data_availability_status': {'key': 'dataAvailabilityStatus', 'type': '[str]'}, - 'description': {'key': 'description', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'feature_window': {'key': 'featureWindow', 'type': 'FeatureWindow'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'resource': {'key': 'resource', 'type': 'MaterializationComputeResource'}, - 'spark_configuration': {'key': 'sparkConfiguration', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, *, - data_availability_status: Optional[List[Union[str, "DataAvailabilityStatus"]]] = None, - description: Optional[str] = None, - display_name: Optional[str] = None, - feature_window: Optional["FeatureWindow"] = None, - job_id: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - resource: Optional["MaterializationComputeResource"] = None, - spark_configuration: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, + error: Optional["ErrorDetail"] = None, **kwargs ): """ - :keyword data_availability_status: Specified the data availability status that you want to - backfill. - :paramtype data_availability_status: list[str or - ~azure.mgmt.machinelearningservices.models.DataAvailabilityStatus] - :keyword description: Specifies description. - :paramtype description: str - :keyword display_name: Specifies description. - :paramtype display_name: str - :keyword feature_window: Specifies the backfill feature window to be materialized. - :paramtype feature_window: ~azure.mgmt.machinelearningservices.models.FeatureWindow - :keyword job_id: Specify the jobId to retry the failed materialization. - :paramtype job_id: str - :keyword properties: Specifies the properties. - :paramtype properties: dict[str, str] - :keyword resource: Specifies the compute resource settings. - :paramtype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource - :keyword spark_configuration: Specifies the spark compute settings. - :paramtype spark_configuration: dict[str, str] - :keyword tags: A set of tags. Specifies the tags. - :paramtype tags: dict[str, str] + :keyword error: The error object. + :paramtype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail """ - super(FeaturesetVersionBackfillRequest, self).__init__(**kwargs) - self.data_availability_status = data_availability_status - self.description = description - self.display_name = display_name - self.feature_window = feature_window - self.job_id = job_id - self.properties = properties - self.resource = resource - self.spark_configuration = spark_configuration - self.tags = tags + super(ErrorResponse, self).__init__(**kwargs) + self.error = error -class FeaturesetVersionBackfillResponse(msrest.serialization.Model): - """Response payload for creating a backfill request for a given feature set version. +class EstimatedVMPrice(msrest.serialization.Model): + """The estimated price info for using a VM of a particular OS type, tier, etc. - :ivar job_ids: List of jobs submitted as part of the backfill request. - :vartype job_ids: list[str] + All required parameters must be populated in order to send to Azure. + + :ivar retail_price: Required. The price charged for using the VM. + :vartype retail_price: float + :ivar os_type: Required. Operating system type used by the VM. Possible values include: + "Linux", "Windows". + :vartype os_type: str or ~azure.mgmt.machinelearningservices.models.VMPriceOSType + :ivar vm_tier: Required. The type of the VM. Possible values include: "Standard", + "LowPriority", "Spot". + :vartype vm_tier: str or ~azure.mgmt.machinelearningservices.models.VMTier """ + _validation = { + 'retail_price': {'required': True}, + 'os_type': {'required': True}, + 'vm_tier': {'required': True}, + } + _attribute_map = { - 'job_ids': {'key': 'jobIds', 'type': '[str]'}, + 'retail_price': {'key': 'retailPrice', 'type': 'float'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'vm_tier': {'key': 'vmTier', 'type': 'str'}, } def __init__( self, *, - job_ids: Optional[List[str]] = None, + retail_price: float, + os_type: Union[str, "VMPriceOSType"], + vm_tier: Union[str, "VMTier"], **kwargs ): """ - :keyword job_ids: List of jobs submitted as part of the backfill request. - :paramtype job_ids: list[str] + :keyword retail_price: Required. The price charged for using the VM. + :paramtype retail_price: float + :keyword os_type: Required. Operating system type used by the VM. Possible values include: + "Linux", "Windows". + :paramtype os_type: str or ~azure.mgmt.machinelearningservices.models.VMPriceOSType + :keyword vm_tier: Required. The type of the VM. Possible values include: "Standard", + "LowPriority", "Spot". + :paramtype vm_tier: str or ~azure.mgmt.machinelearningservices.models.VMTier """ - super(FeaturesetVersionBackfillResponse, self).__init__(**kwargs) - self.job_ids = job_ids + super(EstimatedVMPrice, self).__init__(**kwargs) + self.retail_price = retail_price + self.os_type = os_type + self.vm_tier = vm_tier -class FeaturesetVersionProperties(AssetBase): - """DTO object representing feature set version. +class EstimatedVMPrices(msrest.serialization.Model): + """The estimated price info for using a VM. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar entities: Specifies list of entities. - :vartype entities: list[str] - :ivar materialization_settings: Specifies the materialization settings. - :vartype materialization_settings: - ~azure.mgmt.machinelearningservices.models.MaterializationSettings - :ivar provisioning_state: Provisioning state for the featureset version container. Possible - values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState - :ivar specification: Specifies the feature spec details. - :vartype specification: ~azure.mgmt.machinelearningservices.models.FeaturesetSpecification - :ivar stage: Specifies the asset stage. - :vartype stage: str + :ivar billing_currency: Required. Three lettered code specifying the currency of the VM price. + Example: USD. Possible values include: "USD". + :vartype billing_currency: str or ~azure.mgmt.machinelearningservices.models.BillingCurrency + :ivar unit_of_measure: Required. The unit of time measurement for the specified VM price. + Example: OneHour. Possible values include: "OneHour". + :vartype unit_of_measure: str or ~azure.mgmt.machinelearningservices.models.UnitOfMeasure + :ivar values: Required. The list of estimated prices for using a VM of a particular OS type, + tier, etc. + :vartype values: list[~azure.mgmt.machinelearningservices.models.EstimatedVMPrice] """ _validation = { - 'provisioning_state': {'readonly': True}, + 'billing_currency': {'required': True}, + 'unit_of_measure': {'required': True}, + 'values': {'required': True}, } _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'entities': {'key': 'entities', 'type': '[str]'}, - 'materialization_settings': {'key': 'materializationSettings', 'type': 'MaterializationSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'specification': {'key': 'specification', 'type': 'FeaturesetSpecification'}, - 'stage': {'key': 'stage', 'type': 'str'}, + 'billing_currency': {'key': 'billingCurrency', 'type': 'str'}, + 'unit_of_measure': {'key': 'unitOfMeasure', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[EstimatedVMPrice]'}, } def __init__( self, *, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_anonymous: Optional[bool] = False, - is_archived: Optional[bool] = False, - entities: Optional[List[str]] = None, - materialization_settings: Optional["MaterializationSettings"] = None, - specification: Optional["FeaturesetSpecification"] = None, - stage: Optional[str] = None, + billing_currency: Union[str, "BillingCurrency"], + unit_of_measure: Union[str, "UnitOfMeasure"], + values: List["EstimatedVMPrice"], **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword entities: Specifies list of entities. - :paramtype entities: list[str] - :keyword materialization_settings: Specifies the materialization settings. - :paramtype materialization_settings: - ~azure.mgmt.machinelearningservices.models.MaterializationSettings - :keyword specification: Specifies the feature spec details. - :paramtype specification: ~azure.mgmt.machinelearningservices.models.FeaturesetSpecification - :keyword stage: Specifies the asset stage. - :paramtype stage: str + :keyword billing_currency: Required. Three lettered code specifying the currency of the VM + price. Example: USD. Possible values include: "USD". + :paramtype billing_currency: str or ~azure.mgmt.machinelearningservices.models.BillingCurrency + :keyword unit_of_measure: Required. The unit of time measurement for the specified VM price. + Example: OneHour. Possible values include: "OneHour". + :paramtype unit_of_measure: str or ~azure.mgmt.machinelearningservices.models.UnitOfMeasure + :keyword values: Required. The list of estimated prices for using a VM of a particular OS type, + tier, etc. + :paramtype values: list[~azure.mgmt.machinelearningservices.models.EstimatedVMPrice] """ - super(FeaturesetVersionProperties, self).__init__(description=description, properties=properties, tags=tags, is_anonymous=is_anonymous, is_archived=is_archived, **kwargs) - self.entities = entities - self.materialization_settings = materialization_settings - self.provisioning_state = None - self.specification = specification - self.stage = stage + super(EstimatedVMPrices, self).__init__(**kwargs) + self.billing_currency = billing_currency + self.unit_of_measure = unit_of_measure + self.values = values -class FeaturesetVersionResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of FeaturesetVersion entities. +class ExternalFQDNResponse(msrest.serialization.Model): + """ExternalFQDNResponse. - :ivar next_link: The link to the next page of FeaturesetVersion objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type FeaturesetVersion. - :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + :ivar value: + :vartype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpointsPropertyBag] """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[FeaturesetVersion]'}, + 'value': {'key': 'value', 'type': '[FQDNEndpointsPropertyBag]'}, } def __init__( self, *, - next_link: Optional[str] = None, - value: Optional[List["FeaturesetVersion"]] = None, + value: Optional[List["FQDNEndpointsPropertyBag"]] = None, **kwargs ): """ - :keyword next_link: The link to the next page of FeaturesetVersion objects. If null, there are - no additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type FeaturesetVersion. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + :keyword value: + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpointsPropertyBag] """ - super(FeaturesetVersionResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = next_link + super(ExternalFQDNResponse, self).__init__(**kwargs) self.value = value -class FeaturestoreEntityContainer(ProxyResource): +class Feature(ProxyResource): """Azure Resource Manager resource envelope. Variables are only populated by the server, and will be ignored when sending a request. @@ -12777,8 +13332,7 @@ class FeaturestoreEntityContainer(ProxyResource): information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: - ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainerProperties + :vartype properties: ~azure.mgmt.machinelearningservices.models.FeatureProperties """ _validation = { @@ -12794,28 +13348,198 @@ class FeaturestoreEntityContainer(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'FeaturestoreEntityContainerProperties'}, + 'properties': {'key': 'properties', 'type': 'FeatureProperties'}, } def __init__( self, *, - properties: "FeaturestoreEntityContainerProperties", + properties: "FeatureProperties", **kwargs ): """ :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: - ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainerProperties + :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeatureProperties """ - super(FeaturestoreEntityContainer, self).__init__(**kwargs) + super(Feature, self).__init__(**kwargs) self.properties = properties -class FeaturestoreEntityContainerProperties(AssetContainer): - """DTO object representing feature entity. +class FeatureAttributionDriftMonitoringSignal(MonitoringSignalBase): + """FeatureAttributionDriftMonitoringSignal. + + All required parameters must be populated in order to send to Azure. + + :ivar notification_types: The current notification mode for this signal. + :vartype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar signal_type: Required. [Required] Specifies the type of signal to monitor.Constant filled + by server. Possible values include: "DataDrift", "PredictionDrift", "DataQuality", + "FeatureAttributionDrift", "Custom". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar feature_data_type_override: A dictionary that maps feature names to their respective data + types. + :vartype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :ivar feature_importance_settings: Required. [Required] The settings for computing feature + importance. + :vartype feature_importance_settings: + ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings + :ivar metric_threshold: Required. [Required] A list of metrics to calculate and their + associated thresholds. + :vartype metric_threshold: + ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetricThreshold + :ivar production_data: Required. [Required] The data which drift will be calculated for. + :vartype production_data: + list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :ivar reference_data: Required. [Required] The data to calculate drift against. + :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + """ + + _validation = { + 'signal_type': {'required': True}, + 'feature_importance_settings': {'required': True}, + 'metric_threshold': {'required': True}, + 'production_data': {'required': True}, + 'reference_data': {'required': True}, + } + + _attribute_map = { + 'notification_types': {'key': 'notificationTypes', 'type': '[str]'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'signal_type': {'key': 'signalType', 'type': 'str'}, + 'feature_data_type_override': {'key': 'featureDataTypeOverride', 'type': '{str}'}, + 'feature_importance_settings': {'key': 'featureImportanceSettings', 'type': 'FeatureImportanceSettings'}, + 'metric_threshold': {'key': 'metricThreshold', 'type': 'FeatureAttributionMetricThreshold'}, + 'production_data': {'key': 'productionData', 'type': '[MonitoringInputDataBase]'}, + 'reference_data': {'key': 'referenceData', 'type': 'MonitoringInputDataBase'}, + } + + def __init__( + self, + *, + feature_importance_settings: "FeatureImportanceSettings", + metric_threshold: "FeatureAttributionMetricThreshold", + production_data: List["MonitoringInputDataBase"], + reference_data: "MonitoringInputDataBase", + notification_types: Optional[List[Union[str, "MonitoringNotificationType"]]] = None, + properties: Optional[Dict[str, str]] = None, + feature_data_type_override: Optional[Dict[str, Union[str, "MonitoringFeatureDataType"]]] = None, + **kwargs + ): + """ + :keyword notification_types: The current notification mode for this signal. + :paramtype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword feature_data_type_override: A dictionary that maps feature names to their respective + data types. + :paramtype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :keyword feature_importance_settings: Required. [Required] The settings for computing feature + importance. + :paramtype feature_importance_settings: + ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings + :keyword metric_threshold: Required. [Required] A list of metrics to calculate and their + associated thresholds. + :paramtype metric_threshold: + ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetricThreshold + :keyword production_data: Required. [Required] The data which drift will be calculated for. + :paramtype production_data: + list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :keyword reference_data: Required. [Required] The data to calculate drift against. + :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + """ + super(FeatureAttributionDriftMonitoringSignal, self).__init__(notification_types=notification_types, properties=properties, **kwargs) + self.signal_type = 'FeatureAttributionDrift' # type: str + self.feature_data_type_override = feature_data_type_override + self.feature_importance_settings = feature_importance_settings + self.metric_threshold = metric_threshold + self.production_data = production_data + self.reference_data = reference_data + + +class FeatureAttributionMetricThreshold(msrest.serialization.Model): + """FeatureAttributionMetricThreshold. + + All required parameters must be populated in order to send to Azure. + + :ivar metric: Required. [Required] The feature attribution metric to calculate. Possible values + include: "NormalizedDiscountedCumulativeGain". + :vartype metric: str or ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetric + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + """ + + _validation = { + 'metric': {'required': True}, + } + + _attribute_map = { + 'metric': {'key': 'metric', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, + } + + def __init__( + self, + *, + metric: Union[str, "FeatureAttributionMetric"], + threshold: Optional["MonitoringThreshold"] = None, + **kwargs + ): + """ + :keyword metric: Required. [Required] The feature attribution metric to calculate. Possible + values include: "NormalizedDiscountedCumulativeGain". + :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetric + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + """ + super(FeatureAttributionMetricThreshold, self).__init__(**kwargs) + self.metric = metric + self.threshold = threshold + + +class FeatureImportanceSettings(msrest.serialization.Model): + """FeatureImportanceSettings. + + :ivar mode: The mode of operation for computing feature importance. Possible values include: + "Disabled", "Enabled". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.FeatureImportanceMode + :ivar target_column: The name of the target column within the input data asset. + :vartype target_column: str + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'target_column': {'key': 'targetColumn', 'type': 'str'}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "FeatureImportanceMode"]] = None, + target_column: Optional[str] = None, + **kwargs + ): + """ + :keyword mode: The mode of operation for computing feature importance. Possible values include: + "Disabled", "Enabled". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.FeatureImportanceMode + :keyword target_column: The name of the target column within the input data asset. + :paramtype target_column: str + """ + super(FeatureImportanceSettings, self).__init__(**kwargs) + self.mode = mode + self.target_column = target_column - Variables are only populated by the server, and will be ignored when sending a request. + +class FeatureProperties(ResourceBase): + """DTO object representing feature. :ivar description: The asset description text. :vartype description: str @@ -12823,32 +13547,19 @@ class FeaturestoreEntityContainerProperties(AssetContainer): :vartype properties: dict[str, str] :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :vartype tags: dict[str, str] - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar latest_version: The latest version inside this container. - :vartype latest_version: str - :ivar next_version: The next auto incremental version. - :vartype next_version: str - :ivar provisioning_state: Provisioning state for the featurestore entity container. Possible - values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar data_type: Specifies type. Possible values include: "String", "Integer", "Long", "Float", + "Double", "Binary", "Datetime", "Boolean". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType + :ivar feature_name: Specifies name. + :vartype feature_name: str """ - _validation = { - 'latest_version': {'readonly': True}, - 'next_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - _attribute_map = { 'description': {'key': 'description', 'type': 'str'}, 'properties': {'key': 'properties', 'type': '{str}'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'latest_version': {'key': 'latestVersion', 'type': 'str'}, - 'next_version': {'key': 'nextVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'feature_name': {'key': 'featureName', 'type': 'str'}, } def __init__( @@ -12857,7 +13568,8 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, - is_archived: Optional[bool] = False, + data_type: Optional[Union[str, "FeatureDataType"]] = None, + feature_name: Optional[str] = None, **kwargs ): """ @@ -12867,48 +13579,52 @@ def __init__( :paramtype properties: dict[str, str] :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :paramtype tags: dict[str, str] - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool + :keyword data_type: Specifies type. Possible values include: "String", "Integer", "Long", + "Float", "Double", "Binary", "Datetime", "Boolean". + :paramtype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType + :keyword feature_name: Specifies name. + :paramtype feature_name: str """ - super(FeaturestoreEntityContainerProperties, self).__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) - self.provisioning_state = None + super(FeatureProperties, self).__init__(description=description, properties=properties, tags=tags, **kwargs) + self.data_type = data_type + self.feature_name = feature_name -class FeaturestoreEntityContainerResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of FeaturestoreEntityContainer entities. +class FeatureResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of Feature entities. - :ivar next_link: The link to the next page of FeaturestoreEntityContainer objects. If null, - there are no additional pages. + :ivar next_link: The link to the next page of Feature objects. If null, there are no additional + pages. :vartype next_link: str - :ivar value: An array of objects of type FeaturestoreEntityContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + :ivar value: An array of objects of type Feature. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Feature] """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[FeaturestoreEntityContainer]'}, + 'value': {'key': 'value', 'type': '[Feature]'}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["FeaturestoreEntityContainer"]] = None, + value: Optional[List["Feature"]] = None, **kwargs ): """ - :keyword next_link: The link to the next page of FeaturestoreEntityContainer objects. If null, - there are no additional pages. + :keyword next_link: The link to the next page of Feature objects. If null, there are no + additional pages. :paramtype next_link: str - :keyword value: An array of objects of type FeaturestoreEntityContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + :keyword value: An array of objects of type Feature. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.Feature] """ - super(FeaturestoreEntityContainerResourceArmPaginatedResult, self).__init__(**kwargs) + super(FeatureResourceArmPaginatedResult, self).__init__(**kwargs) self.next_link = next_link self.value = value -class FeaturestoreEntityVersion(ProxyResource): +class FeaturesetContainer(ProxyResource): """Azure Resource Manager resource envelope. Variables are only populated by the server, and will be ignored when sending a request. @@ -12927,8 +13643,7 @@ class FeaturestoreEntityVersion(ProxyResource): information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: - ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersionProperties + :vartype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetContainerProperties """ _validation = { @@ -12944,26 +13659,25 @@ class FeaturestoreEntityVersion(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'FeaturestoreEntityVersionProperties'}, + 'properties': {'key': 'properties', 'type': 'FeaturesetContainerProperties'}, } def __init__( self, *, - properties: "FeaturestoreEntityVersionProperties", + properties: "FeaturesetContainerProperties", **kwargs ): """ :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: - ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersionProperties + :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetContainerProperties """ - super(FeaturestoreEntityVersion, self).__init__(**kwargs) + super(FeaturesetContainer, self).__init__(**kwargs) self.properties = properties -class FeaturestoreEntityVersionProperties(AssetBase): - """DTO object representing feature entity version. +class FeaturesetContainerProperties(AssetContainer): + """DTO object representing feature set. Variables are only populated by the server, and will be ignored when sending a request. @@ -12973,21 +13687,21 @@ class FeaturestoreEntityVersionProperties(AssetBase): :vartype properties: dict[str, str] :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :vartype tags: dict[str, str] - :ivar is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool :ivar is_archived: Is the asset archived?. :vartype is_archived: bool - :ivar index_columns: Specifies index columns. - :vartype index_columns: list[~azure.mgmt.machinelearningservices.models.IndexColumn] - :ivar provisioning_state: Provisioning state for the featurestore entity version. Possible - values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :ivar latest_version: The latest version inside this container. + :vartype latest_version: str + :ivar next_version: The next auto incremental version. + :vartype next_version: str + :ivar provisioning_state: Provisioning state for the featureset container. Possible values + include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.AssetProvisioningState - :ivar stage: Specifies the asset stage. - :vartype stage: str """ _validation = { + 'latest_version': {'readonly': True}, + 'next_version': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -12995,11 +13709,10 @@ class FeaturestoreEntityVersionProperties(AssetBase): 'description': {'key': 'description', 'type': 'str'}, 'properties': {'key': 'properties', 'type': '{str}'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'index_columns': {'key': 'indexColumns', 'type': '[IndexColumn]'}, + 'latest_version': {'key': 'latestVersion', 'type': 'str'}, + 'next_version': {'key': 'nextVersion', 'type': 'str'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'stage': {'key': 'stage', 'type': 'str'}, } def __init__( @@ -13008,10 +13721,7 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, - is_anonymous: Optional[bool] = False, is_archived: Optional[bool] = False, - index_columns: Optional[List["IndexColumn"]] = None, - stage: Optional[str] = None, **kwargs ): """ @@ -13021,359 +13731,974 @@ def __init__( :paramtype properties: dict[str, str] :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :paramtype tags: dict[str, str] - :keyword is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool - :keyword index_columns: Specifies index columns. - :paramtype index_columns: list[~azure.mgmt.machinelearningservices.models.IndexColumn] - :keyword stage: Specifies the asset stage. - :paramtype stage: str """ - super(FeaturestoreEntityVersionProperties, self).__init__(description=description, properties=properties, tags=tags, is_anonymous=is_anonymous, is_archived=is_archived, **kwargs) - self.index_columns = index_columns + super(FeaturesetContainerProperties, self).__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) self.provisioning_state = None - self.stage = stage -class FeaturestoreEntityVersionResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of FeaturestoreEntityVersion entities. +class FeaturesetContainerResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of FeaturesetContainer entities. - :ivar next_link: The link to the next page of FeaturestoreEntityVersion objects. If null, there - are no additional pages. + :ivar next_link: The link to the next page of FeaturesetContainer objects. If null, there are + no additional pages. :vartype next_link: str - :ivar value: An array of objects of type FeaturestoreEntityVersion. - :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + :ivar value: An array of objects of type FeaturesetContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[FeaturestoreEntityVersion]'}, + 'value': {'key': 'value', 'type': '[FeaturesetContainer]'}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["FeaturestoreEntityVersion"]] = None, + value: Optional[List["FeaturesetContainer"]] = None, **kwargs ): """ - :keyword next_link: The link to the next page of FeaturestoreEntityVersion objects. If null, - there are no additional pages. + :keyword next_link: The link to the next page of FeaturesetContainer objects. If null, there + are no additional pages. :paramtype next_link: str - :keyword value: An array of objects of type FeaturestoreEntityVersion. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + :keyword value: An array of objects of type FeaturesetContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] """ - super(FeaturestoreEntityVersionResourceArmPaginatedResult, self).__init__(**kwargs) + super(FeaturesetContainerResourceArmPaginatedResult, self).__init__(**kwargs) self.next_link = next_link self.value = value -class FeatureStoreSettings(msrest.serialization.Model): - """Settings for feature store type workspace. +class FeaturesetSpecification(msrest.serialization.Model): + """DTO object representing specification. - :ivar compute_runtime: Compute runtime config for feature store type workspace. - :vartype compute_runtime: ~azure.mgmt.machinelearningservices.models.ComputeRuntimeDto - :ivar offline_store_connection_name: - :vartype offline_store_connection_name: str - :ivar online_store_connection_name: - :vartype online_store_connection_name: str + :ivar path: Specifies the spec path. + :vartype path: str """ _attribute_map = { - 'compute_runtime': {'key': 'computeRuntime', 'type': 'ComputeRuntimeDto'}, - 'offline_store_connection_name': {'key': 'offlineStoreConnectionName', 'type': 'str'}, - 'online_store_connection_name': {'key': 'onlineStoreConnectionName', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, } def __init__( self, *, - compute_runtime: Optional["ComputeRuntimeDto"] = None, - offline_store_connection_name: Optional[str] = None, - online_store_connection_name: Optional[str] = None, + path: Optional[str] = None, **kwargs ): """ - :keyword compute_runtime: Compute runtime config for feature store type workspace. - :paramtype compute_runtime: ~azure.mgmt.machinelearningservices.models.ComputeRuntimeDto - :keyword offline_store_connection_name: - :paramtype offline_store_connection_name: str - :keyword online_store_connection_name: - :paramtype online_store_connection_name: str + :keyword path: Specifies the spec path. + :paramtype path: str """ - super(FeatureStoreSettings, self).__init__(**kwargs) - self.compute_runtime = compute_runtime - self.offline_store_connection_name = offline_store_connection_name - self.online_store_connection_name = online_store_connection_name + super(FeaturesetSpecification, self).__init__(**kwargs) + self.path = path -class FeatureSubset(MonitoringFeatureFilterBase): - """FeatureSubset. +class FeaturesetVersion(ProxyResource): + """Azure Resource Manager resource envelope. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar filter_type: Required. [Required] Specifies the feature filter to leverage when selecting - features to calculate metrics over.Constant filled by server. Possible values include: - "AllFeatures", "TopNByAttribution", "FeatureSubset". - :vartype filter_type: str or - ~azure.mgmt.machinelearningservices.models.MonitoringFeatureFilterType - :ivar features: Required. [Required] The list of features to include. - :vartype features: list[str] + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionProperties """ _validation = { - 'filter_type': {'required': True}, - 'features': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, } _attribute_map = { - 'filter_type': {'key': 'filterType', 'type': 'str'}, - 'features': {'key': 'features', 'type': '[str]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'FeaturesetVersionProperties'}, } def __init__( self, *, - features: List[str], + properties: "FeaturesetVersionProperties", **kwargs ): """ - :keyword features: Required. [Required] The list of features to include. - :paramtype features: list[str] + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionProperties """ - super(FeatureSubset, self).__init__(**kwargs) - self.filter_type = 'FeatureSubset' # type: str - self.features = features + super(FeaturesetVersion, self).__init__(**kwargs) + self.properties = properties -class FeatureWindow(msrest.serialization.Model): - """Specifies the feature window. +class FeaturesetVersionBackfillRequest(msrest.serialization.Model): + """Request payload for creating a backfill request for a given feature set version. - :ivar feature_window_end: Specifies the feature window end time. - :vartype feature_window_end: ~datetime.datetime - :ivar feature_window_start: Specifies the feature window start time. - :vartype feature_window_start: ~datetime.datetime + :ivar data_availability_status: Specified the data availability status that you want to + backfill. + :vartype data_availability_status: list[str or + ~azure.mgmt.machinelearningservices.models.DataAvailabilityStatus] + :ivar description: Specifies description. + :vartype description: str + :ivar display_name: Specifies description. + :vartype display_name: str + :ivar feature_window: Specifies the backfill feature window to be materialized. + :vartype feature_window: ~azure.mgmt.machinelearningservices.models.FeatureWindow + :ivar job_id: Specify the jobId to retry the failed materialization. + :vartype job_id: str + :ivar properties: Specifies the properties. + :vartype properties: dict[str, str] + :ivar resource: Specifies the compute resource settings. + :vartype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource + :ivar spark_configuration: Specifies the spark compute settings. + :vartype spark_configuration: dict[str, str] + :ivar tags: A set of tags. Specifies the tags. + :vartype tags: dict[str, str] """ _attribute_map = { - 'feature_window_end': {'key': 'featureWindowEnd', 'type': 'iso-8601'}, - 'feature_window_start': {'key': 'featureWindowStart', 'type': 'iso-8601'}, + 'data_availability_status': {'key': 'dataAvailabilityStatus', 'type': '[str]'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'feature_window': {'key': 'featureWindow', 'type': 'FeatureWindow'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'resource': {'key': 'resource', 'type': 'MaterializationComputeResource'}, + 'spark_configuration': {'key': 'sparkConfiguration', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__( self, *, - feature_window_end: Optional[datetime.datetime] = None, - feature_window_start: Optional[datetime.datetime] = None, + data_availability_status: Optional[List[Union[str, "DataAvailabilityStatus"]]] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + feature_window: Optional["FeatureWindow"] = None, + job_id: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + resource: Optional["MaterializationComputeResource"] = None, + spark_configuration: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword feature_window_end: Specifies the feature window end time. - :paramtype feature_window_end: ~datetime.datetime - :keyword feature_window_start: Specifies the feature window start time. - :paramtype feature_window_start: ~datetime.datetime + :keyword data_availability_status: Specified the data availability status that you want to + backfill. + :paramtype data_availability_status: list[str or + ~azure.mgmt.machinelearningservices.models.DataAvailabilityStatus] + :keyword description: Specifies description. + :paramtype description: str + :keyword display_name: Specifies description. + :paramtype display_name: str + :keyword feature_window: Specifies the backfill feature window to be materialized. + :paramtype feature_window: ~azure.mgmt.machinelearningservices.models.FeatureWindow + :keyword job_id: Specify the jobId to retry the failed materialization. + :paramtype job_id: str + :keyword properties: Specifies the properties. + :paramtype properties: dict[str, str] + :keyword resource: Specifies the compute resource settings. + :paramtype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource + :keyword spark_configuration: Specifies the spark compute settings. + :paramtype spark_configuration: dict[str, str] + :keyword tags: A set of tags. Specifies the tags. + :paramtype tags: dict[str, str] """ - super(FeatureWindow, self).__init__(**kwargs) - self.feature_window_end = feature_window_end - self.feature_window_start = feature_window_start + super(FeaturesetVersionBackfillRequest, self).__init__(**kwargs) + self.data_availability_status = data_availability_status + self.description = description + self.display_name = display_name + self.feature_window = feature_window + self.job_id = job_id + self.properties = properties + self.resource = resource + self.spark_configuration = spark_configuration + self.tags = tags -class FeaturizationSettings(msrest.serialization.Model): - """Featurization Configuration. +class FeaturesetVersionBackfillResponse(msrest.serialization.Model): + """Response payload for creating a backfill request for a given feature set version. - :ivar dataset_language: Dataset language, useful for the text data. - :vartype dataset_language: str + :ivar job_ids: List of jobs submitted as part of the backfill request. + :vartype job_ids: list[str] """ _attribute_map = { - 'dataset_language': {'key': 'datasetLanguage', 'type': 'str'}, + 'job_ids': {'key': 'jobIds', 'type': '[str]'}, } def __init__( self, *, - dataset_language: Optional[str] = None, + job_ids: Optional[List[str]] = None, **kwargs ): """ - :keyword dataset_language: Dataset language, useful for the text data. - :paramtype dataset_language: str + :keyword job_ids: List of jobs submitted as part of the backfill request. + :paramtype job_ids: list[str] """ - super(FeaturizationSettings, self).__init__(**kwargs) - self.dataset_language = dataset_language - + super(FeaturesetVersionBackfillResponse, self).__init__(**kwargs) + self.job_ids = job_ids -class MonitoringInputDataBase(msrest.serialization.Model): - """Monitoring input data base definition. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FixedInputData, RollingInputData, StaticInputData. +class FeaturesetVersionProperties(AssetBase): + """DTO object representing feature set version. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar columns: Mapping of column names to special uses. - :vartype columns: dict[str, str] - :ivar data_context: The context metadata of the data source. - :vartype data_context: str - :ivar input_data_type: Required. [Required] Specifies the type of signal to monitor.Constant - filled by server. Possible values include: "Static", "Rolling", "Fixed". - :vartype input_data_type: str or - ~azure.mgmt.machinelearningservices.models.MonitoringInputDataType - :ivar job_input_type: Required. [Required] Specifies the type of job. Possible values include: - "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :ivar uri: Required. [Required] Input Asset URI. - :vartype uri: str + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar entities: Specifies list of entities. + :vartype entities: list[str] + :ivar materialization_settings: Specifies the materialization settings. + :vartype materialization_settings: + ~azure.mgmt.machinelearningservices.models.MaterializationSettings + :ivar provisioning_state: Provisioning state for the featureset version container. Possible + values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar specification: Specifies the feature spec details. + :vartype specification: ~azure.mgmt.machinelearningservices.models.FeaturesetSpecification + :ivar stage: Specifies the asset stage. + :vartype stage: str """ _validation = { - 'input_data_type': {'required': True}, - 'job_input_type': {'required': True}, - 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'columns': {'key': 'columns', 'type': '{str}'}, - 'data_context': {'key': 'dataContext', 'type': 'str'}, - 'input_data_type': {'key': 'inputDataType', 'type': 'str'}, - 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - } - - _subtype_map = { - 'input_data_type': {'Fixed': 'FixedInputData', 'Rolling': 'RollingInputData', 'Static': 'StaticInputData'} + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'entities': {'key': 'entities', 'type': '[str]'}, + 'materialization_settings': {'key': 'materializationSettings', 'type': 'MaterializationSettings'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'specification': {'key': 'specification', 'type': 'FeaturesetSpecification'}, + 'stage': {'key': 'stage', 'type': 'str'}, } def __init__( self, *, - job_input_type: Union[str, "JobInputType"], - uri: str, - columns: Optional[Dict[str, str]] = None, - data_context: Optional[str] = None, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_anonymous: Optional[bool] = False, + is_archived: Optional[bool] = False, + entities: Optional[List[str]] = None, + materialization_settings: Optional["MaterializationSettings"] = None, + specification: Optional["FeaturesetSpecification"] = None, + stage: Optional[str] = None, **kwargs ): """ - :keyword columns: Mapping of column names to special uses. - :paramtype columns: dict[str, str] - :keyword data_context: The context metadata of the data source. - :paramtype data_context: str - :keyword job_input_type: Required. [Required] Specifies the type of job. Possible values - include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", - "triton_model". - :paramtype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :keyword uri: Required. [Required] Input Asset URI. - :paramtype uri: str + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword entities: Specifies list of entities. + :paramtype entities: list[str] + :keyword materialization_settings: Specifies the materialization settings. + :paramtype materialization_settings: + ~azure.mgmt.machinelearningservices.models.MaterializationSettings + :keyword specification: Specifies the feature spec details. + :paramtype specification: ~azure.mgmt.machinelearningservices.models.FeaturesetSpecification + :keyword stage: Specifies the asset stage. + :paramtype stage: str """ - super(MonitoringInputDataBase, self).__init__(**kwargs) - self.columns = columns - self.data_context = data_context - self.input_data_type = None # type: Optional[str] - self.job_input_type = job_input_type - self.uri = uri - + super(FeaturesetVersionProperties, self).__init__(description=description, properties=properties, tags=tags, is_anonymous=is_anonymous, is_archived=is_archived, **kwargs) + self.entities = entities + self.materialization_settings = materialization_settings + self.provisioning_state = None + self.specification = specification + self.stage = stage -class FixedInputData(MonitoringInputDataBase): - """Fixed input data definition. - All required parameters must be populated in order to send to Azure. +class FeaturesetVersionResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of FeaturesetVersion entities. - :ivar columns: Mapping of column names to special uses. - :vartype columns: dict[str, str] - :ivar data_context: The context metadata of the data source. - :vartype data_context: str - :ivar input_data_type: Required. [Required] Specifies the type of signal to monitor.Constant - filled by server. Possible values include: "Static", "Rolling", "Fixed". - :vartype input_data_type: str or - ~azure.mgmt.machinelearningservices.models.MonitoringInputDataType - :ivar job_input_type: Required. [Required] Specifies the type of job. Possible values include: - "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :ivar uri: Required. [Required] Input Asset URI. - :vartype uri: str + :ivar next_link: The link to the next page of FeaturesetVersion objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type FeaturesetVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] """ - _validation = { - 'input_data_type': {'required': True}, - 'job_input_type': {'required': True}, - 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, - } - _attribute_map = { - 'columns': {'key': 'columns', 'type': '{str}'}, - 'data_context': {'key': 'dataContext', 'type': 'str'}, - 'input_data_type': {'key': 'inputDataType', 'type': 'str'}, - 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[FeaturesetVersion]'}, } def __init__( self, *, - job_input_type: Union[str, "JobInputType"], - uri: str, - columns: Optional[Dict[str, str]] = None, - data_context: Optional[str] = None, + next_link: Optional[str] = None, + value: Optional[List["FeaturesetVersion"]] = None, **kwargs ): """ - :keyword columns: Mapping of column names to special uses. - :paramtype columns: dict[str, str] - :keyword data_context: The context metadata of the data source. - :paramtype data_context: str - :keyword job_input_type: Required. [Required] Specifies the type of job. Possible values - include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", - "triton_model". - :paramtype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :keyword uri: Required. [Required] Input Asset URI. - :paramtype uri: str + :keyword next_link: The link to the next page of FeaturesetVersion objects. If null, there are + no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type FeaturesetVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] """ - super(FixedInputData, self).__init__(columns=columns, data_context=data_context, job_input_type=job_input_type, uri=uri, **kwargs) - self.input_data_type = 'Fixed' # type: str + super(FeaturesetVersionResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value -class FlavorData(msrest.serialization.Model): - """FlavorData. +class FeaturestoreEntityContainer(ProxyResource): + """Azure Resource Manager resource envelope. - :ivar data: Model flavor-specific data. - :vartype data: dict[str, str] + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainerProperties """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + _attribute_map = { - 'data': {'key': 'data', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'FeaturestoreEntityContainerProperties'}, } def __init__( self, *, - data: Optional[Dict[str, str]] = None, + properties: "FeaturestoreEntityContainerProperties", **kwargs ): """ - :keyword data: Model flavor-specific data. - :paramtype data: dict[str, str] + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainerProperties """ - super(FlavorData, self).__init__(**kwargs) - self.data = data + super(FeaturestoreEntityContainer, self).__init__(**kwargs) + self.properties = properties -class Forecasting(AutoMLVertical, TableVertical): - """Forecasting task in AutoML Table vertical. +class FeaturestoreEntityContainerProperties(AssetContainer): + """DTO object representing feature entity. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar cv_split_column_names: Columns to use for CVSplit data. - :vartype cv_split_column_names: list[str] - :ivar featurization_settings: Featurization inputs needed for AutoML job. - :vartype featurization_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings - :ivar limit_settings: Execution constraints for AutoMLJob. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings - :ivar n_cross_validations: Number of cross validation folds to be applied on training dataset - when validation dataset is not provided. - :vartype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar latest_version: The latest version inside this container. + :vartype latest_version: str + :ivar next_version: The next auto incremental version. + :vartype next_version: str + :ivar provisioning_state: Provisioning state for the featurestore entity container. Possible + values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + """ + + _validation = { + 'latest_version': {'readonly': True}, + 'next_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'latest_version': {'key': 'latestVersion', 'type': 'str'}, + 'next_version': {'key': 'nextVersion', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_archived: Optional[bool] = False, + **kwargs + ): + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + """ + super(FeaturestoreEntityContainerProperties, self).__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) + self.provisioning_state = None + + +class FeaturestoreEntityContainerResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of FeaturestoreEntityContainer entities. + + :ivar next_link: The link to the next page of FeaturestoreEntityContainer objects. If null, + there are no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type FeaturestoreEntityContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[FeaturestoreEntityContainer]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["FeaturestoreEntityContainer"]] = None, + **kwargs + ): + """ + :keyword next_link: The link to the next page of FeaturestoreEntityContainer objects. If null, + there are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type FeaturestoreEntityContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + """ + super(FeaturestoreEntityContainerResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class FeaturestoreEntityVersion(ProxyResource): + """Azure Resource Manager resource envelope. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'FeaturestoreEntityVersionProperties'}, + } + + def __init__( + self, + *, + properties: "FeaturestoreEntityVersionProperties", + **kwargs + ): + """ + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersionProperties + """ + super(FeaturestoreEntityVersion, self).__init__(**kwargs) + self.properties = properties + + +class FeaturestoreEntityVersionProperties(AssetBase): + """DTO object representing feature entity version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar index_columns: Specifies index columns. + :vartype index_columns: list[~azure.mgmt.machinelearningservices.models.IndexColumn] + :ivar provisioning_state: Provisioning state for the featurestore entity version. Possible + values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar stage: Specifies the asset stage. + :vartype stage: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'index_columns': {'key': 'indexColumns', 'type': '[IndexColumn]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_anonymous: Optional[bool] = False, + is_archived: Optional[bool] = False, + index_columns: Optional[List["IndexColumn"]] = None, + stage: Optional[str] = None, + **kwargs + ): + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword index_columns: Specifies index columns. + :paramtype index_columns: list[~azure.mgmt.machinelearningservices.models.IndexColumn] + :keyword stage: Specifies the asset stage. + :paramtype stage: str + """ + super(FeaturestoreEntityVersionProperties, self).__init__(description=description, properties=properties, tags=tags, is_anonymous=is_anonymous, is_archived=is_archived, **kwargs) + self.index_columns = index_columns + self.provisioning_state = None + self.stage = stage + + +class FeaturestoreEntityVersionResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of FeaturestoreEntityVersion entities. + + :ivar next_link: The link to the next page of FeaturestoreEntityVersion objects. If null, there + are no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type FeaturestoreEntityVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[FeaturestoreEntityVersion]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["FeaturestoreEntityVersion"]] = None, + **kwargs + ): + """ + :keyword next_link: The link to the next page of FeaturestoreEntityVersion objects. If null, + there are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type FeaturestoreEntityVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + """ + super(FeaturestoreEntityVersionResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class FeatureStoreSettings(msrest.serialization.Model): + """FeatureStoreSettings. + + :ivar compute_runtime: + :vartype compute_runtime: ~azure.mgmt.machinelearningservices.models.ComputeRuntimeDto + :ivar offline_store_connection_name: + :vartype offline_store_connection_name: str + :ivar online_store_connection_name: + :vartype online_store_connection_name: str + """ + + _attribute_map = { + 'compute_runtime': {'key': 'computeRuntime', 'type': 'ComputeRuntimeDto'}, + 'offline_store_connection_name': {'key': 'offlineStoreConnectionName', 'type': 'str'}, + 'online_store_connection_name': {'key': 'onlineStoreConnectionName', 'type': 'str'}, + } + + def __init__( + self, + *, + compute_runtime: Optional["ComputeRuntimeDto"] = None, + offline_store_connection_name: Optional[str] = None, + online_store_connection_name: Optional[str] = None, + **kwargs + ): + """ + :keyword compute_runtime: + :paramtype compute_runtime: ~azure.mgmt.machinelearningservices.models.ComputeRuntimeDto + :keyword offline_store_connection_name: + :paramtype offline_store_connection_name: str + :keyword online_store_connection_name: + :paramtype online_store_connection_name: str + """ + super(FeatureStoreSettings, self).__init__(**kwargs) + self.compute_runtime = compute_runtime + self.offline_store_connection_name = offline_store_connection_name + self.online_store_connection_name = online_store_connection_name + + +class FeatureSubset(MonitoringFeatureFilterBase): + """FeatureSubset. + + All required parameters must be populated in order to send to Azure. + + :ivar filter_type: Required. [Required] Specifies the feature filter to leverage when selecting + features to calculate metrics over.Constant filled by server. Possible values include: + "AllFeatures", "TopNByAttribution", "FeatureSubset". + :vartype filter_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureFilterType + :ivar features: Required. [Required] The list of features to include. + :vartype features: list[str] + """ + + _validation = { + 'filter_type': {'required': True}, + 'features': {'required': True}, + } + + _attribute_map = { + 'filter_type': {'key': 'filterType', 'type': 'str'}, + 'features': {'key': 'features', 'type': '[str]'}, + } + + def __init__( + self, + *, + features: List[str], + **kwargs + ): + """ + :keyword features: Required. [Required] The list of features to include. + :paramtype features: list[str] + """ + super(FeatureSubset, self).__init__(**kwargs) + self.filter_type = 'FeatureSubset' # type: str + self.features = features + + +class FeatureWindow(msrest.serialization.Model): + """Specifies the feature window. + + :ivar feature_window_end: Specifies the feature window end time. + :vartype feature_window_end: ~datetime.datetime + :ivar feature_window_start: Specifies the feature window start time. + :vartype feature_window_start: ~datetime.datetime + """ + + _attribute_map = { + 'feature_window_end': {'key': 'featureWindowEnd', 'type': 'iso-8601'}, + 'feature_window_start': {'key': 'featureWindowStart', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + feature_window_end: Optional[datetime.datetime] = None, + feature_window_start: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword feature_window_end: Specifies the feature window end time. + :paramtype feature_window_end: ~datetime.datetime + :keyword feature_window_start: Specifies the feature window start time. + :paramtype feature_window_start: ~datetime.datetime + """ + super(FeatureWindow, self).__init__(**kwargs) + self.feature_window_end = feature_window_end + self.feature_window_start = feature_window_start + + +class FeaturizationSettings(msrest.serialization.Model): + """Featurization Configuration. + + :ivar dataset_language: Dataset language, useful for the text data. + :vartype dataset_language: str + """ + + _attribute_map = { + 'dataset_language': {'key': 'datasetLanguage', 'type': 'str'}, + } + + def __init__( + self, + *, + dataset_language: Optional[str] = None, + **kwargs + ): + """ + :keyword dataset_language: Dataset language, useful for the text data. + :paramtype dataset_language: str + """ + super(FeaturizationSettings, self).__init__(**kwargs) + self.dataset_language = dataset_language + + +class MonitoringInputDataBase(msrest.serialization.Model): + """Monitoring input data base definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: FixedInputData, RollingInputData, StaticInputData. + + All required parameters must be populated in order to send to Azure. + + :ivar columns: Mapping of column names to special uses. + :vartype columns: dict[str, str] + :ivar data_context: The context metadata of the data source. + :vartype data_context: str + :ivar input_data_type: Required. [Required] Specifies the type of signal to monitor.Constant + filled by server. Possible values include: "Static", "Rolling", "Fixed". + :vartype input_data_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringInputDataType + :ivar job_input_type: Required. [Required] Specifies the type of job. Possible values include: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar uri: Required. [Required] Input Asset URI. + :vartype uri: str + """ + + _validation = { + 'input_data_type': {'required': True}, + 'job_input_type': {'required': True}, + 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '{str}'}, + 'data_context': {'key': 'dataContext', 'type': 'str'}, + 'input_data_type': {'key': 'inputDataType', 'type': 'str'}, + 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + } + + _subtype_map = { + 'input_data_type': {'Fixed': 'FixedInputData', 'Rolling': 'RollingInputData', 'Static': 'StaticInputData'} + } + + def __init__( + self, + *, + job_input_type: Union[str, "JobInputType"], + uri: str, + columns: Optional[Dict[str, str]] = None, + data_context: Optional[str] = None, + **kwargs + ): + """ + :keyword columns: Mapping of column names to special uses. + :paramtype columns: dict[str, str] + :keyword data_context: The context metadata of the data source. + :paramtype data_context: str + :keyword job_input_type: Required. [Required] Specifies the type of job. Possible values + include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", + "triton_model". + :paramtype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :keyword uri: Required. [Required] Input Asset URI. + :paramtype uri: str + """ + super(MonitoringInputDataBase, self).__init__(**kwargs) + self.columns = columns + self.data_context = data_context + self.input_data_type = None # type: Optional[str] + self.job_input_type = job_input_type + self.uri = uri + + +class FixedInputData(MonitoringInputDataBase): + """Fixed input data definition. + + All required parameters must be populated in order to send to Azure. + + :ivar columns: Mapping of column names to special uses. + :vartype columns: dict[str, str] + :ivar data_context: The context metadata of the data source. + :vartype data_context: str + :ivar input_data_type: Required. [Required] Specifies the type of signal to monitor.Constant + filled by server. Possible values include: "Static", "Rolling", "Fixed". + :vartype input_data_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringInputDataType + :ivar job_input_type: Required. [Required] Specifies the type of job. Possible values include: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar uri: Required. [Required] Input Asset URI. + :vartype uri: str + """ + + _validation = { + 'input_data_type': {'required': True}, + 'job_input_type': {'required': True}, + 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'columns': {'key': 'columns', 'type': '{str}'}, + 'data_context': {'key': 'dataContext', 'type': 'str'}, + 'input_data_type': {'key': 'inputDataType', 'type': 'str'}, + 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__( + self, + *, + job_input_type: Union[str, "JobInputType"], + uri: str, + columns: Optional[Dict[str, str]] = None, + data_context: Optional[str] = None, + **kwargs + ): + """ + :keyword columns: Mapping of column names to special uses. + :paramtype columns: dict[str, str] + :keyword data_context: The context metadata of the data source. + :paramtype data_context: str + :keyword job_input_type: Required. [Required] Specifies the type of job. Possible values + include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", + "triton_model". + :paramtype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :keyword uri: Required. [Required] Input Asset URI. + :paramtype uri: str + """ + super(FixedInputData, self).__init__(columns=columns, data_context=data_context, job_input_type=job_input_type, uri=uri, **kwargs) + self.input_data_type = 'Fixed' # type: str + + +class FlavorData(msrest.serialization.Model): + """FlavorData. + + :ivar data: Model flavor-specific data. + :vartype data: dict[str, str] + """ + + _attribute_map = { + 'data': {'key': 'data', 'type': '{str}'}, + } + + def __init__( + self, + *, + data: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword data: Model flavor-specific data. + :paramtype data: dict[str, str] + """ + super(FlavorData, self).__init__(**kwargs) + self.data = data + + +class Forecasting(AutoMLVertical, TableVertical): + """Forecasting task in AutoML Table vertical. + + All required parameters must be populated in order to send to Azure. + + :ivar cv_split_column_names: Columns to use for CVSplit data. + :vartype cv_split_column_names: list[str] + :ivar featurization_settings: Featurization inputs needed for AutoML job. + :vartype featurization_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :ivar limit_settings: Execution constraints for AutoMLJob. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :ivar n_cross_validations: Number of cross validation folds to be applied on training dataset + when validation dataset is not provided. + :vartype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations :ivar test_data: Test data input. :vartype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :ivar test_data_size: The fraction of test dataset that needs to be set aside for validation @@ -13830,58 +15155,58 @@ def __init__( class FQDNEndpoints(msrest.serialization.Model): """FQDNEndpoints. - :ivar properties: - :vartype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpointsProperties + :ivar category: + :vartype category: str + :ivar endpoints: + :vartype endpoints: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoint] """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'FQDNEndpointsProperties'}, + 'category': {'key': 'category', 'type': 'str'}, + 'endpoints': {'key': 'endpoints', 'type': '[FQDNEndpoint]'}, } def __init__( self, *, - properties: Optional["FQDNEndpointsProperties"] = None, + category: Optional[str] = None, + endpoints: Optional[List["FQDNEndpoint"]] = None, **kwargs ): """ - :keyword properties: - :paramtype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpointsProperties + :keyword category: + :paramtype category: str + :keyword endpoints: + :paramtype endpoints: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoint] """ super(FQDNEndpoints, self).__init__(**kwargs) - self.properties = properties + self.category = category + self.endpoints = endpoints -class FQDNEndpointsProperties(msrest.serialization.Model): - """FQDNEndpointsProperties. +class FQDNEndpointsPropertyBag(msrest.serialization.Model): + """Property bag for FQDN endpoints result. - :ivar category: - :vartype category: str - :ivar endpoints: - :vartype endpoints: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoint] + :ivar properties: + :vartype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpoints """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[FQDNEndpoint]'}, + 'properties': {'key': 'properties', 'type': 'FQDNEndpoints'}, } def __init__( self, *, - category: Optional[str] = None, - endpoints: Optional[List["FQDNEndpoint"]] = None, + properties: Optional["FQDNEndpoints"] = None, **kwargs ): """ - :keyword category: - :paramtype category: str - :keyword endpoints: - :paramtype endpoints: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoint] + :keyword properties: + :paramtype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpoints """ - super(FQDNEndpointsProperties, self).__init__(**kwargs) - self.category = category - self.endpoints = endpoints + super(FQDNEndpointsPropertyBag, self).__init__(**kwargs) + self.properties = properties class OutboundRule(msrest.serialization.Model): @@ -13890,11 +15215,15 @@ class OutboundRule(msrest.serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: FqdnOutboundRule, PrivateEndpointOutboundRule, ServiceTagOutboundRule. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. Possible values include: "Required", "Recommended", "UserDefined", "Dependency". :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :ivar parent_rule_names: + :vartype parent_rule_names: list[str] :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Possible values include: "Inactive", "Active". :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus @@ -13905,11 +15234,13 @@ class OutboundRule(msrest.serialization.Model): """ _validation = { + 'parent_rule_names': {'readonly': True}, 'type': {'required': True}, } _attribute_map = { 'category': {'key': 'category', 'type': 'str'}, + 'parent_rule_names': {'key': 'parentRuleNames', 'type': '[str]'}, 'status': {'key': 'status', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } @@ -13935,6 +15266,7 @@ def __init__( """ super(OutboundRule, self).__init__(**kwargs) self.category = category + self.parent_rule_names = None self.status = status self.type = None # type: Optional[str] @@ -13942,11 +15274,15 @@ def __init__( class FqdnOutboundRule(OutboundRule): """FQDN Outbound Rule for the managed network of a machine learning workspace. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. Possible values include: "Required", "Recommended", "UserDefined", "Dependency". :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :ivar parent_rule_names: + :vartype parent_rule_names: list[str] :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Possible values include: "Inactive", "Active". :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus @@ -13959,11 +15295,13 @@ class FqdnOutboundRule(OutboundRule): """ _validation = { + 'parent_rule_names': {'readonly': True}, 'type': {'required': True}, } _attribute_map = { 'category': {'key': 'category', 'type': 'str'}, + 'parent_rule_names': {'key': 'parentRuleNames', 'type': '[str]'}, 'status': {'key': 'status', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'destination': {'key': 'destination', 'type': 'str'}, @@ -14322,10 +15660,10 @@ def __init__( class IdentityForCmk(msrest.serialization.Model): - """Identity that will be used to access key vault for encryption at rest. + """Identity object used for encryption. - :ivar user_assigned_identity: The ArmId of the user assigned identity that will be used to - access the customer managed key vault. + :ivar user_assigned_identity: UserAssignedIdentity to be used to fetch the encryption key from + keyVault. :vartype user_assigned_identity: str """ @@ -14340,8 +15678,8 @@ def __init__( **kwargs ): """ - :keyword user_assigned_identity: The ArmId of the user assigned identity that will be used to - access the customer managed key vault. + :keyword user_assigned_identity: UserAssignedIdentity to be used to fetch the encryption key + from keyVault. :paramtype user_assigned_identity: str """ super(IdentityForCmk, self).__init__(**kwargs) @@ -14376,22 +15714,26 @@ def __init__( class Image(msrest.serialization.Model): - """Describes the Image Specifications. + """Image. :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. :vartype additional_properties: dict[str, any] :ivar type: Type of the image. Possible values are: docker - For docker images. azureml - For - AzureML images. Possible values include: "docker", "azureml". Default value: "docker". + AzureML Environment images (custom and curated). Possible values include: "docker", "azureml". + Default value: "docker". :vartype type: str or ~azure.mgmt.machinelearningservices.models.ImageType - :ivar reference: Image reference. + :ivar reference: Image reference URL if type is docker. Environment name if type is azureml. :vartype reference: str + :ivar version: Version of image being used. If latest then skip this field. + :vartype version: str """ _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, 'type': {'key': 'type', 'type': 'str'}, 'reference': {'key': 'reference', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, } def __init__( @@ -14400,6 +15742,7 @@ def __init__( additional_properties: Optional[Dict[str, Any]] = None, type: Optional[Union[str, "ImageType"]] = "docker", reference: Optional[str] = None, + version: Optional[str] = None, **kwargs ): """ @@ -14407,15 +15750,19 @@ def __init__( collection. :paramtype additional_properties: dict[str, any] :keyword type: Type of the image. Possible values are: docker - For docker images. azureml - - For AzureML images. Possible values include: "docker", "azureml". Default value: "docker". + For AzureML Environment images (custom and curated). Possible values include: "docker", + "azureml". Default value: "docker". :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ImageType - :keyword reference: Image reference. + :keyword reference: Image reference URL if type is docker. Environment name if type is azureml. :paramtype reference: str + :keyword version: Version of image being used. If latest then skip this field. + :paramtype version: str """ super(Image, self).__init__(**kwargs) self.additional_properties = additional_properties self.type = type self.reference = reference + self.version = version class ImageVertical(msrest.serialization.Model): @@ -15043,6 +16390,8 @@ def __init__( class ImageMetadata(msrest.serialization.Model): """Returns metadata about the operating system image for this compute instance. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar current_image_version: Specifies the current operating system image version this compute instance is running on. :vartype current_image_version: str @@ -15051,12 +16400,19 @@ class ImageMetadata(msrest.serialization.Model): :ivar is_latest_os_image_version: Specifies whether this compute instance is running on the latest operating system image. :vartype is_latest_os_image_version: bool + :ivar os_patching_status: Metadata about the os patching. + :vartype os_patching_status: ~azure.mgmt.machinelearningservices.models.OsPatchingStatus """ + _validation = { + 'os_patching_status': {'readonly': True}, + } + _attribute_map = { 'current_image_version': {'key': 'currentImageVersion', 'type': 'str'}, 'latest_image_version': {'key': 'latestImageVersion', 'type': 'str'}, 'is_latest_os_image_version': {'key': 'isLatestOsImageVersion', 'type': 'bool'}, + 'os_patching_status': {'key': 'osPatchingStatus', 'type': 'OsPatchingStatus'}, } def __init__( @@ -15081,6 +16437,7 @@ def __init__( self.current_image_version = current_image_version self.latest_image_version = latest_image_version self.is_latest_os_image_version = is_latest_os_image_version + self.os_patching_status = None class ImageModelDistributionSettings(msrest.serialization.Model): @@ -17560,34 +18917,121 @@ class JobService(msrest.serialization.Model): def __init__( self, *, - endpoint: Optional[str] = None, - job_service_type: Optional[str] = None, - nodes: Optional["Nodes"] = None, - port: Optional[int] = None, - properties: Optional[Dict[str, str]] = None, + endpoint: Optional[str] = None, + job_service_type: Optional[str] = None, + nodes: Optional["Nodes"] = None, + port: Optional[int] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword endpoint: Url for endpoint. + :paramtype endpoint: str + :keyword job_service_type: Endpoint type. + :paramtype job_service_type: str + :keyword nodes: Nodes that user would like to start the service on. + If Nodes is not set or set to null, the service will only be started on leader node. + :paramtype nodes: ~azure.mgmt.machinelearningservices.models.Nodes + :keyword port: Port for endpoint. + :paramtype port: int + :keyword properties: Additional properties to set on the endpoint. + :paramtype properties: dict[str, str] + """ + super(JobService, self).__init__(**kwargs) + self.endpoint = endpoint + self.error_message = None + self.job_service_type = job_service_type + self.nodes = nodes + self.port = port + self.properties = properties + self.status = None + + +class JupyterKernelConfig(msrest.serialization.Model): + """Jupyter kernel configuration. + + :ivar argv: Argument to the the runtime. + :vartype argv: list[str] + :ivar display_name: Display name of the kernel. + :vartype display_name: str + :ivar language: Language of the kernel [Example value: python]. + :vartype language: str + """ + + _attribute_map = { + 'argv': {'key': 'argv', 'type': '[str]'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__( + self, + *, + argv: Optional[List[str]] = None, + display_name: Optional[str] = None, + language: Optional[str] = None, + **kwargs + ): + """ + :keyword argv: Argument to the the runtime. + :paramtype argv: list[str] + :keyword display_name: Display name of the kernel. + :paramtype display_name: str + :keyword language: Language of the kernel [Example value: python]. + :paramtype language: str + """ + super(JupyterKernelConfig, self).__init__(**kwargs) + self.argv = argv + self.display_name = display_name + self.language = language + + +class KeyVaultProperties(msrest.serialization.Model): + """Customer Key vault properties. + + All required parameters must be populated in order to send to Azure. + + :ivar identity_client_id: Currently, we support only SystemAssigned MSI. + We need this when we support UserAssignedIdentities. + :vartype identity_client_id: str + :ivar key_identifier: Required. KeyVault key identifier to encrypt the data. + :vartype key_identifier: str + :ivar key_vault_arm_id: Required. KeyVault Arm Id that contains the data encryption key. + :vartype key_vault_arm_id: str + """ + + _validation = { + 'key_identifier': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'key_vault_arm_id': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'identity_client_id': {'key': 'identityClientId', 'type': 'str'}, + 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, + 'key_vault_arm_id': {'key': 'keyVaultArmId', 'type': 'str'}, + } + + def __init__( + self, + *, + key_identifier: str, + key_vault_arm_id: str, + identity_client_id: Optional[str] = None, **kwargs ): """ - :keyword endpoint: Url for endpoint. - :paramtype endpoint: str - :keyword job_service_type: Endpoint type. - :paramtype job_service_type: str - :keyword nodes: Nodes that user would like to start the service on. - If Nodes is not set or set to null, the service will only be started on leader node. - :paramtype nodes: ~azure.mgmt.machinelearningservices.models.Nodes - :keyword port: Port for endpoint. - :paramtype port: int - :keyword properties: Additional properties to set on the endpoint. - :paramtype properties: dict[str, str] + :keyword identity_client_id: Currently, we support only SystemAssigned MSI. + We need this when we support UserAssignedIdentities. + :paramtype identity_client_id: str + :keyword key_identifier: Required. KeyVault key identifier to encrypt the data. + :paramtype key_identifier: str + :keyword key_vault_arm_id: Required. KeyVault Arm Id that contains the data encryption key. + :paramtype key_vault_arm_id: str """ - super(JobService, self).__init__(**kwargs) - self.endpoint = endpoint - self.error_message = None - self.job_service_type = job_service_type - self.nodes = nodes - self.port = port - self.properties = properties - self.status = None + super(KeyVaultProperties, self).__init__(**kwargs) + self.identity_client_id = identity_client_id + self.key_identifier = key_identifier + self.key_vault_arm_id = key_vault_arm_id class KubernetesSchema(msrest.serialization.Model): @@ -18224,9 +19668,9 @@ class ListNotebookKeysResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar primary_access_key: + :ivar primary_access_key: The primary access key of the Notebook. :vartype primary_access_key: str - :ivar secondary_access_key: + :ivar secondary_access_key: The secondary access key of the Notebook. :vartype secondary_access_key: str """ @@ -18256,7 +19700,7 @@ class ListStorageAccountKeysResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar user_storage_key: + :ivar user_storage_key: The access key of the storage. :vartype user_storage_key: str """ @@ -18316,11 +19760,7 @@ class ListWorkspaceKeysResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar user_storage_key: - :vartype user_storage_key: str - :ivar user_storage_resource_id: - :vartype user_storage_resource_id: str - :ivar app_insights_instrumentation_key: + :ivar app_insights_instrumentation_key: The access key of the workspace app insights. :vartype app_insights_instrumentation_key: str :ivar container_registry_credentials: :vartype container_registry_credentials: @@ -18328,36 +19768,47 @@ class ListWorkspaceKeysResult(msrest.serialization.Model): :ivar notebook_access_keys: :vartype notebook_access_keys: ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult + :ivar user_storage_arm_id: The arm Id key of the workspace storage. + :vartype user_storage_arm_id: str + :ivar user_storage_key: The access key of the workspace storage. + :vartype user_storage_key: str """ _validation = { - 'user_storage_key': {'readonly': True}, - 'user_storage_resource_id': {'readonly': True}, 'app_insights_instrumentation_key': {'readonly': True}, - 'container_registry_credentials': {'readonly': True}, - 'notebook_access_keys': {'readonly': True}, + 'user_storage_arm_id': {'readonly': True}, + 'user_storage_key': {'readonly': True}, } _attribute_map = { - 'user_storage_key': {'key': 'userStorageKey', 'type': 'str'}, - 'user_storage_resource_id': {'key': 'userStorageResourceId', 'type': 'str'}, 'app_insights_instrumentation_key': {'key': 'appInsightsInstrumentationKey', 'type': 'str'}, 'container_registry_credentials': {'key': 'containerRegistryCredentials', 'type': 'RegistryListCredentialsResult'}, 'notebook_access_keys': {'key': 'notebookAccessKeys', 'type': 'ListNotebookKeysResult'}, + 'user_storage_arm_id': {'key': 'userStorageArmId', 'type': 'str'}, + 'user_storage_key': {'key': 'userStorageKey', 'type': 'str'}, } def __init__( self, + *, + container_registry_credentials: Optional["RegistryListCredentialsResult"] = None, + notebook_access_keys: Optional["ListNotebookKeysResult"] = None, **kwargs ): """ + :keyword container_registry_credentials: + :paramtype container_registry_credentials: + ~azure.mgmt.machinelearningservices.models.RegistryListCredentialsResult + :keyword notebook_access_keys: + :paramtype notebook_access_keys: + ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult """ super(ListWorkspaceKeysResult, self).__init__(**kwargs) - self.user_storage_key = None - self.user_storage_resource_id = None self.app_insights_instrumentation_key = None - self.container_registry_credentials = None - self.notebook_access_keys = None + self.container_registry_credentials = container_registry_credentials + self.notebook_access_keys = notebook_access_keys + self.user_storage_arm_id = None + self.user_storage_key = None class ListWorkspaceQuotas(msrest.serialization.Model): @@ -18545,7 +19996,7 @@ class ManagedIdentityAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPr :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -18560,10 +20011,12 @@ class ManagedIdentityAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPr "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -18571,16 +20024,18 @@ class ManagedIdentityAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPr :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionManagedIdentity @@ -18596,14 +20051,16 @@ class ManagedIdentityAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPr 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionManagedIdentity'}, } @@ -18611,20 +20068,22 @@ def __init__( self, *, category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, credentials: Optional["WorkspaceConnectionManagedIdentity"] = None, **kwargs ): """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -18639,28 +20098,32 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionManagedIdentity """ - super(ManagedIdentityAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, target=target, metadata=metadata, shared_user_list=shared_user_list, value=value, value_format=value_format, **kwargs) + super(ManagedIdentityAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, error=error, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, metadata=metadata, pe_requirement=pe_requirement, pe_status=pe_status, shared_user_list=shared_user_list, target=target, use_workspace_managed_identity=use_workspace_managed_identity, **kwargs) self.auth_type = 'ManagedIdentity' # type: str self.credentials = credentials @@ -18813,10 +20276,14 @@ class ManagedNetworkSettings(msrest.serialization.Model): :ivar status: Status of the Provisioning for the managed network of a machine learning workspace. :vartype status: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus + :ivar changeable_isolation_modes: + :vartype changeable_isolation_modes: list[str or + ~azure.mgmt.machinelearningservices.models.IsolationMode] """ _validation = { 'network_id': {'readonly': True}, + 'changeable_isolation_modes': {'readonly': True}, } _attribute_map = { @@ -18824,6 +20291,7 @@ class ManagedNetworkSettings(msrest.serialization.Model): 'network_id': {'key': 'networkId', 'type': 'str'}, 'outbound_rules': {'key': 'outboundRules', 'type': '{OutboundRule}'}, 'status': {'key': 'status', 'type': 'ManagedNetworkProvisionStatus'}, + 'changeable_isolation_modes': {'key': 'changeableIsolationModes', 'type': '[str]'}, } def __init__( @@ -18850,6 +20318,7 @@ def __init__( self.network_id = None self.outbound_rules = outbound_rules self.status = status + self.changeable_isolation_modes = None class ManagedOnlineDeployment(OnlineDeploymentProperties): @@ -18908,92 +20377,346 @@ class ManagedOnlineDeployment(OnlineDeploymentProperties): """ _validation = { - 'endpoint_compute_type': {'required': True}, - 'provisioning_state': {'readonly': True}, + 'endpoint_compute_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'code_configuration': {'key': 'codeConfiguration', 'type': 'CodeConfiguration'}, + 'description': {'key': 'description', 'type': 'str'}, + 'environment_id': {'key': 'environmentId', 'type': 'str'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'app_insights_enabled': {'key': 'appInsightsEnabled', 'type': 'bool'}, + 'data_collector': {'key': 'dataCollector', 'type': 'DataCollector'}, + 'egress_public_network_access': {'key': 'egressPublicNetworkAccess', 'type': 'str'}, + 'endpoint_compute_type': {'key': 'endpointComputeType', 'type': 'str'}, + 'instance_type': {'key': 'instanceType', 'type': 'str'}, + 'liveness_probe': {'key': 'livenessProbe', 'type': 'ProbeSettings'}, + 'model': {'key': 'model', 'type': 'str'}, + 'model_mount_path': {'key': 'modelMountPath', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'readiness_probe': {'key': 'readinessProbe', 'type': 'ProbeSettings'}, + 'request_settings': {'key': 'requestSettings', 'type': 'OnlineRequestSettings'}, + 'scale_settings': {'key': 'scaleSettings', 'type': 'OnlineScaleSettings'}, + } + + def __init__( + self, + *, + code_configuration: Optional["CodeConfiguration"] = None, + description: Optional[str] = None, + environment_id: Optional[str] = None, + environment_variables: Optional[Dict[str, str]] = None, + properties: Optional[Dict[str, str]] = None, + app_insights_enabled: Optional[bool] = False, + data_collector: Optional["DataCollector"] = None, + egress_public_network_access: Optional[Union[str, "EgressPublicNetworkAccessType"]] = None, + instance_type: Optional[str] = None, + liveness_probe: Optional["ProbeSettings"] = None, + model: Optional[str] = None, + model_mount_path: Optional[str] = None, + readiness_probe: Optional["ProbeSettings"] = None, + request_settings: Optional["OnlineRequestSettings"] = None, + scale_settings: Optional["OnlineScaleSettings"] = None, + **kwargs + ): + """ + :keyword code_configuration: Code configuration for the endpoint deployment. + :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration + :keyword description: Description of the endpoint deployment. + :paramtype description: str + :keyword environment_id: ARM resource ID or AssetId of the environment specification for the + endpoint deployment. + :paramtype environment_id: str + :keyword environment_variables: Environment variables configuration for the deployment. + :paramtype environment_variables: dict[str, str] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword app_insights_enabled: If true, enables Application Insights logging. + :paramtype app_insights_enabled: bool + :keyword data_collector: The mdc configuration, we disable mdc when it's null. + :paramtype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :keyword egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", + "Disabled". + :paramtype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :keyword instance_type: Compute instance type. + :paramtype instance_type: str + :keyword liveness_probe: Liveness probe monitors the health of the container regularly. + :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword model: The URI path to the model. + :paramtype model: str + :keyword model_mount_path: The path to mount the model in custom container. + :paramtype model_mount_path: str + :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword request_settings: Request settings for the deployment. + :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :keyword scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + """ + super(ManagedOnlineDeployment, self).__init__(code_configuration=code_configuration, description=description, environment_id=environment_id, environment_variables=environment_variables, properties=properties, app_insights_enabled=app_insights_enabled, data_collector=data_collector, egress_public_network_access=egress_public_network_access, instance_type=instance_type, liveness_probe=liveness_probe, model=model, model_mount_path=model_mount_path, readiness_probe=readiness_probe, request_settings=request_settings, scale_settings=scale_settings, **kwargs) + self.endpoint_compute_type = 'Managed' # type: str + + +class ManagedOnlineEndpointDeploymentResourceProperties(EndpointDeploymentResourceProperties): + """ManagedOnlineEndpointDeploymentResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Required. Kind of the deployment.Constant filled by server. + :vartype type: str + :ivar endpoint_compute_type: Enum to determine endpoint compute type. Possible values include: + "Managed", "Kubernetes", "AzureMLCompute". + :vartype endpoint_compute_type: str or + ~azure.mgmt.machinelearningservices.models.EndpointComputeType + :ivar model: + :vartype model: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'endpoint_compute_type': {'key': 'endpointComputeType', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'str'}, + } + + def __init__( + self, + *, + failure_reason: Optional[str] = None, + endpoint_compute_type: Optional[Union[str, "EndpointComputeType"]] = None, + model: Optional[str] = None, + **kwargs + ): + """ + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword endpoint_compute_type: Enum to determine endpoint compute type. Possible values + include: "Managed", "Kubernetes", "AzureMLCompute". + :paramtype endpoint_compute_type: str or + ~azure.mgmt.machinelearningservices.models.EndpointComputeType + :keyword model: + :paramtype model: str + """ + super(ManagedOnlineEndpointDeploymentResourceProperties, self).__init__(failure_reason=failure_reason, **kwargs) + self.type = 'managedOnlineEndpoint' # type: str + self.endpoint_compute_type = endpoint_compute_type + self.model = model + + +class ManagedOnlineEndpointResourceProperties(EndpointResourceProperties): + """ManagedOnlineEndpointResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Required. Type of the endpoint.Constant filled by server. Possible values + include: "Azure.OpenAI", "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", + "managedOnlineEndpoint", "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool + :ivar auth_mode: Enum to determine endpoint authentication mode. Possible values include: + "AMLToken", "Key", "AADToken". + :vartype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode + :ivar compute: + :vartype compute: str + :ivar description: + :vartype description: str + :ivar mirror_traffic: Dictionary of :code:``. + :vartype mirror_traffic: dict[str, int] + :ivar scoring_uri: + :vartype scoring_uri: str + :ivar traffic: Dictionary of :code:``. + :vartype traffic: dict[str, int] + """ + + _validation = { + 'endpoint_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'associated_resource_id': {'key': 'associatedResourceId', 'type': 'str'}, + 'deployments': {'key': 'deployments', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'should_create_ai_services_endpoint': {'key': 'shouldCreateAiServicesEndpoint', 'type': 'bool'}, + 'auth_mode': {'key': 'authMode', 'type': 'str'}, + 'compute': {'key': 'compute', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'mirror_traffic': {'key': 'mirrorTraffic', 'type': '{int}'}, + 'scoring_uri': {'key': 'scoringUri', 'type': 'str'}, + 'traffic': {'key': 'traffic', 'type': '{int}'}, + } + + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + deployments: Optional[List["EndpointDeploymentResourcePropertiesBasicResource"]] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + should_create_ai_services_endpoint: Optional[bool] = None, + auth_mode: Optional[Union[str, "EndpointAuthMode"]] = None, + compute: Optional[str] = None, + description: Optional[str] = None, + mirror_traffic: Optional[Dict[str, int]] = None, + scoring_uri: Optional[str] = None, + traffic: Optional[Dict[str, int]] = None, + **kwargs + ): + """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + :keyword auth_mode: Enum to determine endpoint authentication mode. Possible values include: + "AMLToken", "Key", "AADToken". + :paramtype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode + :keyword compute: + :paramtype compute: str + :keyword description: + :paramtype description: str + :keyword mirror_traffic: Dictionary of :code:``. + :paramtype mirror_traffic: dict[str, int] + :keyword scoring_uri: + :paramtype scoring_uri: str + :keyword traffic: Dictionary of :code:``. + :paramtype traffic: dict[str, int] + """ + super(ManagedOnlineEndpointResourceProperties, self).__init__(associated_resource_id=associated_resource_id, deployments=deployments, endpoint_uri=endpoint_uri, failure_reason=failure_reason, location=location, name=name, should_create_ai_services_endpoint=should_create_ai_services_endpoint, **kwargs) + self.endpoint_type = 'managedOnlineEndpoint' # type: str + self.auth_mode = auth_mode + self.compute = compute + self.description = description + self.mirror_traffic = mirror_traffic + self.scoring_uri = scoring_uri + self.traffic = traffic + + +class ManagedResourceGroupAssignedIdentities(msrest.serialization.Model): + """Details for managed resource group assigned identities. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Identity principal Id. + :vartype principal_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, } _attribute_map = { - 'code_configuration': {'key': 'codeConfiguration', 'type': 'CodeConfiguration'}, - 'description': {'key': 'description', 'type': 'str'}, - 'environment_id': {'key': 'environmentId', 'type': 'str'}, - 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'app_insights_enabled': {'key': 'appInsightsEnabled', 'type': 'bool'}, - 'data_collector': {'key': 'dataCollector', 'type': 'DataCollector'}, - 'egress_public_network_access': {'key': 'egressPublicNetworkAccess', 'type': 'str'}, - 'endpoint_compute_type': {'key': 'endpointComputeType', 'type': 'str'}, - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'liveness_probe': {'key': 'livenessProbe', 'type': 'ProbeSettings'}, - 'model': {'key': 'model', 'type': 'str'}, - 'model_mount_path': {'key': 'modelMountPath', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'readiness_probe': {'key': 'readinessProbe', 'type': 'ProbeSettings'}, - 'request_settings': {'key': 'requestSettings', 'type': 'OnlineRequestSettings'}, - 'scale_settings': {'key': 'scaleSettings', 'type': 'OnlineScaleSettings'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ManagedResourceGroupAssignedIdentities, self).__init__(**kwargs) + self.principal_id = None + + +class ManagedResourceGroupSettings(msrest.serialization.Model): + """Managed resource group settings. + + :ivar assigned_identities: List of assigned identities for the managed resource group. + :vartype assigned_identities: + list[~azure.mgmt.machinelearningservices.models.ManagedResourceGroupAssignedIdentities] + """ + + _attribute_map = { + 'assigned_identities': {'key': 'assignedIdentities', 'type': '[ManagedResourceGroupAssignedIdentities]'}, } def __init__( self, *, - code_configuration: Optional["CodeConfiguration"] = None, - description: Optional[str] = None, - environment_id: Optional[str] = None, - environment_variables: Optional[Dict[str, str]] = None, - properties: Optional[Dict[str, str]] = None, - app_insights_enabled: Optional[bool] = False, - data_collector: Optional["DataCollector"] = None, - egress_public_network_access: Optional[Union[str, "EgressPublicNetworkAccessType"]] = None, - instance_type: Optional[str] = None, - liveness_probe: Optional["ProbeSettings"] = None, - model: Optional[str] = None, - model_mount_path: Optional[str] = None, - readiness_probe: Optional["ProbeSettings"] = None, - request_settings: Optional["OnlineRequestSettings"] = None, - scale_settings: Optional["OnlineScaleSettings"] = None, + assigned_identities: Optional[List["ManagedResourceGroupAssignedIdentities"]] = None, **kwargs ): """ - :keyword code_configuration: Code configuration for the endpoint deployment. - :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration - :keyword description: Description of the endpoint deployment. - :paramtype description: str - :keyword environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. - :paramtype environment_id: str - :keyword environment_variables: Environment variables configuration for the deployment. - :paramtype environment_variables: dict[str, str] - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. - :paramtype properties: dict[str, str] - :keyword app_insights_enabled: If true, enables Application Insights logging. - :paramtype app_insights_enabled: bool - :keyword data_collector: The mdc configuration, we disable mdc when it's null. - :paramtype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector - :keyword egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Possible values include: "Enabled", - "Disabled". - :paramtype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :keyword instance_type: Compute instance type. - :paramtype instance_type: str - :keyword liveness_probe: Liveness probe monitors the health of the container regularly. - :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword model: The URI path to the model. - :paramtype model: str - :keyword model_mount_path: The path to mount the model in custom container. - :paramtype model_mount_path: str - :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword request_settings: Request settings for the deployment. - :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :keyword scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + :keyword assigned_identities: List of assigned identities for the managed resource group. + :paramtype assigned_identities: + list[~azure.mgmt.machinelearningservices.models.ManagedResourceGroupAssignedIdentities] """ - super(ManagedOnlineDeployment, self).__init__(code_configuration=code_configuration, description=description, environment_id=environment_id, environment_variables=environment_variables, properties=properties, app_insights_enabled=app_insights_enabled, data_collector=data_collector, egress_public_network_access=egress_public_network_access, instance_type=instance_type, liveness_probe=liveness_probe, model=model, model_mount_path=model_mount_path, readiness_probe=readiness_probe, request_settings=request_settings, scale_settings=scale_settings, **kwargs) - self.endpoint_compute_type = 'Managed' # type: str + super(ManagedResourceGroupSettings, self).__init__(**kwargs) + self.assigned_identities = assigned_identities class ManagedServiceIdentity(msrest.serialization.Model): @@ -19358,12 +21081,194 @@ def __init__( :keyword evaluation_interval: Interval (number of runs) between policy evaluations. :paramtype evaluation_interval: int """ - super(MedianStoppingPolicy, self).__init__(delay_evaluation=delay_evaluation, evaluation_interval=evaluation_interval, **kwargs) - self.policy_type = 'MedianStopping' # type: str + super(MedianStoppingPolicy, self).__init__(delay_evaluation=delay_evaluation, evaluation_interval=evaluation_interval, **kwargs) + self.policy_type = 'MedianStopping' # type: str + + +class MLFlowModelJobInput(JobInput, AssetJobInput): + """MLFlowModelJobInput. + + All required parameters must be populated in order to send to Azure. + + :ivar mode: Input Asset Delivery Mode. Possible values include: "ReadOnlyMount", + "ReadWriteMount", "Download", "Direct", "EvalMount", "EvalDownload". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode + :ivar uri: Required. [Required] Input Asset URI. + :vartype uri: str + :ivar description: Description for the input. + :vartype description: str + :ivar job_input_type: Required. [Required] Specifies the type of job.Constant filled by server. + Possible values include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", + "mlflow_model", "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + """ + + _validation = { + 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'job_input_type': {'required': True}, + } + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: str, + mode: Optional[Union[str, "InputDeliveryMode"]] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword mode: Input Asset Delivery Mode. Possible values include: "ReadOnlyMount", + "ReadWriteMount", "Download", "Direct", "EvalMount", "EvalDownload". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode + :keyword uri: Required. [Required] Input Asset URI. + :paramtype uri: str + :keyword description: Description for the input. + :paramtype description: str + """ + super(MLFlowModelJobInput, self).__init__(description=description, mode=mode, uri=uri, **kwargs) + self.mode = mode + self.uri = uri + self.job_input_type = 'mlflow_model' # type: str + self.description = description + + +class MLFlowModelJobOutput(JobOutput, AssetJobOutput): + """MLFlowModelJobOutput. + + All required parameters must be populated in order to send to Azure. + + :ivar mode: Output Asset Delivery Mode. Possible values include: "ReadWriteMount", "Upload", + "Direct". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :ivar uri: Output Asset URI. + :vartype uri: str + :ivar description: Description for the output. + :vartype description: str + :ivar job_output_type: Required. [Required] Specifies the type of job.Constant filled by + server. Possible values include: "uri_file", "uri_folder", "mltable", "custom_model", + "mlflow_model", "triton_model". + :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType + """ + + _validation = { + 'job_output_type': {'required': True}, + } + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'job_output_type': {'key': 'jobOutputType', 'type': 'str'}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "OutputDeliveryMode"]] = None, + uri: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword mode: Output Asset Delivery Mode. Possible values include: "ReadWriteMount", "Upload", + "Direct". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode + :keyword uri: Output Asset URI. + :paramtype uri: str + :keyword description: Description for the output. + :paramtype description: str + """ + super(MLFlowModelJobOutput, self).__init__(description=description, mode=mode, uri=uri, **kwargs) + self.mode = mode + self.uri = uri + self.job_output_type = 'mlflow_model' # type: str + self.description = description + + +class MLTableData(DataVersionBaseProperties): + """MLTable data definition. + + All required parameters must be populated in order to send to Azure. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar data_type: Required. [Required] Specifies the type of data.Constant filled by server. + Possible values include: "uri_file", "uri_folder", "mltable". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.DataType + :ivar data_uri: Required. [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. + :vartype data_uri: str + :ivar referenced_uris: Uris referenced in the MLTable definition (required for lineage). + :vartype referenced_uris: list[str] + """ + + _validation = { + 'data_type': {'required': True}, + 'data_uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'data_uri': {'key': 'dataUri', 'type': 'str'}, + 'referenced_uris': {'key': 'referencedUris', 'type': '[str]'}, + } + + def __init__( + self, + *, + data_uri: str, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_anonymous: Optional[bool] = False, + is_archived: Optional[bool] = False, + referenced_uris: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword data_uri: Required. [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. + :paramtype data_uri: str + :keyword referenced_uris: Uris referenced in the MLTable definition (required for lineage). + :paramtype referenced_uris: list[str] + """ + super(MLTableData, self).__init__(description=description, properties=properties, tags=tags, is_anonymous=is_anonymous, is_archived=is_archived, data_uri=data_uri, **kwargs) + self.data_type = 'mltable' # type: str + self.referenced_uris = referenced_uris -class MLFlowModelJobInput(JobInput, AssetJobInput): - """MLFlowModelJobInput. +class MLTableJobInput(JobInput, AssetJobInput): + """MLTableJobInput. All required parameters must be populated in order to send to Azure. @@ -19409,15 +21314,15 @@ def __init__( :keyword description: Description for the input. :paramtype description: str """ - super(MLFlowModelJobInput, self).__init__(description=description, mode=mode, uri=uri, **kwargs) + super(MLTableJobInput, self).__init__(description=description, mode=mode, uri=uri, **kwargs) self.mode = mode self.uri = uri - self.job_input_type = 'mlflow_model' # type: str + self.job_input_type = 'mltable' # type: str self.description = description -class MLFlowModelJobOutput(JobOutput, AssetJobOutput): - """MLFlowModelJobOutput. +class MLTableJobOutput(JobOutput, AssetJobOutput): + """MLTableJobOutput. All required parameters must be populated in order to send to Azure. @@ -19462,17 +21367,242 @@ def __init__( :keyword description: Description for the output. :paramtype description: str """ - super(MLFlowModelJobOutput, self).__init__(description=description, mode=mode, uri=uri, **kwargs) - self.mode = mode - self.uri = uri - self.job_output_type = 'mlflow_model' # type: str - self.description = description + super(MLTableJobOutput, self).__init__(description=description, mode=mode, uri=uri, **kwargs) + self.mode = mode + self.uri = uri + self.job_output_type = 'mltable' # type: str + self.description = description + + +class ModelContainer(ProxyResource): + """Azure Resource Manager resource envelope. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.ModelContainerProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ModelContainerProperties'}, + } + + def __init__( + self, + *, + properties: "ModelContainerProperties", + **kwargs + ): + """ + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelContainerProperties + """ + super(ModelContainer, self).__init__(**kwargs) + self.properties = properties + + +class ModelContainerProperties(AssetContainer): + """ModelContainerProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar latest_version: The latest version inside this container. + :vartype latest_version: str + :ivar next_version: The next auto incremental version. + :vartype next_version: str + :ivar provisioning_state: Provisioning state for the model container. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + """ + + _validation = { + 'latest_version': {'readonly': True}, + 'next_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'latest_version': {'key': 'latestVersion', 'type': 'str'}, + 'next_version': {'key': 'nextVersion', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_archived: Optional[bool] = False, + **kwargs + ): + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + """ + super(ModelContainerProperties, self).__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) + self.provisioning_state = None + + +class ModelContainerResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of ModelContainer entities. + + :ivar next_link: The link to the next page of ModelContainer objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type ModelContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ModelContainer] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[ModelContainer]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["ModelContainer"]] = None, + **kwargs + ): + """ + :keyword next_link: The link to the next page of ModelContainer objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type ModelContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.ModelContainer] + """ + super(ModelContainerResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class ModelSettings(msrest.serialization.Model): + """ModelSettings. + + :ivar model_id: The unique model identifier that this ServerlessEndpoint should provision. + :vartype model_id: str + """ + + _attribute_map = { + 'model_id': {'key': 'modelId', 'type': 'str'}, + } + + def __init__( + self, + *, + model_id: Optional[str] = None, + **kwargs + ): + """ + :keyword model_id: The unique model identifier that this ServerlessEndpoint should provision. + :paramtype model_id: str + """ + super(ModelSettings, self).__init__(**kwargs) + self.model_id = model_id + + +class ModelVersion(ProxyResource): + """Azure Resource Manager resource envelope. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.ModelVersionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ModelVersionProperties'}, + } + + def __init__( + self, + *, + properties: "ModelVersionProperties", + **kwargs + ): + """ + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelVersionProperties + """ + super(ModelVersion, self).__init__(**kwargs) + self.properties = properties -class MLTableData(DataVersionBaseProperties): - """MLTable data definition. +class ModelVersionProperties(AssetBase): + """Model asset version details. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. :ivar description: The asset description text. :vartype description: str @@ -19484,19 +21614,24 @@ class MLTableData(DataVersionBaseProperties): :vartype is_anonymous: bool :ivar is_archived: Is the asset archived?. :vartype is_archived: bool - :ivar data_type: Required. [Required] Specifies the type of data.Constant filled by server. - Possible values include: "uri_file", "uri_folder", "mltable". - :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.DataType - :ivar data_uri: Required. [Required] Uri of the data. Example: - https://go.microsoft.com/fwlink/?linkid=2202330. - :vartype data_uri: str - :ivar referenced_uris: Uris referenced in the MLTable definition (required for lineage). - :vartype referenced_uris: list[str] + :ivar flavors: Mapping of model flavors to their properties. + :vartype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] + :ivar job_name: Name of the training job which produced this model. + :vartype job_name: str + :ivar model_type: The storage format for this entity. Used for NCD. + :vartype model_type: str + :ivar model_uri: The URI path to the model contents. + :vartype model_uri: str + :ivar provisioning_state: Provisioning state for the model version. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar stage: Stage in the model lifecycle assigned to this model. + :vartype stage: str """ _validation = { - 'data_type': {'required': True}, - 'data_uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { @@ -19505,21 +21640,27 @@ class MLTableData(DataVersionBaseProperties): 'tags': {'key': 'tags', 'type': '{str}'}, 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'data_uri': {'key': 'dataUri', 'type': 'str'}, - 'referenced_uris': {'key': 'referencedUris', 'type': '[str]'}, + 'flavors': {'key': 'flavors', 'type': '{FlavorData}'}, + 'job_name': {'key': 'jobName', 'type': 'str'}, + 'model_type': {'key': 'modelType', 'type': 'str'}, + 'model_uri': {'key': 'modelUri', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, } def __init__( self, *, - data_uri: str, description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, is_anonymous: Optional[bool] = False, is_archived: Optional[bool] = False, - referenced_uris: Optional[List[str]] = None, + flavors: Optional[Dict[str, "FlavorData"]] = None, + job_name: Optional[str] = None, + model_type: Optional[str] = None, + model_uri: Optional[str] = None, + stage: Optional[str] = None, **kwargs ): """ @@ -19533,948 +21674,1029 @@ def __init__( :paramtype is_anonymous: bool :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool - :keyword data_uri: Required. [Required] Uri of the data. Example: - https://go.microsoft.com/fwlink/?linkid=2202330. - :paramtype data_uri: str - :keyword referenced_uris: Uris referenced in the MLTable definition (required for lineage). - :paramtype referenced_uris: list[str] + :keyword flavors: Mapping of model flavors to their properties. + :paramtype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] + :keyword job_name: Name of the training job which produced this model. + :paramtype job_name: str + :keyword model_type: The storage format for this entity. Used for NCD. + :paramtype model_type: str + :keyword model_uri: The URI path to the model contents. + :paramtype model_uri: str + :keyword stage: Stage in the model lifecycle assigned to this model. + :paramtype stage: str """ - super(MLTableData, self).__init__(description=description, properties=properties, tags=tags, is_anonymous=is_anonymous, is_archived=is_archived, data_uri=data_uri, **kwargs) - self.data_type = 'mltable' # type: str - self.referenced_uris = referenced_uris - + super(ModelVersionProperties, self).__init__(description=description, properties=properties, tags=tags, is_anonymous=is_anonymous, is_archived=is_archived, **kwargs) + self.flavors = flavors + self.job_name = job_name + self.model_type = model_type + self.model_uri = model_uri + self.provisioning_state = None + self.stage = stage -class MLTableJobInput(JobInput, AssetJobInput): - """MLTableJobInput. - All required parameters must be populated in order to send to Azure. +class ModelVersionResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of ModelVersion entities. - :ivar mode: Input Asset Delivery Mode. Possible values include: "ReadOnlyMount", - "ReadWriteMount", "Download", "Direct", "EvalMount", "EvalDownload". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode - :ivar uri: Required. [Required] Input Asset URI. - :vartype uri: str - :ivar description: Description for the input. - :vartype description: str - :ivar job_input_type: Required. [Required] Specifies the type of job.Constant filled by server. - Possible values include: "literal", "uri_file", "uri_folder", "mltable", "custom_model", - "mlflow_model", "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar next_link: The link to the next page of ModelVersion objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type ModelVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ModelVersion] """ - _validation = { - 'uri': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, - 'job_input_type': {'required': True}, - } - _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'job_input_type': {'key': 'jobInputType', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[ModelVersion]'}, } def __init__( self, *, - uri: str, - mode: Optional[Union[str, "InputDeliveryMode"]] = None, - description: Optional[str] = None, + next_link: Optional[str] = None, + value: Optional[List["ModelVersion"]] = None, **kwargs ): """ - :keyword mode: Input Asset Delivery Mode. Possible values include: "ReadOnlyMount", - "ReadWriteMount", "Download", "Direct", "EvalMount", "EvalDownload". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode - :keyword uri: Required. [Required] Input Asset URI. - :paramtype uri: str - :keyword description: Description for the input. - :paramtype description: str + :keyword next_link: The link to the next page of ModelVersion objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type ModelVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.ModelVersion] """ - super(MLTableJobInput, self).__init__(description=description, mode=mode, uri=uri, **kwargs) - self.mode = mode - self.uri = uri - self.job_input_type = 'mltable' # type: str - self.description = description + super(ModelVersionResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value -class MLTableJobOutput(JobOutput, AssetJobOutput): - """MLTableJobOutput. +class MonitorComputeConfigurationBase(msrest.serialization.Model): + """Monitor compute configuration base definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MonitorServerlessSparkCompute. All required parameters must be populated in order to send to Azure. - :ivar mode: Output Asset Delivery Mode. Possible values include: "ReadWriteMount", "Upload", - "Direct". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode - :ivar uri: Output Asset URI. - :vartype uri: str - :ivar description: Description for the output. - :vartype description: str - :ivar job_output_type: Required. [Required] Specifies the type of job.Constant filled by - server. Possible values include: "uri_file", "uri_folder", "mltable", "custom_model", - "mlflow_model", "triton_model". - :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType + :ivar compute_type: Required. [Required] Specifies the type of signal to monitor.Constant + filled by server. Possible values include: "ServerlessSpark". + :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.MonitorComputeType """ _validation = { - 'job_output_type': {'required': True}, + 'compute_type': {'required': True}, } _attribute_map = { - 'mode': {'key': 'mode', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'job_output_type': {'key': 'jobOutputType', 'type': 'str'}, + 'compute_type': {'key': 'computeType', 'type': 'str'}, + } + + _subtype_map = { + 'compute_type': {'ServerlessSpark': 'MonitorServerlessSparkCompute'} } def __init__( self, - *, - mode: Optional[Union[str, "OutputDeliveryMode"]] = None, - uri: Optional[str] = None, - description: Optional[str] = None, **kwargs ): """ - :keyword mode: Output Asset Delivery Mode. Possible values include: "ReadWriteMount", "Upload", - "Direct". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode - :keyword uri: Output Asset URI. - :paramtype uri: str - :keyword description: Description for the output. - :paramtype description: str """ - super(MLTableJobOutput, self).__init__(description=description, mode=mode, uri=uri, **kwargs) - self.mode = mode - self.uri = uri - self.job_output_type = 'mltable' # type: str - self.description = description - + super(MonitorComputeConfigurationBase, self).__init__(**kwargs) + self.compute_type = None # type: Optional[str] -class ModelContainer(ProxyResource): - """Azure Resource Manager resource envelope. - Variables are only populated by the server, and will be ignored when sending a request. +class MonitorDefinition(msrest.serialization.Model): + """MonitorDefinition. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ModelContainerProperties + :ivar alert_notification_settings: The monitor's notification settings. + :vartype alert_notification_settings: + ~azure.mgmt.machinelearningservices.models.MonitorNotificationSettings + :ivar compute_configuration: Required. [Required] The ARM resource ID of the compute resource + to run the monitoring job on. + :vartype compute_configuration: + ~azure.mgmt.machinelearningservices.models.MonitorComputeConfigurationBase + :ivar monitoring_target: The entities targeted by the monitor. + :vartype monitoring_target: ~azure.mgmt.machinelearningservices.models.MonitoringTarget + :ivar signals: Required. [Required] The signals to monitor. + :vartype signals: dict[str, ~azure.mgmt.machinelearningservices.models.MonitoringSignalBase] """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, - } + _validation = { + 'compute_configuration': {'required': True}, + 'signals': {'required': True}, + } + + _attribute_map = { + 'alert_notification_settings': {'key': 'alertNotificationSettings', 'type': 'MonitorNotificationSettings'}, + 'compute_configuration': {'key': 'computeConfiguration', 'type': 'MonitorComputeConfigurationBase'}, + 'monitoring_target': {'key': 'monitoringTarget', 'type': 'MonitoringTarget'}, + 'signals': {'key': 'signals', 'type': '{MonitoringSignalBase}'}, + } + + def __init__( + self, + *, + compute_configuration: "MonitorComputeConfigurationBase", + signals: Dict[str, "MonitoringSignalBase"], + alert_notification_settings: Optional["MonitorNotificationSettings"] = None, + monitoring_target: Optional["MonitoringTarget"] = None, + **kwargs + ): + """ + :keyword alert_notification_settings: The monitor's notification settings. + :paramtype alert_notification_settings: + ~azure.mgmt.machinelearningservices.models.MonitorNotificationSettings + :keyword compute_configuration: Required. [Required] The ARM resource ID of the compute + resource to run the monitoring job on. + :paramtype compute_configuration: + ~azure.mgmt.machinelearningservices.models.MonitorComputeConfigurationBase + :keyword monitoring_target: The entities targeted by the monitor. + :paramtype monitoring_target: ~azure.mgmt.machinelearningservices.models.MonitoringTarget + :keyword signals: Required. [Required] The signals to monitor. + :paramtype signals: dict[str, ~azure.mgmt.machinelearningservices.models.MonitoringSignalBase] + """ + super(MonitorDefinition, self).__init__(**kwargs) + self.alert_notification_settings = alert_notification_settings + self.compute_configuration = compute_configuration + self.monitoring_target = monitoring_target + self.signals = signals + + +class MonitorEmailNotificationSettings(msrest.serialization.Model): + """MonitorEmailNotificationSettings. + + :ivar emails: The email recipient list which has a limitation of 499 characters in total. + :vartype emails: list[str] + """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'ModelContainerProperties'}, + 'emails': {'key': 'emails', 'type': '[str]'}, } def __init__( self, *, - properties: "ModelContainerProperties", + emails: Optional[List[str]] = None, **kwargs ): """ - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelContainerProperties + :keyword emails: The email recipient list which has a limitation of 499 characters in total. + :paramtype emails: list[str] """ - super(ModelContainer, self).__init__(**kwargs) - self.properties = properties + super(MonitorEmailNotificationSettings, self).__init__(**kwargs) + self.emails = emails -class ModelContainerProperties(AssetContainer): - """ModelContainerProperties. +class MonitoringTarget(msrest.serialization.Model): + """Monitoring target definition. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar latest_version: The latest version inside this container. - :vartype latest_version: str - :ivar next_version: The next auto incremental version. - :vartype next_version: str - :ivar provisioning_state: Provisioning state for the model container. Possible values include: - "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar deployment_id: Reference to the deployment asset targeted by this monitor. + :vartype deployment_id: str + :ivar model_id: Reference to the model asset targeted by this monitor. + :vartype model_id: str + :ivar task_type: Required. [Required] The machine learning task type of the monitored model. + Possible values include: "Classification", "Regression". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.ModelTaskType """ _validation = { - 'latest_version': {'readonly': True}, - 'next_version': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + 'task_type': {'required': True}, } _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'latest_version': {'key': 'latestVersion', 'type': 'str'}, - 'next_version': {'key': 'nextVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'deployment_id': {'key': 'deploymentId', 'type': 'str'}, + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'task_type': {'key': 'taskType', 'type': 'str'}, } def __init__( self, *, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_archived: Optional[bool] = False, + task_type: Union[str, "ModelTaskType"], + deployment_id: Optional[str] = None, + model_id: Optional[str] = None, **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool + :keyword deployment_id: Reference to the deployment asset targeted by this monitor. + :paramtype deployment_id: str + :keyword model_id: Reference to the model asset targeted by this monitor. + :paramtype model_id: str + :keyword task_type: Required. [Required] The machine learning task type of the monitored model. + Possible values include: "Classification", "Regression". + :paramtype task_type: str or ~azure.mgmt.machinelearningservices.models.ModelTaskType """ - super(ModelContainerProperties, self).__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) - self.provisioning_state = None + super(MonitoringTarget, self).__init__(**kwargs) + self.deployment_id = deployment_id + self.model_id = model_id + self.task_type = task_type -class ModelContainerResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of ModelContainer entities. +class MonitoringThreshold(msrest.serialization.Model): + """MonitoringThreshold. - :ivar next_link: The link to the next page of ModelContainer objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type ModelContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ModelContainer] + :ivar value: The threshold value. If null, the set default is dependent on the metric type. + :vartype value: float """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ModelContainer]'}, + 'value': {'key': 'value', 'type': 'float'}, } def __init__( self, *, - next_link: Optional[str] = None, - value: Optional[List["ModelContainer"]] = None, + value: Optional[float] = None, **kwargs ): """ - :keyword next_link: The link to the next page of ModelContainer objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type ModelContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.ModelContainer] + :keyword value: The threshold value. If null, the set default is dependent on the metric type. + :paramtype value: float """ - super(ModelContainerResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = next_link + super(MonitoringThreshold, self).__init__(**kwargs) self.value = value -class ModelSettings(msrest.serialization.Model): - """ModelSettings. +class MonitorNotificationSettings(msrest.serialization.Model): + """MonitorNotificationSettings. - :ivar model_id: The unique model identifier that this ServerlessEndpoint should provision. - :vartype model_id: str + :ivar email_notification_settings: The AML notification email settings. + :vartype email_notification_settings: + ~azure.mgmt.machinelearningservices.models.MonitorEmailNotificationSettings """ _attribute_map = { - 'model_id': {'key': 'modelId', 'type': 'str'}, + 'email_notification_settings': {'key': 'emailNotificationSettings', 'type': 'MonitorEmailNotificationSettings'}, } def __init__( self, *, - model_id: Optional[str] = None, + email_notification_settings: Optional["MonitorEmailNotificationSettings"] = None, **kwargs ): """ - :keyword model_id: The unique model identifier that this ServerlessEndpoint should provision. - :paramtype model_id: str + :keyword email_notification_settings: The AML notification email settings. + :paramtype email_notification_settings: + ~azure.mgmt.machinelearningservices.models.MonitorEmailNotificationSettings """ - super(ModelSettings, self).__init__(**kwargs) - self.model_id = model_id - + super(MonitorNotificationSettings, self).__init__(**kwargs) + self.email_notification_settings = email_notification_settings -class ModelVersion(ProxyResource): - """Azure Resource Manager resource envelope. - Variables are only populated by the server, and will be ignored when sending a request. +class MonitorServerlessSparkCompute(MonitorComputeConfigurationBase): + """Monitor serverless spark compute definition. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ModelVersionProperties + :ivar compute_type: Required. [Required] Specifies the type of signal to monitor.Constant + filled by server. Possible values include: "ServerlessSpark". + :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.MonitorComputeType + :ivar compute_identity: Required. [Required] The identity scheme leveraged to by the spark jobs + running on serverless Spark. + :vartype compute_identity: + ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityBase + :ivar instance_type: Required. [Required] The instance type running the Spark job. + :vartype instance_type: str + :ivar runtime_version: Required. [Required] The Spark runtime version. + :vartype runtime_version: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, + 'compute_type': {'required': True}, + 'compute_identity': {'required': True}, + 'instance_type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'runtime_version': {'required': True, 'min_length': 1, 'pattern': r'^[0-9]+\.[0-9]+$'}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'ModelVersionProperties'}, + 'compute_type': {'key': 'computeType', 'type': 'str'}, + 'compute_identity': {'key': 'computeIdentity', 'type': 'MonitorComputeIdentityBase'}, + 'instance_type': {'key': 'instanceType', 'type': 'str'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, } def __init__( self, *, - properties: "ModelVersionProperties", + compute_identity: "MonitorComputeIdentityBase", + instance_type: str, + runtime_version: str, **kwargs ): """ - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelVersionProperties + :keyword compute_identity: Required. [Required] The identity scheme leveraged to by the spark + jobs running on serverless Spark. + :paramtype compute_identity: + ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityBase + :keyword instance_type: Required. [Required] The instance type running the Spark job. + :paramtype instance_type: str + :keyword runtime_version: Required. [Required] The Spark runtime version. + :paramtype runtime_version: str """ - super(ModelVersion, self).__init__(**kwargs) - self.properties = properties - + super(MonitorServerlessSparkCompute, self).__init__(**kwargs) + self.compute_type = 'ServerlessSpark' # type: str + self.compute_identity = compute_identity + self.instance_type = instance_type + self.runtime_version = runtime_version -class ModelVersionProperties(AssetBase): - """Model asset version details. - Variables are only populated by the server, and will be ignored when sending a request. +class Mpi(DistributionConfiguration): + """MPI distribution configuration. - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar flavors: Mapping of model flavors to their properties. - :vartype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] - :ivar job_name: Name of the training job which produced this model. - :vartype job_name: str - :ivar model_type: The storage format for this entity. Used for NCD. - :vartype model_type: str - :ivar model_uri: The URI path to the model contents. - :vartype model_uri: str - :ivar provisioning_state: Provisioning state for the model version. Possible values include: - "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState - :ivar stage: Stage in the model lifecycle assigned to this model. - :vartype stage: str + All required parameters must be populated in order to send to Azure. + + :ivar distribution_type: Required. [Required] Specifies the type of distribution + framework.Constant filled by server. Possible values include: "PyTorch", "TensorFlow", "Mpi". + :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType + :ivar process_count_per_instance: Number of processes per MPI node. + :vartype process_count_per_instance: int """ _validation = { - 'provisioning_state': {'readonly': True}, + 'distribution_type': {'required': True}, } _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'flavors': {'key': 'flavors', 'type': '{FlavorData}'}, - 'job_name': {'key': 'jobName', 'type': 'str'}, - 'model_type': {'key': 'modelType', 'type': 'str'}, - 'model_uri': {'key': 'modelUri', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'stage': {'key': 'stage', 'type': 'str'}, + 'distribution_type': {'key': 'distributionType', 'type': 'str'}, + 'process_count_per_instance': {'key': 'processCountPerInstance', 'type': 'int'}, } def __init__( self, *, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_anonymous: Optional[bool] = False, - is_archived: Optional[bool] = False, - flavors: Optional[Dict[str, "FlavorData"]] = None, - job_name: Optional[str] = None, - model_type: Optional[str] = None, - model_uri: Optional[str] = None, - stage: Optional[str] = None, + process_count_per_instance: Optional[int] = None, **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword flavors: Mapping of model flavors to their properties. - :paramtype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] - :keyword job_name: Name of the training job which produced this model. - :paramtype job_name: str - :keyword model_type: The storage format for this entity. Used for NCD. - :paramtype model_type: str - :keyword model_uri: The URI path to the model contents. - :paramtype model_uri: str - :keyword stage: Stage in the model lifecycle assigned to this model. - :paramtype stage: str + :keyword process_count_per_instance: Number of processes per MPI node. + :paramtype process_count_per_instance: int """ - super(ModelVersionProperties, self).__init__(description=description, properties=properties, tags=tags, is_anonymous=is_anonymous, is_archived=is_archived, **kwargs) - self.flavors = flavors - self.job_name = job_name - self.model_type = model_type - self.model_uri = model_uri - self.provisioning_state = None - self.stage = stage + super(Mpi, self).__init__(**kwargs) + self.distribution_type = 'Mpi' # type: str + self.process_count_per_instance = process_count_per_instance -class ModelVersionResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of ModelVersion entities. +class NlpVertical(msrest.serialization.Model): + """Abstract class for NLP related AutoML tasks. +NLP - Natural Language Processing. - :ivar next_link: The link to the next page of ModelVersion objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type ModelVersion. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ModelVersion] + :ivar featurization_settings: Featurization inputs needed for AutoML job. + :vartype featurization_settings: + ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :ivar limit_settings: Execution constraints for AutoMLJob. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ModelVersion]'}, + 'featurization_settings': {'key': 'featurizationSettings', 'type': 'NlpVerticalFeaturizationSettings'}, + 'limit_settings': {'key': 'limitSettings', 'type': 'NlpVerticalLimitSettings'}, + 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, } def __init__( self, *, - next_link: Optional[str] = None, - value: Optional[List["ModelVersion"]] = None, + featurization_settings: Optional["NlpVerticalFeaturizationSettings"] = None, + limit_settings: Optional["NlpVerticalLimitSettings"] = None, + validation_data: Optional["MLTableJobInput"] = None, **kwargs ): """ - :keyword next_link: The link to the next page of ModelVersion objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type ModelVersion. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.ModelVersion] + :keyword featurization_settings: Featurization inputs needed for AutoML job. + :paramtype featurization_settings: + ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput """ - super(ModelVersionResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class MonitorComputeConfigurationBase(msrest.serialization.Model): - """Monitor compute configuration base definition. + super(NlpVertical, self).__init__(**kwargs) + self.featurization_settings = featurization_settings + self.limit_settings = limit_settings + self.validation_data = validation_data - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: MonitorServerlessSparkCompute. - All required parameters must be populated in order to send to Azure. +class NlpVerticalFeaturizationSettings(FeaturizationSettings): + """NlpVerticalFeaturizationSettings. - :ivar compute_type: Required. [Required] Specifies the type of signal to monitor.Constant - filled by server. Possible values include: "ServerlessSpark". - :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.MonitorComputeType + :ivar dataset_language: Dataset language, useful for the text data. + :vartype dataset_language: str """ - _validation = { - 'compute_type': {'required': True}, - } - _attribute_map = { - 'compute_type': {'key': 'computeType', 'type': 'str'}, - } - - _subtype_map = { - 'compute_type': {'ServerlessSpark': 'MonitorServerlessSparkCompute'} + 'dataset_language': {'key': 'datasetLanguage', 'type': 'str'}, } def __init__( self, + *, + dataset_language: Optional[str] = None, **kwargs ): """ + :keyword dataset_language: Dataset language, useful for the text data. + :paramtype dataset_language: str """ - super(MonitorComputeConfigurationBase, self).__init__(**kwargs) - self.compute_type = None # type: Optional[str] - + super(NlpVerticalFeaturizationSettings, self).__init__(dataset_language=dataset_language, **kwargs) -class MonitorDefinition(msrest.serialization.Model): - """MonitorDefinition. - All required parameters must be populated in order to send to Azure. +class NlpVerticalLimitSettings(msrest.serialization.Model): + """Job execution constraints. - :ivar alert_notification_settings: The monitor's notification settings. - :vartype alert_notification_settings: - ~azure.mgmt.machinelearningservices.models.MonitorNotificationSettings - :ivar compute_configuration: Required. [Required] The ARM resource ID of the compute resource - to run the monitoring job on. - :vartype compute_configuration: - ~azure.mgmt.machinelearningservices.models.MonitorComputeConfigurationBase - :ivar monitoring_target: The entities targeted by the monitor. - :vartype monitoring_target: ~azure.mgmt.machinelearningservices.models.MonitoringTarget - :ivar signals: Required. [Required] The signals to monitor. - :vartype signals: dict[str, ~azure.mgmt.machinelearningservices.models.MonitoringSignalBase] + :ivar max_concurrent_trials: Maximum Concurrent AutoML iterations. + :vartype max_concurrent_trials: int + :ivar max_trials: Number of AutoML iterations. + :vartype max_trials: int + :ivar timeout: AutoML job timeout. + :vartype timeout: ~datetime.timedelta """ - _validation = { - 'compute_configuration': {'required': True}, - 'signals': {'required': True}, - } - _attribute_map = { - 'alert_notification_settings': {'key': 'alertNotificationSettings', 'type': 'MonitorNotificationSettings'}, - 'compute_configuration': {'key': 'computeConfiguration', 'type': 'MonitorComputeConfigurationBase'}, - 'monitoring_target': {'key': 'monitoringTarget', 'type': 'MonitoringTarget'}, - 'signals': {'key': 'signals', 'type': '{MonitoringSignalBase}'}, + 'max_concurrent_trials': {'key': 'maxConcurrentTrials', 'type': 'int'}, + 'max_trials': {'key': 'maxTrials', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'duration'}, } def __init__( self, *, - compute_configuration: "MonitorComputeConfigurationBase", - signals: Dict[str, "MonitoringSignalBase"], - alert_notification_settings: Optional["MonitorNotificationSettings"] = None, - monitoring_target: Optional["MonitoringTarget"] = None, + max_concurrent_trials: Optional[int] = 1, + max_trials: Optional[int] = 1, + timeout: Optional[datetime.timedelta] = "P7D", **kwargs ): """ - :keyword alert_notification_settings: The monitor's notification settings. - :paramtype alert_notification_settings: - ~azure.mgmt.machinelearningservices.models.MonitorNotificationSettings - :keyword compute_configuration: Required. [Required] The ARM resource ID of the compute - resource to run the monitoring job on. - :paramtype compute_configuration: - ~azure.mgmt.machinelearningservices.models.MonitorComputeConfigurationBase - :keyword monitoring_target: The entities targeted by the monitor. - :paramtype monitoring_target: ~azure.mgmt.machinelearningservices.models.MonitoringTarget - :keyword signals: Required. [Required] The signals to monitor. - :paramtype signals: dict[str, ~azure.mgmt.machinelearningservices.models.MonitoringSignalBase] + :keyword max_concurrent_trials: Maximum Concurrent AutoML iterations. + :paramtype max_concurrent_trials: int + :keyword max_trials: Number of AutoML iterations. + :paramtype max_trials: int + :keyword timeout: AutoML job timeout. + :paramtype timeout: ~datetime.timedelta """ - super(MonitorDefinition, self).__init__(**kwargs) - self.alert_notification_settings = alert_notification_settings - self.compute_configuration = compute_configuration - self.monitoring_target = monitoring_target - self.signals = signals + super(NlpVerticalLimitSettings, self).__init__(**kwargs) + self.max_concurrent_trials = max_concurrent_trials + self.max_trials = max_trials + self.timeout = timeout -class MonitorEmailNotificationSettings(msrest.serialization.Model): - """MonitorEmailNotificationSettings. +class NodeStateCounts(msrest.serialization.Model): + """Counts of various compute node states on the amlCompute. - :ivar emails: The email recipient list which has a limitation of 499 characters in total. - :vartype emails: list[str] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar idle_node_count: Number of compute nodes in idle state. + :vartype idle_node_count: int + :ivar running_node_count: Number of compute nodes which are running jobs. + :vartype running_node_count: int + :ivar preparing_node_count: Number of compute nodes which are being prepared. + :vartype preparing_node_count: int + :ivar unusable_node_count: Number of compute nodes which are in unusable state. + :vartype unusable_node_count: int + :ivar leaving_node_count: Number of compute nodes which are leaving the amlCompute. + :vartype leaving_node_count: int + :ivar preempted_node_count: Number of compute nodes which are in preempted state. + :vartype preempted_node_count: int """ + _validation = { + 'idle_node_count': {'readonly': True}, + 'running_node_count': {'readonly': True}, + 'preparing_node_count': {'readonly': True}, + 'unusable_node_count': {'readonly': True}, + 'leaving_node_count': {'readonly': True}, + 'preempted_node_count': {'readonly': True}, + } + _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, + 'idle_node_count': {'key': 'idleNodeCount', 'type': 'int'}, + 'running_node_count': {'key': 'runningNodeCount', 'type': 'int'}, + 'preparing_node_count': {'key': 'preparingNodeCount', 'type': 'int'}, + 'unusable_node_count': {'key': 'unusableNodeCount', 'type': 'int'}, + 'leaving_node_count': {'key': 'leavingNodeCount', 'type': 'int'}, + 'preempted_node_count': {'key': 'preemptedNodeCount', 'type': 'int'}, } def __init__( self, - *, - emails: Optional[List[str]] = None, **kwargs ): """ - :keyword emails: The email recipient list which has a limitation of 499 characters in total. - :paramtype emails: list[str] """ - super(MonitorEmailNotificationSettings, self).__init__(**kwargs) - self.emails = emails + super(NodeStateCounts, self).__init__(**kwargs) + self.idle_node_count = None + self.running_node_count = None + self.preparing_node_count = None + self.unusable_node_count = None + self.leaving_node_count = None + self.preempted_node_count = None -class MonitoringTarget(msrest.serialization.Model): - """Monitoring target definition. +class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """NoneAuthTypeWorkspaceConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar deployment_id: Reference to the deployment asset targeted by this monitor. - :vartype deployment_id: str - :ivar model_id: Reference to the model asset targeted by this monitor. - :vartype model_id: str - :ivar task_type: Required. [Required] The machine learning task type of the monitored model. - Possible values include: "Classification", "Regression". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.ModelTaskType + :ivar auth_type: Required. Authentication type of the connection target.Constant filled by + server. Possible values include: "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", + "AccountKey", "ServicePrincipal", "AccessKey", "ApiKey", "CustomKeys", "OAuth2", "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Possible values include: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", + "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", + "Serverless". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool """ _validation = { - 'task_type': {'required': True}, + 'auth_type': {'required': True}, + 'created_by_workspace_arm_id': {'readonly': True}, + 'group': {'readonly': True}, } _attribute_map = { - 'deployment_id': {'key': 'deploymentId', 'type': 'str'}, - 'model_id': {'key': 'modelId', 'type': 'str'}, - 'task_type': {'key': 'taskType', 'type': 'str'}, + 'auth_type': {'key': 'authType', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, + 'group': {'key': 'group', 'type': 'str'}, + 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, + 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, } def __init__( self, *, - task_type: Union[str, "ModelTaskType"], - deployment_id: Optional[str] = None, - model_id: Optional[str] = None, + category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, **kwargs ): """ - :keyword deployment_id: Reference to the deployment asset targeted by this monitor. - :paramtype deployment_id: str - :keyword model_id: Reference to the model asset targeted by this monitor. - :paramtype model_id: str - :keyword task_type: Required. [Required] The machine learning task type of the monitored model. - Possible values include: "Classification", "Regression". - :paramtype task_type: str or ~azure.mgmt.machinelearningservices.models.ModelTaskType + :keyword category: Category of the connection. Possible values include: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", + "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", + "Serverless". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool """ - super(MonitoringTarget, self).__init__(**kwargs) - self.deployment_id = deployment_id - self.model_id = model_id - self.task_type = task_type + super(NoneAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, error=error, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, metadata=metadata, pe_requirement=pe_requirement, pe_status=pe_status, shared_user_list=shared_user_list, target=target, use_workspace_managed_identity=use_workspace_managed_identity, **kwargs) + self.auth_type = 'None' # type: str -class MonitoringThreshold(msrest.serialization.Model): - """MonitoringThreshold. +class NoneDatastoreCredentials(DatastoreCredentials): + """Empty/none datastore credentials. - :ivar value: The threshold value. If null, the set default is dependent on the metric type. - :vartype value: float + All required parameters must be populated in order to send to Azure. + + :ivar credentials_type: Required. [Required] Credential type used to authentication with + storage.Constant filled by server. Possible values include: "AccountKey", "Certificate", + "None", "Sas", "ServicePrincipal". + :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType """ + _validation = { + 'credentials_type': {'required': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': 'float'}, + 'credentials_type': {'key': 'credentialsType', 'type': 'str'}, } def __init__( self, - *, - value: Optional[float] = None, **kwargs ): """ - :keyword value: The threshold value. If null, the set default is dependent on the metric type. - :paramtype value: float """ - super(MonitoringThreshold, self).__init__(**kwargs) - self.value = value + super(NoneDatastoreCredentials, self).__init__(**kwargs) + self.credentials_type = 'None' # type: str -class MonitorNotificationSettings(msrest.serialization.Model): - """MonitorNotificationSettings. +class NotebookAccessTokenResult(msrest.serialization.Model): + """NotebookAccessTokenResult. - :ivar email_notification_settings: The AML notification email settings. - :vartype email_notification_settings: - ~azure.mgmt.machinelearningservices.models.MonitorEmailNotificationSettings + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar access_token: + :vartype access_token: str + :ivar expires_in: + :vartype expires_in: int + :ivar host_name: + :vartype host_name: str + :ivar notebook_resource_id: + :vartype notebook_resource_id: str + :ivar public_dns: + :vartype public_dns: str + :ivar refresh_token: + :vartype refresh_token: str + :ivar scope: + :vartype scope: str + :ivar token_type: + :vartype token_type: str """ + _validation = { + 'access_token': {'readonly': True}, + 'expires_in': {'readonly': True}, + 'host_name': {'readonly': True}, + 'notebook_resource_id': {'readonly': True}, + 'public_dns': {'readonly': True}, + 'refresh_token': {'readonly': True}, + 'scope': {'readonly': True}, + 'token_type': {'readonly': True}, + } + _attribute_map = { - 'email_notification_settings': {'key': 'emailNotificationSettings', 'type': 'MonitorEmailNotificationSettings'}, + 'access_token': {'key': 'accessToken', 'type': 'str'}, + 'expires_in': {'key': 'expiresIn', 'type': 'int'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'notebook_resource_id': {'key': 'notebookResourceId', 'type': 'str'}, + 'public_dns': {'key': 'publicDns', 'type': 'str'}, + 'refresh_token': {'key': 'refreshToken', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'}, + 'token_type': {'key': 'tokenType', 'type': 'str'}, } def __init__( self, - *, - email_notification_settings: Optional["MonitorEmailNotificationSettings"] = None, **kwargs ): """ - :keyword email_notification_settings: The AML notification email settings. - :paramtype email_notification_settings: - ~azure.mgmt.machinelearningservices.models.MonitorEmailNotificationSettings """ - super(MonitorNotificationSettings, self).__init__(**kwargs) - self.email_notification_settings = email_notification_settings - + super(NotebookAccessTokenResult, self).__init__(**kwargs) + self.access_token = None + self.expires_in = None + self.host_name = None + self.notebook_resource_id = None + self.public_dns = None + self.refresh_token = None + self.scope = None + self.token_type = None -class MonitorServerlessSparkCompute(MonitorComputeConfigurationBase): - """Monitor serverless spark compute definition. - All required parameters must be populated in order to send to Azure. +class NotebookPreparationError(msrest.serialization.Model): + """NotebookPreparationError. - :ivar compute_type: Required. [Required] Specifies the type of signal to monitor.Constant - filled by server. Possible values include: "ServerlessSpark". - :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.MonitorComputeType - :ivar compute_identity: Required. [Required] The identity scheme leveraged to by the spark jobs - running on serverless Spark. - :vartype compute_identity: - ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityBase - :ivar instance_type: Required. [Required] The instance type running the Spark job. - :vartype instance_type: str - :ivar runtime_version: Required. [Required] The Spark runtime version. - :vartype runtime_version: str + :ivar error_message: + :vartype error_message: str + :ivar status_code: + :vartype status_code: int """ - _validation = { - 'compute_type': {'required': True}, - 'compute_identity': {'required': True}, - 'instance_type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, - 'runtime_version': {'required': True, 'min_length': 1, 'pattern': r'^[0-9]+\.[0-9]+$'}, - } - _attribute_map = { - 'compute_type': {'key': 'computeType', 'type': 'str'}, - 'compute_identity': {'key': 'computeIdentity', 'type': 'MonitorComputeIdentityBase'}, - 'instance_type': {'key': 'instanceType', 'type': 'str'}, - 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'int'}, } def __init__( self, *, - compute_identity: "MonitorComputeIdentityBase", - instance_type: str, - runtime_version: str, + error_message: Optional[str] = None, + status_code: Optional[int] = None, **kwargs ): """ - :keyword compute_identity: Required. [Required] The identity scheme leveraged to by the spark - jobs running on serverless Spark. - :paramtype compute_identity: - ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityBase - :keyword instance_type: Required. [Required] The instance type running the Spark job. - :paramtype instance_type: str - :keyword runtime_version: Required. [Required] The Spark runtime version. - :paramtype runtime_version: str + :keyword error_message: + :paramtype error_message: str + :keyword status_code: + :paramtype status_code: int """ - super(MonitorServerlessSparkCompute, self).__init__(**kwargs) - self.compute_type = 'ServerlessSpark' # type: str - self.compute_identity = compute_identity - self.instance_type = instance_type - self.runtime_version = runtime_version - + super(NotebookPreparationError, self).__init__(**kwargs) + self.error_message = error_message + self.status_code = status_code -class Mpi(DistributionConfiguration): - """MPI distribution configuration. - All required parameters must be populated in order to send to Azure. +class NotebookResourceInfo(msrest.serialization.Model): + """NotebookResourceInfo. - :ivar distribution_type: Required. [Required] Specifies the type of distribution - framework.Constant filled by server. Possible values include: "PyTorch", "TensorFlow", "Mpi". - :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType - :ivar process_count_per_instance: Number of processes per MPI node. - :vartype process_count_per_instance: int + :ivar fqdn: + :vartype fqdn: str + :ivar is_private_link_enabled: + :vartype is_private_link_enabled: bool + :ivar notebook_preparation_error: The error that occurs when preparing notebook. + :vartype notebook_preparation_error: + ~azure.mgmt.machinelearningservices.models.NotebookPreparationError + :ivar resource_id: the data plane resourceId that used to initialize notebook component. + :vartype resource_id: str """ - _validation = { - 'distribution_type': {'required': True}, - } - _attribute_map = { - 'distribution_type': {'key': 'distributionType', 'type': 'str'}, - 'process_count_per_instance': {'key': 'processCountPerInstance', 'type': 'int'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + 'is_private_link_enabled': {'key': 'isPrivateLinkEnabled', 'type': 'bool'}, + 'notebook_preparation_error': {'key': 'notebookPreparationError', 'type': 'NotebookPreparationError'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, } def __init__( self, *, - process_count_per_instance: Optional[int] = None, + fqdn: Optional[str] = None, + is_private_link_enabled: Optional[bool] = None, + notebook_preparation_error: Optional["NotebookPreparationError"] = None, + resource_id: Optional[str] = None, **kwargs ): """ - :keyword process_count_per_instance: Number of processes per MPI node. - :paramtype process_count_per_instance: int + :keyword fqdn: + :paramtype fqdn: str + :keyword is_private_link_enabled: + :paramtype is_private_link_enabled: bool + :keyword notebook_preparation_error: The error that occurs when preparing notebook. + :paramtype notebook_preparation_error: + ~azure.mgmt.machinelearningservices.models.NotebookPreparationError + :keyword resource_id: the data plane resourceId that used to initialize notebook component. + :paramtype resource_id: str """ - super(Mpi, self).__init__(**kwargs) - self.distribution_type = 'Mpi' # type: str - self.process_count_per_instance = process_count_per_instance + super(NotebookResourceInfo, self).__init__(**kwargs) + self.fqdn = fqdn + self.is_private_link_enabled = is_private_link_enabled + self.notebook_preparation_error = notebook_preparation_error + self.resource_id = resource_id -class NlpVertical(msrest.serialization.Model): - """Abstract class for NLP related AutoML tasks. -NLP - Natural Language Processing. +class NotificationSetting(msrest.serialization.Model): + """Configuration for notification. - :ivar featurization_settings: Featurization inputs needed for AutoML job. - :vartype featurization_settings: - ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings - :ivar limit_settings: Execution constraints for AutoMLJob. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar email_on: Send email notification to user on specified notification type. + :vartype email_on: list[str or + ~azure.mgmt.machinelearningservices.models.EmailNotificationEnableType] + :ivar emails: This is the email recipient list which has a limitation of 499 characters in + total concat with comma separator. + :vartype emails: list[str] + :ivar webhooks: Send webhook callback to a service. Key is a user-provided name for the + webhook. + :vartype webhooks: dict[str, ~azure.mgmt.machinelearningservices.models.Webhook] """ _attribute_map = { - 'featurization_settings': {'key': 'featurizationSettings', 'type': 'NlpVerticalFeaturizationSettings'}, - 'limit_settings': {'key': 'limitSettings', 'type': 'NlpVerticalLimitSettings'}, - 'validation_data': {'key': 'validationData', 'type': 'MLTableJobInput'}, + 'email_on': {'key': 'emailOn', 'type': '[str]'}, + 'emails': {'key': 'emails', 'type': '[str]'}, + 'webhooks': {'key': 'webhooks', 'type': '{Webhook}'}, } def __init__( self, *, - featurization_settings: Optional["NlpVerticalFeaturizationSettings"] = None, - limit_settings: Optional["NlpVerticalLimitSettings"] = None, - validation_data: Optional["MLTableJobInput"] = None, + email_on: Optional[List[Union[str, "EmailNotificationEnableType"]]] = None, + emails: Optional[List[str]] = None, + webhooks: Optional[Dict[str, "Webhook"]] = None, **kwargs ): """ - :keyword featurization_settings: Featurization inputs needed for AutoML job. - :paramtype featurization_settings: - ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings - :keyword limit_settings: Execution constraints for AutoMLJob. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword email_on: Send email notification to user on specified notification type. + :paramtype email_on: list[str or + ~azure.mgmt.machinelearningservices.models.EmailNotificationEnableType] + :keyword emails: This is the email recipient list which has a limitation of 499 characters in + total concat with comma separator. + :paramtype emails: list[str] + :keyword webhooks: Send webhook callback to a service. Key is a user-provided name for the + webhook. + :paramtype webhooks: dict[str, ~azure.mgmt.machinelearningservices.models.Webhook] """ - super(NlpVertical, self).__init__(**kwargs) - self.featurization_settings = featurization_settings - self.limit_settings = limit_settings - self.validation_data = validation_data + super(NotificationSetting, self).__init__(**kwargs) + self.email_on = email_on + self.emails = emails + self.webhooks = webhooks -class NlpVerticalFeaturizationSettings(FeaturizationSettings): - """NlpVerticalFeaturizationSettings. +class NumericalDataDriftMetricThreshold(DataDriftMetricThresholdBase): + """NumericalDataDriftMetricThreshold. - :ivar dataset_language: Dataset language, useful for the text data. - :vartype dataset_language: str + All required parameters must be populated in order to send to Azure. + + :ivar data_type: Required. [Required] Specifies the data type of the metric threshold.Constant + filled by server. Possible values include: "Numerical", "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar metric: Required. [Required] The numerical data drift metric to calculate. Possible + values include: "JensenShannonDistance", "PopulationStabilityIndex", + "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". + :vartype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataDriftMetric """ + _validation = { + 'data_type': {'required': True}, + 'metric': {'required': True}, + } + _attribute_map = { - 'dataset_language': {'key': 'datasetLanguage', 'type': 'str'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, + 'metric': {'key': 'metric', 'type': 'str'}, } def __init__( self, *, - dataset_language: Optional[str] = None, + metric: Union[str, "NumericalDataDriftMetric"], + threshold: Optional["MonitoringThreshold"] = None, **kwargs ): """ - :keyword dataset_language: Dataset language, useful for the text data. - :paramtype dataset_language: str + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword metric: Required. [Required] The numerical data drift metric to calculate. Possible + values include: "JensenShannonDistance", "PopulationStabilityIndex", + "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". + :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataDriftMetric """ - super(NlpVerticalFeaturizationSettings, self).__init__(dataset_language=dataset_language, **kwargs) + super(NumericalDataDriftMetricThreshold, self).__init__(threshold=threshold, **kwargs) + self.data_type = 'Numerical' # type: str + self.metric = metric -class NlpVerticalLimitSettings(msrest.serialization.Model): - """Job execution constraints. +class NumericalDataQualityMetricThreshold(DataQualityMetricThresholdBase): + """NumericalDataQualityMetricThreshold. - :ivar max_concurrent_trials: Maximum Concurrent AutoML iterations. - :vartype max_concurrent_trials: int - :ivar max_trials: Number of AutoML iterations. - :vartype max_trials: int - :ivar timeout: AutoML job timeout. - :vartype timeout: ~datetime.timedelta + All required parameters must be populated in order to send to Azure. + + :ivar data_type: Required. [Required] Specifies the data type of the metric threshold.Constant + filled by server. Possible values include: "Numerical", "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar metric: Required. [Required] The numerical data quality metric to calculate. Possible + values include: "NullValueRate", "DataTypeErrorRate", "OutOfBoundsRate". + :vartype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataQualityMetric """ + _validation = { + 'data_type': {'required': True}, + 'metric': {'required': True}, + } + _attribute_map = { - 'max_concurrent_trials': {'key': 'maxConcurrentTrials', 'type': 'int'}, - 'max_trials': {'key': 'maxTrials', 'type': 'int'}, - 'timeout': {'key': 'timeout', 'type': 'duration'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, + 'metric': {'key': 'metric', 'type': 'str'}, } def __init__( self, *, - max_concurrent_trials: Optional[int] = 1, - max_trials: Optional[int] = 1, - timeout: Optional[datetime.timedelta] = "P7D", + metric: Union[str, "NumericalDataQualityMetric"], + threshold: Optional["MonitoringThreshold"] = None, **kwargs ): """ - :keyword max_concurrent_trials: Maximum Concurrent AutoML iterations. - :paramtype max_concurrent_trials: int - :keyword max_trials: Number of AutoML iterations. - :paramtype max_trials: int - :keyword timeout: AutoML job timeout. - :paramtype timeout: ~datetime.timedelta + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword metric: Required. [Required] The numerical data quality metric to calculate. Possible + values include: "NullValueRate", "DataTypeErrorRate", "OutOfBoundsRate". + :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataQualityMetric """ - super(NlpVerticalLimitSettings, self).__init__(**kwargs) - self.max_concurrent_trials = max_concurrent_trials - self.max_trials = max_trials - self.timeout = timeout + super(NumericalDataQualityMetricThreshold, self).__init__(threshold=threshold, **kwargs) + self.data_type = 'Numerical' # type: str + self.metric = metric -class NodeStateCounts(msrest.serialization.Model): - """Counts of various compute node states on the amlCompute. +class NumericalPredictionDriftMetricThreshold(PredictionDriftMetricThresholdBase): + """NumericalPredictionDriftMetricThreshold. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar idle_node_count: Number of compute nodes in idle state. - :vartype idle_node_count: int - :ivar running_node_count: Number of compute nodes which are running jobs. - :vartype running_node_count: int - :ivar preparing_node_count: Number of compute nodes which are being prepared. - :vartype preparing_node_count: int - :ivar unusable_node_count: Number of compute nodes which are in unusable state. - :vartype unusable_node_count: int - :ivar leaving_node_count: Number of compute nodes which are leaving the amlCompute. - :vartype leaving_node_count: int - :ivar preempted_node_count: Number of compute nodes which are in preempted state. - :vartype preempted_node_count: int + :ivar data_type: Required. [Required] Specifies the data type of the metric threshold.Constant + filled by server. Possible values include: "Numerical", "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar metric: Required. [Required] The numerical prediction drift metric to calculate. Possible + values include: "JensenShannonDistance", "PopulationStabilityIndex", + "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". + :vartype metric: str or + ~azure.mgmt.machinelearningservices.models.NumericalPredictionDriftMetric """ _validation = { - 'idle_node_count': {'readonly': True}, - 'running_node_count': {'readonly': True}, - 'preparing_node_count': {'readonly': True}, - 'unusable_node_count': {'readonly': True}, - 'leaving_node_count': {'readonly': True}, - 'preempted_node_count': {'readonly': True}, + 'data_type': {'required': True}, + 'metric': {'required': True}, } _attribute_map = { - 'idle_node_count': {'key': 'idleNodeCount', 'type': 'int'}, - 'running_node_count': {'key': 'runningNodeCount', 'type': 'int'}, - 'preparing_node_count': {'key': 'preparingNodeCount', 'type': 'int'}, - 'unusable_node_count': {'key': 'unusableNodeCount', 'type': 'int'}, - 'leaving_node_count': {'key': 'leavingNodeCount', 'type': 'int'}, - 'preempted_node_count': {'key': 'preemptedNodeCount', 'type': 'int'}, + 'data_type': {'key': 'dataType', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, + 'metric': {'key': 'metric', 'type': 'str'}, } def __init__( self, + *, + metric: Union[str, "NumericalPredictionDriftMetric"], + threshold: Optional["MonitoringThreshold"] = None, **kwargs ): """ + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword metric: Required. [Required] The numerical prediction drift metric to calculate. + Possible values include: "JensenShannonDistance", "PopulationStabilityIndex", + "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". + :paramtype metric: str or + ~azure.mgmt.machinelearningservices.models.NumericalPredictionDriftMetric """ - super(NodeStateCounts, self).__init__(**kwargs) - self.idle_node_count = None - self.running_node_count = None - self.preparing_node_count = None - self.unusable_node_count = None - self.leaving_node_count = None - self.preempted_node_count = None + super(NumericalPredictionDriftMetricThreshold, self).__init__(threshold=threshold, **kwargs) + self.data_type = 'Numerical' # type: str + self.metric = metric -class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """NoneAuthTypeWorkspaceConnectionProperties. +class OAuth2AuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """OAuth2AuthTypeWorkspaceConnectionProperties. Variables are only populated by the server, and will be ignored when sending a request. @@ -20486,7 +22708,7 @@ class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2) :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -20501,10 +22723,12 @@ class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2) "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -20512,16 +22736,21 @@ class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2) :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionOAuth2 """ _validation = { @@ -20534,33 +22763,39 @@ class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2) 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, + 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionOAuth2'}, } def __init__( self, *, category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["WorkspaceConnectionOAuth2"] = None, **kwargs ): """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -20575,658 +22810,937 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionOAuth2 + """ + super(OAuth2AuthTypeWorkspaceConnectionProperties, self).__init__(category=category, error=error, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, metadata=metadata, pe_requirement=pe_requirement, pe_status=pe_status, shared_user_list=shared_user_list, target=target, use_workspace_managed_identity=use_workspace_managed_identity, **kwargs) + self.auth_type = 'OAuth2' # type: str + self.credentials = credentials + + +class Objective(msrest.serialization.Model): + """Optimization objective. + + All required parameters must be populated in order to send to Azure. + + :ivar goal: Required. [Required] Defines supported metric goals for hyperparameter tuning. + Possible values include: "Minimize", "Maximize". + :vartype goal: str or ~azure.mgmt.machinelearningservices.models.Goal + :ivar primary_metric: Required. [Required] Name of the metric to optimize. + :vartype primary_metric: str + """ + + _validation = { + 'goal': {'required': True}, + 'primary_metric': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'goal': {'key': 'goal', 'type': 'str'}, + 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + } + + def __init__( + self, + *, + goal: Union[str, "Goal"], + primary_metric: str, + **kwargs + ): + """ + :keyword goal: Required. [Required] Defines supported metric goals for hyperparameter tuning. + Possible values include: "Minimize", "Maximize". + :paramtype goal: str or ~azure.mgmt.machinelearningservices.models.Goal + :keyword primary_metric: Required. [Required] Name of the metric to optimize. + :paramtype primary_metric: str + """ + super(Objective, self).__init__(**kwargs) + self.goal = goal + self.primary_metric = primary_metric + + +class OneLakeDatastore(DatastoreProperties): + """OneLake (Trident) datastore configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar credentials: Required. [Required] Account credentials. + :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :ivar datastore_type: Required. [Required] Storage type backing the datastore.Constant filled + by server. Possible values include: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", + "AzureFile", "OneLake". + :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType + :ivar is_default: Readonly property to indicate if datastore is the workspace default + datastore. + :vartype is_default: bool + :ivar artifact: Required. [Required] OneLake artifact backing the datastore. + :vartype artifact: ~azure.mgmt.machinelearningservices.models.OneLakeArtifact + :ivar endpoint: OneLake endpoint to use for the datastore. + :vartype endpoint: str + :ivar one_lake_workspace_name: Required. [Required] OneLake workspace name. + :vartype one_lake_workspace_name: str + :ivar service_data_access_auth_identity: Indicates which identity to use to authenticate + service data access to customer's storage. Possible values include: "None", + "WorkspaceSystemAssignedIdentity", "WorkspaceUserAssignedIdentity". + :vartype service_data_access_auth_identity: str or + ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity + """ + + _validation = { + 'credentials': {'required': True}, + 'datastore_type': {'required': True}, + 'is_default': {'readonly': True}, + 'artifact': {'required': True}, + 'one_lake_workspace_name': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'credentials': {'key': 'credentials', 'type': 'DatastoreCredentials'}, + 'datastore_type': {'key': 'datastoreType', 'type': 'str'}, + 'is_default': {'key': 'isDefault', 'type': 'bool'}, + 'artifact': {'key': 'artifact', 'type': 'OneLakeArtifact'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'one_lake_workspace_name': {'key': 'oneLakeWorkspaceName', 'type': 'str'}, + 'service_data_access_auth_identity': {'key': 'serviceDataAccessAuthIdentity', 'type': 'str'}, + } + + def __init__( + self, + *, + credentials: "DatastoreCredentials", + artifact: "OneLakeArtifact", + one_lake_workspace_name: str, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + endpoint: Optional[str] = None, + service_data_access_auth_identity: Optional[Union[str, "ServiceDataAccessAuthIdentity"]] = None, + **kwargs + ): + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword credentials: Required. [Required] Account credentials. + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :keyword artifact: Required. [Required] OneLake artifact backing the datastore. + :paramtype artifact: ~azure.mgmt.machinelearningservices.models.OneLakeArtifact + :keyword endpoint: OneLake endpoint to use for the datastore. + :paramtype endpoint: str + :keyword one_lake_workspace_name: Required. [Required] OneLake workspace name. + :paramtype one_lake_workspace_name: str + :keyword service_data_access_auth_identity: Indicates which identity to use to authenticate + service data access to customer's storage. Possible values include: "None", + "WorkspaceSystemAssignedIdentity", "WorkspaceUserAssignedIdentity". + :paramtype service_data_access_auth_identity: str or + ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity + """ + super(OneLakeDatastore, self).__init__(description=description, properties=properties, tags=tags, credentials=credentials, **kwargs) + self.datastore_type = 'OneLake' # type: str + self.artifact = artifact + self.endpoint = endpoint + self.one_lake_workspace_name = one_lake_workspace_name + self.service_data_access_auth_identity = service_data_access_auth_identity + + +class OnlineDeployment(TrackedResource): + """OnlineDeployment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.OnlineDeploymentProperties + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OnlineDeploymentProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + location: str, + properties: "OnlineDeploymentProperties", + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + kind: Optional[str] = None, + sku: Optional["Sku"] = None, + **kwargs + ): """ - super(NoneAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, target=target, metadata=metadata, shared_user_list=shared_user_list, value=value, value_format=value_format, **kwargs) - self.auth_type = 'None' # type: str - + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :paramtype kind: str + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.OnlineDeploymentProperties + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + """ + super(OnlineDeployment, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.kind = kind + self.properties = properties + self.sku = sku -class NoneDatastoreCredentials(DatastoreCredentials): - """Empty/none datastore credentials. - All required parameters must be populated in order to send to Azure. +class OnlineDeploymentTrackedResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of OnlineDeployment entities. - :ivar credentials_type: Required. [Required] Credential type used to authentication with - storage.Constant filled by server. Possible values include: "AccountKey", "Certificate", - "None", "Sas", "ServicePrincipal". - :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType + :ivar next_link: The link to the next page of OnlineDeployment objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type OnlineDeployment. + :vartype value: list[~azure.mgmt.machinelearningservices.models.OnlineDeployment] """ - _validation = { - 'credentials_type': {'required': True}, - } - _attribute_map = { - 'credentials_type': {'key': 'credentialsType', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[OnlineDeployment]'}, } def __init__( self, + *, + next_link: Optional[str] = None, + value: Optional[List["OnlineDeployment"]] = None, **kwargs ): """ + :keyword next_link: The link to the next page of OnlineDeployment objects. If null, there are + no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type OnlineDeployment. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.OnlineDeployment] """ - super(NoneDatastoreCredentials, self).__init__(**kwargs) - self.credentials_type = 'None' # type: str + super(OnlineDeploymentTrackedResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value -class NotebookAccessTokenResult(msrest.serialization.Model): - """NotebookAccessTokenResult. +class OnlineEndpoint(TrackedResource): + """OnlineEndpoint. Variables are only populated by the server, and will be ignored when sending a request. - :ivar notebook_resource_id: - :vartype notebook_resource_id: str - :ivar host_name: - :vartype host_name: str - :ivar public_dns: - :vartype public_dns: str - :ivar access_token: - :vartype access_token: str - :ivar token_type: - :vartype token_type: str - :ivar expires_in: - :vartype expires_in: int - :ivar refresh_token: - :vartype refresh_token: str - :ivar scope: - :vartype scope: str + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: Required. [Required] Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.OnlineEndpointProperties + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku """ _validation = { - 'notebook_resource_id': {'readonly': True}, - 'host_name': {'readonly': True}, - 'public_dns': {'readonly': True}, - 'access_token': {'readonly': True}, - 'token_type': {'readonly': True}, - 'expires_in': {'readonly': True}, - 'refresh_token': {'readonly': True}, - 'scope': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'properties': {'required': True}, } _attribute_map = { - 'notebook_resource_id': {'key': 'notebookResourceId', 'type': 'str'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'public_dns': {'key': 'publicDns', 'type': 'str'}, - 'access_token': {'key': 'accessToken', 'type': 'str'}, - 'token_type': {'key': 'tokenType', 'type': 'str'}, - 'expires_in': {'key': 'expiresIn', 'type': 'int'}, - 'refresh_token': {'key': 'refreshToken', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OnlineEndpointProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, } def __init__( self, + *, + location: str, + properties: "OnlineEndpointProperties", + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + kind: Optional[str] = None, + sku: Optional["Sku"] = None, **kwargs ): """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :paramtype kind: str + :keyword properties: Required. [Required] Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.OnlineEndpointProperties + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku """ - super(NotebookAccessTokenResult, self).__init__(**kwargs) - self.notebook_resource_id = None - self.host_name = None - self.public_dns = None - self.access_token = None - self.token_type = None - self.expires_in = None - self.refresh_token = None - self.scope = None + super(OnlineEndpoint, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.kind = kind + self.properties = properties + self.sku = sku -class NotebookPreparationError(msrest.serialization.Model): - """NotebookPreparationError. +class OnlineEndpointProperties(EndpointPropertiesBase): + """Online endpoint configuration. - :ivar error_message: - :vartype error_message: str - :ivar status_code: - :vartype status_code: int + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar auth_mode: Required. [Required] Use 'Key' for key based authentication and 'AMLToken' for + Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. + Possible values include: "AMLToken", "Key", "AADToken". + :vartype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode + :ivar description: Description of the inference endpoint. + :vartype description: str + :ivar keys: EndpointAuthKeys to set initially on an Endpoint. + This property will always be returned as null. AuthKey values must be retrieved using the + ListKeys API. + :vartype keys: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar scoring_uri: Endpoint URI. + :vartype scoring_uri: str + :ivar swagger_uri: Endpoint Swagger URI. + :vartype swagger_uri: str + :ivar compute: ARM resource ID of the compute if it exists. + optional. + :vartype compute: str + :ivar mirror_traffic: Percentage of traffic to be mirrored to each deployment without using + returned scoring. Traffic values need to sum to utmost 50. + :vartype mirror_traffic: dict[str, int] + :ivar provisioning_state: Provisioning state for the endpoint. Possible values include: + "Creating", "Deleting", "Succeeded", "Failed", "Updating", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.EndpointProvisioningState + :ivar public_network_access: Set to "Enabled" for endpoints that should allow public access + when Private Link is enabled. Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :ivar traffic: Percentage of traffic from endpoint to divert to each deployment. Traffic values + need to sum to 100. + :vartype traffic: dict[str, int] """ + _validation = { + 'auth_mode': {'required': True}, + 'scoring_uri': {'readonly': True}, + 'swagger_uri': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'auth_mode': {'key': 'authMode', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'keys': {'key': 'keys', 'type': 'EndpointAuthKeys'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'scoring_uri': {'key': 'scoringUri', 'type': 'str'}, + 'swagger_uri': {'key': 'swaggerUri', 'type': 'str'}, + 'compute': {'key': 'compute', 'type': 'str'}, + 'mirror_traffic': {'key': 'mirrorTraffic', 'type': '{int}'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'traffic': {'key': 'traffic', 'type': '{int}'}, } def __init__( self, *, - error_message: Optional[str] = None, - status_code: Optional[int] = None, + auth_mode: Union[str, "EndpointAuthMode"], + description: Optional[str] = None, + keys: Optional["EndpointAuthKeys"] = None, + properties: Optional[Dict[str, str]] = None, + compute: Optional[str] = None, + mirror_traffic: Optional[Dict[str, int]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccessType"]] = None, + traffic: Optional[Dict[str, int]] = None, **kwargs ): """ - :keyword error_message: - :paramtype error_message: str - :keyword status_code: - :paramtype status_code: int - """ - super(NotebookPreparationError, self).__init__(**kwargs) - self.error_message = error_message - self.status_code = status_code + :keyword auth_mode: Required. [Required] Use 'Key' for key based authentication and 'AMLToken' + for Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' + does. Possible values include: "AMLToken", "Key", "AADToken". + :paramtype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode + :keyword description: Description of the inference endpoint. + :paramtype description: str + :keyword keys: EndpointAuthKeys to set initially on an Endpoint. + This property will always be returned as null. AuthKey values must be retrieved using the + ListKeys API. + :paramtype keys: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword compute: ARM resource ID of the compute if it exists. + optional. + :paramtype compute: str + :keyword mirror_traffic: Percentage of traffic to be mirrored to each deployment without using + returned scoring. Traffic values need to sum to utmost 50. + :paramtype mirror_traffic: dict[str, int] + :keyword public_network_access: Set to "Enabled" for endpoints that should allow public access + when Private Link is enabled. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :keyword traffic: Percentage of traffic from endpoint to divert to each deployment. Traffic + values need to sum to 100. + :paramtype traffic: dict[str, int] + """ + super(OnlineEndpointProperties, self).__init__(auth_mode=auth_mode, description=description, keys=keys, properties=properties, **kwargs) + self.compute = compute + self.mirror_traffic = mirror_traffic + self.provisioning_state = None + self.public_network_access = public_network_access + self.traffic = traffic -class NotebookResourceInfo(msrest.serialization.Model): - """NotebookResourceInfo. +class OnlineEndpointTrackedResourceArmPaginatedResult(msrest.serialization.Model): + """A paginated list of OnlineEndpoint entities. - :ivar fqdn: - :vartype fqdn: str - :ivar resource_id: the data plane resourceId that used to initialize notebook component. - :vartype resource_id: str - :ivar notebook_preparation_error: The error that occurs when preparing notebook. - :vartype notebook_preparation_error: - ~azure.mgmt.machinelearningservices.models.NotebookPreparationError + :ivar next_link: The link to the next page of OnlineEndpoint objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type OnlineEndpoint. + :vartype value: list[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] """ _attribute_map = { - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'notebook_preparation_error': {'key': 'notebookPreparationError', 'type': 'NotebookPreparationError'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[OnlineEndpoint]'}, } def __init__( self, *, - fqdn: Optional[str] = None, - resource_id: Optional[str] = None, - notebook_preparation_error: Optional["NotebookPreparationError"] = None, + next_link: Optional[str] = None, + value: Optional[List["OnlineEndpoint"]] = None, **kwargs ): """ - :keyword fqdn: - :paramtype fqdn: str - :keyword resource_id: the data plane resourceId that used to initialize notebook component. - :paramtype resource_id: str - :keyword notebook_preparation_error: The error that occurs when preparing notebook. - :paramtype notebook_preparation_error: - ~azure.mgmt.machinelearningservices.models.NotebookPreparationError + :keyword next_link: The link to the next page of OnlineEndpoint objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type OnlineEndpoint. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] """ - super(NotebookResourceInfo, self).__init__(**kwargs) - self.fqdn = fqdn - self.resource_id = resource_id - self.notebook_preparation_error = notebook_preparation_error + super(OnlineEndpointTrackedResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value -class NotificationSetting(msrest.serialization.Model): - """Configuration for notification. +class OnlineRequestSettings(msrest.serialization.Model): + """Online deployment scoring requests configuration. - :ivar email_on: Send email notification to user on specified notification type. - :vartype email_on: list[str or - ~azure.mgmt.machinelearningservices.models.EmailNotificationEnableType] - :ivar emails: This is the email recipient list which has a limitation of 499 characters in - total concat with comma separator. - :vartype emails: list[str] - :ivar webhooks: Send webhook callback to a service. Key is a user-provided name for the - webhook. - :vartype webhooks: dict[str, ~azure.mgmt.machinelearningservices.models.Webhook] + :ivar max_concurrent_requests_per_instance: The number of maximum concurrent requests per node + allowed per deployment. Defaults to 1. + :vartype max_concurrent_requests_per_instance: int + :ivar max_queue_wait: (Deprecated for Managed Online Endpoints) The maximum amount of time a + request will stay in the queue in ISO 8601 format. + Defaults to 500ms. + (Now increase ``request_timeout_ms`` to account for any networking/queue delays). + :vartype max_queue_wait: ~datetime.timedelta + :ivar request_timeout: The scoring timeout in ISO 8601 format. + Defaults to 5000ms. + :vartype request_timeout: ~datetime.timedelta """ _attribute_map = { - 'email_on': {'key': 'emailOn', 'type': '[str]'}, - 'emails': {'key': 'emails', 'type': '[str]'}, - 'webhooks': {'key': 'webhooks', 'type': '{Webhook}'}, + 'max_concurrent_requests_per_instance': {'key': 'maxConcurrentRequestsPerInstance', 'type': 'int'}, + 'max_queue_wait': {'key': 'maxQueueWait', 'type': 'duration'}, + 'request_timeout': {'key': 'requestTimeout', 'type': 'duration'}, } def __init__( self, *, - email_on: Optional[List[Union[str, "EmailNotificationEnableType"]]] = None, - emails: Optional[List[str]] = None, - webhooks: Optional[Dict[str, "Webhook"]] = None, + max_concurrent_requests_per_instance: Optional[int] = 1, + max_queue_wait: Optional[datetime.timedelta] = "PT0.5S", + request_timeout: Optional[datetime.timedelta] = "PT5S", **kwargs ): """ - :keyword email_on: Send email notification to user on specified notification type. - :paramtype email_on: list[str or - ~azure.mgmt.machinelearningservices.models.EmailNotificationEnableType] - :keyword emails: This is the email recipient list which has a limitation of 499 characters in - total concat with comma separator. - :paramtype emails: list[str] - :keyword webhooks: Send webhook callback to a service. Key is a user-provided name for the - webhook. - :paramtype webhooks: dict[str, ~azure.mgmt.machinelearningservices.models.Webhook] + :keyword max_concurrent_requests_per_instance: The number of maximum concurrent requests per + node allowed per deployment. Defaults to 1. + :paramtype max_concurrent_requests_per_instance: int + :keyword max_queue_wait: (Deprecated for Managed Online Endpoints) The maximum amount of time a + request will stay in the queue in ISO 8601 format. + Defaults to 500ms. + (Now increase ``request_timeout_ms`` to account for any networking/queue delays). + :paramtype max_queue_wait: ~datetime.timedelta + :keyword request_timeout: The scoring timeout in ISO 8601 format. + Defaults to 5000ms. + :paramtype request_timeout: ~datetime.timedelta """ - super(NotificationSetting, self).__init__(**kwargs) - self.email_on = email_on - self.emails = emails - self.webhooks = webhooks + super(OnlineRequestSettings, self).__init__(**kwargs) + self.max_concurrent_requests_per_instance = max_concurrent_requests_per_instance + self.max_queue_wait = max_queue_wait + self.request_timeout = request_timeout -class NumericalDataDriftMetricThreshold(DataDriftMetricThresholdBase): - """NumericalDataDriftMetricThreshold. +class OpenAIEndpointDeploymentResourceProperties(EndpointDeploymentResourceProperties, CognitiveServiceEndpointDeploymentResourceProperties): + """OpenAIEndpointDeploymentResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar data_type: Required. [Required] Specifies the data type of the metric threshold.Constant - filled by server. Possible values include: "Numerical", "Categorical". - :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType - :ivar threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - :ivar metric: Required. [Required] The numerical data drift metric to calculate. Possible - values include: "JensenShannonDistance", "PopulationStabilityIndex", - "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". - :vartype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataDriftMetric + :ivar model: Required. Model used for the endpoint deployment. + :vartype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar version_upgrade_option: Deployment model version upgrade option. Possible values include: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Required. Kind of the deployment.Constant filled by server. + :vartype type: str """ _validation = { - 'data_type': {'required': True}, - 'metric': {'required': True}, + 'model': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, } _attribute_map = { - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, - 'metric': {'key': 'metric', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'EndpointDeploymentModel'}, + 'rai_policy_name': {'key': 'raiPolicyName', 'type': 'str'}, + 'version_upgrade_option': {'key': 'versionUpgradeOption', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, *, - metric: Union[str, "NumericalDataDriftMetric"], - threshold: Optional["MonitoringThreshold"] = None, + model: "EndpointDeploymentModel", + rai_policy_name: Optional[str] = None, + version_upgrade_option: Optional[Union[str, "DeploymentModelVersionUpgradeOption"]] = None, + failure_reason: Optional[str] = None, **kwargs ): """ - :keyword threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - :keyword metric: Required. [Required] The numerical data drift metric to calculate. Possible - values include: "JensenShannonDistance", "PopulationStabilityIndex", - "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". - :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataDriftMetric + :keyword model: Required. Model used for the endpoint deployment. + :paramtype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :keyword rai_policy_name: The name of RAI policy. + :paramtype rai_policy_name: str + :keyword version_upgrade_option: Deployment model version upgrade option. Possible values + include: "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :paramtype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str """ - super(NumericalDataDriftMetricThreshold, self).__init__(threshold=threshold, **kwargs) - self.data_type = 'Numerical' # type: str - self.metric = metric + super(OpenAIEndpointDeploymentResourceProperties, self).__init__(failure_reason=failure_reason, model=model, rai_policy_name=rai_policy_name, version_upgrade_option=version_upgrade_option, **kwargs) + self.model = model + self.rai_policy_name = rai_policy_name + self.version_upgrade_option = version_upgrade_option + self.type = 'Azure.OpenAI' # type: str + self.failure_reason = failure_reason + self.provisioning_state = None -class NumericalDataQualityMetricThreshold(DataQualityMetricThresholdBase): - """NumericalDataQualityMetricThreshold. +class OpenAIEndpointResourceProperties(EndpointResourceProperties): + """OpenAIEndpointResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar data_type: Required. [Required] Specifies the data type of the metric threshold.Constant - filled by server. Possible values include: "Numerical", "Categorical". - :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType - :ivar threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - :ivar metric: Required. [Required] The numerical data quality metric to calculate. Possible - values include: "NullValueRate", "DataTypeErrorRate", "OutOfBoundsRate". - :vartype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataQualityMetric + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Required. Type of the endpoint.Constant filled by server. Possible values + include: "Azure.OpenAI", "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", + "managedOnlineEndpoint", "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool """ _validation = { - 'data_type': {'required': True}, - 'metric': {'required': True}, + 'endpoint_type': {'required': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, - 'metric': {'key': 'metric', 'type': 'str'}, + 'associated_resource_id': {'key': 'associatedResourceId', 'type': 'str'}, + 'deployments': {'key': 'deployments', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'should_create_ai_services_endpoint': {'key': 'shouldCreateAiServicesEndpoint', 'type': 'bool'}, } def __init__( self, *, - metric: Union[str, "NumericalDataQualityMetric"], - threshold: Optional["MonitoringThreshold"] = None, + associated_resource_id: Optional[str] = None, + deployments: Optional[List["EndpointDeploymentResourcePropertiesBasicResource"]] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + should_create_ai_services_endpoint: Optional[bool] = None, **kwargs ): """ - :keyword threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - :keyword metric: Required. [Required] The numerical data quality metric to calculate. Possible - values include: "NullValueRate", "DataTypeErrorRate", "OutOfBoundsRate". - :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataQualityMetric + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool """ - super(NumericalDataQualityMetricThreshold, self).__init__(threshold=threshold, **kwargs) - self.data_type = 'Numerical' # type: str - self.metric = metric + super(OpenAIEndpointResourceProperties, self).__init__(associated_resource_id=associated_resource_id, deployments=deployments, endpoint_uri=endpoint_uri, failure_reason=failure_reason, location=location, name=name, should_create_ai_services_endpoint=should_create_ai_services_endpoint, **kwargs) + self.endpoint_type = 'Azure.OpenAI' # type: str -class NumericalPredictionDriftMetricThreshold(PredictionDriftMetricThresholdBase): - """NumericalPredictionDriftMetricThreshold. +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar data_type: Required. [Required] Specifies the data type of the metric threshold.Constant - filled by server. Possible values include: "Numerical", "Categorical". - :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType - :ivar threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - :ivar metric: Required. [Required] The numerical prediction drift metric to calculate. Possible - values include: "JensenShannonDistance", "PopulationStabilityIndex", - "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". - :vartype metric: str or - ~azure.mgmt.machinelearningservices.models.NumericalPredictionDriftMetric + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.machinelearningservices.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~azure.mgmt.machinelearningservices.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ActionType """ _validation = { - 'data_type': {'required': True}, - 'metric': {'required': True}, + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, } _attribute_map = { - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'threshold': {'key': 'threshold', 'type': 'MonitoringThreshold'}, - 'metric': {'key': 'metric', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, } def __init__( self, *, - metric: Union[str, "NumericalPredictionDriftMetric"], - threshold: Optional["MonitoringThreshold"] = None, + display: Optional["OperationDisplay"] = None, **kwargs ): """ - :keyword threshold: The threshold value. If null, a default value will be set depending on the - selected metric. - :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold - :keyword metric: Required. [Required] The numerical prediction drift metric to calculate. - Possible values include: "JensenShannonDistance", "PopulationStabilityIndex", - "NormalizedWassersteinDistance", "TwoSampleKolmogorovSmirnovTest". - :paramtype metric: str or - ~azure.mgmt.machinelearningservices.models.NumericalPredictionDriftMetric + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.machinelearningservices.models.OperationDisplay """ - super(NumericalPredictionDriftMetricThreshold, self).__init__(threshold=threshold, **kwargs) - self.data_type = 'Numerical' # type: str - self.metric = metric + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None -class OAuth2AuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """OAuth2AuthTypeWorkspaceConnectionProperties. +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar auth_type: Required. Authentication type of the connection target.Constant filled by - server. Possible values include: "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", - "AccountKey", "ServicePrincipal", "AccessKey", "ApiKey", "CustomKeys", "OAuth2", "AAD". - :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType - :ivar category: Category of the connection. Possible values include: "PythonFeed", - "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", - "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", - "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", - "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", - "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", - "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", - "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", - "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", - "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", - "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", - "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", - "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", - "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", - "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", - "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". - :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :ivar created_by_workspace_arm_id: - :vartype created_by_workspace_arm_id: str - :ivar expiry_time: - :vartype expiry_time: ~datetime.datetime - :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", - "Database", "NoSQL", "File", "GenericProtocol", "ServicesAndApps". - :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup - :ivar is_shared_to_all: - :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str - :ivar metadata: Store user metadata for this connection. - :vartype metadata: dict[str, str] - :ivar shared_user_list: - :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :ivar credentials: ClientId and ClientSecret are required. Other properties are optional - depending on each OAuth2 provider's implementation. - :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionOAuth2 + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str """ _validation = { - 'auth_type': {'required': True}, - 'created_by_workspace_arm_id': {'readonly': True}, - 'group': {'readonly': True}, + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, } _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, - 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, - 'group': {'key': 'group', 'type': 'str'}, - 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, - 'metadata': {'key': 'metadata', 'type': '{str}'}, - 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionOAuth2'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, } def __init__( self, - *, - category: Optional[Union[str, "ConnectionCategory"]] = None, - expiry_time: Optional[datetime.datetime] = None, - is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, - credentials: Optional["WorkspaceConnectionOAuth2"] = None, **kwargs ): """ - :keyword category: Category of the connection. Possible values include: "PythonFeed", - "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", - "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", - "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", - "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", - "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", - "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", - "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", - "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", - "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", - "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", - "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", - "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", - "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", - "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", - "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". - :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :keyword expiry_time: - :paramtype expiry_time: ~datetime.datetime - :keyword is_shared_to_all: - :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str - :keyword metadata: Store user metadata for this connection. - :paramtype metadata: dict[str, str] - :keyword shared_user_list: - :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :keyword credentials: ClientId and ClientSecret are required. Other properties are optional - depending on each OAuth2 provider's implementation. - :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionOAuth2 """ - super(OAuth2AuthTypeWorkspaceConnectionProperties, self).__init__(category=category, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, target=target, metadata=metadata, shared_user_list=shared_user_list, value=value, value_format=value_format, **kwargs) - self.auth_type = 'OAuth2' # type: str - self.credentials = credentials + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None -class Objective(msrest.serialization.Model): - """Optimization objective. +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar goal: Required. [Required] Defines supported metric goals for hyperparameter tuning. - Possible values include: "Minimize", "Maximize". - :vartype goal: str or ~azure.mgmt.machinelearningservices.models.Goal - :ivar primary_metric: Required. [Required] Name of the metric to optimize. - :vartype primary_metric: str + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ _validation = { - 'goal': {'required': True}, - 'primary_metric': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'goal': {'key': 'goal', 'type': 'str'}, - 'primary_metric': {'key': 'primaryMetric', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, - *, - goal: Union[str, "Goal"], - primary_metric: str, **kwargs ): """ - :keyword goal: Required. [Required] Defines supported metric goals for hyperparameter tuning. - Possible values include: "Minimize", "Maximize". - :paramtype goal: str or ~azure.mgmt.machinelearningservices.models.Goal - :keyword primary_metric: Required. [Required] Name of the metric to optimize. - :paramtype primary_metric: str """ - super(Objective, self).__init__(**kwargs) - self.goal = goal - self.primary_metric = primary_metric - - -class OneLakeDatastore(DatastoreProperties): - """OneLake (Trident) datastore configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar description: The asset description text. - :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar credentials: Required. [Required] Account credentials. - :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials - :ivar datastore_type: Required. [Required] Storage type backing the datastore.Constant filled - by server. Possible values include: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", - "AzureFile", "OneLake". - :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType - :ivar is_default: Readonly property to indicate if datastore is the workspace default - datastore. - :vartype is_default: bool - :ivar artifact: Required. [Required] OneLake artifact backing the datastore. - :vartype artifact: ~azure.mgmt.machinelearningservices.models.OneLakeArtifact - :ivar endpoint: OneLake endpoint to use for the datastore. - :vartype endpoint: str - :ivar one_lake_workspace_name: Required. [Required] OneLake workspace name. - :vartype one_lake_workspace_name: str - :ivar service_data_access_auth_identity: Indicates which identity to use to authenticate - service data access to customer's storage. Possible values include: "None", - "WorkspaceSystemAssignedIdentity", "WorkspaceUserAssignedIdentity". - :vartype service_data_access_auth_identity: str or - ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity - """ - - _validation = { - 'credentials': {'required': True}, - 'datastore_type': {'required': True}, - 'is_default': {'readonly': True}, - 'artifact': {'required': True}, - 'one_lake_workspace_name': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, - } - - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'credentials': {'key': 'credentials', 'type': 'DatastoreCredentials'}, - 'datastore_type': {'key': 'datastoreType', 'type': 'str'}, - 'is_default': {'key': 'isDefault', 'type': 'bool'}, - 'artifact': {'key': 'artifact', 'type': 'OneLakeArtifact'}, - 'endpoint': {'key': 'endpoint', 'type': 'str'}, - 'one_lake_workspace_name': {'key': 'oneLakeWorkspaceName', 'type': 'str'}, - 'service_data_access_auth_identity': {'key': 'serviceDataAccessAuthIdentity', 'type': 'str'}, + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OsPatchingStatus(msrest.serialization.Model): + """Returns metadata about the os patching. + + :ivar patch_status: The os patching status. Possible values include: "CompletedWithWarnings", + "Failed", "InProgress", "Succeeded", "Unknown". + :vartype patch_status: str or ~azure.mgmt.machinelearningservices.models.PatchStatus + :ivar latest_patch_time: Time of the latest os patching. + :vartype latest_patch_time: str + :ivar reboot_pending: Specifies whether this compute instance is pending for reboot to finish + os patching. + :vartype reboot_pending: bool + :ivar scheduled_reboot_time: Time of scheduled reboot. + :vartype scheduled_reboot_time: str + :ivar os_patching_errors: Collection of errors encountered when doing os patching. + :vartype os_patching_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + """ + + _attribute_map = { + 'patch_status': {'key': 'patchStatus', 'type': 'str'}, + 'latest_patch_time': {'key': 'latestPatchTime', 'type': 'str'}, + 'reboot_pending': {'key': 'rebootPending', 'type': 'bool'}, + 'scheduled_reboot_time': {'key': 'scheduledRebootTime', 'type': 'str'}, + 'os_patching_errors': {'key': 'osPatchingErrors', 'type': '[ErrorResponse]'}, } def __init__( self, *, - credentials: "DatastoreCredentials", - artifact: "OneLakeArtifact", - one_lake_workspace_name: str, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - endpoint: Optional[str] = None, - service_data_access_auth_identity: Optional[Union[str, "ServiceDataAccessAuthIdentity"]] = None, + patch_status: Optional[Union[str, "PatchStatus"]] = None, + latest_patch_time: Optional[str] = None, + reboot_pending: Optional[bool] = None, + scheduled_reboot_time: Optional[str] = None, + os_patching_errors: Optional[List["ErrorResponse"]] = None, **kwargs ): """ - :keyword description: The asset description text. - :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword credentials: Required. [Required] Account credentials. - :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials - :keyword artifact: Required. [Required] OneLake artifact backing the datastore. - :paramtype artifact: ~azure.mgmt.machinelearningservices.models.OneLakeArtifact - :keyword endpoint: OneLake endpoint to use for the datastore. - :paramtype endpoint: str - :keyword one_lake_workspace_name: Required. [Required] OneLake workspace name. - :paramtype one_lake_workspace_name: str - :keyword service_data_access_auth_identity: Indicates which identity to use to authenticate - service data access to customer's storage. Possible values include: "None", - "WorkspaceSystemAssignedIdentity", "WorkspaceUserAssignedIdentity". - :paramtype service_data_access_auth_identity: str or - ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity + :keyword patch_status: The os patching status. Possible values include: + "CompletedWithWarnings", "Failed", "InProgress", "Succeeded", "Unknown". + :paramtype patch_status: str or ~azure.mgmt.machinelearningservices.models.PatchStatus + :keyword latest_patch_time: Time of the latest os patching. + :paramtype latest_patch_time: str + :keyword reboot_pending: Specifies whether this compute instance is pending for reboot to + finish os patching. + :paramtype reboot_pending: bool + :keyword scheduled_reboot_time: Time of scheduled reboot. + :paramtype scheduled_reboot_time: str + :keyword os_patching_errors: Collection of errors encountered when doing os patching. + :paramtype os_patching_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] """ - super(OneLakeDatastore, self).__init__(description=description, properties=properties, tags=tags, credentials=credentials, **kwargs) - self.datastore_type = 'OneLake' # type: str - self.artifact = artifact - self.endpoint = endpoint - self.one_lake_workspace_name = one_lake_workspace_name - self.service_data_access_auth_identity = service_data_access_auth_identity + super(OsPatchingStatus, self).__init__(**kwargs) + self.patch_status = patch_status + self.latest_patch_time = latest_patch_time + self.reboot_pending = reboot_pending + self.scheduled_reboot_time = scheduled_reboot_time + self.os_patching_errors = os_patching_errors -class OnlineDeployment(TrackedResource): - """OnlineDeployment. +class OutboundRuleBasicResource(Resource): + """OutboundRuleBasicResource. Variables are only populated by the server, and will be ignored when sending a request. @@ -21243,19 +23757,9 @@ class OnlineDeployment(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. - :vartype location: str - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type. - :vartype kind: str - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.OnlineDeploymentProperties - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar properties: Required. Outbound Rule for the managed network of a machine learning + workspace. + :vartype properties: ~azure.mgmt.machinelearningservices.models.OutboundRule """ _validation = { @@ -21263,7 +23767,6 @@ class OnlineDeployment(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, - 'location': {'required': True}, 'properties': {'required': True}, } @@ -21272,1814 +23775,1776 @@ class OnlineDeployment(TrackedResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OnlineDeploymentProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, + 'properties': {'key': 'properties', 'type': 'OutboundRule'}, } def __init__( self, *, - location: str, - properties: "OnlineDeploymentProperties", - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - kind: Optional[str] = None, - sku: Optional["Sku"] = None, + properties: "OutboundRule", **kwargs ): """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. - :paramtype location: str - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type. - :paramtype kind: str - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.OnlineDeploymentProperties - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword properties: Required. Outbound Rule for the managed network of a machine learning + workspace. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.OutboundRule """ - super(OnlineDeployment, self).__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.kind = kind + super(OutboundRuleBasicResource, self).__init__(**kwargs) self.properties = properties - self.sku = sku -class OnlineDeploymentTrackedResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of OnlineDeployment entities. +class OutboundRuleListResult(msrest.serialization.Model): + """List of outbound rules for the managed network of a machine learning workspace. - :ivar next_link: The link to the next page of OnlineDeployment objects. If null, there are no - additional pages. + :ivar next_link: The link to the next page constructed using the continuationToken. If null, + there are no additional pages. :vartype next_link: str - :ivar value: An array of objects of type OnlineDeployment. - :vartype value: list[~azure.mgmt.machinelearningservices.models.OnlineDeployment] + :ivar value: The list of machine learning workspaces. Since this list may be incomplete, the + nextLink field should be used to request the next list of machine learning workspaces. + :vartype value: list[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[OnlineDeployment]'}, + 'value': {'key': 'value', 'type': '[OutboundRuleBasicResource]'}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["OnlineDeployment"]] = None, + value: Optional[List["OutboundRuleBasicResource"]] = None, **kwargs ): """ - :keyword next_link: The link to the next page of OnlineDeployment objects. If null, there are - no additional pages. + :keyword next_link: The link to the next page constructed using the continuationToken. If + null, there are no additional pages. :paramtype next_link: str - :keyword value: An array of objects of type OnlineDeployment. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.OnlineDeployment] + :keyword value: The list of machine learning workspaces. Since this list may be incomplete, the + nextLink field should be used to request the next list of machine learning workspaces. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] """ - super(OnlineDeploymentTrackedResourceArmPaginatedResult, self).__init__(**kwargs) + super(OutboundRuleListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value -class OnlineEndpoint(TrackedResource): - """OnlineEndpoint. - - Variables are only populated by the server, and will be ignored when sending a request. +class OutputPathAssetReference(AssetReferenceBase): + """Reference to an asset via its path in a job output. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar location: Required. The geo-location where the resource lives. - :vartype location: str - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type. - :vartype kind: str - :ivar properties: Required. [Required] Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.OnlineEndpointProperties - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar reference_type: Required. [Required] Specifies the type of asset reference.Constant + filled by server. Possible values include: "Id", "DataPath", "OutputPath". + :vartype reference_type: str or ~azure.mgmt.machinelearningservices.models.ReferenceType + :ivar job_id: ARM resource ID of the job. + :vartype job_id: str + :ivar path: The path of the file/directory in the job output. + :vartype path: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'properties': {'required': True}, + 'reference_type': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OnlineEndpointProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, + 'reference_type': {'key': 'referenceType', 'type': 'str'}, + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, } def __init__( self, *, - location: str, - properties: "OnlineEndpointProperties", - tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedServiceIdentity"] = None, - kind: Optional[str] = None, - sku: Optional["Sku"] = None, + job_id: Optional[str] = None, + path: Optional[str] = None, **kwargs ): """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword location: Required. The geo-location where the resource lives. - :paramtype location: str - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type. - :paramtype kind: str - :keyword properties: Required. [Required] Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.OnlineEndpointProperties - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword job_id: ARM resource ID of the job. + :paramtype job_id: str + :keyword path: The path of the file/directory in the job output. + :paramtype path: str """ - super(OnlineEndpoint, self).__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.kind = kind - self.properties = properties - self.sku = sku - - -class OnlineEndpointProperties(EndpointPropertiesBase): - """Online endpoint configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. + super(OutputPathAssetReference, self).__init__(**kwargs) + self.reference_type = 'OutputPath' # type: str + self.job_id = job_id + self.path = path - :ivar auth_mode: Required. [Required] Use 'Key' for key based authentication and 'AMLToken' for - Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. - Possible values include: "AMLToken", "Key", "AADToken". - :vartype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode - :ivar description: Description of the inference endpoint. - :vartype description: str - :ivar keys: EndpointAuthKeys to set initially on an Endpoint. - This property will always be returned as null. AuthKey values must be retrieved using the - ListKeys API. - :vartype keys: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys - :ivar properties: Property dictionary. Properties can be added, but not removed or altered. - :vartype properties: dict[str, str] - :ivar scoring_uri: Endpoint URI. - :vartype scoring_uri: str - :ivar swagger_uri: Endpoint Swagger URI. - :vartype swagger_uri: str - :ivar compute: ARM resource ID of the compute if it exists. - optional. - :vartype compute: str - :ivar mirror_traffic: Percentage of traffic to be mirrored to each deployment without using - returned scoring. Traffic values need to sum to utmost 50. - :vartype mirror_traffic: dict[str, int] - :ivar provisioning_state: Provisioning state for the endpoint. Possible values include: - "Creating", "Deleting", "Succeeded", "Failed", "Updating", "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.EndpointProvisioningState - :ivar public_network_access: Set to "Enabled" for endpoints that should allow public access - when Private Link is enabled. Possible values include: "Enabled", "Disabled". - :vartype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType - :ivar traffic: Percentage of traffic from endpoint to divert to each deployment. Traffic values - need to sum to 100. - :vartype traffic: dict[str, int] + +class PaginatedComputeResourcesList(msrest.serialization.Model): + """Paginated list of Machine Learning compute objects wrapped in ARM resource envelope. + + :ivar value: An array of Machine Learning compute objects wrapped in ARM resource envelope. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ComputeResource] + :ivar next_link: A continuation link (absolute URI) to the next page of results in the list. + :vartype next_link: str """ - _validation = { - 'auth_mode': {'required': True}, - 'scoring_uri': {'readonly': True}, - 'swagger_uri': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + _attribute_map = { + 'value': {'key': 'value', 'type': '[ComputeResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } + def __init__( + self, + *, + value: Optional[List["ComputeResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: An array of Machine Learning compute objects wrapped in ARM resource envelope. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.ComputeResource] + :keyword next_link: A continuation link (absolute URI) to the next page of results in the list. + :paramtype next_link: str + """ + super(PaginatedComputeResourcesList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PartialBatchDeployment(msrest.serialization.Model): + """Mutable batch inference settings per deployment. + + :ivar description: Description of the endpoint deployment. + :vartype description: str + """ + _attribute_map = { - 'auth_mode': {'key': 'authMode', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'keys': {'key': 'keys', 'type': 'EndpointAuthKeys'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'scoring_uri': {'key': 'scoringUri', 'type': 'str'}, - 'swagger_uri': {'key': 'swaggerUri', 'type': 'str'}, - 'compute': {'key': 'compute', 'type': 'str'}, - 'mirror_traffic': {'key': 'mirrorTraffic', 'type': '{int}'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'traffic': {'key': 'traffic', 'type': '{int}'}, } def __init__( self, *, - auth_mode: Union[str, "EndpointAuthMode"], description: Optional[str] = None, - keys: Optional["EndpointAuthKeys"] = None, - properties: Optional[Dict[str, str]] = None, - compute: Optional[str] = None, - mirror_traffic: Optional[Dict[str, int]] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccessType"]] = None, - traffic: Optional[Dict[str, int]] = None, **kwargs ): """ - :keyword auth_mode: Required. [Required] Use 'Key' for key based authentication and 'AMLToken' - for Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' - does. Possible values include: "AMLToken", "Key", "AADToken". - :paramtype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode - :keyword description: Description of the inference endpoint. + :keyword description: Description of the endpoint deployment. :paramtype description: str - :keyword keys: EndpointAuthKeys to set initially on an Endpoint. - This property will always be returned as null. AuthKey values must be retrieved using the - ListKeys API. - :paramtype keys: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. - :paramtype properties: dict[str, str] - :keyword compute: ARM resource ID of the compute if it exists. - optional. - :paramtype compute: str - :keyword mirror_traffic: Percentage of traffic to be mirrored to each deployment without using - returned scoring. Traffic values need to sum to utmost 50. - :paramtype mirror_traffic: dict[str, int] - :keyword public_network_access: Set to "Enabled" for endpoints that should allow public access - when Private Link is enabled. Possible values include: "Enabled", "Disabled". - :paramtype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType - :keyword traffic: Percentage of traffic from endpoint to divert to each deployment. Traffic - values need to sum to 100. - :paramtype traffic: dict[str, int] """ - super(OnlineEndpointProperties, self).__init__(auth_mode=auth_mode, description=description, keys=keys, properties=properties, **kwargs) - self.compute = compute - self.mirror_traffic = mirror_traffic - self.provisioning_state = None - self.public_network_access = public_network_access - self.traffic = traffic + super(PartialBatchDeployment, self).__init__(**kwargs) + self.description = description -class OnlineEndpointTrackedResourceArmPaginatedResult(msrest.serialization.Model): - """A paginated list of OnlineEndpoint entities. +class PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties(msrest.serialization.Model): + """Strictly used in update requests. - :ivar next_link: The link to the next page of OnlineEndpoint objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type OnlineEndpoint. - :vartype value: list[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] + :ivar properties: Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[OnlineEndpoint]'}, + 'properties': {'key': 'properties', 'type': 'PartialBatchDeployment'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__( self, *, - next_link: Optional[str] = None, - value: Optional[List["OnlineEndpoint"]] = None, + properties: Optional["PartialBatchDeployment"] = None, + tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword next_link: The link to the next page of OnlineEndpoint objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type OnlineEndpoint. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] + :keyword properties: Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] """ - super(OnlineEndpointTrackedResourceArmPaginatedResult, self).__init__(**kwargs) - self.next_link = next_link - self.value = value + super(PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties, self).__init__(**kwargs) + self.properties = properties + self.tags = tags -class OnlineRequestSettings(msrest.serialization.Model): - """Online deployment scoring requests configuration. +class PartialManagedServiceIdentity(msrest.serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). - :ivar max_concurrent_requests_per_instance: The number of maximum concurrent requests per node - allowed per deployment. Defaults to 1. - :vartype max_concurrent_requests_per_instance: int - :ivar max_queue_wait: (Deprecated for Managed Online Endpoints) The maximum amount of time a - request will stay in the queue in ISO 8601 format. - Defaults to 500ms. - (Now increase ``request_timeout_ms`` to account for any networking/queue delays). - :vartype max_queue_wait: ~datetime.timedelta - :ivar request_timeout: The scoring timeout in ISO 8601 format. - Defaults to 5000ms. - :vartype request_timeout: ~datetime.timedelta + :ivar type: Managed service identity (system assigned and/or user assigned identities). + Possible values include: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, any] """ _attribute_map = { - 'max_concurrent_requests_per_instance': {'key': 'maxConcurrentRequestsPerInstance', 'type': 'int'}, - 'max_queue_wait': {'key': 'maxQueueWait', 'type': 'duration'}, - 'request_timeout': {'key': 'requestTimeout', 'type': 'duration'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{object}'}, } def __init__( self, *, - max_concurrent_requests_per_instance: Optional[int] = 1, - max_queue_wait: Optional[datetime.timedelta] = "PT0.5S", - request_timeout: Optional[datetime.timedelta] = "PT5S", + type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, Any]] = None, **kwargs ): """ - :keyword max_concurrent_requests_per_instance: The number of maximum concurrent requests per - node allowed per deployment. Defaults to 1. - :paramtype max_concurrent_requests_per_instance: int - :keyword max_queue_wait: (Deprecated for Managed Online Endpoints) The maximum amount of time a - request will stay in the queue in ISO 8601 format. - Defaults to 500ms. - (Now increase ``request_timeout_ms`` to account for any networking/queue delays). - :paramtype max_queue_wait: ~datetime.timedelta - :keyword request_timeout: The scoring timeout in ISO 8601 format. - Defaults to 5000ms. - :paramtype request_timeout: ~datetime.timedelta + :keyword type: Managed service identity (system assigned and/or user assigned identities). + Possible values include: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, any] """ - super(OnlineRequestSettings, self).__init__(**kwargs) - self.max_concurrent_requests_per_instance = max_concurrent_requests_per_instance - self.max_queue_wait = max_queue_wait - self.request_timeout = request_timeout - + super(PartialManagedServiceIdentity, self).__init__(**kwargs) + self.type = type + self.user_assigned_identities = user_assigned_identities -class Operation(msrest.serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - Variables are only populated by the server, and will be ignored when sending a request. +class PartialMinimalTrackedResource(msrest.serialization.Model): + """Strictly used in update requests. - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.machinelearningservices.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", - "system", "user,system". - :vartype origin: str or ~azure.mgmt.machinelearningservices.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ActionType + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ - _validation = { - 'name': {'readonly': True}, - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - 'action_type': {'readonly': True}, + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, } + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(PartialMinimalTrackedResource, self).__init__(**kwargs) + self.tags = tags + + +class PartialMinimalTrackedResourceWithIdentity(PartialMinimalTrackedResource): + """Strictly used in update requests. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + """ + _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'PartialManagedServiceIdentity'}, } def __init__( self, *, - display: Optional["OperationDisplay"] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["PartialManagedServiceIdentity"] = None, **kwargs ): """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.machinelearningservices.models.OperationDisplay + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity """ - super(Operation, self).__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - + super(PartialMinimalTrackedResourceWithIdentity, self).__init__(tags=tags, **kwargs) + self.identity = identity -class OperationDisplay(msrest.serialization.Model): - """Localized display information for this particular operation. - Variables are only populated by the server, and will be ignored when sending a request. +class PartialMinimalTrackedResourceWithSku(PartialMinimalTrackedResource): + """Strictly used in update requests. - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku """ - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, - } - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'PartialSku'}, } def __init__( self, + *, + tags: Optional[Dict[str, str]] = None, + sku: Optional["PartialSku"] = None, **kwargs ): """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku """ - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - + super(PartialMinimalTrackedResourceWithSku, self).__init__(tags=tags, **kwargs) + self.sku = sku -class OperationListResult(msrest.serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - Variables are only populated by the server, and will be ignored when sending a request. +class PartialMinimalTrackedResourceWithSkuAndIdentity(PartialMinimalTrackedResource): + """Strictly used in update requests. - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.machinelearningservices.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku """ - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'PartialManagedServiceIdentity'}, + 'sku': {'key': 'sku', 'type': 'PartialSku'}, } def __init__( self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["PartialManagedServiceIdentity"] = None, + sku: Optional["PartialSku"] = None, **kwargs ): """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku """ - super(OperationListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OutboundRuleBasicResource(Resource): - """Outbound Rule Basic Resource for the managed network of a machine learning workspace. + super(PartialMinimalTrackedResourceWithSkuAndIdentity, self).__init__(tags=tags, **kwargs) + self.identity = identity + self.sku = sku - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. +class PartialRegistryPartialTrackedResource(msrest.serialization.Model): + """Strictly used in update requests. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar properties: Required. Outbound Rule for the managed network of a machine learning - workspace. - :vartype properties: ~azure.mgmt.machinelearningservices.models.OutboundRule + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: + ~azure.mgmt.machinelearningservices.models.RegistryPartialManagedServiceIdentity + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'OutboundRule'}, + 'identity': {'key': 'identity', 'type': 'RegistryPartialManagedServiceIdentity'}, + 'sku': {'key': 'sku', 'type': 'PartialSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__( self, *, - properties: "OutboundRule", + identity: Optional["RegistryPartialManagedServiceIdentity"] = None, + sku: Optional["PartialSku"] = None, + tags: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword properties: Required. Outbound Rule for the managed network of a machine learning - workspace. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.OutboundRule + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: + ~azure.mgmt.machinelearningservices.models.RegistryPartialManagedServiceIdentity + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] """ - super(OutboundRuleBasicResource, self).__init__(**kwargs) - self.properties = properties + super(PartialRegistryPartialTrackedResource, self).__init__(**kwargs) + self.identity = identity + self.sku = sku + self.tags = tags -class OutboundRuleListResult(msrest.serialization.Model): - """List of outbound rules for the managed network of a machine learning workspace. +class PartialSku(msrest.serialization.Model): + """Common SKU definition. - :ivar next_link: The link to the next page constructed using the continuationToken. If null, - there are no additional pages. - :vartype next_link: str - :ivar value: The list of machine learning workspaces. Since this list may be incomplete, the - nextLink field should be used to request the next list of machine learning workspaces. - :vartype value: list[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] + :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :vartype capacity: int + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. + :vartype name: str + :ivar size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :vartype size: str + :ivar tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :vartype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[OutboundRuleBasicResource]'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, } def __init__( self, *, - next_link: Optional[str] = None, - value: Optional[List["OutboundRuleBasicResource"]] = None, + capacity: Optional[int] = None, + family: Optional[str] = None, + name: Optional[str] = None, + size: Optional[str] = None, + tier: Optional[Union[str, "SkuTier"]] = None, **kwargs ): """ - :keyword next_link: The link to the next page constructed using the continuationToken. If - null, there are no additional pages. - :paramtype next_link: str - :keyword value: The list of machine learning workspaces. Since this list may be incomplete, the - nextLink field should be used to request the next list of machine learning workspaces. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] + :keyword capacity: If the SKU supports scale out/in then the capacity integer should be + included. If scale out/in is not possible for the resource this may be omitted. + :paramtype capacity: int + :keyword family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. + :paramtype name: str + :keyword size: The SKU size. When the name field is the combination of tier and some other + value, this would be the standalone code. + :paramtype size: str + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :paramtype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier """ - super(OutboundRuleListResult, self).__init__(**kwargs) - self.next_link = next_link - self.value = value + super(PartialSku, self).__init__(**kwargs) + self.capacity = capacity + self.family = family + self.name = name + self.size = size + self.tier = tier -class OutputPathAssetReference(AssetReferenceBase): - """Reference to an asset via its path in a job output. +class Password(msrest.serialization.Model): + """Password. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar reference_type: Required. [Required] Specifies the type of asset reference.Constant - filled by server. Possible values include: "Id", "DataPath", "OutputPath". - :vartype reference_type: str or ~azure.mgmt.machinelearningservices.models.ReferenceType - :ivar job_id: ARM resource ID of the job. - :vartype job_id: str - :ivar path: The path of the file/directory in the job output. - :vartype path: str + :ivar name: + :vartype name: str + :ivar value: + :vartype value: str """ _validation = { - 'reference_type': {'required': True}, + 'name': {'readonly': True}, + 'value': {'readonly': True}, } _attribute_map = { - 'reference_type': {'key': 'referenceType', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'path': {'key': 'path', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, } def __init__( self, - *, - job_id: Optional[str] = None, - path: Optional[str] = None, **kwargs ): """ - :keyword job_id: ARM resource ID of the job. - :paramtype job_id: str - :keyword path: The path of the file/directory in the job output. - :paramtype path: str """ - super(OutputPathAssetReference, self).__init__(**kwargs) - self.reference_type = 'OutputPath' # type: str - self.job_id = job_id - self.path = path + super(Password, self).__init__(**kwargs) + self.name = None + self.value = None -class PaginatedComputeResourcesList(msrest.serialization.Model): - """Paginated list of Machine Learning compute objects wrapped in ARM resource envelope. +class PATAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """PATAuthTypeWorkspaceConnectionProperties. - :ivar value: An array of Machine Learning compute objects wrapped in ARM resource envelope. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ComputeResource] - :ivar next_link: A continuation link (absolute URI) to the next page of results in the list. - :vartype next_link: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar auth_type: Required. Authentication type of the connection target.Constant filled by + server. Possible values include: "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", + "AccountKey", "ServicePrincipal", "AccessKey", "ApiKey", "CustomKeys", "OAuth2", "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Possible values include: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", + "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", + "Serverless". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken """ + _validation = { + 'auth_type': {'required': True}, + 'created_by_workspace_arm_id': {'readonly': True}, + 'group': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[ComputeResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'auth_type': {'key': 'authType', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, + 'group': {'key': 'group', 'type': 'str'}, + 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, + 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, + 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionPersonalAccessToken'}, } def __init__( self, *, - value: Optional[List["ComputeResource"]] = None, - next_link: Optional[str] = None, + category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["WorkspaceConnectionPersonalAccessToken"] = None, **kwargs ): """ - :keyword value: An array of Machine Learning compute objects wrapped in ARM resource envelope. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.ComputeResource] - :keyword next_link: A continuation link (absolute URI) to the next page of results in the list. - :paramtype next_link: str + :keyword category: Category of the connection. Possible values include: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", + "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", + "Serverless". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken """ - super(PaginatedComputeResourcesList, self).__init__(**kwargs) - self.value = value - self.next_link = next_link + super(PATAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, error=error, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, metadata=metadata, pe_requirement=pe_requirement, pe_status=pe_status, shared_user_list=shared_user_list, target=target, use_workspace_managed_identity=use_workspace_managed_identity, **kwargs) + self.auth_type = 'PAT' # type: str + self.credentials = credentials -class PartialBatchDeployment(msrest.serialization.Model): - """Mutable batch inference settings per deployment. +class PendingUploadCredentialDto(msrest.serialization.Model): + """PendingUploadCredentialDto. - :ivar description: Description of the endpoint deployment. - :vartype description: str + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: SASCredentialDto. + + All required parameters must be populated in order to send to Azure. + + :ivar credential_type: Required. [Required] Credential type used to authentication with + storage.Constant filled by server. Possible values include: "SAS". + :vartype credential_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadCredentialType """ + _validation = { + 'credential_type': {'required': True}, + } + _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, + 'credential_type': {'key': 'credentialType', 'type': 'str'}, + } + + _subtype_map = { + 'credential_type': {'SAS': 'SASCredentialDto'} } def __init__( self, - *, - description: Optional[str] = None, **kwargs ): """ - :keyword description: Description of the endpoint deployment. - :paramtype description: str """ - super(PartialBatchDeployment, self).__init__(**kwargs) - self.description = description + super(PendingUploadCredentialDto, self).__init__(**kwargs) + self.credential_type = None # type: Optional[str] -class PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties(msrest.serialization.Model): - """Strictly used in update requests. +class PendingUploadRequestDto(msrest.serialization.Model): + """PendingUploadRequestDto. - :ivar properties: Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] + :ivar pending_upload_id: If PendingUploadId = null then random guid will be used. + :vartype pending_upload_id: str + :ivar pending_upload_type: TemporaryBlobReference is the only supported type. Possible values + include: "None", "TemporaryBlobReference". + :vartype pending_upload_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadType """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'PartialBatchDeployment'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'pending_upload_id': {'key': 'pendingUploadId', 'type': 'str'}, + 'pending_upload_type': {'key': 'pendingUploadType', 'type': 'str'}, } def __init__( self, *, - properties: Optional["PartialBatchDeployment"] = None, - tags: Optional[Dict[str, str]] = None, + pending_upload_id: Optional[str] = None, + pending_upload_type: Optional[Union[str, "PendingUploadType"]] = None, **kwargs ): """ - :keyword properties: Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] + :keyword pending_upload_id: If PendingUploadId = null then random guid will be used. + :paramtype pending_upload_id: str + :keyword pending_upload_type: TemporaryBlobReference is the only supported type. Possible + values include: "None", "TemporaryBlobReference". + :paramtype pending_upload_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadType """ - super(PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties, self).__init__(**kwargs) - self.properties = properties - self.tags = tags + super(PendingUploadRequestDto, self).__init__(**kwargs) + self.pending_upload_id = pending_upload_id + self.pending_upload_type = pending_upload_type -class PartialManagedServiceIdentity(msrest.serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). +class PendingUploadResponseDto(msrest.serialization.Model): + """PendingUploadResponseDto. - :ivar type: Managed service identity (system assigned and/or user assigned identities). - Possible values include: "None", "SystemAssigned", "UserAssigned", - "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, any] + :ivar blob_reference_for_consumption: Container level read, write, list SAS. + :vartype blob_reference_for_consumption: + ~azure.mgmt.machinelearningservices.models.BlobReferenceForConsumptionDto + :ivar pending_upload_id: ID for this upload request. + :vartype pending_upload_id: str + :ivar pending_upload_type: TemporaryBlobReference is the only supported type. Possible values + include: "None", "TemporaryBlobReference". + :vartype pending_upload_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadType """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{object}'}, + 'blob_reference_for_consumption': {'key': 'blobReferenceForConsumption', 'type': 'BlobReferenceForConsumptionDto'}, + 'pending_upload_id': {'key': 'pendingUploadId', 'type': 'str'}, + 'pending_upload_type': {'key': 'pendingUploadType', 'type': 'str'}, } def __init__( self, *, - type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, Any]] = None, + blob_reference_for_consumption: Optional["BlobReferenceForConsumptionDto"] = None, + pending_upload_id: Optional[str] = None, + pending_upload_type: Optional[Union[str, "PendingUploadType"]] = None, **kwargs ): """ - :keyword type: Managed service identity (system assigned and/or user assigned identities). - Possible values include: "None", "SystemAssigned", "UserAssigned", - "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, any] + :keyword blob_reference_for_consumption: Container level read, write, list SAS. + :paramtype blob_reference_for_consumption: + ~azure.mgmt.machinelearningservices.models.BlobReferenceForConsumptionDto + :keyword pending_upload_id: ID for this upload request. + :paramtype pending_upload_id: str + :keyword pending_upload_type: TemporaryBlobReference is the only supported type. Possible + values include: "None", "TemporaryBlobReference". + :paramtype pending_upload_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadType """ - super(PartialManagedServiceIdentity, self).__init__(**kwargs) - self.type = type - self.user_assigned_identities = user_assigned_identities + super(PendingUploadResponseDto, self).__init__(**kwargs) + self.blob_reference_for_consumption = blob_reference_for_consumption + self.pending_upload_id = pending_upload_id + self.pending_upload_type = pending_upload_type -class PartialMinimalTrackedResource(msrest.serialization.Model): - """Strictly used in update requests. +class PersonalComputeInstanceSettings(msrest.serialization.Model): + """Settings for a personal compute instance. - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] + :ivar assigned_user: A user explicitly assigned to a personal compute instance. + :vartype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + 'assigned_user': {'key': 'assignedUser', 'type': 'AssignedUser'}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, + assigned_user: Optional["AssignedUser"] = None, **kwargs ): """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] + :keyword assigned_user: A user explicitly assigned to a personal compute instance. + :paramtype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser """ - super(PartialMinimalTrackedResource, self).__init__(**kwargs) - self.tags = tags + super(PersonalComputeInstanceSettings, self).__init__(**kwargs) + self.assigned_user = assigned_user -class PartialMinimalTrackedResourceWithIdentity(PartialMinimalTrackedResource): - """Strictly used in update requests. +class PipelineJob(JobBaseProperties): + """Pipeline Job definition: defines generic to MFE attributes. - :ivar tags: A set of tags. Resource tags. + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :vartype tags: dict[str, str] - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :ivar component_id: ARM resource ID of the component resource. + :vartype component_id: str + :ivar compute_id: ARM resource ID of the compute resource. + :vartype compute_id: str + :ivar display_name: Display name of job. + :vartype display_name: str + :ivar experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :vartype experiment_name: str + :ivar identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar job_type: Required. [Required] Specifies the type of job.Constant filled by server. + Possible values include: "AutoML", "Command", "Sweep", "Pipeline", "Spark". + :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType + :ivar notification_setting: Notification setting for the job. + :vartype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :ivar services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :ivar status: Status of the job. Possible values include: "NotStarted", "Starting", + "Provisioning", "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", + "Failed", "Canceled", "NotResponding", "Paused", "Unknown". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :ivar inputs: Inputs for the pipeline job. + :vartype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] + :ivar jobs: Jobs construct the Pipeline Job. + :vartype jobs: dict[str, any] + :ivar outputs: Outputs for the pipeline job. + :vartype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :ivar settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. + :vartype settings: any + :ivar source_job_id: ARM resource ID of source job. + :vartype source_job_id: str """ + _validation = { + 'job_type': {'required': True}, + 'status': {'readonly': True}, + } + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'PartialManagedServiceIdentity'}, + 'component_id': {'key': 'componentId', 'type': 'str'}, + 'compute_id': {'key': 'computeId', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'experiment_name': {'key': 'experimentName', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'IdentityConfiguration'}, + 'is_archived': {'key': 'isArchived', 'type': 'bool'}, + 'job_type': {'key': 'jobType', 'type': 'str'}, + 'notification_setting': {'key': 'notificationSetting', 'type': 'NotificationSetting'}, + 'services': {'key': 'services', 'type': '{JobService}'}, + 'status': {'key': 'status', 'type': 'str'}, + 'inputs': {'key': 'inputs', 'type': '{JobInput}'}, + 'jobs': {'key': 'jobs', 'type': '{object}'}, + 'outputs': {'key': 'outputs', 'type': '{JobOutput}'}, + 'settings': {'key': 'settings', 'type': 'object'}, + 'source_job_id': {'key': 'sourceJobId', 'type': 'str'}, } def __init__( self, *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["PartialManagedServiceIdentity"] = None, + component_id: Optional[str] = None, + compute_id: Optional[str] = None, + display_name: Optional[str] = None, + experiment_name: Optional[str] = "Default", + identity: Optional["IdentityConfiguration"] = None, + is_archived: Optional[bool] = False, + notification_setting: Optional["NotificationSetting"] = None, + services: Optional[Dict[str, "JobService"]] = None, + inputs: Optional[Dict[str, "JobInput"]] = None, + jobs: Optional[Dict[str, Any]] = None, + outputs: Optional[Dict[str, "JobOutput"]] = None, + settings: Optional[Any] = None, + source_job_id: Optional[str] = None, **kwargs ): """ - :keyword tags: A set of tags. Resource tags. + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. :paramtype tags: dict[str, str] - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :keyword component_id: ARM resource ID of the component resource. + :paramtype component_id: str + :keyword compute_id: ARM resource ID of the compute resource. + :paramtype compute_id: str + :keyword display_name: Display name of job. + :paramtype display_name: str + :keyword experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :paramtype experiment_name: str + :keyword identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword notification_setting: Notification setting for the job. + :paramtype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :keyword services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :paramtype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :keyword inputs: Inputs for the pipeline job. + :paramtype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] + :keyword jobs: Jobs construct the Pipeline Job. + :paramtype jobs: dict[str, any] + :keyword outputs: Outputs for the pipeline job. + :paramtype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :keyword settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. + :paramtype settings: any + :keyword source_job_id: ARM resource ID of source job. + :paramtype source_job_id: str """ - super(PartialMinimalTrackedResourceWithIdentity, self).__init__(tags=tags, **kwargs) - self.identity = identity + super(PipelineJob, self).__init__(description=description, properties=properties, tags=tags, component_id=component_id, compute_id=compute_id, display_name=display_name, experiment_name=experiment_name, identity=identity, is_archived=is_archived, notification_setting=notification_setting, services=services, **kwargs) + self.job_type = 'Pipeline' # type: str + self.inputs = inputs + self.jobs = jobs + self.outputs = outputs + self.settings = settings + self.source_job_id = source_job_id -class PartialMinimalTrackedResourceWithSku(PartialMinimalTrackedResource): - """Strictly used in update requests. +class PredictionDriftMonitoringSignal(MonitoringSignalBase): + """PredictionDriftMonitoringSignal. - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + All required parameters must be populated in order to send to Azure. + + :ivar notification_types: The current notification mode for this signal. + :vartype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar signal_type: Required. [Required] Specifies the type of signal to monitor.Constant filled + by server. Possible values include: "DataDrift", "PredictionDrift", "DataQuality", + "FeatureAttributionDrift", "Custom". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar feature_data_type_override: A dictionary that maps feature names to their respective data + types. + :vartype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :ivar metric_thresholds: Required. [Required] A list of metrics to calculate and their + associated thresholds. + :vartype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.PredictionDriftMetricThresholdBase] + :ivar production_data: Required. [Required] The data which drift will be calculated for. + :vartype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :ivar reference_data: Required. [Required] The data to calculate drift against. + :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase """ + _validation = { + 'signal_type': {'required': True}, + 'metric_thresholds': {'required': True}, + 'production_data': {'required': True}, + 'reference_data': {'required': True}, + } + _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'PartialSku'}, + 'notification_types': {'key': 'notificationTypes', 'type': '[str]'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'signal_type': {'key': 'signalType', 'type': 'str'}, + 'feature_data_type_override': {'key': 'featureDataTypeOverride', 'type': '{str}'}, + 'metric_thresholds': {'key': 'metricThresholds', 'type': '[PredictionDriftMetricThresholdBase]'}, + 'production_data': {'key': 'productionData', 'type': 'MonitoringInputDataBase'}, + 'reference_data': {'key': 'referenceData', 'type': 'MonitoringInputDataBase'}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, - sku: Optional["PartialSku"] = None, + metric_thresholds: List["PredictionDriftMetricThresholdBase"], + production_data: "MonitoringInputDataBase", + reference_data: "MonitoringInputDataBase", + notification_types: Optional[List[Union[str, "MonitoringNotificationType"]]] = None, + properties: Optional[Dict[str, str]] = None, + feature_data_type_override: Optional[Dict[str, Union[str, "MonitoringFeatureDataType"]]] = None, **kwargs ): """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + :keyword notification_types: The current notification mode for this signal. + :paramtype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword feature_data_type_override: A dictionary that maps feature names to their respective + data types. + :paramtype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :keyword metric_thresholds: Required. [Required] A list of metrics to calculate and their + associated thresholds. + :paramtype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.PredictionDriftMetricThresholdBase] + :keyword production_data: Required. [Required] The data which drift will be calculated for. + :paramtype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :keyword reference_data: Required. [Required] The data to calculate drift against. + :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase """ - super(PartialMinimalTrackedResourceWithSku, self).__init__(tags=tags, **kwargs) - self.sku = sku + super(PredictionDriftMonitoringSignal, self).__init__(notification_types=notification_types, properties=properties, **kwargs) + self.signal_type = 'PredictionDrift' # type: str + self.feature_data_type_override = feature_data_type_override + self.metric_thresholds = metric_thresholds + self.production_data = production_data + self.reference_data = reference_data -class PartialMinimalTrackedResourceWithSkuAndIdentity(PartialMinimalTrackedResource): - """Strictly used in update requests. +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str """ + _validation = { + 'id': {'readonly': True}, + } + _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'PartialManagedServiceIdentity'}, - 'sku': {'key': 'sku', 'type': 'PartialSku'}, + 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["PartialManagedServiceIdentity"] = None, - sku: Optional["PartialSku"] = None, **kwargs ): """ - :keyword tags: A set of tags. Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku """ - super(PartialMinimalTrackedResourceWithSkuAndIdentity, self).__init__(tags=tags, **kwargs) - self.identity = identity - self.sku = sku + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None -class PartialRegistryPartialTrackedResource(msrest.serialization.Model): - """Strictly used in update requests. +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: - ~azure.mgmt.machinelearningservices.models.RegistryPartialManagedServiceIdentity - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku - :ivar tags: A set of tags. Resource tags. + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar location: Same as workspace location. + :vartype location: str + :ivar sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar tags: A set of tags. Dictionary of :code:``. :vartype tags: dict[str, str] + :ivar private_endpoint: The Private Endpoint resource. + :vartype private_endpoint: + ~azure.mgmt.machinelearningservices.models.WorkspacePrivateEndpointResource + :ivar private_link_service_connection_state: The connection state. + :vartype private_link_service_connection_state: + ~azure.mgmt.machinelearningservices.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnectionProvisioningState """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + _attribute_map = { - 'identity': {'key': 'identity', 'type': 'RegistryPartialManagedServiceIdentity'}, - 'sku': {'key': 'sku', 'type': 'PartialSku'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'WorkspacePrivateEndpointResource'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, *, - identity: Optional["RegistryPartialManagedServiceIdentity"] = None, - sku: Optional["PartialSku"] = None, + identity: Optional["ManagedServiceIdentity"] = None, + location: Optional[str] = None, + sku: Optional["Sku"] = None, tags: Optional[Dict[str, str]] = None, + private_endpoint: Optional["WorkspacePrivateEndpointResource"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: - ~azure.mgmt.machinelearningservices.models.RegistryPartialManagedServiceIdentity - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku - :keyword tags: A set of tags. Resource tags. + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword location: Same as workspace location. + :paramtype location: str + :keyword sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword tags: A set of tags. Dictionary of :code:``. :paramtype tags: dict[str, str] + :keyword private_endpoint: The Private Endpoint resource. + :paramtype private_endpoint: + ~azure.mgmt.machinelearningservices.models.WorkspacePrivateEndpointResource + :keyword private_link_service_connection_state: The connection state. + :paramtype private_link_service_connection_state: + ~azure.mgmt.machinelearningservices.models.PrivateLinkServiceConnectionState + :keyword provisioning_state: The current provisioning state. Possible values include: + "Succeeded", "Creating", "Deleting", "Failed". + :paramtype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnectionProvisioningState """ - super(PartialRegistryPartialTrackedResource, self).__init__(**kwargs) + super(PrivateEndpointConnection, self).__init__(**kwargs) self.identity = identity + self.location = location self.sku = sku self.tags = tags + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state -class PartialSku(msrest.serialization.Model): - """Common SKU definition. +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connection associated with the specified workspace. - :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :vartype capacity: int - :ivar family: If the service has different generations of hardware, for the same SKU, then that - can be captured here. - :vartype family: str - :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. - :vartype name: str - :ivar size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :vartype size: str - :ivar tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", - "Standard", "Premium". - :vartype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] """ _attribute_map = { - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, } def __init__( self, *, - capacity: Optional[int] = None, - family: Optional[str] = None, - name: Optional[str] = None, - size: Optional[str] = None, - tier: Optional[Union[str, "SkuTier"]] = None, - **kwargs - ): - """ - :keyword capacity: If the SKU supports scale out/in then the capacity integer should be - included. If scale out/in is not possible for the resource this may be omitted. - :paramtype capacity: int - :keyword family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :paramtype family: str - :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. - :paramtype name: str - :keyword size: The SKU size. When the name field is the combination of tier and some other - value, this would be the standalone code. - :paramtype size: str - :keyword tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", - "Standard", "Premium". - :paramtype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier - """ - super(PartialSku, self).__init__(**kwargs) - self.capacity = capacity - self.family = family - self.name = name - self.size = size - self.tier = tier - - -class Password(msrest.serialization.Model): - """Password. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: - :vartype name: str - :ivar value: - :vartype value: str - """ - - _validation = { - 'name': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, + value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] """ - super(Password, self).__init__(**kwargs) - self.name = None - self.value = None - - -class PATAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """PATAuthTypeWorkspaceConnectionProperties. - - Variables are only populated by the server, and will be ignored when sending a request. + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value - All required parameters must be populated in order to send to Azure. - :ivar auth_type: Required. Authentication type of the connection target.Constant filled by - server. Possible values include: "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", - "AccountKey", "ServicePrincipal", "AccessKey", "ApiKey", "CustomKeys", "OAuth2", "AAD". - :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType - :ivar category: Category of the connection. Possible values include: "PythonFeed", - "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", - "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", - "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", - "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", - "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", - "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", - "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", - "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", - "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", - "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", - "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", - "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", - "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", - "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", - "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". - :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :ivar created_by_workspace_arm_id: - :vartype created_by_workspace_arm_id: str - :ivar expiry_time: - :vartype expiry_time: ~datetime.datetime - :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", - "Database", "NoSQL", "File", "GenericProtocol", "ServicesAndApps". - :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup - :ivar is_shared_to_all: - :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str - :ivar metadata: Store user metadata for this connection. - :vartype metadata: dict[str, str] - :ivar shared_user_list: - :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :ivar credentials: - :vartype credentials: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken - """ +class PrivateEndpointDestination(msrest.serialization.Model): + """Private Endpoint destination for a Private Endpoint Outbound Rule for the managed network of a machine learning workspace. - _validation = { - 'auth_type': {'required': True}, - 'created_by_workspace_arm_id': {'readonly': True}, - 'group': {'readonly': True}, - } + :ivar service_resource_id: + :vartype service_resource_id: str + :ivar spark_enabled: + :vartype spark_enabled: bool + :ivar spark_status: Type of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Inactive", "Active". + :vartype spark_status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :ivar subresource_target: + :vartype subresource_target: str + """ _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, - 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, - 'group': {'key': 'group', 'type': 'str'}, - 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, - 'metadata': {'key': 'metadata', 'type': '{str}'}, - 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionPersonalAccessToken'}, + 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, + 'spark_enabled': {'key': 'sparkEnabled', 'type': 'bool'}, + 'spark_status': {'key': 'sparkStatus', 'type': 'str'}, + 'subresource_target': {'key': 'subresourceTarget', 'type': 'str'}, } def __init__( self, *, - category: Optional[Union[str, "ConnectionCategory"]] = None, - expiry_time: Optional[datetime.datetime] = None, - is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, - credentials: Optional["WorkspaceConnectionPersonalAccessToken"] = None, + service_resource_id: Optional[str] = None, + spark_enabled: Optional[bool] = None, + spark_status: Optional[Union[str, "RuleStatus"]] = None, + subresource_target: Optional[str] = None, **kwargs ): """ - :keyword category: Category of the connection. Possible values include: "PythonFeed", - "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", - "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", - "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", - "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", - "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", - "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", - "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", - "Sybase", "Teradata", "Vertica", "Cassandra", "Couchbase", "MongoDbV2", "MongoDbAtlas", - "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", - "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", - "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", - "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", - "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", - "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", - "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". - :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :keyword expiry_time: - :paramtype expiry_time: ~datetime.datetime - :keyword is_shared_to_all: - :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str - :keyword metadata: Store user metadata for this connection. - :paramtype metadata: dict[str, str] - :keyword shared_user_list: - :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - :keyword credentials: - :paramtype credentials: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken + :keyword service_resource_id: + :paramtype service_resource_id: str + :keyword spark_enabled: + :paramtype spark_enabled: bool + :keyword spark_status: Type of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Inactive", "Active". + :paramtype spark_status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :keyword subresource_target: + :paramtype subresource_target: str """ - super(PATAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, target=target, metadata=metadata, shared_user_list=shared_user_list, value=value, value_format=value_format, **kwargs) - self.auth_type = 'PAT' # type: str - self.credentials = credentials + super(PrivateEndpointDestination, self).__init__(**kwargs) + self.service_resource_id = service_resource_id + self.spark_enabled = spark_enabled + self.spark_status = spark_status + self.subresource_target = subresource_target -class PendingUploadCredentialDto(msrest.serialization.Model): - """PendingUploadCredentialDto. +class PrivateEndpointOutboundRule(OutboundRule): + """Private Endpoint Outbound Rule for the managed network of a machine learning workspace. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: SASCredentialDto. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar credential_type: Required. [Required] Credential type used to authentication with - storage.Constant filled by server. Possible values include: "SAS". - :vartype credential_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadCredentialType + :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Required", "Recommended", "UserDefined", "Dependency". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :ivar parent_rule_names: + :vartype parent_rule_names: list[str] + :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Possible + values include: "Inactive", "Active". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :ivar type: Required. Type of a managed network Outbound Rule of a machine learning + workspace.Constant filled by server. Possible values include: "FQDN", "PrivateEndpoint", + "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.RuleType + :ivar destination: Private Endpoint destination for a Private Endpoint Outbound Rule for the + managed network of a machine learning workspace. + :vartype destination: ~azure.mgmt.machinelearningservices.models.PrivateEndpointDestination + :ivar fqdns: + :vartype fqdns: list[str] """ _validation = { - 'credential_type': {'required': True}, + 'parent_rule_names': {'readonly': True}, + 'type': {'required': True}, } _attribute_map = { - 'credential_type': {'key': 'credentialType', 'type': 'str'}, - } - - _subtype_map = { - 'credential_type': {'SAS': 'SASCredentialDto'} + 'category': {'key': 'category', 'type': 'str'}, + 'parent_rule_names': {'key': 'parentRuleNames', 'type': '[str]'}, + 'status': {'key': 'status', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'destination': {'key': 'destination', 'type': 'PrivateEndpointDestination'}, + 'fqdns': {'key': 'fqdns', 'type': '[str]'}, } def __init__( self, + *, + category: Optional[Union[str, "RuleCategory"]] = None, + status: Optional[Union[str, "RuleStatus"]] = None, + destination: Optional["PrivateEndpointDestination"] = None, + fqdns: Optional[List[str]] = None, **kwargs ): """ + :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Required", "Recommended", "UserDefined", "Dependency". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :keyword status: Type of a managed network Outbound Rule of a machine learning workspace. + Possible values include: "Inactive", "Active". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :keyword destination: Private Endpoint destination for a Private Endpoint Outbound Rule for the + managed network of a machine learning workspace. + :paramtype destination: ~azure.mgmt.machinelearningservices.models.PrivateEndpointDestination + :keyword fqdns: + :paramtype fqdns: list[str] """ - super(PendingUploadCredentialDto, self).__init__(**kwargs) - self.credential_type = None # type: Optional[str] + super(PrivateEndpointOutboundRule, self).__init__(category=category, status=status, **kwargs) + self.type = 'PrivateEndpoint' # type: str + self.destination = destination + self.fqdns = fqdns -class PendingUploadRequestDto(msrest.serialization.Model): - """PendingUploadRequestDto. +class PrivateEndpointResource(PrivateEndpoint): + """The PE network resource that is linked to this PE connection. - :ivar pending_upload_id: If PendingUploadId = null then random guid will be used. - :vartype pending_upload_id: str - :ivar pending_upload_type: TemporaryBlobReference is the only supported type. Possible values - include: "None", "TemporaryBlobReference". - :vartype pending_upload_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadType + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + :ivar subnet_arm_id: The subnetId that the private endpoint is connected to. + :vartype subnet_arm_id: str """ + _validation = { + 'id': {'readonly': True}, + } + _attribute_map = { - 'pending_upload_id': {'key': 'pendingUploadId', 'type': 'str'}, - 'pending_upload_type': {'key': 'pendingUploadType', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'subnet_arm_id': {'key': 'subnetArmId', 'type': 'str'}, } def __init__( self, *, - pending_upload_id: Optional[str] = None, - pending_upload_type: Optional[Union[str, "PendingUploadType"]] = None, + subnet_arm_id: Optional[str] = None, **kwargs ): """ - :keyword pending_upload_id: If PendingUploadId = null then random guid will be used. - :paramtype pending_upload_id: str - :keyword pending_upload_type: TemporaryBlobReference is the only supported type. Possible - values include: "None", "TemporaryBlobReference". - :paramtype pending_upload_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadType + :keyword subnet_arm_id: The subnetId that the private endpoint is connected to. + :paramtype subnet_arm_id: str """ - super(PendingUploadRequestDto, self).__init__(**kwargs) - self.pending_upload_id = pending_upload_id - self.pending_upload_type = pending_upload_type + super(PrivateEndpointResource, self).__init__(**kwargs) + self.subnet_arm_id = subnet_arm_id -class PendingUploadResponseDto(msrest.serialization.Model): - """PendingUploadResponseDto. +class PrivateLinkResource(Resource): + """A private link resource. - :ivar blob_reference_for_consumption: Container level read, write, list SAS. - :vartype blob_reference_for_consumption: - ~azure.mgmt.machinelearningservices.models.BlobReferenceForConsumptionDto - :ivar pending_upload_id: ID for this upload request. - :vartype pending_upload_id: str - :ivar pending_upload_type: TemporaryBlobReference is the only supported type. Possible values - include: "None", "TemporaryBlobReference". - :vartype pending_upload_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadType + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar location: Same as workspace location. + :vartype location: str + :ivar sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar tags: A set of tags. Dictionary of :code:``. + :vartype tags: dict[str, str] + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + _attribute_map = { - 'blob_reference_for_consumption': {'key': 'blobReferenceForConsumption', 'type': 'BlobReferenceForConsumptionDto'}, - 'pending_upload_id': {'key': 'pendingUploadId', 'type': 'str'}, - 'pending_upload_type': {'key': 'pendingUploadType', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, } def __init__( self, *, - blob_reference_for_consumption: Optional["BlobReferenceForConsumptionDto"] = None, - pending_upload_id: Optional[str] = None, - pending_upload_type: Optional[Union[str, "PendingUploadType"]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + location: Optional[str] = None, + sku: Optional["Sku"] = None, + tags: Optional[Dict[str, str]] = None, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, **kwargs ): """ - :keyword blob_reference_for_consumption: Container level read, write, list SAS. - :paramtype blob_reference_for_consumption: - ~azure.mgmt.machinelearningservices.models.BlobReferenceForConsumptionDto - :keyword pending_upload_id: ID for this upload request. - :paramtype pending_upload_id: str - :keyword pending_upload_type: TemporaryBlobReference is the only supported type. Possible - values include: "None", "TemporaryBlobReference". - :paramtype pending_upload_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadType + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword location: Same as workspace location. + :paramtype location: str + :keyword sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword tags: A set of tags. Dictionary of :code:``. + :paramtype tags: dict[str, str] + :keyword group_id: The private link resource group id. + :paramtype group_id: str + :keyword required_members: The private link resource required member names. + :paramtype required_members: list[str] + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] """ - super(PendingUploadResponseDto, self).__init__(**kwargs) - self.blob_reference_for_consumption = blob_reference_for_consumption - self.pending_upload_id = pending_upload_id - self.pending_upload_type = pending_upload_type + super(PrivateLinkResource, self).__init__(**kwargs) + self.identity = identity + self.location = location + self.sku = sku + self.tags = tags + self.group_id = group_id + self.required_members = required_members + self.required_zone_names = required_zone_names -class PersonalComputeInstanceSettings(msrest.serialization.Model): - """Settings for a personal compute instance. +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. - :ivar assigned_user: A user explicitly assigned to a personal compute instance. - :vartype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser + :ivar value: + :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] """ _attribute_map = { - 'assigned_user': {'key': 'assignedUser', 'type': 'AssignedUser'}, + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, } def __init__( self, *, - assigned_user: Optional["AssignedUser"] = None, + value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): """ - :keyword assigned_user: A user explicitly assigned to a personal compute instance. - :paramtype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser + :keyword value: + :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] """ - super(PersonalComputeInstanceSettings, self).__init__(**kwargs) - self.assigned_user = assigned_user - - -class PipelineJob(JobBaseProperties): - """Pipeline Job definition: defines generic to MFE attributes. + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. - :ivar description: The asset description text. + :ivar actions_required: Some RP chose "None". Other RPs use this for region expansion. + :vartype actions_required: str + :ivar description: User-defined message that, per NRP doc, may be used for approval-related + message. :vartype description: str - :ivar properties: The asset property dictionary. - :vartype properties: dict[str, str] - :ivar tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar component_id: ARM resource ID of the component resource. - :vartype component_id: str - :ivar compute_id: ARM resource ID of the compute resource. - :vartype compute_id: str - :ivar display_name: Display name of job. - :vartype display_name: str - :ivar experiment_name: The name of the experiment the job belongs to. If not set, the job is - placed in the "Default" experiment. - :vartype experiment_name: str - :ivar identity: Identity configuration. If set, this should be one of AmlToken, - ManagedIdentity, UserIdentity or null. - Defaults to AmlToken if null. - :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar job_type: Required. [Required] Specifies the type of job.Constant filled by server. - Possible values include: "AutoML", "Command", "Sweep", "Pipeline", "Spark". - :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType - :ivar notification_setting: Notification setting for the job. - :vartype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting - :ivar services: List of JobEndpoints. - For local jobs, a job endpoint will have an endpoint value of FileStreamObject. - :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] - :ivar status: Status of the job. Possible values include: "NotStarted", "Starting", - "Provisioning", "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", - "Failed", "Canceled", "NotResponding", "Paused", "Unknown". - :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus - :ivar inputs: Inputs for the pipeline job. - :vartype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] - :ivar jobs: Jobs construct the Pipeline Job. - :vartype jobs: dict[str, any] - :ivar outputs: Outputs for the pipeline job. - :vartype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] - :ivar settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. - :vartype settings: any - :ivar source_job_id: ARM resource ID of source job. - :vartype source_job_id: str + :ivar status: Connection status of the service consumer with the service provider. Possible + values include: "Approved", "Pending", "Rejected", "Disconnected", "Timeout". + :vartype status: str or + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ - _validation = { - 'job_type': {'required': True}, - 'status': {'readonly': True}, - } - _attribute_map = { + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'component_id': {'key': 'componentId', 'type': 'str'}, - 'compute_id': {'key': 'computeId', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'experiment_name': {'key': 'experimentName', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'IdentityConfiguration'}, - 'is_archived': {'key': 'isArchived', 'type': 'bool'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'notification_setting': {'key': 'notificationSetting', 'type': 'NotificationSetting'}, - 'services': {'key': 'services', 'type': '{JobService}'}, 'status': {'key': 'status', 'type': 'str'}, - 'inputs': {'key': 'inputs', 'type': '{JobInput}'}, - 'jobs': {'key': 'jobs', 'type': '{object}'}, - 'outputs': {'key': 'outputs', 'type': '{JobOutput}'}, - 'settings': {'key': 'settings', 'type': 'object'}, - 'source_job_id': {'key': 'sourceJobId', 'type': 'str'}, } def __init__( self, *, + actions_required: Optional[str] = None, description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - component_id: Optional[str] = None, - compute_id: Optional[str] = None, - display_name: Optional[str] = None, - experiment_name: Optional[str] = "Default", - identity: Optional["IdentityConfiguration"] = None, - is_archived: Optional[bool] = False, - notification_setting: Optional["NotificationSetting"] = None, - services: Optional[Dict[str, "JobService"]] = None, - inputs: Optional[Dict[str, "JobInput"]] = None, - jobs: Optional[Dict[str, Any]] = None, - outputs: Optional[Dict[str, "JobOutput"]] = None, - settings: Optional[Any] = None, - source_job_id: Optional[str] = None, + status: Optional[Union[str, "EndpointServiceConnectionStatus"]] = None, **kwargs ): """ - :keyword description: The asset description text. + :keyword actions_required: Some RP chose "None". Other RPs use this for region expansion. + :paramtype actions_required: str + :keyword description: User-defined message that, per NRP doc, may be used for approval-related + message. :paramtype description: str - :keyword properties: The asset property dictionary. - :paramtype properties: dict[str, str] - :keyword tags: A set of tags. Tag dictionary. Tags can be added, removed, and updated. - :paramtype tags: dict[str, str] - :keyword component_id: ARM resource ID of the component resource. - :paramtype component_id: str - :keyword compute_id: ARM resource ID of the compute resource. - :paramtype compute_id: str - :keyword display_name: Display name of job. - :paramtype display_name: str - :keyword experiment_name: The name of the experiment the job belongs to. If not set, the job is - placed in the "Default" experiment. - :paramtype experiment_name: str - :keyword identity: Identity configuration. If set, this should be one of AmlToken, - ManagedIdentity, UserIdentity or null. - Defaults to AmlToken if null. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword notification_setting: Notification setting for the job. - :paramtype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting - :keyword services: List of JobEndpoints. - For local jobs, a job endpoint will have an endpoint value of FileStreamObject. - :paramtype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] - :keyword inputs: Inputs for the pipeline job. - :paramtype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] - :keyword jobs: Jobs construct the Pipeline Job. - :paramtype jobs: dict[str, any] - :keyword outputs: Outputs for the pipeline job. - :paramtype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] - :keyword settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. - :paramtype settings: any - :keyword source_job_id: ARM resource ID of source job. - :paramtype source_job_id: str + :keyword status: Connection status of the service consumer with the service provider. Possible + values include: "Approved", "Pending", "Rejected", "Disconnected", "Timeout". + :paramtype status: str or + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ - super(PipelineJob, self).__init__(description=description, properties=properties, tags=tags, component_id=component_id, compute_id=compute_id, display_name=display_name, experiment_name=experiment_name, identity=identity, is_archived=is_archived, notification_setting=notification_setting, services=services, **kwargs) - self.job_type = 'Pipeline' # type: str - self.inputs = inputs - self.jobs = jobs - self.outputs = outputs - self.settings = settings - self.source_job_id = source_job_id + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.actions_required = actions_required + self.description = description + self.status = status -class PredictionDriftMonitoringSignal(MonitoringSignalBase): - """PredictionDriftMonitoringSignal. +class ProbeSettings(msrest.serialization.Model): + """Deployment container liveness/readiness probe configuration. - All required parameters must be populated in order to send to Azure. + :ivar failure_threshold: The number of failures to allow before returning an unhealthy status. + :vartype failure_threshold: int + :ivar initial_delay: The delay before the first probe in ISO 8601 format. + :vartype initial_delay: ~datetime.timedelta + :ivar period: The length of time between probes in ISO 8601 format. + :vartype period: ~datetime.timedelta + :ivar success_threshold: The number of successful probes before returning a healthy status. + :vartype success_threshold: int + :ivar timeout: The probe timeout in ISO 8601 format. + :vartype timeout: ~datetime.timedelta + """ - :ivar notification_types: The current notification mode for this signal. - :vartype notification_types: list[str or - ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] - :ivar properties: Property dictionary. Properties can be added, but not removed or altered. - :vartype properties: dict[str, str] - :ivar signal_type: Required. [Required] Specifies the type of signal to monitor.Constant filled - by server. Possible values include: "DataDrift", "PredictionDrift", "DataQuality", - "FeatureAttributionDrift", "Custom". - :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType - :ivar feature_data_type_override: A dictionary that maps feature names to their respective data - types. - :vartype feature_data_type_override: dict[str, str or - ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] - :ivar metric_thresholds: Required. [Required] A list of metrics to calculate and their - associated thresholds. - :vartype metric_thresholds: - list[~azure.mgmt.machinelearningservices.models.PredictionDriftMetricThresholdBase] - :ivar production_data: Required. [Required] The data which drift will be calculated for. - :vartype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase - :ivar reference_data: Required. [Required] The data to calculate drift against. - :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + _attribute_map = { + 'failure_threshold': {'key': 'failureThreshold', 'type': 'int'}, + 'initial_delay': {'key': 'initialDelay', 'type': 'duration'}, + 'period': {'key': 'period', 'type': 'duration'}, + 'success_threshold': {'key': 'successThreshold', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'duration'}, + } + + def __init__( + self, + *, + failure_threshold: Optional[int] = 30, + initial_delay: Optional[datetime.timedelta] = None, + period: Optional[datetime.timedelta] = "PT10S", + success_threshold: Optional[int] = 1, + timeout: Optional[datetime.timedelta] = "PT2S", + **kwargs + ): + """ + :keyword failure_threshold: The number of failures to allow before returning an unhealthy + status. + :paramtype failure_threshold: int + :keyword initial_delay: The delay before the first probe in ISO 8601 format. + :paramtype initial_delay: ~datetime.timedelta + :keyword period: The length of time between probes in ISO 8601 format. + :paramtype period: ~datetime.timedelta + :keyword success_threshold: The number of successful probes before returning a healthy status. + :paramtype success_threshold: int + :keyword timeout: The probe timeout in ISO 8601 format. + :paramtype timeout: ~datetime.timedelta + """ + super(ProbeSettings, self).__init__(**kwargs) + self.failure_threshold = failure_threshold + self.initial_delay = initial_delay + self.period = period + self.success_threshold = success_threshold + self.timeout = timeout + + +class PyTorch(DistributionConfiguration): + """PyTorch distribution configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar distribution_type: Required. [Required] Specifies the type of distribution + framework.Constant filled by server. Possible values include: "PyTorch", "TensorFlow", "Mpi". + :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType + :ivar process_count_per_instance: Number of processes per node. + :vartype process_count_per_instance: int """ _validation = { - 'signal_type': {'required': True}, - 'metric_thresholds': {'required': True}, - 'production_data': {'required': True}, - 'reference_data': {'required': True}, + 'distribution_type': {'required': True}, } _attribute_map = { - 'notification_types': {'key': 'notificationTypes', 'type': '[str]'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'signal_type': {'key': 'signalType', 'type': 'str'}, - 'feature_data_type_override': {'key': 'featureDataTypeOverride', 'type': '{str}'}, - 'metric_thresholds': {'key': 'metricThresholds', 'type': '[PredictionDriftMetricThresholdBase]'}, - 'production_data': {'key': 'productionData', 'type': 'MonitoringInputDataBase'}, - 'reference_data': {'key': 'referenceData', 'type': 'MonitoringInputDataBase'}, + 'distribution_type': {'key': 'distributionType', 'type': 'str'}, + 'process_count_per_instance': {'key': 'processCountPerInstance', 'type': 'int'}, } def __init__( self, *, - metric_thresholds: List["PredictionDriftMetricThresholdBase"], - production_data: "MonitoringInputDataBase", - reference_data: "MonitoringInputDataBase", - notification_types: Optional[List[Union[str, "MonitoringNotificationType"]]] = None, - properties: Optional[Dict[str, str]] = None, - feature_data_type_override: Optional[Dict[str, Union[str, "MonitoringFeatureDataType"]]] = None, + process_count_per_instance: Optional[int] = None, **kwargs ): """ - :keyword notification_types: The current notification mode for this signal. - :paramtype notification_types: list[str or - ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. - :paramtype properties: dict[str, str] - :keyword feature_data_type_override: A dictionary that maps feature names to their respective - data types. - :paramtype feature_data_type_override: dict[str, str or - ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] - :keyword metric_thresholds: Required. [Required] A list of metrics to calculate and their - associated thresholds. - :paramtype metric_thresholds: - list[~azure.mgmt.machinelearningservices.models.PredictionDriftMetricThresholdBase] - :keyword production_data: Required. [Required] The data which drift will be calculated for. - :paramtype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase - :keyword reference_data: Required. [Required] The data to calculate drift against. - :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :keyword process_count_per_instance: Number of processes per node. + :paramtype process_count_per_instance: int """ - super(PredictionDriftMonitoringSignal, self).__init__(notification_types=notification_types, properties=properties, **kwargs) - self.signal_type = 'PredictionDrift' # type: str - self.feature_data_type_override = feature_data_type_override - self.metric_thresholds = metric_thresholds - self.production_data = production_data - self.reference_data = reference_data - + super(PyTorch, self).__init__(**kwargs) + self.distribution_type = 'PyTorch' # type: str + self.process_count_per_instance = process_count_per_instance -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - Variables are only populated by the server, and will be ignored when sending a request. +class QueueSettings(msrest.serialization.Model): + """QueueSettings. - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str + :ivar job_tier: Controls the compute job tier. Possible values include: "Null", "Spot", + "Basic", "Standard", "Premium". + :vartype job_tier: str or ~azure.mgmt.machinelearningservices.models.JobTier """ - _validation = { - 'id': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + 'job_tier': {'key': 'jobTier', 'type': 'str'}, } def __init__( self, + *, + job_tier: Optional[Union[str, "JobTier"]] = None, **kwargs ): """ + :keyword job_tier: Controls the compute job tier. Possible values include: "Null", "Spot", + "Basic", "Standard", "Premium". + :paramtype job_tier: str or ~azure.mgmt.machinelearningservices.models.JobTier """ - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - + super(QueueSettings, self).__init__(**kwargs) + self.job_tier = job_tier -class PrivateEndpointConnection(Resource): - """The Private Endpoint Connection resource. - Variables are only populated by the server, and will be ignored when sending a request. +class QuotaBaseProperties(msrest.serialization.Model): + """The properties for Quota update or retrieval. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Specifies the resource ID. :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: Specifies the resource type. :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar private_endpoint: The resource of private end point. - :vartype private_endpoint: ~azure.mgmt.machinelearningservices.models.PrivateEndpoint - :ivar private_link_service_connection_state: A collection of information about the state of the - connection between service consumer and provider. - :vartype private_link_service_connection_state: - ~azure.mgmt.machinelearningservices.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnectionProvisioningState + :ivar limit: The maximum permitted quota of the resource. + :vartype limit: long + :ivar unit: An enum describing the unit of quota measurement. Possible values include: "Count". + :vartype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'unit': {'key': 'unit', 'type': 'str'}, } def __init__( self, *, - identity: Optional["ManagedServiceIdentity"] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["Sku"] = None, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + id: Optional[str] = None, + type: Optional[str] = None, + limit: Optional[int] = None, + unit: Optional[Union[str, "QuotaUnit"]] = None, **kwargs ): """ - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword private_endpoint: The resource of private end point. - :paramtype private_endpoint: ~azure.mgmt.machinelearningservices.models.PrivateEndpoint - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.machinelearningservices.models.PrivateLinkServiceConnectionState + :keyword id: Specifies the resource ID. + :paramtype id: str + :keyword type: Specifies the resource type. + :paramtype type: str + :keyword limit: The maximum permitted quota of the resource. + :paramtype limit: long + :keyword unit: An enum describing the unit of quota measurement. Possible values include: + "Count". + :paramtype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit """ - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.identity = identity - self.location = location - self.tags = tags - self.sku = sku - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None + super(QuotaBaseProperties, self).__init__(**kwargs) + self.id = id + self.type = type + self.limit = limit + self.unit = unit -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """List of private endpoint connection associated with the specified workspace. +class QuotaUpdateParameters(msrest.serialization.Model): + """Quota update parameters. - :ivar value: Array of private endpoint connections. - :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] + :ivar value: The list for update quota. + :vartype value: list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] + :ivar location: Region of workspace quota to be updated. + :vartype location: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'value': {'key': 'value', 'type': '[QuotaBaseProperties]'}, + 'location': {'key': 'location', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["QuotaBaseProperties"]] = None, + location: Optional[str] = None, **kwargs ): """ - :keyword value: Array of private endpoint connections. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] + :keyword value: The list for update quota. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] + :keyword location: Region of workspace quota to be updated. + :paramtype location: str """ - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + super(QuotaUpdateParameters, self).__init__(**kwargs) self.value = value + self.location = location -class PrivateEndpointDestination(msrest.serialization.Model): - """Private Endpoint destination for a Private Endpoint Outbound Rule for the managed network of a machine learning workspace. +class RaiBlocklistConfig(msrest.serialization.Model): + """Azure OpenAI blocklist config. - :ivar service_resource_id: - :vartype service_resource_id: str - :ivar spark_enabled: - :vartype spark_enabled: bool - :ivar spark_status: Type of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Inactive", "Active". - :vartype spark_status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus - :ivar subresource_target: - :vartype subresource_target: str + :ivar blocking: If blocking would occur. + :vartype blocking: bool + :ivar blocklist_name: Name of ContentFilter. + :vartype blocklist_name: str """ _attribute_map = { - 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, - 'spark_enabled': {'key': 'sparkEnabled', 'type': 'bool'}, - 'spark_status': {'key': 'sparkStatus', 'type': 'str'}, - 'subresource_target': {'key': 'subresourceTarget', 'type': 'str'}, + 'blocking': {'key': 'blocking', 'type': 'bool'}, + 'blocklist_name': {'key': 'blocklistName', 'type': 'str'}, } def __init__( self, *, - service_resource_id: Optional[str] = None, - spark_enabled: Optional[bool] = None, - spark_status: Optional[Union[str, "RuleStatus"]] = None, - subresource_target: Optional[str] = None, + blocking: Optional[bool] = None, + blocklist_name: Optional[str] = None, **kwargs ): """ - :keyword service_resource_id: - :paramtype service_resource_id: str - :keyword spark_enabled: - :paramtype spark_enabled: bool - :keyword spark_status: Type of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Inactive", "Active". - :paramtype spark_status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus - :keyword subresource_target: - :paramtype subresource_target: str + :keyword blocking: If blocking would occur. + :paramtype blocking: bool + :keyword blocklist_name: Name of ContentFilter. + :paramtype blocklist_name: str """ - super(PrivateEndpointDestination, self).__init__(**kwargs) - self.service_resource_id = service_resource_id - self.spark_enabled = spark_enabled - self.spark_status = spark_status - self.subresource_target = subresource_target - - -class PrivateEndpointOutboundRule(OutboundRule): - """Private Endpoint Outbound Rule for the managed network of a machine learning workspace. + super(RaiBlocklistConfig, self).__init__(**kwargs) + self.blocking = blocking + self.blocklist_name = blocklist_name - All required parameters must be populated in order to send to Azure. - - :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Required", "Recommended", "UserDefined", "Dependency". - :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory - :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Possible - values include: "Inactive", "Active". - :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus - :ivar type: Required. Type of a managed network Outbound Rule of a machine learning - workspace.Constant filled by server. Possible values include: "FQDN", "PrivateEndpoint", - "ServiceTag". - :vartype type: str or ~azure.mgmt.machinelearningservices.models.RuleType - :ivar destination: Private Endpoint destination for a Private Endpoint Outbound Rule for the - managed network of a machine learning workspace. - :vartype destination: ~azure.mgmt.machinelearningservices.models.PrivateEndpointDestination - """ - _validation = { - 'type': {'required': True}, - } +class RaiBlocklistItemBulkRequest(msrest.serialization.Model): + """The Cognitive Services RaiBlocklist Item request body. + + :ivar name: + :vartype name: str + :ivar properties: Properties of Cognitive Services RaiBlocklist Item. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemProperties + """ _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'destination': {'key': 'destination', 'type': 'PrivateEndpointDestination'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RaiBlocklistItemProperties'}, } def __init__( self, *, - category: Optional[Union[str, "RuleCategory"]] = None, - status: Optional[Union[str, "RuleStatus"]] = None, - destination: Optional["PrivateEndpointDestination"] = None, + name: Optional[str] = None, + properties: Optional["RaiBlocklistItemProperties"] = None, **kwargs ): """ - :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Required", "Recommended", "UserDefined", "Dependency". - :paramtype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory - :keyword status: Type of a managed network Outbound Rule of a machine learning workspace. - Possible values include: "Inactive", "Active". - :paramtype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus - :keyword destination: Private Endpoint destination for a Private Endpoint Outbound Rule for the - managed network of a machine learning workspace. - :paramtype destination: ~azure.mgmt.machinelearningservices.models.PrivateEndpointDestination + :keyword name: + :paramtype name: str + :keyword properties: Properties of Cognitive Services RaiBlocklist Item. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemProperties """ - super(PrivateEndpointOutboundRule, self).__init__(category=category, status=status, **kwargs) - self.type = 'PrivateEndpoint' # type: str - self.destination = destination - + super(RaiBlocklistItemBulkRequest, self).__init__(**kwargs) + self.name = name + self.properties = properties -class PrivateEndpointResource(PrivateEndpoint): - """The PE network resource that is linked to this PE connection. - Variables are only populated by the server, and will be ignored when sending a request. +class RaiBlocklistItemProperties(msrest.serialization.Model): + """RAI Custom Blocklist Item properties. - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - :ivar subnet_arm_id: The subnetId that the private endpoint is connected to. - :vartype subnet_arm_id: str + :ivar is_regex: If the pattern is a regex pattern. + :vartype is_regex: bool + :ivar pattern: Pattern to match against. + :vartype pattern: str """ - _validation = { - 'id': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'subnet_arm_id': {'key': 'subnetArmId', 'type': 'str'}, + 'is_regex': {'key': 'isRegex', 'type': 'bool'}, + 'pattern': {'key': 'pattern', 'type': 'str'}, } def __init__( self, *, - subnet_arm_id: Optional[str] = None, + is_regex: Optional[bool] = None, + pattern: Optional[str] = None, **kwargs ): """ - :keyword subnet_arm_id: The subnetId that the private endpoint is connected to. - :paramtype subnet_arm_id: str + :keyword is_regex: If the pattern is a regex pattern. + :paramtype is_regex: bool + :keyword pattern: Pattern to match against. + :paramtype pattern: str """ - super(PrivateEndpointResource, self).__init__(**kwargs) - self.subnet_arm_id = subnet_arm_id + super(RaiBlocklistItemProperties, self).__init__(**kwargs) + self.is_regex = is_regex + self.pattern = pattern -class PrivateLinkResource(Resource): - """A private link resource. +class RaiBlocklistItemPropertiesBasicResource(Resource): + """RaiBlocklistItemPropertiesBasicResource. Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str @@ -23091,20 +25556,8 @@ class PrivateLinkResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource Private link DNS zone name. - :vartype required_zone_names: list[str] + :ivar properties: Required. RAI Custom Blocklist Item properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemProperties """ _validation = { @@ -23112,8 +25565,7 @@ class PrivateLinkResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, + 'properties': {'required': True}, } _attribute_map = { @@ -23121,313 +25573,379 @@ class PrivateLinkResource(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + 'properties': {'key': 'properties', 'type': 'RaiBlocklistItemProperties'}, } def __init__( self, *, - identity: Optional["ManagedServiceIdentity"] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["Sku"] = None, - required_zone_names: Optional[List[str]] = None, + properties: "RaiBlocklistItemProperties", **kwargs ): """ - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword required_zone_names: The private link resource Private link DNS zone name. - :paramtype required_zone_names: list[str] + :keyword properties: Required. RAI Custom Blocklist Item properties. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemProperties """ - super(PrivateLinkResource, self).__init__(**kwargs) - self.identity = identity - self.location = location - self.tags = tags - self.sku = sku - self.group_id = None - self.required_members = None - self.required_zone_names = required_zone_names + super(RaiBlocklistItemPropertiesBasicResource, self).__init__(**kwargs) + self.properties = properties -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. +class RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult(msrest.serialization.Model): + """RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult. - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[RaiBlocklistItemPropertiesBasicResource]'}, } def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + next_link: Optional[str] = None, + value: Optional[List["RaiBlocklistItemPropertiesBasicResource"]] = None, **kwargs ): """ - :keyword value: Array of private link resources. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] """ - super(PrivateLinkResourceListResult, self).__init__(**kwargs) + super(RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link self.value = value -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. +class RaiBlocklistProperties(msrest.serialization.Model): + """RAI Custom Blocklist properties. - :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected", "Disconnected", - "Timeout". - :vartype status: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointServiceConnectionStatus - :ivar description: The reason for approval/rejection of the connection. + :ivar description: Description of the block list. :vartype description: str - :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :vartype actions_required: str """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - actions_required: Optional[str] = None, **kwargs ): """ - :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Possible values include: "Pending", "Approved", "Rejected", - "Disconnected", "Timeout". - :paramtype status: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointServiceConnectionStatus - :keyword description: The reason for approval/rejection of the connection. + :keyword description: Description of the block list. :paramtype description: str - :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :paramtype actions_required: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = status + super(RaiBlocklistProperties, self).__init__(**kwargs) self.description = description - self.actions_required = actions_required -class ProbeSettings(msrest.serialization.Model): - """Deployment container liveness/readiness probe configuration. +class RaiBlocklistPropertiesBasicResource(Resource): + """RaiBlocklistPropertiesBasicResource. - :ivar failure_threshold: The number of failures to allow before returning an unhealthy status. - :vartype failure_threshold: int - :ivar initial_delay: The delay before the first probe in ISO 8601 format. - :vartype initial_delay: ~datetime.timedelta - :ivar period: The length of time between probes in ISO 8601 format. - :vartype period: ~datetime.timedelta - :ivar success_threshold: The number of successful probes before returning a healthy status. - :vartype success_threshold: int - :ivar timeout: The probe timeout in ISO 8601 format. - :vartype timeout: ~datetime.timedelta + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. RAI Custom Blocklist properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistProperties """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + _attribute_map = { - 'failure_threshold': {'key': 'failureThreshold', 'type': 'int'}, - 'initial_delay': {'key': 'initialDelay', 'type': 'duration'}, - 'period': {'key': 'period', 'type': 'duration'}, - 'success_threshold': {'key': 'successThreshold', 'type': 'int'}, - 'timeout': {'key': 'timeout', 'type': 'duration'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'RaiBlocklistProperties'}, } def __init__( self, *, - failure_threshold: Optional[int] = 30, - initial_delay: Optional[datetime.timedelta] = None, - period: Optional[datetime.timedelta] = "PT10S", - success_threshold: Optional[int] = 1, - timeout: Optional[datetime.timedelta] = "PT2S", + properties: "RaiBlocklistProperties", **kwargs ): """ - :keyword failure_threshold: The number of failures to allow before returning an unhealthy - status. - :paramtype failure_threshold: int - :keyword initial_delay: The delay before the first probe in ISO 8601 format. - :paramtype initial_delay: ~datetime.timedelta - :keyword period: The length of time between probes in ISO 8601 format. - :paramtype period: ~datetime.timedelta - :keyword success_threshold: The number of successful probes before returning a healthy status. - :paramtype success_threshold: int - :keyword timeout: The probe timeout in ISO 8601 format. - :paramtype timeout: ~datetime.timedelta + :keyword properties: Required. RAI Custom Blocklist properties. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistProperties """ - super(ProbeSettings, self).__init__(**kwargs) - self.failure_threshold = failure_threshold - self.initial_delay = initial_delay - self.period = period - self.success_threshold = success_threshold - self.timeout = timeout - + super(RaiBlocklistPropertiesBasicResource, self).__init__(**kwargs) + self.properties = properties -class PyTorch(DistributionConfiguration): - """PyTorch distribution configuration. - All required parameters must be populated in order to send to Azure. +class RaiBlocklistPropertiesBasicResourceArmPaginatedResult(msrest.serialization.Model): + """RaiBlocklistPropertiesBasicResourceArmPaginatedResult. - :ivar distribution_type: Required. [Required] Specifies the type of distribution - framework.Constant filled by server. Possible values include: "PyTorch", "TensorFlow", "Mpi". - :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType - :ivar process_count_per_instance: Number of processes per node. - :vartype process_count_per_instance: int + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] """ - _validation = { - 'distribution_type': {'required': True}, + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[RaiBlocklistPropertiesBasicResource]'}, } + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["RaiBlocklistPropertiesBasicResource"]] = None, + **kwargs + ): + """ + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] + """ + super(RaiBlocklistPropertiesBasicResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class RaiPolicyContentFilter(msrest.serialization.Model): + """Azure OpenAI Content Filter. + + :ivar allowed_content_level: Level at which content is filtered. Possible values include: + "Low", "Medium", "High". + :vartype allowed_content_level: str or + ~azure.mgmt.machinelearningservices.models.AllowedContentLevel + :ivar blocking: If blocking would occur. + :vartype blocking: bool + :ivar enabled: If the ContentFilter is enabled. + :vartype enabled: bool + :ivar name: Name of ContentFilter. + :vartype name: str + :ivar source: Content source to apply the Content Filters. Possible values include: "Prompt", + "Completion". + :vartype source: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyContentSource + """ + _attribute_map = { - 'distribution_type': {'key': 'distributionType', 'type': 'str'}, - 'process_count_per_instance': {'key': 'processCountPerInstance', 'type': 'int'}, + 'allowed_content_level': {'key': 'allowedContentLevel', 'type': 'str'}, + 'blocking': {'key': 'blocking', 'type': 'bool'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, } def __init__( self, *, - process_count_per_instance: Optional[int] = None, + allowed_content_level: Optional[Union[str, "AllowedContentLevel"]] = None, + blocking: Optional[bool] = None, + enabled: Optional[bool] = None, + name: Optional[str] = None, + source: Optional[Union[str, "RaiPolicyContentSource"]] = None, **kwargs ): """ - :keyword process_count_per_instance: Number of processes per node. - :paramtype process_count_per_instance: int + :keyword allowed_content_level: Level at which content is filtered. Possible values include: + "Low", "Medium", "High". + :paramtype allowed_content_level: str or + ~azure.mgmt.machinelearningservices.models.AllowedContentLevel + :keyword blocking: If blocking would occur. + :paramtype blocking: bool + :keyword enabled: If the ContentFilter is enabled. + :paramtype enabled: bool + :keyword name: Name of ContentFilter. + :paramtype name: str + :keyword source: Content source to apply the Content Filters. Possible values include: + "Prompt", "Completion". + :paramtype source: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyContentSource """ - super(PyTorch, self).__init__(**kwargs) - self.distribution_type = 'PyTorch' # type: str - self.process_count_per_instance = process_count_per_instance + super(RaiPolicyContentFilter, self).__init__(**kwargs) + self.allowed_content_level = allowed_content_level + self.blocking = blocking + self.enabled = enabled + self.name = name + self.source = source -class QueueSettings(msrest.serialization.Model): - """QueueSettings. +class RaiPolicyProperties(msrest.serialization.Model): + """Azure OpenAI Content Filters properties. - :ivar job_tier: Controls the compute job tier. Possible values include: "Null", "Spot", - "Basic", "Standard", "Premium". - :vartype job_tier: str or ~azure.mgmt.machinelearningservices.models.JobTier + :ivar base_policy_name: Name of the base Content Filters. + :vartype base_policy_name: str + :ivar completion_blocklists: + :vartype completion_blocklists: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistConfig] + :ivar content_filters: + :vartype content_filters: + list[~azure.mgmt.machinelearningservices.models.RaiPolicyContentFilter] + :ivar mode: Content Filters mode. Possible values include: "Default", "Deferred", "Blocking". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyMode + :ivar prompt_blocklists: + :vartype prompt_blocklists: list[~azure.mgmt.machinelearningservices.models.RaiBlocklistConfig] + :ivar type: Content Filters policy type. Possible values include: "UserManaged", + "SystemManaged". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyType """ _attribute_map = { - 'job_tier': {'key': 'jobTier', 'type': 'str'}, + 'base_policy_name': {'key': 'basePolicyName', 'type': 'str'}, + 'completion_blocklists': {'key': 'completionBlocklists', 'type': '[RaiBlocklistConfig]'}, + 'content_filters': {'key': 'contentFilters', 'type': '[RaiPolicyContentFilter]'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'prompt_blocklists': {'key': 'promptBlocklists', 'type': '[RaiBlocklistConfig]'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, *, - job_tier: Optional[Union[str, "JobTier"]] = None, + base_policy_name: Optional[str] = None, + completion_blocklists: Optional[List["RaiBlocklistConfig"]] = None, + content_filters: Optional[List["RaiPolicyContentFilter"]] = None, + mode: Optional[Union[str, "RaiPolicyMode"]] = None, + prompt_blocklists: Optional[List["RaiBlocklistConfig"]] = None, + type: Optional[Union[str, "RaiPolicyType"]] = None, **kwargs ): """ - :keyword job_tier: Controls the compute job tier. Possible values include: "Null", "Spot", - "Basic", "Standard", "Premium". - :paramtype job_tier: str or ~azure.mgmt.machinelearningservices.models.JobTier + :keyword base_policy_name: Name of the base Content Filters. + :paramtype base_policy_name: str + :keyword completion_blocklists: + :paramtype completion_blocklists: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistConfig] + :keyword content_filters: + :paramtype content_filters: + list[~azure.mgmt.machinelearningservices.models.RaiPolicyContentFilter] + :keyword mode: Content Filters mode. Possible values include: "Default", "Deferred", + "Blocking". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyMode + :keyword prompt_blocklists: + :paramtype prompt_blocklists: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistConfig] + :keyword type: Content Filters policy type. Possible values include: "UserManaged", + "SystemManaged". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyType """ - super(QueueSettings, self).__init__(**kwargs) - self.job_tier = job_tier + super(RaiPolicyProperties, self).__init__(**kwargs) + self.base_policy_name = base_policy_name + self.completion_blocklists = completion_blocklists + self.content_filters = content_filters + self.mode = mode + self.prompt_blocklists = prompt_blocklists + self.type = type -class QuotaBaseProperties(msrest.serialization.Model): - """The properties for Quota update or retrieval. +class RaiPolicyPropertiesBasicResource(Resource): + """Azure OpenAI Content Filters resource. - :ivar id: Specifies the resource ID. + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar type: Specifies the resource type. + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar limit: The maximum permitted quota of the resource. - :vartype limit: long - :ivar unit: An enum describing the unit of quota measurement. Possible values include: "Count". - :vartype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: Required. Azure OpenAI Content Filters properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RaiPolicyProperties """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'unit': {'key': 'unit', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'RaiPolicyProperties'}, } def __init__( self, *, - id: Optional[str] = None, - type: Optional[str] = None, - limit: Optional[int] = None, - unit: Optional[Union[str, "QuotaUnit"]] = None, + properties: "RaiPolicyProperties", **kwargs ): """ - :keyword id: Specifies the resource ID. - :paramtype id: str - :keyword type: Specifies the resource type. - :paramtype type: str - :keyword limit: The maximum permitted quota of the resource. - :paramtype limit: long - :keyword unit: An enum describing the unit of quota measurement. Possible values include: - "Count". - :paramtype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit + :keyword properties: Required. Azure OpenAI Content Filters properties. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RaiPolicyProperties """ - super(QuotaBaseProperties, self).__init__(**kwargs) - self.id = id - self.type = type - self.limit = limit - self.unit = unit + super(RaiPolicyPropertiesBasicResource, self).__init__(**kwargs) + self.properties = properties -class QuotaUpdateParameters(msrest.serialization.Model): - """Quota update parameters. +class RaiPolicyPropertiesBasicResourceArmPaginatedResult(msrest.serialization.Model): + """Azure OpenAI Content Filters resource list. - :ivar value: The list for update quota. - :vartype value: list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] - :ivar location: Region of workspace quota to be updated. - :vartype location: str + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[QuotaBaseProperties]'}, - 'location': {'key': 'location', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[RaiPolicyPropertiesBasicResource]'}, } def __init__( self, *, - value: Optional[List["QuotaBaseProperties"]] = None, - location: Optional[str] = None, + next_link: Optional[str] = None, + value: Optional[List["RaiPolicyPropertiesBasicResource"]] = None, **kwargs ): """ - :keyword value: The list for update quota. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] - :keyword location: Region of workspace quota to be updated. - :paramtype location: str + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] """ - super(QuotaUpdateParameters, self).__init__(**kwargs) + super(RaiPolicyPropertiesBasicResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link self.value = value - self.location = location class RandomSamplingAlgorithm(SamplingAlgorithm): @@ -23715,6 +26233,31 @@ def __init__( self.key_value = key_value +class RegenerateServiceAccountKeyContent(msrest.serialization.Model): + """RegenerateServiceAccountKeyContent. + + :ivar key_name: Possible values include: "Key1", "Key2". + :vartype key_name: str or ~azure.mgmt.machinelearningservices.models.ServiceAccountKeyName + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + *, + key_name: Optional[Union[str, "ServiceAccountKeyName"]] = None, + **kwargs + ): + """ + :keyword key_name: Possible values include: "Key1", "Key2". + :paramtype key_name: str or ~azure.mgmt.machinelearningservices.models.ServiceAccountKeyName + """ + super(RegenerateServiceAccountKeyContent, self).__init__(**kwargs) + self.key_name = key_name + + class Registry(TrackedResource): """Registry. @@ -23751,6 +26294,9 @@ class Registry(TrackedResource): :ivar managed_resource_group: ResourceId of the managed RG if the registry has system created resources. :vartype managed_resource_group: ~azure.mgmt.machinelearningservices.models.ArmResourceId + :ivar managed_resource_group_settings: Managed resource group specific settings. + :vartype managed_resource_group_settings: + ~azure.mgmt.machinelearningservices.models.ManagedResourceGroupSettings :ivar ml_flow_registry_uri: MLFlow Registry URI for the Registry. :vartype ml_flow_registry_uri: str :ivar registry_private_endpoint_connections: Private endpoint connections info used for pending @@ -23786,6 +26332,7 @@ class Registry(TrackedResource): 'discovery_url': {'key': 'properties.discoveryUrl', 'type': 'str'}, 'intellectual_property_publisher': {'key': 'properties.intellectualPropertyPublisher', 'type': 'str'}, 'managed_resource_group': {'key': 'properties.managedResourceGroup', 'type': 'ArmResourceId'}, + 'managed_resource_group_settings': {'key': 'properties.managedResourceGroupSettings', 'type': 'ManagedResourceGroupSettings'}, 'ml_flow_registry_uri': {'key': 'properties.mlFlowRegistryUri', 'type': 'str'}, 'registry_private_endpoint_connections': {'key': 'properties.registryPrivateEndpointConnections', 'type': '[RegistryPrivateEndpointConnection]'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, @@ -23803,6 +26350,7 @@ def __init__( discovery_url: Optional[str] = None, intellectual_property_publisher: Optional[str] = None, managed_resource_group: Optional["ArmResourceId"] = None, + managed_resource_group_settings: Optional["ManagedResourceGroupSettings"] = None, ml_flow_registry_uri: Optional[str] = None, registry_private_endpoint_connections: Optional[List["RegistryPrivateEndpointConnection"]] = None, public_network_access: Optional[str] = None, @@ -23828,6 +26376,9 @@ def __init__( :keyword managed_resource_group: ResourceId of the managed RG if the registry has system created resources. :paramtype managed_resource_group: ~azure.mgmt.machinelearningservices.models.ArmResourceId + :keyword managed_resource_group_settings: Managed resource group specific settings. + :paramtype managed_resource_group_settings: + ~azure.mgmt.machinelearningservices.models.ManagedResourceGroupSettings :keyword ml_flow_registry_uri: MLFlow Registry URI for the Registry. :paramtype ml_flow_registry_uri: str :keyword registry_private_endpoint_connections: Private endpoint connections info used for @@ -23848,6 +26399,7 @@ def __init__( self.discovery_url = discovery_url self.intellectual_property_publisher = intellectual_property_publisher self.managed_resource_group = managed_resource_group + self.managed_resource_group_settings = managed_resource_group_settings self.ml_flow_registry_uri = ml_flow_registry_uri self.registry_private_endpoint_connections = registry_private_endpoint_connections self.public_network_access = public_network_access @@ -23859,12 +26411,12 @@ class RegistryListCredentialsResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar location: + :ivar location: The location of the workspace ACR. :vartype location: str - :ivar username: - :vartype username: str :ivar passwords: :vartype passwords: list[~azure.mgmt.machinelearningservices.models.Password] + :ivar username: The username of the workspace ACR. + :vartype username: str """ _validation = { @@ -23874,8 +26426,8 @@ class RegistryListCredentialsResult(msrest.serialization.Model): _attribute_map = { 'location': {'key': 'location', 'type': 'str'}, - 'username': {'key': 'username', 'type': 'str'}, 'passwords': {'key': 'passwords', 'type': '[Password]'}, + 'username': {'key': 'username', 'type': 'str'}, } def __init__( @@ -23890,8 +26442,8 @@ def __init__( """ super(RegistryListCredentialsResult, self).__init__(**kwargs) self.location = None - self.username = None self.passwords = passwords + self.username = None class RegistryPartialManagedServiceIdentity(ManagedServiceIdentity): @@ -24031,7 +26583,7 @@ class RegistryPrivateLinkServiceConnectionState(msrest.serialization.Model): message. :vartype description: str :ivar status: Connection status of the service consumer with the service provider. Possible - values include: "Approved", "Pending", "Rejected", "Disconnected". + values include: "Approved", "Pending", "Rejected", "Disconnected", "Timeout". :vartype status: str or ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ @@ -24057,7 +26609,7 @@ def __init__( message. :paramtype description: str :keyword status: Connection status of the service consumer with the service provider. Possible - values include: "Approved", "Pending", "Rejected", "Disconnected". + values include: "Approved", "Pending", "Rejected", "Disconnected", "Timeout". :paramtype status: str or ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ @@ -24417,6 +26969,31 @@ def __init__( self.capture_headers = capture_headers +class ResizeSchema(msrest.serialization.Model): + """Schema for Compute Instance resize. + + :ivar target_vm_size: The name of the virtual machine size. + :vartype target_vm_size: str + """ + + _attribute_map = { + 'target_vm_size': {'key': 'targetVMSize', 'type': 'str'}, + } + + def __init__( + self, + *, + target_vm_size: Optional[str] = None, + **kwargs + ): + """ + :keyword target_vm_size: The name of the virtual machine size. + :paramtype target_vm_size: str + """ + super(ResizeSchema, self).__init__(**kwargs) + self.target_vm_size = target_vm_size + + class ResourceId(msrest.serialization.Model): """Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet. @@ -24669,7 +27246,7 @@ class SASAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -24684,10 +27261,12 @@ class SASAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -24695,16 +27274,18 @@ class SASAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionSharedAccessSignature @@ -24720,14 +27301,16 @@ class SASAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionSharedAccessSignature'}, } @@ -24735,20 +27318,22 @@ def __init__( self, *, category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, credentials: Optional["WorkspaceConnectionSharedAccessSignature"] = None, **kwargs ): """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -24763,28 +27348,32 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionSharedAccessSignature """ - super(SASAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, target=target, metadata=metadata, shared_user_list=shared_user_list, value=value, value_format=value_format, **kwargs) + super(SASAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, error=error, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, metadata=metadata, pe_requirement=pe_requirement, pe_status=pe_status, shared_user_list=shared_user_list, target=target, use_workspace_managed_identity=use_workspace_managed_identity, **kwargs) self.auth_type = 'SAS' # type: str self.credentials = credentials @@ -25225,7 +27814,7 @@ def __init__( class ScriptReference(msrest.serialization.Model): """Script reference. - :ivar script_source: The storage source of the script: workspace. + :ivar script_source: The storage source of the script: inline, workspace. :vartype script_source: str :ivar script_data: The location of scripts in the mounted volume. :vartype script_data: str @@ -25252,7 +27841,7 @@ def __init__( **kwargs ): """ - :keyword script_source: The storage source of the script: workspace. + :keyword script_source: The storage source of the script: inline, workspace. :paramtype script_source: str :keyword script_data: The location of scripts in the mounted volume. :paramtype script_data: str @@ -25450,11 +28039,153 @@ def __init__( :keyword sku: Sku details required for ARM contract for Autoscaling. :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku """ - super(ServerlessEndpoint, self).__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.kind = kind - self.properties = properties - self.sku = sku + super(ServerlessEndpoint, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.kind = kind + self.properties = properties + self.sku = sku + + +class ServerlessEndpointCapacityReservation(msrest.serialization.Model): + """ServerlessEndpointCapacityReservation. + + All required parameters must be populated in order to send to Azure. + + :ivar capacity_reservation_group_id: Required. + :vartype capacity_reservation_group_id: str + :ivar endpoint_reserved_capacity: + :vartype endpoint_reserved_capacity: int + """ + + _validation = { + 'capacity_reservation_group_id': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'capacity_reservation_group_id': {'key': 'capacityReservationGroupId', 'type': 'str'}, + 'endpoint_reserved_capacity': {'key': 'endpointReservedCapacity', 'type': 'int'}, + } + + def __init__( + self, + *, + capacity_reservation_group_id: str, + endpoint_reserved_capacity: Optional[int] = None, + **kwargs + ): + """ + :keyword capacity_reservation_group_id: Required. + :paramtype capacity_reservation_group_id: str + :keyword endpoint_reserved_capacity: + :paramtype endpoint_reserved_capacity: int + """ + super(ServerlessEndpointCapacityReservation, self).__init__(**kwargs) + self.capacity_reservation_group_id = capacity_reservation_group_id + self.endpoint_reserved_capacity = endpoint_reserved_capacity + + +class ServerlessEndpointContentSafety(msrest.serialization.Model): + """ServerlessEndpointContentSafety. + + All required parameters must be populated in order to send to Azure. + + :ivar content_safety_status: Required. Specifies the status of content safety. Possible values + include: "Enabled", "Disabled". + :vartype content_safety_status: str or + ~azure.mgmt.machinelearningservices.models.ContentSafetyStatus + """ + + _validation = { + 'content_safety_status': {'required': True}, + } + + _attribute_map = { + 'content_safety_status': {'key': 'contentSafetyStatus', 'type': 'str'}, + } + + def __init__( + self, + *, + content_safety_status: Union[str, "ContentSafetyStatus"], + **kwargs + ): + """ + :keyword content_safety_status: Required. Specifies the status of content safety. Possible + values include: "Enabled", "Disabled". + :paramtype content_safety_status: str or + ~azure.mgmt.machinelearningservices.models.ContentSafetyStatus + """ + super(ServerlessEndpointContentSafety, self).__init__(**kwargs) + self.content_safety_status = content_safety_status + + +class ServerlessEndpointInferenceEndpoint(msrest.serialization.Model): + """ServerlessEndpointInferenceEndpoint. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar headers: Dictionary of :code:``. + :vartype headers: dict[str, str] + :ivar uri: Required. + :vartype uri: str + """ + + _validation = { + 'headers': {'readonly': True}, + 'uri': {'required': True}, + } + + _attribute_map = { + 'headers': {'key': 'headers', 'type': '{str}'}, + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: str, + **kwargs + ): + """ + :keyword uri: Required. + :paramtype uri: str + """ + super(ServerlessEndpointInferenceEndpoint, self).__init__(**kwargs) + self.headers = None + self.uri = uri + + +class ServerlessEndpointModelSettings(msrest.serialization.Model): + """ServerlessEndpointModelSettings. + + All required parameters must be populated in order to send to Azure. + + :ivar model_id: Required. + :vartype model_id: str + """ + + _validation = { + 'model_id': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'model_id': {'key': 'modelId', 'type': 'str'}, + } + + def __init__( + self, + *, + model_id: str, + **kwargs + ): + """ + :keyword model_id: Required. + :paramtype model_id: str + """ + super(ServerlessEndpointModelSettings, self).__init__(**kwargs) + self.model_id = model_id class ServerlessEndpointProperties(msrest.serialization.Model): @@ -25540,6 +28271,180 @@ def __init__( self.provisioning_state = None +class ServerlessEndpointResourceProperties(EndpointResourceProperties): + """ServerlessEndpointResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Required. Type of the endpoint.Constant filled by server. Possible values + include: "Azure.OpenAI", "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", + "managedOnlineEndpoint", "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool + :ivar auth_mode: Possible values include: "Key". + :vartype auth_mode: str or + ~azure.mgmt.machinelearningservices.models.ServerlessInferenceEndpointAuthMode + :ivar capacity_reservation: + :vartype capacity_reservation: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointCapacityReservation + :ivar content_safety: + :vartype content_safety: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointContentSafety + :ivar endpoint_state: State of the Serverless Endpoint. Possible values include: "Unknown", + "Creating", "Deleting", "Suspending", "Reinstating", "Online", "Suspended", "CreationFailed", + "DeletionFailed". + :vartype endpoint_state: str or + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointState + :ivar inference_endpoint: + :vartype inference_endpoint: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointInferenceEndpoint + :ivar marketplace_subscription_id: + :vartype marketplace_subscription_id: str + :ivar metadata: Anything. + :vartype metadata: any + :ivar model_settings: + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointModelSettings + :ivar offer: + :vartype offer: ~azure.mgmt.machinelearningservices.models.ServerlessOffer + """ + + _validation = { + 'endpoint_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'associated_resource_id': {'key': 'associatedResourceId', 'type': 'str'}, + 'deployments': {'key': 'deployments', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'should_create_ai_services_endpoint': {'key': 'shouldCreateAiServicesEndpoint', 'type': 'bool'}, + 'auth_mode': {'key': 'authMode', 'type': 'str'}, + 'capacity_reservation': {'key': 'capacityReservation', 'type': 'ServerlessEndpointCapacityReservation'}, + 'content_safety': {'key': 'contentSafety', 'type': 'ServerlessEndpointContentSafety'}, + 'endpoint_state': {'key': 'endpointState', 'type': 'str'}, + 'inference_endpoint': {'key': 'inferenceEndpoint', 'type': 'ServerlessEndpointInferenceEndpoint'}, + 'marketplace_subscription_id': {'key': 'marketplaceSubscriptionId', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': 'object'}, + 'model_settings': {'key': 'modelSettings', 'type': 'ServerlessEndpointModelSettings'}, + 'offer': {'key': 'offer', 'type': 'ServerlessOffer'}, + } + + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + deployments: Optional[List["EndpointDeploymentResourcePropertiesBasicResource"]] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + should_create_ai_services_endpoint: Optional[bool] = None, + auth_mode: Optional[Union[str, "ServerlessInferenceEndpointAuthMode"]] = None, + capacity_reservation: Optional["ServerlessEndpointCapacityReservation"] = None, + content_safety: Optional["ServerlessEndpointContentSafety"] = None, + endpoint_state: Optional[Union[str, "ServerlessEndpointState"]] = None, + inference_endpoint: Optional["ServerlessEndpointInferenceEndpoint"] = None, + marketplace_subscription_id: Optional[str] = None, + metadata: Optional[Any] = None, + model_settings: Optional["ServerlessEndpointModelSettings"] = None, + offer: Optional["ServerlessOffer"] = None, + **kwargs + ): + """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + :keyword auth_mode: Possible values include: "Key". + :paramtype auth_mode: str or + ~azure.mgmt.machinelearningservices.models.ServerlessInferenceEndpointAuthMode + :keyword capacity_reservation: + :paramtype capacity_reservation: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointCapacityReservation + :keyword content_safety: + :paramtype content_safety: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointContentSafety + :keyword endpoint_state: State of the Serverless Endpoint. Possible values include: "Unknown", + "Creating", "Deleting", "Suspending", "Reinstating", "Online", "Suspended", "CreationFailed", + "DeletionFailed". + :paramtype endpoint_state: str or + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointState + :keyword inference_endpoint: + :paramtype inference_endpoint: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointInferenceEndpoint + :keyword marketplace_subscription_id: + :paramtype marketplace_subscription_id: str + :keyword metadata: Anything. + :paramtype metadata: any + :keyword model_settings: + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointModelSettings + :keyword offer: + :paramtype offer: ~azure.mgmt.machinelearningservices.models.ServerlessOffer + """ + super(ServerlessEndpointResourceProperties, self).__init__(associated_resource_id=associated_resource_id, deployments=deployments, endpoint_uri=endpoint_uri, failure_reason=failure_reason, location=location, name=name, should_create_ai_services_endpoint=should_create_ai_services_endpoint, **kwargs) + self.endpoint_type = 'serverlessEndpoint' # type: str + self.auth_mode = auth_mode + self.capacity_reservation = capacity_reservation + self.content_safety = content_safety + self.endpoint_state = endpoint_state + self.inference_endpoint = inference_endpoint + self.marketplace_subscription_id = marketplace_subscription_id + self.metadata = metadata + self.model_settings = model_settings + self.offer = offer + + class ServerlessEndpointTrackedResourceArmPaginatedResult(msrest.serialization.Model): """A paginated list of ServerlessEndpoint entities. @@ -25614,10 +28519,49 @@ def __init__( self.uri = uri +class ServerlessOffer(msrest.serialization.Model): + """ServerlessOffer. + + All required parameters must be populated in order to send to Azure. + + :ivar offer_name: Required. + :vartype offer_name: str + :ivar publisher: Required. + :vartype publisher: str + """ + + _validation = { + 'offer_name': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + 'publisher': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'offer_name': {'key': 'offerName', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + } + + def __init__( + self, + *, + offer_name: str, + publisher: str, + **kwargs + ): + """ + :keyword offer_name: Required. + :paramtype offer_name: str + :keyword publisher: Required. + :paramtype publisher: str + """ + super(ServerlessOffer, self).__init__(**kwargs) + self.offer_name = offer_name + self.publisher = publisher + + class ServiceManagedResourcesSettings(msrest.serialization.Model): """ServiceManagedResourcesSettings. - :ivar cosmos_db: The settings for the service managed cosmosdb account. + :ivar cosmos_db: :vartype cosmos_db: ~azure.mgmt.machinelearningservices.models.CosmosDbSettings """ @@ -25632,7 +28576,7 @@ def __init__( **kwargs ): """ - :keyword cosmos_db: The settings for the service managed cosmosdb account. + :keyword cosmos_db: :paramtype cosmos_db: ~azure.mgmt.machinelearningservices.models.CosmosDbSettings """ super(ServiceManagedResourcesSettings, self).__init__(**kwargs) @@ -25652,7 +28596,7 @@ class ServicePrincipalAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -25667,10 +28611,12 @@ class ServicePrincipalAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -25678,16 +28624,18 @@ class ServicePrincipalAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionServicePrincipal @@ -25703,14 +28651,16 @@ class ServicePrincipalAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionServicePrincipal'}, } @@ -25718,20 +28668,22 @@ def __init__( self, *, category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, credentials: Optional["WorkspaceConnectionServicePrincipal"] = None, **kwargs ): """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -25746,28 +28698,32 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionServicePrincipal """ - super(ServicePrincipalAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, target=target, metadata=metadata, shared_user_list=shared_user_list, value=value, value_format=value_format, **kwargs) + super(ServicePrincipalAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, error=error, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, metadata=metadata, pe_requirement=pe_requirement, pe_status=pe_status, shared_user_list=shared_user_list, target=target, use_workspace_managed_identity=use_workspace_managed_identity, **kwargs) self.auth_type = 'ServicePrincipal' # type: str self.credentials = credentials @@ -25937,11 +28893,15 @@ def __init__( class ServiceTagOutboundRule(OutboundRule): """Service Tag Outbound Rule for the managed network of a machine learning workspace. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. Possible values include: "Required", "Recommended", "UserDefined", "Dependency". :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :ivar parent_rule_names: + :vartype parent_rule_names: list[str] :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Possible values include: "Inactive", "Active". :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus @@ -25955,11 +28915,13 @@ class ServiceTagOutboundRule(OutboundRule): """ _validation = { + 'parent_rule_names': {'readonly': True}, 'type': {'required': True}, } _attribute_map = { 'category': {'key': 'category', 'type': 'str'}, + 'parent_rule_names': {'key': 'parentRuleNames', 'type': '[str]'}, 'status': {'key': 'status', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'destination': {'key': 'destination', 'type': 'ServiceTagDestination'}, @@ -26019,23 +28981,22 @@ class SharedPrivateLinkResource(msrest.serialization.Model): :ivar name: Unique name of the private link. :vartype name: str - :ivar private_link_resource_id: The resource id that private link links to. - :vartype private_link_resource_id: str - :ivar group_id: The private link resource group id. + :ivar group_id: group id of the private link. :vartype group_id: str + :ivar private_link_resource_id: the resource id that private link links to. + :vartype private_link_resource_id: str :ivar request_message: Request message. :vartype request_message: str - :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected", "Disconnected", - "Timeout". + :ivar status: Connection status of the service consumer with the service provider. Possible + values include: "Approved", "Pending", "Rejected", "Disconnected", "Timeout". :vartype status: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointServiceConnectionStatus + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, 'request_message': {'key': 'properties.requestMessage', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, } @@ -26044,31 +29005,30 @@ def __init__( self, *, name: Optional[str] = None, - private_link_resource_id: Optional[str] = None, group_id: Optional[str] = None, + private_link_resource_id: Optional[str] = None, request_message: Optional[str] = None, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + status: Optional[Union[str, "EndpointServiceConnectionStatus"]] = None, **kwargs ): """ :keyword name: Unique name of the private link. :paramtype name: str - :keyword private_link_resource_id: The resource id that private link links to. - :paramtype private_link_resource_id: str - :keyword group_id: The private link resource group id. + :keyword group_id: group id of the private link. :paramtype group_id: str + :keyword private_link_resource_id: the resource id that private link links to. + :paramtype private_link_resource_id: str :keyword request_message: Request message. :paramtype request_message: str - :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Possible values include: "Pending", "Approved", "Rejected", - "Disconnected", "Timeout". + :keyword status: Connection status of the service consumer with the service provider. Possible + values include: "Approved", "Pending", "Rejected", "Disconnected", "Timeout". :paramtype status: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointServiceConnectionStatus + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ super(SharedPrivateLinkResource, self).__init__(**kwargs) self.name = name - self.private_link_resource_id = private_link_resource_id self.group_id = group_id + self.private_link_resource_id = private_link_resource_id self.request_message = request_message self.status = status @@ -26665,6 +29625,172 @@ def __init__( self.runtime_version = runtime_version +class SpeechEndpointDeploymentResourceProperties(EndpointDeploymentResourceProperties, CognitiveServiceEndpointDeploymentResourceProperties): + """SpeechEndpointDeploymentResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar model: Required. Model used for the endpoint deployment. + :vartype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar version_upgrade_option: Deployment model version upgrade option. Possible values include: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Required. Kind of the deployment.Constant filled by server. + :vartype type: str + """ + + _validation = { + 'model': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'type': {'required': True, 'min_length': 1, 'pattern': r'[a-zA-Z0-9_]'}, + } + + _attribute_map = { + 'model': {'key': 'model', 'type': 'EndpointDeploymentModel'}, + 'rai_policy_name': {'key': 'raiPolicyName', 'type': 'str'}, + 'version_upgrade_option': {'key': 'versionUpgradeOption', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + model: "EndpointDeploymentModel", + rai_policy_name: Optional[str] = None, + version_upgrade_option: Optional[Union[str, "DeploymentModelVersionUpgradeOption"]] = None, + failure_reason: Optional[str] = None, + **kwargs + ): + """ + :keyword model: Required. Model used for the endpoint deployment. + :paramtype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :keyword rai_policy_name: The name of RAI policy. + :paramtype rai_policy_name: str + :keyword version_upgrade_option: Deployment model version upgrade option. Possible values + include: "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", "NoAutoUpgrade". + :paramtype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + """ + super(SpeechEndpointDeploymentResourceProperties, self).__init__(failure_reason=failure_reason, model=model, rai_policy_name=rai_policy_name, version_upgrade_option=version_upgrade_option, **kwargs) + self.model = model + self.rai_policy_name = rai_policy_name + self.version_upgrade_option = version_upgrade_option + self.type = 'Azure.Speech' # type: str + self.failure_reason = failure_reason + self.provisioning_state = None + + +class SpeechEndpointResourceProperties(EndpointResourceProperties): + """SpeechEndpointResourceProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Required. Type of the endpoint.Constant filled by server. Possible values + include: "Azure.OpenAI", "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", + "managedOnlineEndpoint", "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Possible values include: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool + """ + + _validation = { + 'endpoint_type': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'associated_resource_id': {'key': 'associatedResourceId', 'type': 'str'}, + 'deployments': {'key': 'deployments', 'type': '[EndpointDeploymentResourcePropertiesBasicResource]'}, + 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'should_create_ai_services_endpoint': {'key': 'shouldCreateAiServicesEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + deployments: Optional[List["EndpointDeploymentResourcePropertiesBasicResource"]] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + should_create_ai_services_endpoint: Optional[bool] = None, + **kwargs + ): + """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + """ + super(SpeechEndpointResourceProperties, self).__init__(associated_resource_id=associated_resource_id, deployments=deployments, endpoint_uri=endpoint_uri, failure_reason=failure_reason, location=location, name=name, should_create_ai_services_endpoint=should_create_ai_services_endpoint, **kwargs) + self.endpoint_type = 'Azure.Speech' # type: str + + class SslConfiguration(msrest.serialization.Model): """The ssl configuration for scoring. @@ -28062,7 +31188,7 @@ def __init__( class TmpfsOptions(msrest.serialization.Model): - """Describes the tmpfs options for the container. + """TmpfsOptions. :ivar size: Mention the Tmpfs size. :vartype size: int @@ -29054,7 +32180,7 @@ class UsernamePasswordAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -29069,10 +32195,12 @@ class UsernamePasswordAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar created_by_workspace_arm_id: :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str :ivar expiry_time: :vartype expiry_time: ~datetime.datetime :ivar group: Group based on connection category. Possible values include: "Azure", "AzureAI", @@ -29080,16 +32208,18 @@ class UsernamePasswordAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup :ivar is_shared_to_all: :vartype is_shared_to_all: bool - :ivar target: - :vartype target: str :ivar metadata: Store user metadata for this connection. :vartype metadata: dict[str, str] + :ivar pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :ivar shared_user_list: :vartype shared_user_list: list[str] - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. Possible values include: "JSON". - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUsernamePassword @@ -29105,14 +32235,16 @@ class UsernamePasswordAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP 'auth_type': {'key': 'authType', 'type': 'str'}, 'category': {'key': 'category', 'type': 'str'}, 'created_by_workspace_arm_id': {'key': 'createdByWorkspaceArmId', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, 'group': {'key': 'group', 'type': 'str'}, 'is_shared_to_all': {'key': 'isSharedToAll', 'type': 'bool'}, - 'target': {'key': 'target', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'pe_requirement': {'key': 'peRequirement', 'type': 'str'}, + 'pe_status': {'key': 'peStatus', 'type': 'str'}, 'shared_user_list': {'key': 'sharedUserList', 'type': '[str]'}, - 'value': {'key': 'value', 'type': 'str'}, - 'value_format': {'key': 'valueFormat', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'use_workspace_managed_identity': {'key': 'useWorkspaceManagedIdentity', 'type': 'bool'}, 'credentials': {'key': 'credentials', 'type': 'WorkspaceConnectionUsernamePassword'}, } @@ -29120,20 +32252,22 @@ def __init__( self, *, category: Optional[Union[str, "ConnectionCategory"]] = None, + error: Optional[str] = None, expiry_time: Optional[datetime.datetime] = None, is_shared_to_all: Optional[bool] = None, - target: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "ManagedPEStatus"]] = None, shared_user_list: Optional[List[str]] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "ValueFormat"]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, credentials: Optional["WorkspaceConnectionUsernamePassword"] = None, **kwargs ): """ :keyword category: Category of the connection. Possible values include: "PythonFeed", "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", - "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", @@ -29148,28 +32282,32 @@ def __init__( "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "OpenAI", "Serp", "BingLLMSearch", - "Serverless", "AIServices". + "Serverless". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str :keyword expiry_time: :paramtype expiry_time: ~datetime.datetime :keyword is_shared_to_all: :paramtype is_shared_to_all: bool - :keyword target: - :paramtype target: str :keyword metadata: Store user metadata for this connection. :paramtype metadata: dict[str, str] + :keyword pe_requirement: Possible values include: "Required", "NotRequired", "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Possible values include: "Inactive", "Active", "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus :keyword shared_user_list: :paramtype shared_user_list: list[str] - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. Possible values include: - "JSON". - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUsernamePassword """ - super(UsernamePasswordAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, target=target, metadata=metadata, shared_user_list=shared_user_list, value=value, value_format=value_format, **kwargs) + super(UsernamePasswordAuthTypeWorkspaceConnectionProperties, self).__init__(category=category, error=error, expiry_time=expiry_time, is_shared_to_all=is_shared_to_all, metadata=metadata, pe_requirement=pe_requirement, pe_status=pe_status, shared_user_list=shared_user_list, target=target, use_workspace_managed_identity=use_workspace_managed_identity, **kwargs) self.auth_type = 'UsernamePassword' # type: str self.credentials = credentials @@ -29617,7 +32755,7 @@ def __init__( class VolumeDefinition(msrest.serialization.Model): - """Describes the volume configuration for the container. + """VolumeDefinition. :ivar type: Type of Volume Definition. Possible Values: bind,volume,tmpfs,npipe. Possible values include: "bind", "volume", "tmpfs", "npipe". Default value: "bind". @@ -29694,7 +32832,7 @@ def __init__( class VolumeOptions(msrest.serialization.Model): - """Describes the volume options for the container. + """VolumeOptions. :ivar nocopy: Indicate whether volume is nocopy. :vartype nocopy: bool @@ -29734,101 +32872,128 @@ class Workspace(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar identity: The identity of the resource. + :ivar identity: Managed service identity (system assigned and/or user assigned identities). :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity :ivar kind: :vartype kind: str - :ivar location: Specifies the location of the resource. + :ivar location: :vartype location: str - :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. + :ivar sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar workspace_id: The immutable id associated with this workspace. - :vartype workspace_id: str - :ivar description: The description of this workspace. - :vartype description: str - :ivar friendly_name: The friendly name for this workspace. This name in mutable. - :vartype friendly_name: str - :ivar key_vault: ARM id of the key vault associated with this workspace. This cannot be changed - once the workspace has been created. - :vartype key_vault: str + :ivar tags: A set of tags. Dictionary of :code:``. + :vartype tags: dict[str, str] + :ivar allow_public_access_when_behind_vnet: The flag to indicate whether to allow public access + when behind VNet. + :vartype allow_public_access_when_behind_vnet: bool + :ivar allow_role_assignment_on_rg: The flag to indicate whether we will do role assignment for + the workspace MSI on resource group level. + :vartype allow_role_assignment_on_rg: bool :ivar application_insights: ARM id of the application insights associated with this workspace. :vartype application_insights: str + :ivar associated_workspaces: + :vartype associated_workspaces: list[str] + :ivar container_registries: + :vartype container_registries: list[str] :ivar container_registry: ARM id of the container registry associated with this workspace. :vartype container_registry: str - :ivar storage_account: ARM id of the storage account associated with this workspace. This - cannot be changed once the workspace has been created. - :vartype storage_account: str + :ivar description: The description of this workspace. + :vartype description: str :ivar discovery_url: Url for the discovery service to identify regional endpoints for machine learning experimentation services. :vartype discovery_url: str + :ivar enable_data_isolation: + :vartype enable_data_isolation: bool + :ivar enable_service_side_cmk_encryption: + :vartype enable_service_side_cmk_encryption: bool + :ivar enable_simplified_cmk: Flag to tell if simplified CMK should be enabled for this + workspace. + :vartype enable_simplified_cmk: bool + :ivar enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterials should be + enabled for this workspace. + :vartype enable_software_bill_of_materials: bool + :ivar encryption: + :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionProperty + :ivar existing_workspaces: + :vartype existing_workspaces: list[str] + :ivar feature_store_settings: Settings for feature store type workspace. + :vartype feature_store_settings: + ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :ivar friendly_name: The friendly name for this workspace. This name in mutable. + :vartype friendly_name: str + :ivar hbi_workspace: The flag to signal HBI data in the workspace and reduce diagnostic data + collected by the service. + :vartype hbi_workspace: bool + :ivar hub_resource_id: + :vartype hub_resource_id: str + :ivar image_build_compute: The compute name for image build. + :vartype image_build_compute: str + :ivar ip_allowlist: The list of IPv4 addresses that are allowed to access the workspace. + :vartype ip_allowlist: list[str] + :ivar key_vault: ARM id of the key vault associated with this workspace. This cannot be changed + once the workspace has been created. + :vartype key_vault: str + :ivar key_vaults: + :vartype key_vaults: list[str] + :ivar managed_network: Managed Network settings for a machine learning workspace. + :vartype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings + :ivar ml_flow_tracking_uri: The URI associated with this workspace that machine learning flow + must point at to set up tracking. + :vartype ml_flow_tracking_uri: str + :ivar notebook_info: The notebook info of Azure ML workspace. + :vartype notebook_info: ~azure.mgmt.machinelearningservices.models.NotebookResourceInfo + :ivar primary_user_assigned_identity: The user assigned identity resource id that represents + the workspace identity. + :vartype primary_user_assigned_identity: str + :ivar private_endpoint_connections: The list of private endpoint connections in the workspace. + :vartype private_endpoint_connections: + list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] + :ivar private_link_count: Count of private connections in the workspace. + :vartype private_link_count: int :ivar provisioning_state: The current deployment state of workspace resource. The provisioningState is to indicate states for resource provisioning. Possible values include: "Unknown", "Updating", "Creating", "Deleting", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState - :ivar encryption: The encryption settings of Azure ML workspace. - :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionProperty - :ivar hbi_workspace: The flag to signal HBI data in the workspace and reduce diagnostic data - collected by the service. - :vartype hbi_workspace: bool - :ivar service_provisioned_resource_group: The name of the managed resource group created by - workspace RP in customer subscription if the workspace is CMK workspace. - :vartype service_provisioned_resource_group: str - :ivar private_link_count: Count of private connections in the workspace. - :vartype private_link_count: int - :ivar image_build_compute: The compute name for image build. - :vartype image_build_compute: str - :ivar allow_public_access_when_behind_vnet: The flag to indicate whether to allow public access - when behind VNet. - :vartype allow_public_access_when_behind_vnet: bool :ivar public_network_access: Whether requests from Public Network are allowed. Possible values include: "Enabled", "Disabled". :vartype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccess - :ivar private_endpoint_connections: The list of private endpoint connections in the workspace. - :vartype private_endpoint_connections: - list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] - :ivar serverless_compute_settings: Settings for serverless compute created in the workspace. + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :ivar serverless_compute_settings: Settings for serverless compute in a workspace. :vartype serverless_compute_settings: ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings + :ivar service_managed_resources_settings: The service managed resource settings. + :vartype service_managed_resources_settings: + ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :ivar service_provisioned_resource_group: The name of the managed resource group created by + workspace RP in customer subscription if the workspace is CMK workspace. + :vartype service_provisioned_resource_group: str :ivar shared_private_link_resources: The list of shared private link resources in this workspace. :vartype shared_private_link_resources: list[~azure.mgmt.machinelearningservices.models.SharedPrivateLinkResource] - :ivar notebook_info: The notebook info of Azure ML workspace. - :vartype notebook_info: ~azure.mgmt.machinelearningservices.models.NotebookResourceInfo - :ivar service_managed_resources_settings: The service managed resource settings. - :vartype service_managed_resources_settings: - ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings - :ivar primary_user_assigned_identity: The user assigned identity resource id that represents - the workspace identity. - :vartype primary_user_assigned_identity: str - :ivar tenant_id: The tenant id associated with this workspace. - :vartype tenant_id: str + :ivar soft_delete_retention_in_days: Retention time in days after workspace get soft deleted. + :vartype soft_delete_retention_in_days: int + :ivar storage_account: ARM id of the storage account associated with this workspace. This + cannot be changed once the workspace has been created. + :vartype storage_account: str + :ivar storage_accounts: + :vartype storage_accounts: list[str] :ivar storage_hns_enabled: If the storage associated with the workspace has hierarchical namespace(HNS) enabled. :vartype storage_hns_enabled: bool - :ivar ml_flow_tracking_uri: The URI associated with this workspace that machine learning flow - must point at to set up tracking. - :vartype ml_flow_tracking_uri: str + :ivar system_datastores_auth_mode: The auth mode used for accessing the system datastores of + the workspace. + :vartype system_datastores_auth_mode: str + :ivar tenant_id: The tenant id associated with this workspace. + :vartype tenant_id: str :ivar v1_legacy_mode: Enabling v1_legacy_mode may prevent you from using features provided by the v2 API. :vartype v1_legacy_mode: bool - :ivar managed_network: Managed Network settings for a machine learning workspace. - :vartype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings - :ivar feature_store_settings: Settings for feature store type workspace. - :vartype feature_store_settings: - ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings - :ivar associated_workspaces: - :vartype associated_workspaces: list[str] - :ivar enable_data_isolation: - :vartype enable_data_isolation: bool - :ivar hub_resource_id: - :vartype hub_resource_id: str :ivar workspace_hub_config: WorkspaceHub's configuration object. :vartype workspace_hub_config: ~azure.mgmt.machinelearningservices.models.WorkspaceHubConfig + :ivar workspace_id: The immutable id associated with this workspace. + :vartype workspace_id: str """ _validation = { @@ -29836,15 +33001,15 @@ class Workspace(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, - 'workspace_id': {'readonly': True}, + 'ml_flow_tracking_uri': {'readonly': True}, + 'notebook_info': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'private_link_count': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'service_provisioned_resource_group': {'readonly': True}, - 'private_link_count': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'notebook_info': {'readonly': True}, - 'tenant_id': {'readonly': True}, 'storage_hns_enabled': {'readonly': True}, - 'ml_flow_tracking_uri': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'workspace_id': {'readonly': True}, } _attribute_map = { @@ -29855,40 +33020,51 @@ class Workspace(Resource): 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, 'kind': {'key': 'kind', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'Sku'}, - 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'key_vault': {'key': 'properties.keyVault', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'allow_public_access_when_behind_vnet': {'key': 'properties.allowPublicAccessWhenBehindVnet', 'type': 'bool'}, + 'allow_role_assignment_on_rg': {'key': 'properties.allowRoleAssignmentOnRG', 'type': 'bool'}, 'application_insights': {'key': 'properties.applicationInsights', 'type': 'str'}, + 'associated_workspaces': {'key': 'properties.associatedWorkspaces', 'type': '[str]'}, + 'container_registries': {'key': 'properties.containerRegistries', 'type': '[str]'}, 'container_registry': {'key': 'properties.containerRegistry', 'type': 'str'}, - 'storage_account': {'key': 'properties.storageAccount', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, 'discovery_url': {'key': 'properties.discoveryUrl', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'enable_data_isolation': {'key': 'properties.enableDataIsolation', 'type': 'bool'}, + 'enable_service_side_cmk_encryption': {'key': 'properties.enableServiceSideCMKEncryption', 'type': 'bool'}, + 'enable_simplified_cmk': {'key': 'properties.enableSimplifiedCmk', 'type': 'bool'}, + 'enable_software_bill_of_materials': {'key': 'properties.enableSoftwareBillOfMaterials', 'type': 'bool'}, 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperty'}, + 'existing_workspaces': {'key': 'properties.existingWorkspaces', 'type': '[str]'}, + 'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, 'hbi_workspace': {'key': 'properties.hbiWorkspace', 'type': 'bool'}, - 'service_provisioned_resource_group': {'key': 'properties.serviceProvisionedResourceGroup', 'type': 'str'}, - 'private_link_count': {'key': 'properties.privateLinkCount', 'type': 'int'}, + 'hub_resource_id': {'key': 'properties.hubResourceId', 'type': 'str'}, 'image_build_compute': {'key': 'properties.imageBuildCompute', 'type': 'str'}, - 'allow_public_access_when_behind_vnet': {'key': 'properties.allowPublicAccessWhenBehindVnet', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'ip_allowlist': {'key': 'properties.ipAllowlist', 'type': '[str]'}, + 'key_vault': {'key': 'properties.keyVault', 'type': 'str'}, + 'key_vaults': {'key': 'properties.keyVaults', 'type': '[str]'}, + 'managed_network': {'key': 'properties.managedNetwork', 'type': 'ManagedNetworkSettings'}, + 'ml_flow_tracking_uri': {'key': 'properties.mlFlowTrackingUri', 'type': 'str'}, + 'notebook_info': {'key': 'properties.notebookInfo', 'type': 'NotebookResourceInfo'}, + 'primary_user_assigned_identity': {'key': 'properties.primaryUserAssignedIdentity', 'type': 'str'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'private_link_count': {'key': 'properties.privateLinkCount', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'serverless_compute_settings': {'key': 'properties.serverlessComputeSettings', 'type': 'ServerlessComputeSettings'}, - 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, - 'notebook_info': {'key': 'properties.notebookInfo', 'type': 'NotebookResourceInfo'}, 'service_managed_resources_settings': {'key': 'properties.serviceManagedResourcesSettings', 'type': 'ServiceManagedResourcesSettings'}, - 'primary_user_assigned_identity': {'key': 'properties.primaryUserAssignedIdentity', 'type': 'str'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'service_provisioned_resource_group': {'key': 'properties.serviceProvisionedResourceGroup', 'type': 'str'}, + 'shared_private_link_resources': {'key': 'properties.sharedPrivateLinkResources', 'type': '[SharedPrivateLinkResource]'}, + 'soft_delete_retention_in_days': {'key': 'properties.softDeleteRetentionInDays', 'type': 'int'}, + 'storage_account': {'key': 'properties.storageAccount', 'type': 'str'}, + 'storage_accounts': {'key': 'properties.storageAccounts', 'type': '[str]'}, 'storage_hns_enabled': {'key': 'properties.storageHnsEnabled', 'type': 'bool'}, - 'ml_flow_tracking_uri': {'key': 'properties.mlFlowTrackingUri', 'type': 'str'}, + 'system_datastores_auth_mode': {'key': 'properties.systemDatastoresAuthMode', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, 'v1_legacy_mode': {'key': 'properties.v1LegacyMode', 'type': 'bool'}, - 'managed_network': {'key': 'properties.managedNetwork', 'type': 'ManagedNetworkSettings'}, - 'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'}, - 'associated_workspaces': {'key': 'properties.associatedWorkspaces', 'type': '[str]'}, - 'enable_data_isolation': {'key': 'properties.enableDataIsolation', 'type': 'bool'}, - 'hub_resource_id': {'key': 'properties.hubResourceId', 'type': 'str'}, 'workspace_hub_config': {'key': 'properties.workspaceHubConfig', 'type': 'WorkspaceHubConfig'}, + 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, } def __init__( @@ -29897,103 +33073,142 @@ def __init__( identity: Optional["ManagedServiceIdentity"] = None, kind: Optional[str] = None, location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, sku: Optional["Sku"] = None, - description: Optional[str] = None, - friendly_name: Optional[str] = None, - key_vault: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + allow_public_access_when_behind_vnet: Optional[bool] = None, + allow_role_assignment_on_rg: Optional[bool] = None, application_insights: Optional[str] = None, + associated_workspaces: Optional[List[str]] = None, + container_registries: Optional[List[str]] = None, container_registry: Optional[str] = None, - storage_account: Optional[str] = None, + description: Optional[str] = None, discovery_url: Optional[str] = None, + enable_data_isolation: Optional[bool] = None, + enable_service_side_cmk_encryption: Optional[bool] = None, + enable_simplified_cmk: Optional[bool] = None, + enable_software_bill_of_materials: Optional[bool] = None, encryption: Optional["EncryptionProperty"] = None, - hbi_workspace: Optional[bool] = False, + existing_workspaces: Optional[List[str]] = None, + feature_store_settings: Optional["FeatureStoreSettings"] = None, + friendly_name: Optional[str] = None, + hbi_workspace: Optional[bool] = None, + hub_resource_id: Optional[str] = None, image_build_compute: Optional[str] = None, - allow_public_access_when_behind_vnet: Optional[bool] = False, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + ip_allowlist: Optional[List[str]] = None, + key_vault: Optional[str] = None, + key_vaults: Optional[List[str]] = None, + managed_network: Optional["ManagedNetworkSettings"] = None, + primary_user_assigned_identity: Optional[str] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccessType"]] = None, serverless_compute_settings: Optional["ServerlessComputeSettings"] = None, - shared_private_link_resources: Optional[List["SharedPrivateLinkResource"]] = None, service_managed_resources_settings: Optional["ServiceManagedResourcesSettings"] = None, - primary_user_assigned_identity: Optional[str] = None, - v1_legacy_mode: Optional[bool] = False, - managed_network: Optional["ManagedNetworkSettings"] = None, - feature_store_settings: Optional["FeatureStoreSettings"] = None, - associated_workspaces: Optional[List[str]] = None, - enable_data_isolation: Optional[bool] = None, - hub_resource_id: Optional[str] = None, + shared_private_link_resources: Optional[List["SharedPrivateLinkResource"]] = None, + soft_delete_retention_in_days: Optional[int] = None, + storage_account: Optional[str] = None, + storage_accounts: Optional[List[str]] = None, + system_datastores_auth_mode: Optional[str] = None, + v1_legacy_mode: Optional[bool] = None, workspace_hub_config: Optional["WorkspaceHubConfig"] = None, **kwargs ): """ - :keyword identity: The identity of the resource. + :keyword identity: Managed service identity (system assigned and/or user assigned identities). :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity :keyword kind: :paramtype kind: str - :keyword location: Specifies the location of the resource. + :keyword location: :paramtype location: str - :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. + :keyword sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword description: The description of this workspace. - :paramtype description: str - :keyword friendly_name: The friendly name for this workspace. This name in mutable. - :paramtype friendly_name: str - :keyword key_vault: ARM id of the key vault associated with this workspace. This cannot be - changed once the workspace has been created. - :paramtype key_vault: str + :keyword tags: A set of tags. Dictionary of :code:``. + :paramtype tags: dict[str, str] + :keyword allow_public_access_when_behind_vnet: The flag to indicate whether to allow public + access when behind VNet. + :paramtype allow_public_access_when_behind_vnet: bool + :keyword allow_role_assignment_on_rg: The flag to indicate whether we will do role assignment + for the workspace MSI on resource group level. + :paramtype allow_role_assignment_on_rg: bool :keyword application_insights: ARM id of the application insights associated with this workspace. :paramtype application_insights: str + :keyword associated_workspaces: + :paramtype associated_workspaces: list[str] + :keyword container_registries: + :paramtype container_registries: list[str] :keyword container_registry: ARM id of the container registry associated with this workspace. :paramtype container_registry: str - :keyword storage_account: ARM id of the storage account associated with this workspace. This - cannot be changed once the workspace has been created. - :paramtype storage_account: str + :keyword description: The description of this workspace. + :paramtype description: str :keyword discovery_url: Url for the discovery service to identify regional endpoints for machine learning experimentation services. :paramtype discovery_url: str - :keyword encryption: The encryption settings of Azure ML workspace. + :keyword enable_data_isolation: + :paramtype enable_data_isolation: bool + :keyword enable_service_side_cmk_encryption: + :paramtype enable_service_side_cmk_encryption: bool + :keyword enable_simplified_cmk: Flag to tell if simplified CMK should be enabled for this + workspace. + :paramtype enable_simplified_cmk: bool + :keyword enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterials should be + enabled for this workspace. + :paramtype enable_software_bill_of_materials: bool + :keyword encryption: :paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionProperty + :keyword existing_workspaces: + :paramtype existing_workspaces: list[str] + :keyword feature_store_settings: Settings for feature store type workspace. + :paramtype feature_store_settings: + ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :keyword friendly_name: The friendly name for this workspace. This name in mutable. + :paramtype friendly_name: str :keyword hbi_workspace: The flag to signal HBI data in the workspace and reduce diagnostic data collected by the service. :paramtype hbi_workspace: bool + :keyword hub_resource_id: + :paramtype hub_resource_id: str :keyword image_build_compute: The compute name for image build. :paramtype image_build_compute: str - :keyword allow_public_access_when_behind_vnet: The flag to indicate whether to allow public - access when behind VNet. - :paramtype allow_public_access_when_behind_vnet: bool + :keyword ip_allowlist: The list of IPv4 addresses that are allowed to access the workspace. + :paramtype ip_allowlist: list[str] + :keyword key_vault: ARM id of the key vault associated with this workspace. This cannot be + changed once the workspace has been created. + :paramtype key_vault: str + :keyword key_vaults: + :paramtype key_vaults: list[str] + :keyword managed_network: Managed Network settings for a machine learning workspace. + :paramtype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings + :keyword primary_user_assigned_identity: The user assigned identity resource id that represents + the workspace identity. + :paramtype primary_user_assigned_identity: str :keyword public_network_access: Whether requests from Public Network are allowed. Possible values include: "Enabled", "Disabled". :paramtype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccess - :keyword serverless_compute_settings: Settings for serverless compute created in the workspace. + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :keyword serverless_compute_settings: Settings for serverless compute in a workspace. :paramtype serverless_compute_settings: ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings + :keyword service_managed_resources_settings: The service managed resource settings. + :paramtype service_managed_resources_settings: + ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings :keyword shared_private_link_resources: The list of shared private link resources in this workspace. :paramtype shared_private_link_resources: list[~azure.mgmt.machinelearningservices.models.SharedPrivateLinkResource] - :keyword service_managed_resources_settings: The service managed resource settings. - :paramtype service_managed_resources_settings: - ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings - :keyword primary_user_assigned_identity: The user assigned identity resource id that represents - the workspace identity. - :paramtype primary_user_assigned_identity: str + :keyword soft_delete_retention_in_days: Retention time in days after workspace get soft + deleted. + :paramtype soft_delete_retention_in_days: int + :keyword storage_account: ARM id of the storage account associated with this workspace. This + cannot be changed once the workspace has been created. + :paramtype storage_account: str + :keyword storage_accounts: + :paramtype storage_accounts: list[str] + :keyword system_datastores_auth_mode: The auth mode used for accessing the system datastores of + the workspace. + :paramtype system_datastores_auth_mode: str :keyword v1_legacy_mode: Enabling v1_legacy_mode may prevent you from using features provided by the v2 API. :paramtype v1_legacy_mode: bool - :keyword managed_network: Managed Network settings for a machine learning workspace. - :paramtype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings - :keyword feature_store_settings: Settings for feature store type workspace. - :paramtype feature_store_settings: - ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings - :keyword associated_workspaces: - :paramtype associated_workspaces: list[str] - :keyword enable_data_isolation: - :paramtype enable_data_isolation: bool - :keyword hub_resource_id: - :paramtype hub_resource_id: str :keyword workspace_hub_config: WorkspaceHub's configuration object. :paramtype workspace_hub_config: ~azure.mgmt.machinelearningservices.models.WorkspaceHubConfig """ @@ -30001,40 +33216,51 @@ def __init__( self.identity = identity self.kind = kind self.location = location - self.tags = tags self.sku = sku - self.workspace_id = None - self.description = description - self.friendly_name = friendly_name - self.key_vault = key_vault + self.tags = tags + self.allow_public_access_when_behind_vnet = allow_public_access_when_behind_vnet + self.allow_role_assignment_on_rg = allow_role_assignment_on_rg self.application_insights = application_insights + self.associated_workspaces = associated_workspaces + self.container_registries = container_registries self.container_registry = container_registry - self.storage_account = storage_account + self.description = description self.discovery_url = discovery_url - self.provisioning_state = None + self.enable_data_isolation = enable_data_isolation + self.enable_service_side_cmk_encryption = enable_service_side_cmk_encryption + self.enable_simplified_cmk = enable_simplified_cmk + self.enable_software_bill_of_materials = enable_software_bill_of_materials self.encryption = encryption + self.existing_workspaces = existing_workspaces + self.feature_store_settings = feature_store_settings + self.friendly_name = friendly_name self.hbi_workspace = hbi_workspace - self.service_provisioned_resource_group = None - self.private_link_count = None + self.hub_resource_id = hub_resource_id self.image_build_compute = image_build_compute - self.allow_public_access_when_behind_vnet = allow_public_access_when_behind_vnet - self.public_network_access = public_network_access + self.ip_allowlist = ip_allowlist + self.key_vault = key_vault + self.key_vaults = key_vaults + self.managed_network = managed_network + self.ml_flow_tracking_uri = None + self.notebook_info = None + self.primary_user_assigned_identity = primary_user_assigned_identity self.private_endpoint_connections = None + self.private_link_count = None + self.provisioning_state = None + self.public_network_access = public_network_access self.serverless_compute_settings = serverless_compute_settings - self.shared_private_link_resources = shared_private_link_resources - self.notebook_info = None self.service_managed_resources_settings = service_managed_resources_settings - self.primary_user_assigned_identity = primary_user_assigned_identity - self.tenant_id = None + self.service_provisioned_resource_group = None + self.shared_private_link_resources = shared_private_link_resources + self.soft_delete_retention_in_days = soft_delete_retention_in_days + self.storage_account = storage_account + self.storage_accounts = storage_accounts self.storage_hns_enabled = None - self.ml_flow_tracking_uri = None + self.system_datastores_auth_mode = system_datastores_auth_mode + self.tenant_id = None self.v1_legacy_mode = v1_legacy_mode - self.managed_network = managed_network - self.feature_store_settings = feature_store_settings - self.associated_workspaces = associated_workspaces - self.enable_data_isolation = enable_data_isolation - self.hub_resource_id = hub_resource_id self.workspace_hub_config = workspace_hub_config + self.workspace_id = None class WorkspaceConnectionAccessKey(msrest.serialization.Model): @@ -30070,7 +33296,7 @@ def __init__( class WorkspaceConnectionAccountKey(msrest.serialization.Model): - """WorkspaceConnectionAccountKey. + """Account key object for workspace connection credential. :ivar key: :vartype key: str @@ -30122,33 +33348,33 @@ def __init__( class WorkspaceConnectionManagedIdentity(msrest.serialization.Model): """WorkspaceConnectionManagedIdentity. - :ivar resource_id: - :vartype resource_id: str :ivar client_id: :vartype client_id: str + :ivar resource_id: + :vartype resource_id: str """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, } def __init__( self, *, - resource_id: Optional[str] = None, client_id: Optional[str] = None, + resource_id: Optional[str] = None, **kwargs ): """ - :keyword resource_id: - :paramtype resource_id: str :keyword client_id: :paramtype client_id: str + :keyword resource_id: + :paramtype resource_id: str """ super(WorkspaceConnectionManagedIdentity, self).__init__(**kwargs) - self.resource_id = resource_id self.client_id = client_id + self.resource_id = resource_id class WorkspaceConnectionOAuth2(msrest.serialization.Model): @@ -30313,38 +33539,35 @@ def __init__( class WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult(msrest.serialization.Model): """WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult. - Variables are only populated by the server, and will be ignored when sending a request. - + :ivar next_link: + :vartype next_link: str :ivar value: :vartype value: list[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource] - :ivar next_link: - :vartype next_link: str """ - _validation = { - 'next_link': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkspaceConnectionPropertiesV2BasicResource]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[WorkspaceConnectionPropertiesV2BasicResource]'}, } def __init__( self, *, + next_link: Optional[str] = None, value: Optional[List["WorkspaceConnectionPropertiesV2BasicResource"]] = None, **kwargs ): """ + :keyword next_link: + :paramtype next_link: str :keyword value: :paramtype value: list[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource] """ super(WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult, self).__init__(**kwargs) + self.next_link = next_link self.value = value - self.next_link = None class WorkspaceConnectionServicePrincipal(msrest.serialization.Model): @@ -30411,45 +33634,73 @@ def __init__( self.sas = sas +class WorkspaceConnectionUpdateParameter(msrest.serialization.Model): + """The properties that the machine learning workspace connection will be updated with. + + :ivar properties: The properties that the machine learning workspace connection will be updated + with. + :vartype properties: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2 + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'WorkspaceConnectionPropertiesV2'}, + } + + def __init__( + self, + *, + properties: Optional["WorkspaceConnectionPropertiesV2"] = None, + **kwargs + ): + """ + :keyword properties: The properties that the machine learning workspace connection will be + updated with. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2 + """ + super(WorkspaceConnectionUpdateParameter, self).__init__(**kwargs) + self.properties = properties + + class WorkspaceConnectionUsernamePassword(msrest.serialization.Model): """WorkspaceConnectionUsernamePassword. - :ivar username: - :vartype username: str :ivar password: :vartype password: str :ivar security_token: Optional, required by connections like SalesForce for extra security in addition to UsernamePassword. :vartype security_token: str + :ivar username: + :vartype username: str """ _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, 'password': {'key': 'password', 'type': 'str'}, 'security_token': {'key': 'securityToken', 'type': 'str'}, + 'username': {'key': 'username', 'type': 'str'}, } def __init__( self, *, - username: Optional[str] = None, password: Optional[str] = None, security_token: Optional[str] = None, + username: Optional[str] = None, **kwargs ): """ - :keyword username: - :paramtype username: str :keyword password: :paramtype password: str :keyword security_token: Optional, required by connections like SalesForce for extra security in addition to UsernamePassword. :paramtype security_token: str + :keyword username: + :paramtype username: str """ super(WorkspaceConnectionUsernamePassword, self).__init__(**kwargs) - self.username = username self.password = password self.security_token = security_token + self.username = username class WorkspaceHubConfig(msrest.serialization.Model): @@ -30487,186 +33738,252 @@ def __init__( class WorkspaceListResult(msrest.serialization.Model): """The result of a request to list machine learning workspaces. + :ivar next_link: The link to the next page constructed using the continuationToken. If null, + there are no additional pages. + :vartype next_link: str :ivar value: The list of machine learning workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning workspaces. :vartype value: list[~azure.mgmt.machinelearningservices.models.Workspace] - :ivar next_link: The URI that can be used to request the next list of machine learning - workspaces. - :vartype next_link: str """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Workspace]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Workspace]'}, } def __init__( self, *, - value: Optional[List["Workspace"]] = None, next_link: Optional[str] = None, + value: Optional[List["Workspace"]] = None, **kwargs ): """ + :keyword next_link: The link to the next page constructed using the continuationToken. If + null, there are no additional pages. + :paramtype next_link: str :keyword value: The list of machine learning workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning workspaces. :paramtype value: list[~azure.mgmt.machinelearningservices.models.Workspace] - :keyword next_link: The URI that can be used to request the next list of machine learning - workspaces. - :paramtype next_link: str """ super(WorkspaceListResult, self).__init__(**kwargs) - self.value = value self.next_link = next_link + self.value = value + + +class WorkspacePrivateEndpointResource(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: e.g. + /subscriptions/{networkSubscriptionId}/resourceGroups/{rgName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}. + :vartype id: str + :ivar subnet_arm_id: The subnetId that the private endpoint is connected to. + :vartype subnet_arm_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'subnet_arm_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'subnet_arm_id': {'key': 'subnetArmId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(WorkspacePrivateEndpointResource, self).__init__(**kwargs) + self.id = None + self.subnet_arm_id = None class WorkspaceUpdateParameters(msrest.serialization.Model): """The parameters for updating a machine learning workspace. + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku :ivar tags: A set of tags. The resource tags for the machine learning workspace. :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar allow_role_assignment_on_rg: + :vartype allow_role_assignment_on_rg: bool + :ivar application_insights: ARM id of the application insights associated with this workspace. + :vartype application_insights: str + :ivar container_registry: ARM id of the container registry associated with this workspace. + :vartype container_registry: str :ivar description: The description of this workspace. :vartype description: str - :ivar friendly_name: The friendly name for this workspace. + :ivar enable_data_isolation: + :vartype enable_data_isolation: bool + :ivar enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterials should be + enabled for this workspace. + :vartype enable_software_bill_of_materials: bool + :ivar encryption: + :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties + :ivar feature_store_settings: Settings for feature store type workspace. + :vartype feature_store_settings: + ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :ivar friendly_name: The friendly name for this workspace. This name in mutable. :vartype friendly_name: str :ivar image_build_compute: The compute name for image build. :vartype image_build_compute: str - :ivar service_managed_resources_settings: The service managed resource settings. - :vartype service_managed_resources_settings: - ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :ivar ip_allowlist: The list of IPv4 addresses that are allowed to access the workspace. + :vartype ip_allowlist: list[str] + :ivar managed_network: Managed Network settings for a machine learning workspace. + :vartype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings :ivar primary_user_assigned_identity: The user assigned identity resource id that represents the workspace identity. :vartype primary_user_assigned_identity: str - :ivar serverless_compute_settings: Settings for serverless compute created in the workspace. - :vartype serverless_compute_settings: - ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings :ivar public_network_access: Whether requests from Public Network are allowed. Possible values include: "Enabled", "Disabled". :vartype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccess - :ivar application_insights: ARM id of the application insights associated with this workspace. - :vartype application_insights: str - :ivar container_registry: ARM id of the container registry associated with this workspace. - :vartype container_registry: str - :ivar feature_store_settings: Settings for feature store type workspace. - :vartype feature_store_settings: - ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings - :ivar managed_network: Managed Network settings for a machine learning workspace. - :vartype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings - :ivar enable_data_isolation: - :vartype enable_data_isolation: bool + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :ivar serverless_compute_settings: Settings for serverless compute in a workspace. + :vartype serverless_compute_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings + :ivar service_managed_resources_settings: The service managed resource settings. + :vartype service_managed_resources_settings: + ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :ivar soft_delete_retention_in_days: Retention time in days after workspace get soft deleted. + :vartype soft_delete_retention_in_days: int :ivar v1_legacy_mode: Enabling v1_legacy_mode may prevent you from using features provided by the v2 API. :vartype v1_legacy_mode: bool - :ivar encryption: - :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'allow_role_assignment_on_rg': {'key': 'properties.allowRoleAssignmentOnRG', 'type': 'bool'}, + 'application_insights': {'key': 'properties.applicationInsights', 'type': 'str'}, + 'container_registry': {'key': 'properties.containerRegistry', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, + 'enable_data_isolation': {'key': 'properties.enableDataIsolation', 'type': 'bool'}, + 'enable_software_bill_of_materials': {'key': 'properties.enableSoftwareBillOfMaterials', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionUpdateProperties'}, + 'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'}, 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, 'image_build_compute': {'key': 'properties.imageBuildCompute', 'type': 'str'}, - 'service_managed_resources_settings': {'key': 'properties.serviceManagedResourcesSettings', 'type': 'ServiceManagedResourcesSettings'}, + 'ip_allowlist': {'key': 'properties.ipAllowlist', 'type': '[str]'}, + 'managed_network': {'key': 'properties.managedNetwork', 'type': 'ManagedNetworkSettings'}, 'primary_user_assigned_identity': {'key': 'properties.primaryUserAssignedIdentity', 'type': 'str'}, - 'serverless_compute_settings': {'key': 'properties.serverlessComputeSettings', 'type': 'ServerlessComputeSettings'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'application_insights': {'key': 'properties.applicationInsights', 'type': 'str'}, - 'container_registry': {'key': 'properties.containerRegistry', 'type': 'str'}, - 'feature_store_settings': {'key': 'properties.featureStoreSettings', 'type': 'FeatureStoreSettings'}, - 'managed_network': {'key': 'properties.managedNetwork', 'type': 'ManagedNetworkSettings'}, - 'enable_data_isolation': {'key': 'properties.enableDataIsolation', 'type': 'bool'}, + 'serverless_compute_settings': {'key': 'properties.serverlessComputeSettings', 'type': 'ServerlessComputeSettings'}, + 'service_managed_resources_settings': {'key': 'properties.serviceManagedResourcesSettings', 'type': 'ServiceManagedResourcesSettings'}, + 'soft_delete_retention_in_days': {'key': 'properties.softDeleteRetentionInDays', 'type': 'int'}, 'v1_legacy_mode': {'key': 'properties.v1LegacyMode', 'type': 'bool'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionUpdateProperties'}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, - sku: Optional["Sku"] = None, identity: Optional["ManagedServiceIdentity"] = None, + sku: Optional["Sku"] = None, + tags: Optional[Dict[str, str]] = None, + allow_role_assignment_on_rg: Optional[bool] = None, + application_insights: Optional[str] = None, + container_registry: Optional[str] = None, description: Optional[str] = None, + enable_data_isolation: Optional[bool] = None, + enable_software_bill_of_materials: Optional[bool] = None, + encryption: Optional["EncryptionUpdateProperties"] = None, + feature_store_settings: Optional["FeatureStoreSettings"] = None, friendly_name: Optional[str] = None, image_build_compute: Optional[str] = None, - service_managed_resources_settings: Optional["ServiceManagedResourcesSettings"] = None, + ip_allowlist: Optional[List[str]] = None, + managed_network: Optional["ManagedNetworkSettings"] = None, primary_user_assigned_identity: Optional[str] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccessType"]] = None, serverless_compute_settings: Optional["ServerlessComputeSettings"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, - application_insights: Optional[str] = None, - container_registry: Optional[str] = None, - feature_store_settings: Optional["FeatureStoreSettings"] = None, - managed_network: Optional["ManagedNetworkSettings"] = None, - enable_data_isolation: Optional[bool] = None, + service_managed_resources_settings: Optional["ServiceManagedResourcesSettings"] = None, + soft_delete_retention_in_days: Optional[int] = None, v1_legacy_mode: Optional[bool] = None, - encryption: Optional["EncryptionUpdateProperties"] = None, **kwargs ): """ + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku :keyword tags: A set of tags. The resource tags for the machine learning workspace. :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword allow_role_assignment_on_rg: + :paramtype allow_role_assignment_on_rg: bool + :keyword application_insights: ARM id of the application insights associated with this + workspace. + :paramtype application_insights: str + :keyword container_registry: ARM id of the container registry associated with this workspace. + :paramtype container_registry: str :keyword description: The description of this workspace. :paramtype description: str - :keyword friendly_name: The friendly name for this workspace. + :keyword enable_data_isolation: + :paramtype enable_data_isolation: bool + :keyword enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterials should be + enabled for this workspace. + :paramtype enable_software_bill_of_materials: bool + :keyword encryption: + :paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties + :keyword feature_store_settings: Settings for feature store type workspace. + :paramtype feature_store_settings: + ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :keyword friendly_name: The friendly name for this workspace. This name in mutable. :paramtype friendly_name: str :keyword image_build_compute: The compute name for image build. :paramtype image_build_compute: str - :keyword service_managed_resources_settings: The service managed resource settings. - :paramtype service_managed_resources_settings: - ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :keyword ip_allowlist: The list of IPv4 addresses that are allowed to access the workspace. + :paramtype ip_allowlist: list[str] + :keyword managed_network: Managed Network settings for a machine learning workspace. + :paramtype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings :keyword primary_user_assigned_identity: The user assigned identity resource id that represents the workspace identity. :paramtype primary_user_assigned_identity: str - :keyword serverless_compute_settings: Settings for serverless compute created in the workspace. - :paramtype serverless_compute_settings: - ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings :keyword public_network_access: Whether requests from Public Network are allowed. Possible values include: "Enabled", "Disabled". :paramtype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccess - :keyword application_insights: ARM id of the application insights associated with this - workspace. - :paramtype application_insights: str - :keyword container_registry: ARM id of the container registry associated with this workspace. - :paramtype container_registry: str - :keyword feature_store_settings: Settings for feature store type workspace. - :paramtype feature_store_settings: - ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings - :keyword managed_network: Managed Network settings for a machine learning workspace. - :paramtype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings - :keyword enable_data_isolation: - :paramtype enable_data_isolation: bool + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :keyword serverless_compute_settings: Settings for serverless compute in a workspace. + :paramtype serverless_compute_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings + :keyword service_managed_resources_settings: The service managed resource settings. + :paramtype service_managed_resources_settings: + ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :keyword soft_delete_retention_in_days: Retention time in days after workspace get soft + deleted. + :paramtype soft_delete_retention_in_days: int :keyword v1_legacy_mode: Enabling v1_legacy_mode may prevent you from using features provided by the v2 API. :paramtype v1_legacy_mode: bool - :keyword encryption: - :paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties """ super(WorkspaceUpdateParameters, self).__init__(**kwargs) - self.tags = tags - self.sku = sku self.identity = identity + self.sku = sku + self.tags = tags + self.allow_role_assignment_on_rg = allow_role_assignment_on_rg + self.application_insights = application_insights + self.container_registry = container_registry self.description = description + self.enable_data_isolation = enable_data_isolation + self.enable_software_bill_of_materials = enable_software_bill_of_materials + self.encryption = encryption + self.feature_store_settings = feature_store_settings self.friendly_name = friendly_name self.image_build_compute = image_build_compute - self.service_managed_resources_settings = service_managed_resources_settings + self.ip_allowlist = ip_allowlist + self.managed_network = managed_network self.primary_user_assigned_identity = primary_user_assigned_identity - self.serverless_compute_settings = serverless_compute_settings self.public_network_access = public_network_access - self.application_insights = application_insights - self.container_registry = container_registry - self.feature_store_settings = feature_store_settings - self.managed_network = managed_network - self.enable_data_isolation = enable_data_isolation + self.serverless_compute_settings = serverless_compute_settings + self.service_managed_resources_settings = service_managed_resources_settings + self.soft_delete_retention_in_days = soft_delete_retention_in_days self.v1_legacy_mode = v1_legacy_mode - self.encryption = encryption diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/__init__.py index 47b3a25a2289f..f76d571ef953e 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/__init__.py @@ -6,17 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import Operations -from ._workspaces_operations import WorkspacesOperations from ._usages_operations import UsagesOperations from ._virtual_machine_sizes_operations import VirtualMachineSizesOperations from ._quotas_operations import QuotasOperations from ._compute_operations import ComputeOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._workspace_connections_operations import WorkspaceConnectionsOperations -from ._managed_network_settings_rule_operations import ManagedNetworkSettingsRuleOperations -from ._managed_network_provisions_operations import ManagedNetworkProvisionsOperations from ._registries_operations import RegistriesOperations from ._workspace_features_operations import WorkspaceFeaturesOperations from ._registry_code_containers_operations import RegistryCodeContainersOperations @@ -54,19 +47,30 @@ from ._online_deployments_operations import OnlineDeploymentsOperations from ._schedules_operations import SchedulesOperations from ._serverless_endpoints_operations import ServerlessEndpointsOperations +from ._operations import Operations +from ._workspaces_operations import WorkspacesOperations +from ._workspace_connections_operations import WorkspaceConnectionsOperations +from ._connection_operations import ConnectionOperations +from ._connection_rai_blocklists_operations import ConnectionRaiBlocklistsOperations +from ._connection_rai_blocklist_operations import ConnectionRaiBlocklistOperations +from ._connection_rai_blocklist_item_operations import ConnectionRaiBlocklistItemOperations +from ._connection_rai_blocklist_items_operations import ConnectionRaiBlocklistItemsOperations +from ._connection_rai_policies_operations import ConnectionRaiPoliciesOperations +from ._connection_rai_policy_operations import ConnectionRaiPolicyOperations +from ._endpoint_deployment_operations import EndpointDeploymentOperations +from ._endpoint_operations import EndpointOperations +from ._rai_policies_operations import RaiPoliciesOperations +from ._rai_policy_operations import RaiPolicyOperations +from ._managed_network_settings_rule_operations import ManagedNetworkSettingsRuleOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._managed_network_provisions_operations import ManagedNetworkProvisionsOperations __all__ = [ - 'Operations', - 'WorkspacesOperations', 'UsagesOperations', 'VirtualMachineSizesOperations', 'QuotasOperations', 'ComputeOperations', - 'PrivateEndpointConnectionsOperations', - 'PrivateLinkResourcesOperations', - 'WorkspaceConnectionsOperations', - 'ManagedNetworkSettingsRuleOperations', - 'ManagedNetworkProvisionsOperations', 'RegistriesOperations', 'WorkspaceFeaturesOperations', 'RegistryCodeContainersOperations', @@ -104,4 +108,22 @@ 'OnlineDeploymentsOperations', 'SchedulesOperations', 'ServerlessEndpointsOperations', + 'Operations', + 'WorkspacesOperations', + 'WorkspaceConnectionsOperations', + 'ConnectionOperations', + 'ConnectionRaiBlocklistsOperations', + 'ConnectionRaiBlocklistOperations', + 'ConnectionRaiBlocklistItemOperations', + 'ConnectionRaiBlocklistItemsOperations', + 'ConnectionRaiPoliciesOperations', + 'ConnectionRaiPolicyOperations', + 'EndpointDeploymentOperations', + 'EndpointOperations', + 'RaiPoliciesOperations', + 'RaiPolicyOperations', + 'ManagedNetworkSettingsRuleOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ManagedNetworkProvisionsOperations', ] diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_compute_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_compute_operations.py index 1ec5aee583834..1625166ed48ab 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_compute_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_compute_operations.py @@ -25,7 +25,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +90,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), - "computeName": _SERIALIZER.url("compute_name", compute_name, 'str'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -130,7 +130,7 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), - "computeName": _SERIALIZER.url("compute_name", compute_name, 'str'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -172,7 +172,7 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), - "computeName": _SERIALIZER.url("compute_name", compute_name, 'str'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -214,7 +214,7 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), - "computeName": _SERIALIZER.url("compute_name", compute_name, 'str'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -237,6 +237,48 @@ def build_delete_request_initial( ) +def build_update_custom_services_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/customServices") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + def build_list_nodes_request( subscription_id, # type: str resource_group_name, # type: str @@ -254,7 +296,7 @@ def build_list_nodes_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), - "computeName": _SERIALIZER.url("compute_name", compute_name, 'str'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -293,7 +335,47 @@ def build_list_keys_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), - "computeName": _SERIALIZER.url("compute_name", compute_name, 'str'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_data_mounts_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateDataMounts") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -304,6 +386,8 @@ def build_list_keys_request( # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( @@ -332,7 +416,7 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), - "computeName": _SERIALIZER.url("compute_name", compute_name, 'str'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -371,7 +455,7 @@ def build_stop_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), - "computeName": _SERIALIZER.url("compute_name", compute_name, 'str'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -410,7 +494,128 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), - "computeName": _SERIALIZER.url("compute_name", compute_name, 'str'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_idle_shutdown_setting_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateIdleShutdownSetting") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_allowed_resize_sizes_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/getAllowedVmSizesForResize") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_resize_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/resize") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str', pattern=r'^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -421,6 +626,8 @@ def build_restart_request_initial( # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( @@ -432,7 +639,7 @@ def build_restart_request_initial( ) # fmt: on -class ComputeOperations(object): +class ComputeOperations(object): # pylint: disable=too-many-public-methods """ComputeOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -1009,6 +1216,73 @@ def get_long_running_output(pipeline_response): begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}"} # type: ignore + @distributed_trace + def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + custom_services, # type: List["_models.CustomService"] + **kwargs # type: Any + ): + # type: (...) -> None + """Updates the custom services list. The list of custom services provided shall be overwritten. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. + :type compute_name: str + :param custom_services: New list of Custom Services. + :type custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(custom_services, '[CustomService]') + + request = build_update_custom_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_custom_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + update_custom_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/customServices"} # type: ignore + + @distributed_trace def list_nodes( self, @@ -1163,21 +1437,90 @@ def list_keys( list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listKeys"} # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements + @distributed_trace + def update_data_mounts( # pylint: disable=inconsistent-return-statements self, resource_group_name, # type: str workspace_name, # type: str compute_name, # type: str + data_mounts, # type: List["_models.ComputeInstanceDataMount"] **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + """Update Data Mounts of a Machine Learning compute. - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + Update Data Mounts of a Machine Learning compute. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. + :type compute_name: str + :param data_mounts: The parameters for creating or updating a machine learning workspace. + :type data_mounts: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceDataMount] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(data_mounts, '[ComputeInstanceDataMount]') + + request = build_update_data_mounts_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_data_mounts.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + update_data_mounts.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateDataMounts"} # type: ignore + + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str request = build_start_request_initial( @@ -1498,3 +1841,261 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart"} # type: ignore + + @distributed_trace + def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + parameters, # type: "_models.IdleShutdownSetting" + **kwargs # type: Any + ): + # type: (...) -> None + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + :type parameters: ~azure.mgmt.machinelearningservices.models.IdleShutdownSetting + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IdleShutdownSetting') + + request = build_update_idle_shutdown_setting_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_idle_shutdown_setting.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + update_idle_shutdown_setting.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateIdleShutdownSetting"} # type: ignore + + + @distributed_trace + def get_allowed_resize_sizes( + self, + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineSizeListResult" + """Returns supported virtual machine sizes for resize. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. + :type compute_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineSizeListResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.VirtualMachineSizeListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_allowed_resize_sizes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + api_version=api_version, + template_url=self.get_allowed_resize_sizes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_allowed_resize_sizes.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/getAllowedVmSizesForResize"} # type: ignore + + + def _resize_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + parameters, # type: "_models.ResizeSchema" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ResizeSchema') + + request = build_resize_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._resize_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _resize_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/resize"} # type: ignore + + + @distributed_trace + def begin_resize( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + parameters, # type: "_models.ResizeSchema" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Updates the size of a Compute Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. + :type compute_name: str + :param parameters: The object for updating VM size setting of specified Compute Instance. + :type parameters: ~azure.mgmt.machinelearningservices.models.ResizeSchema + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._resize_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resize.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/resize"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_operations.py new file mode 100644 index 0000000000000..40800e7d139d3 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_operations.py @@ -0,0 +1,886 @@ +# pylint: disable=too-many-lines +# 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 typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_deployments_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_deployment_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_deployment_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_deployment_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_models_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/models") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_models_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listConnectionModels") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class ConnectionOperations(object): + """ConnectionOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_deployments( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult"] + """Get all the deployments under the Azure OpenAI connection. + + Get all the deployments under the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_deployments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=self.list_deployments.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_deployments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments"} # type: ignore + + def _delete_deployment_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_deployment_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_deployment_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_deployment_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace + def begin_delete_deployment( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete Azure OpenAI connection deployment resource by name. + + Delete Azure OpenAI connection deployment resource by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param deployment_name: Name of the deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_deployment_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete_deployment.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}"} # type: ignore + + @distributed_trace + def get_deployment( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EndpointDeploymentResourcePropertiesBasicResource" + """Get deployments under the Azure OpenAI connection by name. + + Get deployments under the Azure OpenAI connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param deployment_name: Name of the deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointDeploymentResourcePropertiesBasicResource, or the result of cls(response) + :rtype: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_deployment_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_deployment.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_deployment.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}"} # type: ignore + + + def _create_or_update_deployment_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + deployment_name, # type: str + body, # type: "_models.EndpointDeploymentResourcePropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.EndpointDeploymentResourcePropertiesBasicResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'EndpointDeploymentResourcePropertiesBasicResource') + + request = build_create_or_update_deployment_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_deployment_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_deployment_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update_deployment( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + deployment_name, # type: str + body, # type: "_models.EndpointDeploymentResourcePropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.EndpointDeploymentResourcePropertiesBasicResource"] + """Create or update Azure OpenAI connection deployment resource with the specified parameters. + + Create or update Azure OpenAI connection deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param deployment_name: Name of the deployment resource. + :type deployment_name: str + :param body: deployment object. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_deployment_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update_deployment.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}"} # type: ignore + + @distributed_trace + def get_models( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EndpointModels"] + """Get available models under the Azure OpenAI connection. + + Get available models under the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointModels or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EndpointModels] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointModels"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_models_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=self.get_models.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_models_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointModels", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + get_models.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/models"} # type: ignore + + @distributed_trace + def list_models( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EndpointModels" + """Get models under the Azure ML workspace for all Azure OpenAI connections that the user can + deploy. + + Get models under the Azure ML workspace for all Azure OpenAI connections that the user can + deploy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointModels, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointModels + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointModels"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_list_models_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list_models.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointModels', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_models.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listConnectionModels"} # type: ignore + diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_blocklist_item_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_blocklist_item_operations.py new file mode 100644 index 0000000000000..5e138f0b4b6f2 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_blocklist_item_operations.py @@ -0,0 +1,914 @@ +# pylint: disable=too-many-lines +# 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 typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_add_bulk_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/addRaiBlocklistItems") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "raiBlocklistName": _SERIALIZER.url("rai_blocklist_name", rai_blocklist_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_bulk_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/deleteRaiBlocklistItems") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "raiBlocklistName": _SERIALIZER.url("rai_blocklist_name", rai_blocklist_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + rai_blocklist_item_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "raiBlocklistName": _SERIALIZER.url("rai_blocklist_name", rai_blocklist_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + "raiBlocklistItemName": _SERIALIZER.url("rai_blocklist_item_name", rai_blocklist_item_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + rai_blocklist_item_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "raiBlocklistName": _SERIALIZER.url("rai_blocklist_name", rai_blocklist_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + "raiBlocklistItemName": _SERIALIZER.url("rai_blocklist_item_name", rai_blocklist_item_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + rai_blocklist_item_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "raiBlocklistName": _SERIALIZER.url("rai_blocklist_name", rai_blocklist_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + "raiBlocklistItemName": _SERIALIZER.url("rai_blocklist_item_name", rai_blocklist_item_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class ConnectionRaiBlocklistItemOperations(object): + """ConnectionRaiBlocklistItemOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _add_bulk_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + body, # type: List["_models.RaiBlocklistItemBulkRequest"] + **kwargs # type: Any + ): + # type: (...) -> Optional[List["_models.RaiBlocklistItemPropertiesBasicResource"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["_models.RaiBlocklistItemPropertiesBasicResource"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, '[RaiBlocklistItemBulkRequest]') + + request = build_add_bulk_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._add_bulk_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('[RaiBlocklistItemPropertiesBasicResource]', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _add_bulk_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/addRaiBlocklistItems"} # type: ignore + + + @distributed_trace + def begin_add_bulk( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + body, # type: List["_models.RaiBlocklistItemBulkRequest"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[List["_models.RaiBlocklistItemPropertiesBasicResource"]] + """Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :param body: Properties describing the custom blocklist items. + :type body: list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemBulkRequest] + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either list of + RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource]] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.RaiBlocklistItemPropertiesBasicResource"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._add_bulk_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('[RaiBlocklistItemPropertiesBasicResource]', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_add_bulk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/addRaiBlocklistItems"} # type: ignore + + def _delete_bulk_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + body, # type: Any + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'object') + + request = build_delete_bulk_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._delete_bulk_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_bulk_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/deleteRaiBlocklistItems"} # type: ignore + + + @distributed_trace + def begin_delete_bulk( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + body, # type: Any + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete multiple blocklist items from the specified blocklist associated with the Azure OpenAI + connection. + + Delete multiple blocklist items from the specified blocklist associated with the Azure OpenAI + connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :param body: List of RAI Blocklist Items Names. + :type body: any + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_bulk_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete_bulk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/deleteRaiBlocklistItems"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + rai_blocklist_item_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + rai_blocklist_item_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified custom blocklist item associated with the Azure OpenAI connection. + + Deletes the specified custom blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. + :type rai_blocklist_item_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + rai_blocklist_item_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RaiBlocklistItemPropertiesBasicResource" + """Gets the specified custom blocklist item associated with the Azure OpenAI connection. + + Gets the specified custom blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. + :type rai_blocklist_item_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklistItemPropertiesBasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistItemPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RaiBlocklistItemPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}"} # type: ignore + + + def _create_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + rai_blocklist_item_name, # type: str + body, # type: "_models.RaiBlocklistItemPropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.RaiBlocklistItemPropertiesBasicResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistItemPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'RaiBlocklistItemPropertiesBasicResource') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RaiBlocklistItemPropertiesBasicResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RaiBlocklistItemPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}"} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + rai_blocklist_item_name, # type: str + body, # type: "_models.RaiBlocklistItemPropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RaiBlocklistItemPropertiesBasicResource"] + """Update the state of specified blocklist item associated with the Azure OpenAI connection. + + Update the state of specified blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. + :type rai_blocklist_item_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RaiBlocklistItemPropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistItemPropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('RaiBlocklistItemPropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_blocklist_items_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_blocklist_items_operations.py new file mode 100644 index 0000000000000..faa4b24038318 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_blocklist_items_operations.py @@ -0,0 +1,192 @@ +# pylint: disable=too-many-lines +# 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 typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "raiBlocklistName": _SERIALIZER.url("rai_blocklist_name", rai_blocklist_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class ConnectionRaiBlocklistItemsOperations(object): + """ConnectionRaiBlocklistItemsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult"] + """Gets the custom blocklist items associated with the Azure OpenAI connection. + + Gets the custom blocklist items associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_blocklist_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_blocklist_operations.py new file mode 100644 index 0000000000000..2af19bb9f02a1 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_blocklist_operations.py @@ -0,0 +1,521 @@ +# pylint: disable=too-many-lines +# 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 typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "raiBlocklistName": _SERIALIZER.url("rai_blocklist_name", rai_blocklist_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "raiBlocklistName": _SERIALIZER.url("rai_blocklist_name", rai_blocklist_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "raiBlocklistName": _SERIALIZER.url("rai_blocklist_name", rai_blocklist_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class ConnectionRaiBlocklistOperations(object): + """ConnectionRaiBlocklistOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified custom blocklist associated with the Azure OpenAI connection. + + Deletes the specified custom blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RaiBlocklistPropertiesBasicResource" + """Gets the specified custom blocklist associated with the Azure OpenAI connection. + + Gets the specified custom blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiBlocklistPropertiesBasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RaiBlocklistPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}"} # type: ignore + + + def _create_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + body, # type: "_models.RaiBlocklistPropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.RaiBlocklistPropertiesBasicResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'RaiBlocklistPropertiesBasicResource') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RaiBlocklistPropertiesBasicResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RaiBlocklistPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}"} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_blocklist_name, # type: str + body, # type: "_models.RaiBlocklistPropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RaiBlocklistPropertiesBasicResource"] + """Update the state of specified blocklist associated with the Azure OpenAI connection. + + Update the state of specified blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. + :type rai_blocklist_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RaiBlocklistPropertiesBasicResource or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistPropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('RaiBlocklistPropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_blocklists_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_blocklists_operations.py new file mode 100644 index 0000000000000..1f2feb3c08a0f --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_blocklists_operations.py @@ -0,0 +1,185 @@ +# pylint: disable=too-many-lines +# 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 typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class ConnectionRaiBlocklistsOperations(object): + """ConnectionRaiBlocklistsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RaiBlocklistPropertiesBasicResourceArmPaginatedResult"] + """Gets the custom blocklists associated with the Azure OpenAI connection. + + Gets the custom blocklists associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + RaiBlocklistPropertiesBasicResourceArmPaginatedResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiBlocklistPropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RaiBlocklistPropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_policies_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_policies_operations.py new file mode 100644 index 0000000000000..cd58eec2db669 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_policies_operations.py @@ -0,0 +1,185 @@ +# pylint: disable=too-many-lines +# 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 typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class ConnectionRaiPoliciesOperations(object): + """ConnectionRaiPoliciesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RaiPolicyPropertiesBasicResourceArmPaginatedResult"] + """List the specified Content Filters associated with the Azure OpenAI connection. + + List the specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RaiPolicyPropertiesBasicResourceArmPaginatedResult + or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RaiPolicyPropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_policy_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_policy_operations.py new file mode 100644 index 0000000000000..0a4494d973c10 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_connection_rai_policy_operations.py @@ -0,0 +1,521 @@ +# pylint: disable=too-many-lines +# 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 typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_policy_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "raiPolicyName": _SERIALIZER.url("rai_policy_name", rai_policy_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_policy_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "raiPolicyName": _SERIALIZER.url("rai_policy_name", rai_policy_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_policy_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "raiPolicyName": _SERIALIZER.url("rai_policy_name", rai_policy_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class ConnectionRaiPolicyOperations(object): + """ConnectionRaiPolicyOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified Content Filters associated with the Azure OpenAI connection. + + Deletes the specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. + :type rai_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RaiPolicyPropertiesBasicResource" + """Gets the specified Content Filters associated with the Azure OpenAI connection. + + Gets the specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. + :type rai_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiPolicyPropertiesBasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}"} # type: ignore + + + def _create_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_policy_name, # type: str + body, # type: "_models.RaiPolicyPropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.RaiPolicyPropertiesBasicResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'RaiPolicyPropertiesBasicResource') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}"} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + rai_policy_name, # type: str + body, # type: "_models.RaiPolicyPropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RaiPolicyPropertiesBasicResource"] + """Update the state of specified Content Filters associated with the Azure OpenAI connection. + + Update the state of specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. + :type rai_policy_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RaiPolicyPropertiesBasicResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_endpoint_deployment_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_endpoint_deployment_operations.py new file mode 100644 index 0000000000000..63041756bd6bb --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_endpoint_deployment_operations.py @@ -0,0 +1,801 @@ +# pylint: disable=too-many-lines +# 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 typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_in_workspace_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + endpoint_type = kwargs.pop('endpoint_type', None) # type: Optional[Union[str, "_models.EndpointType"]] + skip = kwargs.pop('skip', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/deployments") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if endpoint_type is not None: + _query_parameters['endpointType'] = _SERIALIZER.query("endpoint_type", endpoint_type, 'str') + if skip is not None: + _query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class EndpointDeploymentOperations(object): + """EndpointDeploymentOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_in_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_type=None, # type: Optional[Union[str, "_models.EndpointType"]] + skip=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult"] + """Get all the deployments under the workspace scope. + + Get all the deployments under the workspace scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_type: Endpoint type filter. + :type endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :param skip: Continuation token for pagination. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_in_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + endpoint_type=endpoint_type, + skip=skip, + template_url=self.get_in_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_in_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + endpoint_type=endpoint_type, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + get_in_workspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/deployments"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult"] + """Get all the deployments under the endpoint resource scope. + + Get all the deployments under the endpoint resource scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete endpoint deployment resource by name. + + Delete endpoint deployment resource by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EndpointDeploymentResourcePropertiesBasicResource" + """Get deployments under endpoint resource by name. + + Get deployments under endpoint resource by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointDeploymentResourcePropertiesBasicResource, or the result of cls(response) + :rtype: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + deployment_name, # type: str + body, # type: "_models.EndpointDeploymentResourcePropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.EndpointDeploymentResourcePropertiesBasicResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.EndpointDeploymentResourcePropertiesBasicResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'EndpointDeploymentResourcePropertiesBasicResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + deployment_name, # type: str + body, # type: "_models.EndpointDeploymentResourcePropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.EndpointDeploymentResourcePropertiesBasicResource"] + """Create or update endpoint deployment resource with the specified parameters. + + Create or update endpoint deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. + :type deployment_name: str + :param body: deployment object. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointDeploymentResourcePropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EndpointDeploymentResourcePropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_endpoint_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_endpoint_operations.py new file mode 100644 index 0000000000000..3b67e109e1f4f --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_endpoint_operations.py @@ -0,0 +1,851 @@ +# pylint: disable=too-many-lines +# 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 typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + endpoint_type = kwargs.pop('endpoint_type', None) # type: Optional[Union[str, "_models.EndpointType"]] + include_inference_endpoints = kwargs.pop('include_inference_endpoints', False) # type: Optional[bool] + skip = kwargs.pop('skip', None) # type: Optional[str] + expand = kwargs.pop('expand', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if endpoint_type is not None: + _query_parameters['endpointType'] = _SERIALIZER.query("endpoint_type", endpoint_type, 'str') + if include_inference_endpoints is not None: + _query_parameters['includeInferenceEndpoints'] = _SERIALIZER.query("include_inference_endpoints", include_inference_endpoints, 'bool') + if skip is not None: + _query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'str') + if expand is not None: + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_keys_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/listKeys") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_models_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/models") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_regenerate_keys_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/regenerateKey") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class EndpointOperations(object): + """EndpointOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_type=None, # type: Optional[Union[str, "_models.EndpointType"]] + include_inference_endpoints=False, # type: Optional[bool] + skip=None, # type: Optional[str] + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EndpointResourcePropertiesBasicResourceArmPaginatedResult"] + """List All the endpoints under this workspace. + + List All the endpoints under this workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_type: Endpoint type filter. + :type endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :param include_inference_endpoints: + :type include_inference_endpoints: bool + :param skip: Continuation token for pagination. + :type skip: str + :param expand: Whether the endpoint resource will be expand to include deployment information, + e.g. $expand=deployments. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + EndpointResourcePropertiesBasicResourceArmPaginatedResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointResourcePropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + endpoint_type=endpoint_type, + include_inference_endpoints=include_inference_endpoints, + skip=skip, + expand=expand, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + endpoint_type=endpoint_type, + include_inference_endpoints=include_inference_endpoints, + skip=skip, + expand=expand, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointResourcePropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EndpointResourcePropertiesBasicResource" + """Gets endpoint resource. + + Gets endpoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointResourcePropertiesBasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointResourcePropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointResourcePropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + body, # type: "_models.EndpointResourcePropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.EndpointResourcePropertiesBasicResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.EndpointResourcePropertiesBasicResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'EndpointResourcePropertiesBasicResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('EndpointResourcePropertiesBasicResource', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + body, # type: "_models.EndpointResourcePropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.EndpointResourcePropertiesBasicResource"] + """Create or update endpoint resource with the specified parameters. + + Create or update endpoint resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param body: Endpoint resource object. + :type body: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either EndpointResourcePropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointResourcePropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('EndpointResourcePropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}"} # type: ignore + + @distributed_trace + def list_keys( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EndpointKeys" + """List keys for the endpoint resource. + + List keys for the endpoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EndpointKeys, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_list_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EndpointKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/listKeys"} # type: ignore + + + @distributed_trace + def get_models( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EndpointModels"] + """Get available models under the endpoint resource. + + Get available models under the endpoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointModels or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EndpointModels] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointModels"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_models_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.get_models.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_models_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointModels", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + get_models.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/models"} # type: ignore + + @distributed_trace + def regenerate_keys( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + body, # type: "_models.RegenerateServiceAccountKeyContent" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccountApiKeys" + """Regenerate account keys. + + Regenerate account keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateServiceAccountKeyContent + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountApiKeys, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.AccountApiKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountApiKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'RegenerateServiceAccountKeyContent') + + request = build_regenerate_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccountApiKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/regenerateKey"} # type: ignore + diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_managed_network_provisions_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_managed_network_provisions_operations.py index 2d060a9ed1c0d..39670464fcfec 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_managed_network_provisions_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_managed_network_provisions_operations.py @@ -172,7 +172,7 @@ def begin_provision_managed_network( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param body: Managed Network Provisioning Options for a machine learning workspace. :type body: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionOptions diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_managed_network_settings_rule_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_managed_network_settings_rule_operations.py index 2cc4c048de6b4..0b3ffcf38431a 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_managed_network_settings_rule_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_managed_network_settings_rule_operations.py @@ -226,7 +226,7 @@ def list( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OutboundRuleListResult or the result of @@ -341,6 +341,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if cls: @@ -364,7 +365,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param rule_name: Name of the workspace managed network outbound rule. :type rule_name: str @@ -404,7 +405,7 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -433,7 +434,7 @@ def get( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param rule_name: Name of the workspace managed network outbound rule. :type rule_name: str @@ -562,7 +563,7 @@ def begin_create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param rule_name: Name of the workspace managed network outbound rule. :type rule_name: str diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_operations.py index b0ce31d3e4b3f..f148f6ba03218 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_operations.py @@ -88,6 +88,8 @@ def list( # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Azure Machine Learning Workspaces REST API operations. + Lists all of the available Azure Machine Learning Workspaces REST API operations. + :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) :rtype: diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_private_endpoint_connections_operations.py index c545fe859915e..ff22f79a7d869 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_private_endpoint_connections_operations.py @@ -32,9 +32,9 @@ # fmt: off def build_list_request( + subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str - subscription_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest @@ -44,9 +44,9 @@ def build_list_request( # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } _url = _format_url_section(_url, **path_format_arguments) @@ -68,7 +68,7 @@ def build_list_request( ) -def build_get_request( +def build_delete_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -99,7 +99,7 @@ def build_get_request( _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="GET", + method="DELETE", url=_url, params=_query_parameters, headers=_header_parameters, @@ -107,7 +107,7 @@ def build_get_request( ) -def build_create_or_update_request( +def build_get_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -116,7 +116,6 @@ def build_create_or_update_request( ): # type: (...) -> HttpRequest api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL @@ -136,12 +135,10 @@ def build_create_or_update_request( # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PUT", + method="GET", url=_url, params=_query_parameters, headers=_header_parameters, @@ -149,7 +146,7 @@ def build_create_or_update_request( ) -def build_delete_request( +def build_create_or_update_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -158,6 +155,7 @@ def build_delete_request( ): # type: (...) -> HttpRequest api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL @@ -177,10 +175,12 @@ def build_delete_request( # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="DELETE", + method="PUT", url=_url, params=_query_parameters, headers=_header_parameters, @@ -218,11 +218,13 @@ def list( **kwargs # type: Any ): # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] - """List all the private endpoint connections associated with the workspace. + """Called by end-users to get all PE connections. + + Called by end-users to get all PE connections. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result @@ -242,9 +244,9 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, - subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], ) @@ -254,9 +256,9 @@ def prepare_request(next_link=None): else: request = build_list_request( + subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, - subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, ) @@ -296,29 +298,30 @@ def get_next(next_link=None): list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections"} # type: ignore @distributed_trace - def get( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name, # type: str workspace_name, # type: str private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.PrivateEndpointConnection" - """Gets the specified private endpoint connection associated with the workspace. + # type: (...) -> None + """Called by end-users to delete a PE connection. + + Called by end-users to delete a PE connection. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection + :return: None, or the result of cls(response) + :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -327,13 +330,13 @@ def get( api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - request = build_get_request( + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -345,42 +348,36 @@ def get( ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, None, {}) - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def create_or_update( + def get( self, resource_group_name, # type: str workspace_name, # type: str private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): # type: (...) -> "_models.PrivateEndpointConnection" - """Update the state of specified private endpoint connection associated with the workspace. + """Called by end-users to get a PE connection. + + Called by end-users to get a PE connection. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. - :type properties: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection @@ -393,19 +390,15 @@ def create_or_update( error_map.update(kwargs.pop('error_map', {})) api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(properties, 'PrivateEndpointConnection') - request = build_create_or_update_request( + + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.create_or_update.metadata['url'], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -429,48 +422,58 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def create_or_update( self, resource_group_name, # type: str workspace_name, # type: str private_endpoint_connection_name, # type: str + body, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> None - """Deletes the specified private endpoint connection associated with the workspace. + # type: (...) -> "_models.PrivateEndpointConnection" + """Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. + + Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. :type private_endpoint_connection_name: str + :param body: PrivateEndpointConnection object. + :type body: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - request = build_delete_request( + _json = self._serialize.body(body, 'PrivateEndpointConnection') + + request = build_create_or_update_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - template_url=self.delete.metadata['url'], + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -482,13 +485,17 @@ def delete( # pylint: disable=inconsistent-return-statements ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_private_link_resources_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_private_link_resources_operations.py index cafb01f0fe8b2..a4081b088e558 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_private_link_resources_operations.py @@ -11,6 +11,7 @@ from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -22,7 +23,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,55 +97,94 @@ def list( workspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.PrivateLinkResourceListResult" - """Gets the private link resources that need to be created for a workspace. + # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + """Called by Client (Portal, CLI, etc) to get available "private link resources" for the + workspace. + Each "private link resource" is a connection endpoint (IP address) to the resource. + Pre single connection endpoint per workspace: the Data Plane IP address, returned by DNS + resolution. + Other RPs, such as Azure Storage, have multiple - one for Blobs, other for Queues, etc. + Defined in the "[NRP] Private Endpoint Design" doc, topic "GET API for GroupIds". + + Called by Client (Portal, CLI, etc) to get available "private link resources" for the + workspace. + Each "private link resource" is a connection endpoint (IP address) to the resource. + Pre single connection endpoint per workspace: the Data Plane IP address, returned by DNS + resolution. + Other RPs, such as Azure Storage, have multiple - one for Blobs, other for Queues, etc. + Defined in the "[NRP] Private Endpoint Design" doc, topic "GET API for GroupIds". :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourceListResult, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.PrivateLinkResourceListResult + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateLinkResources"} # type: ignore - diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_rai_policies_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_rai_policies_operations.py new file mode 100644 index 0000000000000..8f0205490c872 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_rai_policies_operations.py @@ -0,0 +1,185 @@ +# pylint: disable=too-many-lines +# 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 typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class RaiPoliciesOperations(object): + """RaiPoliciesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RaiPolicyPropertiesBasicResourceArmPaginatedResult"] + """List the specified Content Filters associated with the Azure OpenAI account. + + List the specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RaiPolicyPropertiesBasicResourceArmPaginatedResult + or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RaiPolicyPropertiesBasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_rai_policy_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_rai_policy_operations.py new file mode 100644 index 0000000000000..52d42b073e7e1 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_rai_policy_operations.py @@ -0,0 +1,521 @@ +# pylint: disable=too-many-lines +# 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 typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + rai_policy_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + "raiPolicyName": _SERIALIZER.url("rai_policy_name", rai_policy_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + rai_policy_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + "raiPolicyName": _SERIALIZER.url("rai_policy_name", rai_policy_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + rai_policy_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$'), + "raiPolicyName": _SERIALIZER.url("rai_policy_name", rai_policy_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class RaiPolicyOperations(object): + """RaiPolicyOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + rai_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + rai_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified Content Filters associated with the Azure OpenAI account. + + Deletes the specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. + :type rai_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + rai_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RaiPolicyPropertiesBasicResource" + """Gets the specified Content Filters associated with the Azure OpenAI account. + + Gets the specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. + :type rai_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RaiPolicyPropertiesBasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}"} # type: ignore + + + def _create_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + rai_policy_name, # type: str + body, # type: "_models.RaiPolicyPropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.RaiPolicyPropertiesBasicResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'RaiPolicyPropertiesBasicResource') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}"} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name, # type: str + workspace_name, # type: str + endpoint_name, # type: str + rai_policy_name, # type: str + body, # type: "_models.RaiPolicyPropertiesBasicResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RaiPolicyPropertiesBasicResource"] + """Update the state of specified Content Filters associated with the Azure OpenAI account. + + Update the state of specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. + :type rai_policy_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RaiPolicyPropertiesBasicResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RaiPolicyPropertiesBasicResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('RaiPolicyPropertiesBasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_workspace_connections_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_workspace_connections_operations.py index 768a0e18bc384..74bd83fac7843 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_workspace_connections_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_workspace_connections_operations.py @@ -14,16 +14,18 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -31,7 +33,53 @@ _SERIALIZER.client_side_validation = False # fmt: off -def build_create_request( +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + target = kwargs.pop('target', None) # type: Optional[str] + category = kwargs.pop('category', None) # type: Optional[str] + include_all = kwargs.pop('include_all', False) # type: Optional[bool] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if target is not None: + _query_parameters['target'] = _SERIALIZER.query("target", target, 'str') + if category is not None: + _query_parameters['category'] = _SERIALIZER.query("category", category, 'str') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if include_all is not None: + _query_parameters['includeAll'] = _SERIALIZER.query("include_all", include_all, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -40,7 +88,6 @@ def build_create_request( ): # type: (...) -> HttpRequest api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL @@ -60,12 +107,10 @@ def build_create_request( # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PUT", + method="DELETE", url=_url, params=_query_parameters, headers=_header_parameters, @@ -112,7 +157,7 @@ def build_get_request( ) -def build_delete_request( +def build_update_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -121,6 +166,7 @@ def build_delete_request( ): # type: (...) -> HttpRequest api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL @@ -140,10 +186,12 @@ def build_delete_request( # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="DELETE", + method="PATCH", url=_url, params=_query_parameters, headers=_header_parameters, @@ -151,42 +199,41 @@ def build_delete_request( ) -def build_list_request( +def build_create_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str + connection_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - target = kwargs.pop('target', None) # type: Optional[str] - category = kwargs.pop('category', None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - if target is not None: - _query_parameters['target'] = _SERIALIZER.query("target", target, 'str') - if category is not None: - _query_parameters['category'] = _SERIALIZER.query("category", category, 'str') _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="GET", + method="PUT", url=_url, params=_query_parameters, headers=_header_parameters, @@ -232,6 +279,48 @@ def build_list_secrets_request( **kwargs ) + +def build_test_connection_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/testconnection") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + # fmt: on class WorkspaceConnectionsOperations(object): """WorkspaceConnectionsOperations operations. @@ -256,51 +345,148 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def create( + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + target=None, # type: Optional[str] + category=None, # type: Optional[str] + include_all=False, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult"] + """Lists all the available machine learning workspaces connections under the specified workspace. + + Lists all the available machine learning workspaces connections under the specified workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param target: Target of the workspace connection. + :type target: str + :param category: Category of the workspace connection. + :type category: str + :param include_all: query parameter that indicates if get connection call should return both + connections and datastores. + :type include_all: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either + WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + target=target, + category=category, + include_all=include_all, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + target=target, + category=category, + include_all=include_all, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections"} # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name, # type: str workspace_name, # type: str connection_name, # type: str - parameters, # type: "_models.WorkspaceConnectionPropertiesV2BasicResource" **kwargs # type: Any ): - # type: (...) -> "_models.WorkspaceConnectionPropertiesV2BasicResource" - """create. + # type: (...) -> None + """Delete machine learning workspaces connections by name. + + Delete machine learning workspaces connections by name. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. :type connection_name: str - :param parameters: The object for creating or updating a new workspace connection. - :type parameters: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :keyword callable cls: A custom type or function that will be passed the direct response - :return: WorkspaceConnectionPropertiesV2BasicResource, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :return: None, or the result of cls(response) + :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceConnectionPropertiesV2BasicResource"] + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(parameters, 'WorkspaceConnectionPropertiesV2BasicResource') - - request = build_create_request( + + request = build_delete_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, connection_name=connection_name, api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.create.metadata['url'], + template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -312,19 +498,15 @@ def create( ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('WorkspaceConnectionPropertiesV2BasicResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, None, {}) - create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}"} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}"} # type: ignore @distributed_trace @@ -336,11 +518,13 @@ def get( **kwargs # type: Any ): # type: (...) -> "_models.WorkspaceConnectionPropertiesV2BasicResource" - """get. + """Lists machine learning workspaces connections by name. + + Lists machine learning workspaces connections by name. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. :type connection_name: str @@ -392,43 +576,55 @@ def get( @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def update( self, resource_group_name, # type: str workspace_name, # type: str connection_name, # type: str + body=None, # type: Optional["_models.WorkspaceConnectionUpdateParameter"] **kwargs # type: Any ): - # type: (...) -> None - """delete. + # type: (...) -> "_models.WorkspaceConnectionPropertiesV2BasicResource" + """Update machine learning workspaces connections under the specified workspace. + + Update machine learning workspaces connections under the specified workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. :type connection_name: str + :param body: Parameters for workspace connection update. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUpdateParameter :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None + :return: WorkspaceConnectionPropertiesV2BasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceConnectionPropertiesV2BasicResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - request = build_delete_request( + if body is not None: + _json = self._serialize.body(body, 'WorkspaceConnectionUpdateParameter') + else: + _json = None + + request = build_update_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, connection_name=connection_name, api_version=api_version, - template_url=self.delete.metadata['url'], + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -440,111 +636,97 @@ def delete( # pylint: disable=inconsistent-return-statements ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize('WorkspaceConnectionPropertiesV2BasicResource', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}"} # type: ignore + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}"} # type: ignore @distributed_trace - def list( + def create( self, resource_group_name, # type: str workspace_name, # type: str - target=None, # type: Optional[str] - category=None, # type: Optional[str] + connection_name, # type: str + body=None, # type: Optional["_models.WorkspaceConnectionPropertiesV2BasicResource"] **kwargs # type: Any ): - # type: (...) -> Iterable["_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult"] - """list. + # type: (...) -> "_models.WorkspaceConnectionPropertiesV2BasicResource" + """Create or update machine learning workspaces connections under the specified workspace. + + Create or update machine learning workspaces connections under the specified workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param target: Target of the workspace connection. - :type target: str - :param category: Category of the workspace connection. - :type category: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param body: The object for creating or updating a new workspace connection. + :type body: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either - WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult] + :return: WorkspaceConnectionPropertiesV2BasicResource, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceConnectionPropertiesV2BasicResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - target=target, - category=category, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - target=target, - category=category, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) + if body is not None: + _json = self._serialize.body(body, 'WorkspaceConnectionPropertiesV2BasicResource') + else: + _json = None - def get_next(next_link=None): - request = prepare_request(next_link) + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return pipeline_response + deserialized = self._deserialize('WorkspaceConnectionPropertiesV2BasicResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}"} # type: ignore - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections"} # type: ignore @distributed_trace def list_secrets( @@ -561,7 +743,7 @@ def list_secrets( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. :type connection_name: str @@ -611,3 +793,137 @@ def list_secrets( list_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/listsecrets"} # type: ignore + + def _test_connection_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + body=None, # type: Optional["_models.WorkspaceConnectionPropertiesV2BasicResource"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'WorkspaceConnectionPropertiesV2BasicResource') + else: + _json = None + + request = build_test_connection_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._test_connection_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _test_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/testconnection"} # type: ignore + + + @distributed_trace + def begin_test_connection( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + connection_name, # type: str + body=None, # type: Optional["_models.WorkspaceConnectionPropertiesV2BasicResource"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Test machine learning workspaces connections under the specified workspace. + + Test machine learning workspaces connections under the specified workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. + :type connection_name: str + :param body: Workspace Connection object. + :type body: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._test_connection_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_test_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/testconnection"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_workspaces_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_workspaces_operations.py index 92aa6652ec927..e97e921285dbf 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_workspaces_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_workspaces_operations.py @@ -33,22 +33,21 @@ _SERIALIZER.client_side_validation = False # fmt: off -def build_get_request( +def build_list_by_subscription_request( subscription_id, # type: str - resource_group_name, # type: str - workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + kind = kwargs.pop('kind', None) # type: Optional[str] + skip = kwargs.pop('skip', None) # type: Optional[str] + ai_capabilities = kwargs.pop('ai_capabilities', None) # type: Optional[str] accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -56,6 +55,12 @@ def build_get_request( # Construct parameters _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if kind is not None: + _query_parameters['kind'] = _SERIALIZER.query("kind", kind, 'str') + if skip is not None: + _query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'str') + if ai_capabilities is not None: + _query_parameters['aiCapabilities'] = _SERIALIZER.query("ai_capabilities", ai_capabilities, 'str') # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] @@ -70,23 +75,23 @@ def build_get_request( ) -def build_create_or_update_request_initial( +def build_list_by_resource_group_request( subscription_id, # type: str resource_group_name, # type: str - workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + kind = kwargs.pop('kind', None) # type: Optional[str] + skip = kwargs.pop('skip', None) # type: Optional[str] + ai_capabilities = kwargs.pop('ai_capabilities', None) # type: Optional[str] accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -94,15 +99,19 @@ def build_create_or_update_request_initial( # Construct parameters _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if kind is not None: + _query_parameters['kind'] = _SERIALIZER.query("kind", kind, 'str') + if skip is not None: + _query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'str') + if ai_capabilities is not None: + _query_parameters['aiCapabilities'] = _SERIALIZER.query("ai_capabilities", ai_capabilities, 'str') # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PUT", + method="GET", url=_url, params=_query_parameters, headers=_header_parameters, @@ -150,7 +159,7 @@ def build_delete_request_initial( ) -def build_update_request_initial( +def build_get_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -158,7 +167,6 @@ def build_update_request_initial( ): # type: (...) -> HttpRequest api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL @@ -177,12 +185,10 @@ def build_update_request_initial( # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PATCH", + method="GET", url=_url, params=_query_parameters, headers=_header_parameters, @@ -190,21 +196,23 @@ def build_update_request_initial( ) -def build_list_by_resource_group_request( +def build_update_request_initial( subscription_id, # type: str resource_group_name, # type: str + workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - skip = kwargs.pop('skip', None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -212,15 +220,15 @@ def build_list_by_resource_group_request( # Construct parameters _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if skip is not None: - _query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'str') # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="GET", + method="PATCH", url=_url, params=_query_parameters, headers=_header_parameters, @@ -228,7 +236,7 @@ def build_list_by_resource_group_request( ) -def build_diagnose_request_initial( +def build_create_or_update_request_initial( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -240,7 +248,7 @@ def build_diagnose_request_initial( accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/diagnose") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -260,7 +268,7 @@ def build_diagnose_request_initial( _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="POST", + method="PUT", url=_url, params=_query_parameters, headers=_header_parameters, @@ -268,7 +276,7 @@ def build_diagnose_request_initial( ) -def build_list_keys_request( +def build_diagnose_request_initial( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -276,10 +284,11 @@ def build_list_keys_request( ): # type: (...) -> HttpRequest api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listKeys") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/diagnose") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -294,6 +303,8 @@ def build_list_keys_request( # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( @@ -305,7 +316,7 @@ def build_list_keys_request( ) -def build_resync_keys_request_initial( +def build_list_keys_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -316,7 +327,7 @@ def build_resync_keys_request_initial( accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listKeys") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -342,19 +353,22 @@ def build_resync_keys_request_initial( ) -def build_list_by_subscription_request( +def build_list_notebook_access_token_request( subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str **kwargs # type: Any ): # type: (...) -> HttpRequest api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - skip = kwargs.pop('skip', None) # type: Optional[str] accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'), } _url = _format_url_section(_url, **path_format_arguments) @@ -362,15 +376,13 @@ def build_list_by_subscription_request( # Construct parameters _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if skip is not None: - _query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'str') # Construct headers _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="GET", + method="POST", url=_url, params=_query_parameters, headers=_header_parameters, @@ -378,7 +390,7 @@ def build_list_by_subscription_request( ) -def build_list_notebook_access_token_request( +def build_list_notebook_keys_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -389,7 +401,7 @@ def build_list_notebook_access_token_request( accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -415,7 +427,7 @@ def build_list_notebook_access_token_request( ) -def build_prepare_notebook_request_initial( +def build_list_storage_account_keys_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -426,7 +438,7 @@ def build_prepare_notebook_request_initial( accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -452,7 +464,7 @@ def build_prepare_notebook_request_initial( ) -def build_list_storage_account_keys_request( +def build_list_outbound_network_dependencies_endpoints_request( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -463,7 +475,7 @@ def build_list_storage_account_keys_request( accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -481,7 +493,7 @@ def build_list_storage_account_keys_request( _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="POST", + method="GET", url=_url, params=_query_parameters, headers=_header_parameters, @@ -489,7 +501,7 @@ def build_list_storage_account_keys_request( ) -def build_list_notebook_keys_request( +def build_prepare_notebook_request_initial( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -500,7 +512,7 @@ def build_list_notebook_keys_request( accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -526,7 +538,7 @@ def build_list_notebook_keys_request( ) -def build_list_outbound_network_dependencies_endpoints_request( +def build_resync_keys_request_initial( subscription_id, # type: str resource_group_name, # type: str workspace_name, # type: str @@ -537,7 +549,7 @@ def build_list_outbound_network_dependencies_endpoints_request( accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -555,7 +567,7 @@ def build_list_outbound_network_dependencies_endpoints_request( _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="GET", + method="POST", url=_url, params=_query_parameters, headers=_header_parameters, @@ -586,92 +598,216 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get( + def list_by_subscription( self, - resource_group_name, # type: str - workspace_name, # type: str + kind=None, # type: Optional[str] + skip=None, # type: Optional[str] + ai_capabilities=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "_models.Workspace" - """Gets the properties of the specified machine learning workspace. + # type: (...) -> Iterable["_models.WorkspaceListResult"] + """Lists all the available machine learning workspaces under the specified subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. - :type workspace_name: str + Lists all the available machine learning workspaces under the specified subscription. + + :param kind: Kind of workspace. + :type kind: str + :param skip: Continuation token for pagination. + :type skip: str + :param ai_capabilities: + :type ai_capabilities: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Workspace, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.Workspace + :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_next(next_link=None): + request = prepare_request(next_link) - deserialized = self._deserialize('Workspace', pipeline_response) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, {}) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized + return pipeline_response - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces"} # type: ignore - def _create_or_update_initial( + @distributed_trace + def list_by_resource_group( self, resource_group_name, # type: str - workspace_name, # type: str - parameters, # type: "_models.Workspace" + kind=None, # type: Optional[str] + skip=None, # type: Optional[str] + ai_capabilities=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Optional["_models.Workspace"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Workspace"]] + # type: (...) -> Iterable["_models.WorkspaceListResult"] + """Lists all the available machine learning workspaces under the specified resource group. + + Lists all the available machine learning workspaces under the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param kind: Kind of workspace. + :type kind: str + :param skip: Continuation token for pagination. + :type skip: str + :param ai_capabilities: + :type ai_capabilities: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request - _json = self._serialize.body(parameters, 'Workspace') + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + workspace_name, # type: str + force_to_purge=False, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], + force_to_purge=force_to_purge, + template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -683,45 +819,41 @@ def _create_or_update_initial( ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize('Workspace', pipeline_response) - if response.status_code == 202: response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, None, response_headers) - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore @distributed_trace - def begin_create_or_update( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name, # type: str workspace_name, # type: str - parameters, # type: "_models.Workspace" + force_to_purge=False, # type: Optional[bool] **kwargs # type: Any ): - # type: (...) -> LROPoller["_models.Workspace"] - """Creates or updates a workspace with the specified parameters. + # type: (...) -> LROPoller[None] + """Deletes a machine learning workspace. + + Deletes a machine learning workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param parameters: The parameters for creating or updating a machine learning workspace. - :type parameters: ~azure.mgmt.machinelearningservices.models.Workspace + :param force_to_purge: Flag to indicate delete is a purge request. + :type force_to_purge: bool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -730,40 +862,35 @@ def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Workspace or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Workspace] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, - parameters=parameters, + force_to_purge=force_to_purge, api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('Workspace', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -775,17 +902,30 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + @distributed_trace + def get( self, resource_group_name, # type: str workspace_name, # type: str - force_to_purge=False, # type: Optional[bool] **kwargs # type: Any ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + # type: (...) -> "_models.Workspace" + """Gets the properties of the specified machine learning workspace. + + Gets the properties of the specified machine learning workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -794,13 +934,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - request = build_delete_request_initial( + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, api_version=api_version, - force_to_purge=force_to_purge, - template_url=self._delete_initial.metadata['url'], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -812,33 +951,94 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore + + + def _update_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + body, # type: "_models.WorkspaceUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.Workspace"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Workspace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'WorkspaceUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Workspace', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_update( self, resource_group_name, # type: str workspace_name, # type: str - force_to_purge=False, # type: Optional[bool] + body, # type: "_models.WorkspaceUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller[None] - """Deletes a machine learning workspace. + # type: (...) -> LROPoller["_models.Workspace"] + """Updates a machine learning workspace with the specified parameters. + + Updates a machine learning workspace with the specified parameters. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param force_to_purge: Flag to indicate delete is a purge request. - :type force_to_purge: bool + :param body: The parameters for updating a machine learning workspace. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -847,32 +1047,37 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns either Workspace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Workspace] :raises: ~azure.core.exceptions.HttpResponseError """ api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, - force_to_purge=force_to_purge, + body=body, api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Workspace', pipeline_response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) @@ -887,13 +1092,13 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore - def _update_initial( + def _create_or_update_initial( self, resource_group_name, # type: str workspace_name, # type: str - parameters, # type: "_models.WorkspaceUpdateParameters" + body, # type: "_models.Workspace" **kwargs # type: Any ): # type: (...) -> Optional["_models.Workspace"] @@ -906,16 +1111,16 @@ def _update_initial( api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(parameters, 'WorkspaceUpdateParameters') + _json = self._serialize.body(body, 'Workspace') - request = build_update_request_initial( + request = build_create_or_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, api_version=api_version, content_type=content_type, json=_json, - template_url=self._update_initial.metadata['url'], + template_url=self._create_or_update_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -946,26 +1151,28 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore @distributed_trace - def begin_update( + def begin_create_or_update( self, resource_group_name, # type: str workspace_name, # type: str - parameters, # type: "_models.WorkspaceUpdateParameters" + body, # type: "_models.Workspace" **kwargs # type: Any ): # type: (...) -> LROPoller["_models.Workspace"] - """Updates a machine learning workspace with the specified parameters. + """Creates or updates a workspace with the specified parameters. + + Creates or updates a workspace with the specified parameters. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param parameters: The parameters for updating a machine learning workspace. - :type parameters: ~azure.mgmt.machinelearningservices.models.WorkspaceUpdateParameters + :param body: The parameters for creating or updating a machine learning workspace. + :type body: ~azure.mgmt.machinelearningservices.models.Workspace :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -988,10 +1195,10 @@ def begin_update( ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, - parameters=parameters, + body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, @@ -1007,7 +1214,7 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1019,101 +1226,17 @@ def get_long_running_output(pipeline_response): ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"} # type: ignore - @distributed_trace - def list_by_resource_group( + def _diagnose_initial( self, resource_group_name, # type: str - skip=None, # type: Optional[str] + workspace_name, # type: str + body=None, # type: Optional["_models.DiagnoseWorkspaceParameters"] **kwargs # type: Any ): - # type: (...) -> Iterable["_models.WorkspaceListResult"] - """Lists all the available machine learning workspaces under the specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param skip: Continuation token for pagination. - :type skip: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - skip=skip, - template_url=self.list_by_resource_group.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_resource_group_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - skip=skip, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkspaceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces"} # type: ignore - - def _diagnose_initial( - self, - resource_group_name, # type: str - workspace_name, # type: str - parameters=None, # type: Optional["_models.DiagnoseWorkspaceParameters"] - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.DiagnoseResponseResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DiagnoseResponseResult"]] + # type: (...) -> Optional["_models.DiagnoseResponseResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DiagnoseResponseResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1122,8 +1245,8 @@ def _diagnose_initial( api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - if parameters is not None: - _json = self._serialize.body(parameters, 'DiagnoseWorkspaceParameters') + if body is not None: + _json = self._serialize.body(body, 'DiagnoseWorkspaceParameters') else: _json = None @@ -1173,7 +1296,7 @@ def begin_diagnose( self, resource_group_name, # type: str workspace_name, # type: str - parameters=None, # type: Optional["_models.DiagnoseWorkspaceParameters"] + body=None, # type: Optional["_models.DiagnoseWorkspaceParameters"] **kwargs # type: Any ): # type: (...) -> LROPoller["_models.DiagnoseResponseResult"] @@ -1183,10 +1306,10 @@ def begin_diagnose( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str - :param parameters: The parameter of diagnosing workspace health. - :type parameters: ~azure.mgmt.machinelearningservices.models.DiagnoseWorkspaceParameters + :param body: The parameter of diagnosing workspace health. + :type body: ~azure.mgmt.machinelearningservices.models.DiagnoseWorkspaceParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1214,7 +1337,7 @@ def begin_diagnose( raw_result = self._diagnose_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, - parameters=parameters, + body=body, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, @@ -1255,9 +1378,12 @@ def list_keys( """Lists all the keys associated with this workspace. This includes keys for the storage account, app insights and password for container registry. + Lists all the keys associated with this workspace. This includes keys for the storage account, + app insights and password for container registry. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListWorkspaceKeysResult, or the result of cls(response) @@ -1305,14 +1431,28 @@ def list_keys( list_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listKeys"} # type: ignore - def _resync_keys_initial( # pylint: disable=inconsistent-return-statements + @distributed_trace + def list_notebook_access_token( self, resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + # type: (...) -> "_models.NotebookAccessTokenResult" + """Get Azure Machine Learning Workspace notebook access token. + + Get Azure Machine Learning Workspace notebook access token. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NotebookAccessTokenResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.NotebookAccessTokenResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookAccessTokenResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1321,12 +1461,12 @@ def _resync_keys_initial( # pylint: disable=inconsistent-return-statements api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - request = build_resync_keys_request_initial( + request = build_list_notebook_access_token_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, api_version=api_version, - template_url=self._resync_keys_initial.metadata['url'], + template_url=self.list_notebook_access_token.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -1338,185 +1478,169 @@ def _resync_keys_initial( # pylint: disable=inconsistent-return-statements ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - + deserialized = self._deserialize('NotebookAccessTokenResult', pipeline_response) if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, {}) - _resync_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys"} # type: ignore + return deserialized + + list_notebook_access_token.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken"} # type: ignore @distributed_trace - def begin_resync_keys( # pylint: disable=inconsistent-return-statements + def list_notebook_keys( self, resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller[None] - """Resync all the keys associated with this workspace. This includes keys for the storage account, - app insights and password for container registry. + # type: (...) -> "_models.ListNotebookKeysResult" + """Lists keys of Azure Machine Learning Workspaces notebook. + + Lists keys of Azure Machine Learning Workspaces notebook. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: ListNotebookKeysResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListNotebookKeysResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval + + + request = build_list_notebook_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list_notebook_keys.metadata['url'], ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._resync_keys_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + deserialized = self._deserialize('ListNotebookKeysResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_notebook_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys"} # type: ignore - begin_resync_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys"} # type: ignore @distributed_trace - def list_by_subscription( + def list_storage_account_keys( self, - skip=None, # type: Optional[str] + resource_group_name, # type: str + workspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["_models.WorkspaceListResult"] - """Lists all the available machine learning workspaces under the specified subscription. + # type: (...) -> "_models.ListStorageAccountKeysResult" + """Lists keys of Azure Machine Learning Workspace's storage account. - :param skip: Continuation token for pagination. - :type skip: str + Lists keys of Azure Machine Learning Workspace's storage account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. + :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceListResult] + :return: ListStorageAccountKeysResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ListStorageAccountKeysResult :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListStorageAccountKeysResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - skip=skip, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkspaceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) + + request = build_list_storage_account_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list_storage_account_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - def get_next(next_link=None): - request = prepare_request(next_link) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize('ListStorageAccountKeysResult', pipeline_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + list_storage_account_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys"} # type: ignore - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces"} # type: ignore @distributed_trace - def list_notebook_access_token( + def list_outbound_network_dependencies_endpoints( self, resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.NotebookAccessTokenResult" - """return notebook access token and refresh token. + # type: (...) -> "_models.ExternalFQDNResponse" + """Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) + programmatically. + + Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) + programmatically. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: NotebookAccessTokenResult, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.NotebookAccessTokenResult + :return: ExternalFQDNResponse, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ExternalFQDNResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NotebookAccessTokenResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExternalFQDNResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1525,12 +1649,12 @@ def list_notebook_access_token( api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - request = build_list_notebook_access_token_request( + request = build_list_outbound_network_dependencies_endpoints_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, api_version=api_version, - template_url=self.list_notebook_access_token.metadata['url'], + template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -1547,14 +1671,14 @@ def list_notebook_access_token( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('NotebookAccessTokenResult', pipeline_response) + deserialized = self._deserialize('ExternalFQDNResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_notebook_access_token.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken"} # type: ignore + list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints"} # type: ignore def _prepare_notebook_initial( @@ -1620,11 +1744,13 @@ def begin_prepare_notebook( **kwargs # type: Any ): # type: (...) -> LROPoller["_models.NotebookResourceInfo"] - """Prepare a notebook. + """Prepare Azure Machine Learning Workspace's notebook resource. + + Prepare Azure Machine Learning Workspace's notebook resource. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1680,86 +1806,14 @@ def get_long_running_output(pipeline_response): begin_prepare_notebook.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook"} # type: ignore - @distributed_trace - def list_storage_account_keys( - self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListStorageAccountKeysResult" - """List storage account keys of a workspace. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. - :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListStorageAccountKeysResult, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.ListStorageAccountKeysResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListStorageAccountKeysResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - - request = build_list_storage_account_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - template_url=self.list_storage_account_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ListStorageAccountKeysResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_storage_account_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys"} # type: ignore - - - @distributed_trace - def list_notebook_keys( + def _resync_keys_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.ListNotebookKeysResult" - """List keys of a notebook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. - :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListNotebookKeysResult, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListNotebookKeysResult"] + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1768,12 +1822,12 @@ def list_notebook_keys( api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - request = build_list_notebook_keys_request( + request = build_resync_keys_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, api_version=api_version, - template_url=self.list_notebook_keys.metadata['url'], + template_url=self._resync_keys_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -1785,81 +1839,85 @@ def list_notebook_keys( ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ListNotebookKeysResult', pipeline_response) + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, None, response_headers) - list_notebook_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys"} # type: ignore + _resync_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys"} # type: ignore @distributed_trace - def list_outbound_network_dependencies_endpoints( + def begin_resync_keys( # pylint: disable=inconsistent-return-statements self, resource_group_name, # type: str workspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.ExternalFQDNResponse" - """Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) - programmatically. + # type: (...) -> LROPoller[None] + """Resync all the keys associated with this workspace.This includes keys for the storage account, + app insights and password for container registry. - Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) - programmatically. + Resync all the keys associated with this workspace.This includes keys for the storage account, + app insights and password for container registry. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: Name of Azure Machine Learning workspace. + :param workspace_name: Azure Machine Learning Workspace Name. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ExternalFQDNResponse, or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.ExternalFQDNResponse + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ExternalFQDNResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2024-07-01-preview") # type: str - - - request = build_list_outbound_network_dependencies_endpoints_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ExternalFQDNResponse', pipeline_response) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._resync_keys_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) - if cls: - return cls(pipeline_response, deserialized, {}) + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - return deserialized - list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints"} # type: ignore + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resync_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys"} # type: ignore diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_telemetry/guide_to_logging.md b/sdk/ml/azure-ai-ml/azure/ai/ml/_telemetry/guide_to_logging.md new file mode 100644 index 0000000000000..05388c6cf2a82 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_telemetry/guide_to_logging.md @@ -0,0 +1,105 @@ +## Configuring Client-side Logging for Azure Machine Learning SDK v2 + + +This document explains the logging system for the Azure ML SDK for developers in this repository who want to understand how the logging system works and how to configure it for their own methods and modules. + +### When do we log? + +Logging will be disabled if + - Calls are not being made from a Jupyter notebook. As an Azure SDK, azure-ai-ml must comply with the Azure SDK for Python's guidelines around logging. The guidelines limit logging to interactive scenarios only, meaning that client-side logging can only be enabled when a user is running SDK code from a Jupyter notebook. + - An incorrect user agent is passed. This prevents calls from other Azure SDKs being inadvertently logged under the azure-ai-ml namespace. Valid user agents for azure-ai-ml following this pattern: "azure-ai-ml/< version >" + - The subscription ID is in the `test_subscriptions` list of internal developer subscription IDs declared in [`logging_handler.py`](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ml/azure-ai-ml/azure/ai/ml/_telemetry/logging_handler.py). Those subscriptions can be used to prevent logging of test commands. + - An exception is triggered while trying to set up and return the logging handler. Logging should never interfere with the execution of the code, so if an exception is triggered, we simply move on. + +Logging can also be explicitly disabled in any scenario by setting `MLClient`'s `enable_telemetry` parameter equal to `False`. + +In all of these cases, a `logging.NullHandler` is returned from `get_appinsights_log_handler`. + +### What do we log? + +The logging structure depends on access to the MLClient, which is passed to the operations class in the constructor. Methods not connected to the MLClient will not have access to that information and thus, cannot be tracked via appinsights logging. + +If logging has been configured for a method, the following information will be logged: + - The method name + - The operation ID + - The parent operation ID, if exists + - The subscription ID, if available + - The resource group name, if available + - The activity name + - The activity status (i.e. "Success" or "Failure") + - The log level + - The log message + - The log timestamp + - The location + - The Python version + +Note that this list isn't exhaustive, but it represents the most important information that is logged. + +### How do we log? + +1. Initialize the package logger with ActivityLogger + +`OpsLogger` is responsible for encapsulating the logging setup for the package. It contains two loggers - `package_logger` and `module_logger`. Custom dimensions can be updated to include additional information. + +To configure logging for a class, you'll need to instantiate an `OpsLogger` with the module name and then call `update_info()`. This will add the logging handler to the package logger. + + +```python +from azure.ai.ml._utils._logger_utils import OpsLogger + + +ops_logger = OpsLogger(__name__) +module_logger = ops_logger.module_logger + +class DataOperations(_ScopeDependentOperations): + def __init__( + self, + operation_scope: OperationScope, + operation_config: OperationConfig, + service_client: Union[ServiceClient042023_preview, ServiceClient102021Dataplane], + service_client_012024_preview: ServiceClient012024_preview, + datastore_operations: DatastoreOperations, + **kwargs: Any, + ): + super(DataOperations, self).__init__(operation_scope, operation_config) + ops_logger.update_info(kwargs) # <--- Need this line in constructor + ... +``` + +1. Configure logging for a method with the `distributed_trace` and `monitor_with_activity` decorators + +*Distributed Tracing* + - `@distributed_trace` is used to enable distributed tracing for a method. Its imported from azure.core.tracing.decorator and when applied to a method, it captures and propagates trace information, which is crucial for identifying performance bottlenecks and troubleshooting issues that span multiple services. + +*Activity Monitoring* + - `@monitor_with_activity` is used to track a method's activity with the provided logger and activity type. This records telemetry data specific to this method's execution including the duration and result status. It accepts parameters like a logger, an activity name, and an activity type (e.g., ActivityType.PUBLICAPI). + +Add these decorators to the method you want to log. + +```python + @monitor_with_activity(ops_logger, "Workspace.Get_Keys", ActivityType.PUBLICAPI) + @distributed_trace + def get_keys(self, name: Optional[str] = None) -> Optional[WorkspaceKeys]: + """Get WorkspaceKeys by workspace name. + + :param name: Name of the workspace. + :type name: str + :return: Keys of workspace dependent resources. + :rtype: ~azure.ai.ml.entities.WorkspaceKeys + + .. admonition:: Example: + + .. literalinclude:: ../samples/ml_samples_workspace.py + :start-after: [START workspace_get_keys] + :end-before: [END workspace_get_keys] + :language: python + :dedent: 8 + :caption: Get the workspace keys for the workspace with the given name. + """ + workspace_name = self._check_workspace_name(name) + obj = self._operation.list_keys(self._resource_group_name, workspace_name) + return WorkspaceKeys._from_rest_object(obj) +``` + +### Where do we log? +All logs are sent to Application Insights. [Here](https://ms.portal.azure.com#@72f988bf-86f1-41af-91ab-2d7cd011db47/blade/Microsoft_OperationsManagementSuite_Workspace/Logs.ReactView/resourceId/%2Fsubscriptions%2F589c7ae9-223e-45e3-a191-98433e0821a9%2FresourceGroups%2Fvienna-sdk%2Fproviders%2Fmicrosoft.insights%2Fcomponents%2Fvienna-sdk-unitedstates/source/LogsBlade.AnalyticsShareLinkToQuery/q/H4sIAAAAAAAAA42Rz0rEQAzG7z5F7KkFV%252FBuhUVBvPkGJU5DO7IzGZKMVfHhnarb1suy13zf98s%252FE3SkF18wjSQE5gOpYUhw1wIOXN%252BMDWDsN8ItRJ7qZomUuuJAUFQxnbyNUO2d%252BTdvH%252Fcc0oGM%252BmrtwGri41C7rMbhoXCjeo56nZWkK6RoDVy2UM0Zejcq3WdpPyvQngdYo5pf1IlPVixP%252Fcn81tr5fgMRUs7i6FE4p5OMo7MbZmsXMdCGw4kEz5hk8f0fYyk%252Fo5Qtz4akH%252Fsf6%252FcN60UdR0MfFSr8zEI79LtwmG%252BfhF%252FJ2fr6q%252BOvvwF2fSfoNQIAAA%253D%253D) is the query to see all azure-ai-ml logs. diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/compute_instance.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/compute_instance.py index 2fa8e06054a46..b47a41bdd6cb7 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/compute_instance.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_compute/compute_instance.py @@ -344,7 +344,7 @@ def _to_dict(self) -> Dict: return res def _set_full_subnet_name(self, subscription_id: str, rg: str) -> None: - if self.network_settings: + if self.network_settings and (self.network_settings.vnet_name or self.network_settings.subnet): self.subnet = get_subnet_str( self.network_settings.vnet_name, self.network_settings.subnet, diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/command_job.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/command_job.py index ffc2da96293a8..ff42db735fc4c 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/command_job.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/command_job.py @@ -61,6 +61,11 @@ class CommandJob(Job, ParameterizedCommand, JobIOMixin): """Command job. + .. note:: + For sweep jobs, inputs, outputs, and parameters are accessible as environment variables using the prefix + ``AZUREML_PARAMETER_``. For example, if you have a parameter named "input_data", you can access it as + ``AZUREML_PARAMETER_input_data``. + :keyword services: Read-only information on services associated with the job. :paramtype services: Optional[dict[str, ~azure.ai.ml.entities.JobService]] :keyword inputs: Mapping of output data bindings used in the command. @@ -75,6 +80,7 @@ class CommandJob(Job, ParameterizedCommand, JobIOMixin): :keyword kwargs: A dictionary of additional configuration parameters. :paramtype kwargs: dict + .. admonition:: Example: .. literalinclude:: ../samples/ml_samples_command_configurations.py diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/sweep_job.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/sweep_job.py index fea84e28cc1a3..49c2824b831d4 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/sweep_job.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/sweep_job.py @@ -71,6 +71,11 @@ class SweepJob(Job, ParameterizedSweep, JobIOMixin): """Sweep job for hyperparameter tuning. + .. note:: + For sweep jobs, inputs, outputs, and parameters are accessible as environment variables using the prefix + ``AZUREML_SWEEP_``. For example, if you have a parameter named "learning_rate", you can access it as + ``AZUREML_SWEEP_learning_rate``. + :keyword name: Name of the job. :paramtype name: str :keyword display_name: Display name of the job. diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/connections/workspace_connection.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/connections/workspace_connection.py index a70def0e414b5..79e25c3e5d8d2 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/connections/workspace_connection.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/connections/workspace_connection.py @@ -20,7 +20,6 @@ ) from azure.ai.ml._schema.workspace.connections.workspace_connection import WorkspaceConnectionSchema -from azure.ai.ml._utils._experimental import experimental from azure.ai.ml._utils.utils import _snake_to_camel, camel_to_snake, dump_yaml_to_file from azure.ai.ml.constants._common import ( BASE_PATH_CONTEXT_KEY, @@ -72,7 +71,6 @@ # Dev note: The acceptable strings for the type field are all snake_cased versions of the string constants defined # In the rest client enum defined at _azure_machine_learning_services_enums.ConnectionCategory. # We avoid directly referencing it in the docs to avoid restclient references. -@experimental class WorkspaceConnection(Resource): """Azure ML connection provides a secure way to store authentication and configuration information needed to connect and interact with the external resources. @@ -424,10 +422,7 @@ def _to_dict(self) -> Dict: return res @classmethod - def _from_rest_object(cls, rest_obj: RestWorkspaceConnection) -> Optional["WorkspaceConnection"]: - if not rest_obj: - return None - + def _from_rest_object(cls, rest_obj: RestWorkspaceConnection) -> "WorkspaceConnection": conn_class = cls._get_entity_class_from_rest_obj(rest_obj) popped_metadata = conn_class._get_required_metadata_fields() @@ -458,7 +453,7 @@ def _from_rest_object(cls, rest_obj: RestWorkspaceConnection) -> Optional["Works # No default in pop, this should fail if we somehow don't get a resource ID rest_kwargs["ai_services_resource_id"] = rest_kwargs.pop(camel_to_snake(CONNECTION_RESOURCE_ID_KEY)) connection = conn_class(**rest_kwargs) - return cast(Optional["WorkspaceConnection"], connection) + return cast(WorkspaceConnection, connection) def _validate(self) -> str: return str(self.name) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_compute_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_compute_operations.py index d7a7ddcf1e8bd..4ac8b55a93e25 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_compute_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_compute_operations.py @@ -424,7 +424,7 @@ def list_sizes(self, *, location: Optional[str] = None, compute_type: Optional[s @distributed_trace @monitor_with_activity(ops_logger, "Compute.enablesso", ActivityType.PUBLICAPI) @experimental - def enable_sso(self, *, name: str, enable_sso: bool = True): + def enable_sso(self, *, name: str, enable_sso: bool = True) -> None: """enable sso for a compute instance. :keyword name: Name of the compute instance. diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_connections_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_connections_operations.py index f5286a7374694..c8e0c3dccc1e7 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_connections_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_connections_operations.py @@ -18,6 +18,7 @@ from azure.ai.ml._utils.utils import _snake_to_camel from azure.ai.ml.entities._workspace.connections.workspace_connection import WorkspaceConnection from azure.core.credentials import TokenCredential +from azure.core.tracing.decorator import distributed_trace from azure.ai.ml.entities._credentials import ( ApiKeyConfiguration, ) @@ -70,6 +71,7 @@ def _try_fill_api_key(self, connection: WorkspaceConnection) -> None: if list_secrets_response.properties.credentials is not None: connection.credentials.key = list_secrets_response.properties.credentials.key + @distributed_trace @monitor_with_activity(ops_logger, "WorkspaceConnections.Get", ActivityType.PUBLICAPI) def get(self, name: str, *, populate_secrets: bool = False, **kwargs: Dict) -> WorkspaceConnection: """Get a connection by name. @@ -98,10 +100,11 @@ def get(self, name: str, *, populate_secrets: bool = False, **kwargs: Dict) -> W self._try_fill_api_key(connection) return connection # type: ignore[return-value] + @distributed_trace @monitor_with_activity(ops_logger, "WorkspaceConnections.CreateOrUpdate", ActivityType.PUBLICAPI) def create_or_update( self, workspace_connection: WorkspaceConnection, *, populate_secrets: bool = False, **kwargs: Any - ) -> Optional[WorkspaceConnection]: + ) -> WorkspaceConnection: """Create or update a connection. :param workspace_connection: Definition of a Workspace Connection or one of its subclasses @@ -126,8 +129,9 @@ def create_or_update( self._try_fill_api_key(conn) return conn + @distributed_trace @monitor_with_activity(ops_logger, "WorkspaceConnections.Delete", ActivityType.PUBLICAPI) - def delete(self, name: str) -> None: + def delete(self, name: str, **kwargs: Any) -> None: """Delete the connection. :param name: Name of the connection. @@ -138,8 +142,10 @@ def delete(self, name: str) -> None: connection_name=name, workspace_name=self._workspace_name, **self._scope_kwargs, + **kwargs, ) + @distributed_trace @monitor_with_activity(ops_logger, "WorkspaceConnections.List", ActivityType.PUBLICAPI) def list( self, diff --git a/sdk/ml/azure-ai-ml/pyproject.toml b/sdk/ml/azure-ai-ml/pyproject.toml index 5c9be4ca8aba0..ac1b99becca50 100644 --- a/sdk/ml/azure-ai-ml/pyproject.toml +++ b/sdk/ml/azure-ai-ml/pyproject.toml @@ -2,7 +2,6 @@ mypy = true pyright = false type_check_samples = false -verifytypes = false pylint = true diff --git a/sdk/ml/azure-ai-ml/samples/ml_samples_automl_image.py b/sdk/ml/azure-ai-ml/samples/ml_samples_automl_image.py index 3943e4ad6157a..2756eb5970281 100644 --- a/sdk/ml/azure-ai-ml/samples/ml_samples_automl_image.py +++ b/sdk/ml/azure-ai-ml/samples/ml_samples_automl_image.py @@ -196,8 +196,6 @@ def automl_image_jobs(self): max_trials=10, max_concurrent_trials=2, ) - # Submit the AutoML job. - image_job.submit() # [END automl.automl_image_job.image_limit_settings] # [START automl.automl_image_job.image_classification_model_settings] diff --git a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-04-01-preview/mfe.json b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-04-01-preview/mfe.json index a319a72a527dd..73584342ffb6f 100644 --- a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-04-01-preview/mfe.json +++ b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-04-01-preview/mfe.json @@ -30021,7 +30021,6 @@ "x-nullable": true, "x-ms-identifiers": [] }, -<<<<<<< HEAD "sweepSettings": { "description": "Settings for model sweeping and hyperparameter tuning.", "$ref": "#/definitions/TableSweepSettings", @@ -31067,968 +31066,3 @@ } } } -======= - "x-nullable": true - } - }, - "additionalProperties": false - }, - "TableVerticalLimitSettings": { - "description": "Job execution constraints.", - "type": "object", - "properties": { - "enableEarlyTermination": { - "description": "Enable early termination, determines whether or not if AutoMLJob will terminate early if there is no score improvement in last 20 iterations.", - "default": true, - "type": "boolean" - }, - "exitScore": { - "format": "double", - "description": "Exit score for the AutoML job.", - "type": "number", - "x-nullable": true - }, - "maxConcurrentTrials": { - "format": "int32", - "description": "Maximum Concurrent iterations.", - "default": 1, - "type": "integer" - }, - "maxCoresPerTrial": { - "format": "int32", - "description": "Max cores per iteration.", - "default": -1, - "type": "integer" - }, - "maxNodes": { - "format": "int32", - "description": "Maximum nodes to use for the experiment.", - "default": 1, - "type": "integer" - }, - "maxTrials": { - "format": "int32", - "description": "Number of iterations.", - "default": 1000, - "type": "integer" - }, - "sweepConcurrentTrials": { - "format": "int32", - "description": "Number of concurrent sweeping runs that user wants to trigger.", - "default": 0, - "type": "integer" - }, - "sweepTrials": { - "format": "int32", - "description": "Number of sweeping runs that user wants to trigger.", - "default": 0, - "type": "integer" - }, - "timeout": { - "format": "duration", - "description": "AutoML job timeout.", - "default": "PT6H", - "type": "string" - }, - "trialTimeout": { - "format": "duration", - "description": "Iteration timeout.", - "default": "PT30M", - "type": "string" - } - }, - "additionalProperties": false - }, - "TargetAggregationFunction": { - "description": "Target aggregate function.", - "enum": [ - "None", - "Sum", - "Max", - "Min", - "Mean" - ], - "type": "string", - "x-ms-enum": { - "name": "TargetAggregationFunction", - "modelAsString": true, - "values": [ - { - "value": "None", - "description": "Represent no value set." - }, - { - "value": "Sum" - }, - { - "value": "Max" - }, - { - "value": "Min" - }, - { - "value": "Mean" - } - ] - }, - "additionalProperties": false - }, - "TargetLags": { - "description": "The number of past periods to lag from the target column.", - "required": [ - "mode" - ], - "type": "object", - "properties": { - "mode": { - "description": "[Required] Set target lags mode - Auto/Custom", - "$ref": "#/definitions/TargetLagsMode", - "x-ms-mutability": [ - "create", - "read" - ] - } - }, - "discriminator": "mode" - }, - "TargetLagsMode": { - "description": "Target lags selection modes.", - "enum": [ - "Auto", - "Custom" - ], - "type": "string", - "x-ms-enum": { - "name": "TargetLagsMode", - "modelAsString": true, - "values": [ - { - "value": "Auto", - "description": "Target lags to be determined automatically." - }, - { - "value": "Custom", - "description": "Use the custom target lags." - } - ] - }, - "additionalProperties": false - }, - "TargetRollingWindowSize": { - "description": "Forecasting target rolling window size.", - "required": [ - "mode" - ], - "type": "object", - "properties": { - "mode": { - "description": "[Required] TargetRollingWindowSiz detection mode.", - "$ref": "#/definitions/TargetRollingWindowSizeMode", - "x-ms-mutability": [ - "create", - "read" - ] - } - }, - "discriminator": "mode" - }, - "TargetRollingWindowSizeMode": { - "description": "Target rolling windows size mode.", - "enum": [ - "Auto", - "Custom" - ], - "type": "string", - "x-ms-enum": { - "name": "TargetRollingWindowSizeMode", - "modelAsString": true, - "values": [ - { - "value": "Auto", - "description": "Determine rolling windows size automatically." - }, - { - "value": "Custom", - "description": "Use the specified rolling window size." - } - ] - }, - "additionalProperties": false - }, - "TargetUtilizationScaleSettings": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/OnlineScaleSettings" - } - ], - "properties": { - "maxInstances": { - "format": "int32", - "description": "The maximum number of instances that the deployment can scale to. The quota will be reserved for max_instances.", - "default": 1, - "type": "integer" - }, - "minInstances": { - "format": "int32", - "description": "The minimum number of instances to always be present.", - "default": 1, - "type": "integer" - }, - "pollingInterval": { - "format": "duration", - "description": "The polling interval in ISO 8691 format. Only supports duration with precision as low as Seconds.", - "default": "PT1S", - "type": "string" - }, - "targetUtilizationPercentage": { - "format": "int32", - "description": "Target CPU usage for the autoscaler.", - "default": 70, - "type": "integer" - } - }, - "x-ms-discriminator-value": "TargetUtilization", - "additionalProperties": false - }, - "TaskType": { - "description": "AutoMLJob Task type.", - "enum": [ - "Classification", - "Regression", - "Forecasting", - "ImageClassification", - "ImageClassificationMultilabel", - "ImageObjectDetection", - "ImageInstanceSegmentation", - "TextClassification", - "TextClassificationMultilabel", - "TextNER" - ], - "type": "string", - "x-ms-enum": { - "name": "TaskType", - "modelAsString": true, - "values": [ - { - "value": "Classification", - "description": "Classification in machine learning and statistics is a supervised learning approach in which\nthe computer program learns from the data given to it and make new observations or classifications." - }, - { - "value": "Regression", - "description": "Regression means to predict the value using the input data. Regression models are used to predict a continuous value." - }, - { - "value": "Forecasting", - "description": "Forecasting is a special kind of regression task that deals with time-series data and creates forecasting model\nthat can be used to predict the near future values based on the inputs." - }, - { - "value": "ImageClassification", - "description": "Image Classification. Multi-class image classification is used when an image is classified with only a single label\nfrom a set of classes - e.g. each image is classified as either an image of a 'cat' or a 'dog' or a 'duck'." - }, - { - "value": "ImageClassificationMultilabel", - "description": "Image Classification Multilabel. Multi-label image classification is used when an image could have one or more labels\nfrom a set of labels - e.g. an image could be labeled with both 'cat' and 'dog'." - }, - { - "value": "ImageObjectDetection", - "description": "Image Object Detection. Object detection is used to identify objects in an image and locate each object with a\nbounding box e.g. locate all dogs and cats in an image and draw a bounding box around each." - }, - { - "value": "ImageInstanceSegmentation", - "description": "Image Instance Segmentation. Instance segmentation is used to identify objects in an image at the pixel level,\ndrawing a polygon around each object in the image." - }, - { - "value": "TextClassification", - "description": "Text classification (also known as text tagging or text categorization) is the process of sorting texts into categories.\nCategories are mutually exclusive." - }, - { - "value": "TextClassificationMultilabel", - "description": "Multilabel classification task assigns each sample to a group (zero or more) of target labels." - }, - { - "value": "TextNER", - "description": "Text Named Entity Recognition a.k.a. TextNER.\nNamed Entity Recognition (NER) is the ability to take free-form text and identify the occurrences of entities such as people, locations, organizations, and more." - } - ] - }, - "additionalProperties": false - }, - "TensorFlow": { - "description": "TensorFlow distribution configuration.", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/DistributionConfiguration" - } - ], - "properties": { - "parameterServerCount": { - "format": "int32", - "description": "Number of parameter server tasks.", - "default": 0, - "type": "integer", - "x-ms-mutability": [ - "create", - "read" - ] - }, - "workerCount": { - "format": "int32", - "description": "Number of workers. If not specified, will default to the instance count.", - "type": "integer", - "x-ms-mutability": [ - "create", - "read" - ], - "x-nullable": true - } - }, - "x-ms-discriminator-value": "TensorFlow", - "additionalProperties": false - }, - "TextAnnotationType": { - "description": "Annotation type of text data.", - "enum": [ - "Classification", - "NamedEntityRecognition" - ], - "type": "string", - "x-ms-enum": { - "name": "TextAnnotationType", - "modelAsString": true, - "values": [ - { - "value": "Classification" - }, - { - "value": "NamedEntityRecognition" - } - ] - }, - "additionalProperties": false - }, - "TextClassification": { - "description": "Text Classification task in AutoML NLP vertical.\r\nNLP - Natural Language Processing.", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/NlpVertical" - }, - { - "$ref": "#/definitions/AutoMLVertical" - } - ], - "properties": { - "primaryMetric": { - "description": "Primary metric for Text-Classification task.", - "default": "Accuracy", - "$ref": "#/definitions/ClassificationPrimaryMetrics" - } - }, - "x-ms-discriminator-value": "TextClassification", - "additionalProperties": false - }, - "TextClassificationMultilabel": { - "description": "Text Classification Multilabel task in AutoML NLP vertical.\r\nNLP - Natural Language Processing.", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/NlpVertical" - }, - { - "$ref": "#/definitions/AutoMLVertical" - } - ], - "properties": { - "primaryMetric": { - "description": "Primary metric for Text-Classification-Multilabel task.\r\nCurrently only Accuracy is supported as primary metric, hence user need not set it explicitly.", - "$ref": "#/definitions/ClassificationMultilabelPrimaryMetrics", - "readOnly": true - } - }, - "x-ms-discriminator-value": "TextClassificationMultilabel", - "additionalProperties": false - }, - "TextNer": { - "description": "Text-NER task in AutoML NLP vertical.\r\nNER - Named Entity Recognition.\r\nNLP - Natural Language Processing.", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/NlpVertical" - }, - { - "$ref": "#/definitions/AutoMLVertical" - } - ], - "properties": { - "primaryMetric": { - "description": "Primary metric for Text-NER task.\r\nOnly 'Accuracy' is supported for Text-NER, so user need not set this explicitly.", - "$ref": "#/definitions/ClassificationPrimaryMetrics", - "readOnly": true - } - }, - "x-ms-discriminator-value": "TextNER", - "additionalProperties": false - }, - "TopNFeaturesByAttribution": { - "required": [ - "filterType" - ], - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/MonitoringFeatureFilterBase" - } - ], - "properties": { - "top": { - "format": "int32", - "description": "The number of top features to include.", - "default": 10, - "type": "integer", - "x-ms-mutability": [ - "create", - "read" - ] - } - }, - "x-ms-discriminator-value": "TopNByAttribution", - "additionalProperties": false - }, - "TrainingMode": { - "description": "Training mode dictates whether to use distributed training or not", - "enum": [ - "Auto", - "Distributed", - "NonDistributed" - ], - "type": "string", - "x-ms-enum": { - "name": "TrainingMode", - "modelAsString": true, - "values": [ - { - "value": "Auto", - "description": "Auto mode" - }, - { - "value": "Distributed", - "description": "Distributed training mode" - }, - { - "value": "NonDistributed", - "description": "Non distributed training mode" - } - ] - }, - "additionalProperties": false - }, - "TrainingSettings": { - "description": "Training related configuration.", - "type": "object", - "properties": { - "enableDnnTraining": { - "description": "Enable recommendation of DNN models.", - "default": false, - "type": "boolean" - }, - "enableModelExplainability": { - "description": "Flag to turn on explainability on best model.", - "default": true, - "type": "boolean" - }, - "enableOnnxCompatibleModels": { - "description": "Flag for enabling onnx compatible models.", - "default": false, - "type": "boolean" - }, - "enableStackEnsemble": { - "description": "Enable stack ensemble run.", - "default": true, - "type": "boolean" - }, - "enableVoteEnsemble": { - "description": "Enable voting ensemble run.", - "default": true, - "type": "boolean" - }, - "ensembleModelDownloadTimeout": { - "format": "duration", - "description": "During VotingEnsemble and StackEnsemble model generation, multiple fitted models from the previous child runs are downloaded.\r\nConfigure this parameter with a higher value than 300 secs, if more time is needed.", - "default": "PT5M", - "type": "string" - }, - "stackEnsembleSettings": { - "description": "Stack ensemble settings for stack ensemble run.", - "$ref": "#/definitions/StackEnsembleSettings", - "x-nullable": true - }, - "trainingMode": { - "description": "TrainingMode mode - Setting to 'auto' is same as setting it to 'non-distributed' for now, however in the future may result in mixed mode or heuristics based mode selection. Default is 'auto'.\r\nIf 'Distributed' then only distributed featurization is used and distributed algorithms are chosen.\r\nIf 'NonDistributed' then only non distributed algorithms are chosen.", - "default": "Auto", - "$ref": "#/definitions/TrainingMode" - } - }, - "additionalProperties": false - }, - "TrialComponent": { - "description": "Trial component definition.", - "required": [ - "command", - "environmentId" - ], - "type": "object", - "properties": { - "codeId": { - "description": "ARM resource ID of the code asset.", - "type": "string", - "x-ms-mutability": [ - "create", - "read" - ], - "x-nullable": true - }, - "command": { - "description": "[Required] The command to execute on startup of the job. eg. \"python train.py\"", - "minLength": 1, - "pattern": "[a-zA-Z0-9_]", - "type": "string", - "x-ms-mutability": [ - "create", - "read" - ] - }, - "distribution": { - "description": "Distribution configuration of the job. If set, this should be one of Mpi, Tensorflow, PyTorch, or null.", - "$ref": "#/definitions/DistributionConfiguration", - "x-ms-mutability": [ - "create", - "read" - ], - "x-nullable": true - }, - "environmentId": { - "description": "[Required] The ARM resource ID of the Environment specification for the job.", - "minLength": 1, - "pattern": "[a-zA-Z0-9_]", - "type": "string" - }, - "environmentVariables": { - "description": "Environment variables included in the job.", - "type": "object", - "additionalProperties": { - "type": "string", - "x-nullable": true - }, - "x-ms-mutability": [ - "create", - "read" - ], - "x-nullable": true - }, - "resources": { - "description": "Compute Resource configuration for the job.", - "default": "{}", - "$ref": "#/definitions/JobResourceConfiguration", - "x-ms-mutability": [ - "create", - "read" - ] - } - }, - "additionalProperties": false - }, - "TriggerBase": { - "required": [ - "triggerType" - ], - "type": "object", - "properties": { - "endTime": { - "description": "Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer https://en.wikipedia.org/wiki/ISO_8601.\r\nRecommented format would be \"2022-06-01T00:00:01\"\r\nIf not present, the schedule will run indefinitely", - "type": "string", - "x-nullable": true - }, - "startTime": { - "description": "Specifies start time of schedule in ISO 8601 format, but without a UTC offset.", - "type": "string", - "x-nullable": true - }, - "timeZone": { - "description": "Specifies time zone in which the schedule runs.\r\nTimeZone should follow Windows time zone format. Refer: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11", - "default": "UTC", - "type": "string" - }, - "triggerType": { - "description": "[Required] ", - "$ref": "#/definitions/TriggerType", - "x-ms-mutability": [ - "create", - "read", - "update" - ] - } - }, - "discriminator": "triggerType" - }, - "TriggerOnceRequest": { - "required": [ - "scheduleTime" - ], - "type": "object", - "properties": { - "scheduleTime": { - "description": "[Required] Specify the schedule time for trigger once", - "minLength": 1, - "pattern": "[a-zA-Z0-9_]", - "type": "string" - } - }, - "additionalProperties": false - }, - "TriggerRunSubmissionDto": { - "type": "object", - "properties": { - "scheduleActionType": { - "$ref": "#/definitions/ScheduleType" - }, - "submissionId": { - "type": "string" - } - }, - "additionalProperties": false - }, - "TriggerType": { - "enum": [ - "Recurrence", - "Cron" - ], - "type": "string", - "x-ms-enum": { - "name": "TriggerType", - "modelAsString": true, - "values": [ - { - "value": "Recurrence" - }, - { - "value": "Cron" - } - ] - }, - "additionalProperties": false - }, - "TritonInferencingServer": { - "description": "Triton inferencing server configurations.", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/InferencingServer" - } - ], - "properties": { - "inferenceConfiguration": { - "description": "Inference configuration for Triton.", - "$ref": "#/definitions/OnlineInferenceConfiguration", - "x-nullable": true - } - }, - "x-ms-discriminator-value": "Triton", - "additionalProperties": false - }, - "TritonModelJobInput": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/AssetJobInput" - }, - { - "$ref": "#/definitions/JobInput" - } - ], - "x-ms-discriminator-value": "triton_model", - "additionalProperties": false - }, - "TritonModelJobOutput": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/AssetJobOutput" - }, - { - "$ref": "#/definitions/JobOutput" - } - ], - "x-ms-discriminator-value": "triton_model", - "additionalProperties": false - }, - "TruncationSelectionPolicy": { - "description": "Defines an early termination policy that cancels a given percentage of runs at each evaluation interval.", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/EarlyTerminationPolicy" - } - ], - "properties": { - "truncationPercentage": { - "format": "int32", - "description": "The percentage of runs to cancel at each evaluation interval.", - "default": 0, - "type": "integer" - } - }, - "x-ms-discriminator-value": "TruncationSelection", - "additionalProperties": false - }, - "UriFileDataVersion": { - "description": "uri-file data version entity", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/DataVersionBase" - } - ], - "x-ms-discriminator-value": "uri_file", - "additionalProperties": false - }, - "UriFileJobInput": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/AssetJobInput" - }, - { - "$ref": "#/definitions/JobInput" - } - ], - "x-ms-discriminator-value": "uri_file", - "additionalProperties": false - }, - "UriFileJobOutput": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/AssetJobOutput" - }, - { - "$ref": "#/definitions/JobOutput" - } - ], - "x-ms-discriminator-value": "uri_file", - "additionalProperties": false - }, - "UriFolderDataVersion": { - "description": "uri-folder data version entity", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/DataVersionBase" - } - ], - "x-ms-discriminator-value": "uri_folder", - "additionalProperties": false - }, - "UriFolderJobInput": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/AssetJobInput" - }, - { - "$ref": "#/definitions/JobInput" - } - ], - "x-ms-discriminator-value": "uri_folder", - "additionalProperties": false - }, - "UriFolderJobOutput": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/AssetJobOutput" - }, - { - "$ref": "#/definitions/JobOutput" - } - ], - "x-ms-discriminator-value": "uri_folder", - "additionalProperties": false - }, - "UseStl": { - "description": "Configure STL Decomposition of the time-series target column.", - "enum": [ - "None", - "Season", - "SeasonTrend" - ], - "type": "string", - "x-ms-enum": { - "name": "UseStl", - "modelAsString": true, - "values": [ - { - "value": "None", - "description": "No stl decomposition." - }, - { - "value": "Season" - }, - { - "value": "SeasonTrend" - } - ] - }, - "additionalProperties": false - }, - "UserIdentity": { - "description": "User identity configuration.", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/IdentityConfiguration" - } - ], - "x-ms-discriminator-value": "UserIdentity", - "additionalProperties": false - }, - "ValidationMetricType": { - "description": "Metric computation method to use for validation metrics in image tasks.", - "enum": [ - "None", - "Coco", - "Voc", - "CocoVoc" - ], - "type": "string", - "x-ms-enum": { - "name": "ValidationMetricType", - "modelAsString": true, - "values": [ - { - "value": "None", - "description": "No metric." - }, - { - "value": "Coco", - "description": "Coco metric." - }, - { - "value": "Voc", - "description": "Voc metric." - }, - { - "value": "CocoVoc", - "description": "CocoVoc metric." - } - ] - }, - "additionalProperties": false - }, - "Webhook": { - "description": "Webhook base", - "required": [ - "webhookType" - ], - "type": "object", - "properties": { - "eventType": { - "description": "Send callback on a specified notification event", - "type": "string", - "x-ms-mutability": [ - "create", - "read" - ], - "x-nullable": true - }, - "webhookType": { - "description": "[Required] Specifies the type of service to send a callback", - "$ref": "#/definitions/WebhookType", - "x-ms-mutability": [ - "create", - "read" - ] - } - }, - "discriminator": "webhookType" - }, - "WebhookType": { - "description": "Enum to determine the webhook callback service type.", - "enum": [ - "AzureDevOps" - ], - "type": "string", - "x-ms-enum": { - "name": "WebhookType", - "modelAsString": true, - "values": [ - { - "value": "AzureDevOps" - } - ] - }, - "additionalProperties": false - }, - "WeekDay": { - "description": "Enum of weekday", - "enum": [ - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", - "Sunday" - ], - "type": "string", - "x-ms-enum": { - "name": "WeekDay", - "modelAsString": true, - "values": [ - { - "value": "Monday", - "description": "Monday weekday" - }, - { - "value": "Tuesday", - "description": "Tuesday weekday" - }, - { - "value": "Wednesday", - "description": "Wednesday weekday" - }, - { - "value": "Thursday", - "description": "Thursday weekday" - }, - { - "value": "Friday", - "description": "Friday weekday" - }, - { - "value": "Saturday", - "description": "Saturday weekday" - }, - { - "value": "Sunday", - "description": "Sunday weekday" - } - ] - }, - "additionalProperties": false - } - }, - "securityDefinitions": { - "azure_auth": { - "type": "oauth2", - "flow": "implicit", - "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", - "scopes": { - "user_impersonation": "impersonate your user account" - }, - "description": "Azure Active Directory OAuth2 Flow." - } - } -} ->>>>>>> d2e868ceda25d4483e306ea166693af80ef229a0 diff --git a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-07-01-preview/machineLearningServices.json b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-07-01-preview/machineLearningServices.json index dfdf649f21a1f..f7bfe45410286 100644 --- a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-07-01-preview/machineLearningServices.json +++ b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-07-01-preview/machineLearningServices.json @@ -34,28 +34,34 @@ } }, "paths": { - "/providers/Microsoft.MachineLearningServices/operations": { + "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/usages": { "get": { "tags": [ - "Operation" + "Usage" ], - "description": "Lists all of the available Azure Machine Learning Workspaces REST API operations.", - "operationId": "Operations_List", + "operationId": "Usages_List", + "description": "Gets the current usage information as well as limits for AML resources for given subscription and location.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "name": "location", + "in": "path", + "required": true, + "type": "string", + "description": "The location for which resource usage is queried.", + "pattern": "^[-\\w\\._]+$" } ], - "x-ms-examples": { - "OperationsList": { - "$ref": "./examples/Workspace/operationsList.json" - } - }, "responses": { "200": { - "description": "The request was successful; the request was well-formed and received properly.", + "description": "OK", "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/OperationListResult" + "$ref": "#/definitions/ListUsagesResult" } }, "default": { @@ -66,129 +72,119 @@ } }, "x-ms-pageable": { - "nextLinkName": null + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "List Usages": { + "$ref": "./examples/Usage/list.json" + } } } }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}": { + "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/vmSizes": { "get": { "tags": [ - "Workspaces" + "VirtualMachineSizes" ], - "description": "Gets the properties of the specified machine learning workspace.", - "operationId": "Workspaces_Get", - "x-ms-examples": { - "Get Workspace": { - "$ref": "./examples/Workspace/get.json" - } - }, + "operationId": "VirtualMachineSizes_List", + "description": "Returns supported VM Sizes in a location", "parameters": [ { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + "name": "location", + "in": "path", + "required": true, + "type": "string", + "description": "The location upon which virtual-machine-sizes is queried.", + "pattern": "^[-\\w\\._]+$" }, { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/WorkspaceNameParameter" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { - "description": "The request was successful; the request was well-formed and received properly.", + "description": "OK", "schema": { - "$ref": "#/definitions/Workspace" + "$ref": "#/definitions/VirtualMachineSizeListResult" } }, "default": { - "description": "Error response describing why the operation failed", + "description": "Error response describing why the operation failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } + }, + "x-ms-examples": { + "List VM Sizes": { + "$ref": "./examples/VirtualMachineSize/list.json" + } } - }, - "put": { + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/updateQuotas": { + "post": { "tags": [ - "Workspaces" + "Quota" ], - "description": "Creates or updates a workspace with the specified parameters.", - "operationId": "Workspaces_CreateOrUpdate", - "x-ms-long-running-operation": true, - "x-ms-examples": { - "Create Workspace": { - "$ref": "./examples/Workspace/create.json" - } - }, + "operationId": "Quotas_Update", + "description": "Update quota for each VM family in workspace.", "parameters": [ { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" + "name": "location", + "in": "path", + "required": true, + "type": "string", + "description": "The location for update quota is queried.", + "pattern": "^[-\\w\\._]+$" }, { "name": "parameters", "in": "body", - "description": "The parameters for creating or updating a machine learning workspace.", "required": true, "schema": { - "$ref": "#/definitions/Workspace" - } + "$ref": "#/definitions/QuotaUpdateParameters" + }, + "description": "Quota update parameters." + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { - "description": "The request was successful; the request was well-formed and received properly.", + "description": "The operation was successful.", "schema": { - "$ref": "#/definitions/Workspace" - } - }, - "202": { - "description": "Accepted", - "headers": { - "Location": { - "description": "URI to poll for asynchronous operation result.", - "type": "string" - }, - "Retry-After": { - "description": "Duration the client should wait between requests, in seconds.", - "type": "integer", - "format": "int32", - "maximum": 600, - "minimum": 10 - } + "$ref": "#/definitions/UpdateWorkspaceQuotasResult" } }, "default": { - "description": "Error response describing why the operation failed", + "description": "Error response describing why the operation failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } + }, + "x-ms-examples": { + "update quotas": { + "$ref": "./examples/Quota/update.json" + } } - }, - "delete": { + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/quotas": { + "get": { "tags": [ - "Workspaces" + "Quota" ], - "description": "Deletes a machine learning workspace.", - "operationId": "Workspaces_Delete", - "x-ms-examples": { - "Delete Workspace": { - "$ref": "./examples/Workspace/delete.json" - } - }, - "x-ms-long-running-operation": true, + "operationId": "Quotas_List", + "description": "Gets the currently assigned Workspace Quotas based on VMFamily.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -197,24 +193,20 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceForceToPurgeParameter" + "name": "location", + "in": "path", + "required": true, + "type": "string", + "description": "The location for which resource usage is queried.", + "pattern": "^[-\\w\\._]+$" } ], "responses": { "200": { - "description": "The request was successful; the request was well-formed and received properly." - }, - "202": { - "description": "The request was accepted; the request was well-formed and received properly." - }, - "204": { - "description": "The machine learning workspace does not exist in the subscription." + "description": "OK", + "schema": { + "$ref": "#/definitions/ListWorkspaceQuotas" + } }, "default": { "description": "Error response describing why the operation failed", @@ -222,24 +214,34 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "List workspace quotas by VMFamily": { + "$ref": "./examples/Quota/list.json" + } } - }, - "patch": { + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes": { + "get": { "tags": [ - "Workspaces" + "OperationalizationClusters", + "MachineLearningComputes" ], - "description": "Updates a machine learning workspace with the specified parameters.", - "operationId": "Workspaces_Update", - "x-ms-long-running-operation": true, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "operationId": "Compute_List", + "description": "Gets computes in specified workspace.", "x-ms-examples": { - "Update Workspace": { - "$ref": "./examples/Workspace/update.json" + "Get Computes": { + "$ref": "./examples/Compute/list.json" } }, "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" }, @@ -250,40 +252,21 @@ "$ref": "#/parameters/WorkspaceNameParameter" }, { - "name": "parameters", - "in": "body", - "description": "The parameters for updating a machine learning workspace.", - "required": true, - "schema": { - "$ref": "#/definitions/WorkspaceUpdateParameters" - } + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/PaginationParameter" } ], "responses": { "200": { - "description": "The request was successful; the request was well-formed and received properly.", + "description": "The response includes a paginated array of Machine Learning computes and a URI to the next set of results, if any. For the more information the limits of the number of items in a resource group, see https://azure.microsoft.com/en-us/documentation/articles/azure-subscription-service-limits/.", "schema": { - "$ref": "#/definitions/Workspace" - } - }, - "202": { - "description": "Accepted", - "headers": { - "Location": { - "description": "URI to poll for asynchronous operation result.", - "type": "string" - }, - "Retry-After": { - "description": "Duration the client should wait between requests, in seconds.", - "type": "integer", - "format": "int32", - "maximum": 600, - "minimum": 10 - } + "$ref": "#/definitions/PaginatedComputeResourcesList" } }, "default": { - "description": "Error response describing why the operation failed", + "description": "Error response describing why the request failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } @@ -291,22 +274,29 @@ } } }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}": { "get": { "tags": [ - "Workspaces" + "OperationalizationClusters", + "MachineLearningComputes" ], - "description": "Lists all the available machine learning workspaces under the specified resource group.", - "operationId": "Workspaces_ListByResourceGroup", + "operationId": "Compute_Get", + "description": "Gets compute definition by its name. Any secrets (storage keys, service credentials, etc) are not returned - use 'keys' nested resource to get them.", "x-ms-examples": { - "Get Workspaces by Resource Group": { - "$ref": "./examples/Workspace/listByResourceGroup.json" + "Get a AKS Compute": { + "$ref": "./examples/Compute/get/AKSCompute.json" + }, + "Get a AML Compute": { + "$ref": "./examples/Compute/get/AmlCompute.json" + }, + "Get an ComputeInstance": { + "$ref": "./examples/Compute/get/ComputeInstance.json" + }, + "Get a Kubernetes Compute": { + "$ref": "./examples/Compute/get/KubernetesCompute.json" } }, "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" }, @@ -314,120 +304,128 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" }, { - "$ref": "#/parameters/PaginationParameter" + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ComputeNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { - "description": "The request was successful; the request was well-formed and received properly.", + "description": "Success.", "schema": { - "$ref": "#/definitions/WorkspaceListResult" + "$ref": "#/definitions/ComputeResource" } }, "default": { - "description": "Error response describing why the operation failed", + "description": "Error response describing why the request failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/diagnose": { - "post": { + }, + "put": { "tags": [ - "Workspaces" - ], - "summary": "Diagnose workspace setup issue.", - "operationId": "Workspaces_Diagnose", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" + "OperationalizationClusters", + "MachineLearningComputes" ], - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + "operationId": "Compute_CreateOrUpdate", + "description": "Creates or updates compute. This call will overwrite a compute if it exists. This is a nonrecoverable operation. If your intent is to create a new compute, do a GET first to verify that it does not exist yet.", + "x-ms-long-running-operation": true, + "x-ms-examples": { + "Create a AML Compute": { + "$ref": "./examples/Compute/createOrUpdate/BasicAmlCompute.json" }, - { - "$ref": "#/parameters/WorkspaceNameParameter" + "Create an ComputeInstance Compute with minimal inputs": { + "$ref": "./examples/Compute/createOrUpdate/ComputeInstanceMinimal.json" + }, + "Create an ComputeInstance Compute": { + "$ref": "./examples/Compute/createOrUpdate/ComputeInstance.json" + }, + "Create an ComputeInstance Compute with Schedules": { + "$ref": "./examples/Compute/createOrUpdate/ComputeInstanceWithSchedules.json" + }, + "Create an AKS Compute": { + "$ref": "./examples/Compute/createOrUpdate/BasicAKSCompute.json" + }, + "Create a DataFactory Compute": { + "$ref": "./examples/Compute/createOrUpdate/BasicDataFactoryCompute.json" + }, + "Update a AML Compute": { + "$ref": "./examples/Compute/createOrUpdate/AmlCompute.json" + }, + "Update an AKS Compute": { + "$ref": "./examples/Compute/createOrUpdate/AKSCompute.json" + }, + "Attach a Kubernetes Compute": { + "$ref": "./examples/Compute/createOrUpdate/KubernetesCompute.json" + } + }, + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ComputeNameParameter" }, { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "in": "body", - "name": "parameters", - "description": "The parameter of diagnosing workspace health", - "schema": { - "$ref": "#/definitions/DiagnoseWorkspaceParameters" - } + "$ref": "#/parameters/ComputeDefinitionParameter" } ], "responses": { - "202": { - "description": "Success", + "200": { + "description": "Compute creation or update initiated.", + "schema": { + "$ref": "#/definitions/ComputeResource" + } + }, + "201": { + "description": "Compute creation or update initiated.", "headers": { - "Location": { - "description": "URI to poll for asynchronous operation result.", + "Azure-AsyncOperation": { + "description": "URI to poll for asynchronous operation status.", "type": "string" - }, - "Retry-After": { - "description": "Duration the client should wait between requests, in seconds.", - "type": "integer", - "format": "int32", - "maximum": 600, - "minimum": 10 } - } - }, - "200": { - "description": "Success", + }, "schema": { - "$ref": "#/definitions/DiagnoseResponseResult" + "$ref": "#/definitions/ComputeResource" } }, "default": { - "description": "Error", + "description": "Error response describing why the request failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } - }, - "x-ms-examples": { - "Diagnose Workspace": { - "$ref": "./examples/Workspace/diagnose.json" - } - }, - "x-ms-long-running-operation": true, - "x-ms-long-running-operation-options": { - "final-state-via": "location" } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listKeys": { - "post": { + }, + "patch": { "tags": [ - "Workspaces" + "OperationalizationClusters", + "MachineLearningComputes" ], - "description": "Lists all the keys associated with this workspace. This includes keys for the storage account, app insights and password for container registry", - "operationId": "Workspaces_ListKeys", + "operationId": "Compute_Update", + "description": "Updates properties of a compute. This call will overwrite a compute if it exists. This is a nonrecoverable operation.", + "x-ms-long-running-operation": true, "x-ms-examples": { - "List Workspace Keys": { - "$ref": "./examples/Workspace/listKeys.json" + "Update a AmlCompute Compute": { + "$ref": "./examples/Compute/patch.json" } }, "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" }, @@ -436,41 +434,52 @@ }, { "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ComputeNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "parameters", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ClusterUpdateParameters" + }, + "description": "Additional parameters for cluster update." } ], "responses": { "200": { - "description": "The request was successful; the request was well-formed and received properly.", + "description": "Compute update initiated.", "schema": { - "$ref": "#/definitions/ListWorkspaceKeysResult" + "$ref": "#/definitions/ComputeResource" } }, "default": { - "description": "Error response describing why the operation failed", + "description": "Error response describing why the request failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys": { - "post": { + }, + "delete": { "tags": [ - "Workspaces" + "OperationalizationClusters", + "MachineLearningComputes" ], - "description": "Resync all the keys associated with this workspace. This includes keys for the storage account, app insights and password for container registry", - "operationId": "Workspaces_ResyncKeys", + "operationId": "Compute_Delete", + "description": "Deletes specified Machine Learning compute.", "x-ms-long-running-operation": true, "x-ms-examples": { - "Resync Workspace Keys": { - "$ref": "./examples/Workspace/resyncKeys.json" + "Delete Compute": { + "$ref": "./examples/Compute/delete.json" } }, "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" }, @@ -479,6 +488,15 @@ }, { "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ComputeNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/UnderlyingResourceActionParameter" } ], "responses": { @@ -486,23 +504,23 @@ "description": "The request was successful; the request was well-formed and received properly." }, "202": { - "description": "Accepted", + "description": "Compute deletion initiated.", "headers": { + "Azure-AsyncOperation": { + "description": "URI to poll for asynchronous operation status.", + "type": "string" + }, "Location": { "description": "URI to poll for asynchronous operation result.", "type": "string" - }, - "Retry-After": { - "description": "Duration the client should wait between requests, in seconds.", - "type": "integer", - "format": "int32", - "maximum": 600, - "minimum": 10 } } }, + "204": { + "description": "No content; The target compute does not exist." + }, "default": { - "description": "Error response describing why the operation failed", + "description": "Error response describing why the request failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } @@ -510,81 +528,90 @@ } } }, - "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/usages": { - "get": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/customServices": { + "post": { "tags": [ - "Usage" + "OperationalizationClusters", + "MachineLearningComputes" ], - "operationId": "Usages_List", - "description": "Gets the current usage information as well as limits for AML resources for given subscription and location.", + "operationId": "Compute_UpdateCustomServices", + "description": "Updates the custom services list. The list of custom services provided shall be overwritten", + "x-ms-examples": { + "Update Custom Services": { + "$ref": "./examples/Compute/updateCustomServices.json" + } + }, "parameters": [ { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" }, { - "name": "location", - "in": "path", + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ComputeNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "customServices", "required": true, - "type": "string", - "description": "The location for which resource usage is queried.", - "pattern": "^[-\\w\\._]+$" + "description": "New list of Custom Services.", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/CustomService" + } + } } ], "responses": { "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/ListUsagesResult" - } + "description": "Success" }, "default": { - "description": "Error response describing why the operation failed", + "description": "Error response describing why the request failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - }, - "x-ms-examples": { - "List Usages": { - "$ref": "./examples/Usage/list.json" - } } } }, - "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/vmSizes": { - "get": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listNodes": { + "post": { "tags": [ - "VirtualMachineSizes" + "MachineLearningComputes" ], - "operationId": "VirtualMachineSizes_List", - "description": "Returns supported VM Sizes in a location", + "operationId": "Compute_ListNodes", + "description": "Get the details (e.g IP address, port etc) of all the compute nodes in the compute.", "parameters": [ { - "name": "location", - "in": "path", - "required": true, - "type": "string", - "description": "The location upon which virtual-machine-sizes is queried.", - "pattern": "^[-\\w\\._]+$" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" }, { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ComputeNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { - "description": "OK", + "description": "The operation was successful. The response contains the list of IP addresses.", "schema": { - "$ref": "#/definitions/VirtualMachineSizeListResult" + "$ref": "#/definitions/AmlComputeNodesInformation" } }, "default": { @@ -594,50 +621,52 @@ } } }, + "x-ms-pageable": { + "nextLinkName": "nextLink", + "itemName": "nodes" + }, "x-ms-examples": { - "List VM Sizes": { - "$ref": "./examples/VirtualMachineSize/list.json" + "Get compute nodes information for a compute": { + "$ref": "./examples/Compute/listNodes.json" } } } }, - "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/updateQuotas": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listKeys": { "post": { "tags": [ - "Quota" + "OperationalizationClusters", + "MachineLearningComputes" ], - "operationId": "Quotas_Update", - "description": "Update quota for each VM family in workspace.", + "operationId": "Compute_ListKeys", + "description": "Gets secrets related to Machine Learning compute (storage keys, service credentials, etc).", + "x-ms-examples": { + "List AKS Compute Keys": { + "$ref": "./examples/Compute/listKeys.json" + } + }, "parameters": [ { - "name": "location", - "in": "path", - "required": true, - "type": "string", - "description": "The location for update quota is queried.", - "pattern": "^[-\\w\\._]+$" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" }, { - "name": "parameters", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/QuotaUpdateParameters" - }, - "description": "Quota update parameters." + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" }, { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + "$ref": "#/parameters/WorkspaceNameParameter" }, { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - } + "$ref": "#/parameters/ComputeNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } ], "responses": { "200": { - "description": "The operation was successful.", + "description": "Success.", "schema": { - "$ref": "#/definitions/UpdateWorkspaceQuotasResult" + "$ref": "#/definitions/ComputeSecrets" } }, "default": { @@ -646,119 +675,121 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } - }, - "x-ms-examples": { - "update quotas": { - "$ref": "./examples/Quota/update.json" - } } } }, - "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/quotas": { - "get": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateDataMounts": { + "post": { "tags": [ - "Quota" + "MachineLearningComputes" ], - "operationId": "Quotas_List", - "description": "Gets the currently assigned Workspace Quotas based on VMFamily.", + "summary": "Update Data Mounts of a Machine Learning compute.", + "operationId": "Compute_UpdateDataMounts", "parameters": [ { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" }, { - "name": "location", - "in": "path", + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ComputeNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "dataMounts", + "in": "body", + "description": "The parameters for creating or updating a machine learning workspace.", "required": true, - "type": "string", - "description": "The location for which resource usage is queried.", - "pattern": "^[-\\w\\._]+$" + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ComputeInstanceDataMount" + } + } } ], "responses": { "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/ListWorkspaceQuotas" - } + "description": "Success." }, "default": { - "description": "Error response describing why the operation failed", + "description": "Error", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - }, "x-ms-examples": { - "List workspace quotas by VMFamily": { - "$ref": "./examples/Quota/list.json" + "Update Data Mounts": { + "$ref": "./examples/Compute/updateDataMounts.json" } } } }, - "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces": { - "get": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/start": { + "post": { "tags": [ - "Workspaces" + "OperationalizationClusters", + "MachineLearningComputes" ], - "description": "Lists all the available machine learning workspaces under the specified subscription.", - "operationId": "Workspaces_ListBySubscription", + "operationId": "Compute_Start", + "description": "Posts a start action to a compute instance", "x-ms-examples": { - "Get Workspaces by subscription": { - "$ref": "./examples/Workspace/listBySubscription.json" + "Start ComputeInstance Compute": { + "$ref": "./examples/Compute/start.json" } }, + "x-ms-long-running-operation": true, "parameters": [ { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" }, { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" }, { - "$ref": "#/parameters/PaginationParameter" + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ComputeNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" } ], "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly.", - "schema": { - "$ref": "#/definitions/WorkspaceListResult" - } + "202": { + "description": "Success." }, "default": { - "description": "Error response describing why the operation failed", + "description": "Error response describing why the operation failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" } } }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes": { - "get": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/stop": { + "post": { "tags": [ "OperationalizationClusters", "MachineLearningComputes" ], - "x-ms-pageable": { - "nextLinkName": "nextLink" - }, - "operationId": "Compute_List", - "description": "Gets computes in specified workspace.", + "operationId": "Compute_Stop", + "description": "Posts a stop action to a compute instance", "x-ms-examples": { - "Get Computes": { - "$ref": "./examples/Compute/list.json" + "Stop ComputeInstance Compute": { + "$ref": "./examples/Compute/stop.json" } }, + "x-ms-long-running-operation": true, "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" @@ -770,21 +801,18 @@ "$ref": "#/parameters/WorkspaceNameParameter" }, { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + "$ref": "#/parameters/ComputeNameParameter" }, { - "$ref": "#/parameters/PaginationParameter" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" } ], "responses": { - "200": { - "description": "The response includes a paginated array of Machine Learning computes and a URI to the next set of results, if any. For the more information the limits of the number of items in a resource group, see https://azure.microsoft.com/en-us/documentation/articles/azure-subscription-service-limits/.", - "schema": { - "$ref": "#/definitions/PaginatedComputeResourcesList" - } + "202": { + "description": "Success." }, "default": { - "description": "Error response describing why the request failed.", + "description": "Error response describing why the operation failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } @@ -792,28 +820,20 @@ } } }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}": { - "get": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart": { + "post": { "tags": [ "OperationalizationClusters", "MachineLearningComputes" ], - "operationId": "Compute_Get", - "description": "Gets compute definition by its name. Any secrets (storage keys, service credentials, etc) are not returned - use 'keys' nested resource to get them.", + "operationId": "Compute_Restart", + "description": "Posts a restart action to a compute instance", "x-ms-examples": { - "Get a AKS Compute": { - "$ref": "./examples/Compute/get/AKSCompute.json" - }, - "Get a AML Compute": { - "$ref": "./examples/Compute/get/AmlCompute.json" - }, - "Get an ComputeInstance": { - "$ref": "./examples/Compute/get/ComputeInstance.json" - }, - "Get a Kubernetes Compute": { - "$ref": "./examples/Compute/get/KubernetesCompute.json" + "Restart ComputeInstance Compute": { + "$ref": "./examples/Compute/restart.json" } }, + "x-ms-long-running-operation": true, "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" @@ -832,55 +852,28 @@ } ], "responses": { - "200": { - "description": "Success.", - "schema": { - "$ref": "#/definitions/ComputeResource" - } + "202": { + "description": "Success." }, "default": { - "description": "Error response describing why the request failed.", + "description": "Error response describing why the operation failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } } - }, - "put": { + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateIdleShutdownSetting": { + "post": { "tags": [ - "OperationalizationClusters", "MachineLearningComputes" ], - "operationId": "Compute_CreateOrUpdate", - "description": "Creates or updates compute. This call will overwrite a compute if it exists. This is a nonrecoverable operation. If your intent is to create a new compute, do a GET first to verify that it does not exist yet.", - "x-ms-long-running-operation": true, + "operationId": "Compute_UpdateIdleShutdownSetting", + "description": "Updates the idle shutdown setting of a compute instance.", "x-ms-examples": { - "Create a AML Compute": { - "$ref": "./examples/Compute/createOrUpdate/BasicAmlCompute.json" - }, - "Create an ComputeInstance Compute with minimal inputs": { - "$ref": "./examples/Compute/createOrUpdate/ComputeInstanceMinimal.json" - }, - "Create an ComputeInstance Compute": { - "$ref": "./examples/Compute/createOrUpdate/ComputeInstance.json" - }, - "Create an ComputeInstance Compute with Schedules": { - "$ref": "./examples/Compute/createOrUpdate/ComputeInstanceWithSchedules.json" - }, - "Create an AKS Compute": { - "$ref": "./examples/Compute/createOrUpdate/BasicAKSCompute.json" - }, - "Create a DataFactory Compute": { - "$ref": "./examples/Compute/createOrUpdate/BasicDataFactoryCompute.json" - }, - "Update a AML Compute": { - "$ref": "./examples/Compute/createOrUpdate/AmlCompute.json" - }, - "Update an AKS Compute": { - "$ref": "./examples/Compute/createOrUpdate/AKSCompute.json" - }, - "Attach a Kubernetes Compute": { - "$ref": "./examples/Compute/createOrUpdate/KubernetesCompute.json" + "Update idle shutdown setting of ComputeInstance": { + "$ref": "./examples/Compute/updateIdleShutdownSetting.json" } }, "parameters": [ @@ -900,49 +893,36 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/ComputeDefinitionParameter" + "name": "parameters", + "in": "body", + "required": true, + "description": "The object for updating idle shutdown setting of specified ComputeInstance.", + "schema": { + "$ref": "#/definitions/IdleShutdownSetting" + } } ], "responses": { "200": { - "description": "Compute creation or update initiated.", - "schema": { - "$ref": "#/definitions/ComputeResource" - } - }, - "201": { - "description": "Compute creation or update initiated.", - "headers": { - "Azure-AsyncOperation": { - "description": "URI to poll for asynchronous operation status.", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/ComputeResource" - } + "description": "Success." }, "default": { - "description": "Error response describing why the request failed.", + "description": "Error response describing why the operation failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } } - }, - "patch": { + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/getAllowedVmSizesForResize": { + "post": { "tags": [ "OperationalizationClusters", "MachineLearningComputes" ], - "operationId": "Compute_Update", - "description": "Updates properties of a compute. This call will overwrite a compute if it exists. This is a nonrecoverable operation.", - "x-ms-long-running-operation": true, - "x-ms-examples": { - "Update a AmlCompute Compute": { - "$ref": "./examples/Compute/patch.json" - } - }, + "operationId": "Compute_getAllowedResizeSizes", + "description": "Returns supported virtual machine sizes for resize", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" @@ -958,45 +938,38 @@ }, { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "parameters", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ClusterUpdateParameters" - }, - "description": "Additional parameters for cluster update." } ], "responses": { "200": { - "description": "Compute update initiated.", + "description": "OK", "schema": { - "$ref": "#/definitions/ComputeResource" + "$ref": "#/definitions/VirtualMachineSizeListResult" } }, "default": { - "description": "Error response describing why the request failed.", + "description": "Error response describing why the operation failed.", "schema": { "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } + }, + "x-ms-examples": { + "List VM Sizes": { + "$ref": "./examples/Compute/getAllowedVMSizesForResize.json" + } } - }, - "delete": { + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/resize": { + "post": { "tags": [ "OperationalizationClusters", "MachineLearningComputes" ], - "operationId": "Compute_Delete", - "description": "Deletes specified Machine Learning compute.", + "operationId": "Compute_Resize", + "description": "Updates the size of a Compute Instance.", "x-ms-long-running-operation": true, - "x-ms-examples": { - "Delete Compute": { - "$ref": "./examples/Compute/delete.json" - } - }, "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" @@ -1014,69 +987,24 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/UnderlyingResourceActionParameter" - } + "name": "parameters", + "in": "body", + "required": true, + "description": "The object for updating VM size setting of specified Compute Instance.", + "schema": { + "$ref": "#/definitions/ResizeSchema" + } + } ], "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly." - }, "202": { - "description": "Compute deletion initiated.", + "description": "Compute resize initiated.", "headers": { - "Azure-AsyncOperation": { - "description": "URI to poll for asynchronous operation status.", - "type": "string" - }, "Location": { - "description": "URI to poll for asynchronous operation result.", "type": "string" } } }, - "204": { - "description": "No content; The target compute does not exist." - }, - "default": { - "description": "Error response describing why the request failed.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listNodes": { - "post": { - "tags": [ - "MachineLearningComputes" - ], - "operationId": "Compute_ListNodes", - "description": "Get the details (e.g IP address, port etc) of all the compute nodes in the compute.", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/ComputeNameParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "The operation was successful. The response contains the list of IP addresses.", - "schema": { - "$ref": "#/definitions/AmlComputeNodesInformation" - } - }, "default": { "description": "Error response describing why the operation failed.", "schema": { @@ -1084,5788 +1012,3052 @@ } } }, - "x-ms-pageable": { - "nextLinkName": "nextLink", - "itemName": "nodes" - }, "x-ms-examples": { - "Get compute nodes information for a compute": { - "$ref": "./examples/Compute/listNodes.json" + "List VM Sizes": { + "$ref": "./examples/Compute/resize.json" } } } + } + }, + "parameters": { + "WorkspaceNameParameter": { + "name": "workspaceName", + "description": "Name of Azure Machine Learning workspace.", + "in": "path", + "type": "string", + "required": true, + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$", + "x-ms-parameter-location": "method" }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken": { - "post": { - "tags": [ - "Workspaces" - ], - "description": "return notebook access token and refresh token", - "operationId": "Workspaces_ListNotebookAccessToken", - "x-ms-examples": { - "List Workspace Keys": { - "$ref": "./examples/Workspace/listNotebookAccessToken.json" - } - }, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - } - ], - "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly.", - "schema": { - "$ref": "#/definitions/NotebookAccessTokenResult" - } - }, - "default": { - "description": "Error response describing why the operation failed", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - } + "ComputeNameParameter": { + "name": "computeName", + "description": "Name of the Azure Machine Learning compute.", + "in": "path", + "type": "string", + "required": true, + "pattern": "^[a-zA-Z](?![a-zA-Z0-9-]*-\\d+$)[a-zA-Z0-9\\-]{2,23}$", + "x-ms-parameter-location": "method" }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listKeys": { - "post": { - "tags": [ - "OperationalizationClusters", - "MachineLearningComputes" - ], - "operationId": "Compute_ListKeys", - "description": "Gets secrets related to Machine Learning compute (storage keys, service credentials, etc).", - "x-ms-examples": { - "List AKS Compute Keys": { - "$ref": "./examples/Compute/listKeys.json" - } + "AsyncOperationIdParameter": { + "name": "asyncOperationId", + "description": "Identifier of an asynchronous Azure Machine Learning compute operation.", + "in": "path", + "type": "string", + "required": true, + "x-ms-parameter-location": "method" + }, + "LocationParameter": { + "name": "location", + "description": "The name of the Azure location/region.", + "in": "path", + "type": "string", + "required": true, + "x-ms-parameter-location": "method" + }, + "PaginationParameter": { + "in": "query", + "name": "$skip", + "type": "string", + "description": "Continuation token for pagination.", + "required": false, + "x-ms-parameter-location": "method" + }, + "ComputeDefinitionParameter": { + "in": "body", + "name": "parameters", + "description": "Payload with Machine Learning compute definition.", + "required": true, + "schema": { + "$ref": "#/definitions/ComputeResource" + }, + "x-ms-parameter-location": "method" + }, + "ComputeTypeParameter": { + "in": "query", + "name": "compute-type", + "type": "string", + "description": "Type of compute to filter by.", + "required": false, + "x-ms-parameter-location": "method" + }, + "UnderlyingResourceActionParameter": { + "in": "query", + "name": "underlyingResourceAction", + "type": "string", + "description": "Delete the underlying compute if 'Delete', or detach the underlying compute from workspace if 'Detach'.", + "required": true, + "enum": [ + "Delete", + "Detach" + ], + "x-ms-enum": { + "name": "UnderlyingResourceAction", + "modelAsString": true + }, + "x-ms-parameter-location": "method" + } + }, + "definitions": { + "UsageName": { + "type": "object", + "properties": { + "value": { + "readOnly": true, + "type": "string", + "description": "The name of the resource." }, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/ComputeNameParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "schema": { - "$ref": "#/definitions/ComputeSecrets" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } + "localizedValue": { + "readOnly": true, + "type": "string", + "description": "The localized name of the resource." } - } + }, + "description": "The Usage Names." }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/start": { - "post": { - "tags": [ - "OperationalizationClusters", - "MachineLearningComputes" - ], - "operationId": "Compute_Start", - "description": "Posts a start action to a compute instance", - "x-ms-examples": { - "Start ComputeInstance Compute": { - "$ref": "./examples/Compute/start.json" - } + "Usage": { + "type": "object", + "properties": { + "id": { + "readOnly": true, + "type": "string", + "description": "Specifies the resource ID." }, - "x-ms-long-running-operation": true, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/ComputeNameParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "202": { - "description": "Success." - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/stop": { - "post": { - "tags": [ - "OperationalizationClusters", - "MachineLearningComputes" - ], - "operationId": "Compute_Stop", - "description": "Posts a stop action to a compute instance", - "x-ms-examples": { - "Stop ComputeInstance Compute": { - "$ref": "./examples/Compute/stop.json" - } - }, - "x-ms-long-running-operation": true, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/ComputeNameParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "202": { - "description": "Success." - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart": { - "post": { - "tags": [ - "OperationalizationClusters", - "MachineLearningComputes" - ], - "operationId": "Compute_Restart", - "description": "Posts a restart action to a compute instance", - "x-ms-examples": { - "Restart ComputeInstance Compute": { - "$ref": "./examples/Compute/restart.json" - } - }, - "x-ms-long-running-operation": true, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/ComputeNameParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "202": { - "description": "Success." - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections": { - "get": { - "tags": [ - "PrivateEndpointConnections" - ], - "operationId": "PrivateEndpointConnections_List", - "description": "List all the private endpoint connections associated with the workspace.", - "x-ms-examples": { - "StorageAccountListPrivateEndpointConnections": { - "$ref": "./examples/PrivateEndpointConnection/list.json" - } - }, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - } - ], - "responses": { - "200": { - "description": "OK -- Successfully retrieved private endpoint connections.", - "schema": { - "$ref": "#/definitions/PrivateEndpointConnectionListResult" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": null - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}": { - "get": { - "tags": [ - "WorkspacePrivateEndpointConnections" - ], - "operationId": "PrivateEndpointConnections_Get", - "description": "Gets the specified private endpoint connection associated with the workspace.", - "x-ms-examples": { - "WorkspaceGetPrivateEndpointConnection": { - "$ref": "./examples/PrivateEndpointConnection/get.json" - } - }, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/PrivateEndpointConnectionName" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "OK -- Get the private endpoint connection properties successfully.", - "schema": { - "$ref": "#/definitions/PrivateEndpointConnection" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - }, - "put": { - "tags": [ - "WorkspacePrivateEndpointConnections" - ], - "operationId": "PrivateEndpointConnections_CreateOrUpdate", - "description": "Update the state of specified private endpoint connection associated with the workspace.", - "x-ms-examples": { - "WorkspacePutPrivateEndpointConnection": { - "$ref": "./examples/PrivateEndpointConnection/createOrUpdate.json" - } - }, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/PrivateEndpointConnectionName" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "properties", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PrivateEndpointConnection" - }, - "description": "The private endpoint connection properties." - } - ], - "responses": { - "200": { - "description": "OK -- Update the private endpoint connection properties successfully.", - "schema": { - "$ref": "#/definitions/PrivateEndpointConnection" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - }, - "delete": { - "tags": [ - "WorkspacePrivateEndpointConnections" - ], - "operationId": "PrivateEndpointConnections_Delete", - "description": "Deletes the specified private endpoint connection associated with the workspace.", - "x-ms-examples": { - "WorkspaceDeletePrivateEndpointConnection": { - "$ref": "./examples/PrivateEndpointConnection/delete.json" - } - }, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/PrivateEndpointConnectionName" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "OK -- Delete the private endpoint connection successfully." - }, - "204": { - "description": "No Content -- The private endpoint connection does not exist." - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateLinkResources": { - "get": { - "tags": [ - "WorkspacePrivateLinkResources" - ], - "operationId": "PrivateLinkResources_List", - "description": "Gets the private link resources that need to be created for a workspace.", - "x-ms-examples": { - "WorkspaceListPrivateLinkResources": { - "$ref": "./examples/PrivateLinkResource/list.json" - } - }, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Successfully retrieved private link resources.", - "schema": { - "$ref": "#/definitions/PrivateLinkResourceListResult" - } - }, - "default": { - "description": "Error response describing why the operation failed", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook": { - "post": { - "tags": [ - "ProxyOperations" - ], - "operationId": "Workspaces_PrepareNotebook", - "description": "Prepare a notebook.", - "x-ms-long-running-operation": true, - "x-ms-long-running-operation-options": { - "final-state-via": "location" - }, - "x-ms-examples": { - "Prepare Notebook": { - "$ref": "./examples/Notebook/prepare.json" - } - }, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - } - ], - "responses": { - "200": { - "description": "Success", - "schema": { - "$ref": "#/definitions/NotebookResourceInfo" - } - }, - "202": { - "description": "Accepted", - "headers": { - "Location": { - "description": "URI to poll for asynchronous operation result.", - "type": "string" - }, - "Retry-After": { - "description": "Duration the client should wait between requests, in seconds.", - "type": "integer", - "format": "int32", - "maximum": 600, - "minimum": 10 - } - } - }, - "default": { - "description": "Error response describing why the operation failed", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys": { - "post": { - "tags": [ - "ProxyOperations" - ], - "operationId": "Workspaces_ListStorageAccountKeys", - "description": "List storage account keys of a workspace.", - "x-ms-examples": { - "List Workspace Keys": { - "$ref": "./examples/Workspace/listStorageAccountKeys.json" - } - }, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - } - ], - "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly.", - "schema": { - "$ref": "#/definitions/ListStorageAccountKeysResult" - } - }, - "default": { - "description": "Error response describing why the operation failed", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys": { - "post": { - "tags": [ - "ProxyOperations" - ], - "operationId": "Workspaces_ListNotebookKeys", - "description": "List keys of a notebook.", - "x-ms-examples": { - "List Workspace Keys": { - "$ref": "./examples/Notebook/listKeys.json" - } - }, - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - } - ], - "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly.", - "schema": { - "$ref": "#/definitions/ListNotebookKeysResult" - } - }, - "default": { - "description": "Error response describing why the operation failed", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}": { - "put": { - "tags": [ - "V2WorkspaceConnectionResource" - ], - "operationId": "WorkspaceConnections_Create", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "machineLearningServices.json#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/ConnectionName" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "parameters", - "in": "body", - "description": "The object for creating or updating a new workspace connection", - "required": true, - "schema": { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResource" - } - } - ], - "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly.", - "schema": { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResource" - } - }, - "default": { - "description": "Error", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "CreateWorkspaceConnection": { - "$ref": "./examples/WorkspaceConnection/create.json" - } - } - }, - "get": { - "tags": [ - "V2WorkspaceConnectionResource" - ], - "operationId": "WorkspaceConnections_Get", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "machineLearningServices.json#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/ConnectionName" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly.", - "schema": { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResource" - } - }, - "default": { - "description": "Error", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "GetWorkspaceConnection": { - "$ref": "./examples/WorkspaceConnection/get.json" - } - } - }, - "delete": { - "tags": [ - "V2WorkspaceConnectionResource" - ], - "operationId": "WorkspaceConnections_Delete", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "machineLearningServices.json#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/ConnectionName" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "default": { - "description": "Error", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - }, - "200": { - "description": "Success" - }, - "204": { - "description": "Success" - } - }, - "x-ms-examples": { - "DeleteWorkspaceConnection": { - "$ref": "./examples/WorkspaceConnection/delete.json" - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections": { - "get": { - "tags": [ - "V2WorkspaceConnectionResource" - ], - "operationId": "WorkspaceConnections_List", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "machineLearningServices.json#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/TargetParameter" - }, - { - "$ref": "#/parameters/CategoryParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly.", - "schema": { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult" - } - }, - "default": { - "description": "Error", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "ListWorkspaceConnections": { - "$ref": "./examples/WorkspaceConnection/list.json" - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/listsecrets": { - "post": { - "tags": [ - "V2WorkspaceConnectionResource" - ], - "summary": "List all the secrets of a machine learning workspaces connections.", - "operationId": "WorkspaceConnections_ListSecrets", - "produces": [ - "application/json" - ], - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/ConnectionName" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly.", - "schema": { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResource" - } - }, - "default": { - "description": "Error", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "GetWorkspaceConnection": { - "$ref": "./examples/WorkspaceConnection/listSecrets.json" - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints": { - "get": { - "tags": [ - "OutboundNetworkDependenciesEndpoints" - ], - "summary": "Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) programmatically.", - "operationId": "Workspaces_ListOutboundNetworkDependenciesEndpoints", - "produces": [ - "application/json" - ], - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success", - "schema": { - "$ref": "#/definitions/ExternalFQDNResponse" - } - }, - "default": { - "description": "Error", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "ListOutboundNetworkDependenciesEndpoints": { - "$ref": "./examples/ExternalFQDN/get.json" - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules": { - "get": { - "tags": [ - "ManagedNetwork" - ], - "summary": "Lists the managed network outbound rules for a machine learning workspace.", - "operationId": "ManagedNetworkSettingsRule_List", - "produces": [ - "application/json" - ], - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly.", - "schema": { - "$ref": "#/definitions/OutboundRuleListResult" - } - }, - "default": { - "description": "Error", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "List ManagedNetworkSettingsRule": { - "$ref": "./examples/ManagedNetwork/listRule.json" - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}": { - "delete": { - "tags": [ - "ManagedNetwork" - ], - "operationId": "ManagedNetworkSettingsRule_Delete", - "summary": "Deletes an outbound rule from the managed network of a machine learning workspace.", - "produces": [ - "application/json" - ], - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/RuleName" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "202": { - "description": "Accepted", - "headers": { - "Location": { - "description": "URI to poll for asynchronous operation result.", - "type": "string" - } - } - }, - "204": { - "description": "No Content" - }, - "200": { - "description": "The request was successful; the request was well-formed and received properly." - }, - "default": { - "description": "Error", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Delete ManagedNetworkSettingsRule": { - "$ref": "./examples/ManagedNetwork/deleteRule.json" - } - }, - "x-ms-long-running-operation": true - }, - "get": { - "tags": [ - "ManagedNetwork" - ], - "operationId": "ManagedNetworkSettingsRule_Get", - "summary": "Gets an outbound rule from the managed network of a machine learning workspace.", - "produces": [ - "application/json" - ], - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/RuleName" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly.", - "schema": { - "$ref": "#/definitions/OutboundRuleBasicResource" - } - }, - "default": { - "description": "Error", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Get ManagedNetworkSettingsRule": { - "$ref": "./examples/ManagedNetwork/getRule.json" - } - } - }, - "put": { - "tags": [ - "ManagedNetwork" - ], - "operationId": "ManagedNetworkSettingsRule_CreateOrUpdate", - "summary": "Creates or updates an outbound rule in the managed network of a machine learning workspace.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "#/parameters/RuleName" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "in": "body", - "name": "body", - "required": true, - "description": "Outbound Rule to be created or updated in the managed network of a machine learning workspace.", - "schema": { - "$ref": "#/definitions/OutboundRuleBasicResource" - } - } - ], - "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly.", - "schema": { - "$ref": "#/definitions/OutboundRuleBasicResource" - } - }, - "202": { - "description": "Accepted", - "headers": { - "Location": { - "description": "URI to poll for asynchronous operation result.", - "type": "string" - }, - "Retry-After": { - "description": "Duration the client should wait between requests, in seconds.", - "type": "integer", - "format": "int32", - "maximum": 600, - "minimum": 10 - } - } - }, - "default": { - "description": "Error", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "CreateOrUpdate ManagedNetworkSettingsRule": { - "$ref": "./examples/ManagedNetwork/createOrUpdateRule.json" - } - }, - "x-ms-long-running-operation": true, - "x-ms-long-running-operation-options": { - "final-state-via": "location" - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/provisionManagedNetwork": { - "post": { - "tags": [ - "ManagedNetwork" - ], - "operationId": "ManagedNetworkProvisions_ProvisionManagedNetwork", - "summary": "Provisions the managed network of a machine learning workspace.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" - }, - { - "$ref": "#/parameters/WorkspaceNameParameter" - }, - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "in": "body", - "name": "body", - "description": "Managed Network Provisioning Options for a machine learning workspace.", - "schema": { - "$ref": "#/definitions/ManagedNetworkProvisionOptions" - } - } - ], - "responses": { - "200": { - "description": "The request was successful; the request was well-formed and received properly.", - "schema": { - "$ref": "#/definitions/ManagedNetworkProvisionStatus" - } - }, - "202": { - "description": "Accepted", - "headers": { - "Location": { - "description": "URI to poll for asynchronous operation result.", - "type": "string" - }, - "Retry-After": { - "description": "Duration the client should wait between requests, in seconds.", - "type": "integer", - "format": "int32", - "maximum": 600, - "minimum": 10 - } - } - }, - "default": { - "description": "Error", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Provision ManagedNetwork": { - "$ref": "./examples/ManagedNetwork/provision.json" - } - }, - "x-ms-long-running-operation": true, - "x-ms-long-running-operation-options": { - "final-state-via": "location" - } - } - } - }, - "parameters": { - "WorkspaceNameParameter": { - "name": "workspaceName", - "description": "Name of Azure Machine Learning workspace.", - "in": "path", - "type": "string", - "required": true, - "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$", - "x-ms-parameter-location": "method" - }, - "ComputeNameParameter": { - "name": "computeName", - "description": "Name of the Azure Machine Learning compute.", - "in": "path", - "type": "string", - "required": true, - "x-ms-parameter-location": "method" - }, - "AsyncOperationIdParameter": { - "name": "asyncOperationId", - "description": "Identifier of an asynchronous Azure Machine Learning compute operation.", - "in": "path", - "type": "string", - "required": true, - "x-ms-parameter-location": "method" - }, - "LocationParameter": { - "name": "location", - "description": "The name of the Azure location/region.", - "in": "path", - "type": "string", - "required": true, - "x-ms-parameter-location": "method" - }, - "PaginationParameter": { - "in": "query", - "name": "$skip", - "type": "string", - "description": "Continuation token for pagination.", - "required": false, - "x-ms-parameter-location": "method" - }, - "ComputeDefinitionParameter": { - "in": "body", - "name": "parameters", - "description": "Payload with Machine Learning compute definition.", - "required": true, - "schema": { - "$ref": "#/definitions/ComputeResource" - }, - "x-ms-parameter-location": "method" - }, - "ComputeTypeParameter": { - "in": "query", - "name": "compute-type", - "type": "string", - "description": "Type of compute to filter by.", - "required": false, - "x-ms-parameter-location": "method" - }, - "UnderlyingResourceActionParameter": { - "in": "query", - "name": "underlyingResourceAction", - "type": "string", - "description": "Delete the underlying compute if 'Delete', or detach the underlying compute from workspace if 'Detach'.", - "required": true, - "enum": [ - "Delete", - "Detach" - ], - "x-ms-enum": { - "name": "UnderlyingResourceAction", - "modelAsString": true - }, - "x-ms-parameter-location": "method" - }, - "PrivateEndpointConnectionName": { - "name": "privateEndpointConnectionName", - "in": "path", - "required": true, - "type": "string", - "description": "The name of the private endpoint connection associated with the workspace", - "x-ms-parameter-location": "method" - }, - "ConnectionName": { - "name": "connectionName", - "in": "path", - "required": true, - "type": "string", - "description": "Friendly name of the workspace connection", - "x-ms-parameter-location": "method", - "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" - }, - "TargetParameter": { - "in": "query", - "name": "target", - "type": "string", - "description": "Target of the workspace connection.", - "required": false, - "x-ms-parameter-location": "method" - }, - "CategoryParameter": { - "in": "query", - "name": "category", - "type": "string", - "description": "Category of the workspace connection.", - "required": false, - "x-ms-parameter-location": "method" - }, - "RuleName": { - "in": "path", - "name": "ruleName", - "description": "Name of the workspace managed network outbound rule", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" - }, - "WorkspaceForceToPurgeParameter": { - "in": "query", - "name": "forceToPurge", - "description": "Flag to indicate delete is a purge request.", - "type": "boolean", - "default": false, - "x-ms-parameter-location": "method" - } - }, - "definitions": { - "Workspace": { - "type": "object", - "description": "An object that represents a machine learning workspace.", - "allOf": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" - } - ], - "properties": { - "properties": { - "$ref": "#/definitions/WorkspaceProperties", - "description": "The properties of the machine learning workspace.", - "x-ms-client-flatten": true - }, - "identity": { - "$ref": "../../../../../common-types/resource-management/v3/managedidentity.json#/definitions/ManagedServiceIdentity", - "description": "The identity of the resource." - }, - "kind": { - "type": "string" - }, - "location": { - "description": "Specifies the location of the resource.", - "type": "string" - }, - "tags": { - "description": "Contains resource tags defined as key/value pairs.", - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "sku": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Sku", - "description": "The sku of the workspace." - } - } - }, - "WorkspaceProperties": { - "type": "object", - "description": "The properties of a machine learning workspace.", - "properties": { - "workspaceId": { - "description": "The immutable id associated with this workspace.", - "type": "string", - "readOnly": true - }, - "description": { - "description": "The description of this workspace.", - "type": "string" - }, - "friendlyName": { - "description": "The friendly name for this workspace. This name in mutable", - "type": "string" - }, - "keyVault": { - "description": "ARM id of the key vault associated with this workspace. This cannot be changed once the workspace has been created", - "type": "string" - }, - "applicationInsights": { - "description": "ARM id of the application insights associated with this workspace.", - "type": "string" - }, - "containerRegistry": { - "description": "ARM id of the container registry associated with this workspace.", - "type": "string", - "x-nullable": true - }, - "storageAccount": { - "description": "ARM id of the storage account associated with this workspace. This cannot be changed once the workspace has been created", - "type": "string" - }, - "discoveryUrl": { - "description": "Url for the discovery service to identify regional endpoints for machine learning experimentation services", - "type": "string" - }, - "provisioningState": { - "type": "string", - "enum": [ - "Unknown", - "Updating", - "Creating", - "Deleting", - "Succeeded", - "Failed", - "Canceled" - ], - "x-ms-enum": { - "name": "ProvisioningState", - "modelAsString": true - }, - "readOnly": true, - "description": "The current deployment state of workspace resource. The provisioningState is to indicate states for resource provisioning." - }, - "encryption": { - "$ref": "#/definitions/EncryptionProperty", - "description": "The encryption settings of Azure ML workspace." - }, - "hbiWorkspace": { - "type": "boolean", - "description": "The flag to signal HBI data in the workspace and reduce diagnostic data collected by the service", - "default": false - }, - "serviceProvisionedResourceGroup": { - "type": "string", - "description": "The name of the managed resource group created by workspace RP in customer subscription if the workspace is CMK workspace", - "readOnly": true - }, - "privateLinkCount": { - "type": "integer", - "format": "int32", - "description": "Count of private connections in the workspace", - "readOnly": true - }, - "imageBuildCompute": { - "description": "The compute name for image build", - "type": "string" - }, - "allowPublicAccessWhenBehindVnet": { - "type": "boolean", - "description": "The flag to indicate whether to allow public access when behind VNet.", - "default": false - }, - "publicNetworkAccess": { - "type": "string", - "description": "Whether requests from Public Network are allowed.", - "enum": [ - "Enabled", - "Disabled" - ], - "x-ms-enum": { - "modelAsString": true, - "name": "PublicNetworkAccess" - } - }, - "privateEndpointConnections": { - "readOnly": true, - "type": "array", - "items": { - "$ref": "#/definitions/PrivateEndpointConnection" - }, - "x-ms-identifiers": [ - "name" - ], - "description": "The list of private endpoint connections in the workspace." - }, - "serverlessComputeSettings": { - "description": "Settings for serverless compute created in the workspace", - "$ref": "#/definitions/ServerlessComputeSettings" - }, - "sharedPrivateLinkResources": { - "type": "array", - "items": { - "$ref": "#/definitions/SharedPrivateLinkResource" - }, - "x-ms-identifiers": [ - "name" - ], - "description": "The list of shared private link resources in this workspace." - }, - "notebookInfo": { - "readOnly": true, - "$ref": "#/definitions/NotebookResourceInfo", - "description": "The notebook info of Azure ML workspace." - }, - "serviceManagedResourcesSettings": { - "$ref": "#/definitions/ServiceManagedResourcesSettings", - "description": "The service managed resource settings." - }, - "primaryUserAssignedIdentity": { - "description": "The user assigned identity resource id that represents the workspace identity.", - "type": "string" - }, - "tenantId": { - "description": "The tenant id associated with this workspace.", - "type": "string", - "readOnly": true - }, - "storageHnsEnabled": { - "description": "If the storage associated with the workspace has hierarchical namespace(HNS) enabled.", - "type": "boolean", - "readOnly": true - }, - "mlFlowTrackingUri": { - "description": "The URI associated with this workspace that machine learning flow must point at to set up tracking.", - "type": "string", - "readOnly": true - }, - "v1LegacyMode": { - "description": "Enabling v1_legacy_mode may prevent you from using features provided by the v2 API.", - "default": false, - "type": "boolean" - }, - "managedNetwork": { - "$ref": "#/definitions/ManagedNetworkSettings" - }, - "featureStoreSettings": { - "description": "Settings for feature store type workspace.", - "$ref": "#/definitions/FeatureStoreSettings" - }, - "associatedWorkspaces": { - "type": "array", - "items": { - "type": "string" - } - }, - "enableDataIsolation": { - "type": "boolean" - }, - "hubResourceId": { - "type": "string" - }, - "workspaceHubConfig": { - "description": "WorkspaceHub's configuration object.", - "$ref": "#/definitions/WorkspaceHubConfig" - } - } - }, - "WorkspaceUpdateParameters": { - "type": "object", - "description": "The parameters for updating a machine learning workspace.", - "properties": { - "tags": { - "description": "The resource tags for the machine learning workspace.", - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "sku": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Sku", - "description": "The sku of the workspace." - }, - "identity": { - "$ref": "../../../../../common-types/resource-management/v3/managedidentity.json#/definitions/ManagedServiceIdentity", - "description": "The identity of the resource." - }, - "properties": { - "$ref": "#/definitions/WorkspacePropertiesUpdateParameters", - "description": "The properties that the machine learning workspace will be updated with.", - "x-ms-client-flatten": true - } - } - }, - "WorkspacePropertiesUpdateParameters": { - "type": "object", - "description": "The parameters for updating the properties of a machine learning workspace.", - "properties": { - "description": { - "description": "The description of this workspace.", - "type": "string" - }, - "friendlyName": { - "description": "The friendly name for this workspace.", - "type": "string" - }, - "imageBuildCompute": { - "description": "The compute name for image build", - "type": "string" - }, - "serviceManagedResourcesSettings": { - "$ref": "#/definitions/ServiceManagedResourcesSettings", - "description": "The service managed resource settings." - }, - "primaryUserAssignedIdentity": { - "description": "The user assigned identity resource id that represents the workspace identity.", - "type": "string" - }, - "serverlessComputeSettings": { - "description": "Settings for serverless compute created in the workspace", - "$ref": "#/definitions/ServerlessComputeSettings" - }, - "publicNetworkAccess": { - "type": "string", - "description": "Whether requests from Public Network are allowed.", - "enum": [ - "Enabled", - "Disabled" - ], - "x-ms-enum": { - "modelAsString": true, - "name": "PublicNetworkAccess" - } - }, - "applicationInsights": { - "description": "ARM id of the application insights associated with this workspace.", - "type": "string" - }, - "containerRegistry": { - "description": "ARM id of the container registry associated with this workspace.", - "type": "string" - }, - "featureStoreSettings": { - "description": "Settings for feature store type workspace.", - "$ref": "#/definitions/FeatureStoreSettings" - }, - "managedNetwork": { - "$ref": "#/definitions/ManagedNetworkSettings" - }, - "enableDataIsolation": { - "type": "boolean" - }, - "v1LegacyMode": { - "description": "Enabling v1_legacy_mode may prevent you from using features provided by the v2 API.", - "type": "boolean" - }, - "encryption": { - "$ref": "#/definitions/EncryptionUpdateProperties" - } - } - }, - "UsageName": { - "type": "object", - "properties": { - "value": { - "readOnly": true, - "type": "string", - "description": "The name of the resource." - }, - "localizedValue": { - "readOnly": true, - "type": "string", - "description": "The localized name of the resource." - } - }, - "description": "The Usage Names." - }, - "Usage": { - "type": "object", - "properties": { - "id": { - "readOnly": true, - "type": "string", - "description": "Specifies the resource ID." - }, - "amlWorkspaceLocation": { - "readOnly": true, - "type": "string", - "description": "Region of the AML workspace in the id." - }, - "type": { - "readOnly": true, - "type": "string", - "description": "Specifies the resource type." - }, - "unit": { - "readOnly": true, - "type": "string", - "description": "An enum describing the unit of usage measurement.", - "enum": [ - "Count" - ], - "x-ms-enum": { - "name": "UsageUnit", - "modelAsString": true - } - }, - "currentValue": { - "readOnly": true, - "type": "integer", - "format": "int64", - "description": "The current usage of the resource." - }, - "limit": { - "readOnly": true, - "type": "integer", - "format": "int64", - "description": "The maximum permitted usage of the resource." - }, - "name": { - "readOnly": true, - "$ref": "#/definitions/UsageName", - "description": "The name of the type of usage." - } - }, - "description": "Describes AML Resource Usage." - }, - "ListUsagesResult": { - "type": "object", - "properties": { - "value": { - "readOnly": true, - "type": "array", - "items": { - "$ref": "#/definitions/Usage" - }, - "description": "The list of AML resource usages." - }, - "nextLink": { - "readOnly": true, - "type": "string", - "description": "The URI to fetch the next page of AML resource usage information. Call ListNext() with this to fetch the next page of AML resource usage information." - } - }, - "description": "The List Usages operation response." - }, - "VirtualMachineSize": { - "type": "object", - "properties": { - "name": { - "type": "string", - "title": "Virtual Machine size name", - "description": "The name of the virtual machine size.", - "readOnly": true - }, - "family": { - "type": "string", - "title": "Virtual Machine family name", - "description": "The family name of the virtual machine size.", - "readOnly": true - }, - "vCPUs": { - "type": "integer", - "format": "int32", - "title": "Number of vPUs", - "description": "The number of vCPUs supported by the virtual machine size.", - "readOnly": true - }, - "gpus": { - "type": "integer", - "format": "int32", - "title": "Number of gPUs", - "description": "The number of gPUs supported by the virtual machine size.", - "readOnly": true - }, - "osVhdSizeMB": { - "type": "integer", - "format": "int32", - "title": "OS VHD Disk size", - "description": "The OS VHD disk size, in MB, allowed by the virtual machine size.", - "readOnly": true - }, - "maxResourceVolumeMB": { - "type": "integer", - "format": "int32", - "title": "Resource volume size", - "description": "The resource volume size, in MB, allowed by the virtual machine size.", - "readOnly": true - }, - "memoryGB": { - "type": "number", - "format": "double", - "title": "Memory size", - "description": "The amount of memory, in GB, supported by the virtual machine size.", - "readOnly": true - }, - "lowPriorityCapable": { - "type": "boolean", - "title": "Low priority capable", - "description": "Specifies if the virtual machine size supports low priority VMs.", - "readOnly": true - }, - "premiumIO": { - "type": "boolean", - "title": "Premium IO supported", - "description": "Specifies if the virtual machine size supports premium IO.", - "readOnly": true - }, - "estimatedVMPrices": { - "title": "Estimated VM prices", - "description": "The estimated price information for using a VM.", - "$ref": "#/definitions/EstimatedVMPrices" - }, - "supportedComputeTypes": { - "type": "array", - "items": { - "type": "string" - }, - "title": "Supported Compute Types", - "description": "Specifies the compute types supported by the virtual machine size." - } - }, - "description": "Describes the properties of a VM size." - }, - "EstimatedVMPrices": { - "type": "object", - "properties": { - "billingCurrency": { - "type": "string", - "title": "Billing currency", - "description": "Three lettered code specifying the currency of the VM price. Example: USD", - "enum": [ - "USD" - ], - "x-ms-enum": { - "name": "BillingCurrency", - "modelAsString": true - } - }, - "unitOfMeasure": { - "type": "string", - "title": "Unit of time measure", - "description": "The unit of time measurement for the specified VM price. Example: OneHour", - "enum": [ - "OneHour" - ], - "x-ms-enum": { - "name": "UnitOfMeasure", - "modelAsString": true - } - }, - "values": { - "type": "array", - "items": { - "$ref": "#/definitions/EstimatedVMPrice" - }, - "x-ms-identifiers": [], - "title": "List of estimated VM prices.", - "description": "The list of estimated prices for using a VM of a particular OS type, tier, etc." - } - }, - "required": [ - "billingCurrency", - "unitOfMeasure", - "values" - ], - "description": "The estimated price info for using a VM." - }, - "EstimatedVMPrice": { - "type": "object", - "properties": { - "retailPrice": { - "type": "number", - "format": "double", - "title": "Retail price", - "description": "The price charged for using the VM." - }, - "osType": { - "type": "string", - "title": "OS type", - "description": "Operating system type used by the VM.", - "enum": [ - "Linux", - "Windows" - ], - "x-ms-enum": { - "name": "VMPriceOSType", - "modelAsString": true - } - }, - "vmTier": { - "type": "string", - "title": "VM tier", - "description": "The type of the VM.", - "enum": [ - "Standard", - "LowPriority", - "Spot" - ], - "x-ms-enum": { - "name": "VMTier", - "modelAsString": true - } - } - }, - "required": [ - "retailPrice", - "osType", - "vmTier" - ], - "description": "The estimated price info for using a VM of a particular OS type, tier, etc." - }, - "VirtualMachineSizeListResult": { - "type": "object", - "properties": { - "value": { - "type": "array", - "items": { - "$ref": "#/definitions/VirtualMachineSize" - }, - "x-ms-identifiers": [ - "name" - ], - "description": "The list of virtual machine sizes supported by AmlCompute." - } - }, - "description": "The List Virtual Machine size operation response." - }, - "WorkspaceListResult": { - "type": "object", - "description": "The result of a request to list machine learning workspaces.", - "properties": { - "value": { - "description": "The list of machine learning workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning workspaces.", - "type": "array", - "items": { - "$ref": "#/definitions/Workspace" - } - }, - "nextLink": { - "description": "The URI that can be used to request the next list of machine learning workspaces.", - "type": "string" - } - } - }, - "QuotaBaseProperties": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Specifies the resource ID." - }, - "type": { - "type": "string", - "description": "Specifies the resource type." - }, - "limit": { - "type": "integer", - "format": "int64", - "title": "Limit.", - "description": "The maximum permitted quota of the resource." - }, - "unit": { - "type": "string", - "description": "An enum describing the unit of quota measurement.", - "enum": [ - "Count" - ], - "x-ms-enum": { - "name": "QuotaUnit", - "modelAsString": true - } - } - }, - "description": "The properties for Quota update or retrieval." - }, - "QuotaUpdateParameters": { - "type": "object", - "properties": { - "value": { - "description": "The list for update quota.", - "type": "array", - "items": { - "$ref": "#/definitions/QuotaBaseProperties" - } - }, - "location": { - "description": "Region of workspace quota to be updated.", - "type": "string" - } - }, - "description": "Quota update parameters." - }, - "DiagnoseRequestProperties": { - "type": "object", - "properties": { - "udr": { - "description": "Setting for diagnosing user defined routing", - "type": "object", - "additionalProperties": { - "type": "object" - } - }, - "nsg": { - "description": "Setting for diagnosing network security group", - "type": "object", - "additionalProperties": { - "type": "object" - } - }, - "resourceLock": { - "description": "Setting for diagnosing resource lock", - "type": "object", - "additionalProperties": { - "type": "object" - } - }, - "dnsResolution": { - "description": "Setting for diagnosing dns resolution", - "type": "object", - "additionalProperties": { - "type": "object" - } - }, - "storageAccount": { - "description": "Setting for diagnosing dependent storage account", - "type": "object", - "additionalProperties": { - "type": "object" - } - }, - "keyVault": { - "description": "Setting for diagnosing dependent key vault", - "type": "object", - "additionalProperties": { - "type": "object" - } - }, - "containerRegistry": { - "description": "Setting for diagnosing dependent container registry", - "type": "object", - "additionalProperties": { - "type": "object" - } - }, - "applicationInsights": { - "description": "Setting for diagnosing dependent application insights", - "type": "object", - "additionalProperties": { - "type": "object" - } - }, - "others": { - "description": "Setting for diagnosing unclassified category of problems", - "type": "object", - "additionalProperties": { - "type": "object" - } - } - } - }, - "DiagnoseWorkspaceParameters": { - "type": "object", - "description": "Parameters to diagnose a workspace", - "properties": { - "value": { - "description": "Value of Parameters", - "$ref": "#/definitions/DiagnoseRequestProperties" - } - } - }, - "DiagnoseResult": { - "type": "object", - "description": "Result of Diagnose", - "properties": { - "code": { - "description": "Code for workspace setup error", - "type": "string", - "readOnly": true - }, - "level": { - "description": "Level of workspace setup error", - "enum": [ - "Warning", - "Error", - "Information" - ], - "type": "string", - "readOnly": true, - "x-ms-enum": { - "name": "DiagnoseResultLevel", - "modelAsString": true - } - }, - "message": { - "description": "Message of workspace setup error", - "type": "string", - "readOnly": true - } - } - }, - "DiagnoseResponseResult": { - "type": "object", - "properties": { - "value": { - "type": "object", - "properties": { - "userDefinedRouteResults": { - "type": "array", - "items": { - "$ref": "#/definitions/DiagnoseResult" - }, - "x-ms-identifiers": [ - "message" - ] - }, - "networkSecurityRuleResults": { - "type": "array", - "items": { - "$ref": "#/definitions/DiagnoseResult" - }, - "x-ms-identifiers": [ - "message" - ] - }, - "resourceLockResults": { - "type": "array", - "items": { - "$ref": "#/definitions/DiagnoseResult" - }, - "x-ms-identifiers": [ - "message" - ] - }, - "dnsResolutionResults": { - "type": "array", - "items": { - "$ref": "#/definitions/DiagnoseResult" - }, - "x-ms-identifiers": [ - "message" - ] - }, - "storageAccountResults": { - "type": "array", - "items": { - "$ref": "#/definitions/DiagnoseResult" - }, - "x-ms-identifiers": [ - "message" - ] - }, - "keyVaultResults": { - "type": "array", - "items": { - "$ref": "#/definitions/DiagnoseResult" - }, - "x-ms-identifiers": [ - "message" - ] - }, - "containerRegistryResults": { - "type": "array", - "items": { - "$ref": "#/definitions/DiagnoseResult" - }, - "x-ms-identifiers": [ - "message" - ] - }, - "applicationInsightsResults": { - "type": "array", - "items": { - "$ref": "#/definitions/DiagnoseResult" - }, - "x-ms-identifiers": [ - "message" - ] - }, - "otherResults": { - "type": "array", - "items": { - "$ref": "#/definitions/DiagnoseResult" - }, - "x-ms-identifiers": [ - "message" - ] - } - } - } - } - }, - "UpdateWorkspaceQuotasResult": { - "type": "object", - "properties": { - "value": { - "description": "The list of workspace quota update result.", - "items": { - "$ref": "#/definitions/UpdateWorkspaceQuotas" - }, - "readOnly": true, - "type": "array" - }, - "nextLink": { - "description": "The URI to fetch the next page of workspace quota update result. Call ListNext() with this to fetch the next page of Workspace Quota update result.", - "readOnly": true, - "type": "string" - } - }, - "description": "The result of update workspace quota." - }, - "UpdateWorkspaceQuotas": { - "type": "object", - "properties": { - "id": { - "readOnly": true, - "type": "string", - "description": "Specifies the resource ID." - }, - "type": { - "readOnly": true, - "type": "string", - "description": "Specifies the resource type." - }, - "limit": { - "type": "integer", - "format": "int64", - "title": "Limit.", - "description": "The maximum permitted quota of the resource." - }, - "unit": { - "readOnly": true, - "type": "string", - "description": "An enum describing the unit of quota measurement.", - "enum": [ - "Count" - ], - "x-ms-enum": { - "name": "QuotaUnit", - "modelAsString": true - } - }, - "status": { - "type": "string", - "readOnly": false, - "title": "Update Workspace Quota Status.", - "description": "Status of update workspace quota.", - "enum": [ - "Undefined", - "Success", - "Failure", - "InvalidQuotaBelowClusterMinimum", - "InvalidQuotaExceedsSubscriptionLimit", - "InvalidVMFamilyName", - "OperationNotSupportedForSku", - "OperationNotEnabledForRegion" - ], - "x-ms-enum": { - "name": "status", - "modelAsString": true - } - } - }, - "description": "The properties for update Quota response." - }, - "ResourceName": { - "type": "object", - "properties": { - "value": { - "readOnly": true, - "type": "string", - "description": "The name of the resource." - }, - "localizedValue": { - "readOnly": true, - "type": "string", - "description": "The localized name of the resource." - } - }, - "description": "The Resource Name." - }, - "ResourceQuota": { - "type": "object", - "properties": { - "id": { - "readOnly": true, - "type": "string", - "description": "Specifies the resource ID." - }, - "amlWorkspaceLocation": { - "readOnly": true, - "type": "string", - "description": "Region of the AML workspace in the id." - }, - "type": { - "readOnly": true, - "type": "string", - "description": "Specifies the resource type." - }, - "name": { - "$ref": "#/definitions/ResourceName", - "description": "Name of the resource.", - "readOnly": true - }, - "limit": { - "readOnly": true, - "type": "integer", - "format": "int64", - "title": "Limit.", - "description": "The maximum permitted quota of the resource." - }, - "unit": { - "readOnly": true, - "type": "string", - "description": "An enum describing the unit of quota measurement.", - "enum": [ - "Count" - ], - "x-ms-enum": { - "name": "QuotaUnit", - "modelAsString": true - } - } - }, - "description": "The quota assigned to a resource." - }, - "ListWorkspaceQuotas": { - "type": "object", - "properties": { - "value": { - "description": "The list of Workspace Quotas by VM Family", - "items": { - "$ref": "#/definitions/ResourceQuota" - }, - "readOnly": true, - "type": "array" - }, - "nextLink": { - "description": "The URI to fetch the next page of workspace quota information by VM Family. Call ListNext() with this to fetch the next page of Workspace Quota information.", - "readOnly": true, - "type": "string" - } - }, - "description": "The List WorkspaceQuotasByVMFamily operation response." - }, - "ResourceId": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of the resource" - } - }, - "required": [ - "id" - ], - "description": "Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet.", - "x-ms-azure-resource": true - }, - "ListWorkspaceKeysResult": { - "type": "object", - "properties": { - "userStorageKey": { - "readOnly": true, - "type": "string", - "x-ms-secret": true - }, - "userStorageResourceId": { - "readOnly": true, - "type": "string" - }, - "appInsightsInstrumentationKey": { - "readOnly": true, - "type": "string", - "x-ms-secret": true - }, - "containerRegistryCredentials": { - "readOnly": true, - "$ref": "#/definitions/RegistryListCredentialsResult" - }, - "notebookAccessKeys": { - "readOnly": true, - "$ref": "#/definitions/ListNotebookKeysResult" - } - } - }, - "NotebookAccessTokenResult": { - "type": "object", - "properties": { - "notebookResourceId": { - "readOnly": true, - "type": "string" - }, - "hostName": { - "readOnly": true, - "type": "string" - }, - "publicDns": { - "readOnly": true, - "type": "string" - }, - "accessToken": { - "readOnly": true, - "type": "string", - "x-ms-secret": true - }, - "tokenType": { - "readOnly": true, - "type": "string" - }, - "expiresIn": { - "readOnly": true, - "type": "integer", - "format": "int32" - }, - "refreshToken": { - "readOnly": true, - "type": "string", - "x-ms-secret": true - }, - "scope": { - "readOnly": true, - "type": "string" - } - } - }, - "RegistryListCredentialsResult": { - "type": "object", - "properties": { - "location": { - "readOnly": true, - "type": "string" - }, - "username": { - "readOnly": true, - "type": "string" - }, - "passwords": { - "type": "array", - "items": { - "$ref": "#/definitions/Password" - }, - "x-ms-identifiers": [ - "name" - ] - } - } - }, - "Password": { - "type": "object", - "properties": { - "name": { - "readOnly": true, - "type": "string" - }, - "value": { - "readOnly": true, - "type": "string" - } - } - }, - "PaginatedComputeResourcesList": { - "type": "object", - "description": "Paginated list of Machine Learning compute objects wrapped in ARM resource envelope.", - "properties": { - "value": { - "type": "array", - "description": "An array of Machine Learning compute objects wrapped in ARM resource envelope.", - "items": { - "$ref": "#/definitions/ComputeResource" - } - }, - "nextLink": { - "type": "string", - "description": "A continuation link (absolute URI) to the next page of results in the list." - } - } - }, - "ComputeResource": { - "type": "object", - "description": "Machine Learning compute object wrapped into ARM resource envelope.", - "allOf": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" - }, - { - "$ref": "#/definitions/ComputeResourceSchema" - } - ], - "properties": { - "identity": { - "$ref": "../../../../../common-types/resource-management/v3/managedidentity.json#/definitions/ManagedServiceIdentity", - "description": "The identity of the resource." - }, - "location": { - "description": "Specifies the location of the resource.", - "type": "string" - }, - "tags": { - "description": "Contains resource tags defined as key/value pairs.", - "type": "object", - "x-nullable": true, - "additionalProperties": { - "type": "string" - } - }, - "sku": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Sku", - "description": "The sku of the workspace.", - "x-nullable": true - } - } - }, - "ComputeResourceSchema": { - "type": "object", - "properties": { - "properties": { - "description": "Compute properties", - "$ref": "#/definitions/Compute" - } - } - }, - "Compute": { - "type": "object", - "description": "Machine Learning compute object.", - "discriminator": "computeType", - "properties": { - "computeType": { - "description": "The type of compute", - "$ref": "#/definitions/ComputeType" - }, - "computeLocation": { - "description": "Location for the underlying compute", - "type": "string", - "x-ms-mutability": [ - "read", - "create" - ] - }, - "provisioningState": { - "type": "string", - "description": "The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed.", - "enum": [ - "Unknown", - "Updating", - "Creating", - "Deleting", - "Succeeded", - "Failed", - "Canceled" - ], - "x-ms-enum": { - "name": "ProvisioningState", - "modelAsString": true - }, - "readOnly": true - }, - "description": { - "type": "string", - "description": "The description of the Machine Learning compute.", - "x-nullable": true - }, - "createdOn": { - "type": "string", - "readOnly": true, - "format": "date-time", - "description": "The time at which the compute was created." - }, - "modifiedOn": { - "type": "string", - "readOnly": true, - "format": "date-time", - "description": "The time at which the compute was last modified." - }, - "resourceId": { - "type": "string", - "description": "ARM resource id of the underlying compute", - "x-nullable": true - }, - "provisioningErrors": { - "type": "array", - "description": "Errors during provisioning", - "items": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - }, - "x-ms-identifiers": [ - "/error/code" - ], - "readOnly": true, - "x-nullable": true - }, - "isAttachedCompute": { - "type": "boolean", - "description": "Indicating whether the compute was provisioned by user and brought from outside if true, or machine learning service provisioned it if false.", - "readOnly": true - }, - "disableLocalAuth": { - "type": "boolean", - "description": "Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication.", - "x-ms-mutability": [ - "read", - "create" - ] - } - }, - "required": [ - "computeType" - ] - }, - "AKS": { - "description": "A Machine Learning compute based on AKS.", - "allOf": [ - { - "$ref": "#/definitions/Compute" - }, - { - "$ref": "#/definitions/AKSSchema" - } - ], - "x-ms-discriminator-value": "AKS" - }, - "AKSSchema": { - "type": "object", - "properties": { - "properties": { - "type": "object", - "description": "AKS properties", - "properties": { - "clusterFqdn": { - "description": "Cluster full qualified domain name", - "type": "string", - "x-nullable": true - }, - "systemServices": { - "type": "array", - "description": "System services", - "items": { - "$ref": "#/definitions/SystemService" - }, - "x-ms-identifiers": [ - "publicIpAddress" - ], - "readOnly": true, - "x-nullable": true - }, - "agentCount": { - "description": "Number of agents", - "type": "integer", - "format": "int32", - "minimum": 0, - "x-nullable": true - }, - "agentVmSize": { - "description": "Agent virtual machine size", - "type": "string", - "x-nullable": true - }, - "clusterPurpose": { - "description": "Intended usage of the cluster", - "type": "string", - "default": "FastProd", - "enum": [ - "FastProd", - "DenseProd", - "DevTest" - ], - "x-ms-enum": { - "name": "ClusterPurpose", - "modelAsString": true - } - }, - "sslConfiguration": { - "description": "SSL configuration", - "$ref": "#/definitions/SslConfiguration", - "x-nullable": true - }, - "aksNetworkingConfiguration": { - "description": "AKS networking configuration for vnet", - "$ref": "#/definitions/AksNetworkingConfiguration", - "x-nullable": true - }, - "loadBalancerType": { - "description": "Load Balancer Type", - "type": "string", - "default": "PublicIp", - "enum": [ - "PublicIp", - "InternalLoadBalancer" - ], - "x-ms-enum": { - "name": "LoadBalancerType", - "modelAsString": true - } - }, - "loadBalancerSubnet": { - "description": "Load Balancer Subnet", - "type": "string", - "x-nullable": true - } - } - } - } - }, - "Kubernetes": { - "description": "A Machine Learning compute based on Kubernetes Compute.", - "allOf": [ - { - "$ref": "#/definitions/Compute" - }, - { - "$ref": "#/definitions/KubernetesSchema" - } - ], - "x-ms-discriminator-value": "Kubernetes" - }, - "KubernetesSchema": { - "type": "object", - "description": "Kubernetes Compute Schema", - "properties": { - "properties": { - "description": "Properties of Kubernetes", - "$ref": "#/definitions/KubernetesProperties" - } - } - }, - "KubernetesProperties": { - "type": "object", - "description": "Kubernetes properties", - "properties": { - "relayConnectionString": { - "description": "Relay connection string.", - "type": "string", - "x-ms-secret": true, - "x-nullable": true - }, - "serviceBusConnectionString": { - "description": "ServiceBus connection string.", - "type": "string", - "x-ms-secret": true, - "x-nullable": true - }, - "extensionPrincipalId": { - "description": "Extension principal-id.", - "type": "string", - "x-nullable": true - }, - "extensionInstanceReleaseTrain": { - "description": "Extension instance release train.", - "type": "string" - }, - "vcName": { - "description": "VC name.", - "type": "string" - }, - "namespace": { - "description": "Compute namespace", - "type": "string", - "default": "default" - }, - "defaultInstanceType": { - "description": "Default instance type", - "type": "string" - }, - "instanceTypes": { - "description": "Instance Type Schema", - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/InstanceTypeSchema" - } - } - } - }, - "AmlComputeProperties": { - "type": "object", - "description": "AML Compute properties", - "properties": { - "osType": { - "description": "Compute OS Type", - "type": "string", - "default": "Linux", - "enum": [ - "Linux", - "Windows" - ], - "x-ms-enum": { - "name": "OsType", - "modelAsString": true - } - }, - "vmSize": { - "description": "Virtual Machine Size", - "type": "string" - }, - "vmPriority": { - "description": "Virtual Machine priority", - "type": "string", - "enum": [ - "Dedicated", - "LowPriority" - ], - "x-ms-enum": { - "name": "VmPriority", - "modelAsString": true - } - }, - "virtualMachineImage": { - "description": "Virtual Machine image for AML Compute - windows only", - "$ref": "#/definitions/VirtualMachineImage", - "x-nullable": true - }, - "isolatedNetwork": { - "description": "Network is isolated or not", - "type": "boolean" - }, - "scaleSettings": { - "description": "Scale settings for AML Compute", - "$ref": "#/definitions/ScaleSettings" - }, - "userAccountCredentials": { - "title": "User account credentials.", - "description": "Credentials for an administrator user account that will be created on each compute node.", - "$ref": "#/definitions/UserAccountCredentials", - "x-nullable": true - }, - "subnet": { - "title": "Subnet.", - "description": "Virtual network subnet resource ID the compute nodes belong to.", - "$ref": "#/definitions/ResourceId", - "x-nullable": true - }, - "remoteLoginPortPublicAccess": { - "type": "string", - "default": "NotSpecified", - "title": "Close remote Login Access Port", - "description": "State of the public SSH port. Possible values are: Disabled - Indicates that the public ssh port is closed on all nodes of the cluster. Enabled - Indicates that the public ssh port is open on all nodes of the cluster. NotSpecified - Indicates that the public ssh port is closed on all nodes of the cluster if VNet is defined, else is open all public nodes. It can be default only during cluster creation time, after creation it will be either enabled or disabled.", - "enum": [ - "Enabled", - "Disabled", - "NotSpecified" - ], - "x-ms-enum": { - "name": "remoteLoginPortPublicAccess", - "modelAsString": true - } - }, - "allocationState": { - "type": "string", - "readOnly": true, - "title": "Allocation state.", - "description": "Allocation state of the compute. Possible values are: steady - Indicates that the compute is not resizing. There are no changes to the number of compute nodes in the compute in progress. A compute enters this state when it is created and when no operations are being performed on the compute to change the number of compute nodes. resizing - Indicates that the compute is resizing; that is, compute nodes are being added to or removed from the compute.", - "enum": [ - "Steady", - "Resizing" - ], - "x-ms-enum": { - "name": "AllocationState", - "modelAsString": true - } - }, - "allocationStateTransitionTime": { - "type": "string", - "readOnly": true, - "format": "date-time", - "title": "Allocation state transition time.", - "description": "The time at which the compute entered its current allocation state." - }, - "errors": { - "readOnly": true, - "title": "Errors.", - "description": "Collection of errors encountered by various compute nodes during node setup.", - "type": "array", - "x-nullable": true, - "items": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - }, - "x-ms-identifiers": [ - "/error/code" - ] - }, - "currentNodeCount": { - "type": "integer", - "readOnly": true, - "format": "int32", - "title": "Current node count.", - "description": "The number of compute nodes currently assigned to the compute.", - "x-nullable": true - }, - "targetNodeCount": { - "type": "integer", - "readOnly": true, - "format": "int32", - "title": "Target node count.", - "description": "The target number of compute nodes for the compute. If the allocationState is resizing, this property denotes the target node count for the ongoing resize operation. If the allocationState is steady, this property denotes the target node count for the previous resize operation.", - "x-nullable": true - }, - "nodeStateCounts": { - "title": "Node state counts.", - "description": "Counts of various node states on the compute.", - "readOnly": true, - "$ref": "#/definitions/NodeStateCounts", - "x-nullable": true - }, - "enableNodePublicIp": { - "type": "boolean", - "default": true, - "title": "Enable node public IP.", - "description": "Enable or disable node public IP address provisioning. Possible values are: Possible values are: true - Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will have a private endpoint and no public IPs.", - "x-nullable": true - }, - "propertyBag": { - "type": "object", - "description": "A property bag containing additional properties.", - "x-nullable": true - } - } - }, - "AmlCompute": { - "description": "An Azure Machine Learning compute.", - "allOf": [ - { - "$ref": "#/definitions/Compute" - }, - { - "$ref": "#/definitions/AmlComputeSchema" - } - ], - "x-ms-discriminator-value": "AmlCompute" - }, - "AmlComputeSchema": { - "type": "object", - "description": "Properties(top level) of AmlCompute", - "properties": { - "properties": { - "description": "Properties of AmlCompute", - "$ref": "#/definitions/AmlComputeProperties" - } - } - }, - "ComputeInstanceProperties": { - "description": "Compute Instance properties", - "type": "object", - "properties": { - "vmSize": { - "description": "Virtual Machine Size", - "type": "string" - }, - "subnet": { - "title": "Subnet.", - "description": "Virtual network subnet resource ID the compute nodes belong to.", - "$ref": "#/definitions/ResourceId", - "x-nullable": true - }, - "applicationSharingPolicy": { - "type": "string", - "default": "Shared", - "title": "Sharing policy for applications on this compute instance", - "description": "Policy for sharing applications on this compute instance among users of parent workspace. If Personal, only the creator can access applications on this compute instance. When Shared, any workspace user can access applications on this instance depending on his/her assigned role.", - "enum": [ - "Personal", - "Shared" - ], - "x-ms-enum": { - "name": "applicationSharingPolicy", - "modelAsString": true - } - }, - "sshSettings": { - "description": "Specifies policy and settings for SSH access.", - "$ref": "#/definitions/ComputeInstanceSshSettings", - "x-nullable": true - }, - "customServices": { - "type": "array", - "description": "List of Custom Services added to the compute.", - "x-nullable": true, - "items": { - "$ref": "#/definitions/CustomService" - }, - "x-ms-identifiers": [ - "name" - ] - }, - "osImageMetadata": { - "readOnly": true, - "description": "Returns metadata about the operating system image for this compute instance.", - "$ref": "#/definitions/ImageMetadata" - }, - "connectivityEndpoints": { - "readOnly": true, - "description": "Describes all connectivity endpoints available for this ComputeInstance.", - "$ref": "#/definitions/ComputeInstanceConnectivityEndpoints" - }, - "applications": { - "type": "array", - "readOnly": true, - "description": "Describes available applications and their endpoints on this ComputeInstance.", - "items": { - "$ref": "#/definitions/ComputeInstanceApplication" - }, - "x-ms-identifiers": [ - "displayName" - ] - }, - "createdBy": { - "readOnly": true, - "description": "Describes information on user who created this ComputeInstance.", - "$ref": "#/definitions/ComputeInstanceCreatedBy" - }, - "errors": { - "readOnly": true, - "title": "Errors.", - "description": "Collection of errors encountered on this ComputeInstance.", - "type": "array", - "items": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - }, - "x-ms-identifiers": [ - "/error/code" - ] - }, - "state": { - "description": "The current state of this ComputeInstance.", - "$ref": "#/definitions/ComputeInstanceState", - "readOnly": true - }, - "computeInstanceAuthorizationType": { - "type": "string", - "title": "Compute Instance Authorization type.", - "description": "The Compute Instance Authorization type. Available values are personal (default).", - "default": "personal", - "x-nullable": true, - "enum": [ - "personal" - ], - "x-ms-enum": { - "name": "ComputeInstanceAuthorizationType", - "modelAsString": true - } - }, - "personalComputeInstanceSettings": { - "title": "Personal Compute Instance settings.", - "description": "Settings for a personal compute instance.", - "$ref": "#/definitions/PersonalComputeInstanceSettings", - "x-nullable": true - }, - "setupScripts": { - "description": "Details of customized scripts to execute for setting up the cluster.", - "$ref": "#/definitions/SetupScripts", - "x-nullable": true - }, - "lastOperation": { - "description": "The last operation on ComputeInstance.", - "$ref": "#/definitions/ComputeInstanceLastOperation", - "readOnly": true, - "x-nullable": true - }, - "schedules": { - "description": "The list of schedules to be applied on the computes.", - "$ref": "#/definitions/ComputeSchedules", - "x-nullable": true - }, - "enableNodePublicIp": { - "type": "boolean", - "title": "Enable node public IP.", - "description": "Enable or disable node public IP address provisioning. Possible values are: Possible values are: true - Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will have a private endpoint and no public IPs." - }, - "containers": { - "type": "array", - "readOnly": true, - "description": "Describes informations of containers on this ComputeInstance.", - "x-nullable": true, - "items": { - "$ref": "#/definitions/ComputeInstanceContainer" - }, - "x-ms-identifiers": [ - "name" - ] - }, - "dataDisks": { - "type": "array", - "readOnly": true, - "description": "Describes informations of dataDisks on this ComputeInstance.", - "x-nullable": true, - "items": { - "$ref": "#/definitions/ComputeInstanceDataDisk" - }, - "x-ms-identifiers": [] - }, - "dataMounts": { - "type": "array", - "readOnly": true, - "description": "Describes informations of dataMounts on this ComputeInstance.", - "x-nullable": true, - "items": { - "$ref": "#/definitions/ComputeInstanceDataMount" - }, - "x-ms-identifiers": [] - }, - "versions": { - "description": "ComputeInstance version.", - "$ref": "#/definitions/ComputeInstanceVersion", - "readOnly": true - } - } - }, - "ComputeInstance": { - "description": "An Azure Machine Learning compute instance.", - "allOf": [ - { - "$ref": "#/definitions/Compute" - }, - { - "$ref": "#/definitions/ComputeInstanceSchema" - } - ], - "x-ms-discriminator-value": "ComputeInstance" - }, - "ComputeInstanceSchema": { - "type": "object", - "description": "Properties(top level) of ComputeInstance", - "properties": { - "properties": { - "description": "Properties of ComputeInstance", - "$ref": "#/definitions/ComputeInstanceProperties" - } - } - }, - "VirtualMachine": { - "description": "A Machine Learning compute based on Azure Virtual Machines.", - "allOf": [ - { - "$ref": "#/definitions/Compute" - }, - { - "$ref": "#/definitions/VirtualMachineSchema" - } - ], - "x-ms-discriminator-value": "VirtualMachine" - }, - "VirtualMachineSchema": { - "type": "object", - "properties": { - "properties": { - "type": "object", - "properties": { - "virtualMachineSize": { - "description": "Virtual Machine size", - "type": "string" - }, - "sshPort": { - "description": "Port open for ssh connections.", - "type": "integer", - "format": "int32" - }, - "notebookServerPort": { - "description": "Notebook server port open for ssh connections.", - "type": "integer", - "format": "int32" - }, - "address": { - "description": "Public IP address of the virtual machine.", - "type": "string" - }, - "administratorAccount": { - "description": "Admin credentials for virtual machine", - "$ref": "#/definitions/VirtualMachineSshCredentials" - }, - "isNotebookInstanceCompute": { - "description": "Indicates whether this compute will be used for running notebooks.", - "type": "boolean" - } - } - } - } - }, - "HDInsightProperties": { - "type": "object", - "description": "HDInsight compute properties", - "properties": { - "sshPort": { - "description": "Port open for ssh connections on the master node of the cluster.", - "type": "integer", - "format": "int32" + "amlWorkspaceLocation": { + "readOnly": true, + "type": "string", + "description": "Region of the AML workspace in the id." }, - "address": { - "description": "Public IP address of the master node of the cluster.", - "type": "string" + "type": { + "readOnly": true, + "type": "string", + "description": "Specifies the resource type." }, - "administratorAccount": { - "description": "Admin credentials for master node of the cluster", - "$ref": "#/definitions/VirtualMachineSshCredentials", - "x-nullable": true - } - } - }, - "HDInsight": { - "description": "A HDInsight compute.", - "allOf": [ - { - "$ref": "#/definitions/Compute" + "unit": { + "readOnly": true, + "type": "string", + "description": "An enum describing the unit of usage measurement.", + "enum": [ + "Count" + ], + "x-ms-enum": { + "name": "UsageUnit", + "modelAsString": true + } }, - { - "$ref": "#/definitions/HDInsightSchema" - } - ], - "x-ms-discriminator-value": "HDInsight" - }, - "HDInsightSchema": { - "type": "object", - "properties": { - "properties": { - "$ref": "#/definitions/HDInsightProperties" - } - } - }, - "DataFactory": { - "description": "A DataFactory compute.", - "allOf": [ - { - "$ref": "#/definitions/Compute" - } - ], - "x-ms-discriminator-value": "DataFactory" - }, - "DatabricksProperties": { - "type": "object", - "description": "Properties of Databricks", - "properties": { - "databricksAccessToken": { - "description": "Databricks access token", - "type": "string" + "currentValue": { + "readOnly": true, + "type": "integer", + "format": "int64", + "description": "The current usage of the resource." }, - "workspaceUrl": { - "description": "Workspace Url", - "type": "string" - } - } - }, - "Databricks": { - "description": "A DataFactory compute.", - "allOf": [ - { - "$ref": "#/definitions/Compute" + "limit": { + "readOnly": true, + "type": "integer", + "format": "int64", + "description": "The maximum permitted usage of the resource." }, - { - "$ref": "#/definitions/DatabricksSchema" + "name": { + "readOnly": true, + "$ref": "#/definitions/UsageName", + "description": "The name of the type of usage." } - ], - "x-ms-discriminator-value": "Databricks" + }, + "description": "Describes AML Resource Usage." }, - "DatabricksSchema": { + "ListUsagesResult": { "type": "object", "properties": { - "properties": { - "$ref": "#/definitions/DatabricksProperties" - } - } - }, - "DataLakeAnalytics": { - "description": "A DataLakeAnalytics compute.", - "allOf": [ - { - "$ref": "#/definitions/Compute" + "value": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/Usage" + }, + "description": "The list of AML resource usages." }, - { - "$ref": "#/definitions/DataLakeAnalyticsSchema" - } - ], - "x-ms-discriminator-value": "DataLakeAnalytics" - }, - "DataLakeAnalyticsSchema": { - "type": "object", - "properties": { - "properties": { - "type": "object", - "properties": { - "dataLakeStoreAccountName": { - "description": "DataLake Store Account Name", - "type": "string" - } - } - } - } - }, - "SynapseSpark": { - "type": "object", - "description": "A SynapseSpark compute.", - "properties": { - "properties": { - "type": "object", - "properties": { - "autoScaleProperties": { - "description": "Auto scale properties.", - "$ref": "#/definitions/AutoScaleProperties" - }, - "autoPauseProperties": { - "description": "Auto pause properties.", - "$ref": "#/definitions/AutoPauseProperties" - }, - "sparkVersion": { - "description": "Spark version.", - "type": "string" - }, - "nodeCount": { - "description": "The number of compute nodes currently assigned to the compute.", - "type": "integer", - "format": "int32" - }, - "nodeSize": { - "description": "Node size.", - "type": "string" - }, - "nodeSizeFamily": { - "description": "Node size family.", - "type": "string" - }, - "subscriptionId": { - "description": "Azure subscription identifier.", - "type": "string" - }, - "resourceGroup": { - "description": "Name of the resource group in which workspace is located.", - "type": "string" - }, - "workspaceName": { - "description": "Name of Azure Machine Learning workspace.", - "type": "string" - }, - "poolName": { - "description": "Pool name.", - "type": "string" - } - } + "nextLink": { + "readOnly": true, + "type": "string", + "description": "The URI to fetch the next page of AML resource usage information. Call ListNext() with this to fetch the next page of AML resource usage information." } }, - "allOf": [ - { - "$ref": "#/definitions/Compute" - } - ], - "x-ms-discriminator-value": "SynapseSpark" + "description": "The List Usages operation response." }, - "SystemService": { + "VirtualMachineSize": { "type": "object", - "description": "A system service running on a compute.", "properties": { - "systemServiceType": { - "description": "The type of this system service.", - "readOnly": true, - "type": "string" + "name": { + "type": "string", + "title": "Virtual Machine size name", + "description": "The name of the virtual machine size.", + "readOnly": true }, - "publicIpAddress": { + "family": { "type": "string", - "description": "Public IP address", + "title": "Virtual Machine family name", + "description": "The family name of the virtual machine size.", "readOnly": true }, - "version": { - "description": "The version for this type.", - "readOnly": true, - "type": "string" + "vCPUs": { + "type": "integer", + "format": "int32", + "title": "Number of vPUs", + "description": "The number of vCPUs supported by the virtual machine size.", + "readOnly": true + }, + "gpus": { + "type": "integer", + "format": "int32", + "title": "Number of gPUs", + "description": "The number of gPUs supported by the virtual machine size.", + "readOnly": true + }, + "osVhdSizeMB": { + "type": "integer", + "format": "int32", + "title": "OS VHD Disk size", + "description": "The OS VHD disk size, in MB, allowed by the virtual machine size.", + "readOnly": true + }, + "maxResourceVolumeMB": { + "type": "integer", + "format": "int32", + "title": "Resource volume size", + "description": "The resource volume size, in MB, allowed by the virtual machine size.", + "readOnly": true + }, + "memoryGB": { + "type": "number", + "format": "double", + "title": "Memory size", + "description": "The amount of memory, in GB, supported by the virtual machine size.", + "readOnly": true + }, + "lowPriorityCapable": { + "type": "boolean", + "title": "Low priority capable", + "description": "Specifies if the virtual machine size supports low priority VMs.", + "readOnly": true + }, + "premiumIO": { + "type": "boolean", + "title": "Premium IO supported", + "description": "Specifies if the virtual machine size supports premium IO.", + "readOnly": true + }, + "estimatedVMPrices": { + "title": "Estimated VM prices", + "description": "The estimated price information for using a VM.", + "$ref": "#/definitions/EstimatedVMPrices" + }, + "supportedComputeTypes": { + "type": "array", + "items": { + "type": "string" + }, + "title": "Supported Compute Types", + "description": "Specifies the compute types supported by the virtual machine size." } - } + }, + "description": "Describes the properties of a VM size." }, - "SslConfiguration": { + "EstimatedVMPrices": { "type": "object", - "description": "The ssl configuration for scoring", "properties": { - "status": { - "description": "Enable or disable ssl for scoring", + "billingCurrency": { "type": "string", + "title": "Billing currency", + "description": "Three lettered code specifying the currency of the VM price. Example: USD", "enum": [ - "Disabled", - "Enabled", - "Auto" + "USD" ], "x-ms-enum": { - "name": "SslConfigStatus", + "name": "BillingCurrency", "modelAsString": true } }, - "cert": { - "description": "Cert data", + "unitOfMeasure": { "type": "string", - "x-ms-secret": true, - "x-nullable": true + "title": "Unit of time measure", + "description": "The unit of time measurement for the specified VM price. Example: OneHour", + "enum": [ + "OneHour" + ], + "x-ms-enum": { + "name": "UnitOfMeasure", + "modelAsString": true + } }, - "key": { - "description": "Key data", - "type": "string", - "x-ms-secret": true, - "x-nullable": true + "values": { + "type": "array", + "items": { + "$ref": "#/definitions/EstimatedVMPrice" + }, + "x-ms-identifiers": [], + "title": "List of estimated VM prices.", + "description": "The list of estimated prices for using a VM of a particular OS type, tier, etc." + } + }, + "required": [ + "billingCurrency", + "unitOfMeasure", + "values" + ], + "description": "The estimated price info for using a VM." + }, + "EstimatedVMPrice": { + "type": "object", + "properties": { + "retailPrice": { + "type": "number", + "format": "double", + "title": "Retail price", + "description": "The price charged for using the VM." }, - "cname": { - "description": "CNAME of the cert", + "osType": { "type": "string", - "x-nullable": true + "title": "OS type", + "description": "Operating system type used by the VM.", + "enum": [ + "Linux", + "Windows" + ], + "x-ms-enum": { + "name": "VMPriceOSType", + "modelAsString": true + } }, - "leafDomainLabel": { - "description": "Leaf domain label of public endpoint", + "vmTier": { "type": "string", - "x-nullable": true - }, - "overwriteExistingDomain": { - "description": "Indicates whether to overwrite existing domain label.", - "type": "boolean" + "title": "VM tier", + "description": "The type of the VM.", + "enum": [ + "Standard", + "LowPriority", + "Spot" + ], + "x-ms-enum": { + "name": "VMTier", + "modelAsString": true + } } - } + }, + "required": [ + "retailPrice", + "osType", + "vmTier" + ], + "description": "The estimated price info for using a VM of a particular OS type, tier, etc." }, - "AksNetworkingConfiguration": { + "VirtualMachineSizeListResult": { "type": "object", - "description": "Advance configuration for AKS networking", "properties": { - "subnetId": { - "description": "Virtual network subnet resource ID the compute nodes belong to", - "type": "string" - }, - "serviceCidr": { - "pattern": "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$", - "description": "A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges.", - "type": "string" - }, - "dnsServiceIP": { - "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", - "description": "An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr.", - "type": "string" - }, - "dockerBridgeCidr": { - "pattern": "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$", - "description": "A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range.", - "type": "string" + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/VirtualMachineSize" + }, + "x-ms-identifiers": [ + "name" + ], + "description": "The list of virtual machine sizes supported by AmlCompute." } - } + }, + "description": "The List Virtual Machine size operation response." }, - "UserAccountCredentials": { + "QuotaBaseProperties": { "type": "object", "properties": { - "adminUserName": { + "id": { "type": "string", - "title": "User name.", - "description": "Name of the administrator user account which can be used to SSH to nodes." + "description": "Specifies the resource ID." }, - "adminUserSshPublicKey": { + "type": { "type": "string", - "x-ms-secret": true, - "title": "SSH public key.", - "description": "SSH public key of the administrator user account." + "description": "Specifies the resource type." }, - "adminUserPassword": { + "limit": { + "type": "integer", + "format": "int64", + "title": "Limit.", + "description": "The maximum permitted quota of the resource." + }, + "unit": { "type": "string", - "x-ms-secret": true, - "title": "Password.", - "description": "Password of the administrator user account." + "description": "An enum describing the unit of quota measurement.", + "enum": [ + "Count" + ], + "x-ms-enum": { + "name": "QuotaUnit", + "modelAsString": true + } } }, - "required": [ - "adminUserName" - ], - "description": "Settings for user account that gets created on each on the nodes of a compute." + "description": "The properties for Quota update or retrieval." }, - "ScaleSettings": { + "QuotaUpdateParameters": { "type": "object", - "description": "scale settings for AML Compute", "properties": { - "maxNodeCount": { - "description": "Max number of nodes to use", - "type": "integer", - "format": "int32" - }, - "minNodeCount": { - "description": "Min number of nodes to use", - "type": "integer", - "format": "int32", - "default": 0 + "value": { + "description": "The list for update quota.", + "type": "array", + "items": { + "$ref": "#/definitions/QuotaBaseProperties" + } }, - "nodeIdleTimeBeforeScaleDown": { - "type": "string", - "format": "duration", - "description": "Node Idle Time before scaling down amlCompute. This string needs to be in the RFC Format." + "location": { + "description": "Region of workspace quota to be updated.", + "type": "string" } }, - "required": [ - "maxNodeCount" - ] + "description": "Quota update parameters." }, - "VirtualMachineImage": { + "UpdateWorkspaceQuotasResult": { "type": "object", - "description": "Virtual Machine image for Windows AML Compute", "properties": { - "id": { - "description": "Virtual Machine image path", + "value": { + "description": "The list of workspace quota update result.", + "items": { + "$ref": "#/definitions/UpdateWorkspaceQuotas" + }, + "readOnly": true, + "type": "array" + }, + "nextLink": { + "description": "The URI to fetch the next page of workspace quota update result. Call ListNext() with this to fetch the next page of Workspace Quota update result.", + "readOnly": true, "type": "string" } }, - "required": [ - "id" - ] + "description": "The result of update workspace quota." }, - "NodeStateCounts": { + "UpdateWorkspaceQuotas": { "type": "object", "properties": { - "idleNodeCount": { - "readOnly": true, - "type": "integer", - "format": "int32", - "title": "Idle node count.", - "description": "Number of compute nodes in idle state." - }, - "runningNodeCount": { + "id": { "readOnly": true, - "type": "integer", - "format": "int32", - "title": "Running node count.", - "description": "Number of compute nodes which are running jobs." + "type": "string", + "description": "Specifies the resource ID." }, - "preparingNodeCount": { + "type": { "readOnly": true, - "type": "integer", - "format": "int32", - "title": "Preparing node count.", - "description": "Number of compute nodes which are being prepared." + "type": "string", + "description": "Specifies the resource type." }, - "unusableNodeCount": { - "readOnly": true, + "limit": { "type": "integer", - "format": "int32", - "title": "Unusable node count.", - "description": "Number of compute nodes which are in unusable state." + "format": "int64", + "title": "Limit.", + "description": "The maximum permitted quota of the resource." }, - "leavingNodeCount": { + "unit": { "readOnly": true, - "type": "integer", - "format": "int32", - "title": "Leaving node count.", - "description": "Number of compute nodes which are leaving the amlCompute." + "type": "string", + "description": "An enum describing the unit of quota measurement.", + "enum": [ + "Count" + ], + "x-ms-enum": { + "name": "QuotaUnit", + "modelAsString": true + } }, - "preemptedNodeCount": { - "readOnly": true, - "type": "integer", - "format": "int32", - "title": "Preempted node count.", - "description": "Number of compute nodes which are in preempted state." - } - }, - "description": "Counts of various compute node states on the amlCompute." - }, - "ScaleSettingsInformation": { - "type": "object", - "properties": { - "scaleSettings": { - "$ref": "#/definitions/ScaleSettings", - "title": "Scale settings." - } - }, - "description": "Desired scale settings for the amlCompute." - }, - "ClusterUpdateProperties": { - "type": "object", - "properties": { - "properties": { - "description": "Properties of ClusterUpdate", - "$ref": "#/definitions/ScaleSettingsInformation" - } - }, - "description": "The properties of a amlCompute that need to be updated." - }, - "ClusterUpdateParameters": { - "type": "object", - "properties": { - "properties": { - "x-ms-client-flatten": true, - "$ref": "#/definitions/ClusterUpdateProperties", - "description": "The properties of the amlCompute." + "status": { + "type": "string", + "readOnly": false, + "title": "Update Workspace Quota Status.", + "description": "Status of update workspace quota.", + "enum": [ + "Undefined", + "Success", + "Failure", + "InvalidQuotaBelowClusterMinimum", + "InvalidQuotaExceedsSubscriptionLimit", + "InvalidVMFamilyName", + "OperationNotSupportedForSku", + "OperationNotEnabledForRegion" + ], + "x-ms-enum": { + "name": "status", + "modelAsString": true + } } }, - "description": "AmlCompute update parameters." + "description": "The properties for update Quota response." }, - "AmlComputeNodesInformation": { + "ResourceName": { "type": "object", - "description": "Result of AmlCompute Nodes", "properties": { - "nodes": { + "value": { "readOnly": true, - "type": "array", - "items": { - "$ref": "#/definitions/AmlComputeNodeInformation" - }, - "x-ms-identifiers": [ - "nodeId" - ], - "description": "The collection of returned AmlCompute nodes details." + "type": "string", + "description": "The name of the resource." }, - "nextLink": { + "localizedValue": { "readOnly": true, "type": "string", - "description": "The continuation token." + "description": "The localized name of the resource." } - } + }, + "description": "The Resource Name." }, - "AmlComputeNodeInformation": { + "ResourceQuota": { "type": "object", - "description": "Compute node information related to a AmlCompute.", "properties": { - "nodeId": { + "id": { "readOnly": true, "type": "string", - "title": "Node ID.", - "description": "ID of the compute node." + "description": "Specifies the resource ID." }, - "privateIpAddress": { + "amlWorkspaceLocation": { "readOnly": true, "type": "string", - "title": "Private IP address.", - "description": "Private IP address of the compute node.", - "x-nullable": true + "description": "Region of the AML workspace in the id." }, - "publicIpAddress": { + "type": { "readOnly": true, "type": "string", - "title": "Public IP address.", - "description": "Public IP address of the compute node.", - "x-nullable": true + "description": "Specifies the resource type." }, - "port": { + "name": { + "$ref": "#/definitions/ResourceName", + "description": "Name of the resource.", + "readOnly": true + }, + "limit": { "readOnly": true, - "type": "number", - "format": "int32", - "title": "Port.", - "description": "SSH port number of the node." + "type": "integer", + "format": "int64", + "title": "Limit.", + "description": "The maximum permitted quota of the resource." }, - "nodeState": { + "unit": { "readOnly": true, "type": "string", + "description": "An enum describing the unit of quota measurement.", "enum": [ - "idle", - "running", - "preparing", - "unusable", - "leaving", - "preempted" + "Count" ], - "description": "State of the compute node. Values are idle, running, preparing, unusable, leaving and preempted.", "x-ms-enum": { - "name": "nodeState", + "name": "QuotaUnit", "modelAsString": true } + } + }, + "description": "The quota assigned to a resource." + }, + "ListWorkspaceQuotas": { + "type": "object", + "properties": { + "value": { + "description": "The list of Workspace Quotas by VM Family", + "items": { + "$ref": "#/definitions/ResourceQuota" + }, + "readOnly": true, + "type": "array" + }, + "nextLink": { + "description": "The URI to fetch the next page of workspace quota information by VM Family. Call ListNext() with this to fetch the next page of Workspace Quota information.", + "readOnly": true, + "type": "string" + } + }, + "description": "The List WorkspaceQuotasByVMFamily operation response." + }, + "ResourceId": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the resource" + } + }, + "required": [ + "id" + ], + "description": "Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet.", + "x-ms-azure-resource": true + }, + "PaginatedComputeResourcesList": { + "type": "object", + "description": "Paginated list of Machine Learning compute objects wrapped in ARM resource envelope.", + "properties": { + "value": { + "type": "array", + "description": "An array of Machine Learning compute objects wrapped in ARM resource envelope.", + "items": { + "$ref": "#/definitions/ComputeResource" + } }, - "runId": { - "readOnly": true, + "nextLink": { "type": "string", - "title": "Run ID.", - "description": "ID of the Experiment running on the node, if any else null.", - "x-nullable": true + "description": "A continuation link (absolute URI) to the next page of results in the list." } } }, - "VirtualMachineSshCredentials": { + "ComputeResource": { "type": "object", - "description": "Admin credentials for virtual machine", + "description": "Machine Learning compute object wrapped into ARM resource envelope.", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" + }, + { + "$ref": "#/definitions/ComputeResourceSchema" + } + ], "properties": { - "username": { - "description": "Username of admin account", - "type": "string" + "identity": { + "$ref": "../../../../../common-types/resource-management/v3/managedidentity.json#/definitions/ManagedServiceIdentity", + "description": "The identity of the resource." }, - "password": { - "description": "Password of admin account", + "location": { + "description": "Specifies the location of the resource.", "type": "string" }, - "publicKeyData": { - "description": "Public key data", - "type": "string", - "x-ms-secret": true + "tags": { + "description": "Contains resource tags defined as key/value pairs.", + "type": "object", + "x-nullable": true, + "additionalProperties": { + "type": "string" + } }, - "privateKeyData": { - "description": "Private key data", - "type": "string", - "x-ms-secret": true + "sku": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Sku", + "description": "The sku of the workspace.", + "x-nullable": true } } }, - "ComputeSecrets": { + "ComputeResourceSchema": { "type": "object", - "description": "Secrets related to a Machine Learning compute. Might differ for every type of compute.", - "discriminator": "computeType", "properties": { - "computeType": { - "description": "The type of compute", - "$ref": "#/definitions/ComputeType" + "properties": { + "description": "Compute properties", + "$ref": "#/definitions/Compute" } - }, - "required": [ - "computeType" - ] + } }, - "AksComputeSecretsProperties": { + "Compute": { "type": "object", - "description": "Properties of AksComputeSecrets", + "description": "Machine Learning compute object.", + "discriminator": "computeType", "properties": { - "userKubeConfig": { + "computeType": { + "description": "The type of compute", + "$ref": "#/definitions/ComputeType" + }, + "computeLocation": { + "description": "Location for the underlying compute", "type": "string", - "description": "Content of kubeconfig file that can be used to connect to the Kubernetes cluster." + "x-ms-mutability": [ + "read", + "create" + ] }, - "adminKubeConfig": { + "provisioningState": { "type": "string", - "description": "Content of kubeconfig file that can be used to connect to the Kubernetes cluster." + "description": "The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed.", + "enum": [ + "Unknown", + "Updating", + "Creating", + "Deleting", + "Succeeded", + "Failed", + "Canceled" + ], + "x-ms-enum": { + "name": "ProvisioningState", + "modelAsString": true + }, + "readOnly": true }, - "imagePullSecretName": { + "description": { "type": "string", - "description": "Image registry pull secret.", + "description": "The description of the Machine Learning compute.", "x-nullable": true - } - } - }, - "AksComputeSecrets": { - "description": "Secrets related to a Machine Learning compute based on AKS.", - "allOf": [ - { - "$ref": "#/definitions/ComputeSecrets" }, - { - "$ref": "#/definitions/AksComputeSecretsProperties" + "createdOn": { + "type": "string", + "readOnly": true, + "format": "date-time", + "description": "The time at which the compute was created." + }, + "modifiedOn": { + "type": "string", + "readOnly": true, + "format": "date-time", + "description": "The time at which the compute was last modified." + }, + "resourceId": { + "type": "string", + "description": "ARM resource id of the underlying compute", + "x-nullable": true + }, + "provisioningErrors": { + "type": "array", + "description": "Errors during provisioning", + "items": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + }, + "x-ms-identifiers": [ + "/error/code" + ], + "readOnly": true, + "x-nullable": true + }, + "isAttachedCompute": { + "type": "boolean", + "description": "Indicating whether the compute was provisioned by user and brought from outside if true, or machine learning service provisioned it if false.", + "readOnly": true + }, + "disableLocalAuth": { + "type": "boolean", + "description": "Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication.", + "x-ms-mutability": [ + "read", + "create" + ] } - ], - "x-ms-discriminator-value": "AKS" + }, + "required": [ + "computeType" + ] }, - "VirtualMachineSecrets": { - "description": "Secrets related to a Machine Learning compute based on AKS.", + "AKS": { + "description": "A Machine Learning compute based on AKS.", "allOf": [ { - "$ref": "#/definitions/ComputeSecrets" + "$ref": "#/definitions/Compute" }, { - "$ref": "#/definitions/VirtualMachineSecretsSchema" + "$ref": "#/definitions/AKSSchema" } ], - "x-ms-discriminator-value": "VirtualMachine" - }, - "VirtualMachineSecretsSchema": { - "type": "object", - "properties": { - "administratorAccount": { - "description": "Admin credentials for virtual machine.", - "$ref": "#/definitions/VirtualMachineSshCredentials" - } - } + "x-ms-discriminator-value": "AKS" }, - "DatabricksComputeSecretsProperties": { + "AKSSchema": { "type": "object", - "description": "Properties of Databricks Compute Secrets", "properties": { - "databricksAccessToken": { - "description": "access token for databricks account.", - "type": "string" + "properties": { + "type": "object", + "description": "AKS properties", + "properties": { + "clusterFqdn": { + "description": "Cluster full qualified domain name", + "type": "string", + "x-nullable": true + }, + "systemServices": { + "type": "array", + "description": "System services", + "items": { + "$ref": "#/definitions/SystemService" + }, + "x-ms-identifiers": [ + "publicIpAddress" + ], + "readOnly": true, + "x-nullable": true + }, + "agentCount": { + "description": "Number of agents", + "type": "integer", + "format": "int32", + "minimum": 0, + "x-nullable": true + }, + "agentVmSize": { + "description": "Agent virtual machine size", + "type": "string", + "x-nullable": true + }, + "clusterPurpose": { + "description": "Intended usage of the cluster", + "type": "string", + "default": "FastProd", + "enum": [ + "FastProd", + "DenseProd", + "DevTest" + ], + "x-ms-enum": { + "name": "ClusterPurpose", + "modelAsString": true + } + }, + "sslConfiguration": { + "description": "SSL configuration", + "$ref": "#/definitions/SslConfiguration", + "x-nullable": true + }, + "aksNetworkingConfiguration": { + "description": "AKS networking configuration for vnet", + "$ref": "#/definitions/AksNetworkingConfiguration", + "x-nullable": true + }, + "loadBalancerType": { + "description": "Load Balancer Type", + "type": "string", + "default": "PublicIp", + "enum": [ + "PublicIp", + "InternalLoadBalancer" + ], + "x-ms-enum": { + "name": "LoadBalancerType", + "modelAsString": true + } + }, + "loadBalancerSubnet": { + "description": "Load Balancer Subnet", + "type": "string", + "x-nullable": true + } + } } } }, - "DatabricksComputeSecrets": { - "description": "Secrets related to a Machine Learning compute based on Databricks.", + "Kubernetes": { + "description": "A Machine Learning compute based on Kubernetes Compute.", "allOf": [ { - "$ref": "#/definitions/ComputeSecrets" + "$ref": "#/definitions/Compute" }, { - "$ref": "#/definitions/DatabricksComputeSecretsProperties" + "$ref": "#/definitions/KubernetesSchema" } ], - "x-ms-discriminator-value": "Databricks" - }, - "ComputeType": { - "type": "string", - "description": "The type of compute", - "enum": [ - "AKS", - "Kubernetes", - "AmlCompute", - "ComputeInstance", - "DataFactory", - "VirtualMachine", - "HDInsight", - "Databricks", - "DataLakeAnalytics", - "SynapseSpark" - ], - "x-ms-enum": { - "name": "ComputeType", - "modelAsString": true - } + "x-ms-discriminator-value": "Kubernetes" }, - "PrivateEndpointConnectionListResult": { + "KubernetesSchema": { "type": "object", + "description": "Kubernetes Compute Schema", "properties": { - "value": { - "type": "array", - "description": "Array of private endpoint connections", - "items": { - "$ref": "#/definitions/PrivateEndpointConnection" - } + "properties": { + "description": "Properties of Kubernetes", + "$ref": "#/definitions/KubernetesProperties" } - }, - "description": "List of private endpoint connection associated with the specified workspace" + } }, - "PrivateEndpointConnection": { + "KubernetesProperties": { "type": "object", + "description": "Kubernetes properties", "properties": { - "properties": { - "$ref": "#/definitions/PrivateEndpointConnectionProperties", - "x-ms-client-flatten": true, - "description": "Resource properties." + "relayConnectionString": { + "description": "Relay connection string.", + "type": "string", + "x-ms-secret": true, + "x-nullable": true }, - "identity": { - "$ref": "../../../../../common-types/resource-management/v3/managedidentity.json#/definitions/ManagedServiceIdentity", - "description": "The identity of the resource." + "serviceBusConnectionString": { + "description": "ServiceBus connection string.", + "type": "string", + "x-ms-secret": true, + "x-nullable": true }, - "location": { - "description": "Specifies the location of the resource.", + "extensionPrincipalId": { + "description": "Extension principal-id.", + "type": "string", + "x-nullable": true + }, + "extensionInstanceReleaseTrain": { + "description": "Extension instance release train.", "type": "string" }, - "tags": { - "description": "Contains resource tags defined as key/value pairs.", + "vcName": { + "description": "VC name.", + "type": "string" + }, + "namespace": { + "description": "Compute namespace", + "type": "string", + "default": "default" + }, + "defaultInstanceType": { + "description": "Default instance type", + "type": "string" + }, + "instanceTypes": { + "description": "Instance Type Schema", "type": "object", "additionalProperties": { - "type": "string" + "$ref": "#/definitions/InstanceTypeSchema" } - }, - "sku": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Sku", - "description": "The sku of the workspace." - } - }, - "allOf": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" } - ], - "description": "The Private Endpoint Connection resource." + } }, - "PrivateEndpointConnectionProperties": { + "AmlComputeProperties": { "type": "object", + "description": "AML Compute properties", "properties": { - "privateEndpoint": { - "$ref": "#/definitions/PrivateEndpoint", - "description": "The resource of private end point." + "osType": { + "description": "Compute OS Type", + "type": "string", + "default": "Linux", + "enum": [ + "Linux", + "Windows" + ], + "x-ms-enum": { + "name": "OsType", + "modelAsString": true + } }, - "privateLinkServiceConnectionState": { - "$ref": "#/definitions/PrivateLinkServiceConnectionState", - "description": "A collection of information about the state of the connection between service consumer and provider." + "vmSize": { + "description": "Virtual Machine Size", + "type": "string" }, - "provisioningState": { - "$ref": "#/definitions/PrivateEndpointConnectionProvisioningState", - "description": "The provisioning state of the private endpoint connection resource." - } - }, - "required": [ - "privateLinkServiceConnectionState" - ], - "description": "Properties of the PrivateEndpointConnectProperties." - }, - "PrivateEndpoint": { - "type": "object", - "properties": { - "id": { - "readOnly": true, + "vmPriority": { + "description": "Virtual Machine priority", "type": "string", - "description": "The ARM identifier for Private Endpoint" - } - }, - "description": "The Private Endpoint resource." - }, - "PrivateLinkServiceConnectionState": { - "type": "object", - "properties": { - "status": { - "$ref": "#/definitions/PrivateEndpointServiceConnectionStatus", - "description": "Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service." + "enum": [ + "Dedicated", + "LowPriority" + ], + "x-ms-enum": { + "name": "VmPriority", + "modelAsString": true + } }, - "description": { + "virtualMachineImage": { + "description": "Virtual Machine image for AML Compute - windows only", + "$ref": "#/definitions/VirtualMachineImage", + "x-nullable": true + }, + "isolatedNetwork": { + "description": "Network is isolated or not", + "type": "boolean" + }, + "scaleSettings": { + "description": "Scale settings for AML Compute", + "$ref": "#/definitions/ScaleSettings" + }, + "userAccountCredentials": { + "title": "User account credentials.", + "description": "Credentials for an administrator user account that will be created on each compute node.", + "$ref": "#/definitions/UserAccountCredentials", + "x-nullable": true + }, + "subnet": { + "title": "Subnet.", + "description": "Virtual network subnet resource ID the compute nodes belong to.", + "$ref": "#/definitions/ResourceId", + "x-nullable": true + }, + "remoteLoginPortPublicAccess": { "type": "string", - "description": "The reason for approval/rejection of the connection." + "default": "NotSpecified", + "title": "Close remote Login Access Port", + "description": "State of the public SSH port. Possible values are: Disabled - Indicates that the public ssh port is closed on all nodes of the cluster. Enabled - Indicates that the public ssh port is open on all nodes of the cluster. NotSpecified - Indicates that the public ssh port is closed on all nodes of the cluster if VNet is defined, else is open all public nodes. It can be default only during cluster creation time, after creation it will be either enabled or disabled.", + "enum": [ + "Enabled", + "Disabled", + "NotSpecified" + ], + "x-ms-enum": { + "name": "remoteLoginPortPublicAccess", + "modelAsString": true + } }, - "actionsRequired": { + "allocationState": { "type": "string", - "description": "A message indicating if changes on the service provider require any updates on the consumer." - } - }, - "description": "A collection of information about the state of the connection between service consumer and provider." - }, - "PrivateEndpointServiceConnectionStatus": { - "type": "string", - "description": "The private endpoint connection status.", - "enum": [ - "Pending", - "Approved", - "Rejected", - "Disconnected", - "Timeout" - ], - "x-ms-enum": { - "name": "PrivateEndpointServiceConnectionStatus", - "modelAsString": true + "readOnly": true, + "title": "Allocation state.", + "description": "Allocation state of the compute. Possible values are: steady - Indicates that the compute is not resizing. There are no changes to the number of compute nodes in the compute in progress. A compute enters this state when it is created and when no operations are being performed on the compute to change the number of compute nodes. resizing - Indicates that the compute is resizing; that is, compute nodes are being added to or removed from the compute.", + "enum": [ + "Steady", + "Resizing" + ], + "x-ms-enum": { + "name": "AllocationState", + "modelAsString": true + } + }, + "allocationStateTransitionTime": { + "type": "string", + "readOnly": true, + "format": "date-time", + "title": "Allocation state transition time.", + "description": "The time at which the compute entered its current allocation state." + }, + "errors": { + "readOnly": true, + "title": "Errors.", + "description": "Collection of errors encountered by various compute nodes during node setup.", + "type": "array", + "x-nullable": true, + "items": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + }, + "x-ms-identifiers": [ + "/error/code" + ] + }, + "currentNodeCount": { + "type": "integer", + "readOnly": true, + "format": "int32", + "title": "Current node count.", + "description": "The number of compute nodes currently assigned to the compute.", + "x-nullable": true + }, + "targetNodeCount": { + "type": "integer", + "readOnly": true, + "format": "int32", + "title": "Target node count.", + "description": "The target number of compute nodes for the compute. If the allocationState is resizing, this property denotes the target node count for the ongoing resize operation. If the allocationState is steady, this property denotes the target node count for the previous resize operation.", + "x-nullable": true + }, + "nodeStateCounts": { + "title": "Node state counts.", + "description": "Counts of various node states on the compute.", + "readOnly": true, + "$ref": "#/definitions/NodeStateCounts", + "x-nullable": true + }, + "enableNodePublicIp": { + "type": "boolean", + "default": true, + "title": "Enable node public IP.", + "description": "Enable or disable node public IP address provisioning. Possible values are: Possible values are: true - Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will have a private endpoint and no public IPs.", + "x-nullable": true + }, + "propertyBag": { + "type": "object", + "description": "A property bag containing additional properties.", + "x-nullable": true + } } }, - "PrivateEndpointConnectionProvisioningState": { - "type": "string", - "readOnly": true, - "description": "The current provisioning state.", - "enum": [ - "Succeeded", - "Creating", - "Deleting", - "Failed" + "AmlCompute": { + "description": "An Azure Machine Learning compute.", + "allOf": [ + { + "$ref": "#/definitions/Compute" + }, + { + "$ref": "#/definitions/AmlComputeSchema" + } ], - "x-ms-enum": { - "name": "PrivateEndpointConnectionProvisioningState", - "modelAsString": true - } + "x-ms-discriminator-value": "AmlCompute" }, - "PrivateLinkResourceListResult": { + "AmlComputeSchema": { "type": "object", + "description": "Properties(top level) of AmlCompute", "properties": { - "value": { - "type": "array", - "description": "Array of private link resources", - "items": { - "$ref": "#/definitions/PrivateLinkResource" - } + "properties": { + "description": "Properties of AmlCompute", + "$ref": "#/definitions/AmlComputeProperties" } - }, - "description": "A list of private link resources" + } }, - "PrivateLinkResource": { + "ComputeInstanceProperties": { + "description": "Compute Instance properties", "type": "object", "properties": { - "properties": { - "$ref": "#/definitions/PrivateLinkResourceProperties", - "description": "Resource properties.", - "x-ms-client-flatten": true - }, - "identity": { - "$ref": "../../../../../common-types/resource-management/v3/managedidentity.json#/definitions/ManagedServiceIdentity", - "description": "The identity of the resource." - }, - "location": { - "description": "Specifies the location of the resource.", + "vmSize": { + "description": "Virtual Machine Size", "type": "string" }, - "tags": { - "description": "Contains resource tags defined as key/value pairs.", - "type": "object", - "additionalProperties": { - "type": "string" - } + "subnet": { + "title": "Subnet.", + "description": "Virtual network subnet resource ID the compute nodes belong to.", + "$ref": "#/definitions/ResourceId", + "x-nullable": true }, - "sku": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Sku", - "description": "The sku of the workspace." - } - }, - "allOf": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" - } - ], - "description": "A private link resource" - }, - "PrivateLinkResourceProperties": { - "type": "object", - "properties": { - "groupId": { - "description": "The private link resource group id.", + "applicationSharingPolicy": { "type": "string", - "readOnly": true + "default": "Shared", + "title": "Sharing policy for applications on this compute instance", + "description": "Policy for sharing applications on this compute instance among users of parent workspace. If Personal, only the creator can access applications on this compute instance. When Shared, any workspace user can access applications on this instance depending on his/her assigned role.", + "enum": [ + "Personal", + "Shared" + ], + "x-ms-enum": { + "name": "applicationSharingPolicy", + "modelAsString": true + } }, - "requiredMembers": { - "description": "The private link resource required member names.", + "autologgerSettings": { + "description": "Specifies settings for autologger.", + "$ref": "#/definitions/ComputeInstanceAutologgerSettings", + "x-nullable": true + }, + "sshSettings": { + "description": "Specifies policy and settings for SSH access.", + "$ref": "#/definitions/ComputeInstanceSshSettings", + "x-nullable": true + }, + "customServices": { "type": "array", + "description": "List of Custom Services added to the compute.", + "x-nullable": true, "items": { - "type": "string" + "$ref": "#/definitions/CustomService" }, - "readOnly": true + "x-ms-identifiers": [ + "name" + ] }, - "requiredZoneNames": { + "osImageMetadata": { + "readOnly": true, + "description": "Returns metadata about the operating system image for this compute instance.", + "$ref": "#/definitions/ImageMetadata" + }, + "connectivityEndpoints": { + "readOnly": true, + "description": "Describes all connectivity endpoints available for this ComputeInstance.", + "$ref": "#/definitions/ComputeInstanceConnectivityEndpoints" + }, + "applications": { "type": "array", + "readOnly": true, + "description": "Describes available applications and their endpoints on this ComputeInstance.", "items": { - "type": "string" + "$ref": "#/definitions/ComputeInstanceApplication" }, - "description": "The private link resource Private link DNS zone name." - } - }, - "description": "Properties of a private link resource." - }, - "SharedPrivateLinkResource": { - "type": "object", - "properties": { - "name": { - "description": "Unique name of the private link.", - "type": "string" + "x-ms-identifiers": [ + "displayName" + ] }, - "properties": { - "$ref": "#/definitions/SharedPrivateLinkResourceProperty", - "x-ms-client-flatten": true, - "description": "Resource properties." - } - } - }, - "SharedPrivateLinkResourceProperty": { - "type": "object", - "properties": { - "privateLinkResourceId": { - "description": "The resource id that private link links to.", - "type": "string" + "createdBy": { + "readOnly": true, + "description": "Describes information on user who created this ComputeInstance.", + "$ref": "#/definitions/ComputeInstanceCreatedBy" }, - "groupId": { - "description": "The private link resource group id.", - "type": "string" + "errors": { + "readOnly": true, + "title": "Errors.", + "description": "Collection of errors encountered on this ComputeInstance.", + "type": "array", + "items": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + }, + "x-ms-identifiers": [ + "/error/code" + ] }, - "requestMessage": { - "description": "Request message.", - "type": "string" + "state": { + "description": "The current state of this ComputeInstance.", + "$ref": "#/definitions/ComputeInstanceState", + "readOnly": true }, - "status": { - "$ref": "#/definitions/PrivateEndpointServiceConnectionStatus", - "description": "Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service." - } - }, - "description": "Properties of a shared private link resource." - }, - "EncryptionProperty": { - "properties": { - "status": { - "description": "Indicates whether or not the encryption is enabled for the workspace.", + "computeInstanceAuthorizationType": { + "type": "string", + "title": "Compute Instance Authorization type.", + "description": "The Compute Instance Authorization type. Available values are personal (default).", + "default": "personal", + "x-nullable": true, "enum": [ - "Enabled", - "Disabled" + "personal" ], - "type": "string", "x-ms-enum": { - "name": "EncryptionStatus", + "name": "ComputeInstanceAuthorizationType", "modelAsString": true } }, - "identity": { - "$ref": "#/definitions/IdentityForCmk", - "description": "The identity that will be used to access the key vault for encryption at rest." + "enableOSPatching": { + "type": "boolean", + "default": false, + "title": "Enable Auto OS Patching.", + "description": "Enable Auto OS Patching. Possible values are: true, false.", + "x-nullable": true }, - "keyVaultProperties": { - "$ref": "#/definitions/EncryptionKeyVaultProperties", - "description": "Customer Key vault properties." - } - }, - "required": [ - "status", - "keyVaultProperties" - ], - "type": "object" - }, - "EncryptionKeyVaultProperties": { - "properties": { - "keyVaultArmId": { - "description": "The ArmId of the keyVault where the customer owned encryption key is present.", - "type": "string" + "enableRootAccess": { + "type": "boolean", + "default": true, + "title": "Enable root access.", + "description": "Enable root access. Possible values are: true, false.", + "x-nullable": true }, - "keyIdentifier": { - "description": "Key vault uri to access the encryption key.", - "type": "string" + "enableSSO": { + "type": "boolean", + "default": true, + "title": "Enable SSO (single sign on).", + "description": "Enable SSO (single sign on). Possible values are: true, false.", + "x-nullable": true }, - "identityClientId": { - "description": "For future use - The client id of the identity which will be used to access key vault.", - "type": "string" - } - }, - "required": [ - "keyIdentifier", - "keyVaultArmId" - ], - "type": "object" - }, - "IdentityForCmk": { - "description": "Identity that will be used to access key vault for encryption at rest", - "type": "object", - "properties": { - "userAssignedIdentity": { - "description": "The ArmId of the user assigned identity that will be used to access the customer managed key vault", - "type": "string" - } - } - }, - "ImageMetadata": { - "type": "object", - "description": "Returns metadata about the operating system image for this compute instance.", - "properties": { - "currentImageVersion": { - "type": "string", - "description": "Specifies the current operating system image version this compute instance is running on." + "releaseQuotaOnStop": { + "type": "boolean", + "default": false, + "title": "Release quota if compute instance stopped.", + "description": "Release quota if compute instance stopped. Possible values are: true - release quota if compute instance stopped. false - don't release quota when compute instance stopped.", + "x-nullable": true }, - "latestImageVersion": { - "type": "string", - "description": "Specifies the latest available operating system image version." + "personalComputeInstanceSettings": { + "title": "Personal Compute Instance settings.", + "description": "Settings for a personal compute instance.", + "$ref": "#/definitions/PersonalComputeInstanceSettings", + "x-nullable": true }, - "isLatestOsImageVersion": { - "type": "boolean", - "description": "Specifies whether this compute instance is running on the latest operating system image." - } - } - }, - "CustomService": { - "type": "object", - "description": "Specifies the custom service configuration", - "properties": { - "name": { - "type": "string", - "description": "Name of the Custom Service" + "setupScripts": { + "description": "Details of customized scripts to execute for setting up the cluster.", + "$ref": "#/definitions/SetupScripts", + "x-nullable": true }, - "image": { - "$ref": "#/definitions/Image", - "description": "Describes the Image Specifications" + "lastOperation": { + "description": "The last operation on ComputeInstance.", + "$ref": "#/definitions/ComputeInstanceLastOperation", + "readOnly": true, + "x-nullable": true }, - "environmentVariables": { - "type": "object", - "description": "Environment Variable for the container", - "additionalProperties": { - "$ref": "#/definitions/EnvironmentVariable" - } + "schedules": { + "description": "The list of schedules to be applied on the computes.", + "$ref": "#/definitions/ComputeSchedules", + "x-nullable": true }, - "docker": { - "description": "Describes the docker settings for the image", - "$ref": "#/definitions/Docker", + "idleTimeBeforeShutdown": { + "type": "string", + "description": "Stops compute instance after user defined period of inactivity. Time is defined in ISO8601 format. Minimum is 15 min, maximum is 3 days." + }, + "enableNodePublicIp": { + "type": "boolean", + "title": "Enable node public IP.", + "description": "Enable or disable node public IP address provisioning. Possible values are: Possible values are: true - Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will have a private endpoint and no public IPs.", "x-nullable": true }, - "endpoints": { + "containers": { "type": "array", - "description": "Configuring the endpoints for the container", + "readOnly": true, + "description": "Describes informations of containers on this ComputeInstance.", + "x-nullable": true, "items": { - "$ref": "#/definitions/Endpoint" + "$ref": "#/definitions/ComputeInstanceContainer" }, "x-ms-identifiers": [ "name" ] }, - "volumes": { + "dataDisks": { "type": "array", - "description": "Configuring the volumes for the container", + "readOnly": true, + "description": "Describes informations of dataDisks on this ComputeInstance.", + "x-nullable": true, "items": { - "$ref": "#/definitions/VolumeDefinition" + "$ref": "#/definitions/ComputeInstanceDataDisk" }, - "x-ms-identifiers": [ - "source", - "target" - ] + "x-ms-identifiers": [] + }, + "dataMounts": { + "type": "array", + "readOnly": true, + "description": "Describes informations of dataMounts on this ComputeInstance.", + "x-nullable": true, + "items": { + "$ref": "#/definitions/ComputeInstanceDataMount" + }, + "x-ms-identifiers": [] + }, + "versions": { + "description": "ComputeInstance version.", + "$ref": "#/definitions/ComputeInstanceVersion", + "readOnly": true } - }, - "additionalProperties": true + } }, - "Image": { - "type": "object", - "description": "Describes the Image Specifications", - "properties": { - "type": { - "default": "docker", - "enum": [ - "docker", - "azureml" - ], - "type": "string", - "title": "Type of the image", - "description": "Type of the image. Possible values are: docker - For docker images. azureml - For AzureML images", - "x-ms-enum": { - "name": "ImageType", - "modelAsString": true - } + "ComputeInstance": { + "description": "An Azure Machine Learning compute instance.", + "allOf": [ + { + "$ref": "#/definitions/Compute" }, - "reference": { - "type": "string", - "description": "Image reference" + { + "$ref": "#/definitions/ComputeInstanceSchema" } - }, - "additionalProperties": true + ], + "x-ms-discriminator-value": "ComputeInstance" }, - "EnvironmentVariable": { + "ComputeInstanceSchema": { "type": "object", - "description": "Environment Variables for the container", + "description": "Properties(top level) of ComputeInstance", "properties": { - "type": { - "enum": [ - "local" - ], - "default": "local", - "title": "Type of Environment Variable", - "description": "Type of the Environment Variable. Possible values are: local - For local variable", - "type": "string", - "x-ms-enum": { - "name": "EnvironmentVariableType", - "modelAsString": true - } + "properties": { + "description": "Properties of ComputeInstance", + "$ref": "#/definitions/ComputeInstanceProperties" + } + } + }, + "VirtualMachine": { + "description": "A Machine Learning compute based on Azure Virtual Machines.", + "allOf": [ + { + "$ref": "#/definitions/Compute" }, - "value": { - "type": "string", - "description": "Value of the Environment variable" + { + "$ref": "#/definitions/VirtualMachineSchema" } - }, - "additionalProperties": true + ], + "x-ms-discriminator-value": "VirtualMachine" }, - "Docker": { + "VirtualMachineSchema": { "type": "object", - "description": "Docker container configuration", "properties": { - "privileged": { - "type": "boolean", - "description": "Indicate whether container shall run in privileged or non-privileged mode.", - "x-nullable": true + "properties": { + "type": "object", + "properties": { + "virtualMachineSize": { + "description": "Virtual Machine size", + "type": "string" + }, + "sshPort": { + "description": "Port open for ssh connections.", + "type": "integer", + "format": "int32" + }, + "notebookServerPort": { + "description": "Notebook server port open for ssh connections.", + "type": "integer", + "format": "int32" + }, + "address": { + "description": "Public IP address of the virtual machine.", + "type": "string" + }, + "administratorAccount": { + "description": "Admin credentials for virtual machine", + "$ref": "#/definitions/VirtualMachineSshCredentials" + }, + "isNotebookInstanceCompute": { + "description": "Indicates whether this compute will be used for running notebooks.", + "type": "boolean" + } + } } - }, - "additionalProperties": true + } }, - "Endpoint": { + "HDInsightProperties": { "type": "object", - "description": "Describes the endpoint configuration for the container", + "description": "HDInsight compute properties", "properties": { - "protocol": { - "enum": [ - "tcp", - "udp", - "http" - ], - "default": "tcp", - "title": "Endpoint Communication Protocol", - "description": "Protocol over which communication will happen over this endpoint", - "x-ms-enum": { - "name": "protocol", - "modelAsString": true - }, - "type": "string" - }, - "name": { - "type": "string", - "description": "Name of the Endpoint" - }, - "target": { - "format": "int32", + "sshPort": { + "description": "Port open for ssh connections on the master node of the cluster.", "type": "integer", - "description": "Application port inside the container." + "format": "int32" }, - "published": { - "format": "int32", - "type": "integer", - "description": "Port over which the application is exposed from container.", - "x-nullable": true + "address": { + "description": "Public IP address of the master node of the cluster.", + "type": "string" }, - "hostIp": { - "description": "Host IP over which the application is exposed from the container", - "type": "string", + "administratorAccount": { + "description": "Admin credentials for master node of the cluster", + "$ref": "#/definitions/VirtualMachineSshCredentials", "x-nullable": true } } }, - "VolumeDefinition": { + "HDInsight": { + "description": "A HDInsight compute.", + "allOf": [ + { + "$ref": "#/definitions/Compute" + }, + { + "$ref": "#/definitions/HDInsightSchema" + } + ], + "x-ms-discriminator-value": "HDInsight" + }, + "HDInsightSchema": { "type": "object", - "description": "Describes the volume configuration for the container", "properties": { - "type": { - "enum": [ - "bind", - "volume", - "tmpfs", - "npipe" - ], - "default": "bind", - "title": "Type of Volume Definition", - "description": "Type of Volume Definition. Possible Values: bind,volume,tmpfs,npipe", - "x-ms-enum": { - "name": "VolumeDefinitionType", - "modelAsString": true - }, - "type": "string" - }, - "readOnly": { - "type": "boolean", - "description": "Indicate whether to mount volume as readOnly. Default value for this is false.", - "x-nullable": true - }, - "source": { - "type": "string", - "description": "Source of the mount. For bind mounts this is the host path." - }, - "target": { - "type": "string", - "description": "Target of the mount. For bind mounts this is the path in the container." - }, - "consistency": { - "type": "string", - "description": "Consistency of the volume" - }, - "bind": { - "$ref": "#/definitions/BindOptions", - "description": "Bind Options of the mount" - }, - "volume": { - "$ref": "#/definitions/VolumeOptions", - "description": "Volume Options of the mount" + "properties": { + "$ref": "#/definitions/HDInsightProperties" + } + } + }, + "DataFactory": { + "description": "A DataFactory compute.", + "allOf": [ + { + "$ref": "#/definitions/Compute" + } + ], + "x-ms-discriminator-value": "DataFactory" + }, + "DatabricksProperties": { + "type": "object", + "description": "Properties of Databricks", + "properties": { + "databricksAccessToken": { + "description": "Databricks access token", + "type": "string" }, - "tmpfs": { - "$ref": "#/definitions/TmpfsOptions", - "description": "tmpfs option of the mount" + "workspaceUrl": { + "description": "Workspace Url", + "type": "string" } } }, - "VolumeOptions": { + "Databricks": { + "description": "A DataFactory compute.", + "allOf": [ + { + "$ref": "#/definitions/Compute" + }, + { + "$ref": "#/definitions/DatabricksSchema" + } + ], + "x-ms-discriminator-value": "Databricks" + }, + "DatabricksSchema": { "type": "object", - "description": "Describes the volume options for the container", "properties": { - "nocopy": { - "type": "boolean", - "description": "Indicate whether volume is nocopy", - "x-nullable": true + "properties": { + "$ref": "#/definitions/DatabricksProperties" } } }, - "BindOptions": { - "type": "object", - "description": "Describes the bind options for the container", - "properties": { - "propagation": { - "type": "string", - "description": "Type of Bind Option", - "x-nullable": true - }, - "createHostPath": { - "type": "boolean", - "description": "Indicate whether to create host path.", - "x-nullable": true + "DataLakeAnalytics": { + "description": "A DataLakeAnalytics compute.", + "allOf": [ + { + "$ref": "#/definitions/Compute" }, - "selinux": { - "type": "string", - "description": "Mention the selinux options.", - "x-nullable": true + { + "$ref": "#/definitions/DataLakeAnalyticsSchema" } - } + ], + "x-ms-discriminator-value": "DataLakeAnalytics" }, - "TmpfsOptions": { - "description": "Describes the tmpfs options for the container", + "DataLakeAnalyticsSchema": { "type": "object", "properties": { - "size": { - "format": "int32", - "type": "integer", - "description": "Mention the Tmpfs size" + "properties": { + "type": "object", + "properties": { + "dataLakeStoreAccountName": { + "description": "DataLake Store Account Name", + "type": "string" + } + } } } }, - "ComputeInstanceSshSettings": { + "SynapseSpark": { "type": "object", - "description": "Specifies policy and settings for SSH access.", + "description": "A SynapseSpark compute.", "properties": { - "sshPublicAccess": { - "type": "string", - "default": "Disabled", - "title": "Access policy for SSH", - "description": "State of the public SSH port. Possible values are: Disabled - Indicates that the public ssh port is closed on this instance. Enabled - Indicates that the public ssh port is open and accessible according to the VNet/subnet policy if applicable.", - "enum": [ - "Enabled", - "Disabled" - ], - "x-ms-enum": { - "name": "sshPublicAccess", - "modelAsString": true + "properties": { + "type": "object", + "properties": { + "autoScaleProperties": { + "description": "Auto scale properties.", + "$ref": "#/definitions/AutoScaleProperties" + }, + "autoPauseProperties": { + "description": "Auto pause properties.", + "$ref": "#/definitions/AutoPauseProperties" + }, + "sparkVersion": { + "description": "Spark version.", + "type": "string" + }, + "nodeCount": { + "description": "The number of compute nodes currently assigned to the compute.", + "type": "integer", + "format": "int32" + }, + "nodeSize": { + "description": "Node size.", + "type": "string" + }, + "nodeSizeFamily": { + "description": "Node size family.", + "type": "string" + }, + "subscriptionId": { + "description": "Azure subscription identifier.", + "type": "string" + }, + "resourceGroup": { + "description": "Name of the resource group in which workspace is located.", + "type": "string" + }, + "workspaceName": { + "description": "Name of Azure Machine Learning workspace.", + "type": "string" + }, + "poolName": { + "description": "Pool name.", + "type": "string" + } } + } + }, + "allOf": [ + { + "$ref": "#/definitions/Compute" + } + ], + "x-ms-discriminator-value": "SynapseSpark" + }, + "SystemService": { + "type": "object", + "description": "A system service running on a compute.", + "properties": { + "systemServiceType": { + "description": "The type of this system service.", + "readOnly": true, + "type": "string" }, - "adminUserName": { + "publicIpAddress": { "type": "string", - "readOnly": true, - "description": "Describes the admin user name." + "description": "Public IP address", + "readOnly": true }, - "sshPort": { - "type": "integer", - "format": "int32", + "version": { + "description": "The version for this type.", "readOnly": true, - "description": "Describes the port for connecting through SSH." - }, - "adminPublicKey": { - "type": "string", - "description": "Specifies the SSH rsa public key file as a string. Use \"ssh-keygen -t rsa -b 2048\" to generate your SSH key pairs." + "type": "string" } } }, - "ComputeInstanceState": { - "type": "string", - "description": "Current state of an ComputeInstance.", - "enum": [ - "Creating", - "CreateFailed", - "Deleting", - "Running", - "Restarting", - "JobRunning", - "SettingUp", - "SetupFailed", - "Starting", - "Stopped", - "Stopping", - "UserSettingUp", - "UserSetupFailed", - "Unknown", - "Unusable" - ], - "x-ms-enum": { - "name": "ComputeInstanceState", - "modelAsString": true - } - }, - "ComputeInstanceLastOperation": { + "SslConfiguration": { "type": "object", - "description": "The last operation on ComputeInstance.", + "description": "The ssl configuration for scoring", "properties": { - "operationName": { + "status": { + "description": "Enable or disable ssl for scoring", "type": "string", - "description": "Name of the last operation.", "enum": [ - "Create", - "Start", - "Stop", - "Restart", - "Reimage", - "Delete" + "Disabled", + "Enabled", + "Auto" ], "x-ms-enum": { - "name": "OperationName", + "name": "SslConfigStatus", "modelAsString": true } }, - "operationTime": { + "cert": { + "description": "Cert data", "type": "string", - "format": "date-time", - "description": "Time of the last operation." + "x-ms-secret": true, + "x-nullable": true }, - "operationStatus": { + "key": { + "description": "Key data", "type": "string", - "description": "Operation status.", - "enum": [ - "InProgress", - "Succeeded", - "CreateFailed", - "StartFailed", - "StopFailed", - "RestartFailed", - "ReimageFailed", - "DeleteFailed" - ], - "x-ms-enum": { - "name": "OperationStatus", - "modelAsString": true - } + "x-ms-secret": true, + "x-nullable": true }, - "operationTrigger": { + "cname": { + "description": "CNAME of the cert", "type": "string", - "description": "Trigger of operation.", - "enum": [ - "User", - "Schedule", - "IdleShutdown" - ], - "x-ms-enum": { - "name": "operationTrigger", - "modelAsString": true - } - } - } - }, - "ComputeInstanceVersion": { - "type": "object", - "description": "Version of computeInstance.", - "properties": { - "runtime": { + "x-nullable": true + }, + "leafDomainLabel": { + "description": "Leaf domain label of public endpoint", "type": "string", - "description": "Runtime of compute instance.", "x-nullable": true + }, + "overwriteExistingDomain": { + "description": "Indicates whether to overwrite existing domain label.", + "type": "boolean" } } }, - "ComputeSchedules": { + "AksNetworkingConfiguration": { "type": "object", - "description": "The list of schedules to be applied on the computes", + "description": "Advance configuration for AKS networking", "properties": { - "computeStartStop": { - "type": "array", - "items": { - "$ref": "#/definitions/ComputeStartStopSchedule" - }, - "description": "The list of compute start stop schedules to be applied." + "subnetId": { + "description": "Virtual network subnet resource ID the compute nodes belong to", + "type": "string" + }, + "serviceCidr": { + "pattern": "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$", + "description": "A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges.", + "type": "string" + }, + "dnsServiceIP": { + "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", + "description": "An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr.", + "type": "string" + }, + "dockerBridgeCidr": { + "pattern": "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$", + "description": "A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range.", + "type": "string" } } }, - "ComputeStartStopSchedule": { + "UserAccountCredentials": { "type": "object", - "description": "Compute start stop schedule properties", "properties": { - "id": { - "description": "A system assigned id for the schedule.", + "adminUserName": { "type": "string", - "x-nullable": true, - "readOnly": true + "title": "User name.", + "description": "Name of the administrator user account which can be used to SSH to nodes." }, - "provisioningStatus": { - "description": "The current deployment state of schedule.", + "adminUserSshPublicKey": { "type": "string", - "enum": [ - "Completed", - "Provisioning", - "Failed" - ], - "x-ms-enum": { - "name": "provisioningStatus", - "modelAsString": true, - "values": [ - { - "value": "Completed" - }, - { - "value": "Provisioning" - }, - { - "value": "Failed" - } - ] - }, - "readOnly": true - }, - "status": { - "$ref": "#/definitions/ScheduleStatus" - }, - "action": { - "description": "[Required] The compute power action.", - "$ref": "#/definitions/ComputePowerAction" - }, - "triggerType": { - "description": "[Required] The schedule trigger type.", - "$ref": "#/definitions/ComputeTriggerType" + "x-ms-secret": true, + "title": "SSH public key.", + "description": "SSH public key of the administrator user account." }, - "recurrence": { - "description": "Required if triggerType is Recurrence.", - "$ref": "#/definitions/Recurrence" + "adminUserPassword": { + "type": "string", + "x-ms-secret": true, + "title": "Password.", + "description": "Password of the administrator user account." + } + }, + "required": [ + "adminUserName" + ], + "description": "Settings for user account that gets created on each on the nodes of a compute." + }, + "ScaleSettings": { + "type": "object", + "description": "scale settings for AML Compute", + "properties": { + "maxNodeCount": { + "description": "Max number of nodes to use", + "type": "integer", + "format": "int32" }, - "cron": { - "description": "Required if triggerType is Cron.", - "$ref": "#/definitions/Cron" + "minNodeCount": { + "description": "Min number of nodes to use", + "type": "integer", + "format": "int32", + "default": 0 }, - "schedule": { - "description": "[Deprecated] Not used any more.", - "$ref": "#/definitions/ScheduleBase" + "nodeIdleTimeBeforeScaleDown": { + "type": "string", + "format": "duration", + "description": "Node Idle Time before scaling down amlCompute. This string needs to be in the RFC Format." } - } - }, - "ComputeTriggerType": { - "enum": [ - "Recurrence", - "Cron" - ], - "description": "Is the trigger type recurrence or cron.", - "type": "string", - "x-ms-enum": { - "name": "ComputeTriggerType", - "modelAsString": true, - "values": [ - { - "value": "Recurrence" - }, - { - "value": "Cron" - } - ] }, - "additionalProperties": false + "required": [ + "maxNodeCount" + ] }, - "ScheduleBase": { + "VirtualMachineImage": { "type": "object", + "description": "Virtual Machine image for Windows AML Compute", "properties": { "id": { - "description": "A system assigned id for the schedule.", - "type": "string", - "x-nullable": true + "description": "Virtual Machine image path", + "type": "string" + } + }, + "required": [ + "id" + ] + }, + "NodeStateCounts": { + "type": "object", + "properties": { + "idleNodeCount": { + "readOnly": true, + "type": "integer", + "format": "int32", + "title": "Idle node count.", + "description": "Number of compute nodes in idle state." }, - "provisioningStatus": { - "$ref": "#/definitions/ScheduleProvisioningState" + "runningNodeCount": { + "readOnly": true, + "type": "integer", + "format": "int32", + "title": "Running node count.", + "description": "Number of compute nodes which are running jobs." }, - "status": { - "$ref": "#/definitions/ScheduleStatus" + "preparingNodeCount": { + "readOnly": true, + "type": "integer", + "format": "int32", + "title": "Preparing node count.", + "description": "Number of compute nodes which are being prepared." + }, + "unusableNodeCount": { + "readOnly": true, + "type": "integer", + "format": "int32", + "title": "Unusable node count.", + "description": "Number of compute nodes which are in unusable state." + }, + "leavingNodeCount": { + "readOnly": true, + "type": "integer", + "format": "int32", + "title": "Leaving node count.", + "description": "Number of compute nodes which are leaving the amlCompute." + }, + "preemptedNodeCount": { + "readOnly": true, + "type": "integer", + "format": "int32", + "title": "Preempted node count.", + "description": "Number of compute nodes which are in preempted state." } }, - "additionalProperties": false + "description": "Counts of various compute node states on the amlCompute." }, - "ScheduleProvisioningState": { - "enum": [ - "Completed", - "Provisioning", - "Failed" - ], - "description": "The current deployment state of schedule.", - "type": "string", - "x-ms-enum": { - "name": "ScheduleProvisioningState", - "modelAsString": true, - "values": [ - { - "value": "Completed" - }, - { - "value": "Provisioning" - }, - { - "value": "Failed" - } - ] + "ScaleSettingsInformation": { + "type": "object", + "properties": { + "scaleSettings": { + "$ref": "#/definitions/ScaleSettings", + "title": "Scale settings." + } }, - "additionalProperties": false + "description": "Desired scale settings for the amlCompute." }, - "ScheduleStatus": { - "enum": [ - "Enabled", - "Disabled" - ], - "description": "Is the schedule enabled or disabled?", - "type": "string", - "x-ms-enum": { - "name": "ScheduleStatus", - "modelAsString": true, - "values": [ - { - "value": "Enabled" - }, - { - "value": "Disabled" - } - ] + "ClusterUpdateProperties": { + "type": "object", + "properties": { + "properties": { + "description": "Properties of ClusterUpdate", + "$ref": "#/definitions/ScaleSettingsInformation" + } }, - "additionalProperties": false + "description": "The properties of a amlCompute that need to be updated." }, - "ComputePowerAction": { - "type": "string", - "description": "The compute power action.", - "enum": [ - "Start", - "Stop" - ], - "x-ms-enum": { - "name": "ComputePowerAction", - "modelAsString": true + "ClusterUpdateParameters": { + "type": "object", + "properties": { + "properties": { + "x-ms-client-flatten": true, + "$ref": "#/definitions/ClusterUpdateProperties", + "description": "The properties of the amlCompute." + } + }, + "description": "AmlCompute update parameters." + }, + "AmlComputeNodesInformation": { + "type": "object", + "description": "Result of AmlCompute Nodes", + "properties": { + "nodes": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/AmlComputeNodeInformation" + }, + "x-ms-identifiers": [ + "nodeId" + ], + "description": "The collection of returned AmlCompute nodes details." + }, + "nextLink": { + "readOnly": true, + "type": "string", + "description": "The continuation token." + } } }, - "Recurrence": { + "AmlComputeNodeInformation": { "type": "object", - "description": "The workflow trigger recurrence for ComputeStartStop schedule type.", + "description": "Compute node information related to a AmlCompute.", "properties": { - "frequency": { - "description": "[Required] The frequency to trigger schedule.", - "$ref": "#/definitions/ComputeRecurrenceFrequency" + "nodeId": { + "readOnly": true, + "type": "string", + "title": "Node ID.", + "description": "ID of the compute node." }, - "interval": { - "description": "[Required] Specifies schedule interval in conjunction with frequency", - "type": "integer", - "format": "int32" + "privateIpAddress": { + "readOnly": true, + "type": "string", + "title": "Private IP address.", + "description": "Private IP address of the compute node.", + "x-nullable": true }, - "startTime": { - "description": "The start time in yyyy-MM-ddTHH:mm:ss format.", + "publicIpAddress": { + "readOnly": true, "type": "string", + "title": "Public IP address.", + "description": "Public IP address of the compute node.", "x-nullable": true }, - "timeZone": { - "description": "Specifies time zone in which the schedule runs.\r\nTimeZone should follow Windows time zone format. Refer: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11", - "default": "UTC", - "type": "string" + "port": { + "readOnly": true, + "type": "number", + "format": "int32", + "title": "Port.", + "description": "SSH port number of the node." }, - "schedule": { - "description": "[Required] The recurrence schedule.", - "$ref": "#/definitions/ComputeRecurrenceSchedule" + "nodeState": { + "readOnly": true, + "type": "string", + "enum": [ + "idle", + "running", + "preparing", + "unusable", + "leaving", + "preempted" + ], + "description": "State of the compute node. Values are idle, running, preparing, unusable, leaving and preempted.", + "x-ms-enum": { + "name": "nodeState", + "modelAsString": true + } + }, + "runId": { + "readOnly": true, + "type": "string", + "title": "Run ID.", + "description": "ID of the Experiment running on the node, if any else null.", + "x-nullable": true } } }, - "ComputeRecurrenceFrequency": { - "description": "Enum to describe the frequency of a compute recurrence schedule", - "enum": [ - "Minute", - "Hour", - "Day", - "Week", - "Month" - ], - "type": "string", - "x-ms-enum": { - "name": "ComputeRecurrenceFrequency", - "modelAsString": true, - "values": [ - { - "value": "Minute", - "description": "Minute frequency" - }, - { - "value": "Hour", - "description": "Hour frequency" - }, - { - "value": "Day", - "description": "Day frequency" - }, - { - "value": "Week", - "description": "Week frequency" - }, - { - "value": "Month", - "description": "Month frequency" - } - ] - }, - "additionalProperties": false - }, - "ComputeRecurrenceSchedule": { - "required": [ - "hours", - "minutes" - ], + "VirtualMachineSshCredentials": { "type": "object", + "description": "Admin credentials for virtual machine", "properties": { - "hours": { - "description": "[Required] List of hours for the schedule.", - "type": "array", - "items": { - "format": "int32", - "type": "integer" - } + "username": { + "description": "Username of admin account", + "type": "string" }, - "minutes": { - "description": "[Required] List of minutes for the schedule.", - "type": "array", - "items": { - "format": "int32", - "type": "integer" - } + "password": { + "description": "Password of admin account", + "type": "string" }, - "monthDays": { - "description": "List of month days for the schedule", - "type": "array", - "items": { - "format": "int32", - "type": "integer" - }, - "x-nullable": true + "publicKeyData": { + "description": "Public key data", + "type": "string", + "x-ms-secret": true }, - "weekDays": { - "description": "List of days for the schedule.", - "type": "array", - "items": { - "$ref": "#/definitions/ComputeWeekDay" - }, - "x-nullable": true + "privateKeyData": { + "description": "Private key data", + "type": "string", + "x-ms-secret": true } - }, - "additionalProperties": false + } }, - "ComputeWeekDay": { - "description": "Enum of weekday", - "enum": [ - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", - "Sunday" - ], - "type": "string", - "x-ms-enum": { - "name": "ComputeWeekDay", - "modelAsString": true, - "values": [ - { - "value": "Monday", - "description": "Monday weekday" - }, - { - "value": "Tuesday", - "description": "Tuesday weekday" - }, - { - "value": "Wednesday", - "description": "Wednesday weekday" - }, - { - "value": "Thursday", - "description": "Thursday weekday" - }, - { - "value": "Friday", - "description": "Friday weekday" - }, - { - "value": "Saturday", - "description": "Saturday weekday" - }, - { - "value": "Sunday", - "description": "Sunday weekday" - } - ] + "ComputeSecrets": { + "type": "object", + "description": "Secrets related to a Machine Learning compute. Might differ for every type of compute.", + "discriminator": "computeType", + "properties": { + "computeType": { + "description": "The type of compute", + "$ref": "#/definitions/ComputeType" + } }, - "additionalProperties": false + "required": [ + "computeType" + ] }, - "Cron": { + "AksComputeSecretsProperties": { "type": "object", - "description": "The workflow trigger cron for ComputeStartStop schedule type.", + "description": "Properties of AksComputeSecrets", "properties": { - "startTime": { - "description": "The start time in yyyy-MM-ddTHH:mm:ss format.", + "userKubeConfig": { "type": "string", - "x-nullable": true + "description": "Content of kubeconfig file that can be used to connect to the Kubernetes cluster." }, - "timeZone": { - "description": "Specifies time zone in which the schedule runs.\r\nTimeZone should follow Windows time zone format. Refer: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11", + "adminKubeConfig": { "type": "string", - "default": "UTC" + "description": "Content of kubeconfig file that can be used to connect to the Kubernetes cluster." }, - "expression": { - "description": "[Required] Specifies cron expression of schedule.\r\nThe expression should follow NCronTab format.", - "type": "string" + "imagePullSecretName": { + "type": "string", + "description": "Image registry pull secret.", + "x-nullable": true } } }, - "IdleShutdownSetting": { + "AksComputeSecrets": { + "description": "Secrets related to a Machine Learning compute based on AKS.", + "allOf": [ + { + "$ref": "#/definitions/ComputeSecrets" + }, + { + "$ref": "#/definitions/AksComputeSecretsProperties" + } + ], + "x-ms-discriminator-value": "AKS" + }, + "VirtualMachineSecrets": { + "description": "Secrets related to a Machine Learning compute based on AKS.", + "allOf": [ + { + "$ref": "#/definitions/ComputeSecrets" + }, + { + "$ref": "#/definitions/VirtualMachineSecretsSchema" + } + ], + "x-ms-discriminator-value": "VirtualMachine" + }, + "VirtualMachineSecretsSchema": { "type": "object", - "description": "Stops compute instance after user defined period of inactivity.", "properties": { - "idleTimeBeforeShutdown": { - "type": "string", - "description": "Time is defined in ISO8601 format. Minimum is 15 min, maximum is 3 days." + "administratorAccount": { + "description": "Admin credentials for virtual machine.", + "$ref": "#/definitions/VirtualMachineSshCredentials" } } }, - "ComputeInstanceDataMount": { + "DatabricksComputeSecretsProperties": { "type": "object", - "description": "Defines an Aml Instance DataMount.", + "description": "Properties of Databricks Compute Secrets", "properties": { - "source": { - "type": "string", - "description": "Source of the ComputeInstance data mount." + "databricksAccessToken": { + "description": "access token for databricks account.", + "type": "string" + } + } + }, + "DatabricksComputeSecrets": { + "description": "Secrets related to a Machine Learning compute based on Databricks.", + "allOf": [ + { + "$ref": "#/definitions/ComputeSecrets" }, - "sourceType": { - "description": "Data source type.", + { + "$ref": "#/definitions/DatabricksComputeSecretsProperties" + } + ], + "x-ms-discriminator-value": "Databricks" + }, + "ComputeType": { + "type": "string", + "description": "The type of compute", + "enum": [ + "AKS", + "Kubernetes", + "AmlCompute", + "ComputeInstance", + "DataFactory", + "VirtualMachine", + "HDInsight", + "Databricks", + "DataLakeAnalytics", + "SynapseSpark" + ], + "x-ms-enum": { + "name": "ComputeType", + "modelAsString": true + } + }, + "ImageMetadata": { + "type": "object", + "description": "Returns metadata about the operating system image for this compute instance.", + "properties": { + "currentImageVersion": { "type": "string", - "enum": [ - "Dataset", - "Datastore", - "URI" - ], - "x-ms-enum": { - "name": "sourceType", - "modelAsString": true - } + "description": "Specifies the current operating system image version this compute instance is running on." }, - "mountName": { + "latestImageVersion": { "type": "string", - "description": "name of the ComputeInstance data mount." + "description": "Specifies the latest available operating system image version." }, - "mountAction": { - "description": "Mount Action.", + "isLatestOsImageVersion": { + "type": "boolean", + "description": "Specifies whether this compute instance is running on the latest operating system image." + }, + "osPatchingStatus": { + "readOnly": true, + "description": "Metadata about the os patching.", + "$ref": "#/definitions/OsPatchingStatus" + } + } + }, + "OsPatchingStatus": { + "type": "object", + "description": "Returns metadata about the os patching.", + "properties": { + "patchStatus": { "type": "string", + "description": "The os patching status.", "enum": [ - "Mount", - "Unmount" + "CompletedWithWarnings", + "Failed", + "InProgress", + "Succeeded", + "Unknown" ], "x-ms-enum": { - "name": "mountAction", + "name": "PatchStatus", "modelAsString": true } }, - "createdBy": { - "type": "string", - "description": "who this data mount created by." - }, - "mountPath": { + "latestPatchTime": { "type": "string", - "description": "Path of this data mount." + "description": "Time of the latest os patching." }, - "mountState": { - "description": "Mount state.", - "type": "string", - "enum": [ - "MountRequested", - "Mounted", - "MountFailed", - "UnmountRequested", - "UnmountFailed", - "Unmounted" - ], - "x-ms-enum": { - "name": "mountState", - "modelAsString": true - } + "rebootPending": { + "type": "boolean", + "description": "Specifies whether this compute instance is pending for reboot to finish os patching." }, - "mountedOn": { + "scheduledRebootTime": { "type": "string", - "format": "date-time", - "title": "Mounted time.", - "description": "The time when the disk mounted." + "description": "Time of scheduled reboot." }, - "error": { - "type": "string", - "description": "Error of this data mount." + "osPatchingErrors": { + "type": "array", + "x-nullable": true, + "description": "Collection of errors encountered when doing os patching.", + "items": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + }, + "x-ms-identifiers": [ + "/error/code" + ] } } }, - "ComputeInstanceDataDisk": { + "CustomService": { "type": "object", - "description": "Defines an Aml Instance DataDisk.", + "description": "Specifies the custom service configuration", "properties": { - "caching": { - "description": "Caching type of Data Disk.", + "name": { "type": "string", - "enum": [ - "None", - "ReadOnly", - "ReadWrite" - ], - "x-ms-enum": { - "name": "caching", - "modelAsString": true + "description": "Name of the Custom Service" + }, + "image": { + "$ref": "#/definitions/Image", + "description": "Describes the Image Specifications" + }, + "environmentVariables": { + "type": "object", + "description": "Environment Variable for the container", + "additionalProperties": { + "$ref": "#/definitions/EnvironmentVariable" } }, - "diskSizeGB": { - "type": "integer", - "format": "int32", - "title": "The initial disk size in gigabytes.", - "description": "The initial disk size in gigabytes." + "docker": { + "description": "Describes the docker settings for the image", + "$ref": "#/definitions/Docker", + "x-nullable": true }, - "lun": { - "type": "integer", - "format": "int32", - "title": "The logical unit number.", - "description": "The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun." + "endpoints": { + "type": "array", + "description": "Configuring the endpoints for the container", + "items": { + "$ref": "#/definitions/Endpoint" + }, + "x-ms-identifiers": [ + "name" + ] }, - "storageAccountType": { - "description": "type of this storage account.", - "type": "string", - "default": "Standard_LRS", - "enum": [ - "Standard_LRS", - "Premium_LRS" - ], - "x-ms-enum": { - "name": "storageAccountType", - "modelAsString": true - } + "volumes": { + "type": "array", + "description": "Configuring the volumes for the container", + "items": { + "$ref": "#/definitions/VolumeDefinition" + }, + "x-ms-identifiers": [ + "source", + "target" + ] + }, + "kernel": { + "description": "Describes the jupyter kernel settings for the image if its a custom environment", + "$ref": "#/definitions/JupyterKernelConfig" } - } + }, + "additionalProperties": true }, - "ComputeInstanceContainer": { + "Image": { "type": "object", - "description": "Defines an Aml Instance container.", "properties": { - "name": { - "type": "string", - "description": "Name of the ComputeInstance container." - }, - "autosave": { - "description": "Auto save settings.", - "type": "string", + "type": { + "default": "docker", "enum": [ - "None", - "Local", - "Remote" + "docker", + "azureml" ], + "type": "string", + "title": "Type of the image", + "description": "Type of the image. Possible values are: docker - For docker images. azureml - For AzureML Environment images (custom and curated)", "x-ms-enum": { - "name": "autosave", + "name": "ImageType", "modelAsString": true } }, - "gpu": { + "reference": { "type": "string", - "description": "Information of GPU." + "description": "Image reference URL if type is docker. Environment name if type is azureml" }, - "network": { - "description": "network of this container.", + "version": { "type": "string", + "description": "Version of image being used. If latest then skip this field" + } + }, + "additionalProperties": true + }, + "EnvironmentVariable": { + "type": "object", + "properties": { + "type": { "enum": [ - "Bridge", - "Host" + "local" ], + "default": "local", + "title": "Type of Environment Variable", + "description": "Type of the Environment Variable. Possible values are: local - For local variable", + "type": "string", "x-ms-enum": { - "name": "network", + "name": "EnvironmentVariableType", "modelAsString": true } }, - "environment": { - "description": "Environment information of this container.", - "$ref": "#/definitions/ComputeInstanceEnvironmentInfo" - }, - "services": { - "type": "array", - "readOnly": true, - "description": "services of this containers.", - "items": { - "type": "object" - }, - "x-ms-identifiers": [] + "value": { + "type": "string", + "description": "Value of the Environment variable" } - } + }, + "additionalProperties": true }, - "ComputeInstanceEnvironmentInfo": { + "Docker": { "type": "object", - "description": "Environment information", "properties": { - "name": { - "description": "name of environment.", - "type": "string" - }, - "version": { - "description": "version of environment.", - "type": "string" + "privileged": { + "type": "boolean", + "description": "Indicate whether container shall run in privileged or non-privileged mode.", + "x-nullable": true } - } + }, + "additionalProperties": true }, - "ComputeInstanceApplication": { + "Endpoint": { "type": "object", - "description": "Defines an Aml Instance application and its connectivity endpoint URI.", "properties": { - "displayName": { - "type": "string", - "description": "Name of the ComputeInstance application." + "protocol": { + "enum": [ + "tcp", + "udp", + "http" + ], + "default": "tcp", + "title": "Endpoint Communication Protocol", + "description": "Protocol over which communication will happen over this endpoint", + "x-ms-enum": { + "name": "protocol", + "modelAsString": true + }, + "type": "string" }, - "endpointUri": { - "type": "string", - "description": "Application' endpoint URI." - } - } - }, - "ComputeInstanceConnectivityEndpoints": { - "type": "object", - "readOnly": true, - "description": "Defines all connectivity endpoints and properties for an ComputeInstance.", - "properties": { - "publicIpAddress": { + "name": { "type": "string", - "readOnly": true, - "description": "Public IP Address of this ComputeInstance.", + "description": "Name of the Endpoint" + }, + "target": { + "format": "int32", + "type": "integer", + "description": "Application port inside the container." + }, + "published": { + "format": "int32", + "type": "integer", + "description": "Port over which the application is exposed from container.", "x-nullable": true }, - "privateIpAddress": { + "hostIp": { + "description": "Host IP over which the application is exposed from the container", "type": "string", - "readOnly": true, - "description": "Private IP Address of this ComputeInstance (local to the VNET in which the compute instance is deployed).", "x-nullable": true } } }, - "ComputeInstanceCreatedBy": { + "VolumeDefinition": { "type": "object", - "readOnly": true, - "description": "Describes information on user who created this ComputeInstance.", "properties": { - "userName": { - "type": "string", - "readOnly": true, - "description": "Name of the user.", + "type": { + "enum": [ + "bind", + "volume", + "tmpfs", + "npipe" + ], + "default": "bind", + "title": "Type of Volume Definition", + "description": "Type of Volume Definition. Possible Values: bind,volume,tmpfs,npipe", + "x-ms-enum": { + "name": "VolumeDefinitionType", + "modelAsString": true + }, + "type": "string" + }, + "readOnly": { + "type": "boolean", + "description": "Indicate whether to mount volume as readOnly. Default value for this is false.", "x-nullable": true }, - "userOrgId": { + "source": { "type": "string", - "readOnly": true, - "description": "Uniquely identifies user' Azure Active Directory organization." + "description": "Source of the mount. For bind mounts this is the host path." }, - "userId": { + "target": { "type": "string", - "readOnly": true, - "description": "Uniquely identifies the user within his/her organization.", + "description": "Target of the mount. For bind mounts this is the path in the container." + }, + "consistency": { + "type": "string", + "description": "Consistency of the volume", + "x-nullable": true + }, + "bind": { + "$ref": "#/definitions/BindOptions", + "description": "Bind Options of the mount", + "x-nullable": true + }, + "volume": { + "$ref": "#/definitions/VolumeOptions", + "description": "Volume Options of the mount", + "x-nullable": true + }, + "tmpfs": { + "$ref": "#/definitions/TmpfsOptions", + "description": "tmpfs option of the mount", "x-nullable": true } } }, - "PersonalComputeInstanceSettings": { + "VolumeOptions": { "type": "object", "properties": { - "assignedUser": { - "$ref": "#/definitions/AssignedUser", - "title": "Assigned User.", - "description": "A user explicitly assigned to a personal compute instance." + "nocopy": { + "type": "boolean", + "description": "Indicate whether volume is nocopy", + "x-nullable": true } - }, - "description": "Settings for a personal compute instance." + } }, - "AssignedUser": { + "BindOptions": { "type": "object", - "description": "A user that can be assigned to a compute instance.", "properties": { - "objectId": { + "propagation": { "type": "string", - "description": "User’s AAD Object Id." + "description": "Type of Bind Option", + "x-nullable": true }, - "tenantId": { - "type": "string", - "description": "User’s AAD Tenant Id." - } - }, - "required": [ - "objectId", - "tenantId" - ] - }, - "ServerlessComputeSettings": { - "type": "object", - "properties": { - "serverlessComputeCustomSubnet": { - "description": "The resource ID of an existing virtual network subnet in which serverless compute nodes should be deployed", - "type": "string", - "format": "arm-id" + "createHostPath": { + "type": "boolean", + "description": "Indicate whether to create host path.", + "x-nullable": true }, - "serverlessComputeNoPublicIP": { - "description": "The flag to signal if serverless compute nodes deployed in custom vNet would have no public IP addresses for a workspace with private endpoint", - "type": "boolean" - } - } - }, - "ServiceManagedResourcesSettings": { - "type": "object", - "properties": { - "cosmosDb": { - "$ref": "#/definitions/CosmosDbSettings", - "description": "The settings for the service managed cosmosdb account." + "selinux": { + "type": "string", + "description": "Mention the selinux options.", + "x-nullable": true } } }, - "CosmosDbSettings": { + "TmpfsOptions": { "type": "object", "properties": { - "collectionsThroughput": { - "type": "integer", + "size": { "format": "int32", - "description": "The throughput of the collections in cosmosdb database" + "type": "integer", + "description": "Mention the Tmpfs size" } } }, - "OutboundRuleListResult": { - "description": "List of outbound rules for the managed network of a machine learning workspace.", + "JupyterKernelConfig": { "type": "object", + "description": "Jupyter kernel configuration.", "properties": { - "nextLink": { - "description": "The link to the next page constructed using the continuationToken. If null, there are no additional pages.", - "type": "string" - }, - "value": { - "description": "The list of machine learning workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning workspaces.", + "argv": { "type": "array", + "description": "Argument to the the runtime", "items": { - "$ref": "#/definitions/OutboundRuleBasicResource" + "type": "string", + "description": "argument values" } - } - } - }, - "OutboundRuleBasicResource": { - "description": "Outbound Rule Basic Resource for the managed network of a machine learning workspace.", - "required": [ - "properties" - ], - "type": "object", - "allOf": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" - } - ], - "properties": { - "properties": { - "$ref": "#/definitions/OutboundRule" - } - } - }, - "ManagedNetworkSettings": { - "description": "Managed Network settings for a machine learning workspace.", - "type": "object", - "properties": { - "isolationMode": { - "description": "Isolation mode for the managed network of a machine learning workspace.", - "$ref": "#/definitions/IsolationMode" }, - "networkId": { + "displayName": { "type": "string", - "readOnly": true - }, - "outboundRules": { - "type": "object", - "additionalProperties": { - "description": "Outbound Rule for the managed network of a machine learning workspace.", - "$ref": "#/definitions/OutboundRule" - }, - "x-nullable": true + "description": "Display name of the kernel" }, - "status": { - "description": "Status of the Provisioning for the managed network of a machine learning workspace.", - "$ref": "#/definitions/ManagedNetworkProvisionStatus" + "language": { + "type": "string", + "description": "Language of the kernel [Example value: python]" } } }, - "ManagedNetworkProvisionOptions": { - "description": "Managed Network Provisioning options for managed network of a machine learning workspace.", + "ComputeInstanceAutologgerSettings": { "type": "object", + "description": "Specifies settings for autologger.", "properties": { - "includeSpark": { - "type": "boolean" + "mlflowAutologger": { + "type": "string", + "description": "Indicates whether mlflow autologger is enabled for notebooks.", + "enum": [ + "Enabled", + "Disabled" + ], + "x-ms-enum": { + "name": "mlflowAutologger", + "modelAsString": true + } } } }, - "ManagedNetworkProvisionStatus": { - "description": "Status of the Provisioning for the managed network of a machine learning workspace.", + "ComputeInstanceSshSettings": { "type": "object", + "description": "Specifies policy and settings for SSH access.", "properties": { - "sparkReady": { - "type": "boolean" + "sshPublicAccess": { + "type": "string", + "default": "Disabled", + "title": "Access policy for SSH", + "description": "State of the public SSH port. Possible values are: Disabled - Indicates that the public ssh port is closed on this instance. Enabled - Indicates that the public ssh port is open and accessible according to the VNet/subnet policy if applicable.", + "enum": [ + "Enabled", + "Disabled" + ], + "x-ms-enum": { + "name": "sshPublicAccess", + "modelAsString": true + } }, - "status": { - "$ref": "#/definitions/ManagedNetworkStatus" + "adminUserName": { + "type": "string", + "readOnly": true, + "description": "Describes the admin user name." + }, + "sshPort": { + "type": "integer", + "format": "int32", + "readOnly": true, + "description": "Describes the port for connecting through SSH." + }, + "adminPublicKey": { + "type": "string", + "description": "Specifies the SSH rsa public key file as a string. Use \"ssh-keygen -t rsa -b 2048\" to generate your SSH key pairs." } } }, - "ManagedNetworkStatus": { - "description": "Status for the managed network of a machine learning workspace.", - "enum": [ - "Inactive", - "Active" - ], + "ComputeInstanceState": { "type": "string", - "x-ms-enum": { - "name": "ManagedNetworkStatus", - "modelAsString": true - } - }, - "IsolationMode": { - "description": "Isolation mode for the managed network of a machine learning workspace.", + "description": "Current state of an ComputeInstance.", "enum": [ - "Disabled", - "AllowInternetOutbound", - "AllowOnlyApprovedOutbound" + "Creating", + "CreateFailed", + "Deleting", + "Running", + "Restarting", + "Resizing", + "JobRunning", + "SettingUp", + "SetupFailed", + "Starting", + "Stopped", + "Stopping", + "UserSettingUp", + "UserSetupFailed", + "Unknown", + "Unusable" ], - "type": "string", "x-ms-enum": { - "name": "IsolationMode", + "name": "ComputeInstanceState", "modelAsString": true } }, - "OutboundRule": { - "description": "Outbound Rule for the managed network of a machine learning workspace.", - "required": [ - "type" - ], + "ComputeInstanceLastOperation": { "type": "object", + "description": "The last operation on ComputeInstance.", "properties": { - "category": { - "$ref": "#/definitions/RuleCategory" + "operationName": { + "type": "string", + "description": "Name of the last operation.", + "enum": [ + "Create", + "Start", + "Stop", + "Restart", + "Resize", + "Reimage", + "Delete" + ], + "x-ms-enum": { + "name": "OperationName", + "modelAsString": true + } }, - "status": { - "$ref": "#/definitions/RuleStatus" + "operationTime": { + "type": "string", + "format": "date-time", + "description": "Time of the last operation." }, - "type": { - "$ref": "#/definitions/RuleType" - } - }, - "discriminator": "type" - }, - "PrivateEndpointOutboundRule": { - "description": "Private Endpoint Outbound Rule for the managed network of a machine learning workspace.", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/OutboundRule" - } - ], - "properties": { - "destination": { - "$ref": "#/definitions/PrivateEndpointDestination" + "operationStatus": { + "type": "string", + "description": "Operation status.", + "enum": [ + "InProgress", + "Succeeded", + "CreateFailed", + "StartFailed", + "StopFailed", + "RestartFailed", + "ResizeFailed", + "ReimageFailed", + "DeleteFailed" + ], + "x-ms-enum": { + "name": "OperationStatus", + "modelAsString": true + } + }, + "operationTrigger": { + "type": "string", + "description": "Trigger of operation.", + "enum": [ + "User", + "Schedule", + "IdleShutdown" + ], + "x-ms-enum": { + "name": "operationTrigger", + "modelAsString": true + } } - }, - "x-ms-discriminator-value": "PrivateEndpoint" + } }, - "PrivateEndpointDestination": { + "ComputeInstanceVersion": { "type": "object", - "description": "Private Endpoint destination for a Private Endpoint Outbound Rule for the managed network of a machine learning workspace.", + "description": "Version of computeInstance.", "properties": { - "serviceResourceId": { + "runtime": { "type": "string", - "format": "arm-id" - }, - "sparkEnabled": { - "type": "boolean" - }, - "sparkStatus": { - "$ref": "#/definitions/RuleStatus" - }, - "subresourceTarget": { - "type": "string" + "description": "Runtime of compute instance.", + "x-nullable": true } } }, - "ServiceTagOutboundRule": { + "ComputeSchedules": { "type": "object", - "description": "Service Tag Outbound Rule for the managed network of a machine learning workspace.", - "allOf": [ - { - "$ref": "#/definitions/OutboundRule" - } - ], + "description": "The list of schedules to be applied on the computes", "properties": { - "destination": { - "$ref": "#/definitions/ServiceTagDestination" + "computeStartStop": { + "type": "array", + "items": { + "$ref": "#/definitions/ComputeStartStopSchedule" + }, + "description": "The list of compute start stop schedules to be applied." } - }, - "x-ms-discriminator-value": "ServiceTag" + } }, - "ServiceTagDestination": { + "ComputeStartStopSchedule": { "type": "object", - "description": "Service Tag destination for a Service Tag Outbound Rule for the managed network of a machine learning workspace.", + "description": "Compute start stop schedule properties", "properties": { - "action": { - "$ref": "#/definitions/RuleAction" + "id": { + "description": "A system assigned id for the schedule.", + "type": "string", + "x-nullable": true, + "readOnly": true }, - "addressPrefixes": { - "description": "Optional, if provided, the ServiceTag property will be ignored.", - "type": "array", - "items": { - "type": "string" + "provisioningStatus": { + "description": "The current deployment state of schedule.", + "type": "string", + "enum": [ + "Completed", + "Provisioning", + "Failed" + ], + "x-ms-enum": { + "name": "provisioningStatus", + "modelAsString": true, + "values": [ + { + "value": "Completed" + }, + { + "value": "Provisioning" + }, + { + "value": "Failed" + } + ] }, "readOnly": true }, - "portRanges": { - "type": "string" + "status": { + "$ref": "#/definitions/ScheduleStatus" }, - "protocol": { - "type": "string" + "action": { + "description": "[Required] The compute power action.", + "$ref": "#/definitions/ComputePowerAction" }, - "serviceTag": { - "type": "string" + "triggerType": { + "description": "[Required] The schedule trigger type.", + "$ref": "#/definitions/ComputeTriggerType" + }, + "recurrence": { + "description": "Required if triggerType is Recurrence.", + "$ref": "#/definitions/Recurrence" + }, + "cron": { + "description": "Required if triggerType is Cron.", + "$ref": "#/definitions/Cron" + }, + "schedule": { + "description": "[Deprecated] Not used any more.", + "$ref": "#/definitions/ScheduleBase" } } }, - "RuleAction": { - "description": "The action enum for networking rule.", + "ComputeTriggerType": { "enum": [ - "Allow", - "Deny" + "Recurrence", + "Cron" ], "type": "string", "x-ms-enum": { - "name": "RuleAction", - "modelAsString": true - } + "name": "ComputeTriggerType", + "modelAsString": true, + "values": [ + { + "value": "Recurrence" + }, + { + "value": "Cron" + } + ] + }, + "additionalProperties": false }, - "FqdnOutboundRule": { + "ScheduleBase": { "type": "object", - "description": "FQDN Outbound Rule for the managed network of a machine learning workspace.", - "allOf": [ - { - "$ref": "#/definitions/OutboundRule" - } - ], "properties": { - "destination": { - "type": "string" + "id": { + "description": "A system assigned id for the schedule.", + "type": "string", + "x-nullable": true + }, + "provisioningStatus": { + "$ref": "#/definitions/ScheduleProvisioningState" + }, + "status": { + "$ref": "#/definitions/ScheduleStatus" } }, - "x-ms-discriminator-value": "FQDN" + "additionalProperties": false }, - "RuleCategory": { - "description": "Category of a managed network Outbound Rule of a machine learning workspace.", + "ScheduleProvisioningState": { "enum": [ - "Required", - "Recommended", - "UserDefined", - "Dependency" + "Completed", + "Provisioning", + "Failed" ], + "description": "The current deployment state of schedule.", "type": "string", "x-ms-enum": { - "name": "RuleCategory", - "modelAsString": true - } + "name": "ScheduleProvisioningState", + "modelAsString": true, + "values": [ + { + "value": "Completed" + }, + { + "value": "Provisioning" + }, + { + "value": "Failed" + } + ] + }, + "additionalProperties": false }, - "RuleStatus": { - "description": "Type of a managed network Outbound Rule of a machine learning workspace.", + "ScheduleStatus": { "enum": [ - "Inactive", - "Active" + "Enabled", + "Disabled" ], + "description": "Is the schedule enabled or disabled?", "type": "string", "x-ms-enum": { - "name": "RuleStatus", - "modelAsString": true - } + "name": "ScheduleStatus", + "modelAsString": true, + "values": [ + { + "value": "Enabled" + }, + { + "value": "Disabled" + } + ] + }, + "additionalProperties": false }, - "RuleType": { - "description": "Type of a managed network Outbound Rule of a machine learning workspace.", + "ComputePowerAction": { + "type": "string", + "description": "[Required] The compute power action.", "enum": [ - "FQDN", - "PrivateEndpoint", - "ServiceTag" + "Start", + "Stop" ], - "type": "string", "x-ms-enum": { - "name": "RuleType", + "name": "ComputePowerAction", "modelAsString": true } }, - "NotebookResourceInfo": { + "Recurrence": { "type": "object", + "description": "The workflow trigger recurrence for ComputeStartStop schedule type.", "properties": { - "fqdn": { - "type": "string" + "frequency": { + "description": "[Required] The frequency to trigger schedule.", + "$ref": "#/definitions/ComputeRecurrenceFrequency" }, - "resourceId": { - "type": "string", - "description": "the data plane resourceId that used to initialize notebook component" + "interval": { + "description": "[Required] Specifies schedule interval in conjunction with frequency", + "type": "integer", + "format": "int32" }, - "notebookPreparationError": { - "$ref": "#/definitions/NotebookPreparationError", - "description": "The error that occurs when preparing notebook.", + "startTime": { + "description": "The start time in yyyy-MM-ddTHH:mm:ss format.", + "type": "string", "x-nullable": true - } - } - }, - "NotebookPreparationError": { - "type": "object", - "properties": { - "errorMessage": { - "type": "string" }, - "statusCode": { - "format": "int32", - "type": "integer" - } - } - }, - "ListNotebookKeysResult": { - "type": "object", - "properties": { - "primaryAccessKey": { - "readOnly": true, - "type": "string", - "x-ms-secret": true + "timeZone": { + "description": "Specifies time zone in which the schedule runs.\r\nTimeZone should follow Windows time zone format. Refer: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11", + "default": "UTC", + "type": "string" }, - "secondaryAccessKey": { - "readOnly": true, - "type": "string", - "x-ms-secret": true - } - } - }, - "ListStorageAccountKeysResult": { - "type": "object", - "properties": { - "userStorageKey": { - "readOnly": true, - "type": "string", - "x-ms-secret": true + "schedule": { + "description": "[Required] The recurrence schedule.", + "$ref": "#/definitions/ComputeRecurrenceSchedule" } } }, - "ConnectionAuthType": { - "description": "Authentication type of the connection target", - "enum": [ - "PAT", - "ManagedIdentity", - "UsernamePassword", - "None", - "SAS", - "AccountKey", - "ServicePrincipal", - "AccessKey", - "ApiKey", - "CustomKeys", - "OAuth2", - "AAD" - ], - "type": "string", - "x-ms-enum": { - "name": "ConnectionAuthType", - "modelAsString": true - } - }, - "ConnectionCategory": { - "description": "Category of the connection", + "ComputeRecurrenceFrequency": { + "description": "Enum to describe the frequency of a compute recurrence schedule", "enum": [ - "PythonFeed", - "ContainerRegistry", - "Git", - "S3", - "Snowflake", - "AzureSqlDb", - "AzureSynapseAnalytics", - "AzureMySqlDb", - "AzurePostgresDb", - "ADLSGen2", - "Redis", - "ApiKey", - "AzureOpenAI", - "CognitiveSearch", - "CognitiveService", - "CustomKeys", - "AzureBlob", - "AzureOneLake", - "CosmosDb", - "CosmosDbMongoDbApi", - "AzureDataExplorer", - "AzureMariaDb", - "AzureDatabricksDeltaLake", - "AzureSqlMi", - "AzureTableStorage", - "AmazonRdsForOracle", - "AmazonRdsForSqlServer", - "AmazonRedshift", - "Db2", - "Drill", - "GoogleBigQuery", - "Greenplum", - "Hbase", - "Hive", - "Impala", - "Informix", - "MariaDb", - "MicrosoftAccess", - "MySql", - "Netezza", - "Oracle", - "Phoenix", - "PostgreSql", - "Presto", - "SapOpenHub", - "SapBw", - "SapHana", - "SapTable", - "Spark", - "SqlServer", - "Sybase", - "Teradata", - "Vertica", - "Cassandra", - "Couchbase", - "MongoDbV2", - "MongoDbAtlas", - "AmazonS3Compatible", - "FileServer", - "FtpServer", - "GoogleCloudStorage", - "Hdfs", - "OracleCloudStorage", - "Sftp", - "GenericHttp", - "ODataRest", - "Odbc", - "GenericRest", - "AmazonMws", - "Concur", - "Dynamics", - "DynamicsAx", - "DynamicsCrm", - "GoogleAdWords", - "Hubspot", - "Jira", - "Magento", - "Marketo", - "Office365", - "Eloqua", - "Responsys", - "OracleServiceCloud", - "PayPal", - "QuickBooks", - "Salesforce", - "SalesforceServiceCloud", - "SalesforceMarketingCloud", - "SapCloudForCustomer", - "SapEcc", - "ServiceNow", - "SharePointOnlineList", - "Shopify", - "Square", - "WebTable", - "Xero", - "Zoho", - "GenericContainerRegistry", - "OpenAI", - "Serp", - "BingLLMSearch", - "Serverless", - "AIServices" + "Minute", + "Hour", + "Day", + "Week", + "Month" ], "type": "string", "x-ms-enum": { - "name": "ConnectionCategory", - "modelAsString": true - } - }, - "WorkspaceConnectionUsernamePassword": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "password": { - "type": "string" - }, - "securityToken": { - "description": "Optional, required by connections like SalesForce for extra security in addition to UsernamePassword", - "type": "string", - "x-ms-secret": true - } - }, - "additionalProperties": false - }, - "WorkspaceConnectionPersonalAccessToken": { - "type": "object", - "properties": { - "pat": { - "type": "string" - } + "name": "ComputeRecurrenceFrequency", + "modelAsString": true, + "values": [ + { + "value": "Minute", + "description": "Minute frequency" + }, + { + "value": "Hour", + "description": "Hour frequency" + }, + { + "value": "Day", + "description": "Day frequency" + }, + { + "value": "Week", + "description": "Week frequency" + }, + { + "value": "Month", + "description": "Month frequency" + } + ] }, "additionalProperties": false }, - "PATAuthTypeWorkspaceConnectionProperties": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" - } + "ComputeRecurrenceSchedule": { + "required": [ + "hours", + "minutes" ], - "properties": { - "credentials": { - "$ref": "#/definitions/WorkspaceConnectionPersonalAccessToken" - } - }, - "additionalProperties": false, - "x-ms-discriminator-value": "PAT" - }, - "WorkspaceConnectionSharedAccessSignature": { - "type": "object", - "properties": { - "sas": { - "type": "string" - } - }, - "additionalProperties": false - }, - "WorkspaceConnectionAccountKey": { "type": "object", "properties": { - "key": { - "type": "string", - "x-ms-secret": true + "hours": { + "description": "[Required] List of hours for the schedule.", + "type": "array", + "items": { + "format": "int32", + "type": "integer" + } + }, + "minutes": { + "description": "[Required] List of minutes for the schedule.", + "type": "array", + "items": { + "format": "int32", + "type": "integer" + } + }, + "monthDays": { + "description": "List of month days for the schedule", + "type": "array", + "items": { + "format": "int32", + "type": "integer" + }, + "x-nullable": true + }, + "weekDays": { + "description": "List of days for the schedule.", + "type": "array", + "items": { + "$ref": "#/definitions/ComputeWeekDay" + }, + "x-nullable": true } }, "additionalProperties": false }, - "SASAuthTypeWorkspaceConnectionProperties": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" - } + "ComputeWeekDay": { + "description": "Enum of weekday", + "enum": [ + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday" ], - "properties": { - "credentials": { - "$ref": "#/definitions/WorkspaceConnectionSharedAccessSignature" - } + "type": "string", + "x-ms-enum": { + "name": "ComputeWeekDay", + "modelAsString": true, + "values": [ + { + "value": "Monday", + "description": "Monday weekday" + }, + { + "value": "Tuesday", + "description": "Tuesday weekday" + }, + { + "value": "Wednesday", + "description": "Wednesday weekday" + }, + { + "value": "Thursday", + "description": "Thursday weekday" + }, + { + "value": "Friday", + "description": "Friday weekday" + }, + { + "value": "Saturday", + "description": "Saturday weekday" + }, + { + "value": "Sunday", + "description": "Sunday weekday" + } + ] }, - "additionalProperties": false, - "x-ms-discriminator-value": "SAS" + "additionalProperties": false }, - "UsernamePasswordAuthTypeWorkspaceConnectionProperties": { + "Cron": { "type": "object", - "allOf": [ - { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" - } - ], + "description": "The workflow trigger cron for ComputeStartStop schedule type.", "properties": { - "credentials": { - "$ref": "#/definitions/WorkspaceConnectionUsernamePassword" + "startTime": { + "description": "The start time in yyyy-MM-ddTHH:mm:ss format.", + "type": "string", + "x-nullable": true + }, + "timeZone": { + "description": "Specifies time zone in which the schedule runs.\r\nTimeZone should follow Windows time zone format. Refer: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11", + "type": "string", + "default": "UTC" + }, + "expression": { + "description": "[Required] Specifies cron expression of schedule.\r\nThe expression should follow NCronTab format.", + "type": "string" } - }, - "additionalProperties": false, - "x-ms-discriminator-value": "UsernamePassword" + } }, - "WorkspaceConnectionPropertiesV2": { - "required": [ - "authType" - ], + "ComputeInstanceDataMount": { "type": "object", + "description": "Defines an Aml Instance DataMount.", "properties": { - "authType": { - "description": "Authentication type of the connection target", - "$ref": "#/definitions/ConnectionAuthType" + "source": { + "type": "string", + "description": "Source of the ComputeInstance data mount." }, - "category": { - "description": "Category of the connection", - "$ref": "#/definitions/ConnectionCategory" + "sourceType": { + "description": "Data source type.", + "type": "string", + "enum": [ + "Dataset", + "Datastore", + "URI" + ], + "x-ms-enum": { + "name": "sourceType", + "modelAsString": true + } }, - "createdByWorkspaceArmId": { + "mountName": { "type": "string", - "format": "arm-id", - "readOnly": true + "description": "name of the ComputeInstance data mount." }, - "expiryTime": { - "format": "date-time", - "type": "string" + "mountAction": { + "description": "Mount Action.", + "type": "string", + "enum": [ + "Mount", + "Unmount" + ], + "x-ms-enum": { + "name": "mountAction", + "modelAsString": true + } }, - "group": { - "description": "Group based on connection category", - "$ref": "#/definitions/ConnectionGroup", - "readOnly": true + "mountMode": { + "description": "Mount Mode.", + "type": "string", + "enum": [ + "ReadOnly", + "ReadWrite" + ], + "x-ms-enum": { + "name": "mountMode", + "modelAsString": true + } }, - "isSharedToAll": { - "type": "boolean" + "createdBy": { + "type": "string", + "description": "who this data mount created by." }, - "target": { - "type": "string" + "mountPath": { + "type": "string", + "description": "Path of this data mount." }, - "metadata": { - "description": "Store user metadata for this connection", - "type": "object", - "additionalProperties": { - "type": "string" + "mountState": { + "description": "Mount state.", + "type": "string", + "enum": [ + "MountRequested", + "Mounted", + "MountFailed", + "UnmountRequested", + "UnmountFailed", + "Unmounted" + ], + "x-ms-enum": { + "name": "mountState", + "modelAsString": true } }, - "sharedUserList": { - "type": "array", - "items": { - "type": "string" + "mountedOn": { + "type": "string", + "format": "date-time", + "title": "Mounted time.", + "description": "The time when the disk mounted." + }, + "error": { + "type": "string", + "description": "Error of this data mount." + } + } + }, + "ComputeInstanceDataDisk": { + "type": "object", + "description": "Defines an Aml Instance DataDisk.", + "properties": { + "caching": { + "description": "Caching type of Data Disk.", + "type": "string", + "enum": [ + "None", + "ReadOnly", + "ReadWrite" + ], + "x-ms-enum": { + "name": "caching", + "modelAsString": true } }, - "value": { - "description": "Value details of the workspace connection.", - "type": "string" + "diskSizeGB": { + "type": "integer", + "format": "int32", + "title": "The initial disk size in gigabytes.", + "description": "The initial disk size in gigabytes." + }, + "lun": { + "type": "integer", + "format": "int32", + "title": "The logical unit number.", + "description": "The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun." }, - "valueFormat": { - "description": "format for the workspace connection value", + "storageAccountType": { + "description": "type of this storage account.", "type": "string", + "default": "Standard_LRS", "enum": [ - "JSON" + "Standard_LRS", + "Premium_LRS" ], "x-ms-enum": { - "name": "ValueFormat", + "name": "storageAccountType", "modelAsString": true } } - }, - "discriminator": "authType" + } }, - "NoneAuthTypeWorkspaceConnectionProperties": { + "ComputeInstanceContainer": { "type": "object", - "allOf": [ - { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + "description": "Defines an Aml Instance container.", + "properties": { + "name": { + "type": "string", + "description": "Name of the ComputeInstance container." + }, + "autosave": { + "description": "Auto save settings.", + "type": "string", + "enum": [ + "None", + "Local", + "Remote" + ], + "x-ms-enum": { + "name": "autosave", + "modelAsString": true + } + }, + "gpu": { + "type": "string", + "description": "Information of GPU." + }, + "network": { + "description": "network of this container.", + "type": "string", + "enum": [ + "Bridge", + "Host" + ], + "x-ms-enum": { + "name": "network", + "modelAsString": true + } + }, + "environment": { + "description": "Environment information of this container.", + "$ref": "#/definitions/ComputeInstanceEnvironmentInfo" + }, + "services": { + "type": "array", + "readOnly": true, + "description": "services of this containers.", + "items": { + "type": "object" + }, + "x-ms-identifiers": [] } - ], - "additionalProperties": false, - "x-ms-discriminator-value": "None" + } }, - "WorkspaceConnectionManagedIdentity": { + "ComputeInstanceEnvironmentInfo": { "type": "object", + "description": "Environment information", "properties": { - "resourceId": { + "name": { + "description": "name of environment.", "type": "string" }, - "clientId": { + "version": { + "description": "version of environment.", "type": "string" } - }, - "additionalProperties": false + } }, - "ManagedIdentityAuthTypeWorkspaceConnectionProperties": { + "ComputeInstanceApplication": { "type": "object", - "allOf": [ - { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + "description": "Defines an Aml Instance application and its connectivity endpoint URI.", + "properties": { + "displayName": { + "type": "string", + "description": "Name of the ComputeInstance application." + }, + "endpointUri": { + "type": "string", + "description": "Application' endpoint URI." } - ], + } + }, + "ComputeInstanceConnectivityEndpoints": { + "type": "object", + "readOnly": true, + "description": "Defines all connectivity endpoints and properties for an ComputeInstance.", + "properties": { + "publicIpAddress": { + "type": "string", + "readOnly": true, + "description": "Public IP Address of this ComputeInstance.", + "x-nullable": true + }, + "privateIpAddress": { + "type": "string", + "readOnly": true, + "description": "Private IP Address of this ComputeInstance (local to the VNET in which the compute instance is deployed).", + "x-nullable": true + } + } + }, + "ComputeInstanceCreatedBy": { + "type": "object", + "readOnly": true, + "description": "Describes information on user who created this ComputeInstance.", "properties": { - "credentials": { - "$ref": "#/definitions/WorkspaceConnectionManagedIdentity" + "userName": { + "type": "string", + "readOnly": true, + "description": "Name of the user.", + "x-nullable": true + }, + "userOrgId": { + "type": "string", + "readOnly": true, + "description": "Uniquely identifies user' Azure Active Directory organization." + }, + "userId": { + "type": "string", + "readOnly": true, + "description": "Uniquely identifies the user within his/her organization.", + "x-nullable": true } - }, - "additionalProperties": false, - "x-ms-discriminator-value": "ManagedIdentity" + } }, - "WorkspaceConnectionPropertiesV2BasicResource": { - "required": [ - "properties" - ], + "PersonalComputeInstanceSettings": { "type": "object", - "allOf": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" - } - ], "properties": { - "properties": { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + "assignedUser": { + "$ref": "#/definitions/AssignedUser", + "title": "Assigned User.", + "description": "A user explicitly assigned to a personal compute instance." } }, - "additionalProperties": false + "description": "Settings for a personal compute instance." }, - "WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult": { + "AssignedUser": { "type": "object", + "description": "A user that can be assigned to a compute instance.", "properties": { - "value": { - "type": "array", - "items": { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResource" - } + "objectId": { + "type": "string", + "description": "User’s AAD Object Id." }, - "nextLink": { - "readOnly": true, - "type": "string" + "tenantId": { + "type": "string", + "description": "User’s AAD Tenant Id." } }, - "additionalProperties": false + "required": [ + "objectId", + "tenantId" + ] }, "SetupScripts": { "type": "object", @@ -6896,7 +4088,7 @@ "description": "Script reference", "properties": { "scriptSource": { - "description": "The storage source of the script: workspace.", + "description": "The storage source of the script: inline, workspace.", "type": "string" }, "scriptData": { @@ -6979,337 +4171,25 @@ "type": "string" } }, - "FQDNEndpointDetail": { - "type": "object", - "properties": { - "port": { - "format": "int32", - "type": "integer" - } - } - }, - "FQDNEndpoint": { - "type": "object", - "properties": { - "domainName": { - "type": "string" - }, - "endpointDetails": { - "type": "array", - "items": { - "$ref": "#/definitions/FQDNEndpointDetail" - }, - "x-ms-identifiers": [ - "port" - ] - } - } - }, - "FQDNEndpointsProperties": { - "type": "object", - "properties": { - "category": { - "type": "string" - }, - "endpoints": { - "type": "array", - "items": { - "$ref": "#/definitions/FQDNEndpoint" - }, - "x-ms-identifiers": [ - "domainName" - ] - } - } - }, - "FQDNEndpoints": { - "type": "object", - "properties": { - "properties": { - "$ref": "#/definitions/FQDNEndpointsProperties" - } - } - }, - "ExternalFQDNResponse": { - "type": "object", - "properties": { - "value": { - "type": "array", - "items": { - "$ref": "#/definitions/FQDNEndpoints" - }, - "x-ms-identifiers": [ - "/properties/category" - ] - } - } - }, - "FeatureStoreSettings": { - "type": "object", - "description": "Settings for feature store type workspace.", - "properties": { - "computeRuntime": { - "$ref": "#/definitions/ComputeRuntimeDto" - }, - "offlineStoreConnectionName": { - "type": "string" - }, - "onlineStoreConnectionName": { - "type": "string" - } - } - }, - "ComputeRuntimeDto": { - "type": "object", - "description": "Compute runtime config for feature store type workspace.", - "properties": { - "sparkRuntimeVersion": { - "type": "string" - } - } - }, - "AADAuthTypeWorkspaceConnectionProperties": { - "description": "This connection type covers the AAD auth for any applicable Azure service", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" - } - ], - "x-ms-discriminator-value": "AAD" - }, - "AccessKeyAuthTypeWorkspaceConnectionProperties": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" - } - ], - "properties": { - "credentials": { - "$ref": "#/definitions/WorkspaceConnectionAccessKey" - } - }, - "x-ms-discriminator-value": "AccessKey" - }, - "WorkspaceConnectionAccessKey": { - "type": "object", - "properties": { - "accessKeyId": { - "type": "string" - }, - "secretAccessKey": { - "type": "string" - } - } - }, - "AccountKeyAuthTypeWorkspaceConnectionProperties": { - "description": "This connection type covers the account key connection for Azure storage", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" - } - ], - "properties": { - "credentials": { - "$ref": "#/definitions/WorkspaceConnectionAccountKey" - } - }, - "x-ms-discriminator-value": "AccountKey" - }, - "ApiKeyAuthWorkspaceConnectionProperties": { - "description": "This connection type covers the generic ApiKey auth connection categories, for examples:\r\nAzureOpenAI:\r\n Category:= AzureOpenAI\r\n AuthType:= ApiKey (as type discriminator)\r\n Credentials:= {ApiKey} as Microsoft.MachineLearning.AccountRP.Contracts.WorkspaceConnection.ApiKey\r\n Target:= {ApiBase}\r\n \r\nCognitiveService:\r\n Category:= CognitiveService\r\n AuthType:= ApiKey (as type discriminator)\r\n Credentials:= {SubscriptionKey} as Microsoft.MachineLearning.AccountRP.Contracts.WorkspaceConnection.ApiKey\r\n Target:= ServiceRegion={serviceRegion}\r\n \r\nCognitiveSearch:\r\n Category:= CognitiveSearch\r\n AuthType:= ApiKey (as type discriminator)\r\n Credentials:= {Key} as Microsoft.MachineLearning.AccountRP.Contracts.WorkspaceConnection.ApiKey\r\n Target:= {Endpoint}\r\n \r\nUse Metadata property bag for ApiType, ApiVersion, Kind and other metadata fields", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" - } - ], - "properties": { - "credentials": { - "$ref": "#/definitions/WorkspaceConnectionApiKey" - } - }, - "x-ms-discriminator-value": "ApiKey" - }, - "WorkspaceConnectionApiKey": { - "description": "Api key object for workspace connection credential.", - "type": "object", - "properties": { - "key": { - "type": "string" - } - } - }, - "CustomKeysWorkspaceConnectionProperties": { - "description": "Category:= CustomKeys\r\nAuthType:= CustomKeys (as type discriminator)\r\nCredentials:= {CustomKeys} as Microsoft.MachineLearning.AccountRP.Contracts.WorkspaceConnection.CustomKeys\r\nTarget:= {any value}\r\nUse Metadata property bag for ApiVersion and other metadata fields", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" - } - ], - "properties": { - "credentials": { - "description": "Custom Keys credential object", - "$ref": "#/definitions/CustomKeys" - } - }, - "x-ms-discriminator-value": "CustomKeys" - }, - "CustomKeys": { - "description": "Custom Keys credential object", - "type": "object", - "properties": { - "keys": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "OAuth2AuthTypeWorkspaceConnectionProperties": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" - } - ], - "properties": { - "credentials": { - "$ref": "#/definitions/WorkspaceConnectionOAuth2" - } - }, - "x-ms-discriminator-value": "OAuth2" - }, - "WorkspaceConnectionOAuth2": { - "description": "ClientId and ClientSecret are required. Other properties are optional\r\ndepending on each OAuth2 provider's implementation.", + "IdleShutdownSetting": { "type": "object", + "description": "Stops compute instance after user defined period of inactivity.", "properties": { - "authUrl": { - "description": "Required by Concur connection category", - "type": "string", - "format": "url" - }, - "clientId": { - "type": "string", - "description": "Client id in the format of UUID", - "format": "uuid" - }, - "clientSecret": { - "type": "string", - "x-ms-secret": true - }, - "developerToken": { - "description": "Required by GoogleAdWords connection category", - "type": "string", - "x-ms-secret": true - }, - "password": { - "type": "string", - "x-ms-secret": true - }, - "refreshToken": { - "description": "Required by GoogleBigQuery, GoogleAdWords, Hubspot, QuickBooks, Square, Xero, Zoho\r\nwhere user needs to get RefreshToken offline", + "idleTimeBeforeShutdown": { "type": "string", - "x-ms-secret": true - }, - "tenantId": { - "description": "Required by QuickBooks and Xero connection categories", - "type": "string" - }, - "username": { - "description": "Concur, ServiceNow auth server AccessToken grant type is 'Password'\r\nwhich requires UsernamePassword", - "type": "string" - } - } - }, - "ServicePrincipalAuthTypeWorkspaceConnectionProperties": { - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" - } - ], - "properties": { - "credentials": { - "$ref": "#/definitions/WorkspaceConnectionServicePrincipal" - } - }, - "x-ms-discriminator-value": "ServicePrincipal" - }, - "WorkspaceConnectionServicePrincipal": { - "type": "object", - "properties": { - "clientId": { - "type": "string" - }, - "clientSecret": { - "x-ms-secret": true, - "type": "string" - }, - "tenantId": { - "type": "string" - } - } - }, - "ConnectionGroup": { - "description": "Group based on connection category", - "enum": [ - "Azure", - "AzureAI", - "Database", - "NoSQL", - "File", - "GenericProtocol", - "ServicesAndApps" - ], - "type": "string", - "x-ms-enum": { - "name": "ConnectionGroup", - "modelAsString": true - } - }, - "EncryptionUpdateProperties": { - "required": [ - "keyVaultProperties" - ], - "type": "object", - "properties": { - "keyVaultProperties": { - "$ref": "#/definitions/EncryptionKeyVaultUpdateProperties" - } - } - }, - "EncryptionKeyVaultUpdateProperties": { - "required": [ - "keyIdentifier" - ], - "type": "object", - "properties": { - "keyIdentifier": { - "minLength": 1, - "pattern": "[a-zA-Z0-9_]", - "type": "string" + "description": "Time is defined in ISO8601 format. Minimum is 15 min, maximum is 3 days." } } }, - "WorkspaceHubConfig": { - "description": "WorkspaceHub's configuration object.", + "ResizeSchema": { "type": "object", + "description": "Schema for Compute Instance resize.", "properties": { - "additionalWorkspaceStorageAccounts": { - "type": "array", - "items": { - "type": "string" - } - }, - "defaultWorkspaceResourceGroup": { - "type": "string" + "targetVMSize": { + "type": "string", + "description": "The name of the virtual machine size." } } } } - } \ No newline at end of file + } diff --git a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-07-01-preview/registries.json b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-07-01-preview/registries.json index 467bd64da663b..f2a21cbf0dac4 100644 --- a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-07-01-preview/registries.json +++ b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-07-01-preview/registries.json @@ -649,6 +649,11 @@ "$ref": "#/definitions/ArmResourceId", "x-nullable": true }, + "managedResourceGroupSettings": { + "description": "Managed resource group specific settings", + "$ref": "#/definitions/ManagedResourceGroupSettings", + "x-nullable": true + }, "mlFlowRegistryUri": { "description": "MLFlow Registry URI for the Registry", "type": "string", @@ -710,6 +715,36 @@ }, "additionalProperties": false }, + "ManagedResourceGroupSettings": { + "description": "Managed resource group settings", + "type": "object", + "properties": { + "assignedIdentities": { + "description": "List of assigned identities for the managed resource group", + "type": "array", + "items": { + "$ref": "#/definitions/ManagedResourceGroupAssignedIdentities" + }, + "x-nullable": true, + "x-ms-identifiers": [] + } + }, + "additionalProperties": false + }, + "ManagedResourceGroupAssignedIdentities": { + "description": "Details for managed resource group assigned identities.", + "type": "object", + "properties": { + "principalId": { + "description": "Identity principal Id", + "type": "string", + "x-nullable": false, + "readOnly": true, + "format": "uuid" + } + }, + "additionalProperties": false + }, "RegistryTrackedResource": { "required": [ "location", @@ -873,4 +908,4 @@ "x-ms-parameter-location": "method" } } - } \ No newline at end of file + } diff --git a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-07-01-preview/workspaceRP.json b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-07-01-preview/workspaceRP.json new file mode 100644 index 0000000000000..14097a4d66199 --- /dev/null +++ b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-07-01-preview/workspaceRP.json @@ -0,0 +1,7300 @@ +{ + "swagger": "2.0", + "info": { + "title": "Azure Machine Learning Services", + "description": "These APIs allow end users to operate on Azure Machine Learning Workspace resources.", + "version": "2024-07-01-preview" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "paths": { + "/providers/Microsoft.MachineLearningServices/operations": { + "get": { + "tags": [ + "Operation" + ], + "summary": "Lists all of the available Azure Machine Learning Workspaces REST API operations", + "operationId": "Operations_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/OperationListResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "OperationsList": { + "$ref": "./examples/Workspace/operationsList.json" + } + }, + "x-ms-pageable": { + "nextLinkName": null + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces": { + "get": { + "tags": [ + "Workspaces" + ], + "summary": "Lists all the available machine learning workspaces under the specified subscription.", + "operationId": "Workspaces_ListBySubscription", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/WorkspaceKindParameter" + }, + { + "$ref": "#/parameters/PaginationParameter" + }, + { + "in": "query", + "name": "aiCapabilities", + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/WorkspaceListResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Workspaces by subscription": { + "$ref": "./examples/Workspace/listBySubscription.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces": { + "get": { + "tags": [ + "Workspaces" + ], + "summary": "Lists all the available machine learning workspaces under the specified resource group.", + "operationId": "Workspaces_ListByResourceGroup", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/WorkspaceKindParameter" + }, + { + "$ref": "#/parameters/PaginationParameter" + }, + { + "in": "query", + "name": "aiCapabilities", + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/WorkspaceListResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Workspaces by Resource Group": { + "$ref": "./examples/Workspace/listByResourceGroup.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}": { + "delete": { + "tags": [ + "Workspaces" + ], + "summary": "Deletes a machine learning workspace.", + "operationId": "Workspaces_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/WorkspaceForceToPurgeParameter" + } + ], + "responses": { + "200": { + "description": "Success" + }, + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Delete Workspace": { + "$ref": "./examples/Workspace/delete.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + }, + "get": { + "tags": [ + "Workspaces" + ], + "summary": "Gets the properties of the specified machine learning workspace.", + "operationId": "Workspaces_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/Workspace" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Workspace": { + "$ref": "./examples/Workspace/get.json" + } + } + }, + "patch": { + "tags": [ + "Workspaces" + ], + "summary": "Updates a machine learning workspace with the specified parameters.", + "operationId": "Workspaces_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "The parameters for updating a machine learning workspace.", + "required": true, + "schema": { + "$ref": "#/definitions/WorkspaceUpdateParameters" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/Workspace" + } + }, + "202": { + "description": "Accepted" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Update Workspace": { + "$ref": "./examples/Workspace/update.json" + } + }, + "x-ms-long-running-operation": true + }, + "put": { + "tags": [ + "Workspaces" + ], + "summary": "Creates or updates a workspace with the specified parameters.", + "operationId": "Workspaces_CreateOrUpdate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "The parameters for creating or updating a machine learning workspace.", + "required": true, + "schema": { + "$ref": "#/definitions/Workspace" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/Workspace" + } + }, + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create Workspace": { + "$ref": "./examples/Workspace/create.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections": { + "get": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Lists all the available machine learning workspaces connections under the specified workspace.", + "operationId": "WorkspaceConnections_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/TargetParameter" + }, + { + "$ref": "#/parameters/CategoryParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "query", + "name": "includeAll", + "description": "query parameter that indicates if get connection call should return both connections and datastores", + "type": "boolean", + "default": false + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "ListWorkspaceConnections": { + "$ref": "./examples/WorkspaceConnection/list.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}": { + "delete": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Delete machine learning workspaces connections by name.", + "operationId": "WorkspaceConnections_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success" + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "DeleteWorkspaceConnection": { + "$ref": "./examples/WorkspaceConnection/delete.json" + } + } + }, + "get": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Lists machine learning workspaces connections by name.", + "operationId": "WorkspaceConnections_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "GetWorkspaceConnection": { + "$ref": "./examples/WorkspaceConnection/get.json" + } + } + }, + "patch": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Update machine learning workspaces connections under the specified workspace.", + "operationId": "WorkspaceConnections_Update", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "Parameters for workspace connection update.", + "schema": { + "$ref": "#/definitions/WorkspaceConnectionUpdateParameter" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "UpdateWorkspaceConnection": { + "$ref": "./examples/WorkspaceConnection/update.json" + } + } + }, + "put": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Create or update machine learning workspaces connections under the specified workspace.", + "operationId": "WorkspaceConnections_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "The object for creating or updating a new workspace connection", + "schema": { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResource" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "CreateWorkspaceConnection": { + "$ref": "./examples/WorkspaceConnection/create.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments": { + "get": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Get all the deployments under the Azure OpenAI connection.", + "operationId": "Connection_ListDeployments", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List Azure OpenAI Connection Deployments": { + "$ref": "./examples/WorkspaceConnection/listDeployments.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}": { + "delete": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Delete Azure OpenAI connection deployment resource by name", + "operationId": "Connection_DeleteDeployment", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/DeploymentNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Delete Azure OpenAI Connection Deployment": { + "$ref": "./examples/WorkspaceConnection/deleteDeployment.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + }, + "get": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Get deployments under the Azure OpenAI connection by name.", + "operationId": "Connection_GetDeployment", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/DeploymentNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointDeploymentResourcePropertiesBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Azure OpenAI Connection Deployment": { + "$ref": "./examples/WorkspaceConnection/getDeployment.json" + } + } + }, + "put": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Create or update Azure OpenAI connection deployment resource with the specified parameters", + "operationId": "Connection_CreateOrUpdateDeployment", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/DeploymentNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "deployment object", + "required": true, + "schema": { + "$ref": "#/definitions/EndpointDeploymentResourcePropertiesBasicResource" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointDeploymentResourcePropertiesBasicResource" + } + }, + "201": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointDeploymentResourcePropertiesBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create Azure OpenAI Connection Deployment": { + "$ref": "./examples/WorkspaceConnection/createDeployment.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/listsecrets": { + "post": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "List all the secrets of a machine learning workspaces connections.", + "operationId": "WorkspaceConnections_ListSecrets", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "GetWorkspaceConnection": { + "$ref": "./examples/WorkspaceConnection/listSecrets.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/models": { + "get": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Get available models under the Azure OpenAI connection.", + "operationId": "Connection_GetModels", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointModels" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Azure OpenAI Connection Models": { + "$ref": "./examples/WorkspaceConnection/getModels.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists": { + "get": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Gets the custom blocklists associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiBlocklists_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiBlocklistPropertiesBasicResourceArmPaginatedResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List Rai Blocklist": { + "$ref": "./examples/WorkspaceConnection/RaiBlocklist/list.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}": { + "delete": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Deletes the specified custom blocklist associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiBlocklist_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/RaiBlocklistParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Delete Rai Blocklist": { + "$ref": "./examples/WorkspaceConnection/RaiBlocklist/delete.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + }, + "get": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Gets the specified custom blocklist associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiBlocklist_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/RaiBlocklistParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiBlocklistPropertiesBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Rai Blocklist": { + "$ref": "./examples/WorkspaceConnection/RaiBlocklist/get.json" + } + } + }, + "put": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Update the state of specified blocklist associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiBlocklist_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/RaiBlocklistParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RaiBlocklistPropertiesBasicResource" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiBlocklistPropertiesBasicResource" + } + }, + "201": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiBlocklistPropertiesBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create Rai Blocklist": { + "$ref": "./examples/WorkspaceConnection/RaiBlocklist/create.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/addRaiBlocklistItems": { + "post": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiBlocklistItem_AddBulk", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/RaiBlocklistParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RaiBlocklistItemsBulkAddRequest" + }, + "description": "Properties describing the custom blocklist items." + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/RaiBlocklistItemPropertiesBasicResource" + } + } + }, + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create Bulk Rai Blocklist Items": { + "$ref": "./examples/WorkspaceConnection/RaiBlocklistItem/addBulk.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/deleteRaiBlocklistItems": { + "post": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Delete multiple blocklist items from the specified blocklist associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiBlocklistItem_DeleteBulk", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/RaiBlocklistParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RaiBlocklistItemsBulkDeleteRequest" + }, + "description": "List of RAI Blocklist Items Names." + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Delete Bulk Rai Blocklist Items": { + "$ref": "./examples/WorkspaceConnection/RaiBlocklistItem/deleteBulk.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems": { + "get": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Gets the custom blocklist items associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiBlocklistItems_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/RaiBlocklistParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List RaiBlocklist Items": { + "$ref": "./examples/WorkspaceConnection/RaiBlocklistItem/list.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}": { + "delete": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Deletes the specified custom blocklist item associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiBlocklistItem_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/RaiBlocklistParameter" + }, + { + "$ref": "#/parameters/RaiBlocklistItemParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Delete RaiBlocklist Item": { + "$ref": "./examples/WorkspaceConnection/RaiBlocklistItem/delete.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + }, + "get": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Gets the specified custom blocklist item associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiBlocklistItem_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/RaiBlocklistParameter" + }, + { + "$ref": "#/parameters/RaiBlocklistItemParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiBlocklistItemPropertiesBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Rai RaiBlocklist Item": { + "$ref": "./examples/WorkspaceConnection/RaiBlocklistItem/get.json" + } + } + }, + "put": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Update the state of specified blocklist item associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiBlocklistItem_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/RaiBlocklistParameter" + }, + { + "$ref": "#/parameters/RaiBlocklistItemParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RaiBlocklistItemPropertiesBasicResource" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiBlocklistItemPropertiesBasicResource" + } + }, + "201": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiBlocklistItemPropertiesBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create RaiBlocklist Item": { + "$ref": "./examples/WorkspaceConnection/RaiBlocklistItem/create.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies": { + "get": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "List the specified Content Filters associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiPolicies_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiPolicyPropertiesBasicResourceArmPaginatedResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List Rai policy": { + "$ref": "./examples/WorkspaceConnection/RaiPolicy/list.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}": { + "delete": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Deletes the specified Content Filters associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiPolicy_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/RaiPolicyNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Delete Rai policy": { + "$ref": "./examples/WorkspaceConnection/RaiPolicy/delete.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + }, + "get": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Gets the specified Content Filters associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiPolicy_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/RaiPolicyNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiPolicyPropertiesBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Rai policy": { + "$ref": "./examples/WorkspaceConnection/RaiPolicy/get.json" + } + } + }, + "put": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Update the state of specified Content Filters associated with the Azure OpenAI connection.", + "operationId": "ConnectionRaiPolicy_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "#/parameters/RaiPolicyNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RaiPolicyPropertiesBasicResource" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiPolicyPropertiesBasicResource" + } + }, + "201": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiPolicyPropertiesBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create Rai policy": { + "$ref": "./examples/WorkspaceConnection/RaiPolicy/create.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/testconnection": { + "post": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Test machine learning workspaces connections under the specified workspace.", + "operationId": "WorkspaceConnections_TestConnection", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/ConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "Workspace Connection object", + "schema": { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResource" + } + } + ], + "responses": { + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "TestWorkspaceConnection": { + "$ref": "./examples/WorkspaceConnection/testConnection.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/deployments": { + "get": { + "tags": [ + "Endpoint" + ], + "summary": "Get all the deployments under the workspace scope", + "operationId": "EndpointDeployment_GetInWorkspace", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/EndpointTypeParameter" + }, + { + "$ref": "#/parameters/PaginationParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Endpoint Deployments In Workspace": { + "$ref": "./examples/Endpoint/Deployment/getInWorkspace.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/diagnose": { + "post": { + "tags": [ + "ProxyOperations" + ], + "summary": "Diagnose workspace setup issue.", + "operationId": "Workspaces_Diagnose", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "The parameter of diagnosing workspace health", + "schema": { + "$ref": "#/definitions/DiagnoseWorkspaceParameters" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/DiagnoseResponseResult" + } + }, + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Diagnose Workspace": { + "$ref": "./examples/Workspace/diagnose.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints": { + "get": { + "tags": [ + "Endpoint" + ], + "summary": "List All the endpoints under this workspace", + "operationId": "Endpoint_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/EndpointTypeParameter" + }, + { + "in": "query", + "name": "includeInferenceEndpoints", + "type": "boolean", + "default": false + }, + { + "$ref": "#/parameters/PaginationParameter" + }, + { + "in": "query", + "description": "Whether the endpoint resource will be expand to include deployment information, e.g. $expand=deployments", + "required": false, + "name": "$expand", + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointResourcePropertiesBasicResourceArmPaginatedResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List Endpoint": { + "$ref": "./examples/Endpoint/list.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}": { + "get": { + "tags": [ + "Endpoint" + ], + "summary": "Gets endpoint resource", + "operationId": "Endpoint_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointResourcePropertiesBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Endpoint": { + "$ref": "./examples/Endpoint/get.json" + } + } + }, + "put": { + "tags": [ + "Endpoint" + ], + "summary": "Create or update endpoint resource with the specified parameters", + "operationId": "Endpoint_CreateOrUpdate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "Endpoint resource object", + "required": true, + "schema": { + "$ref": "#/definitions/EndpointResourcePropertiesBasicResource" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointResourcePropertiesBasicResource" + } + }, + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create Endpoint": { + "$ref": "./examples/Endpoint/create.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments": { + "get": { + "tags": [ + "Endpoint" + ], + "summary": "Get all the deployments under the endpoint resource scope", + "operationId": "EndpointDeployment_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Endpoint Deployments": { + "$ref": "./examples/Endpoint/Deployment/getDeployments.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}": { + "delete": { + "tags": [ + "Endpoint" + ], + "summary": "Delete endpoint deployment resource by name", + "operationId": "EndpointDeployment_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "#/parameters/DeploymentNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "204": { + "description": "Deployment was successfully deleted or doesn't exist." + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Delete Endpoint Deployment": { + "$ref": "./examples/Endpoint/Deployment/delete.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + }, + "get": { + "tags": [ + "Endpoint" + ], + "summary": "Get deployments under endpoint resource by name", + "operationId": "EndpointDeployment_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "#/parameters/DeploymentNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointDeploymentResourcePropertiesBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Endpoint Deployment": { + "$ref": "./examples/Endpoint/Deployment/get.json" + } + } + }, + "put": { + "tags": [ + "Endpoint" + ], + "summary": "Create or update endpoint deployment resource with the specified parameters", + "operationId": "EndpointDeployment_CreateOrUpdate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "#/parameters/DeploymentNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "deployment object", + "required": true, + "schema": { + "$ref": "#/definitions/EndpointDeploymentResourcePropertiesBasicResource" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointDeploymentResourcePropertiesBasicResource" + } + }, + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create Endpoint Deployment": { + "$ref": "./examples/Endpoint/Deployment/create.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/listKeys": { + "post": { + "tags": [ + "Endpoint" + ], + "summary": "List keys for the endpoint resource.", + "operationId": "Endpoint_ListKeys", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointKeys" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List Endpoint Keys": { + "$ref": "./examples/Endpoint/listKeys.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/models": { + "get": { + "tags": [ + "Endpoint" + ], + "summary": "Get available models under the endpoint resource.", + "operationId": "Endpoint_GetModels", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointModels" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Endpoint Models": { + "$ref": "./examples/Endpoint/getModels.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies": { + "get": { + "tags": [ + "Endpoint" + ], + "summary": "List the specified Content Filters associated with the Azure OpenAI account.", + "operationId": "RaiPolicies_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiPolicyPropertiesBasicResourceArmPaginatedResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List Rai policies": { + "$ref": "./examples/Endpoint/RaiPolicy/list.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}": { + "delete": { + "tags": [ + "Endpoint" + ], + "summary": "Deletes the specified Content Filters associated with the Azure OpenAI account.", + "operationId": "RaiPolicy_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "#/parameters/RaiPolicyNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Delete Rai policy": { + "$ref": "./examples/Endpoint/RaiPolicy/delete.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + }, + "get": { + "tags": [ + "Endpoint" + ], + "summary": "Gets the specified Content Filters associated with the Azure OpenAI account.", + "operationId": "RaiPolicy_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "#/parameters/RaiPolicyNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiPolicyPropertiesBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get Rai policy": { + "$ref": "./examples/Endpoint/RaiPolicy/get.json" + } + } + }, + "put": { + "tags": [ + "Endpoint" + ], + "summary": "Update the state of specified Content Filters associated with the Azure OpenAI account.", + "operationId": "RaiPolicy_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "#/parameters/RaiPolicyNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RaiPolicyPropertiesBasicResource" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiPolicyPropertiesBasicResource" + } + }, + "201": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/RaiPolicyPropertiesBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create Rai policy": { + "$ref": "./examples/Endpoint/RaiPolicy/create.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/regenerateKey": { + "post": { + "tags": [ + "Endpoint" + ], + "summary": "Regenerate account keys", + "operationId": "Endpoint_RegenerateKeys", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/EndpointNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RegenerateServiceAccountKeyContent" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/AccountApiKeys" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Regenerate Endpoint Keys": { + "$ref": "./examples/Endpoint/regenerateKey.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listConnectionModels": { + "post": { + "tags": [ + "V2WorkspaceConnectionResource" + ], + "summary": "Get models under the Azure ML workspace for all Azure OpenAI connections that the user can deploy.", + "operationId": "Connection_ListModels", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/EndpointModels" + } + }, + "default": { + "description": "Error response describing why the operation failed", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get models under the Azure ML workspace for all Azure OpenAI connections that the user can deploy": { + "$ref": "./examples/WorkspaceConnection/listConnectionModels.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listKeys": { + "post": { + "tags": [ + "ProxyOperations" + ], + "summary": "Lists all the keys associated with this workspace. This includes keys for the storage account, app insights and password for container registry.", + "operationId": "Workspaces_ListKeys", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/ListWorkspaceKeysResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List Workspace Keys": { + "$ref": "./examples/Workspace/listKeys.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken": { + "post": { + "tags": [ + "ProxyOperations" + ], + "summary": "Get Azure Machine Learning Workspace notebook access token", + "operationId": "Workspaces_ListNotebookAccessToken", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/NotebookAccessTokenResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List Workspace Keys": { + "$ref": "./examples/Workspace/listNotebookAccessToken.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys": { + "post": { + "tags": [ + "ProxyOperations" + ], + "summary": "Lists keys of Azure Machine Learning Workspaces notebook.", + "operationId": "Workspaces_ListNotebookKeys", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/ListNotebookKeysResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List Workspace Keys": { + "$ref": "./examples/Notebook/listKeys.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys": { + "post": { + "tags": [ + "ProxyOperations" + ], + "summary": "Lists keys of Azure Machine Learning Workspace's storage account.", + "operationId": "Workspaces_ListStorageAccountKeys", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/ListStorageAccountKeysResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List Workspace Keys": { + "$ref": "./examples/Workspace/listStorageAccountKeys.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints": { + "get": { + "tags": [ + "OutboundNetworkDependenciesEndpoints" + ], + "summary": "Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) programmatically.", + "operationId": "Workspaces_ListOutboundNetworkDependenciesEndpoints", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/ExternalFQDNResponse" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "ListOutboundNetworkDependenciesEndpoints": { + "$ref": "./examples/ExternalFQDN/get.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules": { + "get": { + "tags": [ + "ManagedNetwork" + ], + "summary": "Lists the managed network outbound rules for a machine learning workspace.", + "operationId": "ManagedNetworkSettingsRule_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/OutboundRuleListResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List ManagedNetworkSettingsRule": { + "$ref": "./examples/ManagedNetwork/listRule.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}": { + "delete": { + "tags": [ + "ManagedNetwork" + ], + "summary": "Deletes an outbound rule from the managed network of a machine learning workspace.", + "operationId": "ManagedNetworkSettingsRule_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/RuleName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success" + }, + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Delete ManagedNetworkSettingsRule": { + "$ref": "./examples/ManagedNetwork/deleteRule.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + }, + "get": { + "tags": [ + "ManagedNetwork" + ], + "summary": "Gets an outbound rule from the managed network of a machine learning workspace.", + "operationId": "ManagedNetworkSettingsRule_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/RuleName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/OutboundRuleBasicResource" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get ManagedNetworkSettingsRule": { + "$ref": "./examples/ManagedNetwork/getRule.json" + } + } + }, + "put": { + "tags": [ + "ManagedNetwork" + ], + "summary": "Creates or updates an outbound rule in the managed network of a machine learning workspace.", + "operationId": "ManagedNetworkSettingsRule_CreateOrUpdate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/RuleName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "Outbound Rule to be created or updated in the managed network of a machine learning workspace.", + "required": true, + "schema": { + "$ref": "#/definitions/OutboundRuleBasicResource" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/OutboundRuleBasicResource" + } + }, + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "CreateOrUpdate ManagedNetworkSettingsRule": { + "$ref": "./examples/ManagedNetwork/createOrUpdateRule.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook": { + "post": { + "tags": [ + "ProxyOperations" + ], + "summary": "Prepare Azure Machine Learning Workspace's notebook resource", + "operationId": "Workspaces_PrepareNotebook", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/NotebookResourceInfo" + } + }, + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Prepare Notebook": { + "$ref": "./examples/Notebook/prepare.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections": { + "get": { + "tags": [ + "WorkspacePrivateEndpointConnections" + ], + "summary": "Called by end-users to get all PE connections.", + "operationId": "PrivateEndpointConnections_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnectionListResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "StorageAccountListPrivateEndpointConnections": { + "$ref": "./examples/PrivateEndpointConnection/list.json" + } + }, + "x-ms-pageable": { + "nextLinkName": null + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}": { + "delete": { + "tags": [ + "WorkspacePrivateEndpointConnections" + ], + "summary": "Called by end-users to delete a PE connection.", + "operationId": "PrivateEndpointConnections_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/PrivateEndpointConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success" + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "WorkspacePutPrivateEndpointConnection": { + "$ref": "./examples/PrivateEndpointConnection/delete.json" + } + } + }, + "get": { + "tags": [ + "WorkspacePrivateEndpointConnections" + ], + "summary": "Called by end-users to get a PE connection.", + "operationId": "PrivateEndpointConnections_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/PrivateEndpointConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnection" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "WorkspaceGetPrivateEndpointConnection": { + "$ref": "./examples/PrivateEndpointConnection/get.json" + } + } + }, + "put": { + "tags": [ + "WorkspacePrivateEndpointConnections" + ], + "summary": "Called by end-users to approve or reject a PE connection.\r\nThis method must validate and forward the call to NRP.", + "operationId": "PrivateEndpointConnections_CreateOrUpdate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "#/parameters/PrivateEndpointConnectionName" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "PrivateEndpointConnection object", + "required": true, + "schema": { + "$ref": "#/definitions/PrivateEndpointConnection" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnection" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "WorkspacePutPrivateEndpointConnection": { + "$ref": "./examples/PrivateEndpointConnection/createOrUpdate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateLinkResources": { + "get": { + "tags": [ + "WorkspacePrivateLinkResources" + ], + "summary": "Called by Client (Portal, CLI, etc) to get available \"private link resources\" for the workspace.\r\nEach \"private link resource\" is a connection endpoint (IP address) to the resource.\r\nPre single connection endpoint per workspace: the Data Plane IP address, returned by DNS resolution.\r\nOther RPs, such as Azure Storage, have multiple - one for Blobs, other for Queues, etc.\r\nDefined in the \"[NRP] Private Endpoint Design\" doc, topic \"GET API for GroupIds\".", + "operationId": "PrivateLinkResources_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/PrivateLinkResourceListResult" + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "WorkspaceListPrivateLinkResources": { + "$ref": "./examples/PrivateLinkResource/list.json" + } + }, + "x-ms-pageable": { + "nextLinkName": null + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/provisionManagedNetwork": { + "post": { + "tags": [ + "ManagedNetwork" + ], + "summary": "Provisions the managed network of a machine learning workspace.", + "operationId": "ManagedNetworkProvisions_ProvisionManagedNetwork", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "Managed Network Provisioning Options for a machine learning workspace.", + "schema": { + "$ref": "#/definitions/ManagedNetworkProvisionOptions" + } + } + ], + "responses": { + "200": { + "description": "The request was successful; the request was well-formed and received properly.", + "schema": { + "$ref": "#/definitions/ManagedNetworkProvisionStatus" + } + }, + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Provision ManagedNetwork": { + "$ref": "./examples/ManagedNetwork/provision.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys": { + "post": { + "tags": [ + "ProxyOperations" + ], + "summary": "Resync all the keys associated with this workspace.This includes keys for the storage account, app insights and password for container registry", + "operationId": "Workspaces_ResyncKeys", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/WorkspaceNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success" + }, + "202": { + "description": "Accepted", + "headers": { + "Location": { + "description": "URI to poll for asynchronous operation result.", + "type": "string" + }, + "Retry-After": { + "description": "Duration the client should wait between requests, in seconds.", + "type": "integer", + "format": "int32" + } + } + }, + "default": { + "description": "Error", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Resync Workspace Keys": { + "$ref": "./examples/Workspace/resyncKeys.json" + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + } + } + } + }, + "definitions": { + "AADAuthTypeWorkspaceConnectionProperties": { + "description": "This connection type covers the AAD auth for any applicable Azure service", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + ], + "x-ms-discriminator-value": "AAD" + }, + "AccessKeyAuthTypeWorkspaceConnectionProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + ], + "properties": { + "credentials": { + "$ref": "#/definitions/WorkspaceConnectionAccessKey" + } + }, + "x-ms-discriminator-value": "AccessKey" + }, + "AccountApiKeys": { + "type": "object", + "properties": { + "key1": { + "type": "string", + "x-ms-secret": true + }, + "key2": { + "type": "string", + "x-ms-secret": true + } + } + }, + "AccountKeyAuthTypeWorkspaceConnectionProperties": { + "description": "This connection type covers the account key connection for Azure storage", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + ], + "properties": { + "credentials": { + "$ref": "#/definitions/WorkspaceConnectionAccountKey" + } + }, + "x-ms-discriminator-value": "AccountKey" + }, + "AllowedContentLevel": { + "description": "Level at which content is filtered.", + "enum": [ + "Low", + "Medium", + "High" + ], + "type": "string", + "x-ms-enum": { + "name": "AllowedContentLevel", + "modelAsString": true + } + }, + "ApiKeyAuthWorkspaceConnectionProperties": { + "description": "This connection type covers the generic ApiKey auth connection categories, for examples:\r\nAzureOpenAI:\r\n Category:= AzureOpenAI\r\n AuthType:= ApiKey (as type discriminator)\r\n Credentials:= {ApiKey} as Microsoft.MachineLearning.AccountRP.Contracts.WorkspaceConnection.ApiKey\r\n Target:= {ApiBase}\r\n \r\nCognitiveService:\r\n Category:= CognitiveService\r\n AuthType:= ApiKey (as type discriminator)\r\n Credentials:= {SubscriptionKey} as Microsoft.MachineLearning.AccountRP.Contracts.WorkspaceConnection.ApiKey\r\n Target:= ServiceRegion={serviceRegion}\r\n \r\nCognitiveSearch:\r\n Category:= CognitiveSearch\r\n AuthType:= ApiKey (as type discriminator)\r\n Credentials:= {Key} as Microsoft.MachineLearning.AccountRP.Contracts.WorkspaceConnection.ApiKey\r\n Target:= {Endpoint}\r\n \r\nUse Metadata property bag for ApiType, ApiVersion, Kind and other metadata fields", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + ], + "properties": { + "credentials": { + "$ref": "#/definitions/WorkspaceConnectionApiKey" + } + }, + "x-ms-discriminator-value": "ApiKey" + }, + "CapacityConfig": { + "type": "object", + "properties": { + "minimum": { + "type": "integer", + "format": "int32", + "description": "The minimum capacity." + }, + "maximum": { + "type": "integer", + "format": "int32", + "description": "The maximum capacity." + }, + "step": { + "type": "integer", + "format": "int32", + "description": "The minimal incremental between allowed values for capacity." + }, + "default": { + "type": "integer", + "format": "int32", + "description": "The default capacity." + }, + "allowedValues": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + }, + "description": "The array of allowed values for capacity." + } + }, + "description": "The capacity configuration." + }, + "CognitiveServiceEndpointDeploymentResourceProperties": { + "required": [ + "model" + ], + "type": "object", + "properties": { + "model": { + "description": "Model used for the endpoint deployment.", + "$ref": "#/definitions/EndpointDeploymentModel" + }, + "raiPolicyName": { + "type": "string", + "description": "The name of RAI policy." + }, + "versionUpgradeOption": { + "description": "Deployment model version upgrade option.", + "type": "string", + "enum": [ + "OnceNewDefaultVersionAvailable", + "OnceCurrentVersionExpired", + "NoAutoUpgrade" + ], + "x-ms-enum": { + "name": "DeploymentModelVersionUpgradeOption", + "modelAsString": true + } + } + } + }, + "CognitiveServicesSku": { + "type": "object", + "properties": { + "capacity": { + "format": "int32", + "type": "integer" + }, + "family": { + "type": "string" + }, + "name": { + "type": "string" + }, + "size": { + "type": "string" + }, + "tier": { + "type": "string" + } + } + }, + "ComputeRuntimeDto": { + "type": "object", + "properties": { + "sparkRuntimeVersion": { + "type": "string" + } + } + }, + "ConnectionAuthType": { + "description": "Authentication type of the connection target", + "enum": [ + "PAT", + "ManagedIdentity", + "UsernamePassword", + "None", + "SAS", + "AccountKey", + "ServicePrincipal", + "AccessKey", + "ApiKey", + "CustomKeys", + "OAuth2", + "AAD" + ], + "type": "string", + "x-ms-enum": { + "name": "ConnectionAuthType", + "modelAsString": true + } + }, + "ConnectionCategory": { + "description": "Category of the connection", + "enum": [ + "PythonFeed", + "ContainerRegistry", + "Git", + "S3", + "Snowflake", + "AzureSqlDb", + "AzureSynapseAnalytics", + "AzureMySqlDb", + "AzurePostgresDb", + "ADLSGen2", + "Redis", + "ApiKey", + "AzureOpenAI", + "AIServices", + "CognitiveSearch", + "CognitiveService", + "CustomKeys", + "AzureBlob", + "AzureOneLake", + "CosmosDb", + "CosmosDbMongoDbApi", + "AzureDataExplorer", + "AzureMariaDb", + "AzureDatabricksDeltaLake", + "AzureSqlMi", + "AzureTableStorage", + "AmazonRdsForOracle", + "AmazonRdsForSqlServer", + "AmazonRedshift", + "Db2", + "Drill", + "GoogleBigQuery", + "Greenplum", + "Hbase", + "Hive", + "Impala", + "Informix", + "MariaDb", + "MicrosoftAccess", + "MySql", + "Netezza", + "Oracle", + "Phoenix", + "PostgreSql", + "Presto", + "SapOpenHub", + "SapBw", + "SapHana", + "SapTable", + "Spark", + "SqlServer", + "Sybase", + "Teradata", + "Vertica", + "Cassandra", + "Couchbase", + "MongoDbV2", + "MongoDbAtlas", + "AmazonS3Compatible", + "FileServer", + "FtpServer", + "GoogleCloudStorage", + "Hdfs", + "OracleCloudStorage", + "Sftp", + "GenericHttp", + "ODataRest", + "Odbc", + "GenericRest", + "AmazonMws", + "Concur", + "Dynamics", + "DynamicsAx", + "DynamicsCrm", + "GoogleAdWords", + "Hubspot", + "Jira", + "Magento", + "Marketo", + "Office365", + "Eloqua", + "Responsys", + "OracleServiceCloud", + "PayPal", + "QuickBooks", + "Salesforce", + "SalesforceServiceCloud", + "SalesforceMarketingCloud", + "SapCloudForCustomer", + "SapEcc", + "ServiceNow", + "SharePointOnlineList", + "Shopify", + "Square", + "WebTable", + "Xero", + "Zoho", + "GenericContainerRegistry", + "OpenAI", + "Serp", + "BingLLMSearch", + "Serverless" + ], + "type": "string", + "x-ms-enum": { + "name": "ConnectionCategory", + "modelAsString": true + } + }, + "ConnectionGroup": { + "description": "Group based on connection category", + "enum": [ + "Azure", + "AzureAI", + "Database", + "NoSQL", + "File", + "GenericProtocol", + "ServicesAndApps" + ], + "type": "string", + "x-ms-enum": { + "name": "ConnectionGroup", + "modelAsString": true + } + }, + "ServerlessEndpointContentSafety": { + "required": [ + "contentSafetyStatus" + ], + "type": "object", + "properties": { + "contentSafetyStatus": { + "$ref": "#/definitions/ContentSafetyStatus" + } + } + }, + "ContentSafetyEndpointDeploymentResourceProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CognitiveServiceEndpointDeploymentResourceProperties" + }, + { + "$ref": "#/definitions/EndpointDeploymentResourceProperties" + } + ], + "x-ms-discriminator-value": "Azure.ContentSafety" + }, + "ContentSafetyEndpointResourceProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/EndpointResourceProperties" + } + ], + "x-ms-discriminator-value": "Azure.ContentSafety" + }, + "ContentSafetyStatus": { + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "ContentSafetyStatus", + "modelAsString": true + } + }, + "CosmosDbSettings": { + "type": "object", + "properties": { + "collectionsThroughput": { + "format": "int32", + "type": "integer" + } + } + }, + "CustomKeys": { + "description": "Custom Keys credential object", + "type": "object", + "properties": { + "keys": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "CustomKeysWorkspaceConnectionProperties": { + "description": "Category:= CustomKeys\r\nAuthType:= CustomKeys (as type discriminator)\r\nCredentials:= {CustomKeys} as Microsoft.MachineLearning.AccountRP.Contracts.WorkspaceConnection.CustomKeys\r\nTarget:= {any value}\r\nUse Metadata property bag for ApiVersion and other metadata fields", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + ], + "properties": { + "credentials": { + "description": "Custom Keys credential object", + "$ref": "#/definitions/CustomKeys" + } + }, + "x-ms-discriminator-value": "CustomKeys" + }, + "DefaultResourceProvisioningState": { + "enum": [ + "NotStarted", + "Failed", + "Creating", + "Updating", + "Succeeded", + "Deleting", + "Accepted", + "Canceled", + "Scaling", + "Disabled" + ], + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ], + "x-ms-enum": { + "name": "DefaultResourceProvisioningState", + "modelAsString": true + } + }, + "DiagnoseRequestProperties": { + "type": "object", + "properties": { + "applicationInsights": { + "description": "Setting for diagnosing dependent application insights", + "type": "object", + "additionalProperties": {} + }, + "containerRegistry": { + "description": "Setting for diagnosing dependent container registry", + "type": "object", + "additionalProperties": {} + }, + "dnsResolution": { + "description": "Setting for diagnosing dns resolution", + "type": "object", + "additionalProperties": {} + }, + "keyVault": { + "description": "Setting for diagnosing dependent key vault", + "type": "object", + "additionalProperties": {} + }, + "nsg": { + "description": "Setting for diagnosing network security group", + "type": "object", + "additionalProperties": {} + }, + "others": { + "description": "Setting for diagnosing unclassified category of problems", + "type": "object", + "additionalProperties": {} + }, + "requiredResourceProviders": { + "description": "Setting for diagnosing the presence of required resource providers in the workspace.", + "type": "object", + "additionalProperties": {} + }, + "resourceLock": { + "description": "Setting for diagnosing resource lock", + "type": "object", + "additionalProperties": {} + }, + "storageAccount": { + "description": "Setting for diagnosing dependent storage account", + "type": "object", + "additionalProperties": {} + }, + "udr": { + "description": "Setting for diagnosing user defined routing", + "type": "object", + "additionalProperties": {} + } + } + }, + "DiagnoseResponseResult": { + "type": "object", + "properties": { + "value": { + "type": "object", + "properties": { + "userDefinedRouteResults": { + "type": "array", + "items": { + "$ref": "#/definitions/DiagnoseResult" + }, + "x-ms-identifiers": [ + "message" + ] + }, + "networkSecurityRuleResults": { + "type": "array", + "items": { + "$ref": "#/definitions/DiagnoseResult" + }, + "x-ms-identifiers": [ + "message" + ] + }, + "resourceLockResults": { + "type": "array", + "items": { + "$ref": "#/definitions/DiagnoseResult" + }, + "x-ms-identifiers": [ + "message" + ] + }, + "dnsResolutionResults": { + "type": "array", + "items": { + "$ref": "#/definitions/DiagnoseResult" + }, + "x-ms-identifiers": [ + "message" + ] + }, + "storageAccountResults": { + "type": "array", + "items": { + "$ref": "#/definitions/DiagnoseResult" + }, + "x-ms-identifiers": [ + "message" + ] + }, + "keyVaultResults": { + "type": "array", + "items": { + "$ref": "#/definitions/DiagnoseResult" + }, + "x-ms-identifiers": [ + "message" + ] + }, + "containerRegistryResults": { + "type": "array", + "items": { + "$ref": "#/definitions/DiagnoseResult" + }, + "x-ms-identifiers": [ + "message" + ] + }, + "applicationInsightsResults": { + "type": "array", + "items": { + "$ref": "#/definitions/DiagnoseResult" + }, + "x-ms-identifiers": [ + "message" + ] + }, + "otherResults": { + "type": "array", + "items": { + "$ref": "#/definitions/DiagnoseResult" + }, + "x-ms-identifiers": [ + "message" + ] + } + } + } + } + }, + "DiagnoseResult": { + "description": "Result of Diagnose", + "type": "object", + "properties": { + "code": { + "description": "Code for workspace setup error", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "level": { + "description": "Level of workspace setup error", + "$ref": "#/definitions/DiagnoseResultLevel", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "message": { + "description": "Message of workspace setup error", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + } + } + }, + "DiagnoseResultLevel": { + "description": "Level of workspace setup error", + "enum": [ + "Warning", + "Error", + "Information" + ], + "type": "string", + "x-ms-enum": { + "name": "DiagnoseResultLevel", + "modelAsString": true + } + }, + "DiagnoseWorkspaceParameters": { + "description": "Parameters to diagnose a workspace", + "type": "object", + "properties": { + "value": { + "$ref": "#/definitions/DiagnoseRequestProperties" + } + } + }, + "EncryptionKeyVaultUpdateProperties": { + "required": [ + "keyIdentifier" + ], + "type": "object", + "properties": { + "keyIdentifier": { + "minLength": 1, + "pattern": "[a-zA-Z0-9_]", + "type": "string" + } + } + }, + "EncryptionProperty": { + "required": [ + "keyVaultProperties", + "status" + ], + "type": "object", + "properties": { + "cosmosDbResourceId": { + "description": "The byok cosmosdb account that customer brings to store customer's data\r\nwith encryption", + "type": "string" + }, + "identity": { + "description": "Identity to be used with the keyVault", + "$ref": "#/definitions/IdentityForCmk" + }, + "keyVaultProperties": { + "description": "KeyVault details to do the encryption", + "$ref": "#/definitions/KeyVaultProperties" + }, + "searchAccountResourceId": { + "description": "The byok search account that customer brings to store customer's data\r\nwith encryption", + "type": "string" + }, + "status": { + "$ref": "#/definitions/EncryptionStatus" + }, + "storageAccountResourceId": { + "description": "The byok storage account that customer brings to store customer's data\r\nwith encryption", + "type": "string" + } + } + }, + "EncryptionStatus": { + "description": "Indicates whether or not the encryption is enabled for the workspace.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "EncryptionStatus", + "modelAsString": true + } + }, + "EncryptionUpdateProperties": { + "required": [ + "keyVaultProperties" + ], + "type": "object", + "properties": { + "keyVaultProperties": { + "$ref": "#/definitions/EncryptionKeyVaultUpdateProperties" + } + } + }, + "EndpointAuthMode": { + "enum": [ + "AMLToken", + "Key", + "AADToken" + ], + "type": "string", + "x-ms-enum": { + "name": "EndpointAuthMode", + "modelAsString": true + } + }, + "EndpointComputeType": { + "enum": [ + "Managed", + "Kubernetes", + "AzureMLCompute" + ], + "type": "string", + "x-ms-enum": { + "name": "EndpointComputeType", + "modelAsString": true + } + }, + "EndpointDeploymentModel": { + "type": "object", + "properties": { + "format": { + "description": "Model format", + "type": "string" + }, + "name": { + "description": "Model name.", + "type": "string" + }, + "source": { + "description": "Optional. Deployment model source ARM resource ID.", + "type": "string" + }, + "version": { + "description": "Model version.", + "type": "string" + } + } + }, + "EndpointDeploymentResourceProperties": { + "required": [ + "type" + ], + "type": "object", + "properties": { + "failureReason": { + "description": "The failure reason if the creation failed.", + "type": "string" + }, + "provisioningState": { + "description": "Read-only provision state status property.", + "$ref": "#/definitions/DefaultResourceProvisioningState" + }, + "type": { + "description": "Kind of the deployment.", + "minLength": 1, + "pattern": "[a-zA-Z0-9_]", + "type": "string" + } + }, + "discriminator": "type" + }, + "EndpointDeploymentResourcePropertiesBasicResource": { + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/EndpointDeploymentResourceProperties" + } + } + }, + "EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult": { + "type": "object", + "properties": { + "nextLink": { + "type": "string" + }, + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/EndpointDeploymentResourcePropertiesBasicResource" + } + } + } + }, + "EndpointKeys": { + "type": "object", + "properties": { + "keys": { + "description": "Dictionary of Keys for the endpoint.", + "$ref": "#/definitions/AccountApiKeys", + "x-ms-secret": true + } + } + }, + "EndpointModelDeprecationProperties": { + "type": "object", + "properties": { + "fineTune": { + "description": "The datetime of deprecation of the fineTune Model.", + "format": "date-time", + "type": "string" + }, + "inference": { + "description": "The datetime of deprecation of the inference Model.", + "format": "date-time", + "type": "string" + } + } + }, + "EndpointModelProperties": { + "description": "Endpoint Model properties.", + "type": "object", + "properties": { + "capabilities": { + "description": "The capabilities.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "deprecation": { + "$ref": "#/definitions/EndpointModelDeprecationProperties" + }, + "finetuneCapabilities": { + "description": "The capabilities for finetune models.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "format": { + "description": "Deployment model format.", + "type": "string" + }, + "isDefaultVersion": { + "description": "If the model is default version.", + "type": "boolean" + }, + "lifecycleStatus": { + "type": "string", + "enum": [ + "GenerallyAvailable", + "Preview" + ], + "x-ms-enum": { + "name": "ModelLifecycleStatus", + "modelAsString": true + }, + "description": "Model lifecycle status." + }, + "maxCapacity": { + "description": "The max capacity.", + "format": "int32", + "type": "integer" + }, + "name": { + "description": "Deployment model name.", + "type": "string" + }, + "skus": { + "description": "The list of Model Sku.", + "type": "array", + "items": { + "$ref": "#/definitions/EndpointModelSkuProperties" + } + }, + "systemData": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData" + }, + "version": { + "description": "Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version is different for different models and might change when there is new version available for a model. Default version for a model could be found from list models API.", + "type": "string" + } + } + }, + "EndpointModelSkuCapacityProperties": { + "type": "object", + "properties": { + "default": { + "description": "The default capacity.", + "format": "int32", + "type": "integer" + }, + "maximum": { + "description": "The maximum capacity.", + "format": "int32", + "type": "integer" + } + } + }, + "EndpointModelSkuProperties": { + "type": "object", + "properties": { + "capacity": { + "$ref": "#/definitions/EndpointModelSkuCapacityProperties" + }, + "connectionIds": { + "description": "The list of ARM id for the connection support this SKU.", + "type": "array", + "items": { + "type": "string", + "format": "arm-id" + } + }, + "deprecationDate": { + "description": "The datetime of deprecation of the model SKU.", + "format": "date-time", + "type": "string" + }, + "name": { + "description": "The name of the model SKU.", + "type": "string" + }, + "rateLimits": { + "type": "array", + "items": { + "$ref": "#/definitions/EndpointModelSkuRateLimitProperties" + } + }, + "usageName": { + "description": "The usage name of the model SKU.", + "type": "string" + } + } + }, + "EndpointModelSkuRateLimitProperties": { + "type": "object", + "properties": { + "count": { + "description": "The count value of Call Rate Limit.", + "format": "float", + "type": "number" + }, + "renewalPeriod": { + "description": "The renewal period in seconds of Call Rate Limit.", + "format": "float", + "type": "number" + }, + "rules": { + "description": "The call rate limit for the model.", + "type": "array", + "items": { + "$ref": "#/definitions/EndpointModelSkuRateLimitRuleProperties" + } + } + } + }, + "EndpointModelSkuRateLimitRulePatternProperties": { + "type": "object", + "properties": { + "method": { + "type": "string" + }, + "path": { + "type": "string" + } + } + }, + "EndpointModelSkuRateLimitRuleProperties": { + "type": "object", + "properties": { + "count": { + "format": "float", + "type": "number" + }, + "dynamicThrottlingEnabled": { + "description": "If the dynamic throttling is enabled.", + "type": "boolean" + }, + "key": { + "type": "string" + }, + "matchPatterns": { + "type": "array", + "items": { + "$ref": "#/definitions/EndpointModelSkuRateLimitRulePatternProperties" + } + }, + "minCount": { + "format": "float", + "type": "number" + }, + "renewalPeriod": { + "format": "float", + "type": "number" + } + } + }, + "EndpointModels": { + "type": "object", + "properties": { + "nextLink": { + "description": "The link to the next page constructed using the continuationToken. If null, there are no additional pages.", + "type": "string" + }, + "value": { + "description": "List of models.", + "type": "array", + "items": { + "$ref": "#/definitions/EndpointModelProperties" + } + } + } + }, + "EndpointResourceProperties": { + "required": [ + "endpointType" + ], + "type": "object", + "properties": { + "associatedResourceId": { + "description": "Byo resource id for creating the built-in model service endpoints.", + "type": "string", + "format": "arm-id" + }, + "deployments": { + "description": "Deployments info.", + "type": "array", + "items": { + "$ref": "#/definitions/EndpointDeploymentResourcePropertiesBasicResource" + } + }, + "endpointType": { + "description": "Type of the endpoint.", + "type": "string", + "enum": [ + "Azure.OpenAI", + "Azure.Speech", + "Azure.ContentSafety", + "Azure.Llama", + "managedOnlineEndpoint", + "serverlessEndpoint" + ], + "x-ms-enum": { + "name": "endpointType", + "modelAsString": true + } + }, + "endpointUri": { + "description": "Uri of the endpoint.", + "type": "string", + "format": "url" + }, + "failureReason": { + "description": "The failure reason if the creation failed.", + "type": "string" + }, + "location": { + "description": "Location of the endpoint.\r\nSince input dto and when parse endpoint resource share the same contract\r\nthis Location field is just for parse the endpoint resource info\r\nwe won't let customer specify the endpoint resource location since we will create it the same location as workspace", + "type": "string" + }, + "name": { + "description": "Name of the endpoint.", + "type": "string" + }, + "provisioningState": { + "description": "Read-only provision state status property.", + "$ref": "#/definitions/DefaultResourceProvisioningState" + }, + "shouldCreateAiServicesEndpoint": { + "description": "Whether the proxy (non-byo) endpoint is a regular endpoint or a OneKeyV2 AI services account endpoint.", + "type": "boolean" + } + }, + "discriminator": "endpointType" + }, + "EndpointResourcePropertiesBasicResource": { + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/EndpointResourceProperties" + } + } + }, + "EndpointResourcePropertiesBasicResourceArmPaginatedResult": { + "type": "object", + "properties": { + "nextLink": { + "type": "string" + }, + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/EndpointResourcePropertiesBasicResource" + } + } + } + }, + "ExternalFQDNResponse": { + "type": "object", + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/FQDNEndpointsPropertyBag" + }, + "x-ms-identifiers": [ + "/properties/category" + ] + } + } + }, + "FQDNEndpoint": { + "type": "object", + "properties": { + "domainName": { + "type": "string" + }, + "endpointDetails": { + "type": "array", + "items": { + "$ref": "#/definitions/FQDNEndpointDetail" + }, + "x-ms-identifiers": [ + "port" + ] + } + } + }, + "FQDNEndpointDetail": { + "type": "object", + "properties": { + "port": { + "format": "int32", + "type": "integer" + } + } + }, + "FQDNEndpoints": { + "type": "object", + "properties": { + "category": { + "type": "string" + }, + "endpoints": { + "type": "array", + "items": { + "$ref": "#/definitions/FQDNEndpoint" + }, + "x-ms-identifiers": [ + "domainName" + ] + } + } + }, + "FQDNEndpointsPropertyBag": { + "description": "Property bag for FQDN endpoints result", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/FQDNEndpoints" + } + } + }, + "FeatureStoreSettings": { + "type": "object", + "properties": { + "computeRuntime": { + "$ref": "#/definitions/ComputeRuntimeDto" + }, + "offlineStoreConnectionName": { + "type": "string" + }, + "onlineStoreConnectionName": { + "type": "string" + } + } + }, + "FqdnOutboundRule": { + "description": "FQDN Outbound Rule for the managed network of a machine learning workspace.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/OutboundRule" + } + ], + "properties": { + "destination": { + "type": "string" + } + }, + "x-ms-discriminator-value": "FQDN" + }, + "IdentityForCmk": { + "description": "Identity object used for encryption.", + "type": "object", + "properties": { + "userAssignedIdentity": { + "description": "UserAssignedIdentity to be used to fetch the encryption key from keyVault", + "type": "string" + } + } + }, + "IsolationMode": { + "description": "Isolation mode for the managed network of a machine learning workspace.", + "enum": [ + "Disabled", + "AllowInternetOutbound", + "AllowOnlyApprovedOutbound" + ], + "type": "string", + "x-ms-enum": { + "name": "IsolationMode", + "modelAsString": true + } + }, + "KeyVaultProperties": { + "description": "Customer Key vault properties.", + "required": [ + "keyIdentifier", + "keyVaultArmId" + ], + "type": "object", + "properties": { + "identityClientId": { + "description": "Currently, we support only SystemAssigned MSI.\r\nWe need this when we support UserAssignedIdentities", + "type": "string" + }, + "keyIdentifier": { + "description": "KeyVault key identifier to encrypt the data", + "minLength": 1, + "pattern": "[a-zA-Z0-9_]", + "type": "string" + }, + "keyVaultArmId": { + "description": "KeyVault Arm Id that contains the data encryption key", + "minLength": 1, + "pattern": "[a-zA-Z0-9_]", + "type": "string" + } + } + }, + "ListNotebookKeysResult": { + "type": "object", + "properties": { + "primaryAccessKey": { + "description": "The primary access key of the Notebook", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ], + "x-ms-secret": true + }, + "secondaryAccessKey": { + "description": "The secondary access key of the Notebook", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ], + "x-ms-secret": true + } + } + }, + "ListStorageAccountKeysResult": { + "type": "object", + "properties": { + "userStorageKey": { + "description": "The access key of the storage", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ], + "x-ms-secret": true + } + } + }, + "ListWorkspaceKeysResult": { + "type": "object", + "properties": { + "appInsightsInstrumentationKey": { + "description": "The access key of the workspace app insights", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ], + "x-ms-secret": true + }, + "containerRegistryCredentials": { + "$ref": "#/definitions/RegistryListCredentialsResult" + }, + "notebookAccessKeys": { + "$ref": "#/definitions/ListNotebookKeysResult" + }, + "userStorageArmId": { + "description": "The arm Id key of the workspace storage", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "userStorageKey": { + "description": "The access key of the workspace storage", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ], + "x-ms-secret": true + } + } + }, + "ManagedIdentityAuthTypeWorkspaceConnectionProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + ], + "properties": { + "credentials": { + "$ref": "#/definitions/WorkspaceConnectionManagedIdentity" + } + }, + "x-ms-discriminator-value": "ManagedIdentity" + }, + "ManagedNetworkProvisionOptions": { + "description": "Managed Network Provisioning options for managed network of a machine learning workspace.", + "type": "object", + "properties": { + "includeSpark": { + "type": "boolean" + } + } + }, + "ManagedNetworkProvisionStatus": { + "description": "Status of the Provisioning for the managed network of a machine learning workspace.", + "type": "object", + "properties": { + "sparkReady": { + "type": "boolean" + }, + "status": { + "description": "Status for the managed network of a machine learning workspace.", + "$ref": "#/definitions/ManagedNetworkStatus" + } + } + }, + "ManagedNetworkSettings": { + "description": "Managed Network settings for a machine learning workspace.", + "type": "object", + "properties": { + "isolationMode": { + "description": "Isolation mode for the managed network of a machine learning workspace.", + "$ref": "#/definitions/IsolationMode" + }, + "networkId": { + "type": "string", + "readOnly": true + }, + "outboundRules": { + "type": "object", + "additionalProperties": { + "description": "Outbound Rule for the managed network of a machine learning workspace.", + "$ref": "#/definitions/OutboundRule" + }, + "x-nullable": true + }, + "status": { + "description": "Status of the Provisioning for the managed network of a machine learning workspace.", + "$ref": "#/definitions/ManagedNetworkProvisionStatus" + }, + "changeableIsolationModes": { + "type": "array", + "items": { + "$ref": "#/definitions/IsolationMode" + }, + "readOnly": true + } + } + }, + "ManagedNetworkStatus": { + "description": "Status for the managed network of a machine learning workspace.", + "enum": [ + "Inactive", + "Active" + ], + "type": "string", + "x-ms-enum": { + "name": "ManagedNetworkStatus", + "modelAsString": true + } + }, + "ManagedOnlineEndpointDeploymentResourceProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/EndpointDeploymentResourceProperties" + } + ], + "properties": { + "endpointComputeType": { + "$ref": "#/definitions/EndpointComputeType" + }, + "model": { + "type": "string" + } + }, + "x-ms-discriminator-value": "managedOnlineEndpoint" + }, + "ManagedOnlineEndpointResourceProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/EndpointResourceProperties" + } + ], + "properties": { + "authMode": { + "$ref": "#/definitions/EndpointAuthMode" + }, + "compute": { + "type": "string" + }, + "description": { + "type": "string" + }, + "mirrorTraffic": { + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + }, + "scoringUri": { + "format": "uri", + "type": "string" + }, + "traffic": { + "type": "object", + "additionalProperties": { + "format": "int32", + "type": "integer" + } + } + }, + "x-ms-discriminator-value": "managedOnlineEndpoint" + }, + "ManagedPERequirement": { + "enum": [ + "Required", + "NotRequired", + "NotApplicable" + ], + "type": "string", + "x-ms-enum": { + "name": "ManagedPERequirement", + "modelAsString": true + } + }, + "ManagedPEStatus": { + "enum": [ + "Inactive", + "Active", + "NotApplicable" + ], + "type": "string", + "x-ms-enum": { + "name": "ManagedPEStatus", + "modelAsString": true + } + }, + "ServerlessEndpointModelSettings": { + "required": [ + "modelId" + ], + "type": "object", + "properties": { + "modelId": { + "minLength": 1, + "pattern": "[a-zA-Z0-9_]", + "type": "string" + } + } + }, + "NoneAuthTypeWorkspaceConnectionProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + ], + "x-ms-discriminator-value": "None" + }, + "NotebookAccessTokenResult": { + "type": "object", + "properties": { + "accessToken": { + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ], + "x-ms-secret": true + }, + "expiresIn": { + "format": "int32", + "type": "integer", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "hostName": { + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "notebookResourceId": { + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "publicDns": { + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "refreshToken": { + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ], + "x-ms-secret": true + }, + "scope": { + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "tokenType": { + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + } + } + }, + "NotebookPreparationError": { + "type": "object", + "properties": { + "errorMessage": { + "type": "string" + }, + "statusCode": { + "format": "int32", + "type": "integer" + } + } + }, + "NotebookResourceInfo": { + "type": "object", + "properties": { + "fqdn": { + "type": "string" + }, + "isPrivateLinkEnabled": { + "type": "boolean" + }, + "notebookPreparationError": { + "description": "The error that occurs when preparing notebook.", + "$ref": "#/definitions/NotebookPreparationError" + }, + "resourceId": { + "description": "the data plane resourceId that used to initialize notebook component", + "type": "string" + } + } + }, + "OAuth2AuthTypeWorkspaceConnectionProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + ], + "properties": { + "credentials": { + "$ref": "#/definitions/WorkspaceConnectionOAuth2" + } + }, + "x-ms-discriminator-value": "OAuth2" + }, + "OpenAIEndpointDeploymentResourceProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CognitiveServiceEndpointDeploymentResourceProperties" + }, + { + "$ref": "#/definitions/EndpointDeploymentResourceProperties" + } + ], + "x-ms-discriminator-value": "Azure.OpenAI" + }, + "OpenAIEndpointResourceProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/EndpointResourceProperties" + } + ], + "x-ms-discriminator-value": "Azure.OpenAI" + }, + "OutboundRule": { + "description": "Outbound Rule for the managed network of a machine learning workspace.", + "required": [ + "type" + ], + "type": "object", + "properties": { + "category": { + "description": "Category of a managed network Outbound Rule of a machine learning workspace.", + "$ref": "#/definitions/RuleCategory" + }, + "parentRuleNames": { + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "status": { + "description": "Type of a managed network Outbound Rule of a machine learning workspace.", + "$ref": "#/definitions/RuleStatus" + }, + "type": { + "description": "Type of a managed network Outbound Rule of a machine learning workspace.", + "$ref": "#/definitions/RuleType" + } + }, + "discriminator": "type" + }, + "OutboundRuleBasicResource": { + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" + } + ], + "properties": { + "properties": { + "description": "Outbound Rule for the managed network of a machine learning workspace.", + "$ref": "#/definitions/OutboundRule" + } + } + }, + "OutboundRuleListResult": { + "description": "List of outbound rules for the managed network of a machine learning workspace.", + "type": "object", + "properties": { + "nextLink": { + "description": "The link to the next page constructed using the continuationToken. If null, there are no additional pages.", + "type": "string" + }, + "value": { + "description": "The list of machine learning workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning workspaces.", + "type": "array", + "items": { + "$ref": "#/definitions/OutboundRuleBasicResource" + } + } + } + }, + "PATAuthTypeWorkspaceConnectionProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + ], + "properties": { + "credentials": { + "$ref": "#/definitions/WorkspaceConnectionPersonalAccessToken" + } + }, + "x-ms-discriminator-value": "PAT" + }, + "Password": { + "type": "object", + "properties": { + "name": { + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ], + "x-ms-secret": true + }, + "value": { + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ], + "x-ms-secret": true + } + } + }, + "PrivateEndpointConnection": { + "description": "The Private Endpoint Connection resource.", + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" + } + ], + "properties": { + "identity": { + "$ref": "../../../../../common-types/resource-management/v3/managedidentity.json#/definitions/ManagedServiceIdentity" + }, + "location": { + "description": "Same as workspace location.", + "type": "string" + }, + "properties": { + "description": "Private endpoint connection properties.", + "$ref": "#/definitions/PrivateEndpointConnectionProperties", + "x-ms-client-flatten": true + }, + "sku": { + "description": "Optional. This field is required to be implemented by the RP because AML is supporting more than one tier", + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Sku" + }, + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "PrivateEndpointConnectionListResult": { + "description": "List of private endpoint connection associated with the specified workspace", + "type": "object", + "properties": { + "value": { + "description": "Array of private endpoint connections", + "type": "array", + "items": { + "$ref": "#/definitions/PrivateEndpointConnection" + } + } + } + }, + "PrivateEndpointConnectionProperties": { + "description": "Private endpoint connection properties.", + "type": "object", + "properties": { + "privateEndpoint": { + "$ref": "#/definitions/WorkspacePrivateEndpointResource" + }, + "privateLinkServiceConnectionState": { + "description": "The connection state.", + "$ref": "#/definitions/PrivateLinkServiceConnectionState" + }, + "provisioningState": { + "$ref": "#/definitions/PrivateEndpointConnectionProvisioningState" + } + } + }, + "PrivateEndpointConnectionProvisioningState": { + "description": "The current provisioning state.", + "enum": [ + "Succeeded", + "Creating", + "Deleting", + "Failed" + ], + "type": "string", + "x-ms-enum": { + "name": "PrivateEndpointConnectionProvisioningState", + "modelAsString": true + } + }, + "PrivateEndpointDestination": { + "description": "Private Endpoint destination for a Private Endpoint Outbound Rule for the managed network of a machine learning workspace.", + "type": "object", + "properties": { + "serviceResourceId": { + "type": "string", + "format": "arm-id" + }, + "sparkEnabled": { + "type": "boolean" + }, + "sparkStatus": { + "description": "Type of a managed network Outbound Rule of a machine learning workspace.", + "$ref": "#/definitions/RuleStatus" + }, + "subresourceTarget": { + "type": "string" + } + } + }, + "PrivateEndpointOutboundRule": { + "description": "Private Endpoint Outbound Rule for the managed network of a machine learning workspace.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/OutboundRule" + } + ], + "properties": { + "destination": { + "description": "Private Endpoint destination for a Private Endpoint Outbound Rule for the managed network of a machine learning workspace.", + "$ref": "#/definitions/PrivateEndpointDestination" + }, + "fqdns": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "x-ms-discriminator-value": "PrivateEndpoint" + }, + "PrivateEndpointServiceConnectionStatus": { + "description": "Connection status of the service consumer with the service provider\r\nPossible state transitions\r\nPending -> Approved (Service provider approves the connection request)\r\nPending -> Rejected (Service provider rejects the connection request)\r\nPending -> Disconnected (Service provider deletes the connection)\r\nApproved -> Rejected (Service provider rejects the approved connection)\r\nApproved -> Disconnected (Service provider deletes the connection)\r\nRejected -> Pending (Service consumer re-initiates the connection request that was rejected)\r\nRejected -> Disconnected (Service provider deletes the connection)", + "enum": [ + "Approved", + "Pending", + "Rejected", + "Disconnected", + "Timeout" + ], + "type": "string", + "x-ms-enum": { + "name": "EndpointServiceConnectionStatus", + "modelAsString": true + } + }, + "PrivateLinkResource": { + "description": "A private link resource", + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" + } + ], + "properties": { + "identity": { + "$ref": "../../../../../common-types/resource-management/v3/managedidentity.json#/definitions/ManagedServiceIdentity" + }, + "location": { + "description": "Same as workspace location.", + "type": "string" + }, + "properties": { + "description": "Properties of a private link resource.", + "$ref": "#/definitions/PrivateLinkResourceProperties", + "x-ms-client-flatten": true + }, + "sku": { + "description": "Optional. This field is required to be implemented by the RP because AML is supporting more than one tier", + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Sku" + }, + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "PrivateLinkResourceListResult": { + "description": "A list of private link resources", + "type": "object", + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/PrivateLinkResource" + } + } + } + }, + "PrivateLinkResourceProperties": { + "description": "Properties of a private link resource.", + "type": "object", + "properties": { + "groupId": { + "description": "The private link resource group id.", + "type": "string" + }, + "requiredMembers": { + "description": "The private link resource required member names.", + "type": "array", + "items": { + "type": "string" + } + }, + "requiredZoneNames": { + "description": "The private link resource Private link DNS zone name.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "PrivateLinkServiceConnectionState": { + "description": "A collection of information about the state of the connection between service consumer and provider.", + "type": "object", + "properties": { + "actionsRequired": { + "description": "Some RP chose \"None\". Other RPs use this for region expansion.", + "type": "string" + }, + "description": { + "description": "User-defined message that, per NRP doc, may be used for approval-related message.", + "type": "string" + }, + "status": { + "$ref": "#/definitions/PrivateEndpointServiceConnectionStatus" + } + } + }, + "ProvisioningState": { + "description": "The current deployment state of workspace resource. The provisioningState is to indicate states for resource provisioning.", + "enum": [ + "Unknown", + "Updating", + "Creating", + "Deleting", + "Succeeded", + "Failed", + "Canceled" + ], + "type": "string", + "x-ms-enum": { + "name": "ProvisioningState", + "modelAsString": true + } + }, + "PublicNetworkAccessType": { + "description": "The public network access flag.", + "enum": [ + "Enabled", + "Disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "PublicNetworkAccessType", + "modelAsString": true + } + }, + "RaiBlocklistItemsBulkAddRequest": { + "description": "The list of Cognitive Services RaiBlocklist Items for batch add.", + "type": "array", + "items": { + "$ref": "#/definitions/RaiBlocklistItemBulkRequest" + }, + "x-ms-identifiers": [ + "name" + ] + }, + "RaiBlocklistItemBulkRequest": { + "description": "The Cognitive Services RaiBlocklist Item request body.", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "properties": { + "$ref": "#/definitions/RaiBlocklistItemProperties", + "description": "Properties of Cognitive Services RaiBlocklist Item." + } + } + }, + "RaiBlocklistItemsBulkDeleteRequest": { + "description": "The list of Cognitive Services RaiBlocklist Items Names.", + "type": "object", + "items": { + "type": "string" + } + }, + "RaiBlocklistConfig": { + "description": "Azure OpenAI blocklist config.", + "type": "object", + "properties": { + "blocking": { + "description": "If blocking would occur.", + "type": "boolean" + }, + "blocklistName": { + "description": "Name of ContentFilter.", + "type": "string" + } + } + }, + "RaiBlocklistItemProperties": { + "description": "RAI Custom Blocklist Item properties.", + "type": "object", + "properties": { + "isRegex": { + "description": "If the pattern is a regex pattern.", + "type": "boolean" + }, + "pattern": { + "description": "Pattern to match against.", + "type": "string" + } + } + }, + "RaiBlocklistItemPropertiesBasicResource": { + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" + } + ], + "properties": { + "properties": { + "description": "RAI Custom Blocklist Item properties.", + "$ref": "#/definitions/RaiBlocklistItemProperties" + } + } + }, + "RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult": { + "type": "object", + "properties": { + "nextLink": { + "type": "string" + }, + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/RaiBlocklistItemPropertiesBasicResource" + } + } + } + }, + "RaiBlocklistProperties": { + "description": "RAI Custom Blocklist properties.", + "type": "object", + "properties": { + "description": { + "description": "Description of the block list.", + "type": "string" + } + } + }, + "RaiBlocklistPropertiesBasicResource": { + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" + } + ], + "properties": { + "properties": { + "description": "RAI Custom Blocklist properties.", + "$ref": "#/definitions/RaiBlocklistProperties" + } + } + }, + "RaiBlocklistPropertiesBasicResourceArmPaginatedResult": { + "type": "object", + "properties": { + "nextLink": { + "type": "string" + }, + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/RaiBlocklistPropertiesBasicResource" + } + } + } + }, + "RaiPolicyContentFilter": { + "description": "Azure OpenAI Content Filter.", + "type": "object", + "properties": { + "allowedContentLevel": { + "$ref": "#/definitions/AllowedContentLevel" + }, + "blocking": { + "description": "If blocking would occur.", + "type": "boolean" + }, + "enabled": { + "description": "If the ContentFilter is enabled.", + "type": "boolean" + }, + "name": { + "description": "Name of ContentFilter.", + "type": "string" + }, + "source": { + "$ref": "#/definitions/RaiPolicyContentSource" + } + } + }, + "RaiPolicyContentSource": { + "description": "Content source to apply the Content Filters.", + "enum": [ + "Prompt", + "Completion" + ], + "type": "string", + "x-ms-enum": { + "name": "RaiPolicyContentSource", + "modelAsString": true + } + }, + "RaiPolicyMode": { + "description": "Content Filters mode.", + "enum": [ + "Default", + "Deferred", + "Blocking" + ], + "type": "string", + "x-ms-enum": { + "name": "RaiPolicyMode", + "modelAsString": true + } + }, + "RaiPolicyProperties": { + "description": "Azure OpenAI Content Filters properties.", + "type": "object", + "properties": { + "basePolicyName": { + "description": "Name of the base Content Filters.", + "type": "string" + }, + "completionBlocklists": { + "type": "array", + "items": { + "$ref": "#/definitions/RaiBlocklistConfig" + } + }, + "contentFilters": { + "type": "array", + "items": { + "$ref": "#/definitions/RaiPolicyContentFilter" + } + }, + "mode": { + "$ref": "#/definitions/RaiPolicyMode" + }, + "promptBlocklists": { + "type": "array", + "items": { + "$ref": "#/definitions/RaiBlocklistConfig" + } + }, + "type": { + "$ref": "#/definitions/RaiPolicyType" + } + } + }, + "RaiPolicyPropertiesBasicResource": { + "description": "Azure OpenAI Content Filters resource.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/RaiPolicyProperties" + } + } + }, + "RaiPolicyPropertiesBasicResourceArmPaginatedResult": { + "description": "Azure OpenAI Content Filters resource list.", + "type": "object", + "properties": { + "nextLink": { + "type": "string" + }, + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/RaiPolicyPropertiesBasicResource" + } + } + } + }, + "RaiPolicyType": { + "description": "Content Filters policy type.", + "enum": [ + "UserManaged", + "SystemManaged" + ], + "type": "string", + "x-ms-enum": { + "name": "RaiPolicyType", + "modelAsString": true + } + }, + "RegenerateServiceAccountKeyContent": { + "type": "object", + "properties": { + "keyName": { + "$ref": "#/definitions/ServiceAccountKeyName" + } + } + }, + "RegistryListCredentialsResult": { + "type": "object", + "properties": { + "location": { + "description": "The location of the workspace ACR", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "passwords": { + "type": "array", + "items": { + "$ref": "#/definitions/Password" + }, + "x-ms-identifiers": [ + "name" + ] + }, + "username": { + "description": "The username of the workspace ACR", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + } + } + }, + "RuleAction": { + "description": "The action enum for networking rule.", + "enum": [ + "Allow", + "Deny" + ], + "type": "string", + "x-ms-enum": { + "name": "RuleAction", + "modelAsString": true + } + }, + "RuleCategory": { + "description": "Category of a managed network Outbound Rule of a machine learning workspace.", + "enum": [ + "Required", + "Recommended", + "UserDefined", + "Dependency" + ], + "type": "string", + "x-ms-enum": { + "name": "RuleCategory", + "modelAsString": true + } + }, + "RuleStatus": { + "description": "Type of a managed network Outbound Rule of a machine learning workspace.", + "enum": [ + "Inactive", + "Active" + ], + "type": "string", + "x-ms-enum": { + "name": "RuleStatus", + "modelAsString": true + } + }, + "RuleType": { + "description": "Type of a managed network Outbound Rule of a machine learning workspace.", + "enum": [ + "FQDN", + "PrivateEndpoint", + "ServiceTag" + ], + "type": "string", + "x-ms-enum": { + "name": "RuleType", + "modelAsString": true + } + }, + "SASAuthTypeWorkspaceConnectionProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + ], + "properties": { + "credentials": { + "$ref": "#/definitions/WorkspaceConnectionSharedAccessSignature" + } + }, + "x-ms-discriminator-value": "SAS" + }, + "ServerlessComputeSettings": { + "type": "object", + "properties": { + "serverlessComputeCustomSubnet": { + "description": "The resource ID of an existing virtual network subnet in which serverless compute nodes should be deployed", + "type": "string", + "format": "arm-id" + }, + "serverlessComputeNoPublicIP": { + "description": "The flag to signal if serverless compute nodes deployed in custom vNet would have no public IP addresses for a workspace with private endpoint", + "type": "boolean" + } + } + }, + "ServerlessEndpointCapacityReservation": { + "required": [ + "capacityReservationGroupId" + ], + "type": "object", + "properties": { + "capacityReservationGroupId": { + "minLength": 1, + "pattern": "[a-zA-Z0-9_]", + "type": "string" + }, + "endpointReservedCapacity": { + "format": "int32", + "type": "integer" + } + } + }, + "ServerlessEndpointResourceProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/EndpointResourceProperties" + } + ], + "properties": { + "authMode": { + "$ref": "#/definitions/ServerlessInferenceEndpointAuthMode" + }, + "capacityReservation": { + "$ref": "#/definitions/ServerlessEndpointCapacityReservation" + }, + "contentSafety": { + "$ref": "#/definitions/ServerlessEndpointContentSafety" + }, + "endpointState": { + "$ref": "#/definitions/ServerlessEndpointState" + }, + "inferenceEndpoint": { + "$ref": "#/definitions/ServerlessEndpointInferenceEndpoint" + }, + "marketplaceSubscriptionId": { + "type": "string" + }, + "metadata": {}, + "modelSettings": { + "$ref": "#/definitions/ServerlessEndpointModelSettings" + }, + "offer": { + "$ref": "#/definitions/ServerlessOffer" + } + }, + "x-ms-discriminator-value": "serverlessEndpoint" + }, + "ServerlessEndpointState": { + "enum": [ + "Unknown", + "Creating", + "Deleting", + "Suspending", + "Reinstating", + "Online", + "Suspended", + "CreationFailed", + "DeletionFailed" + ], + "type": "string", + "x-ms-enum": { + "name": "ServerlessEndpointState", + "modelAsString": true + } + }, + "ServerlessEndpointInferenceEndpoint": { + "required": [ + "uri" + ], + "type": "object", + "properties": { + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "uri": { + "format": "uri", + "type": "string", + "x-ms-mutability": [ + "read" + ] + } + } + }, + "ServerlessInferenceEndpointAuthMode": { + "enum": [ + "Key", + "AAD" + ], + "type": "string", + "x-ms-enum": { + "name": "ServerlessInferenceEndpointAuthMode", + "modelAsString": true + } + }, + "ServerlessOffer": { + "required": [ + "offerName", + "publisher" + ], + "type": "object", + "properties": { + "offerName": { + "minLength": 1, + "pattern": "[a-zA-Z0-9_]", + "type": "string" + }, + "publisher": { + "minLength": 1, + "pattern": "[a-zA-Z0-9_]", + "type": "string" + } + } + }, + "ServiceAccountKeyName": { + "enum": [ + "Key1", + "Key2" + ], + "type": "string", + "x-ms-enum": { + "name": "ServiceAccountKeyName", + "modelAsString": true + } + }, + "ServiceManagedResourcesSettings": { + "type": "object", + "properties": { + "cosmosDb": { + "$ref": "#/definitions/CosmosDbSettings" + } + } + }, + "ServicePrincipalAuthTypeWorkspaceConnectionProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + ], + "properties": { + "credentials": { + "$ref": "#/definitions/WorkspaceConnectionServicePrincipal" + } + }, + "x-ms-discriminator-value": "ServicePrincipal" + }, + "ServiceTagDestination": { + "description": "Service Tag destination for a Service Tag Outbound Rule for the managed network of a machine learning workspace.", + "type": "object", + "properties": { + "action": { + "description": "The action enum for networking rule.", + "$ref": "#/definitions/RuleAction" + }, + "addressPrefixes": { + "description": "Optional, if provided, the ServiceTag property will be ignored.", + "type": "array", + "items": { + "type": "string" + }, + "readOnly": true + }, + "portRanges": { + "type": "string" + }, + "protocol": { + "type": "string" + }, + "serviceTag": { + "type": "string" + } + } + }, + "ServiceTagOutboundRule": { + "description": "Service Tag Outbound Rule for the managed network of a machine learning workspace.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/OutboundRule" + } + ], + "properties": { + "destination": { + "description": "Service Tag destination for a Service Tag Outbound Rule for the managed network of a machine learning workspace.", + "$ref": "#/definitions/ServiceTagDestination" + } + }, + "x-ms-discriminator-value": "ServiceTag" + }, + "SharedPrivateLinkResource": { + "type": "object", + "properties": { + "name": { + "description": "Unique name of the private link", + "type": "string" + }, + "properties": { + "description": "Properties of a shared private link resource.", + "$ref": "#/definitions/SharedPrivateLinkResourceProperty", + "x-ms-client-flatten": true + } + } + }, + "SharedPrivateLinkResourceProperty": { + "description": "Properties of a shared private link resource.", + "type": "object", + "properties": { + "groupId": { + "description": "group id of the private link", + "type": "string" + }, + "privateLinkResourceId": { + "description": "the resource id that private link links to", + "type": "string" + }, + "requestMessage": { + "description": "Request message", + "type": "string" + }, + "status": { + "$ref": "#/definitions/PrivateEndpointServiceConnectionStatus" + } + } + }, + "SpeechEndpointDeploymentResourceProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/CognitiveServiceEndpointDeploymentResourceProperties" + }, + { + "$ref": "#/definitions/EndpointDeploymentResourceProperties" + } + ], + "x-ms-discriminator-value": "Azure.Speech" + }, + "SpeechEndpointResourceProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/EndpointResourceProperties" + } + ], + "x-ms-discriminator-value": "Azure.Speech" + }, + "UsernamePasswordAuthTypeWorkspaceConnectionProperties": { + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + ], + "properties": { + "credentials": { + "$ref": "#/definitions/WorkspaceConnectionUsernamePassword" + } + }, + "x-ms-discriminator-value": "UsernamePassword" + }, + "Workspace": { + "description": "An object that represents a machine learning workspace.", + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" + } + ], + "properties": { + "identity": { + "$ref": "../../../../../common-types/resource-management/v3/managedidentity.json#/definitions/ManagedServiceIdentity" + }, + "kind": { + "type": "string" + }, + "location": { + "type": "string" + }, + "properties": { + "description": "Additional attributes of the entity.", + "$ref": "#/definitions/WorkspaceProperties", + "x-ms-client-flatten": true + }, + "sku": { + "description": "Optional. This field is required to be implemented by the RP because AML is supporting more than one tier", + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Sku" + }, + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "WorkspaceConnectionAccessKey": { + "type": "object", + "properties": { + "accessKeyId": { + "type": "string" + }, + "secretAccessKey": { + "type": "string" + } + } + }, + "WorkspaceConnectionAccountKey": { + "description": "Account key object for workspace connection credential.", + "type": "object", + "properties": { + "key": { + "type": "string" + } + } + }, + "WorkspaceConnectionApiKey": { + "description": "Api key object for workspace connection credential.", + "type": "object", + "properties": { + "key": { + "type": "string" + } + } + }, + "WorkspaceConnectionManagedIdentity": { + "type": "object", + "properties": { + "clientId": { + "type": "string" + }, + "resourceId": { + "type": "string" + } + } + }, + "WorkspaceConnectionOAuth2": { + "description": "ClientId and ClientSecret are required. Other properties are optional\r\ndepending on each OAuth2 provider's implementation.", + "type": "object", + "properties": { + "authUrl": { + "description": "Required by Concur connection category", + "type": "string", + "format": "url" + }, + "clientId": { + "type": "string", + "description": "Client id in the format of UUID", + "format": "uuid" + }, + "clientSecret": { + "type": "string", + "x-ms-secret": true + }, + "developerToken": { + "description": "Required by GoogleAdWords connection category", + "type": "string", + "x-ms-secret": true + }, + "password": { + "type": "string", + "x-ms-secret": true + }, + "refreshToken": { + "description": "Required by GoogleBigQuery, GoogleAdWords, Hubspot, QuickBooks, Square, Xero, Zoho\r\nwhere user needs to get RefreshToken offline", + "type": "string", + "x-ms-secret": true + }, + "tenantId": { + "description": "Required by QuickBooks and Xero connection categories", + "type": "string" + }, + "username": { + "description": "Concur, ServiceNow auth server AccessToken grant type is 'Password'\r\nwhich requires UsernamePassword", + "type": "string" + } + } + }, + "WorkspaceConnectionPersonalAccessToken": { + "type": "object", + "properties": { + "pat": { + "type": "string" + } + } + }, + "WorkspaceConnectionPropertiesV2": { + "required": [ + "authType" + ], + "type": "object", + "properties": { + "authType": { + "description": "Authentication type of the connection target", + "$ref": "#/definitions/ConnectionAuthType" + }, + "category": { + "description": "Category of the connection", + "$ref": "#/definitions/ConnectionCategory" + }, + "createdByWorkspaceArmId": { + "type": "string", + "format": "arm-id", + "readOnly": true + }, + "error": { + "type": "string" + }, + "expiryTime": { + "format": "date-time", + "type": "string" + }, + "group": { + "description": "Group based on connection category", + "$ref": "#/definitions/ConnectionGroup", + "readOnly": true + }, + "isSharedToAll": { + "type": "boolean" + }, + "metadata": { + "description": "Store user metadata for this connection", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "peRequirement": { + "$ref": "#/definitions/ManagedPERequirement" + }, + "peStatus": { + "$ref": "#/definitions/ManagedPEStatus" + }, + "sharedUserList": { + "type": "array", + "items": { + "type": "string" + } + }, + "target": { + "type": "string" + }, + "useWorkspaceManagedIdentity": { + "type": "boolean" + } + }, + "discriminator": "authType" + }, + "WorkspaceConnectionPropertiesV2BasicResource": { + "required": [ + "properties" + ], + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + } + }, + "WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult": { + "type": "object", + "properties": { + "nextLink": { + "type": "string" + }, + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2BasicResource" + } + } + } + }, + "WorkspaceConnectionServicePrincipal": { + "type": "object", + "properties": { + "clientId": { + "type": "string" + }, + "clientSecret": { + "x-ms-secret": true, + "type": "string" + }, + "tenantId": { + "type": "string" + } + } + }, + "WorkspaceConnectionSharedAccessSignature": { + "type": "object", + "properties": { + "sas": { + "type": "string" + } + } + }, + "WorkspaceConnectionUpdateParameter": { + "description": "The properties that the machine learning workspace connection will be updated with.", + "type": "object", + "properties": { + "properties": { + "description": "The properties that the machine learning workspace connection will be updated with.", + "$ref": "#/definitions/WorkspaceConnectionPropertiesV2" + } + } + }, + "WorkspaceConnectionUsernamePassword": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "securityToken": { + "description": "Optional, required by connections like SalesForce for extra security in addition to UsernamePassword", + "type": "string", + "x-ms-secret": true + }, + "username": { + "type": "string" + } + } + }, + "WorkspaceHubConfig": { + "description": "WorkspaceHub's configuration object.", + "type": "object", + "properties": { + "additionalWorkspaceStorageAccounts": { + "type": "array", + "items": { + "type": "string" + } + }, + "defaultWorkspaceResourceGroup": { + "type": "string" + } + } + }, + "WorkspaceListResult": { + "description": "The result of a request to list machine learning workspaces.", + "type": "object", + "properties": { + "nextLink": { + "description": "The link to the next page constructed using the continuationToken. If null, there are no additional pages.", + "type": "string" + }, + "value": { + "description": "The list of machine learning workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning workspaces.", + "type": "array", + "items": { + "$ref": "#/definitions/Workspace" + } + } + } + }, + "WorkspacePrivateEndpointResource": { + "description": "The Private Endpoint resource.", + "type": "object", + "properties": { + "id": { + "description": "e.g. /subscriptions/{networkSubscriptionId}/resourceGroups/{rgName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "subnetArmId": { + "description": "The subnetId that the private endpoint is connected to.", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + } + } + }, + "WorkspaceProperties": { + "description": "The properties of a machine learning workspace.", + "type": "object", + "properties": { + "allowPublicAccessWhenBehindVnet": { + "description": "The flag to indicate whether to allow public access when behind VNet.", + "type": "boolean" + }, + "allowRoleAssignmentOnRG": { + "description": "The flag to indicate whether we will do role assignment for the workspace MSI on resource group level.", + "type": "boolean" + }, + "applicationInsights": { + "description": "ARM id of the application insights associated with this workspace.", + "type": "string" + }, + "associatedWorkspaces": { + "type": "array", + "items": { + "type": "string" + } + }, + "containerRegistries": { + "type": "array", + "items": { + "type": "string" + } + }, + "containerRegistry": { + "description": "ARM id of the container registry associated with this workspace.", + "type": "string" + }, + "description": { + "description": "The description of this workspace.", + "type": "string" + }, + "discoveryUrl": { + "description": "Url for the discovery service to identify regional endpoints for machine learning experimentation services", + "type": "string" + }, + "enableDataIsolation": { + "type": "boolean" + }, + "enableServiceSideCMKEncryption": { + "type": "boolean" + }, + "enableSimplifiedCmk": { + "description": "Flag to tell if simplified CMK should be enabled for this workspace.", + "type": "boolean" + }, + "enableSoftwareBillOfMaterials": { + "description": "Flag to tell if SoftwareBillOfMaterials should be enabled for this workspace.", + "type": "boolean" + }, + "encryption": { + "$ref": "#/definitions/EncryptionProperty" + }, + "existingWorkspaces": { + "type": "array", + "items": { + "type": "string" + } + }, + "featureStoreSettings": { + "description": "Settings for feature store type workspace.", + "$ref": "#/definitions/FeatureStoreSettings" + }, + "friendlyName": { + "description": "The friendly name for this workspace. This name in mutable", + "type": "string" + }, + "hbiWorkspace": { + "description": "The flag to signal HBI data in the workspace and reduce diagnostic data collected by the service", + "type": "boolean" + }, + "hubResourceId": { + "type": "string" + }, + "imageBuildCompute": { + "description": "The compute name for image build", + "type": "string" + }, + "ipAllowlist": { + "description": "The list of IPv4 addresses that are allowed to access the workspace.", + "type": "array", + "items": { + "type": "string" + } + }, + "keyVault": { + "description": "ARM id of the key vault associated with this workspace. This cannot be changed once the workspace has been created", + "type": "string" + }, + "keyVaults": { + "type": "array", + "items": { + "type": "string" + } + }, + "managedNetwork": { + "$ref": "#/definitions/ManagedNetworkSettings" + }, + "mlFlowTrackingUri": { + "description": "The URI associated with this workspace that machine learning flow must point at to set up tracking.", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "notebookInfo": { + "description": "The notebook info of Azure ML workspace.", + "$ref": "#/definitions/NotebookResourceInfo", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "primaryUserAssignedIdentity": { + "description": "The user assigned identity resource id that represents the workspace identity.", + "type": "string" + }, + "privateEndpointConnections": { + "description": "The list of private endpoint connections in the workspace.", + "type": "array", + "items": { + "$ref": "#/definitions/PrivateEndpointConnection" + }, + "readOnly": true, + "x-ms-mutability": [ + "read" + ], + "x-ms-identifiers": [ + "name" + ] + }, + "privateLinkCount": { + "format": "int32", + "description": "Count of private connections in the workspace", + "type": "integer", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "provisioningState": { + "description": "The current deployment state of workspace resource. The provisioningState is to indicate states for resource provisioning.", + "$ref": "#/definitions/ProvisioningState", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "publicNetworkAccess": { + "description": "Whether requests from Public Network are allowed.", + "$ref": "#/definitions/PublicNetworkAccessType" + }, + "serverlessComputeSettings": { + "description": "Settings for serverless compute in a workspace", + "$ref": "#/definitions/ServerlessComputeSettings" + }, + "serviceManagedResourcesSettings": { + "description": "The service managed resource settings.", + "$ref": "#/definitions/ServiceManagedResourcesSettings" + }, + "serviceProvisionedResourceGroup": { + "description": "The name of the managed resource group created by workspace RP in customer subscription if the workspace is CMK workspace", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "sharedPrivateLinkResources": { + "description": "The list of shared private link resources in this workspace.", + "type": "array", + "items": { + "$ref": "#/definitions/SharedPrivateLinkResource" + }, + "x-ms-identifiers": [ + "name" + ] + }, + "softDeleteRetentionInDays": { + "format": "int32", + "description": "Retention time in days after workspace get soft deleted.", + "type": "integer" + }, + "storageAccount": { + "description": "ARM id of the storage account associated with this workspace. This cannot be changed once the workspace has been created", + "type": "string" + }, + "storageAccounts": { + "type": "array", + "items": { + "type": "string" + } + }, + "storageHnsEnabled": { + "description": "If the storage associated with the workspace has hierarchical namespace(HNS) enabled.", + "type": "boolean", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "systemDatastoresAuthMode": { + "description": "The auth mode used for accessing the system datastores of the workspace.", + "type": "string" + }, + "tenantId": { + "description": "The tenant id associated with this workspace.", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + }, + "v1LegacyMode": { + "description": "Enabling v1_legacy_mode may prevent you from using features provided by the v2 API.", + "type": "boolean" + }, + "workspaceHubConfig": { + "description": "WorkspaceHub's configuration object.", + "$ref": "#/definitions/WorkspaceHubConfig" + }, + "workspaceId": { + "description": "The immutable id associated with this workspace.", + "type": "string", + "readOnly": true, + "x-ms-mutability": [ + "read" + ] + } + } + }, + "WorkspacePropertiesUpdateParameters": { + "description": "The parameters for updating a machine learning workspace.", + "type": "object", + "properties": { + "allowRoleAssignmentOnRG": { + "type": "boolean" + }, + "applicationInsights": { + "description": "ARM id of the application insights associated with this workspace.", + "type": "string" + }, + "containerRegistry": { + "description": "ARM id of the container registry associated with this workspace.", + "type": "string" + }, + "description": { + "description": "The description of this workspace.", + "type": "string" + }, + "enableDataIsolation": { + "type": "boolean" + }, + "enableSoftwareBillOfMaterials": { + "description": "Flag to tell if SoftwareBillOfMaterials should be enabled for this workspace", + "type": "boolean" + }, + "encryption": { + "$ref": "#/definitions/EncryptionUpdateProperties" + }, + "featureStoreSettings": { + "description": "Settings for feature store type workspace.", + "$ref": "#/definitions/FeatureStoreSettings" + }, + "friendlyName": { + "description": "The friendly name for this workspace. This name in mutable", + "type": "string" + }, + "imageBuildCompute": { + "description": "The compute name for image build", + "type": "string" + }, + "ipAllowlist": { + "description": "The list of IPv4 addresses that are allowed to access the workspace.", + "type": "array", + "items": { + "type": "string" + } + }, + "managedNetwork": { + "$ref": "#/definitions/ManagedNetworkSettings" + }, + "primaryUserAssignedIdentity": { + "description": "The user assigned identity resource id that represents the workspace identity.", + "type": "string" + }, + "publicNetworkAccess": { + "description": "Whether requests from Public Network are allowed.", + "$ref": "#/definitions/PublicNetworkAccessType" + }, + "serverlessComputeSettings": { + "description": "Settings for serverless compute in a workspace", + "$ref": "#/definitions/ServerlessComputeSettings" + }, + "serviceManagedResourcesSettings": { + "description": "The service managed resource settings.", + "$ref": "#/definitions/ServiceManagedResourcesSettings" + }, + "softDeleteRetentionInDays": { + "format": "int32", + "description": "Retention time in days after workspace get soft deleted.", + "type": "integer" + }, + "v1LegacyMode": { + "description": "Enabling v1_legacy_mode may prevent you from using features provided by the v2 API.", + "type": "boolean" + } + } + }, + "WorkspaceUpdateParameters": { + "description": "The parameters for updating a machine learning workspace.", + "type": "object", + "properties": { + "identity": { + "$ref": "../../../../../common-types/resource-management/v3/managedidentity.json#/definitions/ManagedServiceIdentity" + }, + "properties": { + "description": "The properties that the machine learning workspace will be updated with.", + "$ref": "#/definitions/WorkspacePropertiesUpdateParameters", + "x-ms-client-flatten": true + }, + "sku": { + "description": "Optional. This field is required to be implemented by the RP because AML is supporting more than one tier", + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Sku" + }, + "tags": { + "description": "The resource tags for the machine learning workspace.", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "parameters": { + "WorkspaceKindParameter": { + "in": "query", + "name": "kind", + "description": "Kind of workspace.", + "type": "string", + "x-ms-parameter-location": "method" + }, + "PaginationParameter": { + "in": "query", + "name": "$skip", + "description": "Continuation token for pagination.", + "type": "string", + "x-ms-parameter-location": "method" + }, + "WorkspaceNameParameter": { + "in": "path", + "name": "workspaceName", + "description": "Azure Machine Learning Workspace Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + }, + "WorkspaceForceToPurgeParameter": { + "in": "query", + "name": "forceToPurge", + "description": "Flag to indicate delete is a purge request.", + "type": "boolean", + "default": false, + "x-ms-parameter-location": "method" + }, + "TargetParameter": { + "in": "query", + "name": "target", + "description": "Target of the workspace connection.", + "type": "string", + "x-ms-parameter-location": "method" + }, + "CategoryParameter": { + "in": "query", + "name": "category", + "description": "Category of the workspace connection.", + "type": "string", + "x-ms-parameter-location": "method" + }, + "ConnectionName": { + "in": "path", + "name": "connectionName", + "description": "Friendly name of the workspace connection", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + }, + "DeploymentNameParameter": { + "in": "path", + "name": "deploymentName", + "description": "Name of the deployment resource", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + }, + "RaiBlocklistParameter": { + "in": "path", + "name": "raiBlocklistName", + "description": "The name of the RaiBlocklist.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + }, + "RaiBlocklistItemParameter": { + "in": "path", + "name": "raiBlocklistItemName", + "description": "Name of the RaiBlocklist Item", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + }, + "RaiPolicyNameParameter": { + "in": "path", + "name": "raiPolicyName", + "description": "Name of the Rai Policy.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + }, + "EndpointTypeParameter": { + "in": "query", + "name": "endpointType", + "description": "Endpoint type filter", + "type": "string", + "enum": [ + "Azure.OpenAI", + "Azure.Speech", + "Azure.ContentSafety", + "Azure.Llama", + "managedOnlineEndpoint" + ], + "x-ms-enum": { + "name": "endpointType", + "modelAsString": true + }, + "x-ms-parameter-location": "method" + }, + "EndpointNameParameter": { + "in": "path", + "name": "endpointName", + "description": "Name of the endpoint resource.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + }, + "RuleName": { + "in": "path", + "name": "ruleName", + "description": "Name of the workspace managed network outbound rule", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + }, + "PrivateEndpointConnectionName": { + "in": "path", + "name": "privateEndpointConnectionName", + "description": "NRP Private Endpoint Connection Name", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} diff --git a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/readme.md b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/readme.md index f1d4ea9a03ef4..b47aea1aa1249 100644 --- a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/readme.md +++ b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/readme.md @@ -274,6 +274,7 @@ input-file: - Microsoft.MachineLearningServices/preview/2024-07-01-preview/registries.json - Microsoft.MachineLearningServices/preview/2024-07-01-preview/workspaceFeatures.json - Microsoft.MachineLearningServices/preview/2024-07-01-preview/mfe.json + - Microsoft.MachineLearningServices/preview/2024-07-01-preview/workspaceRP.json output-folder: $(python-sdks-folder)/v2024_07_01_preview ``` diff --git a/sdk/ml/azure-ai-ml/tests/feature_set/e2etests/test_feature_set.py b/sdk/ml/azure-ai-ml/tests/feature_set/e2etests/test_feature_set.py index 3b93043ee8917..4f843920fdc96 100644 --- a/sdk/ml/azure-ai-ml/tests/feature_set/e2etests/test_feature_set.py +++ b/sdk/ml/azure-ai-ml/tests/feature_set/e2etests/test_feature_set.py @@ -61,6 +61,7 @@ def feature_set_validation(fset: FeatureSet): # ---------------------------------------------------------------------------------------------------------------# # NOTE Please enable materialization store on test featurestore 'sdk_vnext_cli_fs' to run this test in live mode. # ---------------------------------------------------------------------------------------------------------------# + @pytest.mark.skip(reason="request header size being too large.") def test_list_materialization_jobs( self, feature_store_client: MLClient, tmp_path: Path, randstr: Callable[[], str] ) -> None: diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/pyproject.toml b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/modelsrepository/azure-iot-modelsrepository/pyproject.toml b/sdk/modelsrepository/azure-iot-modelsrepository/pyproject.toml index cf845e14852bf..df558bb3b1e74 100644 --- a/sdk/modelsrepository/azure-iot-modelsrepository/pyproject.toml +++ b/sdk/modelsrepository/azure-iot-modelsrepository/pyproject.toml @@ -1,5 +1,4 @@ [tool.azure-sdk-build] pyright = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/mongocluster/azure-mgmt-mongocluster/pyproject.toml b/sdk/mongocluster/azure-mgmt-mongocluster/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/mongocluster/azure-mgmt-mongocluster/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/monitor/azure-mgmt-monitor/pyproject.toml b/sdk/monitor/azure-mgmt-monitor/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md index ff53d60451d5f..d68f3e5998de8 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md @@ -10,6 +10,11 @@ ### Other Changes +- Update instrumentation constants info + ([#36696](https://github.com/Azure/azure-sdk-for-python/pull/36696)) +- Refactor statsbeat utils functions + ([#36824](https://github.com/Azure/azure-sdk-for-python/pull/36824)) + ## 1.0.0b28 (2024-07-29) ### Other Changes diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py index 5b2a34b0a09fe..dab4c1bab45ae 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py @@ -153,8 +153,15 @@ "urllib", "urllib3", _AZURE_SDK_OPENTELEMETRY_NAME, + # Instrumentations below this line have not been added to statsbeat report yet "cassandra", "tortoiseorm", + "aiohttp-server", + "asyncio", + "mysqlclient", + "psycopg", + "threading", + "wsgi", ] _INSTRUMENTATIONS_BIT_MAP = {_INSTRUMENTATIONS_LIST[i]: _BASE**i for i in range(len(_INSTRUMENTATIONS_LIST))} @@ -174,6 +181,7 @@ # Temporary solution for checking which instrumentations support metric collection _INSTRUMENTATION_SUPPORTING_METRICS_LIST = ( + "opentelemetry.instrumentation.asgi", "opentelemetry.instrumentation.django", "opentelemetry.instrumentation.falcon", "opentelemetry.instrumentation.fastapi", diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py index e6718737f3508..7571e27fdb651 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py @@ -11,6 +11,7 @@ import warnings from typing import Callable, Dict, Any +from opentelemetry.semconv.attributes.service_attributes import SERVICE_NAME from opentelemetry.semconv.resource import ResourceAttributes from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.util import ns_to_iso_str @@ -212,7 +213,7 @@ def _create_telemetry_item(timestamp: int) -> TelemetryItem: def _populate_part_a_fields(resource: Resource): tags = {} if resource and resource.attributes: - service_name = resource.attributes.get(ResourceAttributes.SERVICE_NAME) + service_name = resource.attributes.get(SERVICE_NAME) service_namespace = resource.attributes.get(ResourceAttributes.SERVICE_NAMESPACE) service_instance_id = resource.attributes.get(ResourceAttributes.SERVICE_INSTANCE_ID) device_id = resource.attributes.get(ResourceAttributes.DEVICE_ID) diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/_base.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/_base.py index 8dd498b30130a..7351fac87ee9c 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/_base.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/_base.py @@ -45,14 +45,13 @@ from azure.monitor.opentelemetry.exporter._connection_string_parser import ConnectionStringParser from azure.monitor.opentelemetry.exporter._storage import LocalFileStorage from azure.monitor.opentelemetry.exporter.statsbeat._state import ( - _REQUESTS_MAP_LOCK, - _REQUESTS_MAP, get_statsbeat_initial_success, get_statsbeat_shutdown, increment_and_check_statsbeat_failure_count, is_statsbeat_enabled, set_statsbeat_initial_success, ) +from azure.monitor.opentelemetry.exporter.statsbeat._utils import _update_requests_map logger = logging.getLogger(__name__) @@ -197,7 +196,7 @@ def _transmit(self, envelopes: List[TelemetryItem]) -> ExportResult: logger.info("Transmission succeeded: Item received: %s. Items accepted: %s", track_response.items_received, track_response.items_accepted) if self._should_collect_stats(): - _update_requests_map(_REQ_SUCCESS_NAME[1]) + _update_requests_map(_REQ_SUCCESS_NAME[1], 1) reach_ingestion = True result = ExportResult.SUCCESS else: # 206 @@ -308,7 +307,7 @@ def _transmit(self, envelopes: List[TelemetryItem]) -> ExportResult: finally: if self._should_collect_stats(): end_time = time.time() - _update_requests_map('count') + _update_requests_map('count', 1) _update_requests_map(_REQ_DURATION_NAME[1], value=end_time-start_time) if self._is_statsbeat_initializing_state(): # Update statsbeat initial success state if reached ingestion @@ -410,22 +409,6 @@ def _reached_ingestion_code(response_code: Optional[int]) -> bool: return response_code in _REACHED_INGESTION_STATUS_CODES -def _update_requests_map(type_name, value=None): - # value is either None, duration, status_code or exc_name - with _REQUESTS_MAP_LOCK: - if type_name in (_REQ_SUCCESS_NAME[1], "count"): # success, count - _REQUESTS_MAP[type_name] = _REQUESTS_MAP.get(type_name, 0) + 1 - elif type_name == _REQ_DURATION_NAME[1]: # duration - _REQUESTS_MAP[type_name] = _REQUESTS_MAP.get(type_name, 0) + value - else: # exception, failure, retry, throttle - prev = 0 - if _REQUESTS_MAP.get(type_name): - prev = _REQUESTS_MAP.get(type_name).get(value, 0) - else: - _REQUESTS_MAP[type_name] = {} - _REQUESTS_MAP[type_name][value] = prev + 1 - - _MONITOR_DOMAIN_MAPPING = { "EventData": TelemetryEventData, "ExceptionData": TelemetryExceptionData, diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/logs/_exporter.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/logs/_exporter.py index 262d8a69f7ddf..0632a7265e82e 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/logs/_exporter.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/logs/_exporter.py @@ -4,7 +4,12 @@ from typing import Optional, Sequence, Any from opentelemetry._logs.severity import SeverityNumber -from opentelemetry.semconv.trace import SpanAttributes +from opentelemetry.semconv.attributes.exception_attributes import ( + EXCEPTION_ESCAPED, + EXCEPTION_MESSAGE, + EXCEPTION_STACKTRACE, + EXCEPTION_TYPE, +) from opentelemetry.sdk._logs import LogData from opentelemetry.sdk._logs.export import LogExporter, LogExportResult @@ -126,10 +131,10 @@ def _convert_log_to_envelope(log_data: LogData) -> TelemetryItem: ) exc_type = exc_message = stack_trace = None if log_record.attributes: - exc_type = log_record.attributes.get(SpanAttributes.EXCEPTION_TYPE) - exc_message = log_record.attributes.get(SpanAttributes.EXCEPTION_MESSAGE) + exc_type = log_record.attributes.get(EXCEPTION_TYPE) + exc_message = log_record.attributes.get(EXCEPTION_MESSAGE) # pylint: disable=line-too-long - stack_trace = log_record.attributes.get(SpanAttributes.EXCEPTION_STACKTRACE) + stack_trace = log_record.attributes.get(EXCEPTION_STACKTRACE) severity_level = _get_severity_level(log_record.severity_number) # Event telemetry @@ -206,10 +211,10 @@ def _is_ignored_attribute(key: str) -> bool: _IGNORED_ATTRS = frozenset( ( - SpanAttributes.EXCEPTION_TYPE, - SpanAttributes.EXCEPTION_MESSAGE, - SpanAttributes.EXCEPTION_STACKTRACE, - SpanAttributes.EXCEPTION_ESCAPED, + EXCEPTION_TYPE, + EXCEPTION_MESSAGE, + EXCEPTION_STACKTRACE, + EXCEPTION_ESCAPED, _APPLICATION_INSIGHTS_EVENT_MARKER_ATTRIBUTE, ) ) diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/statsbeat/_statsbeat.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/statsbeat/_statsbeat.py index 59484a27b62d1..de75661d6ee57 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/statsbeat/_statsbeat.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/statsbeat/_statsbeat.py @@ -1,28 +1,22 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -import os import threading from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader from opentelemetry.sdk.resources import Resource -from azure.monitor.opentelemetry.exporter._constants import ( - _APPLICATIONINSIGHTS_STATS_CONNECTION_STRING_ENV_NAME, - _APPLICATIONINSIGHTS_STATS_LONG_EXPORT_INTERVAL_ENV_NAME, - _APPLICATIONINSIGHTS_STATS_SHORT_EXPORT_INTERVAL_ENV_NAME, - _DEFAULT_NON_EU_STATS_CONNECTION_STRING, - _DEFAULT_EU_STATS_CONNECTION_STRING, - _DEFAULT_STATS_SHORT_EXPORT_INTERVAL, - _DEFAULT_STATS_LONG_EXPORT_INTERVAL, - _EU_ENDPOINTS, -) from azure.monitor.opentelemetry.exporter.statsbeat._exporter import _StatsBeatExporter from azure.monitor.opentelemetry.exporter.statsbeat._statsbeat_metrics import _StatsbeatMetrics from azure.monitor.opentelemetry.exporter.statsbeat._state import ( _STATSBEAT_STATE, _STATSBEAT_STATE_LOCK, ) +from azure.monitor.opentelemetry.exporter.statsbeat._utils import ( + _get_stats_connection_string, + _get_stats_long_export_interval, + _get_stats_short_export_interval, +) _STATSBEAT_METRICS = None @@ -80,36 +74,3 @@ def shutdown_statsbeat_metrics() -> None: if shutdown_success: with _STATSBEAT_STATE_LOCK: _STATSBEAT_STATE["SHUTDOWN"] = True - - -def _get_stats_connection_string(endpoint: str) -> str: - cs_env = os.environ.get(_APPLICATIONINSIGHTS_STATS_CONNECTION_STRING_ENV_NAME) - if cs_env: - return cs_env - for endpoint_location in _EU_ENDPOINTS: - if endpoint_location in endpoint: - # Use statsbeat EU endpoint if user is in EU region - return _DEFAULT_EU_STATS_CONNECTION_STRING - return _DEFAULT_NON_EU_STATS_CONNECTION_STRING - - -# seconds -def _get_stats_short_export_interval() -> int: - ei_env = os.environ.get(_APPLICATIONINSIGHTS_STATS_SHORT_EXPORT_INTERVAL_ENV_NAME) - if ei_env: - try: - return int(ei_env) - except ValueError: - return _DEFAULT_STATS_SHORT_EXPORT_INTERVAL - return _DEFAULT_STATS_SHORT_EXPORT_INTERVAL - - -# seconds -def _get_stats_long_export_interval() -> int: - ei_env = os.environ.get(_APPLICATIONINSIGHTS_STATS_LONG_EXPORT_INTERVAL_ENV_NAME) - if ei_env: - try: - return int(ei_env) - except ValueError: - return _DEFAULT_STATS_LONG_EXPORT_INTERVAL - return _DEFAULT_STATS_LONG_EXPORT_INTERVAL diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/statsbeat/_utils.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/statsbeat/_utils.py new file mode 100644 index 0000000000000..d1607c125aa6b --- /dev/null +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/statsbeat/_utils.py @@ -0,0 +1,69 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +import os + +from azure.monitor.opentelemetry.exporter._constants import ( + _APPLICATIONINSIGHTS_STATS_CONNECTION_STRING_ENV_NAME, + _APPLICATIONINSIGHTS_STATS_LONG_EXPORT_INTERVAL_ENV_NAME, + _APPLICATIONINSIGHTS_STATS_SHORT_EXPORT_INTERVAL_ENV_NAME, + _DEFAULT_NON_EU_STATS_CONNECTION_STRING, + _DEFAULT_EU_STATS_CONNECTION_STRING, + _DEFAULT_STATS_SHORT_EXPORT_INTERVAL, + _DEFAULT_STATS_LONG_EXPORT_INTERVAL, + _EU_ENDPOINTS, + _REQ_DURATION_NAME, + _REQ_SUCCESS_NAME, +) +from azure.monitor.opentelemetry.exporter.statsbeat._state import ( + _REQUESTS_MAP_LOCK, + _REQUESTS_MAP, +) + + +def _get_stats_connection_string(endpoint: str) -> str: + cs_env = os.environ.get(_APPLICATIONINSIGHTS_STATS_CONNECTION_STRING_ENV_NAME) + if cs_env: + return cs_env + for endpoint_location in _EU_ENDPOINTS: + if endpoint_location in endpoint: + # Use statsbeat EU endpoint if user is in EU region + return _DEFAULT_EU_STATS_CONNECTION_STRING + return _DEFAULT_NON_EU_STATS_CONNECTION_STRING + + +# seconds +def _get_stats_short_export_interval() -> int: + ei_env = os.environ.get(_APPLICATIONINSIGHTS_STATS_SHORT_EXPORT_INTERVAL_ENV_NAME) + if ei_env: + try: + return int(ei_env) + except ValueError: + return _DEFAULT_STATS_SHORT_EXPORT_INTERVAL + return _DEFAULT_STATS_SHORT_EXPORT_INTERVAL + + +# seconds +def _get_stats_long_export_interval() -> int: + ei_env = os.environ.get(_APPLICATIONINSIGHTS_STATS_LONG_EXPORT_INTERVAL_ENV_NAME) + if ei_env: + try: + return int(ei_env) + except ValueError: + return _DEFAULT_STATS_LONG_EXPORT_INTERVAL + return _DEFAULT_STATS_LONG_EXPORT_INTERVAL + + +def _update_requests_map(type_name, value): + # value can be either a count, duration, status_code or exc_name + with _REQUESTS_MAP_LOCK: + # Mapping is {type_name: count/duration} + if type_name in (_REQ_SUCCESS_NAME[1], "count", _REQ_DURATION_NAME[1]): # success, count, duration + _REQUESTS_MAP[type_name] = _REQUESTS_MAP.get(type_name, 0) + value + else: # exception, failure, retry, throttle + prev = 0 + # Mapping is {type_name: {value: count} + if _REQUESTS_MAP.get(type_name): + prev = _REQUESTS_MAP.get(type_name).get(value, 0) + else: + _REQUESTS_MAP[type_name] = {} + _REQUESTS_MAP[type_name][value] = prev + 1 diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/pyproject.toml b/sdk/monitor/azure-monitor-opentelemetry-exporter/pyproject.toml index 135102e66fb31..343877d67195d 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/pyproject.toml +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/pyproject.toml @@ -2,4 +2,3 @@ mypy = true pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/logs/test_logs.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/logs/test_logs.py index e3a5ac1688348..1f6b527281c30 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/logs/test_logs.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/logs/test_logs.py @@ -8,7 +8,11 @@ from functools import partial # pylint: disable=import-error -from opentelemetry.semconv.trace import SpanAttributes +from opentelemetry.semconv.attributes.exception_attributes import ( + EXCEPTION_MESSAGE, + EXCEPTION_STACKTRACE, + EXCEPTION_TYPE, +) from opentelemetry.sdk import _logs from opentelemetry.sdk.util.instrumentation import InstrumentationScope from opentelemetry.sdk.resources import Resource @@ -136,9 +140,9 @@ def setUpClass(cls): ), attributes={ "test": "attribute", - SpanAttributes.EXCEPTION_TYPE: "ZeroDivisionError", - SpanAttributes.EXCEPTION_MESSAGE: "division by zero", - SpanAttributes.EXCEPTION_STACKTRACE: 'Traceback (most recent call last):\n File "test.py", line 38, in \n raise ZeroDivisionError()\nZeroDivisionError\n' + EXCEPTION_TYPE: "ZeroDivisionError", + EXCEPTION_MESSAGE: "division by zero", + EXCEPTION_STACKTRACE: 'Traceback (most recent call last):\n File "test.py", line 38, in \n raise ZeroDivisionError()\nZeroDivisionError\n' }, ), InstrumentationScope("test_name"), @@ -157,9 +161,9 @@ def setUpClass(cls): ), attributes={ "test": "attribute", - SpanAttributes.EXCEPTION_TYPE: "ZeroDivisionError", - SpanAttributes.EXCEPTION_MESSAGE: "division by zero", - SpanAttributes.EXCEPTION_STACKTRACE: 'Traceback (most recent call last):\n File "test.py", line 38, in \n raise ZeroDivisionError()\nZeroDivisionError\n' + EXCEPTION_TYPE: "ZeroDivisionError", + EXCEPTION_MESSAGE: "division by zero", + EXCEPTION_STACKTRACE: 'Traceback (most recent call last):\n File "test.py", line 38, in \n raise ZeroDivisionError()\nZeroDivisionError\n' }, ), InstrumentationScope("test_name"), @@ -178,9 +182,9 @@ def setUpClass(cls): ), attributes={ "test": "attribute", - SpanAttributes.EXCEPTION_TYPE: "", - SpanAttributes.EXCEPTION_MESSAGE: "", - SpanAttributes.EXCEPTION_STACKTRACE: "" + EXCEPTION_TYPE: "", + EXCEPTION_MESSAGE: "", + EXCEPTION_STACKTRACE: "" }, ), InstrumentationScope("test_name"), @@ -199,9 +203,9 @@ def setUpClass(cls): ), attributes={ "test": "attribute", - SpanAttributes.EXCEPTION_TYPE: "", - SpanAttributes.EXCEPTION_MESSAGE: "", - SpanAttributes.EXCEPTION_STACKTRACE: "" + EXCEPTION_TYPE: "", + EXCEPTION_MESSAGE: "", + EXCEPTION_STACKTRACE: "" }, ), InstrumentationScope("test_name"), diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/metrics/test_metrics.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/metrics/test_metrics.py index b0aa811c91969..c372670699cc3 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/metrics/test_metrics.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/metrics/test_metrics.py @@ -11,8 +11,6 @@ from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.metrics.export import ( AggregationTemporality, - Gauge, - Histogram, HistogramDataPoint, Metric, MetricExportResult, diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/statsbeat/test_statsbeat.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/statsbeat/test_statsbeat.py index 95c1bbfd1f525..b3397c6abea01 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/statsbeat/test_statsbeat.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/statsbeat/test_statsbeat.py @@ -14,6 +14,8 @@ from azure.monitor.opentelemetry.exporter._constants import ( _ATTACH_METRIC_NAME, + _DEFAULT_EU_STATS_CONNECTION_STRING, + _DEFAULT_NON_EU_STATS_CONNECTION_STRING, _FEATURE_METRIC_NAME, _REQ_DURATION_NAME, _REQ_EXCEPTION_NAME, @@ -122,11 +124,11 @@ def test_collect_statsbeat_metrics_non_eu( stats_exporter = mr._exporter self.assertEqual( stats_exporter._instrumentation_key, - _statsbeat._DEFAULT_NON_EU_STATS_CONNECTION_STRING.split(";")[0].split("=")[1] + _DEFAULT_NON_EU_STATS_CONNECTION_STRING.split(";")[0].split("=")[1] ) self.assertEqual( stats_exporter._endpoint, - _statsbeat._DEFAULT_NON_EU_STATS_CONNECTION_STRING.split(";")[1].split("=")[1] # noqa: E501 + _DEFAULT_NON_EU_STATS_CONNECTION_STRING.split(";")[1].split("=")[1] # noqa: E501 ) @mock.patch.object(MeterProvider, 'shutdown') @@ -153,11 +155,11 @@ def test_collect_statsbeat_metrics_eu( stats_exporter = mr._exporter self.assertEqual( stats_exporter._instrumentation_key, - _statsbeat._DEFAULT_EU_STATS_CONNECTION_STRING.split(";")[0].split("=")[1] + _DEFAULT_EU_STATS_CONNECTION_STRING.split(";")[0].split("=")[1] ) self.assertEqual( stats_exporter._endpoint, - _statsbeat._DEFAULT_EU_STATS_CONNECTION_STRING.split(";")[1].split("=")[1] # noqa: E501 + _DEFAULT_EU_STATS_CONNECTION_STRING.split(";")[1].split("=")[1] # noqa: E501 ) diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_base_exporter.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_base_exporter.py index 1e3613aec76c5..e282e44c7cb34 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_base_exporter.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_base_exporter.py @@ -16,10 +16,7 @@ BaseExporter, ExportResult, ) -from azure.monitor.opentelemetry.exporter.statsbeat._state import ( - _REQUESTS_MAP, - _STATSBEAT_STATE, -) +from azure.monitor.opentelemetry.exporter.statsbeat._state import _REQUESTS_MAP from azure.monitor.opentelemetry.exporter._constants import ( _REQ_DURATION_NAME, _REQ_EXCEPTION_NAME, diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/trace/test_trace.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/trace/test_trace.py index 09ba5d6d01a7e..028cf8fe1383a 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/trace/test_trace.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/trace/test_trace.py @@ -13,7 +13,12 @@ from opentelemetry.sdk import trace, resources from opentelemetry.sdk.trace.export import SpanExportResult from opentelemetry.sdk.util.instrumentation import InstrumentationScope -from opentelemetry.semconv.trace import SpanAttributes +from opentelemetry.semconv.attributes.exception_attributes import ( + EXCEPTION_ESCAPED, + EXCEPTION_MESSAGE, + EXCEPTION_STACKTRACE, + EXCEPTION_TYPE, +) from opentelemetry.trace import Link, SpanContext, SpanKind from opentelemetry.trace.status import Status, StatusCode @@ -1180,10 +1185,10 @@ def test_span_events_to_envelopes_exception(self): kind=SpanKind.CLIENT, ) attributes = { - SpanAttributes.EXCEPTION_TYPE: "ZeroDivisionError", - SpanAttributes.EXCEPTION_MESSAGE: "zero division error", - SpanAttributes.EXCEPTION_STACKTRACE: "Traceback: ZeroDivisionError, division by zero", - SpanAttributes.EXCEPTION_ESCAPED: "True", + EXCEPTION_TYPE: "ZeroDivisionError", + EXCEPTION_MESSAGE: "zero division error", + EXCEPTION_STACKTRACE: "Traceback: ZeroDivisionError, division by zero", + EXCEPTION_ESCAPED: "True", } span.add_event("exception", attributes, time) span.start() diff --git a/sdk/monitor/azure-monitor-opentelemetry/pyproject.toml b/sdk/monitor/azure-monitor-opentelemetry/pyproject.toml index d186893e77fd5..2ef7b27ea9a61 100644 --- a/sdk/monitor/azure-monitor-opentelemetry/pyproject.toml +++ b/sdk/monitor/azure-monitor-opentelemetry/pyproject.toml @@ -1,6 +1,5 @@ [tool.azure-sdk-build] type_check_samples = false -verifytypes = false pyright = false pylint = true bandit = true diff --git a/sdk/monitor/azure-monitor-query/assets.json b/sdk/monitor/azure-monitor-query/assets.json index 0dc4dd023e8ec..2488895523bd1 100644 --- a/sdk/monitor/azure-monitor-query/assets.json +++ b/sdk/monitor/azure-monitor-query/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/monitor/azure-monitor-query", - "Tag": "python/monitor/azure-monitor-query_8640f7c705" + "Tag": "python/monitor/azure-monitor-query_79499b2a8c" } diff --git a/sdk/monitor/azure-monitor-query/tests/test_logs_client.py b/sdk/monitor/azure-monitor-query/tests/test_logs_client.py index 5b7c3d35b286c..f181890235172 100644 --- a/sdk/monitor/azure-monitor-query/tests/test_logs_client.py +++ b/sdk/monitor/azure-monitor-query/tests/test_logs_client.py @@ -73,14 +73,21 @@ def test_logs_single_query_with_partial_success(self, recorded_test, monitor_inf def test_logs_server_timeout(self, recorded_test, monitor_info): client = self.get_client(LogsQueryClient, self.get_credential(LogsQueryClient)) - with pytest.raises(HttpResponseError) as e: + try: response = client.query_workspace( - monitor_info['workspace_id'], + monitor_info["workspace_id"], "range x from 1 to 1000000000000000 step 1 | count", timespan=None, - server_timeout=1, + server_timeout=2, + retry_total=0, ) - assert 'Gateway timeout' in e.value.message + except HttpResponseError as e: + assert "Gateway timeout" in e.message + else: + # Response an be observed as either 504 response code from the gateway or a partial failure 200 response. + assert response.status == LogsQueryStatus.PARTIAL + assert "timed out" in str(response.partial_error) + @pytest.mark.live_test_only("Issues recording dynamic 'id' values in requests/responses") def test_logs_query_batch_default(self, monitor_info): diff --git a/sdk/monitor/azure-monitor-query/tests/test_logs_client_async.py b/sdk/monitor/azure-monitor-query/tests/test_logs_client_async.py index 5db2b695d01d4..c021da083d749 100644 --- a/sdk/monitor/azure-monitor-query/tests/test_logs_client_async.py +++ b/sdk/monitor/azure-monitor-query/tests/test_logs_client_async.py @@ -47,19 +47,23 @@ async def test_logs_auth_no_timespan(self, monitor_info): @pytest.mark.asyncio async def test_logs_server_timeout(self, recorded_test, monitor_info): - client = self.get_client( - LogsQueryClient, self.get_credential(LogsQueryClient, is_async=True)) + client = self.get_client(LogsQueryClient, self.get_credential(LogsQueryClient, is_async=True)) - with pytest.raises(HttpResponseError) as e: + try: async with client: - await client.query_workspace( - monitor_info['workspace_id'], + response = await client.query_workspace( + monitor_info["workspace_id"], "range x from 1 to 1000000000000000 step 1 | count", timespan=None, - server_timeout=1, + server_timeout=2, + retry_total=0, ) - - assert 'Gateway timeout' in e.value.message + except HttpResponseError as e: + assert "Gateway timeout" in e.message + else: + # Response an be observed as either 504 response code from the gateway or a partial failure 200 response. + assert response.status == LogsQueryStatus.PARTIAL + assert "timed out" in str(response.partial_error) @pytest.mark.asyncio async def test_logs_query_batch_raises_on_no_timespan(self, monitor_info): diff --git a/sdk/netapp/azure-mgmt-netapp/CHANGELOG.md b/sdk/netapp/azure-mgmt-netapp/CHANGELOG.md index 15a6d1ff92913..1498083a10c2e 100644 --- a/sdk/netapp/azure-mgmt-netapp/CHANGELOG.md +++ b/sdk/netapp/azure-mgmt-netapp/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 13.2.0 (2024-08-19) + +### Features Added + + - Model Replication has a new parameter replication_id + ## 13.1.0 (2024-07-22) ### Features Added diff --git a/sdk/netapp/azure-mgmt-netapp/_meta.json b/sdk/netapp/azure-mgmt-netapp/_meta.json index e87a56015edeb..cd92c50cb4b13 100644 --- a/sdk/netapp/azure-mgmt-netapp/_meta.json +++ b/sdk/netapp/azure-mgmt-netapp/_meta.json @@ -1,11 +1,11 @@ { - "commit": "81a4ee5a83ae38620c0e1404793caffe005d26e4", + "commit": "8516fa819794ea879bc13bc4137300b67b58de1f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.19", + "@autorest/python@6.17.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/netapp/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 --tag=package-netapp-2023-11-01 --use=@autorest/python@6.13.19 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/netapp/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.17.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/netapp/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/assets.json b/sdk/netapp/azure-mgmt-netapp/assets.json index 0702fc5840c92..5580f10b80066 100644 --- a/sdk/netapp/azure-mgmt-netapp/assets.json +++ b/sdk/netapp/azure-mgmt-netapp/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/netapp/azure-mgmt-netapp", - "Tag": "python/netapp/azure-mgmt-netapp_4a6a10fa5e" + "Tag": "python/netapp/azure-mgmt-netapp_f62048101a" } diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py index 8db5ffe9bc4ff..c76e0f0e7fa83 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py @@ -28,13 +28,13 @@ class NetAppManagementClientConfiguration: # pylint: disable=too-many-instance- :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-11-01") + api_version: str = kwargs.pop("api_version", "2024-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_net_app_management_client.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_net_app_management_client.py index 8a1ed18753e51..a4c104a27733b 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_net_app_management_client.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_net_app_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -91,7 +92,7 @@ class NetAppManagementClient: # pylint: disable=client-accepts-api-version-keyw :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -190,7 +191,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "NetAppManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_serialization.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_serialization.py index f0c6180722c89..8139854b97bb8 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_serialization.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_serialization.py @@ -144,6 +144,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_vendor.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_vendor.py deleted file mode 100644 index 0dafe0e287ff1..0000000000000 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py index e4382a0833481..0b30e0e18f035 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "13.1.0" +VERSION = "13.2.0" diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_configuration.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_configuration.py index d8ccabc4571ef..5b0fbaba00c5a 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_configuration.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_configuration.py @@ -28,13 +28,13 @@ class NetAppManagementClientConfiguration: # pylint: disable=too-many-instance- :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-11-01") + api_version: str = kwargs.pop("api_version", "2024-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_net_app_management_client.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_net_app_management_client.py index 3f4826a58e778..8f50d90552a26 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_net_app_management_client.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_net_app_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -91,7 +92,7 @@ class NetAppManagementClient: # pylint: disable=client-accepts-api-version-keyw :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -192,7 +193,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "NetAppManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_accounts_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_accounts_operations.py index 3c4ec67fa2de5..943956bf1a00b 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_accounts_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_accounts_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._accounts_operations import ( build_create_or_update_request, build_delete_request, @@ -102,7 +102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +117,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -185,7 +183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -201,7 +198,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -268,7 +264,6 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -283,7 +278,7 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetAppAccount", pipeline_response) + deserialized = self._deserialize("NetAppAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -292,7 +287,7 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) async def _create_or_update_initial( self, resource_group_name: str, account_name: str, body: Union[_models.NetAppAccount, IO[bytes]], **kwargs: Any - ) -> _models.NetAppAccount: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -306,7 +301,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -327,10 +322,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -338,15 +333,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("NetAppAccount", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("NetAppAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -455,10 +450,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NetAppAccount", pipeline_response) + deserialized = self._deserialize("NetAppAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -483,9 +479,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -498,7 +492,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -508,10 +502,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -519,12 +513,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -550,7 +552,7 @@ async def begin_delete(self, resource_group_name: str, account_name: str, **kwar lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -559,6 +561,7 @@ async def begin_delete(self, resource_group_name: str, account_name: str, **kwar params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -588,7 +591,7 @@ async def _update_initial( account_name: str, body: Union[_models.NetAppAccountPatch, IO[bytes]], **kwargs: Any - ) -> _models.NetAppAccount: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -602,7 +605,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -623,10 +626,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -634,15 +637,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("NetAppAccount", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("NetAppAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -755,10 +758,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NetAppAccount", pipeline_response) + deserialized = self._deserialize("NetAppAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -782,9 +786,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _renew_credentials_initial( # pylint: disable=inconsistent-return-statements + async def _renew_credentials_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -797,7 +801,7 @@ async def _renew_credentials_initial( # pylint: disable=inconsistent-return-sta _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_renew_credentials_request( resource_group_name=resource_group_name, @@ -807,10 +811,10 @@ async def _renew_credentials_initial( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -818,12 +822,20 @@ async def _renew_credentials_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_renew_credentials( @@ -853,7 +865,7 @@ async def begin_renew_credentials( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._renew_credentials_initial( # type: ignore + raw_result = await self._renew_credentials_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -862,6 +874,7 @@ async def begin_renew_credentials( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_policies_operations.py index 2a0d413492000..872363f5e094d 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_policies_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_policies_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._backup_policies_operations import ( build_create_request, build_delete_request, @@ -107,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -195,7 +193,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -210,7 +207,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupPolicy", pipeline_response) + deserialized = self._deserialize("BackupPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -224,7 +221,7 @@ async def _create_initial( backup_policy_name: str, body: Union[_models.BackupPolicy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.BackupPolicy]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -238,7 +235,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.BackupPolicy]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -260,10 +257,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -271,16 +268,15 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("BackupPolicy", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BackupPolicy", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -403,10 +399,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupPolicy", pipeline_response) + deserialized = self._deserialize("BackupPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -438,7 +435,7 @@ async def _update_initial( backup_policy_name: str, body: Union[_models.BackupPolicyPatch, IO[bytes]], **kwargs: Any - ) -> _models.BackupPolicy: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -452,7 +449,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupPolicy] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -474,10 +471,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -485,15 +482,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BackupPolicy", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BackupPolicy", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -616,10 +613,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupPolicy", pipeline_response) + deserialized = self._deserialize("BackupPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -644,9 +642,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, account_name: str, backup_policy_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -659,7 +657,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -670,10 +668,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -681,12 +679,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -716,7 +722,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, backup_policy_name=backup_policy_name, @@ -726,6 +732,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_vaults_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_vaults_operations.py index d841db1a5afd9..46e71752ee6aa 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_vaults_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_vaults_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._backup_vaults_operations import ( build_create_or_update_request, build_delete_request, @@ -109,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +124,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -197,7 +195,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +209,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupVault", pipeline_response) + deserialized = self._deserialize("BackupVault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -226,7 +223,7 @@ async def _create_or_update_initial( backup_vault_name: str, body: Union[_models.BackupVault, IO[bytes]], **kwargs: Any - ) -> _models.BackupVault: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -240,7 +237,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupVault] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -262,10 +259,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -273,15 +270,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BackupVault", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BackupVault", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -404,10 +401,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupVault", pipeline_response) + deserialized = self._deserialize("BackupVault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -439,7 +437,7 @@ async def _update_initial( backup_vault_name: str, body: Union[_models.BackupVaultPatch, IO[bytes]], **kwargs: Any - ) -> _models.BackupVault: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -453,7 +451,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupVault] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -475,10 +473,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -486,18 +484,19 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BackupVault", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = self._deserialize("BackupVault", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -620,10 +619,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupVault", pipeline_response) + deserialized = self._deserialize("BackupVault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -647,9 +647,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, account_name: str, backup_vault_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -662,7 +662,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -673,10 +673,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -684,6 +684,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -692,8 +696,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -723,7 +731,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, backup_vault_name=backup_vault_name, @@ -733,6 +741,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py index f46fa9abbb590..b96a1a65e0f6c 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._backups_operations import ( build_create_request, build_delete_request, @@ -114,7 +114,6 @@ async def get_latest_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -129,7 +128,7 @@ async def get_latest_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupStatus", pipeline_response) + deserialized = self._deserialize("BackupStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -181,7 +180,6 @@ async def get_volume_latest_restore_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -196,7 +194,7 @@ async def get_volume_latest_restore_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreStatus", pipeline_response) + deserialized = self._deserialize("RestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,7 +255,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -273,7 +270,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -348,7 +344,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +358,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Backup", pipeline_response) + deserialized = self._deserialize("Backup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +373,7 @@ async def _create_initial( backup_name: str, body: Union[_models.Backup, IO[bytes]], **kwargs: Any - ) -> _models.Backup: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -392,7 +387,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Backup] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -415,10 +410,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -426,15 +421,15 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Backup", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Backup", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -567,10 +562,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Backup", pipeline_response) + deserialized = self._deserialize("Backup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -603,7 +599,7 @@ async def _update_initial( backup_name: str, body: Optional[Union[_models.BackupPatch, IO[bytes]]] = None, **kwargs: Any - ) -> _models.Backup: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -617,7 +613,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Backup] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -643,10 +639,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -654,18 +650,19 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Backup", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = self._deserialize("Backup", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -798,10 +795,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Backup", pipeline_response) + deserialized = self._deserialize("Backup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -825,9 +823,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, account_name: str, backup_vault_name: str, backup_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -840,7 +838,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -852,10 +850,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -863,6 +861,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -871,8 +873,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -904,7 +910,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, backup_vault_name=backup_vault_name, @@ -915,6 +921,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_under_account_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_under_account_operations.py index 06ee3726030f8..e036ed99a1da9 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_under_account_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_under_account_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,19 +16,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._backups_under_account_operations import build_migrate_backups_request if sys.version_info >= (3, 9): @@ -58,13 +58,13 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - async def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements + async def _migrate_backups_initial( self, resource_group_name: str, account_name: str, body: Union[_models.BackupsMigrationRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -78,7 +78,7 @@ async def _migrate_backups_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -99,10 +99,10 @@ async def _migrate_backups_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -110,6 +110,10 @@ async def _migrate_backups_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -117,8 +121,12 @@ async def _migrate_backups_initial( # pylint: disable=inconsistent-return-state response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_migrate_backups( @@ -214,7 +222,7 @@ async def begin_migrate_backups( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_backups_initial( # type: ignore + raw_result = await self._migrate_backups_initial( resource_group_name=resource_group_name, account_name=account_name, body=body, @@ -225,6 +233,7 @@ async def begin_migrate_backups( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_under_backup_vault_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_under_backup_vault_operations.py index 48edca1de576a..94c959121e3eb 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_under_backup_vault_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_under_backup_vault_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,19 +16,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._backups_under_backup_vault_operations import build_restore_files_request if sys.version_info >= (3, 9): @@ -58,7 +58,7 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - async def _restore_files_initial( # pylint: disable=inconsistent-return-statements + async def _restore_files_initial( self, resource_group_name: str, account_name: str, @@ -66,7 +66,7 @@ async def _restore_files_initial( # pylint: disable=inconsistent-return-stateme backup_name: str, body: Union[_models.BackupRestoreFiles, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -80,7 +80,7 @@ async def _restore_files_initial( # pylint: disable=inconsistent-return-stateme api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -103,10 +103,10 @@ async def _restore_files_initial( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -114,6 +114,10 @@ async def _restore_files_initial( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -121,8 +125,12 @@ async def _restore_files_initial( # pylint: disable=inconsistent-return-stateme response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_files( @@ -234,7 +242,7 @@ async def begin_restore_files( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_files_initial( # type: ignore + raw_result = await self._restore_files_initial( resource_group_name=resource_group_name, account_name=account_name, backup_vault_name=backup_vault_name, @@ -247,6 +255,7 @@ async def begin_restore_files( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_under_volume_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_under_volume_operations.py index 17993be12addd..c154534d89ed2 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_under_volume_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_under_volume_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,19 +16,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._backups_under_volume_operations import build_migrate_backups_request if sys.version_info >= (3, 9): @@ -58,7 +58,7 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - async def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements + async def _migrate_backups_initial( self, resource_group_name: str, account_name: str, @@ -66,7 +66,7 @@ async def _migrate_backups_initial( # pylint: disable=inconsistent-return-state volume_name: str, body: Union[_models.BackupsMigrationRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -80,7 +80,7 @@ async def _migrate_backups_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -103,10 +103,10 @@ async def _migrate_backups_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -114,6 +114,10 @@ async def _migrate_backups_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -121,8 +125,12 @@ async def _migrate_backups_initial( # pylint: disable=inconsistent-return-state response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_migrate_backups( @@ -236,7 +244,7 @@ async def begin_migrate_backups( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_backups_initial( # type: ignore + raw_result = await self._migrate_backups_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -249,6 +257,7 @@ async def begin_migrate_backups( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_operations.py index 1abd7a76c8b3f..f44ef082fe2ac 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,19 +15,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._net_app_resource_operations import ( build_check_file_path_availability_request, build_check_name_availability_request, @@ -119,7 +119,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -134,7 +133,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -187,7 +186,6 @@ async def check_file_path_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -202,7 +200,7 @@ async def check_file_path_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -264,7 +262,6 @@ async def check_quota_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -279,7 +276,7 @@ async def check_quota_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,7 +316,6 @@ async def query_region_info(self, location: str, **kwargs: Any) -> _models.Regio headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -334,7 +330,7 @@ async def query_region_info(self, location: str, **kwargs: Any) -> _models.Regio error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegionInfo", pipeline_response) + deserialized = self._deserialize("RegionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -392,7 +388,6 @@ async def query_network_sibling_set( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -407,7 +402,7 @@ async def query_network_sibling_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkSiblingSet", pipeline_response) + deserialized = self._deserialize("NetworkSiblingSet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -422,7 +417,7 @@ async def _update_network_sibling_set_initial( network_sibling_set_state_id: str, network_features: Union[str, _models.NetworkFeatures] = "Basic", **kwargs: Any - ) -> Optional[_models.NetworkSiblingSet]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -436,7 +431,7 @@ async def _update_network_sibling_set_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) - cls: ClsType[Optional[_models.NetworkSiblingSet]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _body = _models.UpdateNetworkSiblingSetRequest( network_features=network_features, @@ -455,10 +450,10 @@ async def _update_network_sibling_set_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -466,18 +461,20 @@ async def _update_network_sibling_set_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("NetworkSiblingSet", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -541,10 +538,11 @@ async def begin_update_network_sibling_set( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NetworkSiblingSet", pipeline_response) + deserialized = self._deserialize("NetworkSiblingSet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_quota_limits_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_quota_limits_operations.py index 22f2a7df50ca8..e011218fc5ca5 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_quota_limits_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_quota_limits_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._net_app_resource_quota_limits_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -96,7 +94,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -112,7 +109,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -178,7 +174,6 @@ async def get(self, location: str, quota_limit_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, location: str, quota_limit_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SubscriptionQuotaItem", pipeline_response) + deserialized = self._deserialize("SubscriptionQuotaItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_region_infos_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_region_infos_operations.py index a9c61eaba1b8d..af0b32972a13b 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_region_infos_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_region_infos_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._net_app_resource_region_infos_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -94,7 +92,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -110,7 +107,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -173,7 +169,6 @@ async def get(self, location: str, **kwargs: Any) -> _models.RegionInfoResource: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -188,7 +183,7 @@ async def get(self, location: str, **kwargs: Any) -> _models.RegionInfoResource: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegionInfoResource", pipeline_response) + deserialized = self._deserialize("RegionInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_operations.py index 6d3781205601f..9ce42490d0892 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): @@ -89,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_pools_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_pools_operations.py index 10163300562e8..0e2d270e62b3f 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_pools_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_pools_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._pools_operations import ( build_create_or_update_request, build_delete_request, @@ -107,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -195,7 +193,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -210,7 +207,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CapacityPool", pipeline_response) + deserialized = self._deserialize("CapacityPool", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -224,7 +221,7 @@ async def _create_or_update_initial( pool_name: str, body: Union[_models.CapacityPool, IO[bytes]], **kwargs: Any - ) -> _models.CapacityPool: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -238,7 +235,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityPool] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -260,10 +257,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -271,15 +268,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityPool", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityPool", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -402,10 +399,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CapacityPool", pipeline_response) + deserialized = self._deserialize("CapacityPool", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -436,7 +434,7 @@ async def _update_initial( pool_name: str, body: Union[_models.CapacityPoolPatch, IO[bytes]], **kwargs: Any - ) -> Optional[_models.CapacityPool]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -450,7 +448,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CapacityPool]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -472,10 +470,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -483,13 +481,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CapacityPool", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -612,10 +612,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CapacityPool", pipeline_response) + deserialized = self._deserialize("CapacityPool", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -639,9 +640,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -654,7 +655,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -665,10 +666,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -676,12 +677,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -711,7 +720,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -721,6 +730,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshot_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshot_policies_operations.py index 2c9666e464638..79c513902cbc6 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshot_policies_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshot_policies_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._snapshot_policies_operations import ( build_create_request, build_delete_request, @@ -108,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -194,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SnapshotPolicy", pipeline_response) + deserialized = self._deserialize("SnapshotPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -336,7 +333,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -351,11 +347,7 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SnapshotPolicy", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SnapshotPolicy", pipeline_response) + deserialized = self._deserialize("SnapshotPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -369,7 +361,7 @@ async def _update_initial( snapshot_policy_name: str, body: Union[_models.SnapshotPolicyPatch, IO[bytes]], **kwargs: Any - ) -> _models.SnapshotPolicy: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -383,7 +375,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SnapshotPolicy] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -405,10 +397,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -416,15 +408,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SnapshotPolicy", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SnapshotPolicy", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -541,10 +533,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SnapshotPolicy", pipeline_response) + deserialized = self._deserialize("SnapshotPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -568,9 +561,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, account_name: str, snapshot_policy_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -583,7 +576,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -594,10 +587,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -605,12 +598,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -638,7 +639,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, snapshot_policy_name=snapshot_policy_name, @@ -648,6 +649,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -713,7 +715,6 @@ async def list_volumes( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -728,7 +729,7 @@ async def list_volumes( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SnapshotPolicyVolumeList", pipeline_response) + deserialized = self._deserialize("SnapshotPolicyVolumeList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshots_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshots_operations.py index 3b50269b252a2..6e184bbf406d1 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshots_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshots_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._snapshots_operations import ( build_create_request, build_delete_request, @@ -117,7 +117,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -133,7 +132,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -217,7 +215,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -232,7 +229,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -248,7 +245,7 @@ async def _create_initial( snapshot_name: str, body: Union[_models.Snapshot, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Snapshot]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -262,7 +259,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Snapshot]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -286,10 +283,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -297,13 +294,15 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -446,10 +445,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -482,7 +482,7 @@ async def _update_initial( snapshot_name: str, body: JSON, **kwargs: Any - ) -> Optional[_models.Snapshot]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -496,7 +496,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) - cls: ClsType[Optional[_models.Snapshot]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _json = self._serialize.body(body, "object") @@ -513,10 +513,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -524,13 +524,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -594,10 +596,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -621,7 +624,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, account_name: str, @@ -629,7 +632,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements volume_name: str, snapshot_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -642,7 +645,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -655,10 +658,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -666,12 +669,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -711,7 +722,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -723,6 +734,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -746,7 +758,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_files_initial( # pylint: disable=inconsistent-return-statements + async def _restore_files_initial( self, resource_group_name: str, account_name: str, @@ -755,7 +767,7 @@ async def _restore_files_initial( # pylint: disable=inconsistent-return-stateme snapshot_name: str, body: Union[_models.SnapshotRestoreFiles, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -769,7 +781,7 @@ async def _restore_files_initial( # pylint: disable=inconsistent-return-stateme api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -793,10 +805,10 @@ async def _restore_files_initial( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -804,12 +816,20 @@ async def _restore_files_initial( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_restore_files( @@ -930,7 +950,7 @@ async def begin_restore_files( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restore_files_initial( # type: ignore + raw_result = await self._restore_files_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -944,6 +964,7 @@ async def begin_restore_files( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_subvolumes_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_subvolumes_operations.py index 2cb9a6fa7a0ab..0968d1bb84f65 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_subvolumes_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_subvolumes_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._subvolumes_operations import ( build_create_request, build_delete_request, @@ -116,7 +116,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +131,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -216,7 +214,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -231,7 +228,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SubvolumeInfo", pipeline_response) + deserialized = self._deserialize("SubvolumeInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -247,7 +244,7 @@ async def _create_initial( subvolume_name: str, body: Union[_models.SubvolumeInfo, IO[bytes]], **kwargs: Any - ) -> Optional[_models.SubvolumeInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -261,7 +258,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.SubvolumeInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -285,10 +282,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -296,16 +293,15 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SubvolumeInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SubvolumeInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -448,10 +444,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SubvolumeInfo", pipeline_response) + deserialized = self._deserialize("SubvolumeInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -485,7 +482,7 @@ async def _update_initial( subvolume_name: str, body: Union[_models.SubvolumePatchRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.SubvolumeInfo]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -499,7 +496,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.SubvolumeInfo]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -523,10 +520,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -534,13 +531,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SubvolumeInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -683,10 +682,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SubvolumeInfo", pipeline_response) + deserialized = self._deserialize("SubvolumeInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -711,7 +711,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, account_name: str, @@ -719,7 +719,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements volume_name: str, subvolume_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -732,7 +732,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -745,10 +745,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -756,12 +756,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -801,7 +809,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -813,6 +821,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -845,7 +854,7 @@ async def _get_metadata_initial( volume_name: str, subvolume_name: str, **kwargs: Any - ) -> Optional[_models.SubvolumeModel]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -858,7 +867,7 @@ async def _get_metadata_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.SubvolumeModel]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_get_metadata_request( resource_group_name=resource_group_name, @@ -871,10 +880,10 @@ async def _get_metadata_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -882,13 +891,15 @@ async def _get_metadata_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SubvolumeModel", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -946,10 +957,11 @@ async def begin_get_metadata( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SubvolumeModel", pipeline_response) + deserialized = self._deserialize("SubvolumeModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_groups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_groups_operations.py index 9f3f95efaacc6..991a3e5d0711f 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_groups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_groups_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._volume_groups_operations import ( build_create_request, build_delete_request, @@ -108,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -196,7 +194,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -211,7 +208,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VolumeGroupDetails", pipeline_response) + deserialized = self._deserialize("VolumeGroupDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -225,7 +222,7 @@ async def _create_initial( volume_group_name: str, body: Union[_models.VolumeGroupDetails, IO[bytes]], **kwargs: Any - ) -> _models.VolumeGroupDetails: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -239,7 +236,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VolumeGroupDetails] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -261,10 +258,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -272,11 +269,15 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VolumeGroupDetails", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,10 +406,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VolumeGroupDetails", pipeline_response) + deserialized = self._deserialize("VolumeGroupDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -430,9 +432,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, account_name: str, volume_group_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -445,7 +447,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -456,10 +458,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -467,12 +469,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -502,7 +512,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, volume_group_name=volume_group_name, @@ -512,6 +522,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_quota_rules_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_quota_rules_operations.py index 68917e8d5881d..1105ac80db614 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_quota_rules_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_quota_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._volume_quota_rules_operations import ( build_create_request, build_delete_request, @@ -115,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -131,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -215,7 +213,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -230,7 +227,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) + deserialized = self._deserialize("VolumeQuotaRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -246,7 +243,7 @@ async def _create_initial( volume_quota_rule_name: str, body: Union[_models.VolumeQuotaRule, IO[bytes]], **kwargs: Any - ) -> _models.VolumeQuotaRule: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -260,7 +257,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VolumeQuotaRule] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -284,10 +281,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -295,15 +292,15 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -446,10 +443,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) + deserialized = self._deserialize("VolumeQuotaRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -482,7 +480,7 @@ async def _update_initial( volume_quota_rule_name: str, body: Union[_models.VolumeQuotaRulePatch, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VolumeQuotaRule]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -496,7 +494,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VolumeQuotaRule]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -520,10 +518,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -531,13 +529,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -680,10 +680,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) + deserialized = self._deserialize("VolumeQuotaRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -707,7 +708,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, account_name: str, @@ -715,7 +716,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements volume_name: str, volume_quota_rule_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -728,7 +729,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -741,10 +742,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -752,12 +753,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -797,7 +806,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -809,6 +818,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volumes_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volumes_operations.py index a77d19ddb1e89..37afc6cf23ac5 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volumes_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volumes_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._volumes_operations import ( build_authorize_replication_request, build_break_file_locks_request, @@ -129,7 +129,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -145,7 +144,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -220,7 +218,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -235,7 +232,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Volume", pipeline_response) + deserialized = self._deserialize("Volume", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -250,7 +247,7 @@ async def _create_or_update_initial( volume_name: str, body: Union[_models.Volume, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Volume]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -264,7 +261,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Volume]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -287,10 +284,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -298,16 +295,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Volume", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Volume", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -440,10 +436,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Volume", pipeline_response) + deserialized = self._deserialize("Volume", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -476,7 +473,7 @@ async def _update_initial( volume_name: str, body: Union[_models.VolumePatch, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Volume]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -490,7 +487,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Volume]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -513,10 +510,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -524,13 +521,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Volume", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -663,10 +662,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Volume", pipeline_response) + deserialized = self._deserialize("Volume", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -690,7 +690,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, account_name: str, @@ -698,7 +698,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements volume_name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -711,7 +711,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -724,10 +724,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -735,12 +735,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -781,7 +789,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -793,6 +801,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -818,7 +827,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _populate_availability_zone_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> Optional[_models.Volume]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -831,7 +840,7 @@ async def _populate_availability_zone_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.Volume]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_populate_availability_zone_request( resource_group_name=resource_group_name, @@ -843,10 +852,10 @@ async def _populate_availability_zone_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -854,18 +863,20 @@ async def _populate_availability_zone_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Volume", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -913,10 +924,11 @@ async def begin_populate_availability_zone( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Volume", pipeline_response) + deserialized = self._deserialize("Volume", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -940,7 +952,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _revert_initial( # pylint: disable=inconsistent-return-statements + async def _revert_initial( self, resource_group_name: str, account_name: str, @@ -948,7 +960,7 @@ async def _revert_initial( # pylint: disable=inconsistent-return-statements volume_name: str, body: Union[_models.VolumeRevert, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -962,7 +974,7 @@ async def _revert_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -985,10 +997,10 @@ async def _revert_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -996,12 +1008,20 @@ async def _revert_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_revert( @@ -1113,7 +1133,7 @@ async def begin_revert( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._revert_initial( # type: ignore + raw_result = await self._revert_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1126,6 +1146,7 @@ async def begin_revert( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1149,9 +1170,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-statements + async def _reset_cifs_password_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1164,7 +1185,7 @@ async def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_reset_cifs_password_request( resource_group_name=resource_group_name, @@ -1176,10 +1197,10 @@ async def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1187,6 +1208,10 @@ async def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1194,8 +1219,12 @@ async def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-s response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_reset_cifs_password( @@ -1227,7 +1256,7 @@ async def begin_reset_cifs_password( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._reset_cifs_password_initial( # type: ignore + raw_result = await self._reset_cifs_password_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1238,6 +1267,7 @@ async def begin_reset_cifs_password( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1259,7 +1289,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _break_file_locks_initial( # pylint: disable=inconsistent-return-statements + async def _break_file_locks_initial( self, resource_group_name: str, account_name: str, @@ -1267,7 +1297,7 @@ async def _break_file_locks_initial( # pylint: disable=inconsistent-return-stat volume_name: str, body: Optional[Union[_models.BreakFileLocksRequest, IO[bytes]]] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1281,7 +1311,7 @@ async def _break_file_locks_initial( # pylint: disable=inconsistent-return-stat api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1307,10 +1337,10 @@ async def _break_file_locks_initial( # pylint: disable=inconsistent-return-stat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1318,6 +1348,10 @@ async def _break_file_locks_initial( # pylint: disable=inconsistent-return-stat response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1326,8 +1360,12 @@ async def _break_file_locks_initial( # pylint: disable=inconsistent-return-stat if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_break_file_locks( @@ -1441,7 +1479,7 @@ async def begin_break_file_locks( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._break_file_locks_initial( # type: ignore + raw_result = await self._break_file_locks_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1454,6 +1492,7 @@ async def begin_break_file_locks( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1485,7 +1524,7 @@ async def _list_get_group_id_list_for_ldap_user_initial( # pylint: disable=name volume_name: str, body: Union[_models.GetGroupIdListForLDAPUserRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.GetGroupIdListForLDAPUserResponse]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1499,7 +1538,7 @@ async def _list_get_group_id_list_for_ldap_user_initial( # pylint: disable=name api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.GetGroupIdListForLDAPUserResponse]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1522,10 +1561,10 @@ async def _list_get_group_id_list_for_ldap_user_initial( # pylint: disable=name headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1533,18 +1572,20 @@ async def _list_get_group_id_list_for_ldap_user_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("GetGroupIdListForLDAPUserResponse", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1679,10 +1720,11 @@ async def begin_list_get_group_id_list_for_ldap_user( # pylint: disable=name-to params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GetGroupIdListForLDAPUserResponse", pipeline_response) + deserialized = self._deserialize("GetGroupIdListForLDAPUserResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1706,7 +1748,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _break_replication_initial( # pylint: disable=inconsistent-return-statements + async def _break_replication_initial( self, resource_group_name: str, account_name: str, @@ -1714,7 +1756,7 @@ async def _break_replication_initial( # pylint: disable=inconsistent-return-sta volume_name: str, body: Optional[Union[_models.BreakReplicationRequest, IO[bytes]]] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1728,7 +1770,7 @@ async def _break_replication_initial( # pylint: disable=inconsistent-return-sta api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1754,10 +1796,10 @@ async def _break_replication_initial( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1765,12 +1807,20 @@ async def _break_replication_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_break_replication( @@ -1882,7 +1932,7 @@ async def begin_break_replication( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._break_replication_initial( # type: ignore + raw_result = await self._break_replication_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1895,6 +1945,7 @@ async def begin_break_replication( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1918,7 +1969,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _reestablish_replication_initial( # pylint: disable=inconsistent-return-statements + async def _reestablish_replication_initial( self, resource_group_name: str, account_name: str, @@ -1926,7 +1977,7 @@ async def _reestablish_replication_initial( # pylint: disable=inconsistent-retu volume_name: str, body: Union[_models.ReestablishReplicationRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1940,7 +1991,7 @@ async def _reestablish_replication_initial( # pylint: disable=inconsistent-retu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1963,10 +2014,10 @@ async def _reestablish_replication_initial( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1974,12 +2025,20 @@ async def _reestablish_replication_initial( # pylint: disable=inconsistent-retu response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_reestablish_replication( @@ -2094,7 +2153,7 @@ async def begin_reestablish_replication( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._reestablish_replication_initial( # type: ignore + raw_result = await self._reestablish_replication_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -2107,6 +2166,7 @@ async def begin_reestablish_replication( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2175,7 +2235,6 @@ async def replication_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2190,7 +2249,7 @@ async def replication_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ReplicationStatus", pipeline_response) + deserialized = self._deserialize("ReplicationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2245,7 +2304,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -2261,7 +2319,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -2291,9 +2348,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _resync_replication_initial( # pylint: disable=inconsistent-return-statements + async def _resync_replication_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2306,7 +2363,7 @@ async def _resync_replication_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_resync_replication_request( resource_group_name=resource_group_name, @@ -2318,10 +2375,10 @@ async def _resync_replication_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2329,12 +2386,20 @@ async def _resync_replication_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_resync_replication( @@ -2367,7 +2432,7 @@ async def begin_resync_replication( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._resync_replication_initial( # type: ignore + raw_result = await self._resync_replication_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -2378,6 +2443,7 @@ async def begin_resync_replication( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2401,9 +2467,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_replication_initial( # pylint: disable=inconsistent-return-statements + async def _delete_replication_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2416,7 +2482,7 @@ async def _delete_replication_initial( # pylint: disable=inconsistent-return-st _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_replication_request( resource_group_name=resource_group_name, @@ -2428,10 +2494,10 @@ async def _delete_replication_initial( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2439,12 +2505,20 @@ async def _delete_replication_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete_replication( @@ -2477,7 +2551,7 @@ async def begin_delete_replication( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_replication_initial( # type: ignore + raw_result = await self._delete_replication_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -2488,6 +2562,7 @@ async def begin_delete_replication( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2511,7 +2586,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _authorize_replication_initial( # pylint: disable=inconsistent-return-statements + async def _authorize_replication_initial( self, resource_group_name: str, account_name: str, @@ -2519,7 +2594,7 @@ async def _authorize_replication_initial( # pylint: disable=inconsistent-return volume_name: str, body: Union[_models.AuthorizeRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2533,7 +2608,7 @@ async def _authorize_replication_initial( # pylint: disable=inconsistent-return api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2556,10 +2631,10 @@ async def _authorize_replication_initial( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2567,12 +2642,20 @@ async def _authorize_replication_initial( # pylint: disable=inconsistent-return response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_authorize_replication( @@ -2684,7 +2767,7 @@ async def begin_authorize_replication( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._authorize_replication_initial( # type: ignore + raw_result = await self._authorize_replication_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -2697,6 +2780,7 @@ async def begin_authorize_replication( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2720,9 +2804,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _re_initialize_replication_initial( # pylint: disable=inconsistent-return-statements + async def _re_initialize_replication_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2735,7 +2819,7 @@ async def _re_initialize_replication_initial( # pylint: disable=inconsistent-re _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_re_initialize_replication_request( resource_group_name=resource_group_name, @@ -2747,10 +2831,10 @@ async def _re_initialize_replication_initial( # pylint: disable=inconsistent-re headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2758,12 +2842,20 @@ async def _re_initialize_replication_initial( # pylint: disable=inconsistent-re response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_re_initialize_replication( @@ -2795,7 +2887,7 @@ async def begin_re_initialize_replication( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._re_initialize_replication_initial( # type: ignore + raw_result = await self._re_initialize_replication_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -2806,6 +2898,7 @@ async def begin_re_initialize_replication( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2829,7 +2922,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _pool_change_initial( # pylint: disable=inconsistent-return-statements + async def _pool_change_initial( self, resource_group_name: str, account_name: str, @@ -2837,7 +2930,7 @@ async def _pool_change_initial( # pylint: disable=inconsistent-return-statement volume_name: str, body: Union[_models.PoolChangeRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2851,7 +2944,7 @@ async def _pool_change_initial( # pylint: disable=inconsistent-return-statement api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2874,10 +2967,10 @@ async def _pool_change_initial( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2885,12 +2978,20 @@ async def _pool_change_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_pool_change( @@ -3002,7 +3103,7 @@ async def begin_pool_change( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._pool_change_initial( # type: ignore + raw_result = await self._pool_change_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -3015,6 +3116,7 @@ async def begin_pool_change( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3038,7 +3140,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _relocate_initial( # pylint: disable=inconsistent-return-statements + async def _relocate_initial( self, resource_group_name: str, account_name: str, @@ -3046,7 +3148,7 @@ async def _relocate_initial( # pylint: disable=inconsistent-return-statements volume_name: str, body: Optional[Union[_models.RelocateVolumeRequest, IO[bytes]]] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3060,7 +3162,7 @@ async def _relocate_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3086,10 +3188,10 @@ async def _relocate_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3097,12 +3199,20 @@ async def _relocate_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_relocate( @@ -3214,7 +3324,7 @@ async def begin_relocate( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._relocate_initial( # type: ignore + raw_result = await self._relocate_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -3227,6 +3337,7 @@ async def begin_relocate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3248,9 +3359,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _finalize_relocation_initial( # pylint: disable=inconsistent-return-statements + async def _finalize_relocation_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3263,7 +3374,7 @@ async def _finalize_relocation_initial( # pylint: disable=inconsistent-return-s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_finalize_relocation_request( resource_group_name=resource_group_name, @@ -3275,10 +3386,10 @@ async def _finalize_relocation_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3286,12 +3397,20 @@ async def _finalize_relocation_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_finalize_relocation( @@ -3323,7 +3442,7 @@ async def begin_finalize_relocation( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._finalize_relocation_initial( # type: ignore + raw_result = await self._finalize_relocation_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -3334,6 +3453,7 @@ async def begin_finalize_relocation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3355,9 +3475,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _revert_relocation_initial( # pylint: disable=inconsistent-return-statements + async def _revert_relocation_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3370,7 +3490,7 @@ async def _revert_relocation_initial( # pylint: disable=inconsistent-return-sta _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_revert_relocation_request( resource_group_name=resource_group_name, @@ -3382,10 +3502,10 @@ async def _revert_relocation_initial( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3393,12 +3513,20 @@ async def _revert_relocation_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_revert_relocation( @@ -3431,7 +3559,7 @@ async def begin_revert_relocation( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._revert_relocation_initial( # type: ignore + raw_result = await self._revert_relocation_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -3442,6 +3570,7 @@ async def begin_revert_relocation( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models_py3.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models_py3.py index 8e4d1024ab8ae..f11644d2ebe71 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models_py3.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models_py3.py @@ -1151,7 +1151,7 @@ class CapacityPool(TrackedResource): # pylint: disable=too-many-instance-attrib :ivar pool_id: UUID v4 used to identify the Pool. :vartype pool_id: str :ivar size: Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value - must be multiply of 1099511627776). + must be multiple of 1099511627776). :vartype size: int :ivar service_level: The service level of the file system. Known values are: "Standard", "Premium", "Ultra", and "StandardZRS". @@ -1229,7 +1229,7 @@ def __init__( :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword size: Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks - (value must be multiply of 1099511627776). + (value must be multiple of 1099511627776). :paramtype size: int :keyword service_level: The service level of the file system. Known values are: "Standard", "Premium", "Ultra", and "StandardZRS". @@ -1300,7 +1300,7 @@ class CapacityPoolPatch(_serialization.Model): :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar size: Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value - must be multiply of 1099511627776). + must be multiple of 1099511627776). :vartype size: int :ivar qos_type: The qos type of the pool. Known values are: "Auto" and "Manual". :vartype qos_type: str or ~azure.mgmt.netapp.models.QosType @@ -1341,7 +1341,7 @@ def __init__( :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword size: Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks - (value must be multiply of 1099511627776). + (value must be multiple of 1099511627776). :paramtype size: int :keyword qos_type: The qos type of the pool. Known values are: "Auto" and "Manual". :paramtype qos_type: str or ~azure.mgmt.netapp.models.QosType @@ -1914,7 +1914,7 @@ class KeyVaultProperties(_serialization.Model): :vartype key_vault_uri: str :ivar key_name: The name of KeyVault key. Required. :vartype key_name: str - :ivar key_vault_resource_id: The resource ID of KeyVault. Required. + :ivar key_vault_resource_id: The resource ID of KeyVault. :vartype key_vault_resource_id: str :ivar status: Status of the KeyVault connection. Known values are: "Created", "InUse", "Deleted", "Error", and "Updating". @@ -1930,7 +1930,6 @@ class KeyVaultProperties(_serialization.Model): }, "key_vault_uri": {"required": True}, "key_name": {"required": True}, - "key_vault_resource_id": {"required": True}, "status": {"readonly": True}, } @@ -1942,13 +1941,15 @@ class KeyVaultProperties(_serialization.Model): "status": {"key": "status", "type": "str"}, } - def __init__(self, *, key_vault_uri: str, key_name: str, key_vault_resource_id: str, **kwargs: Any) -> None: + def __init__( + self, *, key_vault_uri: str, key_name: str, key_vault_resource_id: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword key_vault_uri: The Uri of KeyVault. Required. :paramtype key_vault_uri: str :keyword key_name: The name of KeyVault key. Required. :paramtype key_name: str - :keyword key_vault_resource_id: The resource ID of KeyVault. Required. + :keyword key_vault_resource_id: The resource ID of KeyVault. :paramtype key_vault_resource_id: str """ super().__init__(**kwargs) @@ -3249,8 +3250,12 @@ def __init__(self, *, creation_token: Optional[str] = None, **kwargs: Any) -> No class Replication(_serialization.Model): """Replication properties. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to server. + :ivar replication_id: UUID v4 used to identify the replication. + :vartype replication_id: str :ivar endpoint_type: Indicates whether the local volume is the source or destination for the Volume Replication. Known values are: "src" and "dst". :vartype endpoint_type: str or ~azure.mgmt.netapp.models.EndpointType @@ -3263,10 +3268,17 @@ class Replication(_serialization.Model): """ _validation = { + "replication_id": { + "readonly": True, + "max_length": 36, + "min_length": 36, + "pattern": r"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$", + }, "remote_volume_resource_id": {"required": True}, } _attribute_map = { + "replication_id": {"key": "replicationId", "type": "str"}, "endpoint_type": {"key": "endpointType", "type": "str"}, "replication_schedule": {"key": "replicationSchedule", "type": "str"}, "remote_volume_resource_id": {"key": "remoteVolumeResourceId", "type": "str"}, @@ -3295,6 +3307,7 @@ def __init__( :paramtype remote_volume_region: str """ super().__init__(**kwargs) + self.replication_id = None self.endpoint_type = endpoint_type self.replication_schedule = replication_schedule self.remote_volume_resource_id = remote_volume_resource_id @@ -4526,8 +4539,9 @@ class Volume(TrackedResource): # pylint: disable=too-many-instance-attributes "Premium", "Ultra", and "StandardZRS". :vartype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel :ivar usage_threshold: Maximum storage quota allowed for a file system in bytes. This is a soft - quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB, 500Tib for - LargeVolume or 2400Tib for LargeVolume on exceptional basis. Specified in bytes. + quota used for alerting only. For regular volumes, valid values are in the range 50GiB to + 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an + exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. :vartype usage_threshold: int :ivar export_policy: Set of export policy rules. :vartype export_policy: ~azure.mgmt.netapp.models.VolumePropertiesExportPolicy @@ -4703,7 +4717,7 @@ class Volume(TrackedResource): # pylint: disable=too-many-instance-attributes "min_length": 1, "pattern": r"^[a-zA-Z][a-zA-Z0-9\-]{0,79}$", }, - "usage_threshold": {"required": True, "maximum": 2638827906662400, "minimum": 107374182400}, + "usage_threshold": {"required": True, "maximum": 2638827906662400, "minimum": 53687091200}, "provisioning_state": {"readonly": True}, "baremetal_tenant_id": {"readonly": True}, "subnet_id": {"required": True}, @@ -4857,8 +4871,9 @@ def __init__( # pylint: disable=too-many-locals "Premium", "Ultra", and "StandardZRS". :paramtype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel :keyword usage_threshold: Maximum storage quota allowed for a file system in bytes. This is a - soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB, 500Tib for - LargeVolume or 2400Tib for LargeVolume on exceptional basis. Specified in bytes. + soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to + 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an + exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. :paramtype usage_threshold: int :keyword export_policy: Set of export policy rules. :paramtype export_policy: ~azure.mgmt.netapp.models.VolumePropertiesExportPolicy @@ -5339,8 +5354,9 @@ class VolumeGroupVolumeProperties(_serialization.Model): # pylint: disable=too- "Premium", "Ultra", and "StandardZRS". :vartype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel :ivar usage_threshold: Maximum storage quota allowed for a file system in bytes. This is a soft - quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB, 500Tib for - LargeVolume or 2400Tib for LargeVolume on exceptional basis. Specified in bytes. + quota used for alerting only. For regular volumes, valid values are in the range 50GiB to + 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an + exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. :vartype usage_threshold: int :ivar export_policy: Set of export policy rules. :vartype export_policy: ~azure.mgmt.netapp.models.VolumePropertiesExportPolicy @@ -5512,7 +5528,7 @@ class VolumeGroupVolumeProperties(_serialization.Model): # pylint: disable=too- "min_length": 1, "pattern": r"^[a-zA-Z][a-zA-Z0-9\-]{0,79}$", }, - "usage_threshold": {"required": True, "maximum": 2638827906662400, "minimum": 107374182400}, + "usage_threshold": {"required": True, "maximum": 2638827906662400, "minimum": 53687091200}, "provisioning_state": {"readonly": True}, "baremetal_tenant_id": {"readonly": True}, "subnet_id": {"required": True}, @@ -5663,8 +5679,9 @@ def __init__( # pylint: disable=too-many-locals "Premium", "Ultra", and "StandardZRS". :paramtype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel :keyword usage_threshold: Maximum storage quota allowed for a file system in bytes. This is a - soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB, 500Tib for - LargeVolume or 2400Tib for LargeVolume on exceptional basis. Specified in bytes. + soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to + 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an + exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. :paramtype usage_threshold: int :keyword export_policy: Set of export policy rules. :paramtype export_policy: ~azure.mgmt.netapp.models.VolumePropertiesExportPolicy @@ -5887,8 +5904,9 @@ class VolumePatch(_serialization.Model): # pylint: disable=too-many-instance-at "Premium", "Ultra", and "StandardZRS". :vartype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel :ivar usage_threshold: Maximum storage quota allowed for a file system in bytes. This is a soft - quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB, 500Tib for - LargeVolume or 2400Tib for LargeVolume on exceptional basis. Specified in bytes. + quota used for alerting only. For regular volumes, valid values are in the range 50GiB to + 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an + exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. :vartype usage_threshold: int :ivar export_policy: Set of export policy rules. :vartype export_policy: ~azure.mgmt.netapp.models.VolumePatchPropertiesExportPolicy @@ -5948,7 +5966,7 @@ class VolumePatch(_serialization.Model): # pylint: disable=too-many-instance-at "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "usage_threshold": {"maximum": 2638827906662400, "minimum": 107374182400}, + "usage_threshold": {"maximum": 2638827906662400, "minimum": 53687091200}, "unix_permissions": {"max_length": 4, "min_length": 4}, "coolness_period": {"maximum": 183, "minimum": 2}, } @@ -6009,8 +6027,9 @@ def __init__( "Premium", "Ultra", and "StandardZRS". :paramtype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel :keyword usage_threshold: Maximum storage quota allowed for a file system in bytes. This is a - soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB, 500Tib for - LargeVolume or 2400Tib for LargeVolume on exceptional basis. Specified in bytes. + soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to + 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an + exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. :paramtype usage_threshold: int :keyword export_policy: Set of export policy rules. :paramtype export_policy: ~azure.mgmt.netapp.models.VolumePatchPropertiesExportPolicy diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_accounts_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_accounts_operations.py index f5bbe72ccc6fa..936205a433d5d 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_accounts_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_accounts_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -48,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +102,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +137,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -175,7 +175,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,7 +210,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -248,7 +248,7 @@ def build_renew_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -329,7 +329,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -345,7 +344,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -412,7 +410,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -428,7 +425,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -495,7 +491,6 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -510,7 +505,7 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetAppAccount", pipeline_response) + deserialized = self._deserialize("NetAppAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -519,7 +514,7 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo def _create_or_update_initial( self, resource_group_name: str, account_name: str, body: Union[_models.NetAppAccount, IO[bytes]], **kwargs: Any - ) -> _models.NetAppAccount: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -533,7 +528,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -554,10 +549,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -565,15 +560,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("NetAppAccount", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("NetAppAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -682,10 +677,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NetAppAccount", pipeline_response) + deserialized = self._deserialize("NetAppAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -709,9 +705,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -724,7 +718,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -734,10 +728,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -745,12 +739,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -776,7 +778,7 @@ def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: An lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -785,6 +787,7 @@ def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: An params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -814,7 +817,7 @@ def _update_initial( account_name: str, body: Union[_models.NetAppAccountPatch, IO[bytes]], **kwargs: Any - ) -> _models.NetAppAccount: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -828,7 +831,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NetAppAccount] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -849,10 +852,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -860,15 +863,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("NetAppAccount", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("NetAppAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -981,10 +984,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NetAppAccount", pipeline_response) + deserialized = self._deserialize("NetAppAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1008,9 +1012,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _renew_credentials_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + def _renew_credentials_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1023,7 +1025,7 @@ def _renew_credentials_initial( # pylint: disable=inconsistent-return-statement _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_renew_credentials_request( resource_group_name=resource_group_name, @@ -1033,10 +1035,10 @@ def _renew_credentials_initial( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1044,12 +1046,20 @@ def _renew_credentials_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_renew_credentials(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1077,7 +1087,7 @@ def begin_renew_credentials(self, resource_group_name: str, account_name: str, * lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._renew_credentials_initial( # type: ignore + raw_result = self._renew_credentials_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1086,6 +1096,7 @@ def begin_renew_credentials(self, resource_group_name: str, account_name: str, * params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py index 0984ba64effa3..fdb52a215ae17 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -48,7 +48,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +119,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -158,7 +158,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -197,7 +197,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,7 +286,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -302,7 +301,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -374,7 +372,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -389,7 +386,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupPolicy", pipeline_response) + deserialized = self._deserialize("BackupPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -403,7 +400,7 @@ def _create_initial( backup_policy_name: str, body: Union[_models.BackupPolicy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.BackupPolicy]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -417,7 +414,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.BackupPolicy]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -439,10 +436,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -450,16 +447,15 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("BackupPolicy", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BackupPolicy", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -582,10 +578,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupPolicy", pipeline_response) + deserialized = self._deserialize("BackupPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -616,7 +613,7 @@ def _update_initial( backup_policy_name: str, body: Union[_models.BackupPolicyPatch, IO[bytes]], **kwargs: Any - ) -> _models.BackupPolicy: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -630,7 +627,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupPolicy] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -652,10 +649,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -663,15 +660,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BackupPolicy", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BackupPolicy", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -794,10 +791,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupPolicy", pipeline_response) + deserialized = self._deserialize("BackupPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -821,9 +819,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, account_name: str, backup_policy_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -836,7 +834,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -847,10 +845,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -858,12 +856,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -893,7 +899,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, backup_policy_name=backup_policy_name, @@ -903,6 +909,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_vaults_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_vaults_operations.py index 2c214743701dc..f05058d4c1249 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_vaults_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_vaults_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -50,7 +50,7 @@ def build_list_by_net_app_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +123,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -164,7 +164,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -205,7 +205,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -298,7 +298,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -314,7 +313,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -386,7 +384,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -401,7 +398,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupVault", pipeline_response) + deserialized = self._deserialize("BackupVault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -415,7 +412,7 @@ def _create_or_update_initial( backup_vault_name: str, body: Union[_models.BackupVault, IO[bytes]], **kwargs: Any - ) -> _models.BackupVault: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -429,7 +426,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupVault] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -451,10 +448,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -462,15 +459,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BackupVault", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BackupVault", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -593,10 +590,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupVault", pipeline_response) + deserialized = self._deserialize("BackupVault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -627,7 +625,7 @@ def _update_initial( backup_vault_name: str, body: Union[_models.BackupVaultPatch, IO[bytes]], **kwargs: Any - ) -> _models.BackupVault: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -641,7 +639,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupVault] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -663,10 +661,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -674,18 +672,19 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BackupVault", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = self._deserialize("BackupVault", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -808,10 +807,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupVault", pipeline_response) + deserialized = self._deserialize("BackupVault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -835,9 +835,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, account_name: str, backup_vault_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -850,7 +850,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -861,10 +861,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -872,6 +872,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -880,8 +884,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -911,7 +919,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, backup_vault_name=backup_vault_name, @@ -921,6 +929,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_operations.py index 8ea7e932de017..7d2844d0183a1 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -50,7 +50,7 @@ def build_get_latest_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +91,7 @@ def build_get_volume_latest_restore_status_request( # pylint: disable=name-too- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,7 +138,7 @@ def build_list_by_vault_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +183,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +229,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -278,7 +278,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -327,7 +327,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -426,7 +426,6 @@ def get_latest_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -441,7 +440,7 @@ def get_latest_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BackupStatus", pipeline_response) + deserialized = self._deserialize("BackupStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -493,7 +492,6 @@ def get_volume_latest_restore_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -508,7 +506,7 @@ def get_volume_latest_restore_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestoreStatus", pipeline_response) + deserialized = self._deserialize("RestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -569,7 +567,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -585,7 +582,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -660,7 +656,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -675,7 +670,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Backup", pipeline_response) + deserialized = self._deserialize("Backup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -690,7 +685,7 @@ def _create_initial( backup_name: str, body: Union[_models.Backup, IO[bytes]], **kwargs: Any - ) -> _models.Backup: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -704,7 +699,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Backup] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -727,10 +722,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -738,15 +733,15 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Backup", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Backup", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -876,10 +871,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Backup", pipeline_response) + deserialized = self._deserialize("Backup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -911,7 +907,7 @@ def _update_initial( backup_name: str, body: Optional[Union[_models.BackupPatch, IO[bytes]]] = None, **kwargs: Any - ) -> _models.Backup: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -925,7 +921,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Backup] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -951,10 +947,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -962,18 +958,19 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Backup", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = self._deserialize("Backup", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1103,10 +1100,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Backup", pipeline_response) + deserialized = self._deserialize("Backup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1130,9 +1128,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, account_name: str, backup_vault_name: str, backup_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1145,7 +1143,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -1157,10 +1155,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1168,6 +1166,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1176,8 +1178,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -1209,7 +1215,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, backup_vault_name=backup_vault_name, @@ -1220,6 +1226,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_under_account_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_under_account_operations.py index a510514c88497..8394c7e462a7e 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_under_account_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_under_account_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,7 +30,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -48,7 +48,7 @@ def build_migrate_backups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -99,13 +99,13 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements + def _migrate_backups_initial( self, resource_group_name: str, account_name: str, body: Union[_models.BackupsMigrationRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -119,7 +119,7 @@ def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -140,10 +140,10 @@ def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -151,6 +151,10 @@ def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -158,8 +162,12 @@ def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_migrate_backups( @@ -255,7 +263,7 @@ def begin_migrate_backups( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_backups_initial( # type: ignore + raw_result = self._migrate_backups_initial( resource_group_name=resource_group_name, account_name=account_name, body=body, @@ -266,6 +274,7 @@ def begin_migrate_backups( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_under_backup_vault_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_under_backup_vault_operations.py index f43c2f622f916..e48e13b72084c 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_under_backup_vault_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_under_backup_vault_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,7 +30,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -53,7 +53,7 @@ def build_restore_files_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -110,7 +110,7 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - def _restore_files_initial( # pylint: disable=inconsistent-return-statements + def _restore_files_initial( self, resource_group_name: str, account_name: str, @@ -118,7 +118,7 @@ def _restore_files_initial( # pylint: disable=inconsistent-return-statements backup_name: str, body: Union[_models.BackupRestoreFiles, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -132,7 +132,7 @@ def _restore_files_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -155,10 +155,10 @@ def _restore_files_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -166,6 +166,10 @@ def _restore_files_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -173,8 +177,12 @@ def _restore_files_initial( # pylint: disable=inconsistent-return-statements response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_files( @@ -286,7 +294,7 @@ def begin_restore_files( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_files_initial( # type: ignore + raw_result = self._restore_files_initial( resource_group_name=resource_group_name, account_name=account_name, backup_vault_name=backup_vault_name, @@ -299,6 +307,7 @@ def begin_restore_files( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_under_volume_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_under_volume_operations.py index 868318cc23f11..2b5f05c595445 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_under_volume_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_under_volume_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,7 +30,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -48,7 +48,7 @@ def build_migrate_backups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -105,7 +105,7 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements + def _migrate_backups_initial( self, resource_group_name: str, account_name: str, @@ -113,7 +113,7 @@ def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements volume_name: str, body: Union[_models.BackupsMigrationRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -127,7 +127,7 @@ def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -150,10 +150,10 @@ def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -161,6 +161,10 @@ def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -168,8 +172,12 @@ def _migrate_backups_initial( # pylint: disable=inconsistent-return-statements response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_migrate_backups( @@ -283,7 +291,7 @@ def begin_migrate_backups( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_backups_initial( # type: ignore + raw_result = self._migrate_backups_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -296,6 +304,7 @@ def begin_migrate_backups( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_operations.py index c137575b6a072..4a9052fb9fc89 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterator, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,7 +29,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -45,7 +45,7 @@ def build_check_name_availability_request(location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -78,7 +78,7 @@ def build_check_file_path_availability_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -109,7 +109,7 @@ def build_check_quota_availability_request(location: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -140,7 +140,7 @@ def build_query_region_info_request(location: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +167,7 @@ def build_query_network_sibling_set_request(location: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -198,7 +198,7 @@ def build_update_network_sibling_set_request(location: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -299,7 +299,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -314,7 +313,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -367,7 +366,6 @@ def check_file_path_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -382,7 +380,7 @@ def check_file_path_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -444,7 +442,6 @@ def check_quota_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -459,7 +456,7 @@ def check_quota_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -499,7 +496,6 @@ def query_region_info(self, location: str, **kwargs: Any) -> _models.RegionInfo: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +510,7 @@ def query_region_info(self, location: str, **kwargs: Any) -> _models.RegionInfo: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegionInfo", pipeline_response) + deserialized = self._deserialize("RegionInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -572,7 +568,6 @@ def query_network_sibling_set( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -587,7 +582,7 @@ def query_network_sibling_set( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkSiblingSet", pipeline_response) + deserialized = self._deserialize("NetworkSiblingSet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -602,7 +597,7 @@ def _update_network_sibling_set_initial( network_sibling_set_state_id: str, network_features: Union[str, _models.NetworkFeatures] = "Basic", **kwargs: Any - ) -> Optional[_models.NetworkSiblingSet]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -616,7 +611,7 @@ def _update_network_sibling_set_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) - cls: ClsType[Optional[_models.NetworkSiblingSet]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _body = _models.UpdateNetworkSiblingSetRequest( network_features=network_features, @@ -635,10 +630,10 @@ def _update_network_sibling_set_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -646,18 +641,20 @@ def _update_network_sibling_set_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("NetworkSiblingSet", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -721,10 +718,11 @@ def begin_update_network_sibling_set( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NetworkSiblingSet", pipeline_response) + deserialized = self._deserialize("NetworkSiblingSet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_quota_limits_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_quota_limits_operations.py index c7bcd64bb5047..38449e428fd23 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_quota_limits_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_quota_limits_operations.py @@ -20,15 +20,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -45,7 +43,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +70,7 @@ def build_get_request(location: str, quota_limit_name: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +151,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -169,7 +166,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -235,7 +231,6 @@ def get(self, location: str, quota_limit_name: str, **kwargs: Any) -> _models.Su headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -250,7 +245,7 @@ def get(self, location: str, quota_limit_name: str, **kwargs: Any) -> _models.Su error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SubscriptionQuotaItem", pipeline_response) + deserialized = self._deserialize("SubscriptionQuotaItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_region_infos_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_region_infos_operations.py index 1bb5705f52e53..1c4e419c443da 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_region_infos_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_region_infos_operations.py @@ -20,15 +20,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -45,7 +43,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +70,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,7 +149,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -167,7 +164,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -230,7 +226,6 @@ def get(self, location: str, **kwargs: Any) -> _models.RegionInfoResource: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -245,7 +240,7 @@ def get(self, location: str, **kwargs: Any) -> _models.RegionInfoResource: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegionInfoResource", pipeline_response) + deserialized = self._deserialize("RegionInfoResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_operations.py index 03adb0a896d7f..e25e12b5035aa 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_operations.py @@ -20,15 +20,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -45,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -127,7 +124,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_pools_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_pools_operations.py index a17ad28328e54..28fd4ca9a29cc 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_pools_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_pools_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -48,7 +48,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +121,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,7 +162,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -203,7 +203,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -294,7 +294,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -310,7 +309,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -380,7 +378,6 @@ def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -395,7 +392,7 @@ def get(self, resource_group_name: str, account_name: str, pool_name: str, **kwa error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CapacityPool", pipeline_response) + deserialized = self._deserialize("CapacityPool", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +406,7 @@ def _create_or_update_initial( pool_name: str, body: Union[_models.CapacityPool, IO[bytes]], **kwargs: Any - ) -> _models.CapacityPool: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -423,7 +420,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityPool] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -445,10 +442,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -456,15 +453,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityPool", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityPool", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -587,10 +584,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CapacityPool", pipeline_response) + deserialized = self._deserialize("CapacityPool", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -621,7 +619,7 @@ def _update_initial( pool_name: str, body: Union[_models.CapacityPoolPatch, IO[bytes]], **kwargs: Any - ) -> Optional[_models.CapacityPool]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -635,7 +633,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.CapacityPool]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -657,10 +655,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -668,13 +666,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CapacityPool", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -797,10 +797,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CapacityPool", pipeline_response) + deserialized = self._deserialize("CapacityPool", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -824,9 +825,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, account_name: str, pool_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -839,7 +840,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -850,10 +851,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -861,12 +862,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -896,7 +905,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -906,6 +915,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshot_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshot_policies_operations.py index d198604db0557..d1c5798518dd1 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshot_policies_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshot_policies_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -48,7 +48,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +119,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -158,7 +158,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -197,7 +197,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,7 +233,7 @@ def build_list_volumes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -320,7 +320,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -336,7 +335,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -406,7 +404,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -421,7 +418,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SnapshotPolicy", pipeline_response) + deserialized = self._deserialize("SnapshotPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,7 +545,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -563,11 +559,7 @@ def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SnapshotPolicy", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SnapshotPolicy", pipeline_response) + deserialized = self._deserialize("SnapshotPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -581,7 +573,7 @@ def _update_initial( snapshot_policy_name: str, body: Union[_models.SnapshotPolicyPatch, IO[bytes]], **kwargs: Any - ) -> _models.SnapshotPolicy: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -595,7 +587,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SnapshotPolicy] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -617,10 +609,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -628,15 +620,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SnapshotPolicy", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("SnapshotPolicy", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -753,10 +745,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SnapshotPolicy", pipeline_response) + deserialized = self._deserialize("SnapshotPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -780,9 +773,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, account_name: str, snapshot_policy_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -795,7 +788,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -806,10 +799,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -817,12 +810,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -850,7 +851,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, snapshot_policy_name=snapshot_policy_name, @@ -860,6 +861,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -925,7 +927,6 @@ def list_volumes( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -940,7 +941,7 @@ def list_volumes( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SnapshotPolicyVolumeList", pipeline_response) + deserialized = self._deserialize("SnapshotPolicyVolumeList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshots_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshots_operations.py index 3c9e058368eb8..cb6b97b68e676 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshots_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshots_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -51,7 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +98,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +146,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -199,7 +199,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -250,7 +250,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -298,7 +298,7 @@ def build_restore_files_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -404,7 +404,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -420,7 +419,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -504,7 +502,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -519,7 +516,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -535,7 +532,7 @@ def _create_initial( snapshot_name: str, body: Union[_models.Snapshot, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Snapshot]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -549,7 +546,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Snapshot]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -573,10 +570,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -584,13 +581,15 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -730,10 +729,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -766,7 +766,7 @@ def _update_initial( snapshot_name: str, body: JSON, **kwargs: Any - ) -> Optional[_models.Snapshot]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -780,7 +780,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) - cls: ClsType[Optional[_models.Snapshot]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _json = self._serialize.body(body, "object") @@ -797,10 +797,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -808,13 +808,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -877,10 +879,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -904,7 +907,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, account_name: str, @@ -912,7 +915,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements volume_name: str, snapshot_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -925,7 +928,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -938,10 +941,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -949,12 +952,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -994,7 +1005,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1006,6 +1017,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1029,7 +1041,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_files_initial( # pylint: disable=inconsistent-return-statements + def _restore_files_initial( self, resource_group_name: str, account_name: str, @@ -1038,7 +1050,7 @@ def _restore_files_initial( # pylint: disable=inconsistent-return-statements snapshot_name: str, body: Union[_models.SnapshotRestoreFiles, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1052,7 +1064,7 @@ def _restore_files_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1076,10 +1088,10 @@ def _restore_files_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1087,12 +1099,20 @@ def _restore_files_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_restore_files( @@ -1213,7 +1233,7 @@ def begin_restore_files( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restore_files_initial( # type: ignore + raw_result = self._restore_files_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1227,6 +1247,7 @@ def begin_restore_files( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_subvolumes_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_subvolumes_operations.py index 6b332c9d4c11b..4446b41ccb40e 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_subvolumes_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_subvolumes_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -50,7 +50,7 @@ def build_list_by_volume_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +152,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -210,7 +210,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -268,7 +268,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -323,7 +323,7 @@ def build_get_metadata_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -433,7 +433,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -449,7 +448,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -533,7 +531,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -548,7 +545,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SubvolumeInfo", pipeline_response) + deserialized = self._deserialize("SubvolumeInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -564,7 +561,7 @@ def _create_initial( subvolume_name: str, body: Union[_models.SubvolumeInfo, IO[bytes]], **kwargs: Any - ) -> Optional[_models.SubvolumeInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -578,7 +575,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.SubvolumeInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -602,10 +599,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -613,16 +610,15 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SubvolumeInfo", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SubvolumeInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -765,10 +761,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SubvolumeInfo", pipeline_response) + deserialized = self._deserialize("SubvolumeInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -801,7 +798,7 @@ def _update_initial( subvolume_name: str, body: Union[_models.SubvolumePatchRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.SubvolumeInfo]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -815,7 +812,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.SubvolumeInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -839,10 +836,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -850,13 +847,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SubvolumeInfo", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -999,10 +998,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SubvolumeInfo", pipeline_response) + deserialized = self._deserialize("SubvolumeInfo", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1026,7 +1026,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, account_name: str, @@ -1034,7 +1034,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements volume_name: str, subvolume_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1047,7 +1047,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -1060,10 +1060,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1071,12 +1071,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -1116,7 +1124,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1128,6 +1136,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1159,7 +1168,7 @@ def _get_metadata_initial( volume_name: str, subvolume_name: str, **kwargs: Any - ) -> Optional[_models.SubvolumeModel]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1172,7 +1181,7 @@ def _get_metadata_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.SubvolumeModel]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_get_metadata_request( resource_group_name=resource_group_name, @@ -1185,10 +1194,10 @@ def _get_metadata_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1196,13 +1205,15 @@ def _get_metadata_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SubvolumeModel", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1260,10 +1271,11 @@ def begin_get_metadata( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SubvolumeModel", pipeline_response) + deserialized = self._deserialize("SubvolumeModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_groups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_groups_operations.py index e401c414f36c2..dd5f5692b05a6 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_groups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_groups_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -50,7 +50,7 @@ def build_list_by_net_app_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +128,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -174,7 +174,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -272,7 +272,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -288,7 +287,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -360,7 +358,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +372,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VolumeGroupDetails", pipeline_response) + deserialized = self._deserialize("VolumeGroupDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -389,7 +386,7 @@ def _create_initial( volume_group_name: str, body: Union[_models.VolumeGroupDetails, IO[bytes]], **kwargs: Any - ) -> _models.VolumeGroupDetails: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -403,7 +400,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VolumeGroupDetails] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -425,10 +422,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -436,11 +433,15 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VolumeGroupDetails", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -569,10 +570,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VolumeGroupDetails", pipeline_response) + deserialized = self._deserialize("VolumeGroupDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -594,9 +596,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, account_name: str, volume_group_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -609,7 +611,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -620,10 +622,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -631,12 +633,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -666,7 +676,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, volume_group_name=volume_group_name, @@ -676,6 +686,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_quota_rules_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_quota_rules_operations.py index e904d329d3577..862d6d99edb56 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_quota_rules_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_quota_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -50,7 +50,7 @@ def build_list_by_volume_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +145,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -196,7 +196,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -247,7 +247,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -350,7 +350,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -366,7 +365,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -450,7 +448,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -465,7 +462,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) + deserialized = self._deserialize("VolumeQuotaRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -481,7 +478,7 @@ def _create_initial( volume_quota_rule_name: str, body: Union[_models.VolumeQuotaRule, IO[bytes]], **kwargs: Any - ) -> _models.VolumeQuotaRule: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -495,7 +492,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VolumeQuotaRule] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -519,10 +516,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -530,15 +527,15 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -681,10 +678,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) + deserialized = self._deserialize("VolumeQuotaRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -717,7 +715,7 @@ def _update_initial( volume_quota_rule_name: str, body: Union[_models.VolumeQuotaRulePatch, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VolumeQuotaRule]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -731,7 +729,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VolumeQuotaRule]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -755,10 +753,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -766,13 +764,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -915,10 +915,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VolumeQuotaRule", pipeline_response) + deserialized = self._deserialize("VolumeQuotaRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -942,7 +943,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, account_name: str, @@ -950,7 +951,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements volume_name: str, volume_quota_rule_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -963,7 +964,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -976,10 +977,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -987,12 +988,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -1032,7 +1041,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1044,6 +1053,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volumes_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volumes_operations.py index 18e35b65c7133..0c3574ed7f1b2 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volumes_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volumes_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -50,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -173,7 +173,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -224,7 +224,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -267,7 +267,7 @@ def build_populate_availability_zone_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -308,7 +308,7 @@ def build_revert_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -352,7 +352,7 @@ def build_reset_cifs_password_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -393,7 +393,7 @@ def build_break_file_locks_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -437,7 +437,7 @@ def build_list_get_group_id_list_for_ldap_user_request( # pylint: disable=name- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -481,7 +481,7 @@ def build_break_replication_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -525,7 +525,7 @@ def build_reestablish_replication_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -569,7 +569,7 @@ def build_replication_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -610,7 +610,7 @@ def build_list_replications_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -651,7 +651,7 @@ def build_resync_replication_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -692,7 +692,7 @@ def build_delete_replication_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -733,7 +733,7 @@ def build_authorize_replication_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -777,7 +777,7 @@ def build_re_initialize_replication_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -818,7 +818,7 @@ def build_pool_change_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -862,7 +862,7 @@ def build_relocate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -906,7 +906,7 @@ def build_finalize_relocation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -947,7 +947,7 @@ def build_revert_relocation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1046,7 +1046,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1062,7 +1061,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1137,7 +1135,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1152,7 +1149,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Volume", pipeline_response) + deserialized = self._deserialize("Volume", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1167,7 +1164,7 @@ def _create_or_update_initial( volume_name: str, body: Union[_models.Volume, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Volume]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1181,7 +1178,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Volume]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1204,10 +1201,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1215,16 +1212,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Volume", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Volume", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1354,10 +1350,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Volume", pipeline_response) + deserialized = self._deserialize("Volume", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1389,7 +1386,7 @@ def _update_initial( volume_name: str, body: Union[_models.VolumePatch, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Volume]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1403,7 +1400,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Volume]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1426,10 +1423,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1437,13 +1434,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Volume", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1573,10 +1572,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Volume", pipeline_response) + deserialized = self._deserialize("Volume", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1600,7 +1600,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, account_name: str, @@ -1608,7 +1608,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements volume_name: str, force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1621,7 +1621,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -1634,10 +1634,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1645,12 +1645,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -1691,7 +1699,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -1703,6 +1711,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1728,7 +1737,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _populate_availability_zone_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> Optional[_models.Volume]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1741,7 +1750,7 @@ def _populate_availability_zone_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.Volume]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_populate_availability_zone_request( resource_group_name=resource_group_name, @@ -1753,10 +1762,10 @@ def _populate_availability_zone_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1764,18 +1773,20 @@ def _populate_availability_zone_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Volume", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1822,10 +1833,11 @@ def begin_populate_availability_zone( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Volume", pipeline_response) + deserialized = self._deserialize("Volume", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1849,7 +1861,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _revert_initial( # pylint: disable=inconsistent-return-statements + def _revert_initial( self, resource_group_name: str, account_name: str, @@ -1857,7 +1869,7 @@ def _revert_initial( # pylint: disable=inconsistent-return-statements volume_name: str, body: Union[_models.VolumeRevert, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1871,7 +1883,7 @@ def _revert_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1894,10 +1906,10 @@ def _revert_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1905,12 +1917,20 @@ def _revert_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_revert( @@ -2022,7 +2042,7 @@ def begin_revert( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._revert_initial( # type: ignore + raw_result = self._revert_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -2035,6 +2055,7 @@ def begin_revert( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2058,9 +2079,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-statements + def _reset_cifs_password_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2073,7 +2094,7 @@ def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-stateme _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_reset_cifs_password_request( resource_group_name=resource_group_name, @@ -2085,10 +2106,10 @@ def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2096,6 +2117,10 @@ def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2103,8 +2128,12 @@ def _reset_cifs_password_initial( # pylint: disable=inconsistent-return-stateme response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_reset_cifs_password( @@ -2136,7 +2165,7 @@ def begin_reset_cifs_password( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._reset_cifs_password_initial( # type: ignore + raw_result = self._reset_cifs_password_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -2147,6 +2176,7 @@ def begin_reset_cifs_password( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2168,7 +2198,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _break_file_locks_initial( # pylint: disable=inconsistent-return-statements + def _break_file_locks_initial( self, resource_group_name: str, account_name: str, @@ -2176,7 +2206,7 @@ def _break_file_locks_initial( # pylint: disable=inconsistent-return-statements volume_name: str, body: Optional[Union[_models.BreakFileLocksRequest, IO[bytes]]] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2190,7 +2220,7 @@ def _break_file_locks_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2216,10 +2246,10 @@ def _break_file_locks_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2227,6 +2257,10 @@ def _break_file_locks_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2235,8 +2269,12 @@ def _break_file_locks_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_break_file_locks( @@ -2350,7 +2388,7 @@ def begin_break_file_locks( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._break_file_locks_initial( # type: ignore + raw_result = self._break_file_locks_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -2363,6 +2401,7 @@ def begin_break_file_locks( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2394,7 +2433,7 @@ def _list_get_group_id_list_for_ldap_user_initial( # pylint: disable=name-too-l volume_name: str, body: Union[_models.GetGroupIdListForLDAPUserRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.GetGroupIdListForLDAPUserResponse]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2408,7 +2447,7 @@ def _list_get_group_id_list_for_ldap_user_initial( # pylint: disable=name-too-l api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.GetGroupIdListForLDAPUserResponse]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2431,10 +2470,10 @@ def _list_get_group_id_list_for_ldap_user_initial( # pylint: disable=name-too-l headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2442,18 +2481,20 @@ def _list_get_group_id_list_for_ldap_user_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("GetGroupIdListForLDAPUserResponse", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2588,10 +2629,11 @@ def begin_list_get_group_id_list_for_ldap_user( # pylint: disable=name-too-long params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GetGroupIdListForLDAPUserResponse", pipeline_response) + deserialized = self._deserialize("GetGroupIdListForLDAPUserResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2615,7 +2657,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _break_replication_initial( # pylint: disable=inconsistent-return-statements + def _break_replication_initial( self, resource_group_name: str, account_name: str, @@ -2623,7 +2665,7 @@ def _break_replication_initial( # pylint: disable=inconsistent-return-statement volume_name: str, body: Optional[Union[_models.BreakReplicationRequest, IO[bytes]]] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2637,7 +2679,7 @@ def _break_replication_initial( # pylint: disable=inconsistent-return-statement api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2663,10 +2705,10 @@ def _break_replication_initial( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2674,12 +2716,20 @@ def _break_replication_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_break_replication( @@ -2791,7 +2841,7 @@ def begin_break_replication( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._break_replication_initial( # type: ignore + raw_result = self._break_replication_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -2804,6 +2854,7 @@ def begin_break_replication( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2827,7 +2878,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _reestablish_replication_initial( # pylint: disable=inconsistent-return-statements + def _reestablish_replication_initial( self, resource_group_name: str, account_name: str, @@ -2835,7 +2886,7 @@ def _reestablish_replication_initial( # pylint: disable=inconsistent-return-sta volume_name: str, body: Union[_models.ReestablishReplicationRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2849,7 +2900,7 @@ def _reestablish_replication_initial( # pylint: disable=inconsistent-return-sta api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2872,10 +2923,10 @@ def _reestablish_replication_initial( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2883,12 +2934,20 @@ def _reestablish_replication_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_reestablish_replication( @@ -3003,7 +3062,7 @@ def begin_reestablish_replication( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._reestablish_replication_initial( # type: ignore + raw_result = self._reestablish_replication_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -3016,6 +3075,7 @@ def begin_reestablish_replication( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3084,7 +3144,6 @@ def replication_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -3099,7 +3158,7 @@ def replication_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ReplicationStatus", pipeline_response) + deserialized = self._deserialize("ReplicationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3154,7 +3213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -3170,7 +3228,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -3200,9 +3257,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _resync_replication_initial( # pylint: disable=inconsistent-return-statements + def _resync_replication_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3215,7 +3272,7 @@ def _resync_replication_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_resync_replication_request( resource_group_name=resource_group_name, @@ -3227,10 +3284,10 @@ def _resync_replication_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3238,12 +3295,20 @@ def _resync_replication_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_resync_replication( @@ -3276,7 +3341,7 @@ def begin_resync_replication( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._resync_replication_initial( # type: ignore + raw_result = self._resync_replication_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -3287,6 +3352,7 @@ def begin_resync_replication( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3310,9 +3376,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_replication_initial( # pylint: disable=inconsistent-return-statements + def _delete_replication_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3325,7 +3391,7 @@ def _delete_replication_initial( # pylint: disable=inconsistent-return-statemen _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_replication_request( resource_group_name=resource_group_name, @@ -3337,10 +3403,10 @@ def _delete_replication_initial( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3348,12 +3414,20 @@ def _delete_replication_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete_replication( @@ -3386,7 +3460,7 @@ def begin_delete_replication( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_replication_initial( # type: ignore + raw_result = self._delete_replication_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -3397,6 +3471,7 @@ def begin_delete_replication( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3420,7 +3495,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _authorize_replication_initial( # pylint: disable=inconsistent-return-statements + def _authorize_replication_initial( self, resource_group_name: str, account_name: str, @@ -3428,7 +3503,7 @@ def _authorize_replication_initial( # pylint: disable=inconsistent-return-state volume_name: str, body: Union[_models.AuthorizeRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3442,7 +3517,7 @@ def _authorize_replication_initial( # pylint: disable=inconsistent-return-state api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3465,10 +3540,10 @@ def _authorize_replication_initial( # pylint: disable=inconsistent-return-state headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3476,12 +3551,20 @@ def _authorize_replication_initial( # pylint: disable=inconsistent-return-state response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_authorize_replication( @@ -3593,7 +3676,7 @@ def begin_authorize_replication( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._authorize_replication_initial( # type: ignore + raw_result = self._authorize_replication_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -3606,6 +3689,7 @@ def begin_authorize_replication( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3629,9 +3713,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _re_initialize_replication_initial( # pylint: disable=inconsistent-return-statements + def _re_initialize_replication_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3644,7 +3728,7 @@ def _re_initialize_replication_initial( # pylint: disable=inconsistent-return-s _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_re_initialize_replication_request( resource_group_name=resource_group_name, @@ -3656,10 +3740,10 @@ def _re_initialize_replication_initial( # pylint: disable=inconsistent-return-s headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3667,12 +3751,20 @@ def _re_initialize_replication_initial( # pylint: disable=inconsistent-return-s response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_re_initialize_replication( @@ -3704,7 +3796,7 @@ def begin_re_initialize_replication( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._re_initialize_replication_initial( # type: ignore + raw_result = self._re_initialize_replication_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -3715,6 +3807,7 @@ def begin_re_initialize_replication( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3738,7 +3831,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _pool_change_initial( # pylint: disable=inconsistent-return-statements + def _pool_change_initial( self, resource_group_name: str, account_name: str, @@ -3746,7 +3839,7 @@ def _pool_change_initial( # pylint: disable=inconsistent-return-statements volume_name: str, body: Union[_models.PoolChangeRequest, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3760,7 +3853,7 @@ def _pool_change_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3783,10 +3876,10 @@ def _pool_change_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3794,12 +3887,20 @@ def _pool_change_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_pool_change( @@ -3911,7 +4012,7 @@ def begin_pool_change( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._pool_change_initial( # type: ignore + raw_result = self._pool_change_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -3924,6 +4025,7 @@ def begin_pool_change( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -3947,7 +4049,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _relocate_initial( # pylint: disable=inconsistent-return-statements + def _relocate_initial( self, resource_group_name: str, account_name: str, @@ -3955,7 +4057,7 @@ def _relocate_initial( # pylint: disable=inconsistent-return-statements volume_name: str, body: Optional[Union[_models.RelocateVolumeRequest, IO[bytes]]] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3969,7 +4071,7 @@ def _relocate_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -3995,10 +4097,10 @@ def _relocate_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4006,12 +4108,20 @@ def _relocate_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_relocate( @@ -4123,7 +4233,7 @@ def begin_relocate( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._relocate_initial( # type: ignore + raw_result = self._relocate_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -4136,6 +4246,7 @@ def begin_relocate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4157,9 +4268,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _finalize_relocation_initial( # pylint: disable=inconsistent-return-statements + def _finalize_relocation_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4172,7 +4283,7 @@ def _finalize_relocation_initial( # pylint: disable=inconsistent-return-stateme _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_finalize_relocation_request( resource_group_name=resource_group_name, @@ -4184,10 +4295,10 @@ def _finalize_relocation_initial( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4195,12 +4306,20 @@ def _finalize_relocation_initial( # pylint: disable=inconsistent-return-stateme response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_finalize_relocation( @@ -4232,7 +4351,7 @@ def begin_finalize_relocation( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._finalize_relocation_initial( # type: ignore + raw_result = self._finalize_relocation_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -4243,6 +4362,7 @@ def begin_finalize_relocation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -4264,9 +4384,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _revert_relocation_initial( # pylint: disable=inconsistent-return-statements + def _revert_relocation_initial( self, resource_group_name: str, account_name: str, pool_name: str, volume_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4279,7 +4399,7 @@ def _revert_relocation_initial( # pylint: disable=inconsistent-return-statement _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_revert_relocation_request( resource_group_name=resource_group_name, @@ -4291,10 +4411,10 @@ def _revert_relocation_initial( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4302,12 +4422,20 @@ def _revert_relocation_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_revert_relocation( @@ -4340,7 +4468,7 @@ def begin_revert_relocation( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._revert_relocation_initial( # type: ignore + raw_result = self._revert_relocation_initial( resource_group_name=resource_group_name, account_name=account_name, pool_name=pool_name, @@ -4351,6 +4479,7 @@ def begin_revert_relocation( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/netapp/azure-mgmt-netapp/dev_requirements.txt b/sdk/netapp/azure-mgmt-netapp/dev_requirements.txt index 605b1cafa0f26..f0407b400c19c 100644 --- a/sdk/netapp/azure-mgmt-netapp/dev_requirements.txt +++ b/sdk/netapp/azure-mgmt-netapp/dev_requirements.txt @@ -1,4 +1,5 @@ -e ../../../tools/azure-sdk-tools -e ../../../sdk/identity/azure-identity -e ../../network/azure-mgmt-network --e ../../resources/azure-mgmt-resource \ No newline at end of file +-e ../../resources/azure-mgmt-resource +aiohttp diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_create_or_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_create_or_update.py index 2f42a5f7f7319..9a32f11827c9e 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_create_or_update.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_create_or_update.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Accounts_CreateOrUpdate.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Accounts_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_create_or_update_ad.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_create_or_update_ad.py index 861c79dc70631..78468320a6701 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_create_or_update_ad.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_create_or_update_ad.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Accounts_CreateOrUpdateAD.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Accounts_CreateOrUpdateAD.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_delete.py index ce96aac17e7a8..f142f77262843 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_delete.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Accounts_Delete.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Accounts_Delete.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_get.py index 86139f32f6630..9568bd4fa4067 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_get.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Accounts_Get.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Accounts_Get.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_list.py index 6cb1ee47e0f5f..575b51de40561 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_list.py @@ -30,11 +30,13 @@ def main(): subscription_id="D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", ) - response = client.accounts.list_by_subscription() + response = client.accounts.list( + resource_group_name="myRG", + ) for item in response: print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Accounts_List.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Accounts_List.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_renew_credentials.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_renew_credentials.py index 22774e0e8e426..a55942cb80952 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_renew_credentials.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_renew_credentials.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Accounts_RenewCredentials.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Accounts_RenewCredentials.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_update.py index fb083aec4f196..b02c41bbe46b3 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_update.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/accounts_update.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Accounts_Update.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Accounts_Update.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_create.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_create.py index 0617d35c47a9b..1bb88a45d12ab 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_create.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_create.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupPolicies_Create.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupPolicies_Create.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_delete.py index 6d9a5fe5ae0e9..acc166cbec67e 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_delete.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupPolicies_Delete.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupPolicies_Delete.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_get.py index b7e05b5bf48a1..bc253ed6a7bc2 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_get.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupPolicies_Get.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupPolicies_Get.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_list.py index c99d6914411aa..1d5add643f57f 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupPolicies_List.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupPolicies_List.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_update.py index 7b3af6e905b86..3d1e09dfc3af1 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_update.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_policies_update.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupPolicies_Update.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupPolicies_Update.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_create.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_create.py index 1bc26721822d3..8d96c08570e69 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_create.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_create.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupVaults_Create.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupVaults_Create.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_delete.py index 573bf719c2f6e..033ed2c023db9 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_delete.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupVaults_Delete.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupVaults_Delete.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_get.py index dadf9782f97bf..1967f1165a106 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_get.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupVaults_Get.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupVaults_Get.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_list.py index a89d4aeaebea7..1be4da3e4d225 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupVaults_List.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupVaults_List.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_update.py index 887accae48380..eb9b96c1603fa 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_update.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backup_vaults_update.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupVaults_Update.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupVaults_Update.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_account_migrate.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_account_migrate.py index f22dcd78b3af0..80b9da2851b33 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_account_migrate.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_account_migrate.py @@ -41,6 +41,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupsUnderAccount_Migrate.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupsUnderAccount_Migrate.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_create.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_create.py index 9768736b0a7f1..8e6d46e9c051b 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_create.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_create.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupsUnderBackupVault_Create.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupsUnderBackupVault_Create.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_delete.py index 1c82cc1e27f18..4519bcb7ff93c 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_delete.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_delete.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupsUnderBackupVault_Delete.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupsUnderBackupVault_Delete.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_get.py index ccd9fb2645ee7..f2478f6a6f386 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_get.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupsUnderBackupVault_Get.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupsUnderBackupVault_Get.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_list.py index 61721633b672a..f7de26fd547ae 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupsUnderBackupVault_List.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupsUnderBackupVault_List.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_single_file_restore.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_single_file_restore.py index 48628f8e9adac..0f475c9545ddb 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_single_file_restore.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_single_file_restore.py @@ -44,6 +44,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupsUnderBackupVault_SingleFileRestore.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupsUnderBackupVault_SingleFileRestore.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_update.py index 82f0d5bd7f590..7836045b94e70 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_update.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_backup_vault_update.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupsUnderBackupVault_Update.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupsUnderBackupVault_Update.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_volume_migrate.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_volume_migrate.py index 3f170ce7b9575..82ea77a9efada 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_volume_migrate.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/backups_under_volume_migrate.py @@ -43,6 +43,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/BackupsUnderVolume_Migrate.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/BackupsUnderVolume_Migrate.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/group_id_list_for_ldap_user.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/group_id_list_for_ldap_user.py index 5c49dee9b65c3..de66acbf90048 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/group_id_list_for_ldap_user.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/group_id_list_for_ldap_user.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/GroupIdListForLDAPUser.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/GroupIdListForLDAPUser.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/operation_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/operation_list.py index ba30d6b72c80a..99f6e31ee67b7 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/operation_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/operation_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/OperationList.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/OperationList.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_create_or_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_create_or_update.py index 615d6a6546656..28ecb72603b90 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_create_or_update.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_create_or_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Pools_CreateOrUpdate.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Pools_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_delete.py index e06330d58eb87..81fc85b14855f 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_delete.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Pools_Delete.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Pools_Delete.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_get.py index 3c01d19d4928a..ca7e0478cad65 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_get.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Pools_Get.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Pools_Get.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_list.py index 8795f484955d5..f2ba839701c85 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/pools_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Pools_List.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Pools_List.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_get.py index bf3ce4a9ae960..2c130968c24a8 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_get.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/QuotaLimits_Get.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/QuotaLimits_Get.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_list.py index 211f2713867df..4b4ec4fd8afa2 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/quota_limits_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/QuotaLimits_List.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/QuotaLimits_List.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/region_info.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/region_info.py index 03f595a5c2ba6..1a56ecad70c93 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/region_info.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/region_info.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/RegionInfo.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/RegionInfo.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/region_infos_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/region_infos_get.py index b032578d6b42a..beda92df4627a 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/region_infos_get.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/region_infos_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/RegionInfos_Get.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/RegionInfos_Get.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/region_infos_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/region_infos_list.py index 54c4cb4cab369..cd4e2790e8a3d 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/region_infos_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/region_infos_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/RegionInfos_List.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/RegionInfos_List.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_create.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_create.py index ff82de19580ce..db1ad8943ccbc 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_create.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_create.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/SnapshotPolicies_Create.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/SnapshotPolicies_Create.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_delete.py index bea0266e36028..8da3b1bb31136 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_delete.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/SnapshotPolicies_Delete.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/SnapshotPolicies_Delete.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_get.py index effc8aa158d17..8bc3d6616bea9 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_get.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/SnapshotPolicies_Get.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/SnapshotPolicies_Get.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list.py index 2abd8047ebc79..028dfca49e1cb 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/SnapshotPolicies_List.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/SnapshotPolicies_List.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list_volumes.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list_volumes.py index 39ae4b023a5e0..fea2521a53448 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list_volumes.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_list_volumes.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/SnapshotPolicies_ListVolumes.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/SnapshotPolicies_ListVolumes.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_update.py index dd224f3074aa5..0a9ad73c483e3 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_update.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshot_policies_update.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/SnapshotPolicies_Update.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/SnapshotPolicies_Update.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_create.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_create.py index 72f61f38c8077..c8a5420cdbcc5 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_create.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_create.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Snapshots_Create.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Snapshots_Create.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_delete.py index 172c57c376d5e..d0735e7130888 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_delete.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_delete.py @@ -39,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Snapshots_Delete.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Snapshots_Delete.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_get.py index 4913247316f29..cbb77028fa142 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_get.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_get.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Snapshots_Get.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Snapshots_Get.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_list.py index d32cdefe3482a..e547111968777 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_list.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Snapshots_List.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Snapshots_List.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_single_file_restore.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_single_file_restore.py index 37a458105e9a0..53c9f023174ec 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_single_file_restore.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/snapshots_single_file_restore.py @@ -42,6 +42,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Snapshots_SingleFileRestore.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Snapshots_SingleFileRestore.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_create.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_create.py index 10042af443fac..19930ddb1d7a1 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_create.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_create.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Subvolumes_Create.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Subvolumes_Create.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_delete.py index 4f66255d495cd..c23fbe0f584c4 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_delete.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_delete.py @@ -39,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Subvolumes_Delete.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Subvolumes_Delete.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_get.py index c67001d05e35f..9a9fc83b54a5b 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_get.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_get.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Subvolumes_Get.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Subvolumes_Get.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_list.py index f13fce4fe29c3..3516158485ed8 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_list.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Subvolumes_List.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Subvolumes_List.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_metadata.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_metadata.py index ce127721a8d65..eb35b091dee87 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_metadata.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_metadata.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Subvolumes_Metadata.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Subvolumes_Metadata.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_update.py index 3f3c916772873..dcd316786a95d 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_update.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/subvolumes_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Subvolumes_Update.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Subvolumes_Update.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_create_oracle.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_create_oracle.py index efe3709aea908..aacdbef2c00b9 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_create_oracle.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_create_oracle.py @@ -460,6 +460,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/VolumeGroups_Create_Oracle.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/VolumeGroups_Create_Oracle.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_create_sap_hana.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_create_sap_hana.py index 4d2966eaa9b71..09de35302684c 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_create_sap_hana.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_create_sap_hana.py @@ -222,6 +222,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/VolumeGroups_Create_SapHana.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/VolumeGroups_Create_SapHana.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_delete.py index fde0cac71dc6b..c729e0d21efe1 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_delete.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/VolumeGroups_Delete.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/VolumeGroups_Delete.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_get_oracle.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_get_oracle.py index 728904c0063a2..0ab4fb456fe7f 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_get_oracle.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_get_oracle.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/VolumeGroups_Get_Oracle.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/VolumeGroups_Get_Oracle.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_get_sap_hana.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_get_sap_hana.py index b7270c98f4e72..c075336a6e331 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_get_sap_hana.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_get_sap_hana.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/VolumeGroups_Get_SapHana.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/VolumeGroups_Get_SapHana.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_list_oracle.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_list_oracle.py index 1538da7ec9a8d..46bb60d36af3e 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_list_oracle.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_list_oracle.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/VolumeGroups_List_Oracle.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/VolumeGroups_List_Oracle.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_list_sap_hana.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_list_sap_hana.py index db769c62191c9..a5ef208c45495 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_list_sap_hana.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_groups_list_sap_hana.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/VolumeGroups_List_SapHana.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/VolumeGroups_List_SapHana.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_create.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_create.py index d260f055e9f3a..864abfecbd54f 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_create.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_create.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/VolumeQuotaRules_Create.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/VolumeQuotaRules_Create.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_delete.py index f8038a61ba7e7..d2ea9f22c3fd0 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_delete.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_delete.py @@ -39,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/VolumeQuotaRules_Delete.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/VolumeQuotaRules_Delete.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_get.py index bb2a11d7e6ea6..181bd10982aa6 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_get.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_get.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/VolumeQuotaRules_Get.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/VolumeQuotaRules_Get.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_list.py index 037f562ded4e6..2481b5552aabe 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_list.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/VolumeQuotaRules_List.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/VolumeQuotaRules_List.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_update.py index a2d6cd23c6834..7ea74df2e9c0e 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_update.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volume_quota_rules_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/VolumeQuotaRules_Update.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/VolumeQuotaRules_Update.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_authorize_replication.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_authorize_replication.py index 21e9d38d3d1f4..e01de4f6b9615 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_authorize_replication.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_authorize_replication.py @@ -43,6 +43,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_AuthorizeReplication.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_AuthorizeReplication.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_break_file_locks.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_break_file_locks.py index 85159711a4ff4..5686bcf55f743 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_break_file_locks.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_break_file_locks.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_BreakFileLocks.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_BreakFileLocks.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_break_replication.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_break_replication.py index b31f4b5195d8f..27acfc19b39e6 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_break_replication.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_break_replication.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_BreakReplication.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_BreakReplication.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_create_or_update.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_create_or_update.py index 3ef2fd47843d2..44a5764230029 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_create_or_update.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_create_or_update.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_CreateOrUpdate.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete.py index bfa9249148d53..88fad9af83b3d 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_Delete.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_Delete.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete_replication.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete_replication.py index 685395c0f7e44..de894aa5e67b1 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete_replication.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_delete_replication.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_DeleteReplication.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_DeleteReplication.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_finalize_relocation.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_finalize_relocation.py index ff960dd1e608b..e91201a6a2696 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_finalize_relocation.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_finalize_relocation.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_FinalizeRelocation.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_FinalizeRelocation.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_get.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_get.py index 8c7a8354df120..8c86edbbfbcfe 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_get.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_Get.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_Get.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_latest_backup_status.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_latest_backup_status.py index 4162ca533d2fc..48567f32ed797 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_latest_backup_status.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_latest_backup_status.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_LatestBackupStatus.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_LatestBackupStatus.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_latest_restore_status.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_latest_restore_status.py index 69241819efc79..f35bb9c6c33b2 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_latest_restore_status.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_latest_restore_status.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_LatestRestoreStatus.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_LatestRestoreStatus.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list.py index 7fb20b9a1ee62..9c66dea7ca0e8 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_List.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_List.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list_replications.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list_replications.py index 21d1942e98da2..1575ba0711220 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list_replications.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_list_replications.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_ListReplications.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_ListReplications.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_pool_change.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_pool_change.py index 033088e941612..22c575b830893 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_pool_change.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_pool_change.py @@ -43,6 +43,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_PoolChange.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_PoolChange.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_populate_availability_zones.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_populate_availability_zones.py index aff6012429281..fe8b6111252e9 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_populate_availability_zones.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_populate_availability_zones.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_PopulateAvailabilityZones.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_PopulateAvailabilityZones.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_re_initialize_replication.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_re_initialize_replication.py index fa5ea44aaa6ae..290743793198f 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_re_initialize_replication.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_re_initialize_replication.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_ReInitializeReplication.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_ReInitializeReplication.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reestablish_replication.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reestablish_replication.py index 90a1e5417849f..3da5b4ea8f8e3 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reestablish_replication.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reestablish_replication.py @@ -43,6 +43,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_ReestablishReplication.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_ReestablishReplication.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_relocate.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_relocate.py index 4ac5de68a2d4a..fd21d6a7d1532 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_relocate.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_relocate.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_Relocate.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_Relocate.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_replication_status.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_replication_status.py index ff0cd7736bd39..b5f75e1332aab 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_replication_status.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_replication_status.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_ReplicationStatus.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_ReplicationStatus.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reset_cifs_password.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reset_cifs_password.py index e7462dcd0e088..ae35ee0174236 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reset_cifs_password.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_reset_cifs_password.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_ResetCifsPassword.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_ResetCifsPassword.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_resync_replication.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_resync_replication.py index 6a5d25977a24c..e031b49699b51 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_resync_replication.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_resync_replication.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_ResyncReplication.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_ResyncReplication.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert.py index 5d0bb531d4eb5..de8c67604c515 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert.py @@ -43,6 +43,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_Revert.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_Revert.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert_relocation.py b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert_relocation.py index 10f88c331e288..d5f241b0caf36 100644 --- a/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert_relocation.py +++ b/sdk/netapp/azure-mgmt-netapp/generated_samples/volumes_revert_relocation.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-11-01/examples/Volumes_RevertRelocation.json +# x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2024-03-01/examples/Volumes_RevertRelocation.json if __name__ == "__main__": main() diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/conftest.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/conftest.py new file mode 100644 index 0000000000000..5e9c2e5e14c19 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# 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. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + netappmanagement_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + netappmanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + netappmanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + netappmanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=netappmanagement_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=netappmanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=netappmanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=netappmanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_accounts_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_accounts_operations.py new file mode 100644 index 0000000000000..ececad23010b7 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_accounts_operations.py @@ -0,0 +1,215 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementAccountsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.accounts.list_by_subscription( + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.accounts.list( + resource_group_name=resource_group.name, + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.accounts.get( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.accounts.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + body={ + "location": "str", + "activeDirectories": [ + { + "activeDirectoryId": "str", + "adName": "str", + "administrators": ["str"], + "aesEncryption": bool, + "allowLocalNfsUsersWithLdap": bool, + "backupOperators": ["str"], + "dns": "str", + "domain": "str", + "encryptDCConnections": bool, + "kdcIP": "str", + "ldapOverTLS": bool, + "ldapSearchScope": {"groupDN": "str", "groupMembershipFilter": "str", "userDN": "str"}, + "ldapSigning": bool, + "organizationalUnit": "CN=Computers", + "password": "str", + "preferredServersForLdapClient": "str", + "securityOperators": ["str"], + "serverRootCACertificate": "str", + "site": "str", + "smbServerName": "str", + "status": "str", + "statusDetails": "str", + "username": "str", + } + ], + "disableShowmount": bool, + "encryption": { + "identity": {"principalId": "str", "userAssignedIdentity": "str"}, + "keySource": "Microsoft.NetApp", + "keyVaultProperties": { + "keyName": "str", + "keyVaultUri": "str", + "keyVaultId": "str", + "keyVaultResourceId": "str", + "status": "str", + }, + }, + "etag": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.accounts.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.accounts.begin_update( + resource_group_name=resource_group.name, + account_name="str", + body={ + "activeDirectories": [ + { + "activeDirectoryId": "str", + "adName": "str", + "administrators": ["str"], + "aesEncryption": bool, + "allowLocalNfsUsersWithLdap": bool, + "backupOperators": ["str"], + "dns": "str", + "domain": "str", + "encryptDCConnections": bool, + "kdcIP": "str", + "ldapOverTLS": bool, + "ldapSearchScope": {"groupDN": "str", "groupMembershipFilter": "str", "userDN": "str"}, + "ldapSigning": bool, + "organizationalUnit": "CN=Computers", + "password": "str", + "preferredServersForLdapClient": "str", + "securityOperators": ["str"], + "serverRootCACertificate": "str", + "site": "str", + "smbServerName": "str", + "status": "str", + "statusDetails": "str", + "username": "str", + } + ], + "disableShowmount": bool, + "encryption": { + "identity": {"principalId": "str", "userAssignedIdentity": "str"}, + "keySource": "Microsoft.NetApp", + "keyVaultProperties": { + "keyName": "str", + "keyVaultUri": "str", + "keyVaultId": "str", + "keyVaultResourceId": "str", + "status": "str", + }, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_renew_credentials(self, resource_group): + response = self.client.accounts.begin_renew_credentials( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_accounts_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_accounts_operations_async.py new file mode 100644 index 0000000000000..e7ca6676b2629 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_accounts_operations_async.py @@ -0,0 +1,224 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementAccountsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.accounts.list_by_subscription( + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.accounts.list( + resource_group_name=resource_group.name, + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.accounts.get( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.accounts.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + body={ + "location": "str", + "activeDirectories": [ + { + "activeDirectoryId": "str", + "adName": "str", + "administrators": ["str"], + "aesEncryption": bool, + "allowLocalNfsUsersWithLdap": bool, + "backupOperators": ["str"], + "dns": "str", + "domain": "str", + "encryptDCConnections": bool, + "kdcIP": "str", + "ldapOverTLS": bool, + "ldapSearchScope": {"groupDN": "str", "groupMembershipFilter": "str", "userDN": "str"}, + "ldapSigning": bool, + "organizationalUnit": "CN=Computers", + "password": "str", + "preferredServersForLdapClient": "str", + "securityOperators": ["str"], + "serverRootCACertificate": "str", + "site": "str", + "smbServerName": "str", + "status": "str", + "statusDetails": "str", + "username": "str", + } + ], + "disableShowmount": bool, + "encryption": { + "identity": {"principalId": "str", "userAssignedIdentity": "str"}, + "keySource": "Microsoft.NetApp", + "keyVaultProperties": { + "keyName": "str", + "keyVaultUri": "str", + "keyVaultId": "str", + "keyVaultResourceId": "str", + "status": "str", + }, + }, + "etag": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.accounts.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.accounts.begin_update( + resource_group_name=resource_group.name, + account_name="str", + body={ + "activeDirectories": [ + { + "activeDirectoryId": "str", + "adName": "str", + "administrators": ["str"], + "aesEncryption": bool, + "allowLocalNfsUsersWithLdap": bool, + "backupOperators": ["str"], + "dns": "str", + "domain": "str", + "encryptDCConnections": bool, + "kdcIP": "str", + "ldapOverTLS": bool, + "ldapSearchScope": {"groupDN": "str", "groupMembershipFilter": "str", "userDN": "str"}, + "ldapSigning": bool, + "organizationalUnit": "CN=Computers", + "password": "str", + "preferredServersForLdapClient": "str", + "securityOperators": ["str"], + "serverRootCACertificate": "str", + "site": "str", + "smbServerName": "str", + "status": "str", + "statusDetails": "str", + "username": "str", + } + ], + "disableShowmount": bool, + "encryption": { + "identity": {"principalId": "str", "userAssignedIdentity": "str"}, + "keySource": "Microsoft.NetApp", + "keyVaultProperties": { + "keyName": "str", + "keyVaultUri": "str", + "keyVaultId": "str", + "keyVaultResourceId": "str", + "status": "str", + }, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_renew_credentials(self, resource_group): + response = await ( + await self.client.accounts.begin_renew_credentials( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backup_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backup_policies_operations.py new file mode 100644 index 0000000000000..6635f10eb1670 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backup_policies_operations.py @@ -0,0 +1,126 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementBackupPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.backup_policies.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.backup_policies.get( + resource_group_name=resource_group.name, + account_name="str", + backup_policy_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.backup_policies.begin_create( + resource_group_name=resource_group.name, + account_name="str", + backup_policy_name="str", + body={ + "location": "str", + "backupPolicyId": "str", + "dailyBackupsToKeep": 0, + "enabled": bool, + "etag": "str", + "id": "str", + "monthlyBackupsToKeep": 0, + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "volumeBackups": [ + {"backupsCount": 0, "policyEnabled": bool, "volumeName": "str", "volumeResourceId": "str"} + ], + "volumesAssigned": 0, + "weeklyBackupsToKeep": 0, + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.backup_policies.begin_update( + resource_group_name=resource_group.name, + account_name="str", + backup_policy_name="str", + body={ + "backupPolicyId": "str", + "dailyBackupsToKeep": 0, + "enabled": bool, + "id": "str", + "location": "str", + "monthlyBackupsToKeep": 0, + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + "volumeBackups": [ + {"backupsCount": 0, "policyEnabled": bool, "volumeName": "str", "volumeResourceId": "str"} + ], + "volumesAssigned": 0, + "weeklyBackupsToKeep": 0, + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.backup_policies.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + backup_policy_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backup_policies_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backup_policies_operations_async.py new file mode 100644 index 0000000000000..f27b981ea5977 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backup_policies_operations_async.py @@ -0,0 +1,133 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementBackupPoliciesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.backup_policies.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.backup_policies.get( + resource_group_name=resource_group.name, + account_name="str", + backup_policy_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.backup_policies.begin_create( + resource_group_name=resource_group.name, + account_name="str", + backup_policy_name="str", + body={ + "location": "str", + "backupPolicyId": "str", + "dailyBackupsToKeep": 0, + "enabled": bool, + "etag": "str", + "id": "str", + "monthlyBackupsToKeep": 0, + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "volumeBackups": [ + {"backupsCount": 0, "policyEnabled": bool, "volumeName": "str", "volumeResourceId": "str"} + ], + "volumesAssigned": 0, + "weeklyBackupsToKeep": 0, + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.backup_policies.begin_update( + resource_group_name=resource_group.name, + account_name="str", + backup_policy_name="str", + body={ + "backupPolicyId": "str", + "dailyBackupsToKeep": 0, + "enabled": bool, + "id": "str", + "location": "str", + "monthlyBackupsToKeep": 0, + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + "volumeBackups": [ + {"backupsCount": 0, "policyEnabled": bool, "volumeName": "str", "volumeResourceId": "str"} + ], + "volumesAssigned": 0, + "weeklyBackupsToKeep": 0, + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.backup_policies.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + backup_policy_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backup_vaults_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backup_vaults_operations.py new file mode 100644 index 0000000000000..9a6a8dcec0380 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backup_vaults_operations.py @@ -0,0 +1,100 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementBackupVaultsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_net_app_account(self, resource_group): + response = self.client.backup_vaults.list_by_net_app_account( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.backup_vaults.get( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.backup_vaults.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + body={ + "location": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.backup_vaults.begin_update( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + body={"tags": {"str": "str"}}, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.backup_vaults.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backup_vaults_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backup_vaults_operations_async.py new file mode 100644 index 0000000000000..4bbaa9a0a1a8c --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backup_vaults_operations_async.py @@ -0,0 +1,107 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementBackupVaultsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_net_app_account(self, resource_group): + response = self.client.backup_vaults.list_by_net_app_account( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.backup_vaults.get( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.backup_vaults.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + body={ + "location": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.backup_vaults.begin_update( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + body={"tags": {"str": "str"}}, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.backup_vaults.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_operations.py new file mode 100644 index 0000000000000..7b62cb03b029f --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_operations.py @@ -0,0 +1,140 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementBackupsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_latest_status(self, resource_group): + response = self.client.backups.get_latest_status( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_volume_latest_restore_status(self, resource_group): + response = self.client.backups.get_volume_latest_restore_status( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_vault(self, resource_group): + response = self.client.backups.list_by_vault( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.backups.get( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + backup_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.backups.begin_create( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + backup_name="str", + body={ + "volumeResourceId": "str", + "backupId": "str", + "backupPolicyResourceId": "str", + "backupType": "str", + "creationDate": "2020-02-20 00:00:00", + "failureReason": "str", + "id": "str", + "label": "str", + "name": "str", + "provisioningState": "str", + "size": 0, + "snapshotName": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "useExistingSnapshot": False, + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.backups.begin_update( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + backup_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.backups.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + backup_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_operations_async.py new file mode 100644 index 0000000000000..fe7c37d7197df --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_operations_async.py @@ -0,0 +1,147 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementBackupsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_latest_status(self, resource_group): + response = await self.client.backups.get_latest_status( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_volume_latest_restore_status(self, resource_group): + response = await self.client.backups.get_volume_latest_restore_status( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_vault(self, resource_group): + response = self.client.backups.list_by_vault( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.backups.get( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + backup_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.backups.begin_create( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + backup_name="str", + body={ + "volumeResourceId": "str", + "backupId": "str", + "backupPolicyResourceId": "str", + "backupType": "str", + "creationDate": "2020-02-20 00:00:00", + "failureReason": "str", + "id": "str", + "label": "str", + "name": "str", + "provisioningState": "str", + "size": 0, + "snapshotName": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "useExistingSnapshot": False, + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.backups.begin_update( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + backup_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.backups.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + backup_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_account_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_account_operations.py new file mode 100644 index 0000000000000..cc9e883001166 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_account_operations.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementBackupsUnderAccountOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_migrate_backups(self, resource_group): + response = self.client.backups_under_account.begin_migrate_backups( + resource_group_name=resource_group.name, + account_name="str", + body={"backupVaultId": "str"}, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_account_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_account_operations_async.py new file mode 100644 index 0000000000000..d4b3779b7cb65 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_account_operations_async.py @@ -0,0 +1,35 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementBackupsUnderAccountOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_migrate_backups(self, resource_group): + response = await ( + await self.client.backups_under_account.begin_migrate_backups( + resource_group_name=resource_group.name, + account_name="str", + body={"backupVaultId": "str"}, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_backup_vault_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_backup_vault_operations.py new file mode 100644 index 0000000000000..5275671835277 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_backup_vault_operations.py @@ -0,0 +1,34 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementBackupsUnderBackupVaultOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restore_files(self, resource_group): + response = self.client.backups_under_backup_vault.begin_restore_files( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + backup_name="str", + body={"destinationVolumeId": "str", "fileList": ["str"], "restoreFilePath": "str"}, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_backup_vault_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_backup_vault_operations_async.py new file mode 100644 index 0000000000000..b5cedb3df4375 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_backup_vault_operations_async.py @@ -0,0 +1,37 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementBackupsUnderBackupVaultOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restore_files(self, resource_group): + response = await ( + await self.client.backups_under_backup_vault.begin_restore_files( + resource_group_name=resource_group.name, + account_name="str", + backup_vault_name="str", + backup_name="str", + body={"destinationVolumeId": "str", "fileList": ["str"], "restoreFilePath": "str"}, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_volume_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_volume_operations.py new file mode 100644 index 0000000000000..08810a1f9c545 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_volume_operations.py @@ -0,0 +1,34 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementBackupsUnderVolumeOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_migrate_backups(self, resource_group): + response = self.client.backups_under_volume.begin_migrate_backups( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={"backupVaultId": "str"}, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_volume_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_volume_operations_async.py new file mode 100644 index 0000000000000..50c9e9f5a8921 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_backups_under_volume_operations_async.py @@ -0,0 +1,37 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementBackupsUnderVolumeOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_migrate_backups(self, resource_group): + response = await ( + await self.client.backups_under_volume.begin_migrate_backups( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={"backupVaultId": "str"}, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_operations.py new file mode 100644 index 0000000000000..29ad4274e3b16 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_operations.py @@ -0,0 +1,99 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementNetAppResourceOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_name_availability(self, resource_group): + response = self.client.net_app_resource.check_name_availability( + location="str", + name="str", + type="str", + resource_group="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_file_path_availability(self, resource_group): + response = self.client.net_app_resource.check_file_path_availability( + location="str", + name="str", + subnet_id="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_quota_availability(self, resource_group): + response = self.client.net_app_resource.check_quota_availability( + location="str", + name="str", + type="str", + resource_group="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_query_region_info(self, resource_group): + response = self.client.net_app_resource.query_region_info( + location="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_query_network_sibling_set(self, resource_group): + response = self.client.net_app_resource.query_network_sibling_set( + location="str", + network_sibling_set_id="str", + subnet_id="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update_network_sibling_set(self, resource_group): + response = self.client.net_app_resource.begin_update_network_sibling_set( + location="str", + network_sibling_set_id="str", + subnet_id="str", + network_sibling_set_state_id="str", + network_features="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_operations_async.py new file mode 100644 index 0000000000000..95a2213aebb75 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_operations_async.py @@ -0,0 +1,102 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementNetAppResourceOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_name_availability(self, resource_group): + response = await self.client.net_app_resource.check_name_availability( + location="str", + name="str", + type="str", + resource_group="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_file_path_availability(self, resource_group): + response = await self.client.net_app_resource.check_file_path_availability( + location="str", + name="str", + subnet_id="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_quota_availability(self, resource_group): + response = await self.client.net_app_resource.check_quota_availability( + location="str", + name="str", + type="str", + resource_group="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_query_region_info(self, resource_group): + response = await self.client.net_app_resource.query_region_info( + location="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_query_network_sibling_set(self, resource_group): + response = await self.client.net_app_resource.query_network_sibling_set( + location="str", + network_sibling_set_id="str", + subnet_id="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update_network_sibling_set(self, resource_group): + response = await ( + await self.client.net_app_resource.begin_update_network_sibling_set( + location="str", + network_sibling_set_id="str", + subnet_id="str", + network_sibling_set_state_id="str", + network_features="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_quota_limits_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_quota_limits_operations.py new file mode 100644 index 0000000000000..b3ce0f0f3eeac --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_quota_limits_operations.py @@ -0,0 +1,42 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementNetAppResourceQuotaLimitsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.net_app_resource_quota_limits.list( + location="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.net_app_resource_quota_limits.get( + location="str", + quota_limit_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_quota_limits_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_quota_limits_operations_async.py new file mode 100644 index 0000000000000..97f7a9ee320d4 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_quota_limits_operations_async.py @@ -0,0 +1,43 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementNetAppResourceQuotaLimitsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.net_app_resource_quota_limits.list( + location="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.net_app_resource_quota_limits.get( + location="str", + quota_limit_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_region_infos_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_region_infos_operations.py new file mode 100644 index 0000000000000..bc12b7940905b --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_region_infos_operations.py @@ -0,0 +1,41 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementNetAppResourceRegionInfosOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.net_app_resource_region_infos.list( + location="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.net_app_resource_region_infos.get( + location="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_region_infos_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_region_infos_operations_async.py new file mode 100644 index 0000000000000..f51f988f8754a --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_net_app_resource_region_infos_operations_async.py @@ -0,0 +1,42 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementNetAppResourceRegionInfosOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.net_app_resource_region_infos.list( + location="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.net_app_resource_region_infos.get( + location="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_operations.py new file mode 100644 index 0000000000000..53d81993652ce --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_operations.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_operations_async.py new file mode 100644 index 0000000000000..e6e73de55d5ac --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_operations_async.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_pools_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_pools_operations.py new file mode 100644 index 0000000000000..17be0b5736f55 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_pools_operations.py @@ -0,0 +1,118 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementPoolsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.pools.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.pools.get( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.pools.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + body={ + "location": "str", + "serviceLevel": "Premium", + "size": 4398046511104, + "coolAccess": False, + "encryptionType": "Single", + "etag": "str", + "id": "str", + "name": "str", + "poolId": "str", + "provisioningState": "str", + "qosType": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "totalThroughputMibps": 0.0, + "type": "str", + "utilizedThroughputMibps": 0.0, + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.pools.begin_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + body={ + "coolAccess": bool, + "id": "str", + "location": "str", + "name": "str", + "qosType": "str", + "size": 4398046511104, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.pools.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_pools_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_pools_operations_async.py new file mode 100644 index 0000000000000..61d07836b1256 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_pools_operations_async.py @@ -0,0 +1,125 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementPoolsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.pools.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.pools.get( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.pools.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + body={ + "location": "str", + "serviceLevel": "Premium", + "size": 4398046511104, + "coolAccess": False, + "encryptionType": "Single", + "etag": "str", + "id": "str", + "name": "str", + "poolId": "str", + "provisioningState": "str", + "qosType": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "totalThroughputMibps": 0.0, + "type": "str", + "utilizedThroughputMibps": 0.0, + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.pools.begin_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + body={ + "coolAccess": bool, + "id": "str", + "location": "str", + "name": "str", + "qosType": "str", + "size": 4398046511104, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.pools.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_snapshot_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_snapshot_policies_operations.py new file mode 100644 index 0000000000000..1cfe65e89d55c --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_snapshot_policies_operations.py @@ -0,0 +1,131 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementSnapshotPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.snapshot_policies.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.snapshot_policies.get( + resource_group_name=resource_group.name, + account_name="str", + snapshot_policy_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create(self, resource_group): + response = self.client.snapshot_policies.create( + resource_group_name=resource_group.name, + account_name="str", + snapshot_policy_name="str", + body={ + "location": "str", + "dailySchedule": {"hour": 0, "minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + "enabled": bool, + "etag": "str", + "hourlySchedule": {"minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + "id": "str", + "monthlySchedule": {"daysOfMonth": "str", "hour": 0, "minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "weeklySchedule": {"day": "str", "hour": 0, "minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + }, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.snapshot_policies.begin_update( + resource_group_name=resource_group.name, + account_name="str", + snapshot_policy_name="str", + body={ + "dailySchedule": {"hour": 0, "minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + "enabled": bool, + "hourlySchedule": {"minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + "id": "str", + "location": "str", + "monthlySchedule": {"daysOfMonth": "str", "hour": 0, "minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + "weeklySchedule": {"day": "str", "hour": 0, "minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.snapshot_policies.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + snapshot_policy_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_volumes(self, resource_group): + response = self.client.snapshot_policies.list_volumes( + resource_group_name=resource_group.name, + account_name="str", + snapshot_policy_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_snapshot_policies_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_snapshot_policies_operations_async.py new file mode 100644 index 0000000000000..564f918d5d829 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_snapshot_policies_operations_async.py @@ -0,0 +1,142 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementSnapshotPoliciesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.snapshot_policies.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.snapshot_policies.get( + resource_group_name=resource_group.name, + account_name="str", + snapshot_policy_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create(self, resource_group): + response = await self.client.snapshot_policies.create( + resource_group_name=resource_group.name, + account_name="str", + snapshot_policy_name="str", + body={ + "location": "str", + "dailySchedule": {"hour": 0, "minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + "enabled": bool, + "etag": "str", + "hourlySchedule": {"minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + "id": "str", + "monthlySchedule": {"daysOfMonth": "str", "hour": 0, "minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "weeklySchedule": {"day": "str", "hour": 0, "minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + }, + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.snapshot_policies.begin_update( + resource_group_name=resource_group.name, + account_name="str", + snapshot_policy_name="str", + body={ + "dailySchedule": {"hour": 0, "minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + "enabled": bool, + "hourlySchedule": {"minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + "id": "str", + "location": "str", + "monthlySchedule": { + "daysOfMonth": "str", + "hour": 0, + "minute": 0, + "snapshotsToKeep": 0, + "usedBytes": 0, + }, + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + "weeklySchedule": {"day": "str", "hour": 0, "minute": 0, "snapshotsToKeep": 0, "usedBytes": 0}, + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.snapshot_policies.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + snapshot_policy_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_volumes(self, resource_group): + response = await self.client.snapshot_policies.list_volumes( + resource_group_name=resource_group.name, + account_name="str", + snapshot_policy_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_snapshots_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_snapshots_operations.py new file mode 100644 index 0000000000000..85f75f047bb07 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_snapshots_operations.py @@ -0,0 +1,127 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementSnapshotsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.snapshots.list( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.snapshots.get( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + snapshot_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.snapshots.begin_create( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + snapshot_name="str", + body={ + "location": "str", + "created": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "provisioningState": "str", + "snapshotId": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.snapshots.begin_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + snapshot_name="str", + body={}, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.snapshots.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + snapshot_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restore_files(self, resource_group): + response = self.client.snapshots.begin_restore_files( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + snapshot_name="str", + body={"filePaths": ["str"], "destinationPath": "str"}, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_snapshots_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_snapshots_operations_async.py new file mode 100644 index 0000000000000..b9d37f82d4468 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_snapshots_operations_async.py @@ -0,0 +1,136 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementSnapshotsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.snapshots.list( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.snapshots.get( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + snapshot_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.snapshots.begin_create( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + snapshot_name="str", + body={ + "location": "str", + "created": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "provisioningState": "str", + "snapshotId": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.snapshots.begin_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + snapshot_name="str", + body={}, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.snapshots.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + snapshot_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restore_files(self, resource_group): + response = await ( + await self.client.snapshots.begin_restore_files( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + snapshot_name="str", + body={"filePaths": ["str"], "destinationPath": "str"}, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_subvolumes_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_subvolumes_operations.py new file mode 100644 index 0000000000000..055cb37d77b3b --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_subvolumes_operations.py @@ -0,0 +1,126 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementSubvolumesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_volume(self, resource_group): + response = self.client.subvolumes.list_by_volume( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.subvolumes.get( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + subvolume_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.subvolumes.begin_create( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + subvolume_name="str", + body={ + "id": "str", + "name": "str", + "parentPath": "str", + "path": "str", + "provisioningState": "str", + "size": 0, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.subvolumes.begin_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + subvolume_name="str", + body={"path": "str", "size": 0}, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.subvolumes.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + subvolume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_get_metadata(self, resource_group): + response = self.client.subvolumes.begin_get_metadata( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + subvolume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_subvolumes_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_subvolumes_operations_async.py new file mode 100644 index 0000000000000..f1cac97cbf23d --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_subvolumes_operations_async.py @@ -0,0 +1,135 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementSubvolumesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_volume(self, resource_group): + response = self.client.subvolumes.list_by_volume( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.subvolumes.get( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + subvolume_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.subvolumes.begin_create( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + subvolume_name="str", + body={ + "id": "str", + "name": "str", + "parentPath": "str", + "path": "str", + "provisioningState": "str", + "size": 0, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.subvolumes.begin_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + subvolume_name="str", + body={"path": "str", "size": 0}, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.subvolumes.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + subvolume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_get_metadata(self, resource_group): + response = await ( + await self.client.subvolumes.begin_get_metadata( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + subvolume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volume_groups_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volume_groups_operations.py new file mode 100644 index 0000000000000..e329da8ba1605 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volume_groups_operations.py @@ -0,0 +1,180 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementVolumeGroupsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_net_app_account(self, resource_group): + response = self.client.volume_groups.list_by_net_app_account( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.volume_groups.get( + resource_group_name=resource_group.name, + account_name="str", + volume_group_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.volume_groups.begin_create( + resource_group_name=resource_group.name, + account_name="str", + volume_group_name="str", + body={ + "groupMetaData": { + "applicationIdentifier": "str", + "applicationType": "str", + "globalPlacementRules": [{"key": "str", "value": "str"}], + "groupDescription": "str", + "volumesCount": 0, + }, + "id": "str", + "location": "str", + "name": "str", + "provisioningState": "str", + "type": "str", + "volumes": [ + { + "creationToken": "str", + "subnetId": "str", + "usageThreshold": 107374182400, + "actualThroughputMibps": 0.0, + "avsDataStore": "Disabled", + "backupId": "str", + "baremetalTenantId": "str", + "capacityPoolResourceId": "str", + "cloneProgress": 0, + "coolAccess": False, + "coolAccessRetrievalPolicy": "str", + "coolnessPeriod": 0, + "dataProtection": { + "backup": {"backupPolicyId": "str", "backupVaultId": "str", "policyEnforced": bool}, + "replication": { + "remoteVolumeResourceId": "str", + "endpointType": "str", + "remoteVolumeRegion": "str", + "replicationId": "str", + "replicationSchedule": "str", + }, + "snapshot": {"snapshotPolicyId": "str"}, + "volumeRelocation": {"readyToBeFinalized": bool, "relocationRequested": bool}, + }, + "dataStoreResourceId": ["str"], + "defaultGroupQuotaInKiBs": 0, + "defaultUserQuotaInKiBs": 0, + "deleteBaseSnapshot": bool, + "enableSubvolumes": "Disabled", + "encrypted": bool, + "encryptionKeySource": "Microsoft.NetApp", + "exportPolicy": { + "rules": [ + { + "allowedClients": "str", + "chownMode": "Restricted", + "cifs": bool, + "hasRootAccess": True, + "kerberos5ReadOnly": False, + "kerberos5ReadWrite": False, + "kerberos5iReadOnly": False, + "kerberos5iReadWrite": False, + "kerberos5pReadOnly": False, + "kerberos5pReadWrite": False, + "nfsv3": bool, + "nfsv41": bool, + "ruleIndex": 0, + "unixReadOnly": bool, + "unixReadWrite": bool, + } + ] + }, + "fileAccessLogs": "Disabled", + "fileSystemId": "str", + "id": "str", + "isDefaultQuotaEnabled": False, + "isLargeVolume": False, + "isRestoring": bool, + "kerberosEnabled": False, + "keyVaultPrivateEndpointResourceId": "str", + "ldapEnabled": False, + "maximumNumberOfFiles": 0, + "mountTargets": [ + {"fileSystemId": "str", "ipAddress": "str", "mountTargetId": "str", "smbServerFqdn": "str"} + ], + "name": "str", + "networkFeatures": "Basic", + "networkSiblingSetId": "str", + "originatingResourceId": "str", + "placementRules": [{"key": "str", "value": "str"}], + "protocolTypes": ["str"], + "provisionedAvailabilityZone": "str", + "provisioningState": "str", + "proximityPlacementGroup": "str", + "securityStyle": "unix", + "serviceLevel": "Premium", + "smbAccessBasedEnumeration": "str", + "smbContinuouslyAvailable": False, + "smbEncryption": False, + "smbNonBrowsable": "str", + "snapshotDirectoryVisible": True, + "snapshotId": "str", + "storageToNetworkProximity": "str", + "t2Network": "str", + "tags": {"str": "str"}, + "throughputMibps": 0.0, + "type": "str", + "unixPermissions": "str", + "volumeGroupName": "str", + "volumeSpecName": "str", + "volumeType": "str", + "zones": ["str"], + } + ], + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.volume_groups.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + volume_group_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volume_groups_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volume_groups_operations_async.py new file mode 100644 index 0000000000000..f6abd9b8146c5 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volume_groups_operations_async.py @@ -0,0 +1,190 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementVolumeGroupsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_net_app_account(self, resource_group): + response = self.client.volume_groups.list_by_net_app_account( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.volume_groups.get( + resource_group_name=resource_group.name, + account_name="str", + volume_group_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.volume_groups.begin_create( + resource_group_name=resource_group.name, + account_name="str", + volume_group_name="str", + body={ + "groupMetaData": { + "applicationIdentifier": "str", + "applicationType": "str", + "globalPlacementRules": [{"key": "str", "value": "str"}], + "groupDescription": "str", + "volumesCount": 0, + }, + "id": "str", + "location": "str", + "name": "str", + "provisioningState": "str", + "type": "str", + "volumes": [ + { + "creationToken": "str", + "subnetId": "str", + "usageThreshold": 107374182400, + "actualThroughputMibps": 0.0, + "avsDataStore": "Disabled", + "backupId": "str", + "baremetalTenantId": "str", + "capacityPoolResourceId": "str", + "cloneProgress": 0, + "coolAccess": False, + "coolAccessRetrievalPolicy": "str", + "coolnessPeriod": 0, + "dataProtection": { + "backup": {"backupPolicyId": "str", "backupVaultId": "str", "policyEnforced": bool}, + "replication": { + "remoteVolumeResourceId": "str", + "endpointType": "str", + "remoteVolumeRegion": "str", + "replicationId": "str", + "replicationSchedule": "str", + }, + "snapshot": {"snapshotPolicyId": "str"}, + "volumeRelocation": {"readyToBeFinalized": bool, "relocationRequested": bool}, + }, + "dataStoreResourceId": ["str"], + "defaultGroupQuotaInKiBs": 0, + "defaultUserQuotaInKiBs": 0, + "deleteBaseSnapshot": bool, + "enableSubvolumes": "Disabled", + "encrypted": bool, + "encryptionKeySource": "Microsoft.NetApp", + "exportPolicy": { + "rules": [ + { + "allowedClients": "str", + "chownMode": "Restricted", + "cifs": bool, + "hasRootAccess": True, + "kerberos5ReadOnly": False, + "kerberos5ReadWrite": False, + "kerberos5iReadOnly": False, + "kerberos5iReadWrite": False, + "kerberos5pReadOnly": False, + "kerberos5pReadWrite": False, + "nfsv3": bool, + "nfsv41": bool, + "ruleIndex": 0, + "unixReadOnly": bool, + "unixReadWrite": bool, + } + ] + }, + "fileAccessLogs": "Disabled", + "fileSystemId": "str", + "id": "str", + "isDefaultQuotaEnabled": False, + "isLargeVolume": False, + "isRestoring": bool, + "kerberosEnabled": False, + "keyVaultPrivateEndpointResourceId": "str", + "ldapEnabled": False, + "maximumNumberOfFiles": 0, + "mountTargets": [ + { + "fileSystemId": "str", + "ipAddress": "str", + "mountTargetId": "str", + "smbServerFqdn": "str", + } + ], + "name": "str", + "networkFeatures": "Basic", + "networkSiblingSetId": "str", + "originatingResourceId": "str", + "placementRules": [{"key": "str", "value": "str"}], + "protocolTypes": ["str"], + "provisionedAvailabilityZone": "str", + "provisioningState": "str", + "proximityPlacementGroup": "str", + "securityStyle": "unix", + "serviceLevel": "Premium", + "smbAccessBasedEnumeration": "str", + "smbContinuouslyAvailable": False, + "smbEncryption": False, + "smbNonBrowsable": "str", + "snapshotDirectoryVisible": True, + "snapshotId": "str", + "storageToNetworkProximity": "str", + "t2Network": "str", + "tags": {"str": "str"}, + "throughputMibps": 0.0, + "type": "str", + "unixPermissions": "str", + "volumeGroupName": "str", + "volumeSpecName": "str", + "volumeType": "str", + "zones": ["str"], + } + ], + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.volume_groups.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + volume_group_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volume_quota_rules_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volume_quota_rules_operations.py new file mode 100644 index 0000000000000..e6673577a864c --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volume_quota_rules_operations.py @@ -0,0 +1,119 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementVolumeQuotaRulesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_volume(self, resource_group): + response = self.client.volume_quota_rules.list_by_volume( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.volume_quota_rules.get( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + volume_quota_rule_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.volume_quota_rules.begin_create( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + volume_quota_rule_name="str", + body={ + "location": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "quotaSizeInKiBs": 0, + "quotaTarget": "str", + "quotaType": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.volume_quota_rules.begin_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + volume_quota_rule_name="str", + body={ + "provisioningState": "str", + "quotaSizeInKiBs": 0, + "quotaTarget": "str", + "quotaType": "str", + "tags": {"str": "str"}, + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.volume_quota_rules.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + volume_quota_rule_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volume_quota_rules_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volume_quota_rules_operations_async.py new file mode 100644 index 0000000000000..6e0fa6dba84aa --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volume_quota_rules_operations_async.py @@ -0,0 +1,126 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementVolumeQuotaRulesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_volume(self, resource_group): + response = self.client.volume_quota_rules.list_by_volume( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.volume_quota_rules.get( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + volume_quota_rule_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.volume_quota_rules.begin_create( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + volume_quota_rule_name="str", + body={ + "location": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "quotaSizeInKiBs": 0, + "quotaTarget": "str", + "quotaType": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.volume_quota_rules.begin_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + volume_quota_rule_name="str", + body={ + "provisioningState": "str", + "quotaSizeInKiBs": 0, + "quotaTarget": "str", + "quotaType": "str", + "tags": {"str": "str"}, + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.volume_quota_rules.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + volume_quota_rule_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volumes_operations.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volumes_operations.py new file mode 100644 index 0000000000000..29becfa3ab092 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volumes_operations.py @@ -0,0 +1,481 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementVolumesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.volumes.list( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.volumes.get( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.volumes.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={ + "creationToken": "str", + "location": "str", + "subnetId": "str", + "usageThreshold": 107374182400, + "actualThroughputMibps": 0.0, + "avsDataStore": "Disabled", + "backupId": "str", + "baremetalTenantId": "str", + "capacityPoolResourceId": "str", + "cloneProgress": 0, + "coolAccess": False, + "coolAccessRetrievalPolicy": "str", + "coolnessPeriod": 0, + "dataProtection": { + "backup": {"backupPolicyId": "str", "backupVaultId": "str", "policyEnforced": bool}, + "replication": { + "remoteVolumeResourceId": "str", + "endpointType": "str", + "remoteVolumeRegion": "str", + "replicationId": "str", + "replicationSchedule": "str", + }, + "snapshot": {"snapshotPolicyId": "str"}, + "volumeRelocation": {"readyToBeFinalized": bool, "relocationRequested": bool}, + }, + "dataStoreResourceId": ["str"], + "defaultGroupQuotaInKiBs": 0, + "defaultUserQuotaInKiBs": 0, + "deleteBaseSnapshot": bool, + "enableSubvolumes": "Disabled", + "encrypted": bool, + "encryptionKeySource": "Microsoft.NetApp", + "etag": "str", + "exportPolicy": { + "rules": [ + { + "allowedClients": "str", + "chownMode": "Restricted", + "cifs": bool, + "hasRootAccess": True, + "kerberos5ReadOnly": False, + "kerberos5ReadWrite": False, + "kerberos5iReadOnly": False, + "kerberos5iReadWrite": False, + "kerberos5pReadOnly": False, + "kerberos5pReadWrite": False, + "nfsv3": bool, + "nfsv41": bool, + "ruleIndex": 0, + "unixReadOnly": bool, + "unixReadWrite": bool, + } + ] + }, + "fileAccessLogs": "Disabled", + "fileSystemId": "str", + "id": "str", + "isDefaultQuotaEnabled": False, + "isLargeVolume": False, + "isRestoring": bool, + "kerberosEnabled": False, + "keyVaultPrivateEndpointResourceId": "str", + "ldapEnabled": False, + "maximumNumberOfFiles": 0, + "mountTargets": [ + {"fileSystemId": "str", "ipAddress": "str", "mountTargetId": "str", "smbServerFqdn": "str"} + ], + "name": "str", + "networkFeatures": "Basic", + "networkSiblingSetId": "str", + "originatingResourceId": "str", + "placementRules": [{"key": "str", "value": "str"}], + "protocolTypes": ["str"], + "provisionedAvailabilityZone": "str", + "provisioningState": "str", + "proximityPlacementGroup": "str", + "securityStyle": "unix", + "serviceLevel": "Premium", + "smbAccessBasedEnumeration": "str", + "smbContinuouslyAvailable": False, + "smbEncryption": False, + "smbNonBrowsable": "str", + "snapshotDirectoryVisible": True, + "snapshotId": "str", + "storageToNetworkProximity": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "t2Network": "str", + "tags": {"str": "str"}, + "throughputMibps": 0.0, + "type": "str", + "unixPermissions": "str", + "volumeGroupName": "str", + "volumeSpecName": "str", + "volumeType": "str", + "zones": ["str"], + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.volumes.begin_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={ + "coolAccess": bool, + "coolAccessRetrievalPolicy": "str", + "coolnessPeriod": 0, + "dataProtection": { + "backup": {"backupPolicyId": "str", "backupVaultId": "str", "policyEnforced": bool}, + "snapshot": {"snapshotPolicyId": "str"}, + }, + "defaultGroupQuotaInKiBs": 0, + "defaultUserQuotaInKiBs": 0, + "exportPolicy": { + "rules": [ + { + "allowedClients": "str", + "chownMode": "Restricted", + "cifs": bool, + "hasRootAccess": True, + "kerberos5ReadOnly": False, + "kerberos5ReadWrite": False, + "kerberos5iReadOnly": False, + "kerberos5iReadWrite": False, + "kerberos5pReadOnly": False, + "kerberos5pReadWrite": False, + "nfsv3": bool, + "nfsv41": bool, + "ruleIndex": 0, + "unixReadOnly": bool, + "unixReadWrite": bool, + } + ] + }, + "id": "str", + "isDefaultQuotaEnabled": False, + "location": "str", + "name": "str", + "protocolTypes": ["str"], + "serviceLevel": "Premium", + "smbAccessBasedEnumeration": "str", + "smbNonBrowsable": "str", + "snapshotDirectoryVisible": bool, + "tags": {"str": "str"}, + "throughputMibps": 0.0, + "type": "str", + "unixPermissions": "str", + "usageThreshold": 107374182400, + }, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.volumes.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_populate_availability_zone(self, resource_group): + response = self.client.volumes.begin_populate_availability_zone( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_revert(self, resource_group): + response = self.client.volumes.begin_revert( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={"snapshotId": "str"}, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_reset_cifs_password(self, resource_group): + response = self.client.volumes.begin_reset_cifs_password( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_break_file_locks(self, resource_group): + response = self.client.volumes.begin_break_file_locks( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_list_get_group_id_list_for_ldap_user(self, resource_group): + response = self.client.volumes.begin_list_get_group_id_list_for_ldap_user( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={"username": "str"}, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_break_replication(self, resource_group): + response = self.client.volumes.begin_break_replication( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_reestablish_replication(self, resource_group): + response = self.client.volumes.begin_reestablish_replication( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={"sourceVolumeId": "str"}, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_replication_status(self, resource_group): + response = self.client.volumes.replication_status( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_replications(self, resource_group): + response = self.client.volumes.list_replications( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_resync_replication(self, resource_group): + response = self.client.volumes.begin_resync_replication( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_replication(self, resource_group): + response = self.client.volumes.begin_delete_replication( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_authorize_replication(self, resource_group): + response = self.client.volumes.begin_authorize_replication( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={"remoteVolumeResourceId": "str"}, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_re_initialize_replication(self, resource_group): + response = self.client.volumes.begin_re_initialize_replication( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_pool_change(self, resource_group): + response = self.client.volumes.begin_pool_change( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={"newPoolResourceId": "str"}, + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_relocate(self, resource_group): + response = self.client.volumes.begin_relocate( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_finalize_relocation(self, resource_group): + response = self.client.volumes.begin_finalize_relocation( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_revert_relocation(self, resource_group): + response = self.client.volumes.begin_revert_relocation( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volumes_operations_async.py b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volumes_operations_async.py new file mode 100644 index 0000000000000..8d51ea54aa72e --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/generated_tests/test_net_app_management_volumes_operations_async.py @@ -0,0 +1,518 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.netapp.aio import NetAppManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestNetAppManagementVolumesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(NetAppManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.volumes.list( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.volumes.get( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.volumes.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={ + "creationToken": "str", + "location": "str", + "subnetId": "str", + "usageThreshold": 107374182400, + "actualThroughputMibps": 0.0, + "avsDataStore": "Disabled", + "backupId": "str", + "baremetalTenantId": "str", + "capacityPoolResourceId": "str", + "cloneProgress": 0, + "coolAccess": False, + "coolAccessRetrievalPolicy": "str", + "coolnessPeriod": 0, + "dataProtection": { + "backup": {"backupPolicyId": "str", "backupVaultId": "str", "policyEnforced": bool}, + "replication": { + "remoteVolumeResourceId": "str", + "endpointType": "str", + "remoteVolumeRegion": "str", + "replicationId": "str", + "replicationSchedule": "str", + }, + "snapshot": {"snapshotPolicyId": "str"}, + "volumeRelocation": {"readyToBeFinalized": bool, "relocationRequested": bool}, + }, + "dataStoreResourceId": ["str"], + "defaultGroupQuotaInKiBs": 0, + "defaultUserQuotaInKiBs": 0, + "deleteBaseSnapshot": bool, + "enableSubvolumes": "Disabled", + "encrypted": bool, + "encryptionKeySource": "Microsoft.NetApp", + "etag": "str", + "exportPolicy": { + "rules": [ + { + "allowedClients": "str", + "chownMode": "Restricted", + "cifs": bool, + "hasRootAccess": True, + "kerberos5ReadOnly": False, + "kerberos5ReadWrite": False, + "kerberos5iReadOnly": False, + "kerberos5iReadWrite": False, + "kerberos5pReadOnly": False, + "kerberos5pReadWrite": False, + "nfsv3": bool, + "nfsv41": bool, + "ruleIndex": 0, + "unixReadOnly": bool, + "unixReadWrite": bool, + } + ] + }, + "fileAccessLogs": "Disabled", + "fileSystemId": "str", + "id": "str", + "isDefaultQuotaEnabled": False, + "isLargeVolume": False, + "isRestoring": bool, + "kerberosEnabled": False, + "keyVaultPrivateEndpointResourceId": "str", + "ldapEnabled": False, + "maximumNumberOfFiles": 0, + "mountTargets": [ + {"fileSystemId": "str", "ipAddress": "str", "mountTargetId": "str", "smbServerFqdn": "str"} + ], + "name": "str", + "networkFeatures": "Basic", + "networkSiblingSetId": "str", + "originatingResourceId": "str", + "placementRules": [{"key": "str", "value": "str"}], + "protocolTypes": ["str"], + "provisionedAvailabilityZone": "str", + "provisioningState": "str", + "proximityPlacementGroup": "str", + "securityStyle": "unix", + "serviceLevel": "Premium", + "smbAccessBasedEnumeration": "str", + "smbContinuouslyAvailable": False, + "smbEncryption": False, + "smbNonBrowsable": "str", + "snapshotDirectoryVisible": True, + "snapshotId": "str", + "storageToNetworkProximity": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "t2Network": "str", + "tags": {"str": "str"}, + "throughputMibps": 0.0, + "type": "str", + "unixPermissions": "str", + "volumeGroupName": "str", + "volumeSpecName": "str", + "volumeType": "str", + "zones": ["str"], + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.volumes.begin_update( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={ + "coolAccess": bool, + "coolAccessRetrievalPolicy": "str", + "coolnessPeriod": 0, + "dataProtection": { + "backup": {"backupPolicyId": "str", "backupVaultId": "str", "policyEnforced": bool}, + "snapshot": {"snapshotPolicyId": "str"}, + }, + "defaultGroupQuotaInKiBs": 0, + "defaultUserQuotaInKiBs": 0, + "exportPolicy": { + "rules": [ + { + "allowedClients": "str", + "chownMode": "Restricted", + "cifs": bool, + "hasRootAccess": True, + "kerberos5ReadOnly": False, + "kerberos5ReadWrite": False, + "kerberos5iReadOnly": False, + "kerberos5iReadWrite": False, + "kerberos5pReadOnly": False, + "kerberos5pReadWrite": False, + "nfsv3": bool, + "nfsv41": bool, + "ruleIndex": 0, + "unixReadOnly": bool, + "unixReadWrite": bool, + } + ] + }, + "id": "str", + "isDefaultQuotaEnabled": False, + "location": "str", + "name": "str", + "protocolTypes": ["str"], + "serviceLevel": "Premium", + "smbAccessBasedEnumeration": "str", + "smbNonBrowsable": "str", + "snapshotDirectoryVisible": bool, + "tags": {"str": "str"}, + "throughputMibps": 0.0, + "type": "str", + "unixPermissions": "str", + "usageThreshold": 107374182400, + }, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.volumes.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_populate_availability_zone(self, resource_group): + response = await ( + await self.client.volumes.begin_populate_availability_zone( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_revert(self, resource_group): + response = await ( + await self.client.volumes.begin_revert( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={"snapshotId": "str"}, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_reset_cifs_password(self, resource_group): + response = await ( + await self.client.volumes.begin_reset_cifs_password( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_break_file_locks(self, resource_group): + response = await ( + await self.client.volumes.begin_break_file_locks( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_list_get_group_id_list_for_ldap_user(self, resource_group): + response = await ( + await self.client.volumes.begin_list_get_group_id_list_for_ldap_user( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={"username": "str"}, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_break_replication(self, resource_group): + response = await ( + await self.client.volumes.begin_break_replication( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_reestablish_replication(self, resource_group): + response = await ( + await self.client.volumes.begin_reestablish_replication( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={"sourceVolumeId": "str"}, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_replication_status(self, resource_group): + response = await self.client.volumes.replication_status( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_replications(self, resource_group): + response = self.client.volumes.list_replications( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_resync_replication(self, resource_group): + response = await ( + await self.client.volumes.begin_resync_replication( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_replication(self, resource_group): + response = await ( + await self.client.volumes.begin_delete_replication( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_authorize_replication(self, resource_group): + response = await ( + await self.client.volumes.begin_authorize_replication( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={"remoteVolumeResourceId": "str"}, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_re_initialize_replication(self, resource_group): + response = await ( + await self.client.volumes.begin_re_initialize_replication( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_pool_change(self, resource_group): + response = await ( + await self.client.volumes.begin_pool_change( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + body={"newPoolResourceId": "str"}, + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_relocate(self, resource_group): + response = await ( + await self.client.volumes.begin_relocate( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_finalize_relocation(self, resource_group): + response = await ( + await self.client.volumes.begin_finalize_relocation( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_revert_relocation(self, resource_group): + response = await ( + await self.client.volumes.begin_revert_relocation( + resource_group_name=resource_group.name, + account_name="str", + pool_name="str", + volume_name="str", + api_version="2024-03-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/netapp/azure-mgmt-netapp/pyproject.toml b/sdk/netapp/azure-mgmt-netapp/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/netapp/azure-mgmt-netapp/setup.py b/sdk/netapp/azure-mgmt-netapp/setup.py index 8d51a7d7b726c..512cdbbbce5fa 100644 --- a/sdk/netapp/azure-mgmt-netapp/setup.py +++ b/sdk/netapp/azure-mgmt-netapp/setup.py @@ -75,6 +75,7 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", "azure-mgmt-core>=1.3.2", ], diff --git a/sdk/netapp/azure-mgmt-netapp/tests/setup.py b/sdk/netapp/azure-mgmt-netapp/tests/setup.py index 831d564318fa3..7dd91ba878b6f 100644 --- a/sdk/netapp/azure-mgmt-netapp/tests/setup.py +++ b/sdk/netapp/azure-mgmt-netapp/tests/setup.py @@ -31,4 +31,5 @@ PERMA_REMOTE_VNET = 'sdk-python-tests-remote-perma-VNET' PERMA_SUBNET = 'sdk-python-tests-subnet' PERMA_REMOTE_SUBNET = 'sdk-python-tests-remote-subnet' -LIVE = False \ No newline at end of file +LIVE = False +SUBSID = '69a75bda-882e-44d5-8431-63421204132a' \ No newline at end of file diff --git a/sdk/network/azure-mgmt-dns/pyproject.toml b/sdk/network/azure-mgmt-dns/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/network/azure-mgmt-dns/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/network/azure-mgmt-frontdoor/pyproject.toml b/sdk/network/azure-mgmt-frontdoor/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/network/azure-mgmt-frontdoor/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/network/azure-mgmt-network/pyproject.toml b/sdk/network/azure-mgmt-network/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/network/azure-mgmt-network/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/network/azure-mgmt-privatedns/pyproject.toml b/sdk/network/azure-mgmt-privatedns/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/network/azure-mgmt-privatedns/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/networkanalytics/azure-mgmt-networkanalytics/pyproject.toml b/sdk/networkanalytics/azure-mgmt-networkanalytics/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/networkanalytics/azure-mgmt-networkanalytics/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/networkcloud/azure-mgmt-networkcloud/pyproject.toml b/sdk/networkcloud/azure-mgmt-networkcloud/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/networkcloud/azure-mgmt-networkcloud/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/networkfunction/azure-mgmt-networkfunction/pyproject.toml b/sdk/networkfunction/azure-mgmt-networkfunction/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/networkfunction/azure-mgmt-networkfunction/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/newrelicobservability/azure-mgmt-newrelicobservability/pyproject.toml b/sdk/newrelicobservability/azure-mgmt-newrelicobservability/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/newrelicobservability/azure-mgmt-newrelicobservability/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/nginx/azure-mgmt-nginx/pyproject.toml b/sdk/nginx/azure-mgmt-nginx/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/notificationhubs/azure-mgmt-notificationhubs/pyproject.toml b/sdk/notificationhubs/azure-mgmt-notificationhubs/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/notificationhubs/azure-mgmt-notificationhubs/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/nspkg/azure-mgmt-datalake-nspkg/pyproject.toml b/sdk/nspkg/azure-mgmt-datalake-nspkg/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/nspkg/azure-mgmt-datalake-nspkg/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/nspkg/azure-mgmt-nspkg/pyproject.toml b/sdk/nspkg/azure-mgmt-nspkg/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/nspkg/azure-mgmt-nspkg/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/oep/azure-mgmt-oep/pyproject.toml b/sdk/oep/azure-mgmt-oep/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/oep/azure-mgmt-oep/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/openai/azure-openai/tests/conftest.py b/sdk/openai/azure-openai/tests/conftest.py index d924cac171c3c..6f1e307c26db3 100644 --- a/sdk/openai/azure-openai/tests/conftest.py +++ b/sdk/openai/azure-openai/tests/conftest.py @@ -11,17 +11,17 @@ import contextlib import functools import openai -from azure.identity import DefaultAzureCredential, get_bearer_token_provider +from azure.identity import get_bearer_token_provider from azure.identity.aio import ( - DefaultAzureCredential as AsyncDefaultAzureCredential, get_bearer_token_provider as get_bearer_token_provider_async, ) from ci_tools.variables import in_ci +from devtools_testutils import get_credential # for pytest.parametrize -GA = "2024-02-01" -PREVIEW = "2024-05-01-preview" +GA = "2024-06-01" +PREVIEW = "2024-07-01-preview" LATEST = PREVIEW AZURE = "azure" @@ -73,7 +73,7 @@ def client(api_type, api_version): if api_type == "azure": client = openai.AzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT), - azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), + azure_ad_token_provider=get_bearer_token_provider(get_credential(), "https://cognitiveservices.azure.com/.default"), api_version=api_version, ) elif api_type == "azure_key": @@ -89,13 +89,13 @@ def client(api_type, api_version): elif api_type in ["whisper_azure", "tts_azure"]: client = openai.AzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT), - azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), + azure_ad_token_provider=get_bearer_token_provider(get_credential(), "https://cognitiveservices.azure.com/.default"), api_version=api_version, ) elif api_type in ["dalle_azure", "gpt_4_azure", "asst_azure"]: client = openai.AzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT), - azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), + azure_ad_token_provider=get_bearer_token_provider(get_credential(), "https://cognitiveservices.azure.com/.default"), api_version=api_version, ) return client @@ -109,7 +109,7 @@ def client_async(api_type, api_version): if api_type == "azure": client = openai.AsyncAzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT), - azure_ad_token_provider=get_bearer_token_provider_async(AsyncDefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), + azure_ad_token_provider=get_bearer_token_provider_async(get_credential(is_async=True), "https://cognitiveservices.azure.com/.default"), api_version=api_version, ) elif api_type == "azure_key": @@ -125,13 +125,13 @@ def client_async(api_type, api_version): elif api_type in ["whisper_azure", "tts_azure"]: client = openai.AsyncAzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT), - azure_ad_token_provider=get_bearer_token_provider_async(AsyncDefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), + azure_ad_token_provider=get_bearer_token_provider_async(get_credential(is_async=True), "https://cognitiveservices.azure.com/.default"), api_version=api_version, ) elif api_type in ["dalle_azure", "gpt_4_azure", "asst_azure"]: client = openai.AsyncAzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT), - azure_ad_token_provider=get_bearer_token_provider_async(AsyncDefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), + azure_ad_token_provider=get_bearer_token_provider_async(get_credential(is_async=True), "https://cognitiveservices.azure.com/.default"), api_version=api_version, ) return client @@ -194,6 +194,10 @@ async def wrapper(*args, **kwargs): return await f(*args, client_async=client_async, api_type=api_type, api_version=api_version, **kwargs) except openai.RateLimitError: pytest.skip(f"{str(f).split(' ')[1]}[{api_type}]: Skipping - Rate limit reached.") + except openai.BadRequestError as e: + if e.body.get("code") == "content_policy_violation": + pytest.skip(f"{str(f).split(' ')[1]}[{api_type}]: Skipping - Triggered content filter.") + raise return wrapper @@ -209,6 +213,10 @@ def wrapper(*args, **kwargs): return f(*args, client=client, api_type=api_type, api_version=api_version, **kwargs) except openai.RateLimitError: pytest.skip(f"{str(f).split(' ')[1]}[{api_type}]: Skipping - Rate limit reached.") + except openai.BadRequestError as e: + if e.body.get("code") == "content_policy_violation": + pytest.skip(f"{str(f).split(' ')[1]}[{api_type}]: Skipping - Triggered content filter.") + raise return wrapper diff --git a/sdk/openai/azure-openai/tests/test_assistants.py b/sdk/openai/azure-openai/tests/test_assistants.py index ecb0cc7ea3915..20456c09bb294 100644 --- a/sdk/openai/azure-openai/tests/test_assistants.py +++ b/sdk/openai/azure-openai/tests/test_assistants.py @@ -9,7 +9,7 @@ import uuid import openai from devtools_testutils import AzureRecordedTestCase -from conftest import ASST_AZURE, PREVIEW, GPT_4_OPENAI, configure +from conftest import ASST_AZURE, PREVIEW, GPT_4_OPENAI, configure, AZURE from openai import AssistantEventHandler from openai.types.beta.threads import ( Text, diff --git a/sdk/openai/azure-openai/tests/test_chat_completions.py b/sdk/openai/azure-openai/tests/test_chat_completions.py index bd6e2474a3e13..a410ee3e00f20 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions.py @@ -1129,7 +1129,7 @@ def test_chat_completion_vision(self, client, api_type, api_version, **kwargs): assert completion.choices[0].message.role @configure - @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, PREVIEW), (GPT_4_OPENAI, "v1")]) + @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, PREVIEW), (GPT_4_AZURE, GA), (GPT_4_OPENAI, "v1")]) def test_chat_completion_logprobs(self, client, api_type, api_version, **kwargs): messages = [ {"role": "system", "content": "You are a helpful assistant."}, diff --git a/sdk/openai/azure-openai/tests/test_chat_completions_async.py b/sdk/openai/azure-openai/tests/test_chat_completions_async.py index 8889afb26df7a..0fa811b9536b2 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions_async.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions_async.py @@ -1155,7 +1155,7 @@ async def test_chat_completion_vision(self, client_async, api_type, api_version, @configure_async @pytest.mark.asyncio - @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, PREVIEW), (GPT_4_OPENAI, "v1")]) + @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, PREVIEW), (GPT_4_AZURE, GA), (GPT_4_OPENAI, "v1")]) async def test_chat_completion_logprobs(self, client_async, api_type, api_version, **kwargs): messages = [ {"role": "system", "content": "You are a helpful assistant."}, diff --git a/sdk/openai/azure-openai/tests/test_cli.py b/sdk/openai/azure-openai/tests/test_cli.py index ce7397f14cb8c..bc3a563def667 100644 --- a/sdk/openai/azure-openai/tests/test_cli.py +++ b/sdk/openai/azure-openai/tests/test_cli.py @@ -8,8 +8,7 @@ import pathlib import subprocess import pytest -from devtools_testutils import AzureRecordedTestCase -from azure.identity import DefaultAzureCredential +from devtools_testutils import AzureRecordedTestCase, get_credential from conftest import ( ENV_AZURE_OPENAI_ENDPOINT, ENV_AZURE_OPENAI_KEY, @@ -60,7 +59,7 @@ def test_cli_env_vars_token(self): with reload(): os.environ["AZURE_OPENAI_ENDPOINT"] = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) os.environ["OPENAI_API_VERSION"] = LATEST - os.environ["AZURE_OPENAI_AD_TOKEN"] = DefaultAzureCredential().get_token("https://cognitiveservices.azure.com/.default").token + os.environ["AZURE_OPENAI_AD_TOKEN"] = get_credential().get_token("https://cognitiveservices.azure.com/.default").token os.environ["OPENAI_API_TYPE"] = "azure" try: @@ -117,7 +116,7 @@ def test_cli_completions(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}", f"--api-version={LATEST}", - f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", + f"--azure-ad-token={get_credential().get_token('https://cognitiveservices.azure.com/.default').token}", "api", "completions.create", "-m", @@ -139,7 +138,7 @@ def test_cli_chat_completions(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}", f"--api-version={LATEST}", - f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", + f"--azure-ad-token={get_credential().get_token('https://cognitiveservices.azure.com/.default').token}", "api", "chat.completions.create", "-m", @@ -162,7 +161,7 @@ def test_cli_audio_transcription(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT)}", f"--api-version={LATEST}", - f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", + f"--azure-ad-token={get_credential().get_token('https://cognitiveservices.azure.com/.default').token}", "api", "audio.transcriptions.create", "-m", @@ -184,7 +183,7 @@ def test_cli_audio_translation(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT)}", f"--api-version={LATEST}", - f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", + f"--azure-ad-token={get_credential().get_token('https://cognitiveservices.azure.com/.default').token}", "api", "audio.translations.create", "-m", @@ -206,7 +205,7 @@ def test_cli_models_list(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}", f"--api-version={LATEST}", - f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", + f"--azure-ad-token={get_credential().get_token('https://cognitiveservices.azure.com/.default').token}", "api", "models.list", ], @@ -224,7 +223,7 @@ def test_cli_models_retrieve(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}", f"--api-version={LATEST}", - f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", + f"--azure-ad-token={get_credential().get_token('https://cognitiveservices.azure.com/.default').token}", "api", "models.retrieve", "-i", diff --git a/sdk/openai/azure-openai/tests/test_client.py b/sdk/openai/azure-openai/tests/test_client.py index 552fa9a31301c..192673abea217 100644 --- a/sdk/openai/azure-openai/tests/test_client.py +++ b/sdk/openai/azure-openai/tests/test_client.py @@ -7,8 +7,8 @@ import pytest import openai import httpx -from devtools_testutils import AzureRecordedTestCase -from azure.identity import DefaultAzureCredential, get_bearer_token_provider +from devtools_testutils import AzureRecordedTestCase, get_credential +from azure.identity import get_bearer_token_provider from conftest import ( AZURE, ENV_AZURE_OPENAI_ENDPOINT, @@ -44,7 +44,7 @@ def test_chat_completion_endpoint_deployment(self, client, api_type, api_version client = openai.AzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT), azure_deployment=ENV_AZURE_OPENAI_CHAT_COMPLETIONS_NAME, - azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), + azure_ad_token_provider=get_bearer_token_provider(get_credential(), "https://cognitiveservices.azure.com/.default"), api_version=LATEST, ) messages = [ @@ -79,7 +79,7 @@ def test_chat_completion_base_url(self, client, api_type, api_version, **kwargs) client = openai.AzureOpenAI( base_url=f"{os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}/openai/deployments/{ENV_AZURE_OPENAI_CHAT_COMPLETIONS_NAME}", - azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), + azure_ad_token_provider=get_bearer_token_provider(get_credential(), "https://cognitiveservices.azure.com/.default"), api_version=LATEST, ) messages = [ @@ -110,7 +110,7 @@ def test_client_str_token(self, client, api_type, api_version, **kwargs): ] client = openai.AzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT), - azure_ad_token=DefaultAzureCredential().get_token("https://cognitiveservices.azure.com/.default").token, + azure_ad_token=get_credential().get_token("https://cognitiveservices.azure.com/.default").token, api_version=LATEST, ) completion = client.chat.completions.create(messages=messages, **kwargs) @@ -211,7 +211,7 @@ def test_client_env_vars_token(self, client, api_type, api_version, **kwargs): with reload(): os.environ["AZURE_OPENAI_ENDPOINT"] = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) os.environ["OPENAI_API_VERSION"] = LATEST - os.environ["AZURE_OPENAI_AD_TOKEN"] = DefaultAzureCredential().get_token("https://cognitiveservices.azure.com/.default").token + os.environ["AZURE_OPENAI_AD_TOKEN"] = get_credential().get_token("https://cognitiveservices.azure.com/.default").token try: client = openai.AzureOpenAI() diff --git a/sdk/openai/azure-openai/tests/test_client_async.py b/sdk/openai/azure-openai/tests/test_client_async.py index f3296676ff4ab..156d2e71382a8 100644 --- a/sdk/openai/azure-openai/tests/test_client_async.py +++ b/sdk/openai/azure-openai/tests/test_client_async.py @@ -7,8 +7,8 @@ import pytest import openai import httpx -from devtools_testutils import AzureRecordedTestCase -from azure.identity.aio import DefaultAzureCredential, get_bearer_token_provider +from devtools_testutils import AzureRecordedTestCase, get_credential +from azure.identity.aio import get_bearer_token_provider from conftest import ( AZURE, ENV_AZURE_OPENAI_ENDPOINT, @@ -46,7 +46,7 @@ async def test_chat_completion_endpoint_deployment(self, client_async, api_type, client = openai.AsyncAzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT), azure_deployment=ENV_AZURE_OPENAI_CHAT_COMPLETIONS_NAME, - azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), + azure_ad_token_provider=get_bearer_token_provider(get_credential(is_async=True), "https://cognitiveservices.azure.com/.default"), api_version=LATEST, ) messages = [ @@ -82,7 +82,7 @@ async def test_chat_completion_base_url(self, client_async, api_type, api_versio client = openai.AsyncAzureOpenAI( base_url=f"{os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}/openai/deployments/{ENV_AZURE_OPENAI_CHAT_COMPLETIONS_NAME}", - azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), + azure_ad_token_provider=get_bearer_token_provider(get_credential(is_async=True), "https://cognitiveservices.azure.com/.default"), api_version=LATEST, ) messages = [ @@ -112,7 +112,7 @@ async def test_client_str_token(self, client_async, api_type, api_version, **kwa {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who won the world series in 2020?"} ] - credential = DefaultAzureCredential() + credential = get_credential(is_async=True) access_token = await credential.get_token("https://cognitiveservices.azure.com/.default") client = openai.AsyncAzureOpenAI( @@ -224,7 +224,7 @@ async def test_client_env_vars_token(self, client_async, api_type, api_version, with reload(): os.environ["AZURE_OPENAI_ENDPOINT"] = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) os.environ["OPENAI_API_VERSION"] = LATEST - credential = DefaultAzureCredential() + credential = get_credential(is_async=True) access_token = await credential.get_token("https://cognitiveservices.azure.com/.default") os.environ["AZURE_OPENAI_AD_TOKEN"] = access_token.token diff --git a/sdk/openai/azure-openai/tests/test_embeddings.py b/sdk/openai/azure-openai/tests/test_embeddings.py index fb56f473d7653..f69af39463a82 100644 --- a/sdk/openai/azure-openai/tests/test_embeddings.py +++ b/sdk/openai/azure-openai/tests/test_embeddings.py @@ -65,7 +65,7 @@ def test_embedding_user(self, client, api_type, api_version, **kwargs): @configure @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, PREVIEW), (OPENAI, "v1")] + [(AZURE, PREVIEW), (AZURE, GA), (OPENAI, "v1")] ) def test_embedding_dimensions(self, client, api_type, api_version, **kwargs): @@ -82,7 +82,7 @@ def test_embedding_dimensions(self, client, api_type, api_version, **kwargs): @configure @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, PREVIEW), (OPENAI, "v1")] + [(AZURE, PREVIEW), (AZURE, GA), (OPENAI, "v1")] ) def test_embedding_encoding_format(self, client, api_type, api_version, **kwargs): diff --git a/sdk/openai/azure-openai/tests/test_embeddings_async.py b/sdk/openai/azure-openai/tests/test_embeddings_async.py index 7c1d86a62da2e..77dcef3b620b6 100644 --- a/sdk/openai/azure-openai/tests/test_embeddings_async.py +++ b/sdk/openai/azure-openai/tests/test_embeddings_async.py @@ -69,7 +69,7 @@ async def test_embedding_user(self, client_async, api_type, api_version, **kwarg @pytest.mark.asyncio @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, PREVIEW), (OPENAI, "v1")] + [(AZURE, PREVIEW), (AZURE, GA), (OPENAI, "v1")] ) async def test_embedding_dimensions(self, client_async, api_type, api_version, **kwargs): @@ -87,7 +87,7 @@ async def test_embedding_dimensions(self, client_async, api_type, api_version, * @pytest.mark.asyncio @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, PREVIEW), (OPENAI, "v1")] + [(AZURE, PREVIEW), (AZURE, GA), (OPENAI, "v1")] ) async def test_embedding_encoding_format(self, client_async, api_type, api_version, **kwargs): diff --git a/sdk/openai/azure-openai/tests/test_module_client.py b/sdk/openai/azure-openai/tests/test_module_client.py index dcde0598cbf42..90ed7f0f47c50 100644 --- a/sdk/openai/azure-openai/tests/test_module_client.py +++ b/sdk/openai/azure-openai/tests/test_module_client.py @@ -7,8 +7,7 @@ import pytest import pathlib import openai -from azure.identity import DefaultAzureCredential -from devtools_testutils import AzureRecordedTestCase +from devtools_testutils import AzureRecordedTestCase, get_credential from conftest import ( configure, ENV_AZURE_OPENAI_ENDPOINT, @@ -63,7 +62,7 @@ def test_module_client_env_vars_token(self, client, api_type, api_version, **kwa with reload(): os.environ["AZURE_OPENAI_ENDPOINT"] = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) os.environ["OPENAI_API_VERSION"] = LATEST - os.environ["AZURE_OPENAI_AD_TOKEN"] = DefaultAzureCredential().get_token("https://cognitiveservices.azure.com/.default").token + os.environ["AZURE_OPENAI_AD_TOKEN"] = get_credential().get_token("https://cognitiveservices.azure.com/.default").token os.environ["OPENAI_API_TYPE"] = "azure" try: @@ -114,7 +113,7 @@ def test_module_client_ad_token(self, client, api_type, api_version, **kwargs): with reload(): openai.api_type= "azure" openai.azure_endpoint = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) - openai.azure_ad_token = DefaultAzureCredential().get_token("https://cognitiveservices.azure.com/.default").token + openai.azure_ad_token = get_credential().get_token("https://cognitiveservices.azure.com/.default").token openai.api_version = LATEST completion = openai.completions.create(prompt="hello world", model=ENV_AZURE_OPENAI_COMPLETIONS_NAME) @@ -137,7 +136,7 @@ def test_module_client_completions(self, client, api_type, api_version, **kwargs with reload(): openai.api_type= "azure" openai.azure_endpoint = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) - openai.azure_ad_token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default") + openai.azure_ad_token_provider = get_bearer_token_provider(get_credential(), "https://cognitiveservices.azure.com/.default") openai.api_version = LATEST completion = openai.completions.create(prompt="hello world", model=ENV_AZURE_OPENAI_COMPLETIONS_NAME) @@ -159,7 +158,7 @@ def test_module_client_chat_completions(self, client, api_type, api_version, **k with reload(): openai.api_type= "azure" openai.azure_endpoint = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) - openai.azure_ad_token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default") + openai.azure_ad_token_provider = get_bearer_token_provider(get_credential(), "https://cognitiveservices.azure.com/.default") openai.api_version = LATEST messages = [ @@ -187,7 +186,7 @@ def test_module_client_embeddings(self, client, api_type, api_version, **kwargs) with reload(): openai.api_type= "azure" openai.azure_endpoint = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) - openai.azure_ad_token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default") + openai.azure_ad_token_provider = get_bearer_token_provider(get_credential(), "https://cognitiveservices.azure.com/.default") openai.api_version = LATEST embedding = openai.embeddings.create(input="hello world", model=ENV_AZURE_OPENAI_EMBEDDINGS_NAME) @@ -206,7 +205,7 @@ def test_module_client_models(self, client, api_type, api_version, **kwargs): with reload(): openai.api_type= "azure" openai.azure_endpoint = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) - openai.azure_ad_token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default") + openai.azure_ad_token_provider = get_bearer_token_provider(get_credential(), "https://cognitiveservices.azure.com/.default") openai.api_version = LATEST models = openai.models.list() @@ -222,7 +221,7 @@ def test_module_client_audio(self, client, api_type, api_version, **kwargs): with reload(): openai.api_type= "azure" openai.azure_endpoint = os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT) - openai.azure_ad_token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default") + openai.azure_ad_token_provider = get_bearer_token_provider(get_credential(), "https://cognitiveservices.azure.com/.default") openai.api_version = LATEST result = openai.audio.transcriptions.create( diff --git a/sdk/operationsmanagement/azure-mgmt-operationsmanagement/pyproject.toml b/sdk/operationsmanagement/azure-mgmt-operationsmanagement/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/operationsmanagement/azure-mgmt-operationsmanagement/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/oracledatabase/azure-mgmt-oracledatabase/pyproject.toml b/sdk/oracledatabase/azure-mgmt-oracledatabase/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/oracledatabase/azure-mgmt-oracledatabase/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/orbital/azure-mgmt-orbital/pyproject.toml b/sdk/orbital/azure-mgmt-orbital/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/orbital/azure-mgmt-orbital/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/pyproject.toml b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/peering/azure-mgmt-peering/pyproject.toml b/sdk/peering/azure-mgmt-peering/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/peering/azure-mgmt-peering/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/playwrighttesting/azure-mgmt-playwrighttesting/pyproject.toml b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/playwrighttesting/azure-mgmt-playwrighttesting/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/pyproject.toml b/sdk/policyinsights/azure-mgmt-policyinsights/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/policyinsights/azure-mgmt-policyinsights/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/portal/azure-mgmt-portal/pyproject.toml b/sdk/portal/azure-mgmt-portal/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/portal/azure-mgmt-portal/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/powerbidedicated/azure-mgmt-powerbidedicated/pyproject.toml b/sdk/powerbidedicated/azure-mgmt-powerbidedicated/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/powerbidedicated/azure-mgmt-powerbidedicated/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/powerbiembedded/azure-mgmt-powerbiembedded/pyproject.toml b/sdk/powerbiembedded/azure-mgmt-powerbiembedded/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/powerbiembedded/azure-mgmt-powerbiembedded/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/purview/azure-mgmt-purview/pyproject.toml b/sdk/purview/azure-mgmt-purview/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/purview/azure-mgmt-purview/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/purview/azure-purview-administration/pyproject.toml b/sdk/purview/azure-purview-administration/pyproject.toml index db2ab0365e12f..e397b65970793 100644 --- a/sdk/purview/azure-purview-administration/pyproject.toml +++ b/sdk/purview/azure-purview-administration/pyproject.toml @@ -3,5 +3,4 @@ pylint = false pyright = false mypy = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/purview/azure-purview-catalog/pyproject.toml b/sdk/purview/azure-purview-catalog/pyproject.toml index db2ab0365e12f..e397b65970793 100644 --- a/sdk/purview/azure-purview-catalog/pyproject.toml +++ b/sdk/purview/azure-purview-catalog/pyproject.toml @@ -3,5 +3,4 @@ pylint = false pyright = false mypy = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/purview/azure-purview-scanning/pyproject.toml b/sdk/purview/azure-purview-scanning/pyproject.toml index db2ab0365e12f..e397b65970793 100644 --- a/sdk/purview/azure-purview-scanning/pyproject.toml +++ b/sdk/purview/azure-purview-scanning/pyproject.toml @@ -3,5 +3,4 @@ pylint = false pyright = false mypy = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/purview/azure-purview-sharing/pyproject.toml b/sdk/purview/azure-purview-sharing/pyproject.toml index 12fd01822c3d2..68074b7734308 100644 --- a/sdk/purview/azure-purview-sharing/pyproject.toml +++ b/sdk/purview/azure-purview-sharing/pyproject.toml @@ -1,5 +1,4 @@ [tool.azure-sdk-build] pylint = false pyright = false -verifytypes = false sphinx = false diff --git a/sdk/quantum/azure-mgmt-quantum/pyproject.toml b/sdk/quantum/azure-mgmt-quantum/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/quantum/azure-mgmt-quantum/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/qumulo/azure-mgmt-qumulo/pyproject.toml b/sdk/qumulo/azure-mgmt-qumulo/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/qumulo/azure-mgmt-qumulo/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/quota/azure-mgmt-quota/pyproject.toml b/sdk/quota/azure-mgmt-quota/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/quota/azure-mgmt-quota/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/rdbms/azure-mgmt-rdbms/_meta.json b/sdk/rdbms/azure-mgmt-rdbms/_meta.json index e5ec370848eab..cedc780e496e6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/_meta.json +++ b/sdk/rdbms/azure-mgmt-rdbms/_meta.json @@ -1,11 +1,11 @@ { - "commit": "67e8e173b7a52626d07b4bd4001abcb5bd413b34", + "commit": "c1d839d48ee936c9338431c38f2cbbfbc9879ea2", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.16", + "@autorest/python@6.17.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/mysql/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/python@6.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/mysql/resource-manager/readme.md" + "autorest_command": "autorest specification/mariadb/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/python@6.17.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "readme": "specification/mariadb/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_configuration.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_configuration.py index 6e7ba42ce0278..2b478540a86db 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_configuration.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class MariaDBManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class MariaDBManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for MariaDBManagementClient. Note that all parameters used to create this instance are saved as instance @@ -32,7 +31,6 @@ class MariaDBManagementClientConfiguration(Configuration): # pylint: disable=to """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(MariaDBManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -42,6 +40,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.subscription_id = subscription_id self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-rdbms/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -50,9 +49,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_maria_db_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_maria_db_management_client.py index b06db82be57d3..9e3618bbf8962 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_maria_db_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_maria_db_management_client.py @@ -8,9 +8,12 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import MariaDBManagementClientConfiguration @@ -131,7 +134,25 @@ def __init__( self._config = MariaDBManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -189,7 +210,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -209,12 +230,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "MariaDBManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_serialization.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_serialization.py index 4bae2292227bd..8139854b97bb8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_serialization.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,9 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +172,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +290,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +335,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +346,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +385,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +410,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +440,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +556,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +644,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +663,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +705,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +725,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +740,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +749,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -804,7 +800,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +820,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +989,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1166,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1205,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1225,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1365,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1385,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1444,12 +1438,12 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore @@ -1481,7 +1475,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1509,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1572,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1646,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1694,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1751,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1802,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1855,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1886,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1903,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1938,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1975,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1991,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_vendor.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_vendor.py index 5f2a1d870ed1a..b62d4ffd5d251 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_vendor.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import MariaDBManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from ._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class MariaDBManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/_configuration.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/_configuration.py index 1b69ac0d19cb6..1e7c916bebef3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/_configuration.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/_configuration.py @@ -8,7 +8,6 @@ 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, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MariaDBManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class MariaDBManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for MariaDBManagementClient. Note that all parameters used to create this instance are saved as instance @@ -32,7 +31,6 @@ class MariaDBManagementClientConfiguration(Configuration): # pylint: disable=to """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(MariaDBManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -42,6 +40,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.subscription_id = subscription_id self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-rdbms/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -50,9 +49,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/_maria_db_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/_maria_db_management_client.py index 2178b26c48d7f..fbeaacb216575 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/_maria_db_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/_maria_db_management_client.py @@ -8,9 +8,12 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -134,7 +137,25 @@ def __init__( self._config = MariaDBManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -192,7 +213,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -212,12 +235,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MariaDBManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/_vendor.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/_vendor.py index 5a1d01258608e..fe09af679d709 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/_vendor.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import MariaDBManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_advisors_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_advisors_operations.py index 943582c59171b..34d5e1da381a1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_advisors_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_advisors_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,18 +19,20 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._advisors_operations import build_get_request, build_list_by_server_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,12 +69,11 @@ async def get( :type server_name: str :param advisor_name: The advisor name for recommendation action. Required. :type advisor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Advisor or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.Advisor :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -85,22 +87,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.Advisor] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, advisor_name=advisor_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -109,16 +109,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Advisor", pipeline_response) + deserialized = self._deserialize("Advisor", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -131,7 +127,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Advisor or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.Advisor] :raises ~azure.core.exceptions.HttpResponseError: @@ -142,7 +137,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.AdvisorsResultList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -153,24 +148,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("AdvisorsResultList", pipeline_response) @@ -180,11 +172,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -195,7 +187,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_check_name_availability_operations.py index bca5489f44119..3e05b1b0eb7f4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_check_name_availability_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._check_name_availability_operations import build_execute_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +71,6 @@ async def execute( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: @@ -76,17 +78,16 @@ async def execute( @overload async def execute( - self, name_availability_request: IO, *, content_type: str = "application/json", **kwargs: Any + self, name_availability_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailability: """Check the availability of name for resource. :param name_availability_request: The required parameters for checking if resource name is available. Required. - :type name_availability_request: IO + :type name_availability_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: @@ -94,22 +95,19 @@ async def execute( @distributed_trace_async async def execute( - self, name_availability_request: Union[_models.NameAvailabilityRequest, IO], **kwargs: Any + self, name_availability_request: Union[_models.NameAvailabilityRequest, IO[bytes]], **kwargs: Any ) -> _models.NameAvailability: """Check the availability of name for resource. :param name_availability_request: The required parameters for checking if resource name is - available. Is either a NameAvailabilityRequest type or a IO type. Required. - :type name_availability_request: ~azure.mgmt.rdbms.mariadb.models.NameAvailabilityRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + available. Is either a NameAvailabilityRequest type or a IO[bytes] type. Required. + :type name_availability_request: ~azure.mgmt.rdbms.mariadb.models.NameAvailabilityRequest or + IO[bytes] :return: NameAvailability or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -132,22 +130,20 @@ async def execute( else: _json = self._serialize.body(name_availability_request, "NameAvailabilityRequest") - request = build_execute_request( + _request = build_execute_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.execute.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,11 +152,9 @@ async def execute( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - execute.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/checkNameAvailability"} + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_configurations_operations.py index cd756efef7da0..2765f157038be 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_configurations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._configurations_operations import ( build_create_or_update_request, build_get_request, @@ -37,6 +38,10 @@ ) from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,10 +70,10 @@ async def _create_or_update_initial( resource_group_name: str, server_name: str, configuration_name: str, - parameters: Union[_models.Configuration, IO], + parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -81,7 +86,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -91,7 +96,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Configuration") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, @@ -100,36 +105,33 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/configurations/{configurationName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -156,14 +158,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Configuration or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.Configuration] @@ -176,7 +170,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, configuration_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -191,18 +185,10 @@ async def begin_create_or_update( :param configuration_name: The name of the server configuration. Required. :type configuration_name: str :param parameters: The required parameters for updating a server configuration. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Configuration or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.Configuration] @@ -215,7 +201,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, configuration_name: str, - parameters: Union[_models.Configuration, IO], + parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Configuration]: """Updates a configuration of a server. @@ -228,19 +214,8 @@ async def begin_create_or_update( :param configuration_name: The name of the server configuration. Required. :type configuration_name: str :param parameters: The required parameters for updating a server configuration. Is either a - Configuration type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.Configuration or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Configuration type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.Configuration or IO[bytes] :return: An instance of AsyncLROPoller that returns either Configuration or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.Configuration] @@ -268,12 +243,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -283,17 +259,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Configuration].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/configurations/{configurationName}" - } + return AsyncLROPoller[_models.Configuration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def get( @@ -308,12 +282,11 @@ async def get( :type server_name: str :param configuration_name: The name of the server configuration. Required. :type configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Configuration or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.Configuration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -327,22 +300,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -351,16 +322,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/configurations/{configurationName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -373,7 +340,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Configuration or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.Configuration] :raises ~azure.core.exceptions.HttpResponseError: @@ -384,7 +350,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -395,24 +361,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationListResult", pipeline_response) @@ -422,11 +385,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -437,7 +400,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/configurations" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_databases_operations.py index 13e160253c6b1..210b6396e18b4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_databases_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._databases_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +39,10 @@ ) from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,10 +71,10 @@ async def _create_or_update_initial( resource_group_name: str, server_name: str, database_name: str, - parameters: Union[_models.Database, IO], + parameters: Union[_models.Database, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Database]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,7 +87,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -92,7 +97,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Database") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -101,39 +106,33 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Database", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Database", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/databases/{databaseName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -160,14 +159,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.Database] @@ -180,7 +171,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, database_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -195,18 +186,10 @@ async def begin_create_or_update( :param database_name: The name of the database. Required. :type database_name: str :param parameters: The required parameters for creating or updating a database. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.Database] @@ -219,7 +202,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, database_name: str, - parameters: Union[_models.Database, IO], + parameters: Union[_models.Database, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Database]: """Creates a new database or updates an existing database. @@ -232,19 +215,8 @@ async def begin_create_or_update( :param database_name: The name of the database. Required. :type database_name: str :param parameters: The required parameters for creating or updating a database. Is either a - Database type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.Database or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Database type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.Database or IO[bytes] :return: An instance of AsyncLROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.Database] @@ -272,12 +244,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -287,22 +260,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Database].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/databases/{databaseName}" - } + return AsyncLROPoller[_models.Database]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,38 +285,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/databases/{databaseName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -360,14 +334,6 @@ async def begin_delete( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -381,7 +347,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -391,11 +357,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -404,17 +371,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/databases/{databaseName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -429,12 +392,11 @@ async def get( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Database or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.Database :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,22 +410,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.Database] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -472,16 +432,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/databases/{databaseName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -494,7 +450,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Database or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.Database] :raises ~azure.core.exceptions.HttpResponseError: @@ -505,7 +460,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -516,24 +471,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DatabaseListResult", pipeline_response) @@ -543,11 +495,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,7 +510,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/databases" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_firewall_rules_operations.py index b98b8281025ae..bb3b1eede4dae 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_firewall_rules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._firewall_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +39,10 @@ ) from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,10 +71,10 @@ async def _create_or_update_initial( resource_group_name: str, server_name: str, firewall_rule_name: str, - parameters: Union[_models.FirewallRule, IO], + parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.FirewallRule]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,7 +87,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -92,7 +97,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "FirewallRule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -101,39 +106,33 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("FirewallRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -160,14 +159,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FirewallRule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.FirewallRule] @@ -180,7 +171,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, firewall_rule_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -195,18 +186,10 @@ async def begin_create_or_update( :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str :param parameters: The required parameters for creating or updating a firewall rule. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FirewallRule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.FirewallRule] @@ -219,7 +202,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, firewall_rule_name: str, - parameters: Union[_models.FirewallRule, IO], + parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.FirewallRule]: """Creates a new firewall rule or updates an existing firewall rule. @@ -232,19 +215,8 @@ async def begin_create_or_update( :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str :param parameters: The required parameters for creating or updating a firewall rule. Is either - a FirewallRule type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.FirewallRule or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + a FirewallRule type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.FirewallRule or IO[bytes] :return: An instance of AsyncLROPoller that returns either FirewallRule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.FirewallRule] @@ -272,12 +244,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -287,22 +260,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.FirewallRule].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return AsyncLROPoller[_models.FirewallRule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,38 +285,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -360,14 +334,6 @@ async def begin_delete( :type server_name: str :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -381,7 +347,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -391,11 +357,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -404,17 +371,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -429,12 +392,11 @@ async def get( :type server_name: str :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallRule or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.FirewallRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,22 +410,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -472,16 +432,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -494,7 +450,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallRule or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.FirewallRule] :raises ~azure.core.exceptions.HttpResponseError: @@ -505,7 +460,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -516,24 +471,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) @@ -543,11 +495,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,7 +510,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/firewallRules" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_location_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_location_based_performance_tier_operations.py index 2ab74d0dfb043..4a6d1cbfa44cc 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_location_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_location_based_performance_tier_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._location_based_performance_tier_operations import build_list_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +61,6 @@ def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.Perf :param location_name: The name of the location. Required. :type location_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PerformanceTierProperties or the result of cls(response) :rtype: @@ -71,7 +73,7 @@ def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.Perf api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PerformanceTierListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,23 +84,20 @@ def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.Perf def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( location_name=location_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PerformanceTierListResult", pipeline_response) @@ -108,11 +107,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -123,7 +122,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/locations/{locationName}/performanceTiers" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_location_based_recommended_action_sessions_operation_status_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_location_based_recommended_action_sessions_operation_status_operations.py index 1ec5082aee534..93a3e7659774d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_location_based_recommended_action_sessions_operation_status_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_location_based_recommended_action_sessions_operation_status_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,22 +18,24 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._location_based_recommended_action_sessions_operation_status_operations import build_get_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class LocationBasedRecommendedActionSessionsOperationStatusOperations: +class LocationBasedRecommendedActionSessionsOperationStatusOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -61,12 +64,11 @@ async def get( :type location_name: str :param operation_id: The operation identifier. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecommendedActionSessionsOperationStatus or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.RecommendedActionSessionsOperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -80,21 +82,19 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.RecommendedActionSessionsOperationStatus] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( location_name=location_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -103,13 +103,9 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendedActionSessionsOperationStatus", pipeline_response) + deserialized = self._deserialize("RecommendedActionSessionsOperationStatus", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/locations/{locationName}/recommendedActionSessionsAzureAsyncOperation/{operationId}" - } + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_location_based_recommended_action_sessions_result_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_location_based_recommended_action_sessions_result_operations.py index 8e06eb13ebc91..7c464d954f1c4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_location_based_recommended_action_sessions_result_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_location_based_recommended_action_sessions_result_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,22 +19,24 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._location_based_recommended_action_sessions_result_operations import build_list_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class LocationBasedRecommendedActionSessionsResultOperations: +class LocationBasedRecommendedActionSessionsResultOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -62,7 +65,6 @@ def list( :type location_name: str :param operation_id: The operation identifier. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RecommendationAction or the result of cls(response) :rtype: @@ -75,7 +77,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.RecommendationActionsResultList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -86,24 +88,21 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( location_name=location_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("RecommendationActionsResultList", pipeline_response) @@ -113,11 +112,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -128,7 +127,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/locations/{locationName}/recommendedActionSessionsOperationResults/{operationId}" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_log_files_operations.py index 5643533160a9b..fb3c248be6e6a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_log_files_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._log_files_operations import build_list_by_server_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +66,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LogFile or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.LogFile] :raises ~azure.core.exceptions.HttpResponseError: @@ -74,7 +76,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.LogFileListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -85,24 +87,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("LogFileListResult", pipeline_response) @@ -112,11 +111,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -127,7 +126,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/logFiles" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_maria_db_management_client_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_maria_db_management_client_operations.py index 057a2366e3480..a5ae59183dd86 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_maria_db_management_client_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_maria_db_management_client_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -14,30 +15,35 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._maria_db_management_client_operations import ( build_create_recommended_action_session_request, build_reset_query_performance_insight_data_request, ) from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MariaDBManagementClientOperationsMixin(MariaDBManagementClientMixinABC): + @distributed_trace_async async def reset_query_performance_insight_data( self, resource_group_name: str, server_name: str, **kwargs: Any @@ -49,12 +55,11 @@ async def reset_query_performance_insight_data( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QueryPerformanceInsightResetDataResult or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.QueryPerformanceInsightResetDataResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -68,21 +73,19 @@ async def reset_query_performance_insight_data( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.QueryPerformanceInsightResetDataResult] = kwargs.pop("cls", None) - request = build_reset_query_performance_insight_data_request( + _request = build_reset_query_performance_insight_data_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.reset_query_performance_insight_data.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -91,21 +94,17 @@ async def reset_query_performance_insight_data( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryPerformanceInsightResetDataResult", pipeline_response) + deserialized = self._deserialize("QueryPerformanceInsightResetDataResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_query_performance_insight_data.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/resetQueryPerformanceInsightData" - } + return deserialized # type: ignore - async def _create_recommended_action_session_initial( # pylint: disable=inconsistent-return-statements + async def _create_recommended_action_session_initial( # pylint: disable=name-too-long self, resource_group_name: str, server_name: str, advisor_name: str, database_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -117,39 +116,42 @@ async def _create_recommended_action_session_initial( # pylint: disable=inconsi _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_create_recommended_action_session_request( + _request = build_create_recommended_action_session_request( resource_group_name=resource_group_name, server_name=server_name, advisor_name=advisor_name, subscription_id=self._config.subscription_id, database_name=database_name, api_version=api_version, - template_url=self._create_recommended_action_session_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_recommended_action_session_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}/createRecommendedActionSession" - } + return deserialized # type: ignore @distributed_trace_async async def begin_create_recommended_action_session( @@ -166,14 +168,6 @@ async def begin_create_recommended_action_session( :type advisor_name: str :param database_name: The name of the database. Required. :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -187,7 +181,7 @@ async def begin_create_recommended_action_session( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_recommended_action_session_initial( # type: ignore + raw_result = await self._create_recommended_action_session_initial( resource_group_name=resource_group_name, server_name=server_name, advisor_name=advisor_name, @@ -198,11 +192,12 @@ async def begin_create_recommended_action_session( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -211,14 +206,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_recommended_action_session.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}/createRecommendedActionSession" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_operations.py index 7b24a25a6999f..78e93522c6a2d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,17 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,12 +58,11 @@ def __init__(self, *args, **kwargs) -> None: async def list(self, **kwargs: Any) -> _models.OperationListResult: """Lists all of the available REST API operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.OperationListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -74,18 +76,16 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -94,11 +94,9 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list.metadata = {"url": "/providers/Microsoft.DBforMariaDB/operations"} + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_private_endpoint_connections_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_private_endpoint_connections_operations.py index 72a37c8c8bb2f..d19e621992455 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_create_or_update_request, build_delete_request, @@ -39,6 +40,10 @@ ) from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,12 +80,11 @@ async def get( :type server_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,22 +98,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -118,26 +120,22 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> Optional[_models.PrivateEndpointConnection]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -150,7 +148,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -160,7 +158,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -169,36 +167,33 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -225,14 +220,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -246,7 +233,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -261,18 +248,10 @@ async def begin_create_or_update( :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -286,7 +265,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Approve or reject a private endpoint connection with a given name. @@ -298,19 +277,8 @@ async def begin_create_or_update( :type server_name: str :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str - :param parameters: Is either a PrivateEndpointConnection type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.PrivateEndpointConnection or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -339,12 +307,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -354,22 +323,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -381,38 +348,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -427,14 +397,6 @@ async def begin_delete( :type server_name: str :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -448,7 +410,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -458,11 +420,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -471,27 +434,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _update_tags_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnection: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +463,7 @@ async def _update_tags_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -514,7 +473,7 @@ async def _update_tags_initial( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -523,34 +482,33 @@ async def _update_tags_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_tags_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload async def begin_update_tags( @@ -580,14 +538,6 @@ async def begin_update_tags( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -601,7 +551,7 @@ async def begin_update_tags( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -619,18 +569,10 @@ async def begin_update_tags( :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update private endpoint connection Tags operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -644,7 +586,7 @@ async def begin_update_tags( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Updates tags on private endpoint connection. @@ -659,19 +601,8 @@ async def begin_update_tags( :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update private endpoint connection Tags - operation. Is either a TagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.TagsObject or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + operation. Is either a TagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.TagsObject or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -700,12 +631,13 @@ async def begin_update_tags( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -715,17 +647,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_server( @@ -738,7 +668,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -751,7 +680,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -762,24 +691,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -789,11 +715,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -804,7 +730,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_private_link_resources_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_private_link_resources_operations.py index ee4973e4ea65b..bf9091aa85ec2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_private_link_resources_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,18 +19,20 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request, build_list_by_server_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +67,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.PrivateLinkResource] @@ -76,7 +78,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -87,24 +89,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -114,11 +113,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -130,10 +129,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateLinkResources" - } - @distributed_trace_async async def get( self, resource_group_name: str, server_name: str, group_name: str, **kwargs: Any @@ -147,12 +142,11 @@ async def get( :type server_name: str :param group_name: The name of the private link resource. Required. :type group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,22 +160,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, group_name=group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -190,13 +182,9 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateLinkResources/{groupName}" - } + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_query_texts_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_query_texts_operations.py index 2db065377e9e9..30dca5acceedc 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_query_texts_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_query_texts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,18 +19,20 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._query_texts_operations import build_get_request, build_list_by_server_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,12 +67,11 @@ async def get(self, resource_group_name: str, server_name: str, query_id: str, * :type server_name: str :param query_id: The Query-Store query identifier. Required. :type query_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QueryText or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.QueryText :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -83,22 +85,20 @@ async def get(self, resource_group_name: str, server_name: str, query_id: str, * api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.QueryText] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, query_id=query_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -107,16 +107,12 @@ async def get(self, resource_group_name: str, server_name: str, query_id: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryText", pipeline_response) + deserialized = self._deserialize("QueryText", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/queryTexts/{queryId}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -131,7 +127,6 @@ def list_by_server( :type server_name: str :param query_ids: The query identifiers. Required. :type query_ids: list[str] - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either QueryText or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.QueryText] :raises ~azure.core.exceptions.HttpResponseError: @@ -142,7 +137,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.QueryTextsResultList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -153,25 +148,22 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, query_ids=query_ids, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("QueryTextsResultList", pipeline_response) @@ -181,11 +173,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -196,7 +188,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/queryTexts" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_recommended_actions_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_recommended_actions_operations.py index 93e36b1f3b94b..db091df22de0a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_recommended_actions_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_recommended_actions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,18 +19,20 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommended_actions_operations import build_get_request, build_list_by_server_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,12 +71,11 @@ async def get( :type advisor_name: str :param recommended_action_name: The recommended action name. Required. :type recommended_action_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecommendationAction or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.RecommendationAction :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -87,23 +89,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.RecommendationAction] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, advisor_name=advisor_name, recommended_action_name=recommended_action_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -112,16 +112,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationAction", pipeline_response) + deserialized = self._deserialize("RecommendationAction", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -143,7 +139,6 @@ def list_by_server( :type advisor_name: str :param session_id: The recommendation action session identifier. Default value is None. :type session_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RecommendationAction or the result of cls(response) :rtype: @@ -156,7 +151,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.RecommendationActionsResultList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,26 +162,23 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, advisor_name=advisor_name, subscription_id=self._config.subscription_id, session_id=session_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("RecommendationActionsResultList", pipeline_response) @@ -196,11 +188,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -211,7 +203,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}/recommendedActions" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_recoverable_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_recoverable_servers_operations.py index d15074b203cba..9e140709b43d7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_recoverable_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_recoverable_servers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,17 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recoverable_servers_operations import build_get_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,12 +63,11 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecoverableServerResource or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.RecoverableServerResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,21 +81,19 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.RecoverableServerResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -102,13 +102,9 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecoverableServerResource", pipeline_response) + deserialized = self._deserialize("RecoverableServerResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/recoverableServers" - } + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_replicas_operations.py index 8ecef41aa5040..f5022d9147f26 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_replicas_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._replicas_operations import build_list_by_server_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +66,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -74,7 +76,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -85,24 +87,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) @@ -112,11 +111,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -127,7 +126,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/replicas" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_server_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_server_based_performance_tier_operations.py index c08eff9571ef9..29b488997ffd7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_server_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_server_based_performance_tier_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_based_performance_tier_operations import build_list_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +66,6 @@ def list( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PerformanceTierProperties or the result of cls(response) :rtype: @@ -76,7 +78,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PerformanceTierListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -87,24 +89,21 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PerformanceTierListResult", pipeline_response) @@ -114,11 +113,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,7 +128,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/performanceTiers" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_server_parameters_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_server_parameters_operations.py index e6489d8e80a29..aafd2a89a0e68 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_server_parameters_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_server_parameters_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,22 +16,26 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_parameters_operations import build_list_update_configurations_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,10 +63,10 @@ async def _list_update_configurations_initial( self, resource_group_name: str, server_name: str, - value: Union[_models.ConfigurationListResult, IO], + value: Union[_models.ConfigurationListResult, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ConfigurationListResult]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -74,7 +79,7 @@ async def _list_update_configurations_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ConfigurationListResult]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -84,7 +89,7 @@ async def _list_update_configurations_initial( else: _json = self._serialize.body(value, "ConfigurationListResult") - request = build_list_update_configurations_request( + _request = build_list_update_configurations_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -92,36 +97,33 @@ async def _list_update_configurations_initial( content_type=content_type, json=_json, content=_content, - template_url=self._list_update_configurations_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _list_update_configurations_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/updateConfigurations" - } + return deserialized # type: ignore @overload async def begin_list_update_configurations( @@ -145,14 +147,6 @@ async def begin_list_update_configurations( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ConfigurationListResult or the result of cls(response) :rtype: @@ -165,7 +159,7 @@ async def begin_list_update_configurations( self, resource_group_name: str, server_name: str, - value: IO, + value: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -178,18 +172,10 @@ async def begin_list_update_configurations( :param server_name: The name of the server. Required. :type server_name: str :param value: The parameters for updating a list of server configuration. Required. - :type value: IO + :type value: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ConfigurationListResult or the result of cls(response) :rtype: @@ -202,7 +188,7 @@ async def begin_list_update_configurations( self, resource_group_name: str, server_name: str, - value: Union[_models.ConfigurationListResult, IO], + value: Union[_models.ConfigurationListResult, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ConfigurationListResult]: """Update a list of configurations in a given server. @@ -213,19 +199,8 @@ async def begin_list_update_configurations( :param server_name: The name of the server. Required. :type server_name: str :param value: The parameters for updating a list of server configuration. Is either a - ConfigurationListResult type or a IO type. Required. - :type value: ~azure.mgmt.rdbms.mariadb.models.ConfigurationListResult or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ConfigurationListResult type or a IO[bytes] type. Required. + :type value: ~azure.mgmt.rdbms.mariadb.models.ConfigurationListResult or IO[bytes] :return: An instance of AsyncLROPoller that returns either ConfigurationListResult or the result of cls(response) :rtype: @@ -253,12 +228,13 @@ async def begin_list_update_configurations( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = self._deserialize("ConfigurationListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -271,14 +247,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ConfigurationListResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_list_update_configurations.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/updateConfigurations" - } + return AsyncLROPoller[_models.ConfigurationListResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_server_security_alert_policies_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_server_security_alert_policies_operations.py index 1a647fc368eea..fb232ef74287f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_server_security_alert_policies_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_server_security_alert_policies_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_security_alert_policies_operations import ( build_create_or_update_request, build_get_request, @@ -37,6 +38,10 @@ ) from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,12 +83,11 @@ async def get( :param security_alert_policy_name: The name of the security alert policy. "Default" Required. :type security_alert_policy_name: str or ~azure.mgmt.rdbms.mariadb.models.SecurityAlertPolicyName - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerSecurityAlertPolicy or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.ServerSecurityAlertPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,22 +101,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.ServerSecurityAlertPolicy] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, security_alert_policy_name=security_alert_policy_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -121,26 +123,22 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, server_name: str, security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], - parameters: Union[_models.ServerSecurityAlertPolicy, IO], + parameters: Union[_models.ServerSecurityAlertPolicy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ServerSecurityAlertPolicy]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -153,7 +151,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ServerSecurityAlertPolicy]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -163,7 +161,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "ServerSecurityAlertPolicy") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, security_alert_policy_name=security_alert_policy_name, @@ -172,36 +170,33 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -229,14 +224,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -250,7 +237,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -266,18 +253,10 @@ async def begin_create_or_update( :type security_alert_policy_name: str or ~azure.mgmt.rdbms.mariadb.models.SecurityAlertPolicyName :param parameters: The server security alert policy. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -291,7 +270,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], - parameters: Union[_models.ServerSecurityAlertPolicy, IO], + parameters: Union[_models.ServerSecurityAlertPolicy, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ServerSecurityAlertPolicy]: """Creates or updates a threat detection policy. @@ -305,19 +284,8 @@ async def begin_create_or_update( :type security_alert_policy_name: str or ~azure.mgmt.rdbms.mariadb.models.SecurityAlertPolicyName :param parameters: The server security alert policy. Is either a ServerSecurityAlertPolicy type - or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.ServerSecurityAlertPolicy or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.ServerSecurityAlertPolicy or IO[bytes] :return: An instance of AsyncLROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -346,12 +314,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -361,17 +330,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ServerSecurityAlertPolicy].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" - } + return AsyncLROPoller[_models.ServerSecurityAlertPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_server( @@ -384,7 +351,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -397,7 +363,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.ServerSecurityAlertPolicyListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -408,24 +374,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ServerSecurityAlertPolicyListResult", pipeline_response) @@ -435,11 +398,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -450,7 +413,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/securityAlertPolicies" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_servers_operations.py index 46bff2bd673f5..d76eb8ce25bd3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_servers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._servers_operations import ( build_create_request, build_delete_request, @@ -43,6 +44,10 @@ ) from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,9 +72,13 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def _create_initial( - self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerForCreate, IO], **kwargs: Any - ) -> Optional[_models.Server]: - error_map = { + self, + resource_group_name: str, + server_name: str, + parameters: Union[_models.ServerForCreate, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,7 +91,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -92,7 +101,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "ServerForCreate") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -100,39 +109,33 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Server", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return deserialized # type: ignore @overload async def begin_create( @@ -157,14 +160,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.Server] @@ -176,7 +171,7 @@ async def begin_create( self, resource_group_name: str, server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -190,18 +185,10 @@ async def begin_create( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for creating or updating a server. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.Server] @@ -210,7 +197,11 @@ async def begin_create( @distributed_trace_async async def begin_create( - self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerForCreate, IO], **kwargs: Any + self, + resource_group_name: str, + server_name: str, + parameters: Union[_models.ServerForCreate, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.Server]: """Creates a new server or updates an existing server. The update action will overwrite the existing server. @@ -221,19 +212,8 @@ async def begin_create( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for creating or updating a server. Is either a - ServerForCreate type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.ServerForCreate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ServerForCreate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.ServerForCreate or IO[bytes] :return: An instance of AsyncLROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.Server] @@ -260,12 +240,13 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -275,26 +256,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Server].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return AsyncLROPoller[_models.Server]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, server_name: str, - parameters: Union[_models.ServerUpdateParameters, IO], + parameters: Union[_models.ServerUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -307,7 +286,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -317,7 +296,7 @@ async def _update_initial( else: _json = self._serialize.body(parameters, "ServerUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -325,36 +304,33 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -379,14 +355,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.Server] @@ -398,7 +366,7 @@ async def begin_update( self, resource_group_name: str, server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -412,18 +380,10 @@ async def begin_update( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for updating a server. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.Server] @@ -435,7 +395,7 @@ async def begin_update( self, resource_group_name: str, server_name: str, - parameters: Union[_models.ServerUpdateParameters, IO], + parameters: Union[_models.ServerUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Server]: """Updates an existing server. The request body can contain one to many of the properties present @@ -447,19 +407,8 @@ async def begin_update( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for updating a server. Is either a - ServerUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.ServerUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ServerUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.ServerUpdateParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.Server] @@ -486,12 +435,13 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -501,22 +451,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Server].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return AsyncLROPoller[_models.Server]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -528,37 +474,40 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -569,14 +518,6 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -590,7 +531,7 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -599,11 +540,12 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -612,17 +554,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _models.Server: @@ -633,12 +571,11 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Server or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.Server :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -652,21 +589,19 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.Server] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,16 +610,12 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Server"]: @@ -693,7 +624,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -704,7 +634,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -715,23 +645,20 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) @@ -741,11 +668,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -757,15 +684,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers" - } - @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: """List all the servers in a given subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -776,7 +698,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -787,22 +709,19 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) @@ -812,11 +731,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -828,12 +747,8 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/servers"} - - async def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _restart_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -845,37 +760,40 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_restart_request( + _request = build_restart_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._restart_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/restart" - } + return deserialized # type: ignore @distributed_trace_async async def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -886,14 +804,6 @@ async def begin_restart(self, resource_group_name: str, server_name: str, **kwar :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -907,7 +817,7 @@ async def begin_restart(self, resource_group_name: str, server_name: str, **kwar lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restart_initial( # type: ignore + raw_result = await self._restart_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -916,11 +826,12 @@ async def begin_restart(self, resource_group_name: str, server_name: str, **kwar params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -929,22 +840,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/restart" - } - - async def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _start_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -956,38 +861,41 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_start_request( + _request = build_start_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/start" - } + return deserialized # type: ignore @distributed_trace_async async def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -998,14 +906,6 @@ async def begin_start(self, resource_group_name: str, server_name: str, **kwargs :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1019,7 +919,7 @@ async def begin_start(self, resource_group_name: str, server_name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._start_initial( # type: ignore + raw_result = await self._start_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1028,11 +928,12 @@ async def begin_start(self, resource_group_name: str, server_name: str, **kwargs params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -1041,22 +942,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/start" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _stop_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1068,38 +963,41 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_stop_request( + _request = build_stop_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/stop" - } + return deserialized # type: ignore @distributed_trace_async async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1110,14 +1008,6 @@ async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1131,7 +1021,7 @@ async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._stop_initial( # type: ignore + raw_result = await self._stop_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1140,11 +1030,12 @@ async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -1153,14 +1044,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/stop" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_top_query_statistics_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_top_query_statistics_operations.py index afbb5dff05946..7b4b61e23c3ae 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_top_query_statistics_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_top_query_statistics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -19,18 +20,20 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_query_statistics_operations import build_get_request, build_list_by_server_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,12 +70,11 @@ async def get( :type server_name: str :param query_statistic_id: The Query Statistic identifier. Required. :type query_statistic_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QueryStatistic or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.QueryStatistic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -86,22 +88,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.QueryStatistic] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, query_statistic_id=query_statistic_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -110,16 +110,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryStatistic", pipeline_response) + deserialized = self._deserialize("QueryStatistic", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/topQueryStatistics/{queryStatisticId}" - } + return deserialized # type: ignore @overload def list_by_server( @@ -143,7 +139,6 @@ def list_by_server( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either QueryStatistic or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.QueryStatistic] @@ -155,7 +150,7 @@ def list_by_server( self, resource_group_name: str, server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -168,11 +163,10 @@ def list_by_server( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for retrieving top query statistics. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either QueryStatistic or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.QueryStatistic] @@ -184,7 +178,7 @@ def list_by_server( self, resource_group_name: str, server_name: str, - parameters: Union[_models.TopQueryStatisticsInput, IO], + parameters: Union[_models.TopQueryStatisticsInput, IO[bytes]], **kwargs: Any ) -> AsyncIterable["_models.QueryStatistic"]: """Retrieve the Query-Store top queries for specified metric and aggregation. @@ -195,12 +189,8 @@ def list_by_server( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for retrieving top query statistics. Is either a - TopQueryStatisticsInput type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.TopQueryStatisticsInput or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + TopQueryStatisticsInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.TopQueryStatisticsInput or IO[bytes] :return: An iterator like instance of either QueryStatistic or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.QueryStatistic] @@ -213,7 +203,7 @@ def list_by_server( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TopQueryStatisticsResultList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +221,7 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -239,19 +229,16 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, content=_content, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("TopQueryStatisticsResultList", pipeline_response) @@ -261,11 +248,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -276,7 +263,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/topQueryStatistics" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_virtual_network_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_virtual_network_rules_operations.py index 84b6b49a94414..28c7fc01ebc08 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_virtual_network_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_virtual_network_rules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._virtual_network_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +39,10 @@ ) from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,12 +79,11 @@ async def get( :type server_name: str :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,22 +97,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,26 +119,22 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, server_name: str, virtual_network_rule_name: str, - parameters: Union[_models.VirtualNetworkRule, IO], + parameters: Union[_models.VirtualNetworkRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualNetworkRule]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +147,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualNetworkRule]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -159,7 +157,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "VirtualNetworkRule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, @@ -168,39 +166,33 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -227,14 +219,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule] @@ -247,7 +231,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, virtual_network_rule_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -262,18 +246,10 @@ async def begin_create_or_update( :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str :param parameters: The requested virtual Network Rule Resource state. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule] @@ -286,7 +262,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, virtual_network_rule_name: str, - parameters: Union[_models.VirtualNetworkRule, IO], + parameters: Union[_models.VirtualNetworkRule, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.VirtualNetworkRule]: """Creates or updates an existing virtual network rule. @@ -299,19 +275,8 @@ async def begin_create_or_update( :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str :param parameters: The requested virtual Network Rule Resource state. Is either a - VirtualNetworkRule type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + VirtualNetworkRule type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule or IO[bytes] :return: An instance of AsyncLROPoller that returns either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule] @@ -339,12 +304,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -354,22 +320,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.VirtualNetworkRule].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return AsyncLROPoller[_models.VirtualNetworkRule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, virtual_network_rule_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -381,38 +345,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -427,14 +394,6 @@ async def begin_delete( :type server_name: str :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -448,7 +407,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, @@ -458,11 +417,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -471,17 +431,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_by_server( @@ -494,7 +450,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule] @@ -506,7 +461,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.VirtualNetworkRuleListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,24 +472,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("VirtualNetworkRuleListResult", pipeline_response) @@ -544,11 +496,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,7 +511,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/virtualNetworkRules" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_wait_statistics_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_wait_statistics_operations.py index 62dba6e17cdff..50f405ffa1a6c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_wait_statistics_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/aio/operations/_wait_statistics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -19,18 +20,20 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._wait_statistics_operations import build_get_request, build_list_by_server_request from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,12 +70,11 @@ async def get( :type server_name: str :param wait_statistics_id: The Wait Statistic identifier. Required. :type wait_statistics_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WaitStatistic or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.WaitStatistic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -86,22 +88,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.WaitStatistic] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, wait_statistics_id=wait_statistics_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -110,16 +110,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WaitStatistic", pipeline_response) + deserialized = self._deserialize("WaitStatistic", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/waitStatistics/{waitStatisticsId}" - } + return deserialized # type: ignore @overload def list_by_server( @@ -143,7 +139,6 @@ def list_by_server( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WaitStatistic or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.WaitStatistic] :raises ~azure.core.exceptions.HttpResponseError: @@ -154,7 +149,7 @@ def list_by_server( self, resource_group_name: str, server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -167,11 +162,10 @@ def list_by_server( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for retrieving wait statistics. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WaitStatistic or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.WaitStatistic] :raises ~azure.core.exceptions.HttpResponseError: @@ -182,7 +176,7 @@ def list_by_server( self, resource_group_name: str, server_name: str, - parameters: Union[_models.WaitStatisticsInput, IO], + parameters: Union[_models.WaitStatisticsInput, IO[bytes]], **kwargs: Any ) -> AsyncIterable["_models.WaitStatistic"]: """Retrieve wait statistics for specified aggregation window. @@ -193,12 +187,8 @@ def list_by_server( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for retrieving wait statistics. Is either a - WaitStatisticsInput type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.WaitStatisticsInput or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + WaitStatisticsInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.WaitStatisticsInput or IO[bytes] :return: An iterator like instance of either WaitStatistic or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.mariadb.models.WaitStatistic] :raises ~azure.core.exceptions.HttpResponseError: @@ -210,7 +200,7 @@ def list_by_server( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WaitStatisticsResultList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -228,7 +218,7 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -236,19 +226,16 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, content=_content, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("WaitStatisticsResultList", pipeline_response) @@ -258,11 +245,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -273,7 +260,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/waitStatistics" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/models/_models_py3.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/models/_models_py3.py index dafc014351953..4f3f66bd418ad 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/models/_models_py3.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/models/_models_py3.py @@ -30,7 +30,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -66,7 +66,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -75,22 +75,6 @@ class ProxyResource(Resource): :vartype type: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class Advisor(ProxyResource): """Represents a recommendation action advisor. @@ -98,7 +82,7 @@ class Advisor(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -185,7 +169,7 @@ class Configuration(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -270,7 +254,7 @@ class Database(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -406,10 +390,10 @@ class FirewallRule(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -486,7 +470,7 @@ class LogFile(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -604,7 +588,7 @@ def __init__( class NameAvailabilityRequest(_serialization.Model): """Request from client to check resource name availability. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: Resource name to verify. Required. :vartype name: str @@ -918,7 +902,7 @@ class PrivateEndpointConnection(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1029,7 +1013,7 @@ class PrivateLinkResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1116,12 +1100,12 @@ def __init__(self, **kwargs: Any) -> None: self.required_members = None -class PrivateLinkServiceConnectionStateProperty(_serialization.Model): +class PrivateLinkServiceConnectionStateProperty(_serialization.Model): # pylint: disable=name-too-long """PrivateLinkServiceConnectionStateProperty. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar status: The private link service connection status. Required. :vartype status: str @@ -1196,7 +1180,7 @@ class QueryStatistic(ProxyResource): # pylint: disable=too-many-instance-attrib Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1303,7 +1287,7 @@ class QueryText(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1376,7 +1360,7 @@ class RecommendationAction(ProxyResource): # pylint: disable=too-many-instance- Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1536,7 +1520,7 @@ class RecoverableServerResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1598,10 +1582,10 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1646,10 +1630,10 @@ class Server(TrackedResource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1810,7 +1794,7 @@ def __init__( class ServerForCreate(_serialization.Model): """Represents a server to be created. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar sku: The SKU (pricing tier) of the server. :vartype sku: ~azure.mgmt.rdbms.mariadb.models.Sku @@ -1908,7 +1892,7 @@ def __init__(self, **kwargs: Any) -> None: self.properties = None -class ServerPrivateEndpointConnectionProperties(_serialization.Model): +class ServerPrivateEndpointConnectionProperties(_serialization.Model): # pylint: disable=name-too-long """Properties of a private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -1961,12 +1945,12 @@ def __init__( self.provisioning_state = None -class ServerPrivateLinkServiceConnectionStateProperty(_serialization.Model): +class ServerPrivateLinkServiceConnectionStateProperty(_serialization.Model): # pylint: disable=name-too-long """ServerPrivateLinkServiceConnectionStateProperty. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar status: The private link service connection status. Required. Known values are: "Approved", "Pending", "Rejected", and "Disconnected". @@ -2015,7 +1999,7 @@ class ServerPropertiesForCreate(_serialization.Model): ServerPropertiesForDefaultCreate, ServerPropertiesForGeoRestore, ServerPropertiesForRestore, ServerPropertiesForReplica - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar version: Server version. Known values are: "10.2" and "10.3". :vartype version: str or ~azure.mgmt.rdbms.mariadb.models.ServerVersion @@ -2097,7 +2081,7 @@ def __init__( class ServerPropertiesForDefaultCreate(ServerPropertiesForCreate): """The properties used to create a new server. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar version: Server version. Known values are: "10.2" and "10.3". :vartype version: str or ~azure.mgmt.rdbms.mariadb.models.ServerVersion @@ -2191,7 +2175,7 @@ class ServerPropertiesForGeoRestore(ServerPropertiesForCreate): """The properties used to create a new server by restoring to a different region from a geo replicated backup. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar version: Server version. Known values are: "10.2" and "10.3". :vartype version: str or ~azure.mgmt.rdbms.mariadb.models.ServerVersion @@ -2274,7 +2258,7 @@ def __init__( class ServerPropertiesForReplica(ServerPropertiesForCreate): """The properties to create a new replica. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar version: Server version. Known values are: "10.2" and "10.3". :vartype version: str or ~azure.mgmt.rdbms.mariadb.models.ServerVersion @@ -2357,7 +2341,7 @@ def __init__( class ServerPropertiesForRestore(ServerPropertiesForCreate): """The properties used to create a new server by restoring from a backup. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar version: Server version. Known values are: "10.2" and "10.3". :vartype version: str or ~azure.mgmt.rdbms.mariadb.models.ServerVersion @@ -2453,7 +2437,7 @@ class ServerSecurityAlertPolicy(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2665,7 +2649,7 @@ def __init__( class Sku(_serialization.Model): """Billing information related properties of a server. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. Required. @@ -2798,7 +2782,7 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N class TopQueryStatisticsInput(_serialization.Model): """Input to get top query statistics. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar number_of_top_queries: Max number of top queries to return. Required. :vartype number_of_top_queries: int @@ -2900,7 +2884,7 @@ class VirtualNetworkRule(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2987,7 +2971,7 @@ class WaitStatistic(ProxyResource): # pylint: disable=too-many-instance-attribu Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3084,7 +3068,7 @@ def __init__( class WaitStatisticsInput(_serialization.Model): """Input to get wait statistics. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar observation_start_time: Observation start time. Required. :vartype observation_start_time: ~datetime.datetime diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_advisors_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_advisors_operations.py index e30f2f7e579a2..975f0c1aac868 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_advisors_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_advisors_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -132,12 +136,11 @@ def get(self, resource_group_name: str, server_name: str, advisor_name: str, **k :type server_name: str :param advisor_name: The advisor name for recommendation action. Required. :type advisor_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Advisor or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.Advisor :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,22 +154,20 @@ def get(self, resource_group_name: str, server_name: str, advisor_name: str, **k api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.Advisor] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, advisor_name=advisor_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -175,16 +176,12 @@ def get(self, resource_group_name: str, server_name: str, advisor_name: str, **k map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Advisor", pipeline_response) + deserialized = self._deserialize("Advisor", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterable["_models.Advisor"]: @@ -195,7 +192,6 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Advisor or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.Advisor] :raises ~azure.core.exceptions.HttpResponseError: @@ -206,7 +202,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.AdvisorsResultList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -217,24 +213,21 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("AdvisorsResultList", pipeline_response) @@ -244,11 +237,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -259,7 +252,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_check_name_availability_operations.py index 02f4c90df2e1c..ff4bc4e11e04f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_check_name_availability_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +103,6 @@ def execute( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: @@ -107,17 +110,16 @@ def execute( @overload def execute( - self, name_availability_request: IO, *, content_type: str = "application/json", **kwargs: Any + self, name_availability_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailability: """Check the availability of name for resource. :param name_availability_request: The required parameters for checking if resource name is available. Required. - :type name_availability_request: IO + :type name_availability_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: @@ -125,22 +127,19 @@ def execute( @distributed_trace def execute( - self, name_availability_request: Union[_models.NameAvailabilityRequest, IO], **kwargs: Any + self, name_availability_request: Union[_models.NameAvailabilityRequest, IO[bytes]], **kwargs: Any ) -> _models.NameAvailability: """Check the availability of name for resource. :param name_availability_request: The required parameters for checking if resource name is - available. Is either a NameAvailabilityRequest type or a IO type. Required. - :type name_availability_request: ~azure.mgmt.rdbms.mariadb.models.NameAvailabilityRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + available. Is either a NameAvailabilityRequest type or a IO[bytes] type. Required. + :type name_availability_request: ~azure.mgmt.rdbms.mariadb.models.NameAvailabilityRequest or + IO[bytes] :return: NameAvailability or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,22 +162,20 @@ def execute( else: _json = self._serialize.body(name_availability_request, "NameAvailabilityRequest") - request = build_execute_request( + _request = build_execute_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.execute.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,11 +184,9 @@ def execute( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - execute.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/checkNameAvailability"} + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_configurations_operations.py index ebfb4e73aa7d0..ff98f9c338804 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_configurations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -166,10 +172,10 @@ def _create_or_update_initial( resource_group_name: str, server_name: str, configuration_name: str, - parameters: Union[_models.Configuration, IO], + parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +188,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -192,7 +198,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Configuration") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, @@ -201,36 +207,33 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/configurations/{configurationName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -257,14 +260,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Configuration or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.Configuration] @@ -277,7 +272,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, configuration_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -292,18 +287,10 @@ def begin_create_or_update( :param configuration_name: The name of the server configuration. Required. :type configuration_name: str :param parameters: The required parameters for updating a server configuration. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Configuration or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.Configuration] @@ -316,7 +303,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, configuration_name: str, - parameters: Union[_models.Configuration, IO], + parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Configuration]: """Updates a configuration of a server. @@ -329,19 +316,8 @@ def begin_create_or_update( :param configuration_name: The name of the server configuration. Required. :type configuration_name: str :param parameters: The required parameters for updating a server configuration. Is either a - Configuration type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.Configuration or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Configuration type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.Configuration or IO[bytes] :return: An instance of LROPoller that returns either Configuration or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.Configuration] @@ -369,12 +345,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -384,17 +361,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Configuration].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/configurations/{configurationName}" - } + return LROPoller[_models.Configuration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def get( @@ -409,12 +384,11 @@ def get( :type server_name: str :param configuration_name: The name of the server configuration. Required. :type configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Configuration or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.Configuration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,22 +402,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -452,16 +424,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/configurations/{configurationName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -474,7 +442,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Configuration or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.Configuration] :raises ~azure.core.exceptions.HttpResponseError: @@ -485,7 +452,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -496,24 +463,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationListResult", pipeline_response) @@ -523,11 +487,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,7 +502,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/configurations" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_databases_operations.py index f5fa0c616b3c1..3567e3e78644d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_databases_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -200,10 +206,10 @@ def _create_or_update_initial( resource_group_name: str, server_name: str, database_name: str, - parameters: Union[_models.Database, IO], + parameters: Union[_models.Database, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Database]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +222,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -226,7 +232,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Database") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -235,39 +241,33 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Database", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Database", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/databases/{databaseName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -294,14 +294,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.Database] :raises ~azure.core.exceptions.HttpResponseError: @@ -313,7 +305,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, database_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -328,18 +320,10 @@ def begin_create_or_update( :param database_name: The name of the database. Required. :type database_name: str :param parameters: The required parameters for creating or updating a database. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.Database] :raises ~azure.core.exceptions.HttpResponseError: @@ -351,7 +335,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, database_name: str, - parameters: Union[_models.Database, IO], + parameters: Union[_models.Database, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Database]: """Creates a new database or updates an existing database. @@ -364,19 +348,8 @@ def begin_create_or_update( :param database_name: The name of the database. Required. :type database_name: str :param parameters: The required parameters for creating or updating a database. Is either a - Database type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.Database or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Database type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.Database or IO[bytes] :return: An instance of LROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.Database] :raises ~azure.core.exceptions.HttpResponseError: @@ -403,12 +376,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -418,22 +392,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Database].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/databases/{databaseName}" - } + return LROPoller[_models.Database]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,38 +417,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/databases/{databaseName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -491,14 +466,6 @@ def begin_delete( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -512,7 +479,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -522,11 +489,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -535,17 +503,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/databases/{databaseName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> _models.Database: @@ -558,12 +522,11 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Database or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.Database :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -577,22 +540,20 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.Database] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -601,16 +562,12 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/databases/{databaseName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterable["_models.Database"]: @@ -621,7 +578,6 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Database or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.Database] :raises ~azure.core.exceptions.HttpResponseError: @@ -632,7 +588,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -643,24 +599,21 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DatabaseListResult", pipeline_response) @@ -670,11 +623,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -685,7 +638,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/databases" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_firewall_rules_operations.py index f9b8d8ea42591..26dbced5f0ddb 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_firewall_rules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -200,10 +206,10 @@ def _create_or_update_initial( resource_group_name: str, server_name: str, firewall_rule_name: str, - parameters: Union[_models.FirewallRule, IO], + parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.FirewallRule]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +222,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -226,7 +232,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "FirewallRule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -235,39 +241,33 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("FirewallRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -294,14 +294,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FirewallRule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.FirewallRule] @@ -314,7 +306,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, firewall_rule_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -329,18 +321,10 @@ def begin_create_or_update( :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str :param parameters: The required parameters for creating or updating a firewall rule. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FirewallRule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.FirewallRule] @@ -353,7 +337,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, firewall_rule_name: str, - parameters: Union[_models.FirewallRule, IO], + parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.FirewallRule]: """Creates a new firewall rule or updates an existing firewall rule. @@ -366,19 +350,8 @@ def begin_create_or_update( :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str :param parameters: The required parameters for creating or updating a firewall rule. Is either - a FirewallRule type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.FirewallRule or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + a FirewallRule type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.FirewallRule or IO[bytes] :return: An instance of LROPoller that returns either FirewallRule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.FirewallRule] @@ -406,12 +379,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -421,22 +395,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.FirewallRule].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return LROPoller[_models.FirewallRule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,38 +420,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -494,14 +469,6 @@ def begin_delete( :type server_name: str :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -515,7 +482,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -525,11 +492,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -538,17 +506,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -563,12 +527,11 @@ def get( :type server_name: str :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallRule or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.FirewallRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -582,22 +545,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -606,16 +567,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -628,7 +585,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallRule or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.FirewallRule] :raises ~azure.core.exceptions.HttpResponseError: @@ -639,7 +595,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -650,24 +606,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) @@ -677,11 +630,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -692,7 +645,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/firewallRules" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_location_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_location_based_performance_tier_operations.py index 08a2aa79bf812..64466689379ce 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_location_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_location_based_performance_tier_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +92,6 @@ def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.Performan :param location_name: The name of the location. Required. :type location_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PerformanceTierProperties or the result of cls(response) :rtype: @@ -101,7 +104,7 @@ def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.Performan api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PerformanceTierListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,23 +115,20 @@ def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.Performan def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( location_name=location_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PerformanceTierListResult", pipeline_response) @@ -138,11 +138,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,7 +153,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/locations/{locationName}/performanceTiers" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_location_based_recommended_action_sessions_operation_status_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_location_based_recommended_action_sessions_operation_status_operations.py index 6a5258f18b733..bfd200a6391e0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_location_based_recommended_action_sessions_operation_status_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_location_based_recommended_action_sessions_operation_status_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +67,7 @@ def build_get_request(location_name: str, operation_id: str, subscription_id: st return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class LocationBasedRecommendedActionSessionsOperationStatusOperations: +class LocationBasedRecommendedActionSessionsOperationStatusOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -92,12 +96,11 @@ def get( :type location_name: str :param operation_id: The operation identifier. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecommendedActionSessionsOperationStatus or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.RecommendedActionSessionsOperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,21 +114,19 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.RecommendedActionSessionsOperationStatus] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( location_name=location_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -134,13 +135,9 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendedActionSessionsOperationStatus", pipeline_response) + deserialized = self._deserialize("RecommendedActionSessionsOperationStatus", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/locations/{locationName}/recommendedActionSessionsAzureAsyncOperation/{operationId}" - } + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_location_based_recommended_action_sessions_result_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_location_based_recommended_action_sessions_result_operations.py index 80d3dc9605555..2ede7e6efab94 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_location_based_recommended_action_sessions_result_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_location_based_recommended_action_sessions_result_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +68,7 @@ def build_list_request(location_name: str, operation_id: str, subscription_id: s return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class LocationBasedRecommendedActionSessionsResultOperations: +class LocationBasedRecommendedActionSessionsResultOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -91,7 +95,6 @@ def list(self, location_name: str, operation_id: str, **kwargs: Any) -> Iterable :type location_name: str :param operation_id: The operation identifier. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RecommendationAction or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.RecommendationAction] @@ -103,7 +106,7 @@ def list(self, location_name: str, operation_id: str, **kwargs: Any) -> Iterable api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.RecommendationActionsResultList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,24 +117,21 @@ def list(self, location_name: str, operation_id: str, **kwargs: Any) -> Iterable def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( location_name=location_name, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RecommendationActionsResultList", pipeline_response) @@ -141,11 +141,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,7 +156,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/locations/{locationName}/recommendedActionSessionsOperationResults/{operationId}" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_log_files_operations.py index 20af5a6e34602..408fe43a9afd5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_log_files_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +100,6 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LogFile or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.LogFile] :raises ~azure.core.exceptions.HttpResponseError: @@ -107,7 +110,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.LogFileListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,24 +121,21 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("LogFileListResult", pipeline_response) @@ -145,11 +145,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -160,7 +160,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/logFiles" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_maria_db_management_client_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_maria_db_management_client_operations.py index 5e7b8212f82ea..20adff1df6549 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_maria_db_management_client_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_maria_db_management_client_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast +import sys +from typing import Any, Callable, Dict, Iterator, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -14,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -27,8 +29,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +42,7 @@ _SERIALIZER.client_side_validation = False -def build_reset_query_performance_insight_data_request( +def build_reset_query_performance_insight_data_request( # pylint: disable=name-too-long resource_group_name: str, server_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -69,7 +75,7 @@ def build_reset_query_performance_insight_data_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_recommended_action_session_request( +def build_create_recommended_action_session_request( # pylint: disable=name-too-long resource_group_name: str, server_name: str, advisor_name: str, @@ -105,6 +111,7 @@ def build_create_recommended_action_session_request( class MariaDBManagementClientOperationsMixin(MariaDBManagementClientMixinABC): + @distributed_trace def reset_query_performance_insight_data( self, resource_group_name: str, server_name: str, **kwargs: Any @@ -116,12 +123,11 @@ def reset_query_performance_insight_data( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QueryPerformanceInsightResetDataResult or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.QueryPerformanceInsightResetDataResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -135,21 +141,19 @@ def reset_query_performance_insight_data( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.QueryPerformanceInsightResetDataResult] = kwargs.pop("cls", None) - request = build_reset_query_performance_insight_data_request( + _request = build_reset_query_performance_insight_data_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.reset_query_performance_insight_data.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,21 +162,17 @@ def reset_query_performance_insight_data( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryPerformanceInsightResetDataResult", pipeline_response) + deserialized = self._deserialize("QueryPerformanceInsightResetDataResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_query_performance_insight_data.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/resetQueryPerformanceInsightData" - } + return deserialized # type: ignore - def _create_recommended_action_session_initial( # pylint: disable=inconsistent-return-statements + def _create_recommended_action_session_initial( # pylint: disable=name-too-long self, resource_group_name: str, server_name: str, advisor_name: str, database_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,39 +184,42 @@ def _create_recommended_action_session_initial( # pylint: disable=inconsistent- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_create_recommended_action_session_request( + _request = build_create_recommended_action_session_request( resource_group_name=resource_group_name, server_name=server_name, advisor_name=advisor_name, subscription_id=self._config.subscription_id, database_name=database_name, api_version=api_version, - template_url=self._create_recommended_action_session_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_recommended_action_session_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}/createRecommendedActionSession" - } + return deserialized # type: ignore @distributed_trace def begin_create_recommended_action_session( @@ -233,14 +236,6 @@ def begin_create_recommended_action_session( :type advisor_name: str :param database_name: The name of the database. Required. :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -254,7 +249,7 @@ def begin_create_recommended_action_session( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_recommended_action_session_initial( # type: ignore + raw_result = self._create_recommended_action_session_initial( resource_group_name=resource_group_name, server_name=server_name, advisor_name=advisor_name, @@ -265,11 +260,12 @@ def begin_create_recommended_action_session( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -278,14 +274,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_recommended_action_session.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}/createRecommendedActionSession" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_operations.py index 68284e13180b6..13789a3679b24 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,12 +80,11 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> _models.OperationListResult: """Lists all of the available REST API operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.OperationListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,18 +98,16 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -115,11 +116,9 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list.metadata = {"url": "/providers/Microsoft.DBforMariaDB/operations"} + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_private_endpoint_connections_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_private_endpoint_connections_operations.py index 7095bd3fa55e0..dbbf245824256 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_private_endpoint_connections_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -269,12 +275,11 @@ def get( :type server_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,22 +293,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -312,26 +315,22 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> Optional[_models.PrivateEndpointConnection]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -344,7 +343,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -354,7 +353,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -363,36 +362,33 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -419,14 +415,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -440,7 +428,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -455,18 +443,10 @@ def begin_create_or_update( :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -480,7 +460,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: """Approve or reject a private endpoint connection with a given name. @@ -492,19 +472,8 @@ def begin_create_or_update( :type server_name: str :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str - :param parameters: Is either a PrivateEndpointConnection type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.PrivateEndpointConnection or IO[bytes] :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -533,12 +502,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -548,22 +518,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,38 +543,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -621,14 +592,6 @@ def begin_delete( :type server_name: str :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -642,7 +605,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -652,11 +615,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -665,27 +629,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _update_tags_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnection: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -698,7 +658,7 @@ def _update_tags_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -708,7 +668,7 @@ def _update_tags_initial( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -717,34 +677,33 @@ def _update_tags_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_tags_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload def begin_update_tags( @@ -774,14 +733,6 @@ def begin_update_tags( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -795,7 +746,7 @@ def begin_update_tags( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -813,18 +764,10 @@ def begin_update_tags( :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update private endpoint connection Tags operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -838,7 +781,7 @@ def begin_update_tags( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: """Updates tags on private endpoint connection. @@ -853,19 +796,8 @@ def begin_update_tags( :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update private endpoint connection Tags - operation. Is either a TagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.TagsObject or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + operation. Is either a TagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.TagsObject or IO[bytes] :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -894,12 +826,13 @@ def begin_update_tags( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -909,17 +842,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_server( @@ -932,7 +863,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -945,7 +875,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -956,24 +886,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -983,11 +910,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -998,7 +925,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_private_link_resources_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_private_link_resources_operations.py index 3f5346dac6b15..12c0836d36eed 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_private_link_resources_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -132,7 +136,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.PrivateLinkResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -143,7 +146,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -154,24 +157,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -181,11 +181,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -197,10 +197,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateLinkResources" - } - @distributed_trace def get( self, resource_group_name: str, server_name: str, group_name: str, **kwargs: Any @@ -214,12 +210,11 @@ def get( :type server_name: str :param group_name: The name of the private link resource. Required. :type group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -233,22 +228,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, group_name=group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -257,13 +250,9 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateLinkResources/{groupName}" - } + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_query_texts_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_query_texts_operations.py index 765c683eea9ca..c66dd81686f31 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_query_texts_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_query_texts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -133,12 +137,11 @@ def get(self, resource_group_name: str, server_name: str, query_id: str, **kwarg :type server_name: str :param query_id: The Query-Store query identifier. Required. :type query_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QueryText or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.QueryText :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -152,22 +155,20 @@ def get(self, resource_group_name: str, server_name: str, query_id: str, **kwarg api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.QueryText] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, query_id=query_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,16 +177,12 @@ def get(self, resource_group_name: str, server_name: str, query_id: str, **kwarg map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryText", pipeline_response) + deserialized = self._deserialize("QueryText", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/queryTexts/{queryId}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -200,7 +197,6 @@ def list_by_server( :type server_name: str :param query_ids: The query identifiers. Required. :type query_ids: list[str] - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either QueryText or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.QueryText] :raises ~azure.core.exceptions.HttpResponseError: @@ -211,7 +207,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.QueryTextsResultList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,25 +218,22 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, query_ids=query_ids, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("QueryTextsResultList", pipeline_response) @@ -250,11 +243,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -265,7 +258,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/queryTexts" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_recommended_actions_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_recommended_actions_operations.py index 9625a31d67065..ab55522a26abe 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_recommended_actions_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_recommended_actions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -151,12 +155,11 @@ def get( :type advisor_name: str :param recommended_action_name: The recommended action name. Required. :type recommended_action_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecommendationAction or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.RecommendationAction :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -170,23 +173,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.RecommendationAction] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, advisor_name=advisor_name, recommended_action_name=recommended_action_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -195,16 +196,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationAction", pipeline_response) + deserialized = self._deserialize("RecommendationAction", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -226,7 +223,6 @@ def list_by_server( :type advisor_name: str :param session_id: The recommendation action session identifier. Default value is None. :type session_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RecommendationAction or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.RecommendationAction] @@ -238,7 +234,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.RecommendationActionsResultList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -249,26 +245,23 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, advisor_name=advisor_name, subscription_id=self._config.subscription_id, session_id=session_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RecommendationActionsResultList", pipeline_response) @@ -278,11 +271,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -293,7 +286,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}/recommendedActions" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_recoverable_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_recoverable_servers_operations.py index e4ec949a11b53..1f411412db604 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_recoverable_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_recoverable_servers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -93,12 +97,11 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecoverableServerResource or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.RecoverableServerResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,21 +115,19 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.RecoverableServerResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -135,13 +136,9 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecoverableServerResource", pipeline_response) + deserialized = self._deserialize("RecoverableServerResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/recoverableServers" - } + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_replicas_operations.py index 8290b41df97f2..e5f23924d232c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_replicas_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +100,6 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -107,7 +110,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,24 +121,21 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) @@ -145,11 +145,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -160,7 +160,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/replicas" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_server_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_server_based_performance_tier_operations.py index 1a237cf0b521b..c4052aaaa7fb0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_server_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_server_based_performance_tier_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +100,6 @@ def list( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PerformanceTierProperties or the result of cls(response) :rtype: @@ -109,7 +112,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PerformanceTierListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,24 +123,21 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PerformanceTierListResult", pipeline_response) @@ -147,11 +147,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -162,7 +162,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/performanceTiers" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_server_parameters_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_server_parameters_operations.py index e004a7560470e..872762a6841e6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_server_parameters_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_server_parameters_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +30,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,10 +102,10 @@ def _list_update_configurations_initial( self, resource_group_name: str, server_name: str, - value: Union[_models.ConfigurationListResult, IO], + value: Union[_models.ConfigurationListResult, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ConfigurationListResult]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +118,7 @@ def _list_update_configurations_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ConfigurationListResult]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -122,7 +128,7 @@ def _list_update_configurations_initial( else: _json = self._serialize.body(value, "ConfigurationListResult") - request = build_list_update_configurations_request( + _request = build_list_update_configurations_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -130,36 +136,33 @@ def _list_update_configurations_initial( content_type=content_type, json=_json, content=_content, - template_url=self._list_update_configurations_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _list_update_configurations_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/updateConfigurations" - } + return deserialized # type: ignore @overload def begin_list_update_configurations( @@ -183,14 +186,6 @@ def begin_list_update_configurations( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ConfigurationListResult or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.ConfigurationListResult] @@ -202,7 +197,7 @@ def begin_list_update_configurations( self, resource_group_name: str, server_name: str, - value: IO, + value: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -215,18 +210,10 @@ def begin_list_update_configurations( :param server_name: The name of the server. Required. :type server_name: str :param value: The parameters for updating a list of server configuration. Required. - :type value: IO + :type value: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ConfigurationListResult or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.ConfigurationListResult] @@ -238,7 +225,7 @@ def begin_list_update_configurations( self, resource_group_name: str, server_name: str, - value: Union[_models.ConfigurationListResult, IO], + value: Union[_models.ConfigurationListResult, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ConfigurationListResult]: """Update a list of configurations in a given server. @@ -249,19 +236,8 @@ def begin_list_update_configurations( :param server_name: The name of the server. Required. :type server_name: str :param value: The parameters for updating a list of server configuration. Is either a - ConfigurationListResult type or a IO type. Required. - :type value: ~azure.mgmt.rdbms.mariadb.models.ConfigurationListResult or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ConfigurationListResult type or a IO[bytes] type. Required. + :type value: ~azure.mgmt.rdbms.mariadb.models.ConfigurationListResult or IO[bytes] :return: An instance of LROPoller that returns either ConfigurationListResult or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.ConfigurationListResult] @@ -288,12 +264,13 @@ def begin_list_update_configurations( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = self._deserialize("ConfigurationListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -305,14 +282,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ConfigurationListResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_list_update_configurations.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/updateConfigurations" - } + return LROPoller[_models.ConfigurationListResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_server_security_alert_policies_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_server_security_alert_policies_operations.py index 73bf2c7513a9d..981ed2ece579a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_server_security_alert_policies_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_server_security_alert_policies_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -187,12 +193,11 @@ def get( :param security_alert_policy_name: The name of the security alert policy. "Default" Required. :type security_alert_policy_name: str or ~azure.mgmt.rdbms.mariadb.models.SecurityAlertPolicyName - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerSecurityAlertPolicy or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.ServerSecurityAlertPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,22 +211,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.ServerSecurityAlertPolicy] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, security_alert_policy_name=security_alert_policy_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,26 +233,22 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, server_name: str, security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], - parameters: Union[_models.ServerSecurityAlertPolicy, IO], + parameters: Union[_models.ServerSecurityAlertPolicy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ServerSecurityAlertPolicy]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +261,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ServerSecurityAlertPolicy]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -272,7 +271,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "ServerSecurityAlertPolicy") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, security_alert_policy_name=security_alert_policy_name, @@ -281,36 +280,33 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -338,14 +334,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -359,7 +347,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -375,18 +363,10 @@ def begin_create_or_update( :type security_alert_policy_name: str or ~azure.mgmt.rdbms.mariadb.models.SecurityAlertPolicyName :param parameters: The server security alert policy. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -400,7 +380,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], - parameters: Union[_models.ServerSecurityAlertPolicy, IO], + parameters: Union[_models.ServerSecurityAlertPolicy, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ServerSecurityAlertPolicy]: """Creates or updates a threat detection policy. @@ -414,19 +394,8 @@ def begin_create_or_update( :type security_alert_policy_name: str or ~azure.mgmt.rdbms.mariadb.models.SecurityAlertPolicyName :param parameters: The server security alert policy. Is either a ServerSecurityAlertPolicy type - or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.ServerSecurityAlertPolicy or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.ServerSecurityAlertPolicy or IO[bytes] :return: An instance of LROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -455,12 +424,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -470,17 +440,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ServerSecurityAlertPolicy].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" - } + return LROPoller[_models.ServerSecurityAlertPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_server( @@ -493,7 +461,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -506,7 +473,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.ServerSecurityAlertPolicyListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,24 +484,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ServerSecurityAlertPolicyListResult", pipeline_response) @@ -544,11 +508,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,7 +523,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/securityAlertPolicies" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_servers_operations.py index 520db27b78c1d..7d54e6e2014fd 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_servers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -343,9 +349,13 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") def _create_initial( - self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerForCreate, IO], **kwargs: Any - ) -> Optional[_models.Server]: - error_map = { + self, + resource_group_name: str, + server_name: str, + parameters: Union[_models.ServerForCreate, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -358,7 +368,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -368,7 +378,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "ServerForCreate") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -376,39 +386,33 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Server", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return deserialized # type: ignore @overload def begin_create( @@ -433,14 +437,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -451,7 +447,7 @@ def begin_create( self, resource_group_name: str, server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -465,18 +461,10 @@ def begin_create( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for creating or updating a server. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -484,7 +472,11 @@ def begin_create( @distributed_trace def begin_create( - self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerForCreate, IO], **kwargs: Any + self, + resource_group_name: str, + server_name: str, + parameters: Union[_models.ServerForCreate, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.Server]: """Creates a new server or updates an existing server. The update action will overwrite the existing server. @@ -495,19 +487,8 @@ def begin_create( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for creating or updating a server. Is either a - ServerForCreate type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.ServerForCreate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ServerForCreate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.ServerForCreate or IO[bytes] :return: An instance of LROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -533,12 +514,13 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -548,26 +530,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Server].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return LROPoller[_models.Server]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, server_name: str, - parameters: Union[_models.ServerUpdateParameters, IO], + parameters: Union[_models.ServerUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -580,7 +560,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -590,7 +570,7 @@ def _update_initial( else: _json = self._serialize.body(parameters, "ServerUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -598,36 +578,33 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -652,14 +629,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -670,7 +639,7 @@ def begin_update( self, resource_group_name: str, server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -684,18 +653,10 @@ def begin_update( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for updating a server. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -706,7 +667,7 @@ def begin_update( self, resource_group_name: str, server_name: str, - parameters: Union[_models.ServerUpdateParameters, IO], + parameters: Union[_models.ServerUpdateParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Server]: """Updates an existing server. The request body can contain one to many of the properties present @@ -718,19 +679,8 @@ def begin_update( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for updating a server. Is either a - ServerUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.ServerUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ServerUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.ServerUpdateParameters or IO[bytes] :return: An instance of LROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -756,12 +706,13 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -771,22 +722,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Server].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return LROPoller[_models.Server]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -798,37 +745,40 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -839,14 +789,6 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -860,7 +802,7 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -869,11 +811,12 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -882,17 +825,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _models.Server: @@ -903,12 +842,11 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Server or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.Server :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -922,21 +860,19 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.Server] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -945,16 +881,12 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Server"]: @@ -963,7 +895,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -974,7 +905,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -985,23 +916,20 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) @@ -1011,11 +939,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1027,15 +955,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers" - } - @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Server"]: """List all the servers in a given subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -1046,7 +969,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Server"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1057,22 +980,19 @@ def list(self, **kwargs: Any) -> Iterable["_models.Server"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) @@ -1082,11 +1002,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1098,12 +1018,8 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/servers"} - - def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + def _restart_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1115,37 +1031,40 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_restart_request( + _request = build_restart_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._restart_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/restart" - } + return deserialized # type: ignore @distributed_trace def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1156,14 +1075,6 @@ def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: An :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1177,7 +1088,7 @@ def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: An lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restart_initial( # type: ignore + raw_result = self._restart_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1186,11 +1097,12 @@ def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: An params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -1199,22 +1111,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/restart" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + def _start_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1226,38 +1132,41 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_start_request( + _request = build_start_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/start" - } + return deserialized # type: ignore @distributed_trace def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1268,14 +1177,6 @@ def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1289,7 +1190,7 @@ def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._start_initial( # type: ignore + raw_result = self._start_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1298,11 +1199,12 @@ def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -1311,22 +1213,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/start" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + def _stop_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1338,38 +1234,41 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_stop_request( + _request = build_stop_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/stop" - } + return deserialized # type: ignore @distributed_trace def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1380,14 +1279,6 @@ def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1401,7 +1292,7 @@ def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._stop_initial( # type: ignore + raw_result = self._stop_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1410,11 +1301,12 @@ def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -1423,14 +1315,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/stop" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_top_query_statistics_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_top_query_statistics_operations.py index 8f27054d7790d..40d7e93d9c6de 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_top_query_statistics_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_top_query_statistics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -138,12 +142,11 @@ def get( :type server_name: str :param query_statistic_id: The Query Statistic identifier. Required. :type query_statistic_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QueryStatistic or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.QueryStatistic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,22 +160,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.QueryStatistic] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, query_statistic_id=query_statistic_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,16 +182,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryStatistic", pipeline_response) + deserialized = self._deserialize("QueryStatistic", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/topQueryStatistics/{queryStatisticId}" - } + return deserialized # type: ignore @overload def list_by_server( @@ -214,7 +211,6 @@ def list_by_server( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either QueryStatistic or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.QueryStatistic] :raises ~azure.core.exceptions.HttpResponseError: @@ -225,7 +221,7 @@ def list_by_server( self, resource_group_name: str, server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -238,11 +234,10 @@ def list_by_server( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for retrieving top query statistics. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either QueryStatistic or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.QueryStatistic] :raises ~azure.core.exceptions.HttpResponseError: @@ -253,7 +248,7 @@ def list_by_server( self, resource_group_name: str, server_name: str, - parameters: Union[_models.TopQueryStatisticsInput, IO], + parameters: Union[_models.TopQueryStatisticsInput, IO[bytes]], **kwargs: Any ) -> Iterable["_models.QueryStatistic"]: """Retrieve the Query-Store top queries for specified metric and aggregation. @@ -264,12 +259,8 @@ def list_by_server( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for retrieving top query statistics. Is either a - TopQueryStatisticsInput type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.TopQueryStatisticsInput or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + TopQueryStatisticsInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.TopQueryStatisticsInput or IO[bytes] :return: An iterator like instance of either QueryStatistic or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.QueryStatistic] :raises ~azure.core.exceptions.HttpResponseError: @@ -281,7 +272,7 @@ def list_by_server( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TopQueryStatisticsResultList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +290,7 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -307,19 +298,16 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, content=_content, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("TopQueryStatisticsResultList", pipeline_response) @@ -329,11 +317,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -344,7 +332,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/topQueryStatistics" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_virtual_network_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_virtual_network_rules_operations.py index ce230e322f44f..24b186aca5c13 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_virtual_network_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_virtual_network_rules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -202,12 +208,11 @@ def get( :type server_name: str :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,22 +226,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,26 +248,22 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, server_name: str, virtual_network_rule_name: str, - parameters: Union[_models.VirtualNetworkRule, IO], + parameters: Union[_models.VirtualNetworkRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualNetworkRule]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +276,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualNetworkRule]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -287,7 +286,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "VirtualNetworkRule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, @@ -296,39 +295,33 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -355,14 +348,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule] @@ -375,7 +360,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, virtual_network_rule_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -390,18 +375,10 @@ def begin_create_or_update( :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str :param parameters: The requested virtual Network Rule Resource state. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule] @@ -414,7 +391,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, virtual_network_rule_name: str, - parameters: Union[_models.VirtualNetworkRule, IO], + parameters: Union[_models.VirtualNetworkRule, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.VirtualNetworkRule]: """Creates or updates an existing virtual network rule. @@ -427,19 +404,8 @@ def begin_create_or_update( :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str :param parameters: The requested virtual Network Rule Resource state. Is either a - VirtualNetworkRule type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + VirtualNetworkRule type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule or IO[bytes] :return: An instance of LROPoller that returns either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule] @@ -467,12 +433,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -482,22 +449,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.VirtualNetworkRule].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return LROPoller[_models.VirtualNetworkRule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, virtual_network_rule_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -509,38 +474,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -555,14 +523,6 @@ def begin_delete( :type server_name: str :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -576,7 +536,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, @@ -586,11 +546,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -599,17 +560,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_by_server( @@ -622,7 +579,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.VirtualNetworkRule] :raises ~azure.core.exceptions.HttpResponseError: @@ -633,7 +589,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.VirtualNetworkRuleListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -644,24 +600,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("VirtualNetworkRuleListResult", pipeline_response) @@ -671,11 +624,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -686,7 +639,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/virtualNetworkRules" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_wait_statistics_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_wait_statistics_operations.py index f8b9e5fa06b65..7e07496e27e1e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_wait_statistics_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/_wait_statistics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MariaDBManagementClientMixinABC, _convert_request +from .._vendor import MariaDBManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -138,12 +142,11 @@ def get( :type server_name: str :param wait_statistics_id: The Wait Statistic identifier. Required. :type wait_statistics_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WaitStatistic or the result of cls(response) :rtype: ~azure.mgmt.rdbms.mariadb.models.WaitStatistic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,22 +160,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.WaitStatistic] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, wait_statistics_id=wait_statistics_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,16 +182,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WaitStatistic", pipeline_response) + deserialized = self._deserialize("WaitStatistic", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/waitStatistics/{waitStatisticsId}" - } + return deserialized # type: ignore @overload def list_by_server( @@ -214,7 +211,6 @@ def list_by_server( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WaitStatistic or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.WaitStatistic] :raises ~azure.core.exceptions.HttpResponseError: @@ -225,7 +221,7 @@ def list_by_server( self, resource_group_name: str, server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -238,11 +234,10 @@ def list_by_server( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for retrieving wait statistics. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WaitStatistic or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.WaitStatistic] :raises ~azure.core.exceptions.HttpResponseError: @@ -253,7 +248,7 @@ def list_by_server( self, resource_group_name: str, server_name: str, - parameters: Union[_models.WaitStatisticsInput, IO], + parameters: Union[_models.WaitStatisticsInput, IO[bytes]], **kwargs: Any ) -> Iterable["_models.WaitStatistic"]: """Retrieve wait statistics for specified aggregation window. @@ -264,12 +259,8 @@ def list_by_server( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for retrieving wait statistics. Is either a - WaitStatisticsInput type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.mariadb.models.WaitStatisticsInput or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + WaitStatisticsInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.mariadb.models.WaitStatisticsInput or IO[bytes] :return: An iterator like instance of either WaitStatistic or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.mariadb.models.WaitStatistic] :raises ~azure.core.exceptions.HttpResponseError: @@ -281,7 +272,7 @@ def list_by_server( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WaitStatisticsResultList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +290,7 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -307,19 +298,16 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, content=_content, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("WaitStatisticsResultList", pipeline_response) @@ -329,11 +317,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -344,7 +332,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/waitStatistics" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_my_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_my_sql_management_client.py index 80cf32629967b..536d826f6c99b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_my_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_my_sql_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -244,7 +245,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "MySQLManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_serialization.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_serialization.py index 2f781d740827a..8139854b97bb8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_serialization.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_serialization.py @@ -144,6 +144,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -1441,7 +1443,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_vendor.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_vendor.py index c66f4e1bfd639..9f5d46fd1c541 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_vendor.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import MySQLManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from ._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class MySQLManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/_my_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/_my_sql_management_client.py index 8a8c5b19d1f59..4ee16c6385e41 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/_my_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/_my_sql_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -250,7 +251,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MySQLManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/_vendor.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/_vendor.py index 29d54c5719096..c9602c04620ee 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/_vendor.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import MySQLManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_advisors_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_advisors_operations.py index 3b89f71f1452d..9020ffce89fb3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_advisors_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_advisors_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._advisors_operations import build_get_request, build_list_by_server_request from .._vendor import MySQLManagementClientMixinABC @@ -98,7 +96,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +109,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Advisor", pipeline_response) + deserialized = self._deserialize("Advisor", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -159,12 +156,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_check_name_availability_operations.py index e9934d844b025..e724cfe560238 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_check_name_availability_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._check_name_availability_operations import build_execute_request from .._vendor import MySQLManagementClientMixinABC @@ -141,7 +139,6 @@ async def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -155,7 +152,7 @@ async def execute( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_configurations_operations.py index a192c6d531b6f..0af29af5d0840 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_configurations_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._configurations_operations import ( build_create_or_update_request, build_get_request, @@ -72,7 +72,7 @@ async def _create_or_update_initial( configuration_name: str, parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -86,7 +86,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -108,10 +108,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -119,12 +119,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -241,10 +243,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -306,7 +309,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +322,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -367,12 +369,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_databases_operations.py index d9528eb08d789..fdb79c9ad7a68 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_databases_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._databases_operations import ( build_create_or_update_request, build_delete_request, @@ -73,7 +73,7 @@ async def _create_or_update_initial( database_name: str, parameters: Union[_models.Database, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Database]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -87,7 +87,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -109,10 +109,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -120,15 +120,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Database", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Database", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -245,10 +244,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -270,9 +270,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -285,7 +285,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -296,10 +296,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -307,11 +307,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -339,7 +347,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -349,6 +357,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -410,7 +419,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -424,7 +432,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -471,12 +479,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_firewall_rules_operations.py index 21bb01603b9f7..43d37390ac79e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_firewall_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._firewall_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -73,7 +73,7 @@ async def _create_or_update_initial( firewall_rule_name: str, parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.FirewallRule]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -87,7 +87,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -109,10 +109,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -120,15 +120,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("FirewallRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -245,10 +244,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -270,9 +270,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -285,7 +285,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -296,10 +296,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -307,11 +307,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -339,7 +347,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -349,6 +357,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -410,7 +419,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -424,7 +432,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -471,12 +479,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_location_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_location_based_performance_tier_operations.py index 061f0506fbf92..6da7028edaa12 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_location_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_location_based_performance_tier_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._location_based_performance_tier_operations import build_list_request from .._vendor import MySQLManagementClientMixinABC @@ -93,12 +91,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_location_based_recommended_action_sessions_operation_status_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_location_based_recommended_action_sessions_operation_status_operations.py index 4be752a6db1d1..952ac63d77107 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_location_based_recommended_action_sessions_operation_status_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_location_based_recommended_action_sessions_operation_status_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._location_based_recommended_action_sessions_operation_status_operations import build_get_request from .._vendor import MySQLManagementClientMixinABC @@ -92,7 +90,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -106,7 +103,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendedActionSessionsOperationStatus", pipeline_response) + deserialized = self._deserialize("RecommendedActionSessionsOperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_location_based_recommended_action_sessions_result_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_location_based_recommended_action_sessions_result_operations.py index f474baf0aad32..6dba49f8c9f00 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_location_based_recommended_action_sessions_result_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_location_based_recommended_action_sessions_result_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._location_based_recommended_action_sessions_result_operations import build_list_request from .._vendor import MySQLManagementClientMixinABC @@ -98,12 +96,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_log_files_operations.py index 03f9ccc6faa3a..d6d2d62f53e8a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_log_files_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._log_files_operations import build_list_by_server_request from .._vendor import MySQLManagementClientMixinABC @@ -97,12 +95,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_my_sql_management_client_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_my_sql_management_client_operations.py index c15d189320e27..4bb013bd68e21 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_my_sql_management_client_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_my_sql_management_client_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,19 +15,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._my_sql_management_client_operations import ( build_create_recommended_action_session_request, build_reset_query_performance_insight_data_request, @@ -81,7 +81,6 @@ async def reset_query_performance_insight_data( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -95,16 +94,16 @@ async def reset_query_performance_insight_data( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryPerformanceInsightResetDataResult", pipeline_response) + deserialized = self._deserialize("QueryPerformanceInsightResetDataResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_recommended_action_session_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _create_recommended_action_session_initial( # pylint: disable=name-too-long self, resource_group_name: str, server_name: str, advisor_name: str, database_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -117,7 +116,7 @@ async def _create_recommended_action_session_initial( # pylint: disable=inconsi _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_create_recommended_action_session_request( resource_group_name=resource_group_name, @@ -129,10 +128,10 @@ async def _create_recommended_action_session_initial( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -140,11 +139,19 @@ async def _create_recommended_action_session_initial( # pylint: disable=inconsi response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_create_recommended_action_session( @@ -174,7 +181,7 @@ async def begin_create_recommended_action_session( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_recommended_action_session_initial( # type: ignore + raw_result = await self._create_recommended_action_session_initial( resource_group_name=resource_group_name, server_name=server_name, advisor_name=advisor_name, @@ -185,6 +192,7 @@ async def begin_create_recommended_action_session( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_operations.py index 24f8e668ff851..555a0c5da71c6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request from .._vendor import MySQLManagementClientMixinABC @@ -83,7 +81,6 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -97,7 +94,7 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_private_endpoint_connections_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_private_endpoint_connections_operations.py index 4b5fbc0493f39..cc585371b5b20 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_private_endpoint_connections_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_create_or_update_request, build_delete_request, @@ -107,7 +107,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -121,7 +120,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -135,7 +134,7 @@ async def _create_or_update_initial( private_endpoint_connection_name: str, parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> Optional[_models.PrivateEndpointConnection]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -149,7 +148,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -171,10 +170,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -182,12 +181,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -306,10 +307,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -331,9 +333,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -346,7 +348,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -357,10 +359,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -368,11 +370,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -400,7 +410,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -410,6 +420,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -438,7 +449,7 @@ async def _update_tags_initial( private_endpoint_connection_name: str, parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -452,7 +463,7 @@ async def _update_tags_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -474,10 +485,10 @@ async def _update_tags_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -485,10 +496,14 @@ async def _update_tags_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -616,10 +631,11 @@ async def begin_update_tags( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -683,12 +699,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_private_link_resources_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_private_link_resources_operations.py index d43f847338cf0..71f494952f681 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_private_link_resources_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_private_link_resources_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request, build_list_by_server_request from .._vendor import MySQLManagementClientMixinABC @@ -99,12 +97,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -173,7 +169,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -187,7 +182,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_query_texts_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_query_texts_operations.py index 30df7c73aa3a6..c8b2c5ad6da38 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_query_texts_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_query_texts_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._query_texts_operations import build_get_request, build_list_by_server_request from .._vendor import MySQLManagementClientMixinABC @@ -96,7 +94,6 @@ async def get(self, resource_group_name: str, server_name: str, query_id: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -110,7 +107,7 @@ async def get(self, resource_group_name: str, server_name: str, query_id: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryText", pipeline_response) + deserialized = self._deserialize("QueryText", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -160,12 +157,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_recommended_actions_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_recommended_actions_operations.py index fc99f7bf599e3..12fc24a14e8ff 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_recommended_actions_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_recommended_actions_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recommended_actions_operations import build_get_request, build_list_by_server_request from .._vendor import MySQLManagementClientMixinABC @@ -101,7 +99,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -115,7 +112,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationAction", pipeline_response) + deserialized = self._deserialize("RecommendationAction", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -175,12 +172,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_recoverable_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_recoverable_servers_operations.py index cd7d2075ee28c..e2c622e1dafa2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_recoverable_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_recoverable_servers_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recoverable_servers_operations import build_get_request from .._vendor import MySQLManagementClientMixinABC @@ -91,7 +89,6 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -105,7 +102,7 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecoverableServerResource", pipeline_response) + deserialized = self._deserialize("RecoverableServerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_replicas_operations.py index b0d3e59ffdef8..44e33268adede 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_replicas_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._replicas_operations import build_list_by_server_request from .._vendor import MySQLManagementClientMixinABC @@ -97,12 +95,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_administrators_operations.py index 9e827a8453520..d43d2f769089a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_administrators_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_administrators_operations import ( build_create_or_update_request, build_delete_request, @@ -103,7 +103,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -117,7 +116,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) + deserialized = self._deserialize("ServerAdministratorResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -130,7 +129,7 @@ async def _create_or_update_initial( server_name: str, properties: Union[_models.ServerAdministratorResource, IO[bytes]], **kwargs: Any - ) -> _models.ServerAdministratorResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -144,7 +143,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServerAdministratorResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -165,10 +164,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -176,14 +175,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -298,10 +297,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) + deserialized = self._deserialize("ServerAdministratorResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -323,9 +323,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -338,7 +336,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -348,10 +346,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -359,11 +357,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -387,7 +393,7 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -396,6 +402,7 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -459,12 +466,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_based_performance_tier_operations.py index cdc7ce113616f..750911001332e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_based_performance_tier_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_based_performance_tier_operations import build_list_request from .._vendor import MySQLManagementClientMixinABC @@ -99,12 +97,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_keys_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_keys_operations.py index 43a859ad97f04..6be5c6dfa0ed6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_keys_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_keys_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_keys_operations import ( build_create_or_update_request, build_delete_request, @@ -104,12 +104,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -176,7 +174,6 @@ async def get(self, resource_group_name: str, server_name: str, key_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -190,7 +187,7 @@ async def get(self, resource_group_name: str, server_name: str, key_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerKey", pipeline_response) + deserialized = self._deserialize("ServerKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -204,7 +201,7 @@ async def _create_or_update_initial( resource_group_name: str, parameters: Union[_models.ServerKey, IO[bytes]], **kwargs: Any - ) -> _models.ServerKey: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -218,7 +215,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServerKey] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -240,10 +237,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -251,14 +248,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ServerKey", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("ServerKey", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,10 +375,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerKey", pipeline_response) + deserialized = self._deserialize("ServerKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -403,9 +401,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, server_name: str, key_name: str, resource_group_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -418,7 +416,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( server_name=server_name, @@ -429,10 +427,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -440,11 +438,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -472,7 +478,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( server_name=server_name, key_name=key_name, resource_group_name=resource_group_name, @@ -482,6 +488,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_parameters_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_parameters_operations.py index 7fff1f1b8449d..c75ba8e9dcf55 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_parameters_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_parameters_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,19 +16,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_parameters_operations import build_list_update_configurations_request from .._vendor import MySQLManagementClientMixinABC @@ -65,7 +65,7 @@ async def _list_update_configurations_initial( server_name: str, value: Union[_models.ConfigurationListResult, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ConfigurationListResult]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -79,7 +79,7 @@ async def _list_update_configurations_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ConfigurationListResult]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -100,10 +100,10 @@ async def _list_update_configurations_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -111,12 +111,14 @@ async def _list_update_configurations_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -226,10 +228,11 @@ async def begin_list_update_configurations( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = self._deserialize("ConfigurationListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_security_alert_policies_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_security_alert_policies_operations.py index b847ab4ba79b4..5af425741c923 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_security_alert_policies_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_server_security_alert_policies_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_security_alert_policies_operations import ( build_create_or_update_request, build_get_request, @@ -109,7 +109,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +122,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -137,7 +136,7 @@ async def _create_or_update_initial( security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], parameters: Union[_models.ServerSecurityAlertPolicy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ServerSecurityAlertPolicy]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -151,7 +150,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ServerSecurityAlertPolicy]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -173,10 +172,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -184,12 +183,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -309,10 +310,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -376,12 +378,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_servers_operations.py index d66383e788ae2..46e7147b69357 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_servers_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._servers_operations import ( build_create_request, build_delete_request, @@ -78,7 +78,7 @@ async def _create_initial( server_name: str, parameters: Union[_models.ServerForCreate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -92,7 +92,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -113,10 +113,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -124,15 +124,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Server", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -242,10 +241,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -273,7 +273,7 @@ async def _update_initial( server_name: str, parameters: Union[_models.ServerUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -287,7 +287,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -308,10 +308,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -319,12 +319,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -434,10 +436,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -459,9 +462,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -474,7 +475,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -484,10 +485,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -495,11 +496,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -523,7 +532,7 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -532,6 +541,7 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -588,7 +598,6 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -602,7 +611,7 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -644,12 +653,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -709,12 +716,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -743,9 +748,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + async def _restart_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -758,7 +761,7 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_restart_request( resource_group_name=resource_group_name, @@ -768,10 +771,10 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -779,11 +782,19 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -807,7 +818,7 @@ async def begin_restart(self, resource_group_name: str, server_name: str, **kwar lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restart_initial( # type: ignore + raw_result = await self._restart_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -816,6 +827,7 @@ async def begin_restart(self, resource_group_name: str, server_name: str, **kwar params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -837,9 +849,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + async def _start_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -852,7 +862,7 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -862,10 +872,10 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -873,12 +883,20 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -902,7 +920,7 @@ async def begin_start(self, resource_group_name: str, server_name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._start_initial( # type: ignore + raw_result = await self._start_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -911,6 +929,7 @@ async def begin_start(self, resource_group_name: str, server_name: str, **kwargs params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -932,9 +951,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + async def _stop_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -947,7 +964,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -957,10 +974,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -968,12 +985,20 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -997,7 +1022,7 @@ async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._stop_initial( # type: ignore + raw_result = await self._stop_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1006,6 +1031,7 @@ async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1027,13 +1053,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _upgrade_initial( # pylint: disable=inconsistent-return-statements + async def _upgrade_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerUpgradeParameters, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1047,7 +1073,7 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1068,10 +1094,10 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1079,12 +1105,20 @@ async def _upgrade_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_upgrade( @@ -1172,7 +1206,7 @@ async def begin_upgrade( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._upgrade_initial( # type: ignore + raw_result = await self._upgrade_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -1183,6 +1217,7 @@ async def begin_upgrade( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_top_query_statistics_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_top_query_statistics_operations.py index 2f8904ae067f0..64781ab2abac9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_top_query_statistics_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_top_query_statistics_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._top_query_statistics_operations import build_get_request, build_list_by_server_request from .._vendor import MySQLManagementClientMixinABC @@ -99,7 +97,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +110,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryStatistic", pipeline_response) + deserialized = self._deserialize("QueryStatistic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -232,12 +229,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_virtual_network_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_virtual_network_rules_operations.py index 4248032215a56..fd4f54eb18ec7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_virtual_network_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_virtual_network_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._virtual_network_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -106,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -120,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -134,7 +133,7 @@ async def _create_or_update_initial( virtual_network_rule_name: str, parameters: Union[_models.VirtualNetworkRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualNetworkRule]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -148,7 +147,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualNetworkRule]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -170,10 +169,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -181,15 +180,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -306,10 +304,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -331,9 +330,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, virtual_network_rule_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -346,7 +345,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -357,10 +356,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -368,11 +367,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -400,7 +407,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, @@ -410,6 +417,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -472,12 +480,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_wait_statistics_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_wait_statistics_operations.py index 88ad04090df28..e83446a03c136 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_wait_statistics_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/aio/operations/_wait_statistics_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._wait_statistics_operations import build_get_request, build_list_by_server_request from .._vendor import MySQLManagementClientMixinABC @@ -99,7 +97,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +110,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WaitStatistic", pipeline_response) + deserialized = self._deserialize("WaitStatistic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -232,12 +229,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_advisors_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_advisors_operations.py index 5d0c605b77527..ba722311c68a8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_advisors_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_advisors_operations.py @@ -19,15 +19,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -164,7 +163,6 @@ def get(self, resource_group_name: str, server_name: str, advisor_name: str, **k headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +176,7 @@ def get(self, resource_group_name: str, server_name: str, advisor_name: str, **k map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Advisor", pipeline_response) + deserialized = self._deserialize("Advisor", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -223,12 +221,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_check_name_availability_operations.py index 9acb1ab325d72..5fb04b0527e89 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_check_name_availability_operations.py @@ -19,15 +19,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -172,7 +171,6 @@ def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +184,7 @@ def execute( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_configurations_operations.py index 7b2badd9b0899..e9eefcb0fc3d8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_configurations_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -173,7 +174,7 @@ def _create_or_update_initial( configuration_name: str, parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -187,7 +188,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -209,10 +210,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -220,12 +221,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -342,10 +345,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -407,7 +411,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -421,7 +424,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -468,12 +471,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_databases_operations.py index ab7eca31a90e5..2fa835b95e1ec 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_databases_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -207,7 +208,7 @@ def _create_or_update_initial( database_name: str, parameters: Union[_models.Database, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Database]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -221,7 +222,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -243,10 +244,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -254,15 +255,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Database", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Database", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -376,10 +376,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -401,9 +402,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -416,7 +417,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -427,10 +428,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -438,11 +439,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -470,7 +479,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -480,6 +489,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -539,7 +549,6 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -553,7 +562,7 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -598,12 +607,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_firewall_rules_operations.py index d208cce96af13..864c7d3234170 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_firewall_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -207,7 +208,7 @@ def _create_or_update_initial( firewall_rule_name: str, parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.FirewallRule]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -221,7 +222,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -243,10 +244,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -254,15 +255,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("FirewallRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -379,10 +379,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -404,9 +405,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -419,7 +420,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -430,10 +431,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -441,11 +442,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -473,7 +482,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -483,6 +492,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -544,7 +554,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -558,7 +567,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -605,12 +614,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_location_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_location_based_performance_tier_operations.py index 37387011cc0af..071d93134189b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_location_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_location_based_performance_tier_operations.py @@ -19,15 +19,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -122,12 +121,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_location_based_recommended_action_sessions_operation_status_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_location_based_recommended_action_sessions_operation_status_operations.py index 53f19f574539b..a3d0d68d652b5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_location_based_recommended_action_sessions_operation_status_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_location_based_recommended_action_sessions_operation_status_operations.py @@ -18,15 +18,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -123,7 +122,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -137,7 +135,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendedActionSessionsOperationStatus", pipeline_response) + deserialized = self._deserialize("RecommendedActionSessionsOperationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_location_based_recommended_action_sessions_result_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_location_based_recommended_action_sessions_result_operations.py index 19f9f7c1c42c1..0018a7ffa4d2d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_location_based_recommended_action_sessions_result_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_location_based_recommended_action_sessions_result_operations.py @@ -19,15 +19,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -126,12 +125,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_log_files_operations.py index d42dd0314c32b..fa9a449d38a04 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_log_files_operations.py @@ -19,15 +19,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -130,12 +129,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_my_sql_management_client_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_my_sql_management_client_operations.py index 7de8fd0355366..7d0d67f02cac2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_my_sql_management_client_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_my_sql_management_client_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterator, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,7 +29,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -148,7 +149,6 @@ def reset_query_performance_insight_data( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -162,16 +162,16 @@ def reset_query_performance_insight_data( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryPerformanceInsightResetDataResult", pipeline_response) + deserialized = self._deserialize("QueryPerformanceInsightResetDataResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_recommended_action_session_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _create_recommended_action_session_initial( # pylint: disable=name-too-long self, resource_group_name: str, server_name: str, advisor_name: str, database_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -184,7 +184,7 @@ def _create_recommended_action_session_initial( # pylint: disable=inconsistent- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_create_recommended_action_session_request( resource_group_name=resource_group_name, @@ -196,10 +196,10 @@ def _create_recommended_action_session_initial( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -207,11 +207,19 @@ def _create_recommended_action_session_initial( # pylint: disable=inconsistent- response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_create_recommended_action_session( @@ -241,7 +249,7 @@ def begin_create_recommended_action_session( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_recommended_action_session_initial( # type: ignore + raw_result = self._create_recommended_action_session_initial( resource_group_name=resource_group_name, server_name=server_name, advisor_name=advisor_name, @@ -252,6 +260,7 @@ def begin_create_recommended_action_session( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_operations.py index 8c3cec984e1c2..69df1caa8bca9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_operations.py @@ -18,15 +18,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -104,7 +103,6 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -118,7 +116,7 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_private_endpoint_connections_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_private_endpoint_connections_operations.py index b92dbb3607c4a..ca0eebf010ec3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_private_endpoint_connections_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_private_endpoint_connections_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -301,7 +302,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +315,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +329,7 @@ def _create_or_update_initial( private_endpoint_connection_name: str, parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> Optional[_models.PrivateEndpointConnection]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -343,7 +343,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -365,10 +365,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -376,12 +376,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -497,10 +499,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -522,9 +525,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -537,7 +540,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -548,10 +551,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -559,11 +562,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -591,7 +602,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -601,6 +612,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -629,7 +641,7 @@ def _update_tags_initial( private_endpoint_connection_name: str, parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -643,7 +655,7 @@ def _update_tags_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -665,10 +677,10 @@ def _update_tags_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -676,10 +688,14 @@ def _update_tags_initial( response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -804,10 +820,11 @@ def begin_update_tags( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -870,12 +887,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_private_link_resources_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_private_link_resources_operations.py index 7393cb0d467dd..801833ec5e2b4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_private_link_resources_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_private_link_resources_operations.py @@ -19,15 +19,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -166,12 +165,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -240,7 +237,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -254,7 +250,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_query_texts_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_query_texts_operations.py index 1073611dcf6ca..50929ea3df0a7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_query_texts_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_query_texts_operations.py @@ -19,15 +19,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -165,7 +164,6 @@ def get(self, resource_group_name: str, server_name: str, query_id: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -179,7 +177,7 @@ def get(self, resource_group_name: str, server_name: str, query_id: str, **kwarg map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryText", pipeline_response) + deserialized = self._deserialize("QueryText", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -229,12 +227,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_recommended_actions_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_recommended_actions_operations.py index 4800550a01134..ab9a69ced35eb 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_recommended_actions_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_recommended_actions_operations.py @@ -19,15 +19,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -184,7 +183,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -198,7 +196,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecommendationAction", pipeline_response) + deserialized = self._deserialize("RecommendationAction", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -257,12 +255,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_recoverable_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_recoverable_servers_operations.py index 5f1916a7218b4..03582cede1db9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_recoverable_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_recoverable_servers_operations.py @@ -18,15 +18,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -124,7 +123,6 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -138,7 +136,7 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecoverableServerResource", pipeline_response) + deserialized = self._deserialize("RecoverableServerResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_replicas_operations.py index f8f114d40d8ba..42a2053b146ca 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_replicas_operations.py @@ -19,15 +19,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -130,12 +129,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_administrators_operations.py index 147e315782c43..479152e289890 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_administrators_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -228,7 +229,6 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +242,7 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) + deserialized = self._deserialize("ServerAdministratorResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -255,7 +255,7 @@ def _create_or_update_initial( server_name: str, properties: Union[_models.ServerAdministratorResource, IO[bytes]], **kwargs: Any - ) -> _models.ServerAdministratorResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -269,7 +269,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServerAdministratorResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -290,10 +290,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -301,14 +301,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -423,10 +423,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) + deserialized = self._deserialize("ServerAdministratorResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -448,9 +449,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -463,7 +462,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -473,10 +472,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -484,11 +483,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -512,7 +519,7 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -521,6 +528,7 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -584,12 +592,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_based_performance_tier_operations.py index 8ba91c3953eb6..66d47c579eef0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_based_performance_tier_operations.py @@ -19,15 +19,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -131,12 +130,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_keys_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_keys_operations.py index 4bdbe817161c2..e817094200658 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_keys_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_keys_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -236,12 +237,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -308,7 +307,6 @@ def get(self, resource_group_name: str, server_name: str, key_name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -322,7 +320,7 @@ def get(self, resource_group_name: str, server_name: str, key_name: str, **kwarg map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerKey", pipeline_response) + deserialized = self._deserialize("ServerKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -336,7 +334,7 @@ def _create_or_update_initial( resource_group_name: str, parameters: Union[_models.ServerKey, IO[bytes]], **kwargs: Any - ) -> _models.ServerKey: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -350,7 +348,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServerKey] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -372,10 +370,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -383,14 +381,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ServerKey", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("ServerKey", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -507,10 +505,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerKey", pipeline_response) + deserialized = self._deserialize("ServerKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -532,9 +531,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, server_name: str, key_name: str, resource_group_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -547,7 +546,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( server_name=server_name, @@ -558,10 +557,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -569,11 +568,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, server_name: str, key_name: str, resource_group_name: str, **kwargs: Any) -> LROPoller[None]: @@ -599,7 +606,7 @@ def begin_delete(self, server_name: str, key_name: str, resource_group_name: str lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( server_name=server_name, key_name=key_name, resource_group_name=resource_group_name, @@ -609,6 +616,7 @@ def begin_delete(self, server_name: str, key_name: str, resource_group_name: str params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_parameters_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_parameters_operations.py index 527e605a6c725..7a5043fb2f95c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_parameters_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_parameters_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -103,7 +104,7 @@ def _list_update_configurations_initial( server_name: str, value: Union[_models.ConfigurationListResult, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ConfigurationListResult]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -117,7 +118,7 @@ def _list_update_configurations_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ConfigurationListResult]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -138,10 +139,10 @@ def _list_update_configurations_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -149,12 +150,14 @@ def _list_update_configurations_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -261,10 +264,11 @@ def begin_list_update_configurations( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = self._deserialize("ConfigurationListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_security_alert_policies_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_security_alert_policies_operations.py index bfe3233d8a6dc..e3b5e887fa816 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_security_alert_policies_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_security_alert_policies_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -218,7 +219,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -232,7 +232,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -246,7 +246,7 @@ def _create_or_update_initial( security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], parameters: Union[_models.ServerSecurityAlertPolicy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ServerSecurityAlertPolicy]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -260,7 +260,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ServerSecurityAlertPolicy]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -282,10 +282,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -293,12 +293,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -415,10 +417,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -481,12 +484,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_servers_operations.py index c40405cca710f..41e0a329747d8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_servers_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -389,7 +390,7 @@ def _create_initial( server_name: str, parameters: Union[_models.ServerForCreate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -403,7 +404,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,10 +425,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -435,15 +436,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Server", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -550,10 +550,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -581,7 +582,7 @@ def _update_initial( server_name: str, parameters: Union[_models.ServerUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -595,7 +596,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -616,10 +617,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -627,12 +628,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -739,10 +742,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -764,9 +768,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -779,7 +781,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -789,10 +791,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -800,11 +802,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -828,7 +838,7 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -837,6 +847,7 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -893,7 +904,6 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -907,7 +917,7 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -949,12 +959,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1014,12 +1022,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1048,9 +1054,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + def _restart_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1063,7 +1067,7 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_restart_request( resource_group_name=resource_group_name, @@ -1073,10 +1077,10 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1084,11 +1088,19 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1112,7 +1124,7 @@ def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: An lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restart_initial( # type: ignore + raw_result = self._restart_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1121,6 +1133,7 @@ def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: An params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1142,9 +1155,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + def _start_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1157,7 +1168,7 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -1167,10 +1178,10 @@ def _start_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1178,12 +1189,20 @@ def _start_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1207,7 +1226,7 @@ def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._start_initial( # type: ignore + raw_result = self._start_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1216,6 +1235,7 @@ def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1237,9 +1257,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + def _stop_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1252,7 +1270,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -1262,10 +1280,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1273,12 +1291,20 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1302,7 +1328,7 @@ def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._stop_initial( # type: ignore + raw_result = self._stop_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1311,6 +1337,7 @@ def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1332,13 +1359,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _upgrade_initial( # pylint: disable=inconsistent-return-statements + def _upgrade_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerUpgradeParameters, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1352,7 +1379,7 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1373,10 +1400,10 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1384,12 +1411,20 @@ def _upgrade_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_upgrade( @@ -1477,7 +1512,7 @@ def begin_upgrade( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._upgrade_initial( # type: ignore + raw_result = self._upgrade_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -1488,6 +1523,7 @@ def begin_upgrade( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_top_query_statistics_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_top_query_statistics_operations.py index d3df5b1f66a73..2dab90f16da3a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_top_query_statistics_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_top_query_statistics_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -170,7 +169,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -184,7 +182,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryStatistic", pipeline_response) + deserialized = self._deserialize("QueryStatistic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -303,12 +301,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_virtual_network_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_virtual_network_rules_operations.py index 000880f68b50c..9c3e49e2bc3b7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_virtual_network_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_virtual_network_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -234,7 +235,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -248,7 +248,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -262,7 +262,7 @@ def _create_or_update_initial( virtual_network_rule_name: str, parameters: Union[_models.VirtualNetworkRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualNetworkRule]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -276,7 +276,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualNetworkRule]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -298,10 +298,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -309,15 +309,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -434,10 +433,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -459,9 +459,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, virtual_network_rule_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -474,7 +474,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -485,10 +485,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -496,11 +496,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -528,7 +536,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, @@ -538,6 +546,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -599,12 +608,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_wait_statistics_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_wait_statistics_operations.py index a37f09d589224..0c242b6235d96 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_wait_statistics_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_wait_statistics_operations.py @@ -20,15 +20,14 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import MySQLManagementClientMixinABC, _convert_request +from .._vendor import MySQLManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -170,7 +169,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -184,7 +182,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WaitStatistic", pipeline_response) + deserialized = self._deserialize("WaitStatistic", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -303,12 +301,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/_my_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/_my_sql_management_client.py index 66522e5fc6694..0629fc62262c0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/_my_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/_my_sql_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -75,17 +76,6 @@ class MySQLManagementClient: # pylint: disable=client-accepts-api-version-keywo :ivar firewall_rules: FirewallRulesOperations operations :vartype firewall_rules: azure.mgmt.rdbms.mysql_flexibleservers.operations.FirewallRulesOperations - :ivar servers: ServersOperations operations - :vartype servers: azure.mgmt.rdbms.mysql_flexibleservers.operations.ServersOperations - :ivar replicas: ReplicasOperations operations - :vartype replicas: azure.mgmt.rdbms.mysql_flexibleservers.operations.ReplicasOperations - :ivar servers_migration: ServersMigrationOperations operations - :vartype servers_migration: - azure.mgmt.rdbms.mysql_flexibleservers.operations.ServersMigrationOperations - :ivar advanced_threat_protection_settings: AdvancedThreatProtectionSettingsOperations - operations - :vartype advanced_threat_protection_settings: - azure.mgmt.rdbms.mysql_flexibleservers.operations.AdvancedThreatProtectionSettingsOperations :ivar log_files: LogFilesOperations operations :vartype log_files: azure.mgmt.rdbms.mysql_flexibleservers.operations.LogFilesOperations :ivar location_based_capabilities: LocationBasedCapabilitiesOperations operations @@ -117,6 +107,17 @@ class MySQLManagementClient: # pylint: disable=client-accepts-api-version-keywo :vartype operations: azure.mgmt.rdbms.mysql_flexibleservers.operations.Operations :ivar maintenances: MaintenancesOperations operations :vartype maintenances: azure.mgmt.rdbms.mysql_flexibleservers.operations.MaintenancesOperations + :ivar servers: ServersOperations operations + :vartype servers: azure.mgmt.rdbms.mysql_flexibleservers.operations.ServersOperations + :ivar replicas: ReplicasOperations operations + :vartype replicas: azure.mgmt.rdbms.mysql_flexibleservers.operations.ReplicasOperations + :ivar servers_migration: ServersMigrationOperations operations + :vartype servers_migration: + azure.mgmt.rdbms.mysql_flexibleservers.operations.ServersMigrationOperations + :ivar advanced_threat_protection_settings: AdvancedThreatProtectionSettingsOperations + operations + :vartype advanced_threat_protection_settings: + azure.mgmt.rdbms.mysql_flexibleservers.operations.AdvancedThreatProtectionSettingsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. @@ -177,14 +178,6 @@ def __init__( self.configurations = ConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize) self.firewall_rules = FirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize) - self.servers_migration = ServersMigrationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.advanced_threat_protection_settings = AdvancedThreatProtectionSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.log_files = LogFilesOperations(self._client, self._config, self._serialize, self._deserialize) self.location_based_capabilities = LocationBasedCapabilitiesOperations( self._client, self._config, self._serialize, self._deserialize @@ -212,6 +205,14 @@ def __init__( ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.maintenances = MaintenancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize) + self.servers_migration = ServersMigrationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.advanced_threat_protection_settings = AdvancedThreatProtectionSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -238,7 +239,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "MySQLManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/_serialization.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/_serialization.py index 2f781d740827a..8139854b97bb8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/_serialization.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/_serialization.py @@ -144,6 +144,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -1441,7 +1443,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/_vendor.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/_vendor.py deleted file mode 100644 index 0dafe0e287ff1..0000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/_my_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/_my_sql_management_client.py index a6e775eaa5c13..1fb8af9c61658 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/_my_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/_my_sql_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -75,17 +76,6 @@ class MySQLManagementClient: # pylint: disable=client-accepts-api-version-keywo :ivar firewall_rules: FirewallRulesOperations operations :vartype firewall_rules: azure.mgmt.rdbms.mysql_flexibleservers.aio.operations.FirewallRulesOperations - :ivar servers: ServersOperations operations - :vartype servers: azure.mgmt.rdbms.mysql_flexibleservers.aio.operations.ServersOperations - :ivar replicas: ReplicasOperations operations - :vartype replicas: azure.mgmt.rdbms.mysql_flexibleservers.aio.operations.ReplicasOperations - :ivar servers_migration: ServersMigrationOperations operations - :vartype servers_migration: - azure.mgmt.rdbms.mysql_flexibleservers.aio.operations.ServersMigrationOperations - :ivar advanced_threat_protection_settings: AdvancedThreatProtectionSettingsOperations - operations - :vartype advanced_threat_protection_settings: - azure.mgmt.rdbms.mysql_flexibleservers.aio.operations.AdvancedThreatProtectionSettingsOperations :ivar log_files: LogFilesOperations operations :vartype log_files: azure.mgmt.rdbms.mysql_flexibleservers.aio.operations.LogFilesOperations :ivar location_based_capabilities: LocationBasedCapabilitiesOperations operations @@ -118,6 +108,17 @@ class MySQLManagementClient: # pylint: disable=client-accepts-api-version-keywo :ivar maintenances: MaintenancesOperations operations :vartype maintenances: azure.mgmt.rdbms.mysql_flexibleservers.aio.operations.MaintenancesOperations + :ivar servers: ServersOperations operations + :vartype servers: azure.mgmt.rdbms.mysql_flexibleservers.aio.operations.ServersOperations + :ivar replicas: ReplicasOperations operations + :vartype replicas: azure.mgmt.rdbms.mysql_flexibleservers.aio.operations.ReplicasOperations + :ivar servers_migration: ServersMigrationOperations operations + :vartype servers_migration: + azure.mgmt.rdbms.mysql_flexibleservers.aio.operations.ServersMigrationOperations + :ivar advanced_threat_protection_settings: AdvancedThreatProtectionSettingsOperations + operations + :vartype advanced_threat_protection_settings: + azure.mgmt.rdbms.mysql_flexibleservers.aio.operations.AdvancedThreatProtectionSettingsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. @@ -178,14 +179,6 @@ def __init__( self.configurations = ConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize) self.firewall_rules = FirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize) - self.servers_migration = ServersMigrationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.advanced_threat_protection_settings = AdvancedThreatProtectionSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.log_files = LogFilesOperations(self._client, self._config, self._serialize, self._deserialize) self.location_based_capabilities = LocationBasedCapabilitiesOperations( self._client, self._config, self._serialize, self._deserialize @@ -213,6 +206,14 @@ def __init__( ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.maintenances = MaintenancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize) + self.servers_migration = ServersMigrationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.advanced_threat_protection_settings = AdvancedThreatProtectionSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any @@ -241,7 +242,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MySQLManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/__init__.py index 6c36a88d4b013..390e4a121d952 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/__init__.py @@ -14,10 +14,6 @@ from ._configurations_operations import ConfigurationsOperations from ._databases_operations import DatabasesOperations from ._firewall_rules_operations import FirewallRulesOperations -from ._servers_operations import ServersOperations -from ._replicas_operations import ReplicasOperations -from ._servers_migration_operations import ServersMigrationOperations -from ._advanced_threat_protection_settings_operations import AdvancedThreatProtectionSettingsOperations from ._log_files_operations import LogFilesOperations from ._location_based_capabilities_operations import LocationBasedCapabilitiesOperations from ._location_based_capability_set_operations import LocationBasedCapabilitySetOperations @@ -29,6 +25,10 @@ from ._get_private_dns_zone_suffix_operations import GetPrivateDnsZoneSuffixOperations from ._operations import Operations from ._maintenances_operations import MaintenancesOperations +from ._servers_operations import ServersOperations +from ._replicas_operations import ReplicasOperations +from ._servers_migration_operations import ServersMigrationOperations +from ._advanced_threat_protection_settings_operations import AdvancedThreatProtectionSettingsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -43,10 +43,6 @@ "ConfigurationsOperations", "DatabasesOperations", "FirewallRulesOperations", - "ServersOperations", - "ReplicasOperations", - "ServersMigrationOperations", - "AdvancedThreatProtectionSettingsOperations", "LogFilesOperations", "LocationBasedCapabilitiesOperations", "LocationBasedCapabilitySetOperations", @@ -58,6 +54,10 @@ "GetPrivateDnsZoneSuffixOperations", "Operations", "MaintenancesOperations", + "ServersOperations", + "ReplicasOperations", + "ServersMigrationOperations", + "AdvancedThreatProtectionSettingsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_advanced_threat_protection_settings_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_advanced_threat_protection_settings_operations.py index 65922d7fc95f4..ba4edff73f309 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_advanced_threat_protection_settings_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_advanced_threat_protection_settings_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._advanced_threat_protection_settings_operations import ( build_get_request, build_list_request, @@ -111,7 +111,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -126,7 +125,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response) + deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -140,7 +139,7 @@ async def _update_initial( advanced_threat_protection_name: Union[str, _models.AdvancedThreatProtectionName], parameters: Union[_models.AdvancedThreatProtectionForUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AdvancedThreatProtection]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -154,7 +153,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.AdvancedThreatProtection]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -176,10 +175,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -187,21 +186,23 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -328,10 +329,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response) + deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -362,7 +364,7 @@ async def _update_put_initial( advanced_threat_protection_name: Union[str, _models.AdvancedThreatProtectionName], parameters: Union[_models.AdvancedThreatProtection, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AdvancedThreatProtection]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -376,7 +378,7 @@ async def _update_put_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.AdvancedThreatProtection]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -398,10 +400,10 @@ async def _update_put_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -409,24 +411,23 @@ async def _update_put_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -552,10 +553,11 @@ async def begin_update_put( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response) + deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -621,12 +623,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_azure_ad_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_azure_ad_administrators_operations.py index 41cae92335b24..a3b72954e0614 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_azure_ad_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_azure_ad_administrators_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._azure_ad_administrators_operations import ( build_create_or_update_request, build_delete_request, @@ -72,7 +72,7 @@ async def _create_or_update_initial( administrator_name: Union[str, _models.AdministratorName], parameters: Union[_models.AzureADAdministrator, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AzureADAdministrator]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -84,9 +84,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.AzureADAdministrator]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -108,10 +108,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -119,16 +119,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("AzureADAdministrator", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureADAdministrator", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -235,7 +234,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureADAdministrator] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -254,10 +253,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureADAdministrator", pipeline_response) + deserialized = self._deserialize("AzureADAdministrator", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -279,13 +279,13 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, administrator_name: Union[str, _models.AdministratorName], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -297,8 +297,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -309,10 +309,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -320,12 +320,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -352,13 +360,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, administrator_name=administrator_name, @@ -368,6 +376,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -424,7 +433,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.AzureADAdministrator] = kwargs.pop("cls", None) _request = build_get_request( @@ -436,7 +445,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -451,7 +459,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureADAdministrator", pipeline_response) + deserialized = self._deserialize("AzureADAdministrator", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -478,7 +486,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.AdministratorListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -500,12 +508,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_backup_and_export_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_backup_and_export_operations.py index 88d5896500ab6..9a59a8ded8d82 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_backup_and_export_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_backup_and_export_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,19 +16,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._backup_and_export_operations import build_create_request, build_validate_backup_request if sys.version_info >= (3, 9): @@ -64,7 +64,7 @@ async def _create_initial( server_name: str, parameters: Union[_models.BackupAndExportRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.BackupAndExportResponse]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -76,9 +76,9 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.BackupAndExportResponse]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -99,10 +99,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -110,21 +110,23 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BackupAndExportResponse", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -218,7 +220,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackupAndExportResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -236,10 +238,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupAndExportResponse", pipeline_response) + deserialized = self._deserialize("BackupAndExportResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -289,7 +292,7 @@ async def validate_backup( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ValidateBackupResponse] = kwargs.pop("cls", None) _request = build_validate_backup_request( @@ -300,7 +303,6 @@ async def validate_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +317,7 @@ async def validate_backup( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateBackupResponse", pipeline_response) + deserialized = self._deserialize("ValidateBackupResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_backups_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_backups_operations.py index ef8e7998ad529..240dc18483927 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_backups_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_backups_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._backups_operations import build_get_request, build_list_by_server_request, build_put_request if sys.version_info >= (3, 9): @@ -85,7 +83,7 @@ async def put( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ServerBackup] = kwargs.pop("cls", None) _request = build_put_request( @@ -97,7 +95,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +109,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerBackup", pipeline_response) + deserialized = self._deserialize("ServerBackup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -147,7 +144,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ServerBackup] = kwargs.pop("cls", None) _request = build_get_request( @@ -159,7 +156,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -174,7 +170,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerBackup", pipeline_response) + deserialized = self._deserialize("ServerBackup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -200,7 +196,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ServerBackupListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -222,12 +218,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_check_name_availability_operations.py index 8fd3cc81e3a89..b8cfef333b03c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_check_name_availability_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._check_name_availability_operations import build_execute_request if sys.version_info >= (3, 9): @@ -135,7 +133,7 @@ async def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) @@ -157,7 +155,6 @@ async def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -172,7 +169,7 @@ async def execute( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_check_name_availability_without_location_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_check_name_availability_without_location_operations.py index dda27f4c0e58f..a70945aa89e63 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_check_name_availability_without_location_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_check_name_availability_without_location_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._check_name_availability_without_location_operations import build_execute_request if sys.version_info >= (3, 9): @@ -120,7 +118,7 @@ async def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) @@ -141,7 +139,6 @@ async def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -156,7 +153,7 @@ async def execute( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_check_virtual_network_subnet_usage_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_check_virtual_network_subnet_usage_operations.py index 955c515877340..d57d360dd6d21 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_check_virtual_network_subnet_usage_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_check_virtual_network_subnet_usage_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._check_virtual_network_subnet_usage_operations import build_execute_request if sys.version_info >= (3, 9): @@ -128,7 +126,7 @@ async def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkSubnetUsageResult] = kwargs.pop("cls", None) @@ -150,7 +148,6 @@ async def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -165,7 +162,7 @@ async def execute( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworkSubnetUsageResult", pipeline_response) + deserialized = self._deserialize("VirtualNetworkSubnetUsageResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_configurations_operations.py index 10e3217581a82..306997e8351d4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_configurations_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._configurations_operations import ( build_batch_update_request, build_create_or_update_request, @@ -73,7 +73,7 @@ async def _create_or_update_initial( configuration_name: str, parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -85,9 +85,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -109,10 +109,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -120,18 +120,20 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -231,7 +233,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -250,10 +252,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -282,7 +285,7 @@ async def _update_initial( configuration_name: str, parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -294,9 +297,9 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -318,10 +321,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -329,13 +332,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -436,7 +441,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -455,10 +460,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -508,7 +514,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) _request = build_get_request( @@ -520,7 +526,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -535,7 +540,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,7 +553,7 @@ async def _batch_update_initial( server_name: str, parameters: Union[_models.ConfigurationListForBatchUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ConfigurationListResult]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -560,9 +565,9 @@ async def _batch_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ConfigurationListResult]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -583,10 +588,10 @@ async def _batch_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -594,13 +599,15 @@ async def _batch_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -694,7 +701,7 @@ async def begin_batch_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -712,10 +719,11 @@ async def begin_batch_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = self._deserialize("ConfigurationListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -774,7 +782,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -800,12 +808,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_databases_operations.py index 48caa6a460cda..f98c7561427cf 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_databases_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._databases_operations import ( build_create_or_update_request, build_delete_request, @@ -72,7 +72,7 @@ async def _create_or_update_initial( database_name: str, parameters: Union[_models.Database, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Database]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -84,9 +84,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -108,10 +108,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -119,16 +119,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Database", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Database", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -229,7 +228,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Database] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -248,10 +247,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -273,9 +273,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -287,8 +287,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -299,10 +299,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -310,12 +310,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -337,13 +345,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -353,6 +361,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -402,7 +411,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.Database] = kwargs.pop("cls", None) _request = build_get_request( @@ -414,7 +423,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -429,7 +437,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -455,7 +463,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -477,12 +485,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_firewall_rules_operations.py index 0350d338c240f..01828c93096e9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_firewall_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._firewall_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -72,7 +72,7 @@ async def _create_or_update_initial( firewall_rule_name: str, parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.FirewallRule]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -84,9 +84,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -108,10 +108,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -119,16 +119,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("FirewallRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -229,7 +228,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -248,10 +247,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -273,9 +273,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -287,8 +287,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -299,10 +299,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -310,12 +310,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -337,13 +345,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -353,6 +361,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -402,7 +411,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) _request = build_get_request( @@ -414,7 +423,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -429,7 +437,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -455,7 +463,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -477,12 +485,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py index e440917964bc1..4d651004852d1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._get_private_dns_zone_suffix_operations import build_execute_request if sys.version_info >= (3, 9): @@ -74,7 +72,7 @@ async def execute(self, **kwargs: Any) -> _models.GetPrivateDnsZoneSuffixRespons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.GetPrivateDnsZoneSuffixResponse] = kwargs.pop("cls", None) _request = build_execute_request( @@ -82,7 +80,6 @@ async def execute(self, **kwargs: Any) -> _models.GetPrivateDnsZoneSuffixRespons headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -97,7 +94,7 @@ async def execute(self, **kwargs: Any) -> _models.GetPrivateDnsZoneSuffixRespons error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GetPrivateDnsZoneSuffixResponse", pipeline_response) + deserialized = self._deserialize("GetPrivateDnsZoneSuffixResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_location_based_capabilities_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_location_based_capabilities_operations.py index 451c8c429b58f..50bd824026c94 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_location_based_capabilities_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_location_based_capabilities_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._location_based_capabilities_operations import build_list_request if sys.version_info >= (3, 9): @@ -71,7 +69,7 @@ def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.Capa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.CapabilitiesListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -92,12 +90,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_location_based_capability_set_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_location_based_capability_set_operations.py index b164156711ac9..c4111348332bd 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_location_based_capability_set_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_location_based_capability_set_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._location_based_capability_set_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -71,7 +69,7 @@ def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.Capa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.CapabilitySetsList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -92,12 +90,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -150,7 +146,7 @@ async def get(self, location_name: str, capability_set_name: str = "default", ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.Capability] = kwargs.pop("cls", None) _request = build_get_request( @@ -161,7 +157,6 @@ async def get(self, location_name: str, capability_set_name: str = "default", ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -176,7 +171,7 @@ async def get(self, location_name: str, capability_set_name: str = "default", ** error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Capability", pipeline_response) + deserialized = self._deserialize("Capability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_log_files_operations.py index c280e32c25960..f56bb544d9f96 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_log_files_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._log_files_operations import build_list_by_server_request if sys.version_info >= (3, 9): @@ -75,7 +73,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.LogFileListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -97,12 +95,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_long_running_backup_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_long_running_backup_operations.py index a1cd7932bac8a..3a8fdb6d62857 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_long_running_backup_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_long_running_backup_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,19 +16,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._long_running_backup_operations import build_create_request if sys.version_info >= (3, 9): @@ -65,7 +65,7 @@ async def _create_initial( backup_name: str, parameters: Optional[Union[_models.ServerBackupV2, IO[bytes]]] = None, **kwargs: Any - ) -> Optional[_models.ServerBackupV2]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -77,9 +77,9 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ServerBackupV2]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -104,10 +104,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -115,24 +115,23 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ServerBackupV2", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ServerBackupV2", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -234,7 +233,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ServerBackupV2] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -253,10 +252,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerBackupV2", pipeline_response) + deserialized = self._deserialize("ServerBackupV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_long_running_backups_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_long_running_backups_operations.py index 756c0fe38d6d5..1f4d6796390c2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_long_running_backups_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_long_running_backups_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._long_running_backups_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -85,7 +83,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ServerBackupV2] = kwargs.pop("cls", None) _request = build_get_request( @@ -97,7 +95,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +109,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerBackupV2", pipeline_response) + deserialized = self._deserialize("ServerBackupV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -138,7 +135,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ServerBackupV2ListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -160,12 +157,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_maintenances_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_maintenances_operations.py index 07e57979d6892..99319f3c43c22 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_maintenances_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_maintenances_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._maintenances_operations import build_list_request, build_read_request, build_update_request if sys.version_info >= (3, 9): @@ -88,7 +88,7 @@ async def read( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.Maintenance] = kwargs.pop("cls", None) _request = build_read_request( @@ -100,7 +100,6 @@ async def read( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -115,7 +114,7 @@ async def read( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Maintenance", pipeline_response) + deserialized = self._deserialize("Maintenance", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -129,7 +128,7 @@ async def _update_initial( maintenance_name: str, parameters: Optional[Union[_models.MaintenanceUpdate, IO[bytes]]] = None, **kwargs: Any - ) -> Optional[_models.Maintenance]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -141,9 +140,9 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Maintenance]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -168,10 +167,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -179,18 +178,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Maintenance", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -292,7 +293,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Maintenance] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -311,10 +312,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Maintenance", pipeline_response) + deserialized = self._deserialize("Maintenance", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -353,7 +355,7 @@ def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.MaintenanceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -375,12 +377,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_operation_progress_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_operation_progress_operations.py index 99eb86be0d481..717fbde69f344 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_operation_progress_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_operation_progress_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operation_progress_operations import build_get_request if sys.version_info >= (3, 9): @@ -80,7 +78,7 @@ async def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.OperationProgressResult] = kwargs.pop("cls", None) _request = build_get_request( @@ -91,7 +89,6 @@ async def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -106,7 +103,7 @@ async def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationProgressResult", pipeline_response) + deserialized = self._deserialize("OperationProgressResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_operation_results_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_operation_results_operations.py index ed554cb9bf5b8..2d369cfb3bd30 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_operation_results_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_operation_results_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operation_results_operations import build_get_request if sys.version_info >= (3, 9): @@ -80,7 +78,7 @@ async def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.OperationStatusExtendedResult] = kwargs.pop("cls", None) _request = build_get_request( @@ -91,7 +89,6 @@ async def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _mo headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -106,7 +103,7 @@ async def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatusExtendedResult", pipeline_response) + deserialized = self._deserialize("OperationStatusExtendedResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_operations.py index fcb9a8bc90885..d45d8db462596 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): @@ -68,7 +66,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -87,12 +85,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_replicas_operations.py index 009e71227542e..f1c5b86200120 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_replicas_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._replicas_operations import build_list_by_server_request if sys.version_info >= (3, 9): @@ -97,12 +95,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_servers_migration_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_servers_migration_operations.py index ab0eebc2a13ea..8051dce1fd67b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_servers_migration_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_servers_migration_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,19 +15,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._servers_migration_operations import build_cutover_migration_request if sys.version_info >= (3, 9): @@ -59,7 +59,7 @@ def __init__(self, *args, **kwargs) -> None: async def _cutover_migration_initial( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Optional[_models.Server]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -72,7 +72,7 @@ async def _cutover_migration_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_cutover_migration_request( resource_group_name=resource_group_name, @@ -82,10 +82,10 @@ async def _cutover_migration_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -93,21 +93,23 @@ async def _cutover_migration_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -149,10 +151,11 @@ async def begin_cutover_migration( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_servers_operations.py index 879c62797763c..62e0d30580f87 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/aio/operations/_servers_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._servers_operations import ( build_create_request, build_delete_request, @@ -76,7 +76,7 @@ def __init__(self, *args, **kwargs) -> None: async def _create_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.Server, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -90,7 +90,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -111,10 +111,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -122,21 +122,20 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Server", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -244,10 +243,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -275,7 +275,7 @@ async def _update_initial( server_name: str, parameters: Union[_models.ServerForUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -289,7 +289,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -310,10 +310,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -321,18 +321,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -444,10 +446,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -469,9 +472,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -484,7 +485,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -494,10 +495,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -505,6 +506,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -513,8 +518,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -538,7 +547,7 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -547,6 +556,7 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -606,7 +616,6 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -621,7 +630,7 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -664,12 +673,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -731,12 +738,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -766,9 +771,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -781,7 +786,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -791,10 +796,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -802,6 +807,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -810,8 +819,12 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -835,7 +848,7 @@ async def begin_failover(self, resource_group_name: str, server_name: str, **kwa lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -844,6 +857,7 @@ async def begin_failover(self, resource_group_name: str, server_name: str, **kwa params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -980,7 +994,6 @@ async def validate_estimate_high_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -995,20 +1008,20 @@ async def validate_estimate_high_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HighAvailabilityValidationEstimation", pipeline_response) + deserialized = self._deserialize("HighAvailabilityValidationEstimation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _restart_initial( # pylint: disable=inconsistent-return-statements + async def _restart_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerRestartParameter, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1022,7 +1035,7 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1043,10 +1056,10 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1054,6 +1067,10 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1062,8 +1079,12 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_restart( @@ -1152,7 +1173,7 @@ async def begin_restart( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restart_initial( # type: ignore + raw_result = await self._restart_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -1163,6 +1184,7 @@ async def begin_restart( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1184,9 +1206,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + async def _start_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1199,7 +1219,7 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -1209,10 +1229,10 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1220,6 +1240,10 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1228,8 +1252,12 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1253,7 +1281,7 @@ async def begin_start(self, resource_group_name: str, server_name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._start_initial( # type: ignore + raw_result = await self._start_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1262,6 +1290,7 @@ async def begin_start(self, resource_group_name: str, server_name: str, **kwargs params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1283,9 +1312,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + async def _stop_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1298,7 +1325,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -1308,10 +1335,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1319,6 +1346,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1327,8 +1358,12 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1352,7 +1387,7 @@ async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._stop_initial( # type: ignore + raw_result = await self._stop_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1361,6 +1396,7 @@ async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1382,13 +1418,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _reset_gtid_initial( # pylint: disable=inconsistent-return-statements + async def _reset_gtid_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerGtidSetParameter, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1402,7 +1438,7 @@ async def _reset_gtid_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1423,10 +1459,10 @@ async def _reset_gtid_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1434,6 +1470,10 @@ async def _reset_gtid_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1442,8 +1482,12 @@ async def _reset_gtid_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_reset_gtid( @@ -1532,7 +1576,7 @@ async def begin_reset_gtid( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._reset_gtid_initial( # type: ignore + raw_result = await self._reset_gtid_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -1543,6 +1587,7 @@ async def begin_reset_gtid( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1573,7 +1618,7 @@ async def _detach_v_net_initial( server_name: str, parameters: Union[_models.ServerDetachVNetParameter, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1587,7 +1632,7 @@ async def _detach_v_net_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1608,10 +1653,10 @@ async def _detach_v_net_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1619,18 +1664,20 @@ async def _detach_v_net_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1740,10 +1787,11 @@ async def begin_detach_v_net( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/__init__.py index 6c36a88d4b013..390e4a121d952 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/__init__.py @@ -14,10 +14,6 @@ from ._configurations_operations import ConfigurationsOperations from ._databases_operations import DatabasesOperations from ._firewall_rules_operations import FirewallRulesOperations -from ._servers_operations import ServersOperations -from ._replicas_operations import ReplicasOperations -from ._servers_migration_operations import ServersMigrationOperations -from ._advanced_threat_protection_settings_operations import AdvancedThreatProtectionSettingsOperations from ._log_files_operations import LogFilesOperations from ._location_based_capabilities_operations import LocationBasedCapabilitiesOperations from ._location_based_capability_set_operations import LocationBasedCapabilitySetOperations @@ -29,6 +25,10 @@ from ._get_private_dns_zone_suffix_operations import GetPrivateDnsZoneSuffixOperations from ._operations import Operations from ._maintenances_operations import MaintenancesOperations +from ._servers_operations import ServersOperations +from ._replicas_operations import ReplicasOperations +from ._servers_migration_operations import ServersMigrationOperations +from ._advanced_threat_protection_settings_operations import AdvancedThreatProtectionSettingsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -43,10 +43,6 @@ "ConfigurationsOperations", "DatabasesOperations", "FirewallRulesOperations", - "ServersOperations", - "ReplicasOperations", - "ServersMigrationOperations", - "AdvancedThreatProtectionSettingsOperations", "LogFilesOperations", "LocationBasedCapabilitiesOperations", "LocationBasedCapabilitySetOperations", @@ -58,6 +54,10 @@ "GetPrivateDnsZoneSuffixOperations", "Operations", "MaintenancesOperations", + "ServersOperations", + "ReplicasOperations", + "ServersMigrationOperations", + "AdvancedThreatProtectionSettingsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_advanced_threat_protection_settings_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_advanced_threat_protection_settings_operations.py index fb21db20c5dd5..a56744ebb0865 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_advanced_threat_protection_settings_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_advanced_threat_protection_settings_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -265,7 +265,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +279,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response) + deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -294,7 +293,7 @@ def _update_initial( advanced_threat_protection_name: Union[str, _models.AdvancedThreatProtectionName], parameters: Union[_models.AdvancedThreatProtectionForUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AdvancedThreatProtection]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -308,7 +307,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.AdvancedThreatProtection]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -330,10 +329,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -341,21 +340,23 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -482,10 +483,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response) + deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -516,7 +518,7 @@ def _update_put_initial( advanced_threat_protection_name: Union[str, _models.AdvancedThreatProtectionName], parameters: Union[_models.AdvancedThreatProtection, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AdvancedThreatProtection]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -530,7 +532,7 @@ def _update_put_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.AdvancedThreatProtection]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -552,10 +554,10 @@ def _update_put_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -563,24 +565,23 @@ def _update_put_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -706,10 +707,11 @@ def begin_update_put( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response) + deserialized = self._deserialize("AdvancedThreatProtection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -775,12 +777,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_azure_ad_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_azure_ad_administrators_operations.py index f7ecd75279973..c2eda95f8f8d1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_azure_ad_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_azure_ad_administrators_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -53,7 +53,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -94,7 +94,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +132,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +166,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -219,7 +219,7 @@ def _create_or_update_initial( administrator_name: Union[str, _models.AdministratorName], parameters: Union[_models.AzureADAdministrator, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AzureADAdministrator]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -231,9 +231,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.AzureADAdministrator]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -255,10 +255,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -266,16 +266,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("AzureADAdministrator", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureADAdministrator", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -382,7 +381,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AzureADAdministrator] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -401,10 +400,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureADAdministrator", pipeline_response) + deserialized = self._deserialize("AzureADAdministrator", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -426,13 +426,13 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, administrator_name: Union[str, _models.AdministratorName], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -444,8 +444,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -456,10 +456,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -467,12 +467,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -499,13 +507,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, administrator_name=administrator_name, @@ -515,6 +523,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -571,7 +580,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.AzureADAdministrator] = kwargs.pop("cls", None) _request = build_get_request( @@ -583,7 +592,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -598,7 +606,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureADAdministrator", pipeline_response) + deserialized = self._deserialize("AzureADAdministrator", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -625,7 +633,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.AdministratorListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -647,12 +655,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_backup_and_export_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_backup_and_export_operations.py index 879be6abe4327..6bd32352002bd 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_backup_and_export_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_backup_and_export_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,7 +30,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -48,7 +48,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -84,7 +84,7 @@ def build_validate_backup_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,7 @@ def _create_initial( server_name: str, parameters: Union[_models.BackupAndExportRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.BackupAndExportResponse]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -148,9 +148,9 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.BackupAndExportResponse]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -171,10 +171,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -182,21 +182,23 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BackupAndExportResponse", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -290,7 +292,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BackupAndExportResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -308,10 +310,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupAndExportResponse", pipeline_response) + deserialized = self._deserialize("BackupAndExportResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -361,7 +364,7 @@ def validate_backup( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ValidateBackupResponse] = kwargs.pop("cls", None) _request = build_validate_backup_request( @@ -372,7 +375,6 @@ def validate_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +389,7 @@ def validate_backup( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ValidateBackupResponse", pipeline_response) + deserialized = self._deserialize("ValidateBackupResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_backups_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_backups_operations.py index 7bd5176583258..150a727370e76 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_backups_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_backups_operations.py @@ -19,15 +19,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -46,7 +44,7 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +112,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,7 +184,7 @@ def put(self, resource_group_name: str, server_name: str, backup_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ServerBackup] = kwargs.pop("cls", None) _request = build_put_request( @@ -198,7 +196,6 @@ def put(self, resource_group_name: str, server_name: str, backup_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -213,7 +210,7 @@ def put(self, resource_group_name: str, server_name: str, backup_name: str, **kw error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerBackup", pipeline_response) + deserialized = self._deserialize("ServerBackup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -246,7 +243,7 @@ def get(self, resource_group_name: str, server_name: str, backup_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ServerBackup] = kwargs.pop("cls", None) _request = build_get_request( @@ -258,7 +255,6 @@ def get(self, resource_group_name: str, server_name: str, backup_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get(self, resource_group_name: str, server_name: str, backup_name: str, **kw error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerBackup", pipeline_response) + deserialized = self._deserialize("ServerBackup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -299,7 +295,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ServerBackupListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -321,12 +317,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_check_name_availability_operations.py index cb2e9ee537c02..866fdc7945089 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_check_name_availability_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +42,7 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +167,7 @@ def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) @@ -191,7 +189,6 @@ def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -206,7 +203,7 @@ def execute( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_check_name_availability_without_location_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_check_name_availability_without_location_operations.py index 46537a92843d0..fb07b6eb6e5f1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_check_name_availability_without_location_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_check_name_availability_without_location_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +42,7 @@ def build_execute_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -152,7 +150,7 @@ def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) @@ -173,7 +171,6 @@ def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -188,7 +185,7 @@ def execute( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_check_virtual_network_subnet_usage_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_check_virtual_network_subnet_usage_operations.py index e967b332468db..a725d3bd5aa7a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_check_virtual_network_subnet_usage_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_check_virtual_network_subnet_usage_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +42,7 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,7 +160,7 @@ def execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.VirtualNetworkSubnetUsageResult] = kwargs.pop("cls", None) @@ -184,7 +182,6 @@ def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -199,7 +196,7 @@ def execute( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworkSubnetUsageResult", pipeline_response) + deserialized = self._deserialize("VirtualNetworkSubnetUsageResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_configurations_operations.py index 6ba3dba5f118a..241ed81859a2e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_configurations_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -49,7 +49,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -86,7 +86,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -123,7 +123,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +157,7 @@ def build_batch_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -201,7 +201,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -262,7 +262,7 @@ def _create_or_update_initial( configuration_name: str, parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -274,9 +274,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -298,10 +298,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -309,18 +309,20 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -420,7 +422,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -439,10 +441,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -471,7 +474,7 @@ def _update_initial( configuration_name: str, parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -483,9 +486,9 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -507,10 +510,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -518,13 +521,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -625,7 +630,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -644,10 +649,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -697,7 +703,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) _request = build_get_request( @@ -709,7 +715,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -724,7 +729,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -737,7 +742,7 @@ def _batch_update_initial( server_name: str, parameters: Union[_models.ConfigurationListForBatchUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ConfigurationListResult]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -749,9 +754,9 @@ def _batch_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ConfigurationListResult]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -772,10 +777,10 @@ def _batch_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -783,13 +788,15 @@ def _batch_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -883,7 +890,7 @@ def begin_batch_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -901,10 +908,11 @@ def begin_batch_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = self._deserialize("ConfigurationListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -962,7 +970,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -988,12 +996,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_databases_operations.py index 0ba8512a6da2e..95ee723eaf89b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_databases_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -49,7 +49,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -86,7 +86,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +154,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +207,7 @@ def _create_or_update_initial( database_name: str, parameters: Union[_models.Database, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Database]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -219,9 +219,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -243,10 +243,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -254,16 +254,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Database", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Database", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -358,7 +357,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Database] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -377,10 +376,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -402,9 +402,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -416,8 +416,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -428,10 +428,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -439,12 +439,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -466,13 +474,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -482,6 +490,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -529,7 +538,7 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.Database] = kwargs.pop("cls", None) _request = build_get_request( @@ -541,7 +550,6 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -556,7 +564,7 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -579,7 +587,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -601,12 +609,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_firewall_rules_operations.py index 409e0b7e82970..6467e5cfd18b4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_firewall_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -49,7 +49,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -88,7 +88,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +124,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +160,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +213,7 @@ def _create_or_update_initial( firewall_rule_name: str, parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.FirewallRule]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -225,9 +225,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -249,10 +249,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -260,16 +260,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("FirewallRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -370,7 +369,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -389,10 +388,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -414,9 +414,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -428,8 +428,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -440,10 +440,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -451,12 +451,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -478,13 +486,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -494,6 +502,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -543,7 +552,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) _request = build_get_request( @@ -555,7 +564,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -570,7 +578,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -596,7 +604,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -618,12 +626,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py index 3a887e87493fe..1ecd9d974efe0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -43,7 +41,7 @@ def build_execute_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +94,7 @@ def execute(self, **kwargs: Any) -> _models.GetPrivateDnsZoneSuffixResponse: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.GetPrivateDnsZoneSuffixResponse] = kwargs.pop("cls", None) _request = build_execute_request( @@ -104,7 +102,6 @@ def execute(self, **kwargs: Any) -> _models.GetPrivateDnsZoneSuffixResponse: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -119,7 +116,7 @@ def execute(self, **kwargs: Any) -> _models.GetPrivateDnsZoneSuffixResponse: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GetPrivateDnsZoneSuffixResponse", pipeline_response) + deserialized = self._deserialize("GetPrivateDnsZoneSuffixResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_location_based_capabilities_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_location_based_capabilities_operations.py index cd488856c2181..022776d8b4662 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_location_based_capabilities_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_location_based_capabilities_operations.py @@ -19,15 +19,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +42,7 @@ def build_list_request(location_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +100,7 @@ def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.Capabilit _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.CapabilitiesListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -123,12 +121,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_location_based_capability_set_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_location_based_capability_set_operations.py index fc2092fadb130..835ca83236bb3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_location_based_capability_set_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_location_based_capability_set_operations.py @@ -19,15 +19,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +42,7 @@ def build_list_request(location_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +72,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +131,7 @@ def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.Capabilit _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.CapabilitySetsList] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -154,12 +152,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -212,7 +208,7 @@ def get(self, location_name: str, capability_set_name: str = "default", **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.Capability] = kwargs.pop("cls", None) _request = build_get_request( @@ -223,7 +219,6 @@ def get(self, location_name: str, capability_set_name: str = "default", **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -238,7 +233,7 @@ def get(self, location_name: str, capability_set_name: str = "default", **kwargs error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Capability", pipeline_response) + deserialized = self._deserialize("Capability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_log_files_operations.py index 424ad29e853ad..c813f636bd15c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_log_files_operations.py @@ -19,15 +19,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -46,7 +44,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +106,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.LogFileListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -130,12 +128,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_long_running_backup_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_long_running_backup_operations.py index 8a19e89a1b80c..bb6e3ab2c484f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_long_running_backup_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_long_running_backup_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,7 +30,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -48,7 +48,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -105,7 +105,7 @@ def _create_initial( backup_name: str, parameters: Optional[Union[_models.ServerBackupV2, IO[bytes]]] = None, **kwargs: Any - ) -> Optional[_models.ServerBackupV2]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -117,9 +117,9 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ServerBackupV2]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -144,10 +144,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -155,24 +155,23 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ServerBackupV2", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ServerBackupV2", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -274,7 +273,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ServerBackupV2] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -293,10 +292,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerBackupV2", pipeline_response) + deserialized = self._deserialize("ServerBackupV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_long_running_backups_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_long_running_backups_operations.py index 1cdc2470179bd..953e522da6c61 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_long_running_backups_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_long_running_backups_operations.py @@ -19,15 +19,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -46,7 +44,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +76,7 @@ def build_list_request(resource_group_name: str, server_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +150,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ServerBackupV2] = kwargs.pop("cls", None) _request = build_get_request( @@ -164,7 +162,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -179,7 +176,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerBackupV2", pipeline_response) + deserialized = self._deserialize("ServerBackupV2", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -203,7 +200,7 @@ def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.ServerBackupV2ListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -225,12 +222,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_maintenances_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_maintenances_operations.py index 238de0d690f86..ab515e4049d47 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_maintenances_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_maintenances_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -49,7 +49,7 @@ def build_read_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,7 +118,7 @@ def build_list_request(resource_group_name: str, server_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +192,7 @@ def read( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.Maintenance] = kwargs.pop("cls", None) _request = build_read_request( @@ -204,7 +204,6 @@ def read( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -219,7 +218,7 @@ def read( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Maintenance", pipeline_response) + deserialized = self._deserialize("Maintenance", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -233,7 +232,7 @@ def _update_initial( maintenance_name: str, parameters: Optional[Union[_models.MaintenanceUpdate, IO[bytes]]] = None, **kwargs: Any - ) -> Optional[_models.Maintenance]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -245,9 +244,9 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Maintenance]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -272,10 +271,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -283,18 +282,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Maintenance", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -396,7 +397,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Maintenance] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -415,10 +416,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Maintenance", pipeline_response) + deserialized = self._deserialize("Maintenance", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -457,7 +459,7 @@ def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.MaintenanceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -479,12 +481,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_operation_progress_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_operation_progress_operations.py index a2c11cf401321..9c8cc0d6246c8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_operation_progress_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_operation_progress_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -43,7 +41,7 @@ def build_get_request(location_name: str, operation_id: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +110,7 @@ def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _models.O _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.OperationProgressResult] = kwargs.pop("cls", None) _request = build_get_request( @@ -123,7 +121,6 @@ def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _models.O headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -138,7 +135,7 @@ def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _models.O error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationProgressResult", pipeline_response) + deserialized = self._deserialize("OperationProgressResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_operation_results_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_operation_results_operations.py index 18f1fa0865d12..6bf323ebb4881 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_operation_results_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_operation_results_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -43,7 +41,7 @@ def build_get_request(location_name: str, operation_id: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +110,7 @@ def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _models.O _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.OperationStatusExtendedResult] = kwargs.pop("cls", None) _request = build_get_request( @@ -123,7 +121,6 @@ def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _models.O headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -138,7 +135,7 @@ def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _models.O error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatusExtendedResult", pipeline_response) + deserialized = self._deserialize("OperationStatusExtendedResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_operations.py index 0c4f401695ef4..8ff7423af6ed0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_operations.py @@ -19,15 +19,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +42,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +87,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-12-30")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -108,12 +106,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_replicas_operations.py index 775273dc64a4c..a07c2d62a319c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_replicas_operations.py @@ -19,15 +19,13 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -130,12 +128,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_servers_migration_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_servers_migration_operations.py index c0c6edca78c9b..b07fa8098f5f3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_servers_migration_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_servers_migration_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterator, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,7 +29,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -93,9 +93,7 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - def _cutover_migration_initial( - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Optional[_models.Server]: + def _cutover_migration_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -108,7 +106,7 @@ def _cutover_migration_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_cutover_migration_request( resource_group_name=resource_group_name, @@ -118,10 +116,10 @@ def _cutover_migration_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -129,21 +127,23 @@ def _cutover_migration_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -183,10 +183,11 @@ def begin_cutover_migration( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_servers_operations.py index bec425d7b96c7..fd6a7d090663a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql_flexibleservers/operations/_servers_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -493,7 +493,7 @@ def __init__(self, *args, **kwargs): def _create_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.Server, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -507,7 +507,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -528,10 +528,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -539,21 +539,20 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Server", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -655,10 +654,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -686,7 +686,7 @@ def _update_initial( server_name: str, parameters: Union[_models.ServerForUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -700,7 +700,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -721,10 +721,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -732,18 +732,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -849,10 +851,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -874,9 +877,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -889,7 +890,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -899,10 +900,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -910,6 +911,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -918,8 +923,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -943,7 +952,7 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -952,6 +961,7 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1010,7 +1020,6 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1025,7 +1034,7 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1067,12 +1076,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1133,12 +1140,10 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: _request = HttpRequest("GET", next_link) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1168,9 +1173,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + def _failover_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1183,7 +1186,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1193,10 +1196,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1204,6 +1207,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1212,8 +1219,12 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1237,7 +1248,7 @@ def begin_failover(self, resource_group_name: str, server_name: str, **kwargs: A lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1246,6 +1257,7 @@ def begin_failover(self, resource_group_name: str, server_name: str, **kwargs: A params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1382,7 +1394,6 @@ def validate_estimate_high_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1397,20 +1408,20 @@ def validate_estimate_high_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HighAvailabilityValidationEstimation", pipeline_response) + deserialized = self._deserialize("HighAvailabilityValidationEstimation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _restart_initial( # pylint: disable=inconsistent-return-statements + def _restart_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerRestartParameter, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1424,7 +1435,7 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1445,10 +1456,10 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1456,6 +1467,10 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1464,8 +1479,12 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_restart( @@ -1554,7 +1573,7 @@ def begin_restart( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restart_initial( # type: ignore + raw_result = self._restart_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -1565,6 +1584,7 @@ def begin_restart( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1586,9 +1606,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + def _start_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1601,7 +1619,7 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -1611,10 +1629,10 @@ def _start_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1622,6 +1640,10 @@ def _start_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1630,8 +1652,12 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1655,7 +1681,7 @@ def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._start_initial( # type: ignore + raw_result = self._start_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1664,6 +1690,7 @@ def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1685,9 +1712,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: + def _stop_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1700,7 +1725,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -1710,10 +1735,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1721,6 +1746,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1729,8 +1758,12 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1754,7 +1787,7 @@ def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._stop_initial( # type: ignore + raw_result = self._stop_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1763,6 +1796,7 @@ def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1784,13 +1818,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _reset_gtid_initial( # pylint: disable=inconsistent-return-statements + def _reset_gtid_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerGtidSetParameter, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1804,7 +1838,7 @@ def _reset_gtid_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1825,10 +1859,10 @@ def _reset_gtid_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1836,6 +1870,10 @@ def _reset_gtid_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1844,8 +1882,12 @@ def _reset_gtid_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_reset_gtid( @@ -1934,7 +1976,7 @@ def begin_reset_gtid( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._reset_gtid_initial( # type: ignore + raw_result = self._reset_gtid_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -1945,6 +1987,7 @@ def begin_reset_gtid( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1974,7 +2017,7 @@ def _detach_v_net_initial( server_name: str, parameters: Union[_models.ServerDetachVNetParameter, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1988,7 +2031,7 @@ def _detach_v_net_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2009,10 +2052,10 @@ def _detach_v_net_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2020,18 +2063,20 @@ def _detach_v_net_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2135,10 +2180,11 @@ def begin_detach_v_net( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_configuration.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_configuration.py index c79a7430b4af3..e2c7a9862a2ad 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_configuration.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class PostgreSQLManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class PostgreSQLManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for PostgreSQLManagementClient. Note that all parameters used to create this instance are saved as instance @@ -32,7 +31,6 @@ class PostgreSQLManagementClientConfiguration(Configuration): # pylint: disable """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(PostgreSQLManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -42,6 +40,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.subscription_id = subscription_id self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-rdbms/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -50,9 +49,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_postgre_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_postgre_sql_management_client.py index 6ceaf022a4738..bd2aabc062301 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_postgre_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_postgre_sql_management_client.py @@ -8,9 +8,12 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import PostgreSQLManagementClientConfiguration @@ -111,7 +114,25 @@ def __init__( self._config = PostgreSQLManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -156,7 +177,7 @@ def __init__( ) self.server_keys = ServerKeysOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -176,12 +197,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "PostgreSQLManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_serialization.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_serialization.py index 4bae2292227bd..8139854b97bb8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_serialization.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,9 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +172,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +290,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +335,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +346,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +385,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +410,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +440,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +556,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +644,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +663,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +705,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +725,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +740,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +749,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -804,7 +800,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +820,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +989,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1166,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1205,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1225,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1365,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1385,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1444,12 +1438,12 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore @@ -1481,7 +1475,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1509,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1572,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1646,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1694,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1751,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1802,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1855,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1886,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1903,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1938,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1975,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1991,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_vendor.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_vendor.py deleted file mode 100644 index 0dafe0e287ff1..0000000000000 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/_configuration.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/_configuration.py index d68b5dbe01c6c..17d2a3982609e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/_configuration.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/_configuration.py @@ -8,7 +8,6 @@ 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, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class PostgreSQLManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class PostgreSQLManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for PostgreSQLManagementClient. Note that all parameters used to create this instance are saved as instance @@ -32,7 +31,6 @@ class PostgreSQLManagementClientConfiguration(Configuration): # pylint: disable """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(PostgreSQLManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -42,6 +40,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.subscription_id = subscription_id self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-rdbms/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -50,9 +49,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/_postgre_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/_postgre_sql_management_client.py index 1f8f8c26e05c7..2015531e23540 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/_postgre_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/_postgre_sql_management_client.py @@ -8,9 +8,12 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -112,7 +115,25 @@ def __init__( self._config = PostgreSQLManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -157,7 +178,9 @@ def __init__( ) self.server_keys = ServerKeysOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -177,12 +200,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "PostgreSQLManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_check_name_availability_operations.py index 930d697f6c097..88425a9aba408 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_check_name_availability_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._check_name_availability_operations import build_execute_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +70,6 @@ async def execute( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: @@ -75,17 +77,16 @@ async def execute( @overload async def execute( - self, name_availability_request: IO, *, content_type: str = "application/json", **kwargs: Any + self, name_availability_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailability: """Check the availability of name for resource. :param name_availability_request: The required parameters for checking if resource name is available. Required. - :type name_availability_request: IO + :type name_availability_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: @@ -93,23 +94,19 @@ async def execute( @distributed_trace_async async def execute( - self, name_availability_request: Union[_models.NameAvailabilityRequest, IO], **kwargs: Any + self, name_availability_request: Union[_models.NameAvailabilityRequest, IO[bytes]], **kwargs: Any ) -> _models.NameAvailability: """Check the availability of name for resource. :param name_availability_request: The required parameters for checking if resource name is - available. Is either a NameAvailabilityRequest type or a IO type. Required. + available. Is either a NameAvailabilityRequest type or a IO[bytes] type. Required. :type name_availability_request: ~azure.mgmt.rdbms.postgresql.models.NameAvailabilityRequest or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: NameAvailability or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -132,22 +129,20 @@ async def execute( else: _json = self._serialize.body(name_availability_request, "NameAvailabilityRequest") - request = build_execute_request( + _request = build_execute_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.execute.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,13 +151,9 @@ async def execute( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - execute.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability" - } + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_configurations_operations.py index 644ecfeb9b619..1cf1f2114b608 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_configurations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,13 +31,16 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._configurations_operations import ( build_create_or_update_request, build_get_request, build_list_by_server_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +69,10 @@ async def _create_or_update_initial( resource_group_name: str, server_name: str, configuration_name: str, - parameters: Union[_models.Configuration, IO], + parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -80,7 +85,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -90,7 +95,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Configuration") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, @@ -99,36 +104,33 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -155,14 +157,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Configuration or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.Configuration] @@ -175,7 +169,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, configuration_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -190,18 +184,10 @@ async def begin_create_or_update( :param configuration_name: The name of the server configuration. Required. :type configuration_name: str :param parameters: The required parameters for updating a server configuration. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Configuration or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.Configuration] @@ -214,7 +200,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, configuration_name: str, - parameters: Union[_models.Configuration, IO], + parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Configuration]: """Updates a configuration of a server. @@ -227,19 +213,8 @@ async def begin_create_or_update( :param configuration_name: The name of the server configuration. Required. :type configuration_name: str :param parameters: The required parameters for updating a server configuration. Is either a - Configuration type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.Configuration or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Configuration type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.Configuration or IO[bytes] :return: An instance of AsyncLROPoller that returns either Configuration or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.Configuration] @@ -267,12 +242,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -282,17 +258,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Configuration].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}" - } + return AsyncLROPoller[_models.Configuration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def get( @@ -307,12 +281,11 @@ async def get( :type server_name: str :param configuration_name: The name of the server configuration. Required. :type configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Configuration or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.Configuration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,22 +299,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -350,16 +321,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -372,7 +339,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Configuration or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql.models.Configuration] @@ -384,7 +350,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -395,24 +361,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationListResult", pipeline_response) @@ -422,11 +385,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -437,7 +400,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_databases_operations.py index 3137310395d74..a944d591d647e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_databases_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._databases_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +38,10 @@ build_list_by_server_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,10 +70,10 @@ async def _create_or_update_initial( resource_group_name: str, server_name: str, database_name: str, - parameters: Union[_models.Database, IO], + parameters: Union[_models.Database, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Database]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -81,7 +86,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -91,7 +96,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Database") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -100,39 +105,33 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Database", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Database", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -159,14 +158,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.Database] @@ -179,7 +170,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, database_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -194,18 +185,10 @@ async def begin_create_or_update( :param database_name: The name of the database. Required. :type database_name: str :param parameters: The required parameters for creating or updating a database. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.Database] @@ -218,7 +201,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, database_name: str, - parameters: Union[_models.Database, IO], + parameters: Union[_models.Database, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Database]: """Creates a new database or updates an existing database. @@ -231,19 +214,8 @@ async def begin_create_or_update( :param database_name: The name of the database. Required. :type database_name: str :param parameters: The required parameters for creating or updating a database. Is either a - Database type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.Database or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Database type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.Database or IO[bytes] :return: An instance of AsyncLROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.Database] @@ -271,12 +243,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -286,22 +259,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Database].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" - } + return AsyncLROPoller[_models.Database]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,38 +284,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -359,14 +333,6 @@ async def begin_delete( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -380,7 +346,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -390,11 +356,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -403,17 +370,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -428,12 +391,11 @@ async def get( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Database or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.Database :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,22 +409,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.Database] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -471,16 +431,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -493,7 +449,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Database or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql.models.Database] :raises ~azure.core.exceptions.HttpResponseError: @@ -504,7 +459,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -515,24 +470,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DatabaseListResult", pipeline_response) @@ -542,11 +494,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,7 +509,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_firewall_rules_operations.py index 0ba05229bfc86..29a797f2b6b40 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_firewall_rules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._firewall_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +38,10 @@ build_list_by_server_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,10 +70,10 @@ async def _create_or_update_initial( resource_group_name: str, server_name: str, firewall_rule_name: str, - parameters: Union[_models.FirewallRule, IO], + parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.FirewallRule]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -81,7 +86,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -91,7 +96,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "FirewallRule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -100,39 +105,33 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("FirewallRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -159,14 +158,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FirewallRule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.FirewallRule] @@ -179,7 +170,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, firewall_rule_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -194,18 +185,10 @@ async def begin_create_or_update( :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str :param parameters: The required parameters for creating or updating a firewall rule. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FirewallRule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.FirewallRule] @@ -218,7 +201,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, firewall_rule_name: str, - parameters: Union[_models.FirewallRule, IO], + parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.FirewallRule]: """Creates a new firewall rule or updates an existing firewall rule. @@ -231,19 +214,8 @@ async def begin_create_or_update( :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str :param parameters: The required parameters for creating or updating a firewall rule. Is either - a FirewallRule type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.FirewallRule or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + a FirewallRule type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.FirewallRule or IO[bytes] :return: An instance of AsyncLROPoller that returns either FirewallRule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.FirewallRule] @@ -271,12 +243,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -286,22 +259,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.FirewallRule].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return AsyncLROPoller[_models.FirewallRule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,38 +284,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -359,14 +333,6 @@ async def begin_delete( :type server_name: str :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -380,7 +346,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -390,11 +356,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -403,17 +370,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -428,12 +391,11 @@ async def get( :type server_name: str :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallRule or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.FirewallRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,22 +409,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -471,16 +431,12 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -493,7 +449,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallRule or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql.models.FirewallRule] @@ -505,7 +460,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -516,24 +471,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) @@ -543,11 +495,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,7 +510,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_location_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_location_based_performance_tier_operations.py index 6ca67e06d3152..af89604603419 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_location_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_location_based_performance_tier_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,16 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._location_based_performance_tier_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +60,6 @@ def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.Perf :param location_name: The name of the location. Required. :type location_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PerformanceTierProperties or the result of cls(response) :rtype: @@ -70,7 +72,7 @@ def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.Perf api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.PerformanceTierListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -81,23 +83,20 @@ def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.Perf def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( location_name=location_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PerformanceTierListResult", pipeline_response) @@ -107,11 +106,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -122,7 +121,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_log_files_operations.py index 0b89fd9e72c01..291504318a599 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_log_files_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,16 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._log_files_operations import build_list_by_server_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +65,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LogFile or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql.models.LogFile] :raises ~azure.core.exceptions.HttpResponseError: @@ -73,7 +75,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.LogFileListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,24 +86,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("LogFileListResult", pipeline_response) @@ -111,11 +110,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -126,7 +125,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/logFiles" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_operations.py index 16c600c2bb13c..ea7f72acda537 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,12 +57,11 @@ def __init__(self, *args, **kwargs) -> None: async def list(self, **kwargs: Any) -> _models.OperationListResult: """Lists all of the available REST API operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.OperationListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -73,18 +75,16 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -93,11 +93,9 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/operations"} + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_endpoint_connections_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_endpoint_connections_operations.py index b91403600ed30..1cb0c131b6130 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +39,10 @@ build_update_tags_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,12 +79,11 @@ async def get( :type server_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,22 +97,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,26 +119,22 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> Optional[_models.PrivateEndpointConnection]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +147,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -159,7 +157,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -168,36 +166,33 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -224,14 +219,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -245,7 +232,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -260,18 +247,10 @@ async def begin_create_or_update( :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -285,7 +264,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Approve or reject a private endpoint connection with a given name. @@ -297,19 +276,8 @@ async def begin_create_or_update( :type server_name: str :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str - :param parameters: Is either a PrivateEndpointConnection type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.PrivateEndpointConnection or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -338,12 +306,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -353,22 +322,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -380,38 +347,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -426,14 +396,6 @@ async def begin_delete( :type server_name: str :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -447,7 +409,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -457,11 +419,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -470,27 +433,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _update_tags_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnection: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +462,7 @@ async def _update_tags_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -513,7 +472,7 @@ async def _update_tags_initial( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -522,34 +481,33 @@ async def _update_tags_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_tags_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload async def begin_update_tags( @@ -579,14 +537,6 @@ async def begin_update_tags( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -600,7 +550,7 @@ async def begin_update_tags( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -618,18 +568,10 @@ async def begin_update_tags( :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update private endpoint connection Tags operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -643,7 +585,7 @@ async def begin_update_tags( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Updates tags on private endpoint connection. @@ -658,19 +600,8 @@ async def begin_update_tags( :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update private endpoint connection Tags - operation. Is either a TagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.TagsObject or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + operation. Is either a TagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.TagsObject or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -699,12 +630,13 @@ async def begin_update_tags( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -714,17 +646,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_server( @@ -737,7 +667,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -750,7 +679,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -761,24 +690,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -788,11 +714,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -803,7 +729,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_link_resources_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_link_resources_operations.py index d9c332a54e85b..7679224b86782 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_link_resources_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request, build_list_by_server_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +66,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql.models.PrivateLinkResource] @@ -75,7 +77,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -86,24 +88,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -113,11 +112,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,10 +128,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources" - } - @distributed_trace_async async def get( self, resource_group_name: str, server_name: str, group_name: str, **kwargs: Any @@ -146,12 +141,11 @@ async def get( :type server_name: str :param group_name: The name of the private link resource. Required. :type group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,22 +159,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, group_name=group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -189,13 +181,9 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources/{groupName}" - } + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_recoverable_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_recoverable_servers_operations.py index 0b5df1173e970..7c9a0c5ccc2fa 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_recoverable_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_recoverable_servers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._recoverable_servers_operations import build_get_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,12 +62,11 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecoverableServerResource or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.RecoverableServerResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -78,21 +80,19 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.RecoverableServerResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -101,13 +101,9 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecoverableServerResource", pipeline_response) + deserialized = self._deserialize("RecoverableServerResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/recoverableServers" - } + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_replicas_operations.py index 26d0e1b42f90a..de16132d43ef9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_replicas_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,16 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._replicas_operations import build_list_by_server_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +65,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -73,7 +75,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,24 +86,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) @@ -111,11 +110,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -126,7 +125,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/replicas" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_administrators_operations.py index 7b404ea3a887b..ba6bc034c372e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_administrators_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_administrators_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +38,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,12 +76,11 @@ async def get( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerAdministratorResource or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.ServerAdministratorResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,21 +94,19 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerAdministratorResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -113,25 +115,21 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) + deserialized = self._deserialize("ServerAdministratorResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, server_name: str, - properties: Union[_models.ServerAdministratorResource, IO], + properties: Union[_models.ServerAdministratorResource, IO[bytes]], **kwargs: Any - ) -> _models.ServerAdministratorResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -144,7 +142,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServerAdministratorResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -154,7 +152,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(properties, "ServerAdministratorResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -162,39 +160,34 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" - } - @overload async def begin_create_or_update( self, @@ -219,14 +212,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ServerAdministratorResource or the result of cls(response) :rtype: @@ -239,7 +224,7 @@ async def begin_create_or_update( self, resource_group_name: str, server_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -254,18 +239,10 @@ async def begin_create_or_update( :type server_name: str :param properties: The required parameters for creating or updating an AAD server administrator. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ServerAdministratorResource or the result of cls(response) :rtype: @@ -278,7 +255,7 @@ async def begin_create_or_update( self, resource_group_name: str, server_name: str, - properties: Union[_models.ServerAdministratorResource, IO], + properties: Union[_models.ServerAdministratorResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ServerAdministratorResource]: """Creates or update active directory administrator on an existing server. The update action will @@ -290,19 +267,8 @@ async def begin_create_or_update( :param server_name: The name of the server. Required. :type server_name: str :param properties: The required parameters for creating or updating an AAD server - administrator. Is either a ServerAdministratorResource type or a IO type. Required. - :type properties: ~azure.mgmt.rdbms.postgresql.models.ServerAdministratorResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + administrator. Is either a ServerAdministratorResource type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.rdbms.postgresql.models.ServerAdministratorResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either ServerAdministratorResource or the result of cls(response) :rtype: @@ -330,12 +296,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) + deserialized = self._deserialize("ServerAdministratorResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -345,22 +312,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ServerAdministratorResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" - } + return AsyncLROPoller[_models.ServerAdministratorResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,37 +335,40 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -413,14 +379,6 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -434,7 +392,7 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -443,11 +401,12 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -456,17 +415,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list( @@ -479,7 +434,6 @@ def list( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServerAdministratorResource or the result of cls(response) :rtype: @@ -492,7 +446,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerAdministratorResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,24 +457,21 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ServerAdministratorResourceListResult", pipeline_response) @@ -530,11 +481,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -545,7 +496,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_based_performance_tier_operations.py index 601de05e96083..f25dda2dead52 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_based_performance_tier_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -18,16 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_based_performance_tier_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +65,6 @@ def list( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PerformanceTierProperties or the result of cls(response) :rtype: @@ -75,7 +77,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.PerformanceTierListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -86,24 +88,21 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PerformanceTierListResult", pipeline_response) @@ -113,11 +112,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -128,7 +127,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/performanceTiers" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_keys_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_keys_operations.py index 15f5e8a44359a..5630c4902d84a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_keys_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_keys_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_keys_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +38,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +74,6 @@ def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Asy :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServerKey or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql.models.ServerKey] :raises ~azure.core.exceptions.HttpResponseError: @@ -80,7 +84,7 @@ def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) cls: ClsType[_models.ServerKeyListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,24 +95,21 @@ def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ServerKeyListResult", pipeline_response) @@ -118,11 +119,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -134,10 +135,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys" - } - @distributed_trace_async async def get(self, resource_group_name: str, server_name: str, key_name: str, **kwargs: Any) -> _models.ServerKey: """Gets a PostgreSQL Server key. @@ -149,12 +146,11 @@ async def get(self, resource_group_name: str, server_name: str, key_name: str, * :type server_name: str :param key_name: The name of the PostgreSQL Server key to be retrieved. Required. :type key_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerKey or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.ServerKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,22 +164,20 @@ async def get(self, resource_group_name: str, server_name: str, key_name: str, * api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) cls: ClsType[_models.ServerKey] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, key_name=key_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -192,26 +186,22 @@ async def get(self, resource_group_name: str, server_name: str, key_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerKey", pipeline_response) + deserialized = self._deserialize("ServerKey", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, server_name: str, key_name: str, resource_group_name: str, - parameters: Union[_models.ServerKey, IO], + parameters: Union[_models.ServerKey, IO[bytes]], **kwargs: Any - ) -> _models.ServerKey: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +214,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServerKey] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -234,7 +224,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "ServerKey") - request = build_create_or_update_request( + _request = build_create_or_update_request( server_name=server_name, key_name=key_name, resource_group_name=resource_group_name, @@ -243,39 +233,34 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ServerKey", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("ServerKey", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" - } - @overload async def begin_create_or_update( self, @@ -302,14 +287,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ServerKey or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.ServerKey] @@ -322,7 +299,7 @@ async def begin_create_or_update( server_name: str, key_name: str, resource_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -338,18 +315,10 @@ async def begin_create_or_update( Required. :type resource_group_name: str :param parameters: The requested PostgreSQL Server key resource state. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ServerKey or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.ServerKey] @@ -362,7 +331,7 @@ async def begin_create_or_update( server_name: str, key_name: str, resource_group_name: str, - parameters: Union[_models.ServerKey, IO], + parameters: Union[_models.ServerKey, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ServerKey]: """Creates or updates a PostgreSQL Server key. @@ -376,19 +345,8 @@ async def begin_create_or_update( Required. :type resource_group_name: str :param parameters: The requested PostgreSQL Server key resource state. Is either a ServerKey - type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerKey or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerKey or IO[bytes] :return: An instance of AsyncLROPoller that returns either ServerKey or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.ServerKey] @@ -416,12 +374,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerKey", pipeline_response) + deserialized = self._deserialize("ServerKey", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -431,22 +390,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ServerKey].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" - } + return AsyncLROPoller[_models.ServerKey]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, server_name: str, key_name: str, resource_group_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -458,38 +415,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( server_name=server_name, key_name=key_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -504,14 +464,6 @@ async def begin_delete( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -525,7 +477,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( server_name=server_name, key_name=key_name, resource_group_name=resource_group_name, @@ -535,11 +487,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -548,14 +501,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_parameters_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_parameters_operations.py index bc06fc849adf4..aaa98476d141f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_parameters_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_parameters_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,21 +16,25 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_parameters_operations import build_list_update_configurations_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,10 +62,10 @@ async def _list_update_configurations_initial( self, resource_group_name: str, server_name: str, - value: Union[_models.ConfigurationListResult, IO], + value: Union[_models.ConfigurationListResult, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ConfigurationListResult]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -73,7 +78,7 @@ async def _list_update_configurations_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ConfigurationListResult]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -83,7 +88,7 @@ async def _list_update_configurations_initial( else: _json = self._serialize.body(value, "ConfigurationListResult") - request = build_list_update_configurations_request( + _request = build_list_update_configurations_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -91,36 +96,33 @@ async def _list_update_configurations_initial( content_type=content_type, json=_json, content=_content, - template_url=self._list_update_configurations_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _list_update_configurations_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations" - } + return deserialized # type: ignore @overload async def begin_list_update_configurations( @@ -144,14 +146,6 @@ async def begin_list_update_configurations( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ConfigurationListResult or the result of cls(response) :rtype: @@ -164,7 +158,7 @@ async def begin_list_update_configurations( self, resource_group_name: str, server_name: str, - value: IO, + value: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -177,18 +171,10 @@ async def begin_list_update_configurations( :param server_name: The name of the server. Required. :type server_name: str :param value: The parameters for updating a list of server configuration. Required. - :type value: IO + :type value: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ConfigurationListResult or the result of cls(response) :rtype: @@ -201,7 +187,7 @@ async def begin_list_update_configurations( self, resource_group_name: str, server_name: str, - value: Union[_models.ConfigurationListResult, IO], + value: Union[_models.ConfigurationListResult, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ConfigurationListResult]: """Update a list of configurations in a given server. @@ -212,19 +198,8 @@ async def begin_list_update_configurations( :param server_name: The name of the server. Required. :type server_name: str :param value: The parameters for updating a list of server configuration. Is either a - ConfigurationListResult type or a IO type. Required. - :type value: ~azure.mgmt.rdbms.postgresql.models.ConfigurationListResult or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ConfigurationListResult type or a IO[bytes] type. Required. + :type value: ~azure.mgmt.rdbms.postgresql.models.ConfigurationListResult or IO[bytes] :return: An instance of AsyncLROPoller that returns either ConfigurationListResult or the result of cls(response) :rtype: @@ -252,12 +227,13 @@ async def begin_list_update_configurations( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = self._deserialize("ConfigurationListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -270,14 +246,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ConfigurationListResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_list_update_configurations.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations" - } + return AsyncLROPoller[_models.ConfigurationListResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_security_alert_policies_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_security_alert_policies_operations.py index ac59f0a9b29b4..e7091d09f394a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_security_alert_policies_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_server_security_alert_policies_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,13 +31,16 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_security_alert_policies_operations import ( build_create_or_update_request, build_get_request, build_list_by_server_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,12 +82,11 @@ async def get( :param security_alert_policy_name: The name of the security alert policy. "Default" Required. :type security_alert_policy_name: str or ~azure.mgmt.rdbms.postgresql.models.SecurityAlertPolicyName - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerSecurityAlertPolicy or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.ServerSecurityAlertPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,22 +100,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerSecurityAlertPolicy] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, security_alert_policy_name=security_alert_policy_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -120,26 +122,22 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, server_name: str, security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], - parameters: Union[_models.ServerSecurityAlertPolicy, IO], + parameters: Union[_models.ServerSecurityAlertPolicy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ServerSecurityAlertPolicy]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -152,7 +150,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ServerSecurityAlertPolicy]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -162,7 +160,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "ServerSecurityAlertPolicy") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, security_alert_policy_name=security_alert_policy_name, @@ -171,36 +169,33 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -228,14 +223,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -249,7 +236,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -265,18 +252,10 @@ async def begin_create_or_update( :type security_alert_policy_name: str or ~azure.mgmt.rdbms.postgresql.models.SecurityAlertPolicyName :param parameters: The server security alert policy. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -290,7 +269,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], - parameters: Union[_models.ServerSecurityAlertPolicy, IO], + parameters: Union[_models.ServerSecurityAlertPolicy, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ServerSecurityAlertPolicy]: """Creates or updates a threat detection policy. @@ -304,19 +283,8 @@ async def begin_create_or_update( :type security_alert_policy_name: str or ~azure.mgmt.rdbms.postgresql.models.SecurityAlertPolicyName :param parameters: The server security alert policy. Is either a ServerSecurityAlertPolicy type - or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerSecurityAlertPolicy or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerSecurityAlertPolicy or IO[bytes] :return: An instance of AsyncLROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -345,12 +313,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -360,17 +329,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ServerSecurityAlertPolicy].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" - } + return AsyncLROPoller[_models.ServerSecurityAlertPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_server( @@ -383,7 +350,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -396,7 +362,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerSecurityAlertPolicyListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -407,24 +373,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ServerSecurityAlertPolicyListResult", pipeline_response) @@ -434,11 +397,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,7 +412,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_servers_operations.py index 21f083f2ecb43..902b1dc4a2196 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_servers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._servers_operations import ( build_create_request, build_delete_request, @@ -40,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,9 +69,13 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def _create_initial( - self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerForCreate, IO], **kwargs: Any - ) -> Optional[_models.Server]: - error_map = { + self, + resource_group_name: str, + server_name: str, + parameters: Union[_models.ServerForCreate, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,7 +88,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -89,7 +98,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "ServerForCreate") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -97,39 +106,33 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Server", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return deserialized # type: ignore @overload async def begin_create( @@ -153,14 +156,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.Server] @@ -172,7 +167,7 @@ async def begin_create( self, resource_group_name: str, server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -185,18 +180,10 @@ async def begin_create( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for creating or updating a server. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.Server] @@ -205,7 +192,11 @@ async def begin_create( @distributed_trace_async async def begin_create( - self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerForCreate, IO], **kwargs: Any + self, + resource_group_name: str, + server_name: str, + parameters: Union[_models.ServerForCreate, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.Server]: """Creates a new server, or will overwrite an existing server. @@ -215,19 +206,8 @@ async def begin_create( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for creating or updating a server. Is either a - ServerForCreate type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerForCreate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ServerForCreate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerForCreate or IO[bytes] :return: An instance of AsyncLROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.Server] @@ -254,12 +234,13 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -269,26 +250,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Server].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return AsyncLROPoller[_models.Server]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, server_name: str, - parameters: Union[_models.ServerUpdateParameters, IO], + parameters: Union[_models.ServerUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -301,7 +280,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -311,7 +290,7 @@ async def _update_initial( else: _json = self._serialize.body(parameters, "ServerUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -319,36 +298,33 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -373,14 +349,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.Server] @@ -392,7 +360,7 @@ async def begin_update( self, resource_group_name: str, server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -406,18 +374,10 @@ async def begin_update( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for updating a server. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.Server] @@ -429,7 +389,7 @@ async def begin_update( self, resource_group_name: str, server_name: str, - parameters: Union[_models.ServerUpdateParameters, IO], + parameters: Union[_models.ServerUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Server]: """Updates an existing server. The request body can contain one to many of the properties present @@ -441,19 +401,8 @@ async def begin_update( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for updating a server. Is either a - ServerUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ServerUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerUpdateParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql.models.Server] @@ -480,12 +429,13 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -495,22 +445,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Server].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return AsyncLROPoller[_models.Server]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -522,37 +468,40 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -563,14 +512,6 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -584,7 +525,7 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -593,11 +534,12 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -606,17 +548,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _models.Server: @@ -627,12 +565,11 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Server or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.Server :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -646,21 +583,19 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.Server] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -669,16 +604,12 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Server"]: @@ -687,7 +618,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -698,7 +628,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -709,23 +639,20 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) @@ -735,11 +662,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -751,15 +678,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers" - } - @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: """List all the servers in a given subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -770,7 +692,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -781,22 +703,19 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) @@ -806,11 +725,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -822,12 +741,8 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers"} - - async def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _restart_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -839,37 +754,40 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_restart_request( + _request = build_restart_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._restart_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart" - } + return deserialized # type: ignore @distributed_trace_async async def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -880,14 +798,6 @@ async def begin_restart(self, resource_group_name: str, server_name: str, **kwar :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -901,7 +811,7 @@ async def begin_restart(self, resource_group_name: str, server_name: str, **kwar lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restart_initial( # type: ignore + raw_result = await self._restart_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -910,11 +820,12 @@ async def begin_restart(self, resource_group_name: str, server_name: str, **kwar params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -923,14 +834,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_virtual_network_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_virtual_network_rules_operations.py index d7a609d46b819..fae5f4d2ed5e5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_virtual_network_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/aio/operations/_virtual_network_rules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -16,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._virtual_network_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +38,10 @@ build_list_by_server_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,12 +78,11 @@ async def get( :type server_name: str :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.VirtualNetworkRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,22 +96,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -116,26 +118,22 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, server_name: str, virtual_network_rule_name: str, - parameters: Union[_models.VirtualNetworkRule, IO], + parameters: Union[_models.VirtualNetworkRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualNetworkRule]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -148,7 +146,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualNetworkRule]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -158,7 +156,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "VirtualNetworkRule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, @@ -167,39 +165,33 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return deserialized # type: ignore @overload async def begin_create_or_update( @@ -226,14 +218,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either VirtualNetworkRule or the result of cls(response) :rtype: @@ -247,7 +231,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, virtual_network_rule_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -262,18 +246,10 @@ async def begin_create_or_update( :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str :param parameters: The requested virtual Network Rule Resource state. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either VirtualNetworkRule or the result of cls(response) :rtype: @@ -287,7 +263,7 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, virtual_network_rule_name: str, - parameters: Union[_models.VirtualNetworkRule, IO], + parameters: Union[_models.VirtualNetworkRule, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.VirtualNetworkRule]: """Creates or updates an existing virtual network rule. @@ -300,19 +276,8 @@ async def begin_create_or_update( :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str :param parameters: The requested virtual Network Rule Resource state. Is either a - VirtualNetworkRule type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.VirtualNetworkRule or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + VirtualNetworkRule type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.VirtualNetworkRule or IO[bytes] :return: An instance of AsyncLROPoller that returns either VirtualNetworkRule or the result of cls(response) :rtype: @@ -341,12 +306,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -356,22 +322,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.VirtualNetworkRule].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return AsyncLROPoller[_models.VirtualNetworkRule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, virtual_network_rule_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,38 +347,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -429,14 +396,6 @@ async def begin_delete( :type server_name: str :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -450,7 +409,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, @@ -460,11 +419,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -473,17 +433,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_by_server( @@ -496,7 +452,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql.models.VirtualNetworkRule] @@ -508,7 +463,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.VirtualNetworkRuleListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -519,24 +474,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("VirtualNetworkRuleListResult", pipeline_response) @@ -546,11 +498,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -561,7 +513,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models_py3.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models_py3.py index 5edfa653d88a6..cc9ba648b7c50 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models_py3.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models_py3.py @@ -8,16 +8,10 @@ # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from .. import _serialization -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -29,7 +23,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -65,7 +59,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -74,22 +68,6 @@ class ProxyResource(Resource): :vartype type: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class Configuration(ProxyResource): """Represents a Configuration. @@ -97,7 +75,7 @@ class Configuration(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -182,7 +160,7 @@ class Database(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -318,10 +296,10 @@ class FirewallRule(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -398,7 +376,7 @@ class LogFile(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -522,7 +500,7 @@ def __init__( class NameAvailabilityRequest(_serialization.Model): """Request from client to check resource name availability. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: Resource name to verify. Required. :vartype name: str @@ -836,7 +814,7 @@ class PrivateEndpointConnection(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -947,7 +925,7 @@ class PrivateLinkResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1034,12 +1012,12 @@ def __init__(self, **kwargs: Any) -> None: self.required_members = None -class PrivateLinkServiceConnectionStateProperty(_serialization.Model): +class PrivateLinkServiceConnectionStateProperty(_serialization.Model): # pylint: disable=name-too-long """PrivateLinkServiceConnectionStateProperty. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar status: The private link service connection status. Required. :vartype status: str @@ -1080,7 +1058,7 @@ class RecoverableServerResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1179,10 +1157,10 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1227,10 +1205,10 @@ class Server(TrackedResource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1421,7 +1399,7 @@ class ServerAdministratorResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1503,7 +1481,7 @@ def __init__(self, *, value: Optional[List["_models.ServerAdministratorResource" class ServerForCreate(_serialization.Model): """Represents a server to be created. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar identity: The Azure Active Directory identity of the server. :vartype identity: ~azure.mgmt.rdbms.postgresql.models.ResourceIdentity @@ -1566,7 +1544,7 @@ class ServerKey(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1698,7 +1676,7 @@ def __init__(self, **kwargs: Any) -> None: self.properties = None -class ServerPrivateEndpointConnectionProperties(_serialization.Model): +class ServerPrivateEndpointConnectionProperties(_serialization.Model): # pylint: disable=name-too-long """Properties of a private endpoint connection. Variables are only populated by the server, and will be ignored when sending a request. @@ -1751,12 +1729,12 @@ def __init__( self.provisioning_state = None -class ServerPrivateLinkServiceConnectionStateProperty(_serialization.Model): +class ServerPrivateLinkServiceConnectionStateProperty(_serialization.Model): # pylint: disable=name-too-long """ServerPrivateLinkServiceConnectionStateProperty. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar status: The private link service connection status. Required. Known values are: "Approved", "Pending", "Rejected", and "Disconnected". @@ -1805,7 +1783,7 @@ class ServerPropertiesForCreate(_serialization.Model): ServerPropertiesForDefaultCreate, ServerPropertiesForGeoRestore, ServerPropertiesForRestore, ServerPropertiesForReplica - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar version: Server version. Known values are: "9.5", "9.6", "10", "10.0", "10.2", and "11". :vartype version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion @@ -1901,7 +1879,7 @@ def __init__( class ServerPropertiesForDefaultCreate(ServerPropertiesForCreate): """The properties used to create a new server. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar version: Server version. Known values are: "9.5", "9.6", "10", "10.0", "10.2", and "11". :vartype version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion @@ -2009,7 +1987,7 @@ class ServerPropertiesForGeoRestore(ServerPropertiesForCreate): """The properties used to create a new server by restoring to a different region from a geo replicated backup. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar version: Server version. Known values are: "9.5", "9.6", "10", "10.0", "10.2", and "11". :vartype version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion @@ -2106,7 +2084,7 @@ def __init__( class ServerPropertiesForReplica(ServerPropertiesForCreate): """The properties to create a new replica. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar version: Server version. Known values are: "9.5", "9.6", "10", "10.0", "10.2", and "11". :vartype version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion @@ -2203,7 +2181,7 @@ def __init__( class ServerPropertiesForRestore(ServerPropertiesForCreate): """The properties used to create a new server by restoring from a backup. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar version: Server version. Known values are: "9.5", "9.6", "10", "10.0", "10.2", and "11". :vartype version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion @@ -2313,7 +2291,7 @@ class ServerSecurityAlertPolicy(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2536,7 +2514,7 @@ def __init__( class Sku(_serialization.Model): """Billing information related properties of a server. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. Required. @@ -2672,7 +2650,7 @@ class VirtualNetworkRule(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_check_name_availability_operations.py index 51d6825b5ca70..8c28c89db2677 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_check_name_availability_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +102,6 @@ def execute( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: @@ -107,17 +109,16 @@ def execute( @overload def execute( - self, name_availability_request: IO, *, content_type: str = "application/json", **kwargs: Any + self, name_availability_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailability: """Check the availability of name for resource. :param name_availability_request: The required parameters for checking if resource name is available. Required. - :type name_availability_request: IO + :type name_availability_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: @@ -125,23 +126,19 @@ def execute( @distributed_trace def execute( - self, name_availability_request: Union[_models.NameAvailabilityRequest, IO], **kwargs: Any + self, name_availability_request: Union[_models.NameAvailabilityRequest, IO[bytes]], **kwargs: Any ) -> _models.NameAvailability: """Check the availability of name for resource. :param name_availability_request: The required parameters for checking if resource name is - available. Is either a NameAvailabilityRequest type or a IO type. Required. + available. Is either a NameAvailabilityRequest type or a IO[bytes] type. Required. :type name_availability_request: ~azure.mgmt.rdbms.postgresql.models.NameAvailabilityRequest or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: NameAvailability or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,22 +161,20 @@ def execute( else: _json = self._serialize.body(name_availability_request, "NameAvailabilityRequest") - request = build_execute_request( + _request = build_execute_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.execute.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -188,13 +183,9 @@ def execute( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - execute.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability" - } + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_configurations_operations.py index 0d94ef8c5f937..d754cfadca1c3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_configurations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -166,10 +171,10 @@ def _create_or_update_initial( resource_group_name: str, server_name: str, configuration_name: str, - parameters: Union[_models.Configuration, IO], + parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +187,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -192,7 +197,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Configuration") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, @@ -201,36 +206,33 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -257,14 +259,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Configuration or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.Configuration] @@ -277,7 +271,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, configuration_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -292,18 +286,10 @@ def begin_create_or_update( :param configuration_name: The name of the server configuration. Required. :type configuration_name: str :param parameters: The required parameters for updating a server configuration. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Configuration or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.Configuration] @@ -316,7 +302,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, configuration_name: str, - parameters: Union[_models.Configuration, IO], + parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Configuration]: """Updates a configuration of a server. @@ -329,19 +315,8 @@ def begin_create_or_update( :param configuration_name: The name of the server configuration. Required. :type configuration_name: str :param parameters: The required parameters for updating a server configuration. Is either a - Configuration type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.Configuration or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Configuration type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.Configuration or IO[bytes] :return: An instance of LROPoller that returns either Configuration or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.Configuration] @@ -369,12 +344,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -384,17 +360,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Configuration].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}" - } + return LROPoller[_models.Configuration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def get( @@ -409,12 +383,11 @@ def get( :type server_name: str :param configuration_name: The name of the server configuration. Required. :type configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Configuration or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.Configuration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,22 +401,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, configuration_name=configuration_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -452,16 +423,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -474,7 +441,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Configuration or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql.models.Configuration] :raises ~azure.core.exceptions.HttpResponseError: @@ -485,7 +451,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -496,24 +462,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ConfigurationListResult", pipeline_response) @@ -523,11 +486,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -538,7 +501,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_databases_operations.py index ca79e06b6de84..efefc21140037 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_databases_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -200,10 +205,10 @@ def _create_or_update_initial( resource_group_name: str, server_name: str, database_name: str, - parameters: Union[_models.Database, IO], + parameters: Union[_models.Database, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Database]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +221,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -226,7 +231,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Database") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -235,39 +240,33 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Database", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Database", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -294,14 +293,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.Database] :raises ~azure.core.exceptions.HttpResponseError: @@ -313,7 +304,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, database_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -328,18 +319,10 @@ def begin_create_or_update( :param database_name: The name of the database. Required. :type database_name: str :param parameters: The required parameters for creating or updating a database. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.Database] :raises ~azure.core.exceptions.HttpResponseError: @@ -351,7 +334,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, database_name: str, - parameters: Union[_models.Database, IO], + parameters: Union[_models.Database, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Database]: """Creates a new database or updates an existing database. @@ -364,19 +347,8 @@ def begin_create_or_update( :param database_name: The name of the database. Required. :type database_name: str :param parameters: The required parameters for creating or updating a database. Is either a - Database type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.Database or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Database type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.Database or IO[bytes] :return: An instance of LROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.Database] :raises ~azure.core.exceptions.HttpResponseError: @@ -403,12 +375,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -418,22 +391,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Database].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" - } + return LROPoller[_models.Database]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,38 +416,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -491,14 +465,6 @@ def begin_delete( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -512,7 +478,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -522,11 +488,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -535,17 +502,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> _models.Database: @@ -558,12 +521,11 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Database or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.Database :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -577,22 +539,20 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.Database] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -601,16 +561,12 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterable["_models.Database"]: @@ -621,7 +577,6 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Database or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql.models.Database] :raises ~azure.core.exceptions.HttpResponseError: @@ -632,7 +587,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -643,24 +598,21 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DatabaseListResult", pipeline_response) @@ -670,11 +622,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -685,7 +637,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_firewall_rules_operations.py index 166a050c15fce..9401f9d5c4577 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_firewall_rules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -200,10 +205,10 @@ def _create_or_update_initial( resource_group_name: str, server_name: str, firewall_rule_name: str, - parameters: Union[_models.FirewallRule, IO], + parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.FirewallRule]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +221,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -226,7 +231,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "FirewallRule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -235,39 +240,33 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("FirewallRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -294,14 +293,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FirewallRule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.FirewallRule] @@ -314,7 +305,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, firewall_rule_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -329,18 +320,10 @@ def begin_create_or_update( :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str :param parameters: The required parameters for creating or updating a firewall rule. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FirewallRule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.FirewallRule] @@ -353,7 +336,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, firewall_rule_name: str, - parameters: Union[_models.FirewallRule, IO], + parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.FirewallRule]: """Creates a new firewall rule or updates an existing firewall rule. @@ -366,19 +349,8 @@ def begin_create_or_update( :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str :param parameters: The required parameters for creating or updating a firewall rule. Is either - a FirewallRule type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.FirewallRule or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + a FirewallRule type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.FirewallRule or IO[bytes] :return: An instance of LROPoller that returns either FirewallRule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.FirewallRule] @@ -406,12 +378,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -421,22 +394,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.FirewallRule].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return LROPoller[_models.FirewallRule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,38 +419,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -494,14 +468,6 @@ def begin_delete( :type server_name: str :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -515,7 +481,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -525,11 +491,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -538,17 +505,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -563,12 +526,11 @@ def get( :type server_name: str :param firewall_rule_name: The name of the server firewall rule. Required. :type firewall_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallRule or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.FirewallRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -582,22 +544,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -606,16 +566,12 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}" - } + return deserialized # type: ignore @distributed_trace def list_by_server( @@ -628,7 +584,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallRule or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql.models.FirewallRule] :raises ~azure.core.exceptions.HttpResponseError: @@ -639,7 +594,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -650,24 +605,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) @@ -677,11 +629,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -692,7 +644,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_location_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_location_based_performance_tier_operations.py index 6b594d3f8036d..be609022b2582 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_location_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_location_based_performance_tier_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +91,6 @@ def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.Performan :param location_name: The name of the location. Required. :type location_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PerformanceTierProperties or the result of cls(response) :rtype: @@ -101,7 +103,7 @@ def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.Performan api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.PerformanceTierListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,23 +114,20 @@ def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.Performan def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( location_name=location_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PerformanceTierListResult", pipeline_response) @@ -138,11 +137,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,7 +152,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_log_files_operations.py index 4790e7b189155..80280ce707d43 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_log_files_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +99,6 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LogFile or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql.models.LogFile] :raises ~azure.core.exceptions.HttpResponseError: @@ -107,7 +109,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.LogFileListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,24 +120,21 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("LogFileListResult", pipeline_response) @@ -145,11 +144,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -160,7 +159,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/logFiles" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_operations.py index f60c16987d83e..2b21c4234d422 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,12 +79,11 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> _models.OperationListResult: """Lists all of the available REST API operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.OperationListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,18 +97,16 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -115,11 +115,9 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list.metadata = {"url": "/providers/Microsoft.DBforPostgreSQL/operations"} + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_endpoint_connections_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_endpoint_connections_operations.py index 90d56cec289e6..8f87d84cdfd19 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_endpoint_connections_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -269,12 +274,11 @@ def get( :type server_name: str :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,22 +292,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -312,26 +314,22 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> Optional[_models.PrivateEndpointConnection]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -344,7 +342,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -354,7 +352,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -363,36 +361,33 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -419,14 +414,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -440,7 +427,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -455,18 +442,10 @@ def begin_create_or_update( :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str :param parameters: Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -480,7 +459,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: """Approve or reject a private endpoint connection with a given name. @@ -492,19 +471,8 @@ def begin_create_or_update( :type server_name: str :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str - :param parameters: Is either a PrivateEndpointConnection type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.PrivateEndpointConnection or IO[bytes] :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -533,12 +501,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -548,22 +517,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,38 +542,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -621,14 +591,6 @@ def begin_delete( :type server_name: str :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -642,7 +604,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -652,11 +614,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -665,27 +628,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _update_tags_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any - ) -> _models.PrivateEndpointConnection: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -698,7 +657,7 @@ def _update_tags_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -708,7 +667,7 @@ def _update_tags_initial( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -717,34 +676,33 @@ def _update_tags_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_tags_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_tags_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload def begin_update_tags( @@ -774,14 +732,6 @@ def begin_update_tags( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -795,7 +745,7 @@ def begin_update_tags( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -813,18 +763,10 @@ def begin_update_tags( :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update private endpoint connection Tags operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -838,7 +780,7 @@ def begin_update_tags( resource_group_name: str, server_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: """Updates tags on private endpoint connection. @@ -853,19 +795,8 @@ def begin_update_tags( :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str :param parameters: Parameters supplied to the Update private endpoint connection Tags - operation. Is either a TagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.TagsObject or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + operation. Is either a TagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.TagsObject or IO[bytes] :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -894,12 +825,13 @@ def begin_update_tags( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -909,17 +841,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_server( @@ -932,7 +862,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -945,7 +874,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -956,24 +885,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -983,11 +909,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -998,7 +924,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_link_resources_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_link_resources_operations.py index c85c52b6c5262..35ebc9e7eceac 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_link_resources_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -132,7 +135,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql.models.PrivateLinkResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -143,7 +145,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -154,24 +156,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -181,11 +180,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -197,10 +196,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources" - } - @distributed_trace def get( self, resource_group_name: str, server_name: str, group_name: str, **kwargs: Any @@ -214,12 +209,11 @@ def get( :type server_name: str :param group_name: The name of the private link resource. Required. :type group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResource or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -233,22 +227,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, group_name=group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -257,13 +249,9 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources/{groupName}" - } + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_recoverable_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_recoverable_servers_operations.py index aaf0aa1c7dcd9..c0993e6b11a40 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_recoverable_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_recoverable_servers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -93,12 +96,11 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RecoverableServerResource or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.RecoverableServerResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,21 +114,19 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.RecoverableServerResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -135,13 +135,9 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecoverableServerResource", pipeline_response) + deserialized = self._deserialize("RecoverableServerResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/recoverableServers" - } + return deserialized # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_replicas_operations.py index aa18745549d97..575473ff14b1a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_replicas_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +99,6 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -107,7 +109,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,24 +120,21 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) @@ -145,11 +144,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -160,7 +159,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/replicas" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_administrators_operations.py index 0cba18887e4cf..07242e7a4e588 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_administrators_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -197,12 +202,11 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerAdministratorResource or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.ServerAdministratorResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,21 +220,19 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerAdministratorResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,25 +241,21 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) + deserialized = self._deserialize("ServerAdministratorResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, server_name: str, - properties: Union[_models.ServerAdministratorResource, IO], + properties: Union[_models.ServerAdministratorResource, IO[bytes]], **kwargs: Any - ) -> _models.ServerAdministratorResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -270,7 +268,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServerAdministratorResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -280,7 +278,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(properties, "ServerAdministratorResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -288,39 +286,34 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" - } - @overload def begin_create_or_update( self, @@ -345,14 +338,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ServerAdministratorResource or the result of cls(response) :rtype: @@ -365,7 +350,7 @@ def begin_create_or_update( self, resource_group_name: str, server_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -380,18 +365,10 @@ def begin_create_or_update( :type server_name: str :param properties: The required parameters for creating or updating an AAD server administrator. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ServerAdministratorResource or the result of cls(response) :rtype: @@ -404,7 +381,7 @@ def begin_create_or_update( self, resource_group_name: str, server_name: str, - properties: Union[_models.ServerAdministratorResource, IO], + properties: Union[_models.ServerAdministratorResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ServerAdministratorResource]: """Creates or update active directory administrator on an existing server. The update action will @@ -416,19 +393,8 @@ def begin_create_or_update( :param server_name: The name of the server. Required. :type server_name: str :param properties: The required parameters for creating or updating an AAD server - administrator. Is either a ServerAdministratorResource type or a IO type. Required. - :type properties: ~azure.mgmt.rdbms.postgresql.models.ServerAdministratorResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + administrator. Is either a ServerAdministratorResource type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.rdbms.postgresql.models.ServerAdministratorResource or IO[bytes] :return: An instance of LROPoller that returns either ServerAdministratorResource or the result of cls(response) :rtype: @@ -456,12 +422,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerAdministratorResource", pipeline_response) + deserialized = self._deserialize("ServerAdministratorResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -471,22 +438,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ServerAdministratorResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" - } + return LROPoller[_models.ServerAdministratorResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -498,37 +461,40 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -539,14 +505,6 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -560,7 +518,7 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -569,11 +527,12 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -582,17 +541,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list( @@ -605,7 +560,6 @@ def list( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServerAdministratorResource or the result of cls(response) :rtype: @@ -618,7 +572,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerAdministratorResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,24 +583,21 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ServerAdministratorResourceListResult", pipeline_response) @@ -656,11 +607,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -671,7 +622,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_based_performance_tier_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_based_performance_tier_operations.py index 21d776c1703b7..ff4e7664e28f1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_based_performance_tier_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_based_performance_tier_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +99,6 @@ def list( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PerformanceTierProperties or the result of cls(response) :rtype: @@ -109,7 +111,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.PerformanceTierListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,24 +122,21 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PerformanceTierListResult", pipeline_response) @@ -147,11 +146,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -162,7 +161,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/performanceTiers" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_keys_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_keys_operations.py index 216e60762c735..8ff581215e21c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_keys_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_keys_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -202,7 +207,6 @@ def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Ite :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServerKey or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql.models.ServerKey] :raises ~azure.core.exceptions.HttpResponseError: @@ -213,7 +217,7 @@ def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) cls: ClsType[_models.ServerKeyListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,24 +228,21 @@ def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ServerKeyListResult", pipeline_response) @@ -251,11 +252,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,10 +268,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys" - } - @distributed_trace def get(self, resource_group_name: str, server_name: str, key_name: str, **kwargs: Any) -> _models.ServerKey: """Gets a PostgreSQL Server key. @@ -282,12 +279,11 @@ def get(self, resource_group_name: str, server_name: str, key_name: str, **kwarg :type server_name: str :param key_name: The name of the PostgreSQL Server key to be retrieved. Required. :type key_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerKey or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.ServerKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -301,22 +297,20 @@ def get(self, resource_group_name: str, server_name: str, key_name: str, **kwarg api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) cls: ClsType[_models.ServerKey] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, key_name=key_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,26 +319,22 @@ def get(self, resource_group_name: str, server_name: str, key_name: str, **kwarg map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerKey", pipeline_response) + deserialized = self._deserialize("ServerKey", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, server_name: str, key_name: str, resource_group_name: str, - parameters: Union[_models.ServerKey, IO], + parameters: Union[_models.ServerKey, IO[bytes]], **kwargs: Any - ) -> _models.ServerKey: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +347,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServerKey] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -367,7 +357,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "ServerKey") - request = build_create_or_update_request( + _request = build_create_or_update_request( server_name=server_name, key_name=key_name, resource_group_name=resource_group_name, @@ -376,39 +366,34 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ServerKey", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("ServerKey", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" - } - @overload def begin_create_or_update( self, @@ -435,14 +420,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ServerKey or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.ServerKey] :raises ~azure.core.exceptions.HttpResponseError: @@ -454,7 +431,7 @@ def begin_create_or_update( server_name: str, key_name: str, resource_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -470,18 +447,10 @@ def begin_create_or_update( Required. :type resource_group_name: str :param parameters: The requested PostgreSQL Server key resource state. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ServerKey or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.ServerKey] :raises ~azure.core.exceptions.HttpResponseError: @@ -493,7 +462,7 @@ def begin_create_or_update( server_name: str, key_name: str, resource_group_name: str, - parameters: Union[_models.ServerKey, IO], + parameters: Union[_models.ServerKey, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ServerKey]: """Creates or updates a PostgreSQL Server key. @@ -507,19 +476,8 @@ def begin_create_or_update( Required. :type resource_group_name: str :param parameters: The requested PostgreSQL Server key resource state. Is either a ServerKey - type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerKey or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerKey or IO[bytes] :return: An instance of LROPoller that returns either ServerKey or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.ServerKey] :raises ~azure.core.exceptions.HttpResponseError: @@ -546,12 +504,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerKey", pipeline_response) + deserialized = self._deserialize("ServerKey", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -561,22 +520,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ServerKey].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" - } + return LROPoller[_models.ServerKey]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, server_name: str, key_name: str, resource_group_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -588,38 +545,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( server_name=server_name, key_name=key_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, server_name: str, key_name: str, resource_group_name: str, **kwargs: Any) -> LROPoller[None]: @@ -632,14 +592,6 @@ def begin_delete(self, server_name: str, key_name: str, resource_group_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -653,7 +605,7 @@ def begin_delete(self, server_name: str, key_name: str, resource_group_name: str lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( server_name=server_name, key_name=key_name, resource_group_name=resource_group_name, @@ -663,11 +615,12 @@ def begin_delete(self, server_name: str, key_name: str, resource_group_name: str params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -676,14 +629,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_parameters_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_parameters_operations.py index eae11b141090d..4379ee7615034 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_parameters_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_parameters_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +30,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,10 +101,10 @@ def _list_update_configurations_initial( self, resource_group_name: str, server_name: str, - value: Union[_models.ConfigurationListResult, IO], + value: Union[_models.ConfigurationListResult, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ConfigurationListResult]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +117,7 @@ def _list_update_configurations_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ConfigurationListResult]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -122,7 +127,7 @@ def _list_update_configurations_initial( else: _json = self._serialize.body(value, "ConfigurationListResult") - request = build_list_update_configurations_request( + _request = build_list_update_configurations_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -130,36 +135,33 @@ def _list_update_configurations_initial( content_type=content_type, json=_json, content=_content, - template_url=self._list_update_configurations_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _list_update_configurations_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations" - } + return deserialized # type: ignore @overload def begin_list_update_configurations( @@ -183,14 +185,6 @@ def begin_list_update_configurations( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ConfigurationListResult or the result of cls(response) :rtype: @@ -203,7 +197,7 @@ def begin_list_update_configurations( self, resource_group_name: str, server_name: str, - value: IO, + value: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -216,18 +210,10 @@ def begin_list_update_configurations( :param server_name: The name of the server. Required. :type server_name: str :param value: The parameters for updating a list of server configuration. Required. - :type value: IO + :type value: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ConfigurationListResult or the result of cls(response) :rtype: @@ -240,7 +226,7 @@ def begin_list_update_configurations( self, resource_group_name: str, server_name: str, - value: Union[_models.ConfigurationListResult, IO], + value: Union[_models.ConfigurationListResult, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ConfigurationListResult]: """Update a list of configurations in a given server. @@ -251,19 +237,8 @@ def begin_list_update_configurations( :param server_name: The name of the server. Required. :type server_name: str :param value: The parameters for updating a list of server configuration. Is either a - ConfigurationListResult type or a IO type. Required. - :type value: ~azure.mgmt.rdbms.postgresql.models.ConfigurationListResult or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ConfigurationListResult type or a IO[bytes] type. Required. + :type value: ~azure.mgmt.rdbms.postgresql.models.ConfigurationListResult or IO[bytes] :return: An instance of LROPoller that returns either ConfigurationListResult or the result of cls(response) :rtype: @@ -291,12 +266,13 @@ def begin_list_update_configurations( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = self._deserialize("ConfigurationListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -308,14 +284,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ConfigurationListResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_list_update_configurations.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations" - } + return LROPoller[_models.ConfigurationListResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_security_alert_policies_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_security_alert_policies_operations.py index fd8446850f20a..f5583bc921219 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_security_alert_policies_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_security_alert_policies_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -187,12 +192,11 @@ def get( :param security_alert_policy_name: The name of the security alert policy. "Default" Required. :type security_alert_policy_name: str or ~azure.mgmt.rdbms.postgresql.models.SecurityAlertPolicyName - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerSecurityAlertPolicy or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.ServerSecurityAlertPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,22 +210,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerSecurityAlertPolicy] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, security_alert_policy_name=security_alert_policy_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,26 +232,22 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, server_name: str, security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], - parameters: Union[_models.ServerSecurityAlertPolicy, IO], + parameters: Union[_models.ServerSecurityAlertPolicy, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ServerSecurityAlertPolicy]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +260,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ServerSecurityAlertPolicy]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -272,7 +270,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "ServerSecurityAlertPolicy") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, security_alert_policy_name=security_alert_policy_name, @@ -281,36 +279,33 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -338,14 +333,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -359,7 +346,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -375,18 +362,10 @@ def begin_create_or_update( :type security_alert_policy_name: str or ~azure.mgmt.rdbms.postgresql.models.SecurityAlertPolicyName :param parameters: The server security alert policy. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -400,7 +379,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, security_alert_policy_name: Union[str, _models.SecurityAlertPolicyName], - parameters: Union[_models.ServerSecurityAlertPolicy, IO], + parameters: Union[_models.ServerSecurityAlertPolicy, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ServerSecurityAlertPolicy]: """Creates or updates a threat detection policy. @@ -414,19 +393,8 @@ def begin_create_or_update( :type security_alert_policy_name: str or ~azure.mgmt.rdbms.postgresql.models.SecurityAlertPolicyName :param parameters: The server security alert policy. Is either a ServerSecurityAlertPolicy type - or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerSecurityAlertPolicy or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerSecurityAlertPolicy or IO[bytes] :return: An instance of LROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -455,12 +423,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicy", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -470,17 +439,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ServerSecurityAlertPolicy].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" - } + return LROPoller[_models.ServerSecurityAlertPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_server( @@ -493,7 +460,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServerSecurityAlertPolicy or the result of cls(response) :rtype: @@ -506,7 +472,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerSecurityAlertPolicyListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,24 +483,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ServerSecurityAlertPolicyListResult", pipeline_response) @@ -544,11 +507,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,7 +522,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_servers_operations.py index 7f482136150f7..9b6c084d336e2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_servers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -281,9 +286,13 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") def _create_initial( - self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerForCreate, IO], **kwargs: Any - ) -> Optional[_models.Server]: - error_map = { + self, + resource_group_name: str, + server_name: str, + parameters: Union[_models.ServerForCreate, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -296,7 +305,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -306,7 +315,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "ServerForCreate") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -314,39 +323,33 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Server", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return deserialized # type: ignore @overload def begin_create( @@ -370,14 +373,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -388,7 +383,7 @@ def begin_create( self, resource_group_name: str, server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -401,18 +396,10 @@ def begin_create( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for creating or updating a server. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -420,7 +407,11 @@ def begin_create( @distributed_trace def begin_create( - self, resource_group_name: str, server_name: str, parameters: Union[_models.ServerForCreate, IO], **kwargs: Any + self, + resource_group_name: str, + server_name: str, + parameters: Union[_models.ServerForCreate, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.Server]: """Creates a new server, or will overwrite an existing server. @@ -430,19 +421,8 @@ def begin_create( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for creating or updating a server. Is either a - ServerForCreate type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerForCreate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ServerForCreate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerForCreate or IO[bytes] :return: An instance of LROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -468,12 +448,13 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -483,26 +464,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Server].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return LROPoller[_models.Server]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, server_name: str, - parameters: Union[_models.ServerUpdateParameters, IO], + parameters: Union[_models.ServerUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -515,7 +494,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -525,7 +504,7 @@ def _update_initial( else: _json = self._serialize.body(parameters, "ServerUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -533,36 +512,33 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -587,14 +563,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -605,7 +573,7 @@ def begin_update( self, resource_group_name: str, server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -619,18 +587,10 @@ def begin_update( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for updating a server. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -641,7 +601,7 @@ def begin_update( self, resource_group_name: str, server_name: str, - parameters: Union[_models.ServerUpdateParameters, IO], + parameters: Union[_models.ServerUpdateParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Server]: """Updates an existing server. The request body can contain one to many of the properties present @@ -653,19 +613,8 @@ def begin_update( :param server_name: The name of the server. Required. :type server_name: str :param parameters: The required parameters for updating a server. Is either a - ServerUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerUpdateParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ServerUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerUpdateParameters or IO[bytes] :return: An instance of LROPoller that returns either Server or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -691,12 +640,13 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -706,22 +656,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Server].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return LROPoller[_models.Server]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -733,37 +679,40 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -774,14 +723,6 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -795,7 +736,7 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -804,11 +745,12 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -817,17 +759,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _models.Server: @@ -838,12 +776,11 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Server or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.Server :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,21 +794,19 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.Server] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -880,16 +815,12 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Server"]: @@ -898,7 +829,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -909,7 +839,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -920,23 +850,20 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) @@ -946,11 +873,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -962,15 +889,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers" - } - @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Server"]: """List all the servers in a given subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql.models.Server] :raises ~azure.core.exceptions.HttpResponseError: @@ -981,7 +903,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Server"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -992,22 +914,19 @@ def list(self, **kwargs: Any) -> Iterable["_models.Server"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ServerListResult", pipeline_response) @@ -1017,11 +936,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1033,12 +952,8 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers"} - - def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + def _restart_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1050,37 +965,40 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_restart_request( + _request = build_restart_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._restart_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart" - } + return deserialized # type: ignore @distributed_trace def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1091,14 +1009,6 @@ def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: An :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1112,7 +1022,7 @@ def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: An lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restart_initial( # type: ignore + raw_result = self._restart_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1121,11 +1031,12 @@ def begin_restart(self, resource_group_name: str, server_name: str, **kwargs: An params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -1134,14 +1045,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_virtual_network_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_virtual_network_rules_operations.py index f28537df6cf12..580037b14e0cc 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_virtual_network_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_virtual_network_rules_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -202,12 +207,11 @@ def get( :type server_name: str :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualNetworkRule or the result of cls(response) :rtype: ~azure.mgmt.rdbms.postgresql.models.VirtualNetworkRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,22 +225,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.VirtualNetworkRule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,26 +247,22 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, server_name: str, virtual_network_rule_name: str, - parameters: Union[_models.VirtualNetworkRule, IO], + parameters: Union[_models.VirtualNetworkRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualNetworkRule]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +275,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualNetworkRule]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -287,7 +285,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "VirtualNetworkRule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, @@ -296,39 +294,33 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return deserialized # type: ignore @overload def begin_create_or_update( @@ -355,14 +347,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.VirtualNetworkRule] @@ -375,7 +359,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, virtual_network_rule_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -390,18 +374,10 @@ def begin_create_or_update( :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str :param parameters: The requested virtual Network Rule Resource state. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.VirtualNetworkRule] @@ -414,7 +390,7 @@ def begin_create_or_update( resource_group_name: str, server_name: str, virtual_network_rule_name: str, - parameters: Union[_models.VirtualNetworkRule, IO], + parameters: Union[_models.VirtualNetworkRule, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.VirtualNetworkRule]: """Creates or updates an existing virtual network rule. @@ -427,19 +403,8 @@ def begin_create_or_update( :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str :param parameters: The requested virtual Network Rule Resource state. Is either a - VirtualNetworkRule type or a IO type. Required. - :type parameters: ~azure.mgmt.rdbms.postgresql.models.VirtualNetworkRule or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + VirtualNetworkRule type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql.models.VirtualNetworkRule or IO[bytes] :return: An instance of LROPoller that returns either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql.models.VirtualNetworkRule] @@ -467,12 +432,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualNetworkRule", pipeline_response) + deserialized = self._deserialize("VirtualNetworkRule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -482,22 +448,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.VirtualNetworkRule].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return LROPoller[_models.VirtualNetworkRule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, virtual_network_rule_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -509,38 +473,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -555,14 +522,6 @@ def begin_delete( :type server_name: str :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -576,7 +535,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, virtual_network_rule_name=virtual_network_rule_name, @@ -586,11 +545,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -599,17 +559,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_by_server( @@ -622,7 +578,6 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualNetworkRule or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql.models.VirtualNetworkRule] :raises ~azure.core.exceptions.HttpResponseError: @@ -633,7 +588,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01")) cls: ClsType[_models.VirtualNetworkRuleListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -644,24 +599,21 @@ def list_by_server( def prepare_request(next_link=None): if not next_link: - request = build_list_by_server_request( + _request = build_list_by_server_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_server.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("VirtualNetworkRuleListResult", pipeline_response) @@ -671,11 +623,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -686,7 +638,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_server.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules" - } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_postgre_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_postgre_sql_management_client.py index debb7af4e9447..7a12fd54da066 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_postgre_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_postgre_sql_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -245,7 +246,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "PostgreSQLManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_serialization.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_serialization.py index 2f781d740827a..8139854b97bb8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_serialization.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_serialization.py @@ -144,6 +144,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -1441,7 +1443,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_vendor.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_vendor.py index 1ebd4d09de5ca..19c350056f0c1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_vendor.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import PostgreSQLManagementClientConfiguration if TYPE_CHECKING: @@ -19,14 +17,6 @@ from ._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class PostgreSQLManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_postgre_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_postgre_sql_management_client.py index 42f9776ce54f7..091b0f06ceee0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_postgre_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_postgre_sql_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -250,7 +251,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "PostgreSQLManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_vendor.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_vendor.py index ac8903243dd4d..28f78b5e3b8d1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_vendor.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_vendor.py @@ -8,8 +8,6 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import PostgreSQLManagementClientConfiguration if TYPE_CHECKING: diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_administrators_operations.py index ad6759b2128a3..dddcc487e7e7d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_administrators_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._administrators_operations import ( build_create_request, build_delete_request, @@ -39,6 +40,10 @@ ) from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,8 +74,8 @@ async def _create_initial( object_id: str, parameters: Union[_models.ActiveDirectoryAdministratorAdd, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ActiveDirectoryAdministrator]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -83,7 +88,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ActiveDirectoryAdministrator]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -105,10 +110,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -116,21 +121,20 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -254,10 +258,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response) + deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -282,10 +287,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, object_id: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -297,7 +302,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -308,10 +313,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -319,6 +324,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -327,8 +336,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -356,7 +369,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, object_id=object_id, @@ -366,6 +379,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -406,7 +420,7 @@ async def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ActiveDirectoryAdministrator :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -429,7 +443,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -444,7 +457,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response) + deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -474,7 +487,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdministratorListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -493,7 +506,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -509,7 +521,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_backups_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_backups_operations.py index 7ffc76a12663d..7fc194d023eed 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_backups_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_backups_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,18 +20,20 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._backups_operations import build_get_request, build_list_by_server_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +74,7 @@ async def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerBackup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,7 +97,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +111,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerBackup", pipeline_response) + deserialized = self._deserialize("ServerBackup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -138,7 +140,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServerBackupListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +159,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -173,7 +174,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_operations.py index 1e57a18b45dba..f2f4164fff520 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._check_name_availability_operations import build_execute_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +108,7 @@ async def execute( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -137,7 +140,6 @@ async def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -152,7 +154,7 @@ async def execute( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_with_location_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_with_location_operations.py index 79d466a4f17b4..d91c4c8662fe6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_with_location_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_check_name_availability_with_location_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._check_name_availability_with_location_operations import build_execute_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -120,7 +123,7 @@ async def execute( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -153,7 +156,6 @@ async def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -168,7 +170,7 @@ async def execute( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_configurations_operations.py index decaf5963d87a..d0249ea5f9c08 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_configurations_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._configurations_operations import ( build_get_request, build_list_by_server_request, @@ -39,6 +40,10 @@ ) from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -166,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Configuration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -189,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -204,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -218,8 +220,8 @@ async def _update_initial( configuration_name: str, parameters: Union[_models.ConfigurationForUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -232,7 +234,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -254,10 +256,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -265,21 +267,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Configuration", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -399,10 +400,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -434,8 +436,8 @@ async def _put_initial( configuration_name: str, parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,7 +450,7 @@ async def _put_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -470,10 +472,10 @@ async def _put_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -481,21 +483,20 @@ async def _put_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Configuration", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -615,10 +616,11 @@ async def begin_put( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_databases_operations.py index 96ac0e8606247..6ba3d10b5d353 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_databases_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._databases_operations import ( build_create_request, build_delete_request, @@ -39,6 +40,10 @@ ) from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,8 +74,8 @@ async def _create_initial( database_name: str, parameters: Union[_models.Database, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Database]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -83,7 +88,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -105,10 +110,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -116,21 +121,20 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Database", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Database", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -249,10 +253,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -277,10 +282,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -292,7 +297,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -303,10 +308,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -314,6 +319,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -322,8 +331,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -351,7 +364,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -361,6 +374,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -401,7 +415,7 @@ async def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Database :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -424,7 +438,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -439,7 +452,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -468,7 +481,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -487,7 +500,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -503,7 +515,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_firewall_rules_operations.py index ba8c0903b5111..8413d6b5b8c3b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_firewall_rules_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._firewall_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -39,6 +40,10 @@ ) from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,8 +74,8 @@ async def _create_or_update_initial( firewall_rule_name: str, parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.FirewallRule]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -83,7 +88,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -105,10 +110,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -116,21 +121,20 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("FirewallRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallRule", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -249,10 +253,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -277,10 +282,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -292,7 +297,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -303,10 +308,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -314,6 +319,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -322,8 +331,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -351,7 +364,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -361,6 +374,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -401,7 +415,7 @@ async def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.FirewallRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -424,7 +438,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -439,7 +452,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -468,7 +481,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -487,7 +500,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -503,7 +515,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_flexible_server_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_flexible_server_operations.py index 6efa5dc377784..8bfc801576e2c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_flexible_server_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_flexible_server_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,25 +16,29 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._flexible_server_operations import ( build_start_ltr_backup_request, build_trigger_ltr_pre_backup_request, ) from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +142,7 @@ async def trigger_ltr_pre_backup( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.LtrPreBackupResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +176,6 @@ async def trigger_ltr_pre_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -189,7 +193,7 @@ async def trigger_ltr_pre_backup( response_headers = {} response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) - deserialized = self._deserialize("LtrPreBackupResponse", pipeline_response) + deserialized = self._deserialize("LtrPreBackupResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -202,8 +206,8 @@ async def _start_ltr_backup_initial( server_name: str, parameters: Union[_models.LtrBackupRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.LtrBackupResponse]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +220,7 @@ async def _start_ltr_backup_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.LtrBackupResponse]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -237,10 +241,10 @@ async def _start_ltr_backup_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -248,17 +252,18 @@ async def _start_ltr_backup_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} if response.status_code == 200: response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) - deserialized = self._deserialize("LtrBackupResponse", pipeline_response) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) @@ -267,6 +272,8 @@ async def _start_ltr_backup_initial( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -376,6 +383,7 @@ async def begin_start_ltr_backup( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -383,7 +391,7 @@ def get_long_running_output(pipeline_response): response = pipeline_response.http_response response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) - deserialized = self._deserialize("LtrBackupResponse", pipeline_response) + deserialized = self._deserialize("LtrBackupResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py index ad37233e789ee..da89b66664057 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,17 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._get_private_dns_zone_suffix_operations import build_execute_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +62,7 @@ async def execute(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -78,7 +81,6 @@ async def execute(self, **kwargs: Any) -> str: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -93,7 +95,7 @@ async def execute(self, **kwargs: Any) -> str: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_location_based_capabilities_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_location_based_capabilities_operations.py index 553686ede72c5..cd045153c6170 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_location_based_capabilities_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_location_based_capabilities_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._location_based_capabilities_operations import build_execute_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +74,7 @@ def execute(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.F api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CapabilitiesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +92,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +107,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_log_files_operations.py index 42b6840f15993..20884ad28d548 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_log_files_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._log_files_operations import build_list_by_server_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +78,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LogFileListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -110,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_ltr_backup_operations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_ltr_backup_operations_operations.py index 0a4cc7fc4a4f7..a09026a46b11a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_ltr_backup_operations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_ltr_backup_operations_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,18 +20,20 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._ltr_backup_operations_operations import build_get_request, build_list_by_server_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +74,7 @@ async def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.LtrServerBackupOperation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,7 +97,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +111,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LtrServerBackupOperation", pipeline_response) + deserialized = self._deserialize("LtrServerBackupOperation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -139,7 +141,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LtrServerBackupOperationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +160,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -174,7 +175,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_migrations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_migrations_operations.py index 4617d6da835a6..ede3f90b37912 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_migrations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_migrations_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._migrations_operations import ( build_create_request, build_delete_request, @@ -38,6 +37,10 @@ ) from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -153,7 +156,7 @@ async def create( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -188,7 +191,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -203,11 +205,7 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("MigrationResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("MigrationResource", pipeline_response) + deserialized = self._deserialize("MigrationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -237,7 +235,7 @@ async def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +258,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -275,7 +272,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrationResource", pipeline_response) + deserialized = self._deserialize("MigrationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -380,7 +377,7 @@ async def update( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,7 +412,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -430,7 +426,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrationResource", pipeline_response) + deserialized = self._deserialize("MigrationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +456,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -483,7 +479,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -533,7 +528,7 @@ def list_by_target_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MigrationResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -553,7 +548,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -569,7 +563,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_operations.py index 65c105277e64b..42293ef6cb890 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,17 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +62,7 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.OperationListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -78,7 +81,6 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -93,7 +95,7 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_postgre_sql_management_client_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_postgre_sql_management_client_operations.py index 079b53c200157..09ac90f9a0bd9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_postgre_sql_management_client_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_postgre_sql_management_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,22 +19,25 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._postgre_sql_management_client_operations import build_check_migration_name_availability_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PostgreSQLManagementClientOperationsMixin(PostgreSQLManagementClientMixinABC): # pylint: disable=name-too-long + @overload async def check_migration_name_availability( self, @@ -127,7 +131,7 @@ async def check_migration_name_availability( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationNameAvailabilityResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +165,6 @@ async def check_migration_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -176,7 +179,7 @@ async def check_migration_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrationNameAvailabilityResource", pipeline_response) + deserialized = self._deserialize("MigrationNameAvailabilityResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connection_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connection_operations.py index 28302af0b37cb..76ac36ca9c04d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connection_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connection_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,22 +16,26 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connection_operations import build_delete_request, build_update_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,8 +66,8 @@ async def _update_initial( private_endpoint_connection_name: str, parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> Optional[_models.PrivateEndpointConnection]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -75,7 +80,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -97,10 +102,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -108,21 +113,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -242,10 +246,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -267,10 +272,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -282,7 +287,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -293,10 +298,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -304,6 +309,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -312,8 +321,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -341,7 +354,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -351,6 +364,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connections_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connections_operations.py index 03cb307e9b389..af6f28355e536 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,18 +20,20 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import build_get_request, build_list_by_server_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +74,7 @@ async def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,7 +97,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +111,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -139,7 +141,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +160,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -174,7 +175,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_link_resources_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_link_resources_operations.py index bc339dcec7cbb..3309a41c42806 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_link_resources_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_link_resources_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,18 +20,20 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request, build_list_by_server_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +79,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +98,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +113,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -158,7 +159,7 @@ async def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -181,7 +182,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -196,7 +196,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_quota_usages_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_quota_usages_operations.py index 34dc315b76d46..7e1144cd623c5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_quota_usages_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_quota_usages_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._quota_usages_operations import build_list_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +73,7 @@ def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.Quot api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.QuotaUsagesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -88,7 +91,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -104,7 +106,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_replicas_operations.py index c4aaf33d525e4..92f6a29c1facb 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_replicas_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._replicas_operations import build_list_by_server_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +78,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -110,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_server_capabilities_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_server_capabilities_operations.py index 11c8924bfbe62..feb67bbab72e7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_server_capabilities_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_server_capabilities_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,17 +20,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_capabilities_operations import build_list_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +79,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CapabilitiesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +98,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +113,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_server_threat_protection_settings_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_server_threat_protection_settings_operations.py index 829a14dd53752..227698e7e8ec3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_server_threat_protection_settings_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_server_threat_protection_settings_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_threat_protection_settings_operations import ( build_create_or_update_request, build_get_request, @@ -38,6 +39,10 @@ ) from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServerThreatProtectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -171,7 +174,7 @@ async def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -194,7 +197,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +211,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) + deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -223,8 +225,8 @@ async def _create_or_update_initial( threat_protection_name: Union[str, _models.ThreatProtectionName], parameters: Union[_models.ServerThreatProtectionSettingsModel, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ServerThreatProtectionSettingsModel]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,7 +239,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ServerThreatProtectionSettingsModel]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -259,10 +261,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -270,21 +272,20 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -409,10 +410,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) + deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_servers_operations.py index d252b03e18c00..c2ae6ee5b4dac 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_servers_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._servers_operations import ( build_create_request, build_delete_request, @@ -44,6 +45,10 @@ ) from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,8 +74,8 @@ def __init__(self, *args, **kwargs) -> None: async def _create_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.Server, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -83,7 +88,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -104,10 +109,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -115,21 +120,20 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Server", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -234,10 +238,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -268,8 +273,8 @@ async def _update_initial( server_name: str, parameters: Union[_models.ServerForUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -282,7 +287,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -303,10 +308,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -314,18 +319,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -438,10 +445,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -466,10 +474,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -481,7 +487,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -491,10 +497,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -502,6 +508,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -510,8 +520,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -535,7 +549,7 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -544,6 +558,7 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -580,7 +595,7 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Server :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -602,7 +617,6 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -617,7 +631,7 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -642,7 +656,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -660,7 +674,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -676,7 +689,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -721,7 +733,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -738,7 +750,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -754,7 +765,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -784,14 +794,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _restart_initial( # pylint: disable=inconsistent-return-statements + async def _restart_initial( self, resource_group_name: str, server_name: str, parameters: Optional[Union[_models.RestartParameter, IO[bytes]]] = None, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -804,7 +814,7 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -828,10 +838,10 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -839,6 +849,10 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -847,8 +861,12 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_restart( @@ -937,7 +955,7 @@ async def begin_restart( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restart_initial( # type: ignore + raw_result = await self._restart_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -948,6 +966,7 @@ async def begin_restart( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -971,10 +990,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _start_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -986,7 +1003,7 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -996,10 +1013,10 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1007,6 +1024,10 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1015,8 +1036,12 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1040,7 +1065,7 @@ async def begin_start(self, resource_group_name: str, server_name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._start_initial( # type: ignore + raw_result = await self._start_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1049,6 +1074,7 @@ async def begin_start(self, resource_group_name: str, server_name: str, **kwargs params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1072,10 +1098,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _stop_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1087,7 +1111,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -1097,10 +1121,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1108,6 +1132,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1116,8 +1144,12 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1141,7 +1173,7 @@ async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._stop_initial( # type: ignore + raw_result = await self._stop_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1150,6 +1182,7 @@ async def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_endpoints_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_endpoints_operations.py index 2dcfd94cc9513..9123ff9714727 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_endpoints_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_endpoints_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._virtual_endpoints_operations import ( build_create_request, build_delete_request, @@ -40,6 +41,10 @@ ) from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,8 +75,8 @@ async def _create_initial( virtual_endpoint_name: str, parameters: Union[_models.VirtualEndpointResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualEndpointResource]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,7 +89,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualEndpointResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -106,10 +111,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -117,21 +122,20 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -253,10 +257,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -288,8 +293,8 @@ async def _update_initial( virtual_endpoint_name: str, parameters: Union[_models.VirtualEndpointResourceForPatch, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualEndpointResource]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -302,7 +307,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualEndpointResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -324,10 +329,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -335,18 +340,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -471,10 +478,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -499,10 +507,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,7 +522,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -525,10 +533,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -536,6 +544,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -544,8 +556,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -573,7 +589,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, virtual_endpoint_name=virtual_endpoint_name, @@ -583,6 +599,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -623,7 +640,7 @@ async def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -646,7 +663,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -661,7 +677,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -691,7 +707,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualEndpointsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -710,7 +726,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -726,7 +741,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_network_subnet_usage_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_network_subnet_usage_operations.py index 7b4eab1463d0b..ec983fbf39eb0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_network_subnet_usage_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_network_subnet_usage_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._virtual_network_subnet_usage_operations import build_execute_request from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +117,7 @@ async def execute( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualNetworkSubnetUsageResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +150,6 @@ async def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -162,7 +164,7 @@ async def execute( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworkSubnetUsageResult", pipeline_response) + deserialized = self._deserialize("VirtualNetworkSubnetUsageResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_administrators_operations.py index 6fc82595f3013..4dde8c6f61442 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_administrators_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -211,8 +217,8 @@ def _create_initial( object_id: str, parameters: Union[_models.ActiveDirectoryAdministratorAdd, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ActiveDirectoryAdministrator]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +231,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ActiveDirectoryAdministrator]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -247,10 +253,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -258,21 +264,20 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -396,10 +401,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response) + deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -423,10 +429,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, object_id: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -438,7 +444,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -449,10 +455,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -460,6 +466,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -468,8 +478,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -497,7 +511,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, object_id=object_id, @@ -507,6 +521,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -547,7 +562,7 @@ def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ActiveDirectoryAdministrator :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -570,7 +585,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -585,7 +599,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response) + deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -615,7 +629,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdministratorListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -634,7 +648,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -650,7 +663,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_backups_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_backups_operations.py index 0dcb36f1898ed..f013701ff0fed 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_backups_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_backups_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +145,7 @@ def get(self, resource_group_name: str, server_name: str, backup_name: str, **kw :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerBackup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +168,6 @@ def get(self, resource_group_name: str, server_name: str, backup_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -179,7 +182,7 @@ def get(self, resource_group_name: str, server_name: str, backup_name: str, **kw error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerBackup", pipeline_response) + deserialized = self._deserialize("ServerBackup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -208,7 +211,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServerBackupListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +230,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -243,7 +245,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_operations.py index 40df54f57bb1a..59b6c7693a8e5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -136,7 +140,7 @@ def execute( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +172,6 @@ def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +186,7 @@ def execute( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_with_location_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_with_location_operations.py index bd971a406b019..9942b13eba1ae 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_with_location_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_with_location_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -153,7 +157,7 @@ def execute( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.NameAvailability :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +190,6 @@ def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -201,7 +204,7 @@ def execute( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailability", pipeline_response) + deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_configurations_operations.py index 136a01f01f384..359e7a70084ec 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_configurations_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -235,7 +241,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +260,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -270,7 +275,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -317,7 +321,7 @@ def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Configuration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,7 +344,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -355,7 +358,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -369,8 +372,8 @@ def _update_initial( configuration_name: str, parameters: Union[_models.ConfigurationForUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,7 +386,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -405,10 +408,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -416,21 +419,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Configuration", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -550,10 +552,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -584,8 +587,8 @@ def _put_initial( configuration_name: str, parameters: Union[_models.Configuration, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Configuration]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -598,7 +601,7 @@ def _put_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Configuration]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -620,10 +623,10 @@ def _put_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -631,21 +634,20 @@ def _put_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Configuration", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Configuration", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -765,10 +767,11 @@ def begin_put( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response) + deserialized = self._deserialize("Configuration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_databases_operations.py index 15e0a4d1baf2b..190e8a6702684 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_databases_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -211,8 +217,8 @@ def _create_initial( database_name: str, parameters: Union[_models.Database, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Database]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +231,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -247,10 +253,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -258,21 +264,20 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Database", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Database", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -388,10 +393,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -415,10 +421,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +436,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -441,10 +447,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -452,6 +458,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -460,8 +470,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -489,7 +503,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, @@ -499,6 +513,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -537,7 +552,7 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Database :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -560,7 +575,6 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -575,7 +589,7 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Database", pipeline_response) + deserialized = self._deserialize("Database", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -602,7 +616,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -621,7 +635,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -637,7 +650,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_firewall_rules_operations.py index 5a7f3da515a17..1e69174c691e8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_firewall_rules_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -217,8 +223,8 @@ def _create_or_update_initial( firewall_rule_name: str, parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any - ) -> Optional[_models.FirewallRule]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +237,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FirewallRule]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -253,10 +259,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -264,21 +270,20 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("FirewallRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallRule", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -397,10 +402,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -424,10 +430,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +445,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -450,10 +456,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -461,6 +467,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -469,8 +479,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -498,7 +512,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, firewall_rule_name=firewall_rule_name, @@ -508,6 +522,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -548,7 +563,7 @@ def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.FirewallRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -571,7 +586,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -586,7 +600,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallRule", pipeline_response) + deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -615,7 +629,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -634,7 +648,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -650,7 +663,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_flexible_server_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_flexible_server_operations.py index cdfd04e6d8b73..57343c4a38fb2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_flexible_server_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_flexible_server_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +30,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -212,7 +218,7 @@ def trigger_ltr_pre_backup( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.LtrPreBackupResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -246,7 +252,6 @@ def trigger_ltr_pre_backup( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -264,7 +269,7 @@ def trigger_ltr_pre_backup( response_headers = {} response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) - deserialized = self._deserialize("LtrPreBackupResponse", pipeline_response) + deserialized = self._deserialize("LtrPreBackupResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -277,8 +282,8 @@ def _start_ltr_backup_initial( server_name: str, parameters: Union[_models.LtrBackupRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.LtrBackupResponse]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -291,7 +296,7 @@ def _start_ltr_backup_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.LtrBackupResponse]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -312,10 +317,10 @@ def _start_ltr_backup_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -323,17 +328,18 @@ def _start_ltr_backup_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} if response.status_code == 200: response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) - deserialized = self._deserialize("LtrBackupResponse", pipeline_response) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) @@ -342,6 +348,8 @@ def _start_ltr_backup_initial( "str", response.headers.get("Azure-AsyncOperation") ) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -451,6 +459,7 @@ def begin_start_ltr_backup( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): @@ -458,7 +467,7 @@ def get_long_running_output(pipeline_response): response = pipeline_response.http_response response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) - deserialized = self._deserialize("LtrBackupResponse", pipeline_response) + deserialized = self._deserialize("LtrBackupResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py index 68be29f9878a3..8fc3b7f28406d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +84,7 @@ def execute(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,7 +103,6 @@ def execute(self, **kwargs: Any) -> str: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -114,7 +117,7 @@ def execute(self, **kwargs: Any) -> str: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize("str", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_location_based_capabilities_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_location_based_capabilities_operations.py index 36ce6badddcb7..41d1f846733c2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_location_based_capabilities_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_location_based_capabilities_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -101,7 +105,7 @@ def execute(self, location_name: str, **kwargs: Any) -> Iterable["_models.Flexib api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CapabilitiesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -119,7 +123,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +138,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_log_files_operations.py index e0a2320da27ce..a0e520057f510 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_log_files_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -110,7 +114,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LogFileListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -129,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -145,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_ltr_backup_operations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_ltr_backup_operations_operations.py index 07121c0d4e330..4cdc6026cd7ee 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_ltr_backup_operations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_ltr_backup_operations_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -143,7 +147,7 @@ def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.LtrServerBackupOperation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +170,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -181,7 +184,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LtrServerBackupOperation", pipeline_response) + deserialized = self._deserialize("LtrServerBackupOperation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -211,7 +214,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LtrServerBackupOperationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -230,7 +233,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -246,7 +248,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_migrations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_migrations_operations.py index 51b5a8e801aec..35be382b295cc 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_migrations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_migrations_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -365,7 +369,7 @@ def create( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -400,7 +404,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -415,11 +418,7 @@ def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("MigrationResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("MigrationResource", pipeline_response) + deserialized = self._deserialize("MigrationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -449,7 +448,7 @@ def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +471,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +485,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrationResource", pipeline_response) + deserialized = self._deserialize("MigrationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -592,7 +590,7 @@ def update( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -627,7 +625,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -642,7 +639,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrationResource", pipeline_response) + deserialized = self._deserialize("MigrationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -672,7 +669,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -695,7 +692,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -745,7 +741,7 @@ def list_by_target_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MigrationResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -765,7 +761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -781,7 +776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_operations.py index 79dbc5dd446c2..f25c0d22b5424 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +84,7 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.OperationListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,7 +103,6 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -114,7 +117,7 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_postgre_sql_management_client_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_postgre_sql_management_client_operations.py index c08d47bb6a84f..31df596c4a5b2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_postgre_sql_management_client_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_postgre_sql_management_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -79,6 +83,7 @@ def build_check_migration_name_availability_request( # pylint: disable=name-too class PostgreSQLManagementClientOperationsMixin(PostgreSQLManagementClientMixinABC): # pylint: disable=name-too-long + @overload def check_migration_name_availability( self, @@ -172,7 +177,7 @@ def check_migration_name_availability( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationNameAvailabilityResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,7 +211,6 @@ def check_migration_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +225,7 @@ def check_migration_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrationNameAvailabilityResource", pipeline_response) + deserialized = self._deserialize("MigrationNameAvailabilityResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connection_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connection_operations.py index 8ae1174f231c0..fb003b8969f62 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connection_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connection_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,8 +30,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -156,8 +162,8 @@ def _update_initial( private_endpoint_connection_name: str, parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> Optional[_models.PrivateEndpointConnection]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -170,7 +176,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -192,10 +198,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -203,21 +209,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -337,10 +342,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -362,10 +368,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,7 +383,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -388,10 +394,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -399,6 +405,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -407,8 +417,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -436,7 +450,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -446,6 +460,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connections_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connections_operations.py index 3b981ec791209..4698729f4681b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connections_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -152,7 +156,7 @@ def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +179,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -190,7 +193,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -220,7 +223,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +242,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -255,7 +257,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_link_resources_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_link_resources_operations.py index b37e0bd263c9b..6f77d476e8fb3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_link_resources_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_link_resources_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -148,7 +152,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +171,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -183,7 +186,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -230,7 +232,7 @@ def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -253,7 +255,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -268,7 +269,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_quota_usages_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_quota_usages_operations.py index ada0950815cbd..b27ec5ed502ab 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_quota_usages_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_quota_usages_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -100,7 +104,7 @@ def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.QuotaUsag api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.QuotaUsagesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,7 +122,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -134,7 +137,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_replicas_operations.py index a6003e0e279f2..eb6641ce1e814 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_replicas_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -110,7 +114,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -129,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -145,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_capabilities_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_capabilities_operations.py index 3169d3253eb51..19f689a169dcc 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_capabilities_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_capabilities_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,19 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -111,7 +115,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CapabilitiesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +134,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -146,7 +149,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_threat_protection_settings_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_threat_protection_settings_operations.py index d396f2442c43b..7633638c1a223 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_threat_protection_settings_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_threat_protection_settings_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -199,7 +205,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServerThreatProtectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -218,7 +224,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -234,7 +239,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -286,7 +290,7 @@ def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -309,7 +313,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -324,7 +327,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) + deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -338,8 +341,8 @@ def _create_or_update_initial( threat_protection_name: Union[str, _models.ThreatProtectionName], parameters: Union[_models.ServerThreatProtectionSettingsModel, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ServerThreatProtectionSettingsModel]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +355,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ServerThreatProtectionSettingsModel]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -374,10 +377,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -385,21 +388,20 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -524,10 +526,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) + deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_servers_operations.py index 6e16acc7c18d3..48a01a886a65d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_servers_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -364,8 +370,8 @@ def __init__(self, *args, **kwargs): def _create_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.Server, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +384,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -399,10 +405,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -410,21 +416,20 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Server", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -526,10 +531,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -559,8 +565,8 @@ def _update_initial( server_name: str, parameters: Union[_models.ServerForUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Server]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -573,7 +579,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -594,10 +600,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -605,18 +611,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("Server", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -726,10 +734,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -753,10 +762,8 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -768,7 +775,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -778,10 +785,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -789,6 +796,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -797,8 +808,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -822,7 +837,7 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -831,6 +846,7 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -867,7 +883,7 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Server :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -889,7 +905,6 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -904,7 +919,7 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Server", pipeline_response) + deserialized = self._deserialize("Server", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -929,7 +944,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -947,7 +962,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -963,7 +977,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1008,7 +1021,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Server"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1025,7 +1038,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1041,7 +1053,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1071,14 +1082,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _restart_initial( # pylint: disable=inconsistent-return-statements + def _restart_initial( self, resource_group_name: str, server_name: str, parameters: Optional[Union[_models.RestartParameter, IO[bytes]]] = None, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1091,7 +1102,7 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1115,10 +1126,10 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1126,6 +1137,10 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1134,8 +1149,12 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_restart( @@ -1224,7 +1243,7 @@ def begin_restart( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restart_initial( # type: ignore + raw_result = self._restart_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -1235,6 +1254,7 @@ def begin_restart( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1258,10 +1278,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + def _start_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1273,7 +1291,7 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( resource_group_name=resource_group_name, @@ -1283,10 +1301,10 @@ def _start_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1294,6 +1312,10 @@ def _start_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1302,8 +1324,12 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1327,7 +1353,7 @@ def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._start_initial( # type: ignore + raw_result = self._start_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1336,6 +1362,7 @@ def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1359,10 +1386,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> None: - error_map = { + def _stop_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1374,7 +1399,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( resource_group_name=resource_group_name, @@ -1384,10 +1409,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1395,6 +1420,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1403,8 +1432,12 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1428,7 +1461,7 @@ def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._stop_initial( # type: ignore + raw_result = self._stop_initial( resource_group_name=resource_group_name, server_name=server_name, api_version=api_version, @@ -1437,6 +1470,7 @@ def begin_stop(self, resource_group_name: str, server_name: str, **kwargs: Any) params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_endpoints_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_endpoints_operations.py index bce3da1db64b7..e992f4f2e876f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_endpoints_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_endpoints_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -278,8 +284,8 @@ def _create_initial( virtual_endpoint_name: str, parameters: Union[_models.VirtualEndpointResource, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualEndpointResource]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -292,7 +298,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualEndpointResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -314,10 +320,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -325,21 +331,20 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -461,10 +466,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -495,8 +501,8 @@ def _update_initial( virtual_endpoint_name: str, parameters: Union[_models.VirtualEndpointResourceForPatch, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualEndpointResource]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -509,7 +515,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualEndpointResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -531,10 +537,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -542,18 +548,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -678,10 +686,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -705,10 +714,10 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -720,7 +729,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -731,10 +740,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -742,6 +751,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -750,8 +763,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -779,7 +796,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, server_name=server_name, virtual_endpoint_name=virtual_endpoint_name, @@ -789,6 +806,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -829,7 +847,7 @@ def get( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -852,7 +870,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -867,7 +884,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -897,7 +914,7 @@ def list_by_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualEndpointsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -916,7 +933,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -932,7 +948,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_network_subnet_usage_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_network_subnet_usage_operations.py index 13443513efdc1..e1ac132b66ef9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_network_subnet_usage_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_network_subnet_usage_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,16 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request +from .._vendor import PostgreSQLManagementClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -147,7 +151,7 @@ def execute( :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualNetworkSubnetUsageResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +184,6 @@ def execute( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -195,7 +198,7 @@ def execute( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworkSubnetUsageResult", pipeline_response) + deserialized = self._deserialize("VirtualNetworkSubnetUsageResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/advisors_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/advisors_get.py index bc2664c4fd0af..321216b619a5d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/advisors_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/advisors_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/advisors_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/advisors_list_by_server.py index 28d03363242f5..47379b32ddbf5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/advisors_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/advisors_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/check_name_availability.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/check_name_availability.py index bca505caf3a8b..e74e45a31424b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/check_name_availability.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/check_name_availability.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configuration_create_or_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configuration_create_or_update.py index 15584994c23ff..6bb8bf932d010 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configuration_create_or_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configuration_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configuration_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configuration_get.py index 35bbf575984c0..023e2fba51b9d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configuration_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configuration_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configuration_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configuration_list_by_server.py index 61af2fb1c60ac..0f556c52a291e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configuration_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configuration_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configurations_update_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configurations_update_by_server.py index 992b1ac901bda..fe1606135ebd1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configurations_update_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/configurations_update_by_server.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_create.py index ef79ce34869d0..b1830fc77946d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_delete.py index 1a62a3189ebe4..3269239458de9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_get.py index ee04ec9d8df4f..447cf9c6def2b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_list_by_server.py index 561f496f04c25..653f8d4c393f7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/database_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_create.py index fc168285ac68f..52d677f0a4938 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_delete.py index 80658c2c20eb5..bb5be94087290 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_get.py index afc0350f3920e..64599b41f91a6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_list_by_server.py index 045b022001bf7..765922c44e0ff 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/firewall_rule_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/log_file_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/log_file_list_by_server.py index f12d55799e8b4..323420ddfd681 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/log_file_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/log_file_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/operation_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/operation_list.py index 4b78b8f4283c9..64c5a5f6c741d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/operation_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/operation_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/performance_tiers_list_by_location.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/performance_tiers_list_by_location.py index 792f3feb44557..d944f47f3bed0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/performance_tiers_list_by_location.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/performance_tiers_list_by_location.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/performance_tiers_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/performance_tiers_list_by_server.py index 1f988b305742f..6fe8355e4267b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/performance_tiers_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/performance_tiers_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_delete.py index 149e802766c95..4366aea4c91d0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_get.py index 918de1989116c..8ea6ec000973b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_list.py index 3616ae60b58a0..2dfa5a1e1c09a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_update.py index 69d68bc8c841c..4dad9bad87287 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_update_tags.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_update_tags.py index fd68503ebec9c..8cef206754b92 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_update_tags.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_endpoint_connection_update_tags.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_link_resources_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_link_resources_get.py index 4a6e319dd53cb..75f2d3336248b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_link_resources_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_link_resources_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_link_resources_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_link_resources_list.py index f299aa9675938..1c331d87df533 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_link_resources_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/private_link_resources_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/query_performance_insight_reset_data.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/query_performance_insight_reset_data.py index 0ffd930d81af4..4956e393b860f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/query_performance_insight_reset_data.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/query_performance_insight_reset_data.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/query_texts_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/query_texts_get.py index a4c776c5efb83..c8f5692088c51 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/query_texts_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/query_texts_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/query_texts_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/query_texts_list_by_server.py index e111d0fb1ff92..d80d0e30d47b9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/query_texts_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/query_texts_list_by_server.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_action_session_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_action_session_create.py index e9a1f1fe97cf8..3616e7a94d990 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_action_session_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_action_session_create.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_action_session_operation_status.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_action_session_operation_status.py index 3ee431612e550..dd2a530b26ce0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_action_session_operation_status.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_action_session_operation_status.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_action_session_result.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_action_session_result.py index a267f74b2536b..1c37706d43305 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_action_session_result.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_action_session_result.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_actions_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_actions_get.py index 16426e0973160..929106fe6fb9d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_actions_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_actions_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_actions_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_actions_list_by_server.py index a4b7865b8f753..214765c378e63 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_actions_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recommended_actions_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recoverable_servers_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recoverable_servers_get.py index 60c3f3451a868..ce86ee15217df 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recoverable_servers_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/recoverable_servers_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/replicas_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/replicas_list_by_server.py index 3716473dff277..2f75133d1364d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/replicas_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/replicas_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create.py index b3659924b3362..ec63105f2cc63 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create_geo_restore_mode.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create_geo_restore_mode.py index 098f3b9822b63..0c500a2fc23d9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create_geo_restore_mode.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create_geo_restore_mode.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create_point_in_time_restore.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create_point_in_time_restore.py index 20110c39b2903..7e3948f496338 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create_point_in_time_restore.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create_point_in_time_restore.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create_replica_mode.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create_replica_mode.py index 4e6b8cd3f8c9e..a9f6d4cdb6207 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create_replica_mode.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_create_replica_mode.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_delete.py index 07db421fc0247..d12be8ee670a7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_get.py index d9008ad33e849..15e4e04b98c15 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_list.py index ea327bf12b91d..c4966dbd90bde 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_list_by_resource_group.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_list_by_resource_group.py index cfbefa4e105bf..52be5814141cb 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_list_by_resource_group.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_restart.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_restart.py index 7145e0aac59e3..5d4b1c311f7d0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_restart.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_restart.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_create_max.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_create_max.py index 98ca015f8cabc..f8b2edcd9dea1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_create_max.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_create_max.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_create_min.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_create_min.py index 32eea076865f2..ca745045007a7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_create_min.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_create_min.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_get.py index e83d6b4af944c..b59da0c33ebbe 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_get.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_list_by_server.py index 43f30c87baa93..9aac6e440ce65 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_security_alerts_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_start.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_start.py index 3c71a4a0d4c71..e9466f8aa99f7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_start.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_start.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_stop.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_stop.py index 2d208e4bde7f4..fefdc0f07b7b3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_stop.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_stop.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_update.py index 0a703192d5b37..01e632301a447 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/server_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/top_query_statistics_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/top_query_statistics_get.py index 34ebd974ca272..62d14e43ce7f7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/top_query_statistics_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/top_query_statistics_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/top_query_statistics_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/top_query_statistics_list_by_server.py index a5a203d5aec19..7dc3e57b1ecd1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/top_query_statistics_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/top_query_statistics_list_by_server.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_create_or_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_create_or_update.py index e20d74f08f5af..8c3527137c297 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_create_or_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_delete.py index 851577ad6eb0d..7e097890ce26b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_get.py index a91161c1d870a..fe2550efc4ec1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_list.py index 7a0002139950e..75084bbb78f5d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/virtual_network_rules_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/wait_statistics_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/wait_statistics_get.py index c81430bf40128..e3390019575c8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/wait_statistics_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/wait_statistics_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/wait_statistics_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/wait_statistics_list_by_server.py index 5714bb4ae3aeb..04e02198b6164 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/wait_statistics_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mariadb/wait_statistics_list_by_server.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.mariadb import MariaDBManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrator_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrator_create.py index b2d0714f79c6f..7a22a515a77db 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrator_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrator_create.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2023-06-01-preview/examples/AzureADAdministratorCreate.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/stable/2023-12-30/examples/AzureADAdministratorCreate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrator_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrator_delete.py index 1ec1580846c1b..d9b2093afbb9a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrator_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrator_delete.py @@ -42,6 +42,6 @@ def main(): ).result() -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2023-06-01-preview/examples/AzureADAdministratorDelete.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/stable/2023-12-30/examples/AzureADAdministratorDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrator_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrator_get.py index 228a34a509c4d..fef06c40ece81 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrator_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrator_get.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2023-06-01-preview/examples/AzureADAdministratorGet.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/stable/2023-12-30/examples/AzureADAdministratorGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrators_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrators_list_by_server.py index dd4ae2587f6fe..27b71b80e02ff 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrators_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/azure_ad_administrators_list_by_server.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2023-06-01-preview/examples/AzureADAdministratorsListByServer.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/stable/2023-12-30/examples/AzureADAdministratorsListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backup_and_export.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backup_and_export.py index 7105a51abf6f4..b91016e169e0d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backup_and_export.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backup_and_export.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-10-01-preview/examples/BackupAndExport.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/stable/2023-12-30/examples/BackupAndExport.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backup_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backup_get.py index ddf07c25f7fab..06b4134aa1815 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backup_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backup_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-10-01-preview/examples/BackupGet.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/stable/2023-12-30/examples/BackupGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backup_put.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backup_put.py index e2f288404909b..2ec38638534ef 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backup_put.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backup_put.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-10-01-preview/examples/BackupPut.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/stable/2023-12-30/examples/BackupPut.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backups_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backups_list_by_server.py index ecf475a565124..1e603dac91262 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backups_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/backups_list_by_server.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-10-01-preview/examples/BackupsListByServer.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/stable/2023-12-30/examples/BackupsListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/capabilities_by_location_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/capabilities_by_location_list.py index a13e5bac6589d..9ac85c8accedd 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/capabilities_by_location_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/capabilities_by_location_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-12-01-preview/examples/CapabilitiesByLocationList.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/stable/2023-12-30/examples/CapabilitiesByLocationList.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/capability_set_by_location.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/capability_set_by_location.py index 4fbf7bf14734b..cb310377a1988 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/capability_set_by_location.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/capability_set_by_location.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-12-01-preview/examples/CapabilitySetByLocation.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/stable/2023-12-30/examples/CapabilitySetByLocation.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/capability_set_list_by_location.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/capability_set_list_by_location.py index f99fe90ff4419..b2bf766b57010 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/capability_set_list_by_location.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/capability_set_list_by_location.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-12-01-preview/examples/CapabilitySetListByLocation.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/stable/2023-12-30/examples/CapabilitySetListByLocation.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/check_name_availability.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/check_name_availability.py index 4554a2e18dddd..656309cb24aa6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/check_name_availability.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/check_name_availability.py @@ -11,7 +11,6 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.rdbms.mysql_flexibleservers import MySQLManagementClient - """ # PREREQUISITES pip install azure-identity @@ -24,21 +23,19 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ - - def main(): client = MySQLManagementClient( credential=DefaultAzureCredential(), subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.check_name_availability.execute( - location_name="SouthEastAsia", - name_availability_request={"name": "name1", "type": "Microsoft.DBforMySQL/flexibleServers"}, + response = client.check_name_availability_without_location.execute( + name_availability_request={'name': 'name1', 'type': 'Microsoft.DBforMySQL/flexibleServers'}, ) print(response) - -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-12-01-preview/examples/CheckNameAvailability.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/stable/2023-12-30/examples/CheckNameAvailability.json if __name__ == "__main__": main() +__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/check_virtual_network_subnet_usage.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/check_virtual_network_subnet_usage.py index 0147d30ec246c..c9ba9b98ffd33 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/check_virtual_network_subnet_usage.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/check_virtual_network_subnet_usage.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-12-01-preview/examples/CheckVirtualNetworkSubnetUsage.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/stable/2023-12-30/examples/CheckVirtualNetworkSubnetUsage.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configuration_create_or_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configuration_create_or_update.py index 6457ec08ce1cc..28d7ef09d0c7f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configuration_create_or_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configuration_create_or_update.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationCreateOrUpdate.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/stable/2023-12-30/examples/ConfigurationCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configuration_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configuration_get.py index bf33afd28a2f1..6057b07ebd7ff 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configuration_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configuration_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationGet.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/stable/2023-12-30/examples/ConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configuration_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configuration_update.py index bec39d08ccbb6..e215a0e1046b7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configuration_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configuration_update.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationUpdate.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/stable/2023-12-30/examples/ConfigurationUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configurations_batch_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configurations_batch_update.py index f3d3784eadc20..1d3a646ebb81f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configurations_batch_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configurations_batch_update.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationsBatchUpdate.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/stable/2023-12-30/examples/ConfigurationsBatchUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configurations_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configurations_list_by_server.py index 93e38f34a281b..734d744b8fc3c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configurations_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/configurations_list_by_server.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationsListByServer.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/stable/2023-12-30/examples/ConfigurationsListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/database_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/database_create.py index 6fd9642f454cc..2521fd0c78cd8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/database_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/database_create.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2023-06-01-preview/examples/DatabaseCreate.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/stable/2023-12-30/examples/DatabaseCreate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/database_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/database_delete.py index 9dbba4f0160f1..82d7ee90a0026 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/database_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/database_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2023-06-01-preview/examples/DatabaseDelete.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/stable/2023-12-30/examples/DatabaseDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/database_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/database_get.py index 4d8ce55112a7d..57384e6955c35 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/database_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/database_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2023-06-01-preview/examples/DatabaseGet.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/stable/2023-12-30/examples/DatabaseGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/databases_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/databases_list_by_server.py index 3c697a5e4506b..aaa0413fe3fce 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/databases_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/databases_list_by_server.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2023-06-01-preview/examples/DatabasesListByServer.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/stable/2023-12-30/examples/DatabasesListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rule_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rule_create.py index e7147b4b5a04e..33ec67b3cfa08 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rule_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rule_create.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2023-06-01-preview/examples/FirewallRuleCreate.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/stable/2023-12-30/examples/FirewallRuleCreate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rule_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rule_delete.py index 1846a3f884828..ba0a57809487f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rule_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rule_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2023-06-01-preview/examples/FirewallRuleDelete.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/stable/2023-12-30/examples/FirewallRuleDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rule_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rule_get.py index 3b1ec5635974f..d26eddf6cbd88 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rule_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rule_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2023-06-01-preview/examples/FirewallRuleGet.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/stable/2023-12-30/examples/FirewallRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rules_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rules_list_by_server.py index 1979e942a5a37..5a8738d5598ed 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rules_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/firewall_rules_list_by_server.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2023-06-01-preview/examples/FirewallRulesListByServer.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/stable/2023-12-30/examples/FirewallRulesListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/get_private_dns_zone_suffix.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/get_private_dns_zone_suffix.py index 8a03edd4839ce..b0b4e1ee18f56 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/get_private_dns_zone_suffix.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/get_private_dns_zone_suffix.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-12-01-preview/examples/GetPrivateDnsZoneSuffix.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/stable/2023-12-30/examples/GetPrivateDnsZoneSuffix.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/log_files_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/log_files_list_by_server.py index 18ad4120bb3ec..7ee4510158ef8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/log_files_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/log_files_list_by_server.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/LogFiles/preview/2023-06-01-preview/examples/LogFilesListByServer.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/LogFiles/stable/2023-12-30/examples/LogFilesListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/long_running_backup.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/long_running_backup.py index 1ef8cf5ff6f7e..68115fd65031f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/long_running_backup.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/long_running_backup.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-10-01-preview/examples/LongRunningBackup.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/stable/2023-12-30/examples/LongRunningBackup.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/long_running_backup_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/long_running_backup_get.py index 9a760654c2c0b..565b836fee136 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/long_running_backup_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/long_running_backup_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-10-01-preview/examples/LongRunningBackupGet.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/stable/2023-12-30/examples/LongRunningBackupGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/long_running_backups_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/long_running_backups_list_by_server.py index 8318fbe276cd6..d96b4df26f743 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/long_running_backups_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/long_running_backups_list_by_server.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-10-01-preview/examples/LongRunningBackupsListByServer.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/stable/2023-12-30/examples/LongRunningBackupsListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/maintenance_read.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/maintenance_read.py index 15b0260a01682..67856508ef8c2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/maintenance_read.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/maintenance_read.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Maintenance/preview/2023-10-01-preview/examples/MaintenanceRead.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Maintenance/stable/2023-12-30/examples/MaintenanceRead.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/maintenance_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/maintenance_update.py index 557ce5a19e482..e54eb6494e4fc 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/maintenance_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/maintenance_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Maintenance/preview/2023-10-01-preview/examples/MaintenanceUpdate.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Maintenance/stable/2023-12-30/examples/MaintenanceUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/maintenances_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/maintenances_list_by_server.py index d26d30389200c..be26aa507de13 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/maintenances_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/maintenances_list_by_server.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Maintenance/preview/2023-10-01-preview/examples/MaintenancesListByServer.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Maintenance/stable/2023-12-30/examples/MaintenancesListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operation_progress_get_backup_and_export.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operation_progress_get_backup_and_export.py index 506e3921e0396..4a5865c3c114c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operation_progress_get_backup_and_export.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operation_progress_get_backup_and_export.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-12-01-preview/examples/OperationProgress_Get_BackupAndExport.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/stable/2023-12-30/examples/OperationProgress_Get_BackupAndExport.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operation_progress_get_import_from_storage.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operation_progress_get_import_from_storage.py index 1e5b59d54efe4..ea6a8a4cfc41c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operation_progress_get_import_from_storage.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operation_progress_get_import_from_storage.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-12-01-preview/examples/OperationProgress_Get_ImportFromStorage.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/stable/2023-12-30/examples/OperationProgress_Get_ImportFromStorage.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operation_results_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operation_results_get.py index ea0ab8ea4935b..f7be9e23a3a2b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operation_results_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operation_results_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-12-01-preview/examples/OperationResults_Get.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/stable/2023-12-30/examples/OperationResults_Get.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operations_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operations_list.py index 6eb36e73579f3..db286de8d5b5d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operations_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-12-01-preview/examples/OperationsList.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/stable/2023-12-30/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/validate_backup.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/validate_backup.py index a3a74a5398b8a..c0df615f73358 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/validate_backup.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/mysql_flexibleservers/validate_backup.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-10-01-preview/examples/ValidateBackup.json +# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/stable/2023-12-30/examples/ValidateBackup.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/check_name_availability.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/check_name_availability.py index 8f32b45b460b5..33e589e2769cf 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/check_name_availability.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/check_name_availability.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configuration_create_or_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configuration_create_or_update.py index fd2ce019539a6..42c6d683c0fef 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configuration_create_or_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configuration_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configuration_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configuration_get.py index ddb14847d356c..acf894bf2a7bc 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configuration_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configuration_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configuration_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configuration_list_by_server.py index 0283111611598..509b890f7e774 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configuration_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configuration_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configurations_update_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configurations_update_by_server.py index 58f287bd84e80..c9f846cf1b40e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configurations_update_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/configurations_update_by_server.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_create.py index 1f5d784b48be6..27a75d5d35ae0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_delete.py index 6f9de2a96bf8d..2415f2d98f33b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_get.py index 775fa88a19fe6..c8fcefa914857 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_list_by_server.py index 21f4a85eee2ac..7b99251c80846 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/database_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_create.py index 911ce624f71a6..52311f2a93ef9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_delete.py index 24b942933c9e5..5224c70ad3fee 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_get.py index df9427dcbdc9d..185b582bd7b88 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_list_by_server.py index 01100b39fa8d8..b3b49133485b5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/firewall_rule_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/log_file_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/log_file_list_by_server.py index cb2e6df96c132..eb968269447fd 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/log_file_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/log_file_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/operation_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/operation_list.py index a63db4015e614..8ac659f13d695 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/operation_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/operation_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/performance_tiers_list_by_location.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/performance_tiers_list_by_location.py index 5e196195c8e8a..1475b0031453a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/performance_tiers_list_by_location.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/performance_tiers_list_by_location.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/performance_tiers_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/performance_tiers_list_by_server.py index 6c917954a46c9..8d5d368e17387 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/performance_tiers_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/performance_tiers_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_delete.py index 450c6a14faef4..7c048c421fe2b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_get.py index dba520b3243ba..c53f912c6e2d0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_list.py index c3b8cb3705eb6..4afe193e5abc9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_update.py index f9d243b0c7769..906341aec6225 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_update_tags.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_update_tags.py index 2c3722eb0eca7..80585c22b56a3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_update_tags.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_endpoint_connection_update_tags.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_link_resources_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_link_resources_get.py index 9b767f382f7be..dac3e293d0396 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_link_resources_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_link_resources_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_link_resources_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_link_resources_list.py index e6e581977f025..7c47433fefe2b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_link_resources_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/private_link_resources_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/recoverable_servers_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/recoverable_servers_get.py index 1624f2b221128..d2220b457b1be 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/recoverable_servers_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/recoverable_servers_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/replicas_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/replicas_list_by_server.py index 29be441acbc75..4228f27bfe667 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/replicas_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/replicas_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_create_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_create_update.py index 6cf25309f417f..f01513eb7f68e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_create_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_create_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_delete.py index c32bd663c89b4..88bd2e71413fd 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_get.py index c92c6ad21e4bd..b81f22f3269d1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_list.py index 4e7d1e097378d..47304c7c6ac6b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_admin_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create.py index 53ec949ccee0e..2e7b9a35977ff 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create_geo_restore_mode.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create_geo_restore_mode.py index b6b4d5b0c7cce..2ab2a915e767e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create_geo_restore_mode.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create_geo_restore_mode.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create_point_in_time_restore.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create_point_in_time_restore.py index 3f43ff0d93abb..2cd19679fb298 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create_point_in_time_restore.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create_point_in_time_restore.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create_replica_mode.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create_replica_mode.py index 5144cb46ad9ab..5230c956e16ed 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create_replica_mode.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_create_replica_mode.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_delete.py index e8972948a1c5c..255393f2848cd 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_get.py index a4c759ebc0b04..587f218e8799d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_create_or_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_create_or_update.py index 0e56e3c3e3965..a7d2b372e0b43 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_create_or_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_delete.py index c3d0863246e1b..a6139c8e81f52 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_get.py index a0558b23d51ee..86c9ee65a0d84 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_list.py index 3a5e5352cfa28..962ef1b29f91d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_key_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_list.py index b6c27ca668945..9bfbfab34ad40 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_list_by_resource_group.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_list_by_resource_group.py index 05e9ef168ea6a..0d41a87b09341 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_list_by_resource_group.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_restart.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_restart.py index 16a4dc2197802..43fe31d2def8f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_restart.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_restart.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_create_max.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_create_max.py index 790172f5bf0d7..ffbe1f1deca7f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_create_max.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_create_max.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_create_min.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_create_min.py index 24624107b0022..769c34186a93b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_create_min.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_create_min.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_get.py index a5b3d3825e361..c0e7cebf82dab 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_get.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_list_by_server.py index 03884e876388f..d85db20dc306d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_security_alerts_list_by_server.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_update.py index b8fa60d42ff94..8e070d869052b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/server_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_create_or_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_create_or_update.py index 63da621dc30b1..681129343cbd5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_create_or_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_delete.py index dcf4b95ad134b..62e6d782a1fa5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_get.py index 777a65dbf4dc8..4fe726e7a99ec 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_list.py index 8f3564dcc0048..8ed236938a455 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql/virtual_network_rules_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient """ diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_update.py index 0a4570dbc5072..9c75e126ee1fa 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_update.py @@ -32,7 +32,7 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.configurations.begin_update( + response = client.configurations.begin_put( resource_group_name="testrg", server_name="testserver", configuration_name="event_scheduler", @@ -44,3 +44,4 @@ def main(): # x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-12-01-preview/examples/ConfigurationUpdate.json if __name__ == "__main__": main() +() diff --git a/sdk/rdbms/azure-mgmt-rdbms/pyproject.toml b/sdk/rdbms/azure-mgmt-rdbms/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/rdbms/azure-mgmt-rdbms/setup.py b/sdk/rdbms/azure-mgmt-rdbms/setup.py index cfa61df6bdaa8..26b793d7384dd 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/setup.py +++ b/sdk/rdbms/azure-mgmt-rdbms/setup.py @@ -75,6 +75,7 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", "azure-mgmt-core>=1.3.2", ], diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/pyproject.toml b/sdk/recoveryservices/azure-mgmt-recoveryservices/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/pyproject.toml b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/pyproject.toml b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/pyproject.toml b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/recoveryservicesdatareplication/azure-mgmt-recoveryservicesdatareplication/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/redhatopenshift/azure-mgmt-redhatopenshift/pyproject.toml b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/redhatopenshift/azure-mgmt-redhatopenshift/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/redis/azure-mgmt-redis/pyproject.toml b/sdk/redis/azure-mgmt-redis/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/redis/azure-mgmt-redis/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/pyproject.toml b/sdk/redisenterprise/azure-mgmt-redisenterprise/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/regionmove/azure-mgmt-regionmove/pyproject.toml b/sdk/regionmove/azure-mgmt-regionmove/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/regionmove/azure-mgmt-regionmove/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/relay/azure-mgmt-relay/pyproject.toml b/sdk/relay/azure-mgmt-relay/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/relay/azure-mgmt-relay/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/pyproject.toml b/sdk/remoterendering/azure-mixedreality-remoterendering/pyproject.toml index 7e21996d43175..ae6b3321db78e 100644 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/pyproject.toml +++ b/sdk/remoterendering/azure-mixedreality-remoterendering/pyproject.toml @@ -1,4 +1,3 @@ [tool.azure-sdk-build] pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/reservations/azure-mgmt-reservations/pyproject.toml b/sdk/reservations/azure-mgmt-reservations/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/reservations/azure-mgmt-reservations/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/resourceconnector/azure-mgmt-resourceconnector/pyproject.toml b/sdk/resourceconnector/azure-mgmt-resourceconnector/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/resourceconnector/azure-mgmt-resourceconnector/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/pyproject.toml b/sdk/resourcehealth/azure-mgmt-resourcehealth/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/resourcemover/azure-mgmt-resourcemover/pyproject.toml b/sdk/resourcemover/azure-mgmt-resourcemover/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/resourcemover/azure-mgmt-resourcemover/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/resources/azure-mgmt-msi/pyproject.toml b/sdk/resources/azure-mgmt-msi/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/resources/azure-mgmt-resource/pyproject.toml b/sdk/resources/azure-mgmt-resource/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/resources/azure-mgmt-resourcegraph/pyproject.toml b/sdk/resources/azure-mgmt-resourcegraph/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/resources/azure-mgmt-resourcegraph/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/scheduler/azure-mgmt-scheduler/pyproject.toml b/sdk/scheduler/azure-mgmt-scheduler/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/scheduler/azure-mgmt-scheduler/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_patch.py b/sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_patch.py index 0a202598bc617..00b7ce26f39df 100644 --- a/sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_patch.py +++ b/sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_patch.py @@ -390,7 +390,7 @@ def __init__(self, **kwargs: Any) -> None: self.name: str = kwargs.pop("name") self.version: int = kwargs.pop("version") - def __repr__(self): + def __repr__(self) -> str: return ( f"SchemaProperties(id={self.id}, format={self.format}, " f"group_name={self.group_name}, name={self.name}, version={self.version})"[:1024] @@ -411,7 +411,7 @@ def __init__(self, **kwargs: Any) -> None: self.definition: str = kwargs.pop("definition") self.properties: SchemaProperties = kwargs.pop("properties") - def __repr__(self): + def __repr__(self) -> str: return f"Schema(definition={self.definition}, properties={self.properties})"[:1024] diff --git a/sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/aio/_patch.py b/sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/aio/_patch.py index a8d2708650069..025f7083ecda8 100644 --- a/sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/aio/_patch.py +++ b/sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/aio/_patch.py @@ -18,6 +18,7 @@ Dict, ) from functools import partial +from typing_extensions import Self from azure.core.tracing.decorator_async import distributed_trace_async @@ -42,7 +43,7 @@ ###### Wrapper Class ###### -class SchemaRegistryClient(object): +class SchemaRegistryClient: """ SchemaRegistryClient is a client for registering and retrieving schemas from the Azure Schema Registry service. @@ -78,11 +79,11 @@ def __init__( **kwargs, ) - async def __aenter__(self): + async def __aenter__(self) -> Self: await self._generated_client.__aenter__() return self - async def __aexit__(self, *args): + async def __aexit__(self, *args: Any) -> None: await self._generated_client.__aexit__(*args) async def close(self) -> None: diff --git a/sdk/schemaregistry/azure-schemaregistry/pyproject.toml b/sdk/schemaregistry/azure-schemaregistry/pyproject.toml index 62cf8270a79d7..49f351cfcef95 100644 --- a/sdk/schemaregistry/azure-schemaregistry/pyproject.toml +++ b/sdk/schemaregistry/azure-schemaregistry/pyproject.toml @@ -2,4 +2,3 @@ mypy = true pyright = false type_check_samples = true -verifytypes = false diff --git a/sdk/schemaregistry/azure-schemaregistry/setup.py b/sdk/schemaregistry/azure-schemaregistry/setup.py index dfe6ff19c4f3c..8a14178d04688 100644 --- a/sdk/schemaregistry/azure-schemaregistry/setup.py +++ b/sdk/schemaregistry/azure-schemaregistry/setup.py @@ -70,6 +70,7 @@ install_requires=[ "azure-core<2.0.0,>=1.28.0", "isodate>=0.6.0", + "typing-extensions>=4.6.0" ], extras_require={ "jsonencoder": [ diff --git a/sdk/scvmm/azure-mgmt-scvmm/pyproject.toml b/sdk/scvmm/azure-mgmt-scvmm/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/search/azure-mgmt-search/pyproject.toml b/sdk/search/azure-mgmt-search/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/search/azure-mgmt-search/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_models_py3.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_models_py3.py index aaf2749d7f89d..fecef94867cd2 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_models_py3.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_models_py3.py @@ -4432,7 +4432,7 @@ def __init__( allow_skillset_to_read_file_data: bool = False, pdf_text_rotation_algorithm: Union[str, "_models.BlobIndexerPDFTextRotationAlgorithm"] = "none", execution_environment: Union[str, "_models.IndexerExecutionEnvironment"] = "standard", - query_timeout: str = "00:05:00", + query_timeout: Optional[str] = "00:05:00", **kwargs: Any ) -> None: """ diff --git a/sdk/search/azure-search-documents/samples/sample_indexer_datasource_skillset.py b/sdk/search/azure-search-documents/samples/sample_indexer_datasource_skillset.py index 43a5c90198042..0c566f0aeaf1a 100644 --- a/sdk/search/azure-search-documents/samples/sample_indexer_datasource_skillset.py +++ b/sdk/search/azure-search-documents/samples/sample_indexer_datasource_skillset.py @@ -116,7 +116,7 @@ def sample_indexer_workflow(): print("Index is created") # we pass the data source, skillsets and targeted index to build an indexer - configuration = IndexingParametersConfiguration(parsing_mode="jsonArray") + configuration = IndexingParametersConfiguration(parsing_mode="jsonArray", query_timeout=None) parameters = IndexingParameters(configuration=configuration) indexer = SearchIndexer( name="hotel-data-indexer", diff --git a/sdk/security/azure-mgmt-security/pyproject.toml b/sdk/security/azure-mgmt-security/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/security/azure-mgmt-security/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/securitydevops/azure-mgmt-securitydevops/pyproject.toml b/sdk/securitydevops/azure-mgmt-securitydevops/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/securitydevops/azure-mgmt-securitydevops/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/pyproject.toml b/sdk/securityinsight/azure-mgmt-securityinsight/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/selfhelp/azure-mgmt-selfhelp/pyproject.toml b/sdk/selfhelp/azure-mgmt-selfhelp/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/selfhelp/azure-mgmt-selfhelp/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/serialconsole/azure-mgmt-serialconsole/pyproject.toml b/sdk/serialconsole/azure-mgmt-serialconsole/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/serialconsole/azure-mgmt-serialconsole/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/servermanager/azure-mgmt-servermanager/pyproject.toml b/sdk/servermanager/azure-mgmt-servermanager/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/servermanager/azure-mgmt-servermanager/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/servicebus/azure-mgmt-servicebus/pyproject.toml b/sdk/servicebus/azure-mgmt-servicebus/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/_message_backcompat.py b/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/_message_backcompat.py index 85a99d932bfbb..0220b554aa21d 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/_message_backcompat.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/_message_backcompat.py @@ -31,6 +31,7 @@ class Settler(Protocol): def settle_messages( self, delivery_id: Optional[int], + delivery_tag: Optional[bytes], outcome: str, *, error: Optional[AMQPError] = None, @@ -85,7 +86,7 @@ def __init__( self._settler: Optional["Settler"] = kwargs.pop("settler", None) self._encoding = kwargs.get("encoding") self.delivery_no: Optional[int] = kwargs.get("delivery_no") - self.delivery_tag: Optional[str] = kwargs.get("delivery_tag") or None + self.delivery_tag: Optional[bytes] = kwargs.get("delivery_tag") or None self.on_send_complete: Optional[Callable] = None self.properties: Optional[LegacyMessageProperties] = ( LegacyMessageProperties(self._message.properties) @@ -159,7 +160,7 @@ def get_message(self) -> "Message": def accept(self) -> bool: if self._can_settle_message() and self._settler: - self._settler.settle_messages(self.delivery_no, "accepted") + self._settler.settle_messages(self.delivery_no, self.delivery_tag, "accepted") self.state = MessageState.ReceivedSettled return True return False @@ -173,6 +174,7 @@ def reject( if self._can_settle_message() and self._settler: self._settler.settle_messages( self.delivery_no, + self.delivery_tag, "rejected", error=AMQPError( condition=condition, description=description, info=info @@ -184,7 +186,7 @@ def reject( def release(self) -> bool: if self._can_settle_message() and self._settler: - self._settler.settle_messages(self.delivery_no, "released") + self._settler.settle_messages(self.delivery_no, self.delivery_tag, "released") self.state = MessageState.ReceivedSettled return True return False @@ -198,6 +200,7 @@ def modify( if self._can_settle_message() and self._settler: self._settler.settle_messages( self.delivery_no, + self.delivery_tag, "modified", delivery_failed=failed, undeliverable_here=deliverable, diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_client_async.py b/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_client_async.py index d48dde9bc63ae..b9a19281c372b 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_client_async.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_client_async.py @@ -388,7 +388,7 @@ async def mgmt_request_async( self._mgmt_links[node] = mgmt_link await mgmt_link.open() - while not self.client_ready_async(): + while not await self.client_ready_async(): await asyncio.sleep(0.05) while not await mgmt_link.ready(): @@ -933,6 +933,7 @@ async def _message_generator_async(self, timeout=None): async def settle_messages_async( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["accepted"], *, batchable: Optional[bool] = None @@ -943,6 +944,7 @@ async def settle_messages_async( async def settle_messages_async( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["released"], *, batchable: Optional[bool] = None @@ -953,6 +955,7 @@ async def settle_messages_async( async def settle_messages_async( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["rejected"], *, error: Optional[AMQPError] = None, @@ -964,6 +967,7 @@ async def settle_messages_async( async def settle_messages_async( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["modified"], *, delivery_failed: Optional[bool] = None, @@ -977,6 +981,7 @@ async def settle_messages_async( async def settle_messages_async( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["received"], *, section_number: int, @@ -985,7 +990,13 @@ async def settle_messages_async( ): ... - async def settle_messages_async(self, delivery_id: Union[int, Tuple[int, int]], outcome: str, **kwargs): + async def settle_messages_async( + self, + delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, + outcome: str, + **kwargs + ): batchable = kwargs.pop('batchable', None) if outcome.lower() == 'accepted': state: Outcomes = Accepted() @@ -1007,6 +1018,7 @@ async def settle_messages_async(self, delivery_id: Union[int, Tuple[int, int]], await self._link.send_disposition( first_delivery_id=first, last_delivery_id=last, + delivery_tag=delivery_tag, settled=True, delivery_state=state, batchable=batchable, diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_receiver_async.py b/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_receiver_async.py index 18afe14e14200..62439e49b6c0c 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_receiver_async.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_receiver_async.py @@ -16,6 +16,7 @@ DispositionFrame, ) from ..outcomes import Received, Accepted, Rejected, Released, Modified +from ..error import AMQPException, ErrorCondition _LOGGER = logging.getLogger(__name__) @@ -31,6 +32,7 @@ def __init__(self, session, handle, source_address, **kwargs): self._on_transfer = kwargs.pop("on_transfer") self._received_payload = bytearray() self._first_frame = None + self._received_delivery_tags = set() @classmethod def from_incoming_frame(cls, session, handle, frame): @@ -69,6 +71,7 @@ async def _incoming_transfer(self, frame): if self._received_payload or frame[5]: # more self._received_payload.extend(frame[11]) if not frame[5]: + self._received_delivery_tags.add(self._first_frame[2]) if self._received_payload: message = decode_payload(memoryview(self._received_payload)) self._received_payload = bytearray() @@ -79,6 +82,7 @@ async def _incoming_transfer(self, frame): await self._outgoing_disposition( first=self._first_frame[1], last=self._first_frame[1], + delivery_tag=self._first_frame[2], settled=True, state=delivery_state, batchable=None @@ -100,6 +104,7 @@ async def _outgoing_disposition( self, first: int, last: Optional[int], + delivery_tag: bytes, settled: Optional[bool], state: Optional[Union[Received, Accepted, Rejected, Released, Modified]], batchable: Optional[bool], @@ -107,9 +112,13 @@ async def _outgoing_disposition( disposition_frame = DispositionFrame( role=self.role, first=first, last=last, settled=settled, state=state, batchable=batchable ) + if delivery_tag not in self._received_delivery_tags: + raise AMQPException(condition=ErrorCondition.IllegalState, description = "Delivery tag not found.") + if self.network_trace: _LOGGER.debug("-> %r", DispositionFrame(*disposition_frame), extra=self.network_trace_params) await self._session._outgoing_disposition(disposition_frame) # pylint: disable=protected-access + self._received_delivery_tags.remove(delivery_tag) async def attach(self): await super().attach() @@ -121,12 +130,20 @@ async def send_disposition( wait: Union[bool, float] = False, first_delivery_id: int, last_delivery_id: Optional[int] = None, + delivery_tag: bytes, settled: Optional[bool] = None, delivery_state: Optional[Union[Received, Accepted, Rejected, Released, Modified]] = None, batchable: Optional[bool] = None ): if self._is_closed: raise ValueError("Link already closed.") - await self._outgoing_disposition(first_delivery_id, last_delivery_id, settled, delivery_state, batchable) + await self._outgoing_disposition( + first_delivery_id, + last_delivery_id, + delivery_tag, + settled, + delivery_state, + batchable + ) if not settled: await self._wait_for_response(wait) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/client.py b/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/client.py index 32eec588cf2a4..5fbb501e6cb3e 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/client.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/client.py @@ -1030,6 +1030,7 @@ def _message_generator(self, timeout=None): def settle_messages( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["accepted"], *, batchable: Optional[bool] = None @@ -1040,6 +1041,7 @@ def settle_messages( def settle_messages( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["released"], *, batchable: Optional[bool] = None @@ -1050,6 +1052,7 @@ def settle_messages( def settle_messages( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["rejected"], *, error: Optional[AMQPError] = None, @@ -1061,6 +1064,7 @@ def settle_messages( def settle_messages( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["modified"], *, delivery_failed: Optional[bool] = None, @@ -1074,6 +1078,7 @@ def settle_messages( def settle_messages( self, delivery_id: Union[int, Tuple[int, int]], + delivery_tag: bytes, outcome: Literal["received"], *, section_number: int, @@ -1083,7 +1088,7 @@ def settle_messages( ... def settle_messages( - self, delivery_id: Union[int, Tuple[int, int]], outcome: str, **kwargs + self, delivery_id: Union[int, Tuple[int, int]], delivery_tag: bytes, outcome: str, **kwargs ): batchable = kwargs.pop("batchable", None) if outcome.lower() == "accepted": @@ -1106,6 +1111,7 @@ def settle_messages( self._link.send_disposition( first_delivery_id=first, last_delivery_id=last, + delivery_tag=delivery_tag, settled=True, delivery_state=state, batchable=batchable, diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/receiver.py b/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/receiver.py index 99095379a28bc..4a8ab9214b987 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/receiver.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/receiver.py @@ -13,6 +13,7 @@ from .constants import LinkState, Role from .performatives import TransferFrame, DispositionFrame from .outcomes import Received, Accepted, Rejected, Released, Modified +from .error import AMQPException, ErrorCondition _LOGGER = logging.getLogger(__name__) @@ -28,6 +29,7 @@ def __init__(self, session, handle, source_address, **kwargs): self._on_transfer = kwargs.pop("on_transfer") self._received_payload = bytearray() self._first_frame = None + self._received_delivery_tags = set() @classmethod def from_incoming_frame(cls, session, handle, frame): @@ -54,6 +56,7 @@ def _incoming_attach(self, frame): def _incoming_transfer(self, frame): if self.network_trace: _LOGGER.debug("<- %r", TransferFrame(payload=b"***", *frame[:-1]), extra=self.network_trace_params) + # If more is false --> this is the last frame of the message if not frame[5]: self.current_link_credit -= 1 @@ -66,16 +69,19 @@ def _incoming_transfer(self, frame): if self._received_payload or frame[5]: # more self._received_payload.extend(frame[11]) if not frame[5]: + self._received_delivery_tags.add(self._first_frame[2]) if self._received_payload: message = decode_payload(memoryview(self._received_payload)) self._received_payload = bytearray() else: message = decode_payload(frame[11]) delivery_state = self._process_incoming_message(self._first_frame, message) + if not frame[4] and delivery_state: # settled self._outgoing_disposition( first=self._first_frame[1], last=self._first_frame[1], + delivery_tag=self._first_frame[2], settled=True, state=delivery_state, batchable=None @@ -97,16 +103,21 @@ def _outgoing_disposition( self, first: int, last: Optional[int], + delivery_tag: bytes, settled: Optional[bool], state: Optional[Union[Received, Accepted, Rejected, Released, Modified]], batchable: Optional[bool], ): + if delivery_tag not in self._received_delivery_tags: + raise AMQPException(condition=ErrorCondition.IllegalState, description = "Delivery tag not found.") + disposition_frame = DispositionFrame( role=self.role, first=first, last=last, settled=settled, state=state, batchable=batchable ) if self.network_trace: _LOGGER.debug("-> %r", DispositionFrame(*disposition_frame), extra=self.network_trace_params) self._session._outgoing_disposition(disposition_frame) # pylint: disable=protected-access + self._received_delivery_tags.remove(delivery_tag) def attach(self): super().attach() @@ -118,12 +129,20 @@ def send_disposition( wait: Union[bool, float] = False, first_delivery_id: int, last_delivery_id: Optional[int] = None, + delivery_tag: bytes, settled: Optional[bool] = None, delivery_state: Optional[Union[Received, Accepted, Rejected, Released, Modified]] = None, batchable: Optional[bool] = None ): if self._is_closed: raise ValueError("Link already closed.") - self._outgoing_disposition(first_delivery_id, last_delivery_id, settled, delivery_state, batchable) + self._outgoing_disposition( + first_delivery_id, + last_delivery_id, + delivery_tag, + settled, + delivery_state, + batchable + ) if not settled: self._wait_for_response(wait) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/_transport/_pyamqp_transport.py b/sdk/servicebus/azure-servicebus/azure/servicebus/_transport/_pyamqp_transport.py index 88470139eabcd..0bdc78b254cdb 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/_transport/_pyamqp_transport.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/_transport/_pyamqp_transport.py @@ -718,7 +718,7 @@ def enhanced_message_received( # pylint: disable=arguments-differ receiver._handler._received_messages.put((frame, message)) else: # If receive_message or receive iterator is not being called, release message passed to callback. - receiver._handler.settle_messages(frame[1], 'released') + receiver._handler.settle_messages(frame[1], frame[2], 'released') @staticmethod def build_received_message( @@ -780,10 +780,11 @@ def settle_message_via_receiver_link( # pylint: disable=protected-access try: if settle_operation == MESSAGE_COMPLETE: - return handler.settle_messages(message._delivery_id, 'accepted') + return handler.settle_messages(message._delivery_id, message._delivery_tag, 'accepted') if settle_operation == MESSAGE_ABANDON: return handler.settle_messages( message._delivery_id, + message._delivery_tag, 'modified', delivery_failed=True, undeliverable_here=False @@ -791,6 +792,7 @@ def settle_message_via_receiver_link( if settle_operation == MESSAGE_DEAD_LETTER: return handler.settle_messages( message._delivery_id, + message._delivery_tag, 'rejected', error=AMQPError( condition=DEADLETTERNAME, @@ -804,6 +806,7 @@ def settle_message_via_receiver_link( if settle_operation == MESSAGE_DEFER: return handler.settle_messages( message._delivery_id, + message._delivery_tag, 'modified', delivery_failed=True, undeliverable_here=True @@ -814,6 +817,14 @@ def settle_message_via_receiver_link( except AMQPConnectionError as e: raise RuntimeError("Connection lost during settle operation.") from e + except AMQPException as ae: + if ( + ae.condition == ErrorCondition.IllegalState + ): + raise RuntimeError("Link error occurred during settle operation.") from ae + + raise ServiceBusConnectionError(message="Link error occurred during settle operation.") from ae + raise ValueError( f"Unsupported settle operation type: {settle_operation}" ) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/_transport/_pyamqp_transport_async.py b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/_transport/_pyamqp_transport_async.py index f47c28409b5c8..27f0afe2372b2 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/_transport/_pyamqp_transport_async.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/_transport/_pyamqp_transport_async.py @@ -19,7 +19,9 @@ from ..._pyamqp.error import ( AMQPConnectionError, AMQPError, + AMQPException, MessageException, + ErrorCondition, ) from ._base_async import AmqpTransportAsync @@ -42,7 +44,8 @@ ) from ..._transport._pyamqp_transport import PyamqpTransport from ...exceptions import ( - OperationTimeoutError + OperationTimeoutError, + ServiceBusConnectionError, ) if TYPE_CHECKING: @@ -283,7 +286,7 @@ async def enhanced_message_received_async( if receiver._receive_context.is_set(): receiver._handler._received_messages.put((frame, message)) else: - await receiver._handler.settle_messages_async(frame[1], 'released') + await receiver._handler.settle_messages_async(frame[1], frame[2], 'released') @staticmethod def set_handler_message_received_async(receiver: "ServiceBusReceiver") -> None: @@ -317,10 +320,11 @@ async def settle_message_via_receiver_link_async( # pylint: disable=protected-access try: if settle_operation == MESSAGE_COMPLETE: - return await handler.settle_messages_async(message._delivery_id, 'accepted') + return await handler.settle_messages_async(message._delivery_id, message._delivery_tag, 'accepted') if settle_operation == MESSAGE_ABANDON: return await handler.settle_messages_async( message._delivery_id, + message._delivery_tag, 'modified', delivery_failed=True, undeliverable_here=False @@ -328,6 +332,7 @@ async def settle_message_via_receiver_link_async( if settle_operation == MESSAGE_DEAD_LETTER: return await handler.settle_messages_async( message._delivery_id, + message._delivery_tag, 'rejected', error=AMQPError( condition=DEADLETTERNAME, @@ -341,6 +346,7 @@ async def settle_message_via_receiver_link_async( if settle_operation == MESSAGE_DEFER: return await handler.settle_messages_async( message._delivery_id, + message._delivery_tag, 'modified', delivery_failed=True, undeliverable_here=True @@ -351,6 +357,15 @@ async def settle_message_via_receiver_link_async( except AMQPConnectionError as e: raise RuntimeError("Connection lost during settle operation.") from e + except AMQPException as ae: + if ( + ae.condition == ErrorCondition.IllegalState + ): + raise RuntimeError("Link error occurred during settle operation.") from ae + + raise ServiceBusConnectionError(message="Link error occurred during settle operation.") from ae + + raise ValueError( f"Unsupported settle operation type: {settle_operation}" ) diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/test_queues_async.py b/sdk/servicebus/azure-servicebus/tests/async_tests/test_queues_async.py index c7d48b2b039a4..e77784e31fc70 100644 --- a/sdk/servicebus/azure-servicebus/tests/async_tests/test_queues_async.py +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/test_queues_async.py @@ -2379,7 +2379,7 @@ def _hack_amqp_mgmt_request(cls, message, operation, op_type=None, node=None, ca def _hack_sb_receiver_settle_message(self, message, settle_operation, dead_letter_reason=None, dead_letter_error_description=None): raise uamqp.errors.AMQPError() else: - async def _hack_amqp_message_complete(cls, _, settlement): + async def _hack_amqp_message_complete(cls, _, _unused, settlement): if settlement == 'completed': raise RuntimeError() @@ -2955,3 +2955,37 @@ async def test_state_deferred_async(self, uamqp_transport, *, servicebus_namespa ) for message in received_deferred_msg: assert message.state == ServiceBusMessageState.DEFERRED + + @pytest.mark.asyncio + @pytest.mark.liveTest + @pytest.mark.live_test_only + @CachedServiceBusResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + @ServiceBusQueuePreparer(name_prefix='servicebustest', dead_lettering_on_message_expiration=True, lock_duration='PT10S') + @pytest.mark.parametrize("uamqp_transport", uamqp_transport_params, ids=uamqp_transport_ids) + @ArgPasserAsync() + async def test_queue_complete_message_on_different_receiver_async(self, uamqp_transport, *, servicebus_namespace_connection_string=None, servicebus_queue=None, **kwargs): + async with ServiceBusClient.from_connection_string( + servicebus_namespace_connection_string, uamqp_transport=uamqp_transport) as sb_client: + sender = sb_client.get_queue_sender(servicebus_queue.name) + receiver1 = sb_client.get_queue_receiver(servicebus_queue.name) + receiver2 = sb_client.get_queue_receiver(servicebus_queue.name) + + async with sender, receiver1, receiver2: + await sender.send_messages([ServiceBusMessage('test') for _ in range(5)]) + received_msgs = [] + # the amount of messages returned by receive call is not stable, especially in live tests + # of different os platforms, this is why a while loop is used here to receive the specific + # amount of message we want to receive + while len(received_msgs) < 5: + # start receives on the first receiver and complete them on the other one. + # the messages should settle over the management of the second receiver. + for msg in await receiver1.receive_messages(max_message_count=10, max_wait_time=5): + await receiver2.complete_message(msg) + received_msgs.append(msg) + + assert len(received_msgs) == 5 + + messages_in_queue = await receiver1.peek_messages() + + assert len(messages_in_queue) == 0 diff --git a/sdk/servicebus/azure-servicebus/tests/test_queues.py b/sdk/servicebus/azure-servicebus/tests/test_queues.py index a5be5431b9893..104fc7901d82c 100644 --- a/sdk/servicebus/azure-servicebus/tests/test_queues.py +++ b/sdk/servicebus/azure-servicebus/tests/test_queues.py @@ -263,7 +263,7 @@ def sub_test_releasing_messages(): # leaving the extra credits on the wire for msg in receiver.receive_messages(max_message_count=10, max_wait_time=5): receiver.complete_message(msg) - received_msgs.append(received_msgs) + received_msgs.append(msg) assert len(received_msgs) == 5 # send 5 more messages, those messages would arrive at the client while the program is sleeping @@ -2782,7 +2782,7 @@ def _hack_amqp_mgmt_request(cls, message, operation, op_type=None, node=None, ca def _hack_sb_receiver_settle_message(self, message, settle_operation, dead_letter_reason=None, dead_letter_error_description=None): raise uamqp.errors.AMQPError() else: - def _hack_amqp_message_complete(cls, _, settlement): + def _hack_amqp_message_complete(cls, _, _unused, settlement): if settlement == 'completed': raise RuntimeError() @@ -3372,3 +3372,36 @@ def test_state_deferred(self, uamqp_transport, *, servicebus_namespace=None, ser ) for message in received_deferred_msg: assert message.state == ServiceBusMessageState.DEFERRED + + @pytest.mark.liveTest + @pytest.mark.live_test_only + @CachedServiceBusResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + @ServiceBusQueuePreparer(name_prefix='servicebustest', dead_lettering_on_message_expiration=True, lock_duration='PT10S') + @pytest.mark.parametrize("uamqp_transport", uamqp_transport_params, ids=uamqp_transport_ids) + @ArgPasser() + def test_queue_complete_message_on_different_receiver(self, uamqp_transport, *, servicebus_namespace_connection_string=None, servicebus_queue=None, **kwargs): + with ServiceBusClient.from_connection_string( + servicebus_namespace_connection_string, uamqp_transport=uamqp_transport) as sb_client: + sender = sb_client.get_queue_sender(servicebus_queue.name) + receiver1 = sb_client.get_queue_receiver(servicebus_queue.name) + receiver2 = sb_client.get_queue_receiver(servicebus_queue.name) + + with sender, receiver1, receiver2: + sender.send_messages([ServiceBusMessage('test') for _ in range(5)]) + received_msgs = [] + # the amount of messages returned by receive call is not stable, especially in live tests + # of different os platforms, this is why a while loop is used here to receive the specific + # amount of message we want to receive + while len(received_msgs) < 5: + # start receives on the first receiver and complete them on the other one. + # the messages should settle over the management of the second receiver. + for msg in receiver1.receive_messages(max_message_count=10, max_wait_time=5): + receiver2.complete_message(msg) + received_msgs.append(msg) + + assert len(received_msgs) == 5 + + messages_in_queue = receiver1.peek_messages() + + assert len(messages_in_queue) == 0 diff --git a/sdk/servicebus/tests.yml b/sdk/servicebus/tests.yml index 633f84e412efc..355d85e08bb4d 100644 --- a/sdk/servicebus/tests.yml +++ b/sdk/servicebus/tests.yml @@ -30,8 +30,3 @@ extends: SubscriptionConfigurationFilePaths: - eng/common/TestResources/sub-config/AzureUsGovMsft.json Location: 'usgovarizona' - China: - ServiceConnection: china_azure-sdk-tests - SubscriptionConfigurationFilePaths: - - eng/common/TestResources/sub-config/AzureChinaMsft.json - Location: 'chinanorth3' diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/pyproject.toml b/sdk/servicefabric/azure-mgmt-servicefabric/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/servicefabric/azure-mgmt-servicefabric/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/pyproject.toml b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/pyproject.toml b/sdk/servicelinker/azure-mgmt-servicelinker/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/servicelinker/azure-mgmt-servicelinker/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/servicenetworking/azure-mgmt-servicenetworking/pyproject.toml b/sdk/servicenetworking/azure-mgmt-servicenetworking/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/servicenetworking/azure-mgmt-servicenetworking/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/signalr/azure-mgmt-signalr/pyproject.toml b/sdk/signalr/azure-mgmt-signalr/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/sphere/azure-mgmt-sphere/pyproject.toml b/sdk/sphere/azure-mgmt-sphere/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/sphere/azure-mgmt-sphere/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/springappdiscovery/azure-mgmt-springappdiscovery/pyproject.toml b/sdk/springappdiscovery/azure-mgmt-springappdiscovery/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/springappdiscovery/azure-mgmt-springappdiscovery/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/sql/azure-mgmt-sql/pyproject.toml b/sdk/sql/azure-mgmt-sql/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/sql/azure-mgmt-sqlvirtualmachine/pyproject.toml b/sdk/sql/azure-mgmt-sqlvirtualmachine/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/sql/azure-mgmt-sqlvirtualmachine/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/standbypool/azure-mgmt-standbypool/pyproject.toml b/sdk/standbypool/azure-mgmt-standbypool/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/standbypool/azure-mgmt-standbypool/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/storage/azure-mgmt-storage/pyproject.toml b/sdk/storage/azure-mgmt-storage/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/storage/azure-mgmt-storagecache/pyproject.toml b/sdk/storage/azure-mgmt-storagecache/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/storage/azure-mgmt-storagecache/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/storage/azure-mgmt-storageimportexport/pyproject.toml b/sdk/storage/azure-mgmt-storageimportexport/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/storage/azure-mgmt-storageimportexport/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/storage/azure-mgmt-storagesync/pyproject.toml b/sdk/storage/azure-mgmt-storagesync/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/storage/azure-storage-blob-changefeed/pyproject.toml b/sdk/storage/azure-storage-blob-changefeed/pyproject.toml index ff779a518143f..05ee5668ed6ac 100644 --- a/sdk/storage/azure-storage-blob-changefeed/pyproject.toml +++ b/sdk/storage/azure-storage-blob-changefeed/pyproject.toml @@ -2,4 +2,3 @@ mypy = false pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/storage/azure-storage-blob/CHANGELOG.md b/sdk/storage/azure-storage-blob/CHANGELOG.md index 8b87db867bbfa..06e92777e7600 100644 --- a/sdk/storage/azure-storage-blob/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob/CHANGELOG.md @@ -1,10 +1,23 @@ # Release History -## 12.22.0 (Unreleased) +## 12.23.0 (Unreleased) ### Features Added +## 12.23.0b1 (2024-08-07) + +### Features Added +- Added support for service version 2024-11-04. + +### Other Changes +- Bumped minimum `azure-core` dependency to 1.30.0. + +## 12.22.0 (2024-08-06) + +### Other Changes +- Updated type hints across the entire package and enabled MyPy to run during CI. Some public types may have been adjusted if they were previously erroneous or incomplete. + ## 12.21.0 (2024-07-18) ### Features Added diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py index 07c9987ee1e53..42433f4191194 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py @@ -1412,6 +1412,8 @@ def delete_blobs( # pylint: disable=delete-operation-wrong-return-type """ if len(blobs) == 0: return iter([]) + if self._is_localhost: + kwargs['url_prepend'] = self.account_name reqs, options = _generate_delete_blobs_options( self._query_str, @@ -1494,6 +1496,8 @@ def set_standard_blob_tier_blobs( :return: An iterator of responses, one for each blob in order :rtype: Iterator[~azure.core.pipeline.transport.HttpResponse] """ + if self._is_localhost: + kwargs['url_prepend'] = self.account_name reqs, options = _generate_set_tiers_options( self._query_str, self.container_name, @@ -1553,6 +1557,8 @@ def set_premium_page_blob_tier_blobs( :return: An iterator of responses, one for each blob in order :rtype: Iterator[~azure.core.pipeline.transport.HttpResponse] """ + if self._is_localhost: + kwargs['url_prepend'] = self.account_name reqs, options = _generate_set_tiers_options( self._query_str, self.container_name, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client_helpers.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client_helpers.py index b30c976676df4..9ee405b4c31b8 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client_helpers.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client_helpers.py @@ -120,6 +120,7 @@ def _generate_delete_blobs_options( if_modified_since = kwargs.pop('if_modified_since', None) if_unmodified_since = kwargs.pop('if_unmodified_since', None) if_tags_match_condition = kwargs.pop('if_tags_match_condition', None) + url_prepend = kwargs.pop('url_prepend', None) kwargs.update({'raise_on_any_failure': raise_on_any_failure, 'sas': query_str.replace('?', '&'), 'timeout': '&timeout=' + str(timeout) if timeout else "", @@ -157,9 +158,11 @@ def _generate_delete_blobs_options( req = HttpRequest( "DELETE", - f"/{quote(container_name)}/{quote(str(blob_name), safe='/~')}{query_str}", + (f"{'/' + quote(url_prepend) if url_prepend else ''}/" + f"{quote(container_name)}/{quote(str(blob_name), safe='/~')}{query_str}"), headers=header_parameters ) + req.format_parameters(query_parameters) reqs.append(req) @@ -223,6 +226,7 @@ def _generate_set_tiers_options( raise_on_any_failure = kwargs.pop('raise_on_any_failure', True) rehydrate_priority = kwargs.pop('rehydrate_priority', None) if_tags = kwargs.pop('if_tags_match_condition', None) + url_prepend = kwargs.pop('url_prepend', None) kwargs.update({'raise_on_any_failure': raise_on_any_failure, 'sas': query_str.replace('?', '&'), 'timeout': '&timeout=' + str(timeout) if timeout else "", @@ -252,7 +256,8 @@ def _generate_set_tiers_options( req = HttpRequest( "PUT", - f"/{quote(container_name)}/{quote(str(blob_name), safe='/~')}{query_str}", + (f"{'/' + quote(url_prepend) if url_prepend else ''}/" + f"{quote(container_name)}/{quote(str(blob_name), safe='/~')}{query_str}"), headers=header_parameters ) req.format_parameters(query_parameters) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py index 6b4f7a4b6f7cb..67dc2f9a2aee1 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py @@ -56,6 +56,7 @@ '2023-11-03', '2024-05-04', '2024-08-04', + '2024-11-04', ] diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py index 56458cd8d82af..28c58255677b0 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py @@ -76,6 +76,7 @@ def __init__( self._location_mode = kwargs.get("_location_mode", LocationMode.PRIMARY) self._hosts = kwargs.get("_hosts") self.scheme = parsed_url.scheme + self._is_localhost = False if service not in ["blob", "queue", "file-share", "dfs"]: raise ValueError(f"Invalid service: {service}") @@ -85,6 +86,7 @@ def __init__( self.account_name = account[0] if len(account) > 1 else None if not self.account_name and parsed_url.netloc.startswith("localhost") \ or parsed_url.netloc.startswith("127.0.0.1"): + self._is_localhost = True self.account_name = parsed_url.path.strip("/") self.credential = _format_shared_key_credential(self.account_name, credential) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/shared_access_signature.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/shared_access_signature.py index 318fc05ec4741..21ba30240cb65 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/shared_access_signature.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/shared_access_signature.py @@ -107,8 +107,17 @@ def __init__(self, account_name, account_key, x_ms_version=X_MS_VERSION): self.account_key = account_key self.x_ms_version = x_ms_version - def generate_account(self, services, resource_types, permission, expiry, start=None, - ip=None, protocol=None, **kwargs) -> str: + def generate_account( + self, services, + resource_types, + permission, + expiry, + start=None, + ip=None, + protocol=None, + sts_hook=None, + **kwargs + ) -> str: ''' Generates a shared access signature for the account. Use the returned signature with the sas_token parameter of the service @@ -152,6 +161,10 @@ def generate_account(self, services, resource_types, permission, expiry, start=N :keyword str encryption_scope: Optional. If specified, this is the encryption scope to use when sending requests authorized with this SAS URI. + :param sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :type sts_hook: Optional[Callable[[str], None]] :returns: The generated SAS token for the account. :rtype: str ''' @@ -161,12 +174,16 @@ def generate_account(self, services, resource_types, permission, expiry, start=N sas.add_encryption_scope(**kwargs) sas.add_account_signature(self.account_name, self.account_key) + if sts_hook is not None: + sts_hook(sas.string_to_sign) + return sas.get_token() class _SharedAccessHelper(object): def __init__(self): self.query_dict = {} + self.string_to_sign = "" def _add_query(self, name, val): if val: @@ -229,6 +246,7 @@ def get_value_to_append(query): self._add_query(QueryStringConstants.SIGNED_SIGNATURE, sign_string(account_key, string_to_sign)) + self.string_to_sign = string_to_sign def get_token(self) -> str: return '&'.join([f'{n}={url_quote(v)}' for n, v in self.query_dict.items() if v is not None]) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared_access_signature.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared_access_signature.py index 5636da2ae0ec4..bd33559d180b4 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared_access_signature.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared_access_signature.py @@ -5,7 +5,10 @@ # -------------------------------------------------------------------------- # pylint: disable=docstring-keyword-should-match-keyword-only -from typing import Union, Optional, Any, TYPE_CHECKING +from typing import ( + Any, Callable, Optional, Union, + TYPE_CHECKING +) from urllib.parse import parse_qs from ._shared import sign_string, url_quote @@ -64,6 +67,7 @@ def generate_blob( content_encoding: Optional[str] = None, content_language: Optional[str] = None, content_type: Optional[str] = None, + sts_hook: Optional[Callable[[str], None]] = None, **kwargs: Any ) -> str: ''' @@ -132,6 +136,10 @@ def generate_blob( :param str content_type: Response header value for Content-Type when resource is accessed using this shared access signature. + :param sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :type sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str ''' @@ -155,6 +163,9 @@ def generate_blob( sas.add_resource_signature(self.account_name, self.account_key, resource_path, user_delegation_key=self.user_delegation_key) + if sts_hook is not None: + sts_hook(sas.string_to_sign) + return sas.get_token() def generate_container( @@ -170,6 +181,7 @@ def generate_container( content_encoding: Optional[str] = None, content_language: Optional[str] = None, content_type: Optional[str] = None, + sts_hook: Optional[Callable[[str], None]] = None, **kwargs: Any ) -> str: ''' @@ -228,6 +240,10 @@ def generate_container( :param str content_type: Response header value for Content-Type when resource is accessed using this shared access signature. + :param sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :type sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str ''' @@ -242,6 +258,10 @@ def generate_container( sas.add_info_for_hns_account(**kwargs) sas.add_resource_signature(self.account_name, self.account_key, container_name, user_delegation_key=self.user_delegation_key) + + if sts_hook is not None: + sts_hook(sas.string_to_sign) + return sas.get_token() @@ -316,6 +336,7 @@ def add_resource_signature(self, account_name, account_key, path, user_delegatio self._add_query(QueryStringConstants.SIGNED_SIGNATURE, sign_string(account_key if user_delegation_key is None else user_delegation_key.value, string_to_sign)) + self.string_to_sign = string_to_sign def get_token(self) -> str: # a conscious decision was made to exclude the timestamp in the generated token @@ -335,6 +356,7 @@ def generate_account_sas( ip: Optional[str] = None, *, services: Union[Services, str] = Services(blob=True), + sts_hook: Optional[Callable[[str], None]] = None, **kwargs: Any ) -> str: """Generates a shared access signature for the blob service. @@ -376,6 +398,10 @@ def generate_account_sas( Specifies the protocol permitted for a request made. The default value is https. :keyword str encryption_scope: Specifies the encryption scope for a request made so that all write operations will be service encrypted. + :keyword sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :paramtype sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str @@ -396,6 +422,7 @@ def generate_account_sas( expiry=expiry, start=start, ip=ip, + sts_hook=sts_hook, **kwargs ) @@ -410,6 +437,8 @@ def generate_container_sas( start: Optional[Union["datetime", str]] = None, policy_id: Optional[str] = None, ip: Optional[str] = None, + *, + sts_hook: Optional[Callable[[str], None]] = None, **kwargs: Any ) -> str: """Generates a shared access signature for a container. @@ -483,6 +512,10 @@ def generate_container_sas( :keyword str correlation_id: The correlation id to correlate the storage audit logs with the audit logs used by the principal generating and distributing the SAS. This can only be used when generating a SAS with delegation key. + :keyword sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :paramtype sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str @@ -515,6 +548,7 @@ def generate_container_sas( start=start, policy_id=policy_id, ip=ip, + sts_hook=sts_hook, **kwargs ) @@ -531,6 +565,8 @@ def generate_blob_sas( start: Optional[Union["datetime", str]] = None, policy_id: Optional[str] = None, ip: Optional[str] = None, + *, + sts_hook: Optional[Callable[[str], None]] = None, **kwargs: Any ) -> str: """Generates a shared access signature for a blob. @@ -616,6 +652,10 @@ def generate_blob_sas( :keyword str correlation_id: The correlation id to correlate the storage audit logs with the audit logs used by the principal generating and distributing the SAS. This can only be used when generating a SAS with delegation key. + :keyword sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :paramtype sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str """ @@ -645,6 +685,7 @@ def generate_blob_sas( start=start, policy_id=policy_id, ip=ip, + sts_hook=sts_hook, **kwargs ) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_version.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_version.py index 4611321909bf3..9bdabb440225a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_version.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_version.py @@ -4,4 +4,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "12.22.0" +VERSION = "12.23.0" diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py index 2a4353762f2bd..169e4ae447ada 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py @@ -1406,6 +1406,8 @@ async def delete_blobs( """ if len(blobs) == 0: return AsyncList([]) + if self._is_localhost: + kwargs['url_prepend'] = self.account_name reqs, options = _generate_delete_blobs_options( self._query_str, @@ -1485,6 +1487,8 @@ async def set_standard_blob_tier_blobs( :return: An async iterator of responses, one for each blob in order :rtype: asynciterator[~azure.core.pipeline.transport.AsyncHttpResponse] """ + if self._is_localhost: + kwargs['url_prepend'] = self.account_name reqs, options = _generate_set_tiers_options( self._query_str, self.container_name, @@ -1544,6 +1548,8 @@ async def set_premium_page_blob_tier_blobs( :return: An async iterator of responses, one for each blob in order :rtype: asynciterator[~azure.core.pipeline.transport.AsyncHttpResponse] """ + if self._is_localhost: + kwargs['url_prepend'] = self.account_name reqs, options = _generate_set_tiers_options( self._query_str, self.container_name, diff --git a/sdk/storage/azure-storage-blob/setup.py b/sdk/storage/azure-storage-blob/setup.py index fe770e6e4fc64..b011968e8e1c0 100644 --- a/sdk/storage/azure-storage-blob/setup.py +++ b/sdk/storage/azure-storage-blob/setup.py @@ -78,14 +78,14 @@ ]), python_requires=">=3.8", install_requires=[ - "azure-core>=1.28.0", + "azure-core>=1.30.0", "cryptography>=2.1.4", "typing-extensions>=4.6.0", "isodate>=0.6.1" ], extras_require={ "aio": [ - "azure-core[aio]>=1.28.0", + "azure-core[aio]>=1.30.0", ], }, ) diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md index eaf7e1c8677b6..7ae4690465cb6 100644 --- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md @@ -1,10 +1,18 @@ # Release History -## 12.17.0b1 (Unreleased) +## 12.17.0 (Unreleased) ### Features Added +## 12.17.0b1 (2024-08-07) + +### Features Added +- Added support for service version 2024-11-04. + +### Other Changes +- Bumped minimum `azure-core` dependency to 1.30.0. + ## 12.16.0 (2024-07-18) ### Features Added diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py index 8c4a26173732c..ec3ce4329f18a 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py @@ -35,6 +35,7 @@ '2023-11-03', '2024-05-04', '2024-08-04', + '2024-11-04', ] # This list must be in chronological order! diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client.py index 56458cd8d82af..28c58255677b0 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client.py @@ -76,6 +76,7 @@ def __init__( self._location_mode = kwargs.get("_location_mode", LocationMode.PRIMARY) self._hosts = kwargs.get("_hosts") self.scheme = parsed_url.scheme + self._is_localhost = False if service not in ["blob", "queue", "file-share", "dfs"]: raise ValueError(f"Invalid service: {service}") @@ -85,6 +86,7 @@ def __init__( self.account_name = account[0] if len(account) > 1 else None if not self.account_name and parsed_url.netloc.startswith("localhost") \ or parsed_url.netloc.startswith("127.0.0.1"): + self._is_localhost = True self.account_name = parsed_url.path.strip("/") self.credential = _format_shared_key_credential(self.account_name, credential) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/shared_access_signature.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/shared_access_signature.py index 318fc05ec4741..21ba30240cb65 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/shared_access_signature.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/shared_access_signature.py @@ -107,8 +107,17 @@ def __init__(self, account_name, account_key, x_ms_version=X_MS_VERSION): self.account_key = account_key self.x_ms_version = x_ms_version - def generate_account(self, services, resource_types, permission, expiry, start=None, - ip=None, protocol=None, **kwargs) -> str: + def generate_account( + self, services, + resource_types, + permission, + expiry, + start=None, + ip=None, + protocol=None, + sts_hook=None, + **kwargs + ) -> str: ''' Generates a shared access signature for the account. Use the returned signature with the sas_token parameter of the service @@ -152,6 +161,10 @@ def generate_account(self, services, resource_types, permission, expiry, start=N :keyword str encryption_scope: Optional. If specified, this is the encryption scope to use when sending requests authorized with this SAS URI. + :param sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :type sts_hook: Optional[Callable[[str], None]] :returns: The generated SAS token for the account. :rtype: str ''' @@ -161,12 +174,16 @@ def generate_account(self, services, resource_types, permission, expiry, start=N sas.add_encryption_scope(**kwargs) sas.add_account_signature(self.account_name, self.account_key) + if sts_hook is not None: + sts_hook(sas.string_to_sign) + return sas.get_token() class _SharedAccessHelper(object): def __init__(self): self.query_dict = {} + self.string_to_sign = "" def _add_query(self, name, val): if val: @@ -229,6 +246,7 @@ def get_value_to_append(query): self._add_query(QueryStringConstants.SIGNED_SIGNATURE, sign_string(account_key, string_to_sign)) + self.string_to_sign = string_to_sign def get_token(self) -> str: return '&'.join([f'{n}={url_quote(v)}' for n, v in self.query_dict.items() if v is not None]) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared_access_signature.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared_access_signature.py index f5ce3f75bb152..71f9f31cacd6a 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared_access_signature.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared_access_signature.py @@ -6,7 +6,8 @@ # pylint: disable=docstring-keyword-should-match-keyword-only from typing import ( # pylint: disable=unused-import - Union, Optional, Any, TYPE_CHECKING + Any, Callable, Optional, Union, + TYPE_CHECKING ) from urllib.parse import parse_qs @@ -36,6 +37,7 @@ def generate_account_sas( expiry: Union["datetime", str], *, services: Union[Services, str] = Services(blob=True), + sts_hook: Optional[Callable[[str], None]] = None, **kwargs: Any ) -> str: """Generates a shared access signature for the DataLake service. @@ -77,6 +79,10 @@ def generate_account_sas( Specifies the protocol permitted for a request made. The default value is https. :keyword str encryption_scope: Specifies the encryption scope for a request made so that all write operations will be service encrypted. + :keyword sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :paramtype sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str """ @@ -87,18 +93,21 @@ def generate_account_sas( permission=permission, expiry=expiry, services=services, + sts_hook=sts_hook, **kwargs ) def generate_file_system_sas( - account_name, # type: str - file_system_name, # type: str - credential, # type: Union[str, UserDelegationKey] - permission=None, # type: Optional[Union[FileSystemSasPermissions, str]] - expiry=None, # type: Optional[Union[datetime, str]] - **kwargs # type: Any - ): + account_name, # type: str + file_system_name, # type: str + credential, # type: Union[str, UserDelegationKey] + permission=None, # type: Optional[Union[FileSystemSasPermissions, str]] + expiry=None, # type: Optional[Union[datetime, str]] + *, + sts_hook=None, # type: Optional[Callable[[str], None]] + **kwargs # type: Any +): # type: (...) -> str """Generates a shared access signature for a file system. @@ -182,6 +191,10 @@ def generate_file_system_sas( generating and distributing the SAS. :keyword str encryption_scope: Specifies the encryption scope for a request made so that all write operations will be service encrypted. + :keyword sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :paramtype sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str """ @@ -192,18 +205,22 @@ def generate_file_system_sas( user_delegation_key=credential if not isinstance(credential, str) else None, permission=permission, expiry=expiry, - **kwargs) + sts_hook=sts_hook, + **kwargs + ) def generate_directory_sas( - account_name, # type: str - file_system_name, # type: str - directory_name, # type: str - credential, # type: Union[str, UserDelegationKey] - permission=None, # type: Optional[Union[DirectorySasPermissions, str]] - expiry=None, # type: Optional[Union[datetime, str]] - **kwargs # type: Any - ): + account_name, # type: str + file_system_name, # type: str + directory_name, # type: str + credential, # type: Union[str, UserDelegationKey] + permission=None, # type: Optional[Union[DirectorySasPermissions, str]] + expiry=None, # type: Optional[Union[datetime, str]] + *, + sts_hook=None, # type: Optional[Callable[[str], None]] + **kwargs # type: Any +): # type: (...) -> str """Generates a shared access signature for a directory. @@ -289,6 +306,10 @@ def generate_directory_sas( generating and distributing the SAS. :keyword str encryption_scope: Specifies the encryption scope for a request made so that all write operations will be service encrypted. + :keyword sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :paramtype sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str """ @@ -303,19 +324,23 @@ def generate_directory_sas( expiry=expiry, sdd=depth, is_directory=True, - **kwargs) + sts_hook=sts_hook, + **kwargs + ) def generate_file_sas( - account_name, # type: str - file_system_name, # type: str - directory_name, # type: str - file_name, # type: str - credential, # type: Union[str, UserDelegationKey] - permission=None, # type: Optional[Union[FileSasPermissions, str]] - expiry=None, # type: Optional[Union[datetime, str]] - **kwargs # type: Any - ): + account_name, # type: str + file_system_name, # type: str + directory_name, # type: str + file_name, # type: str + credential, # type: Union[str, UserDelegationKey] + permission=None, # type: Optional[Union[FileSasPermissions, str]] + expiry=None, # type: Optional[Union[datetime, str]] + *, + sts_hook=None, # type: Optional[Callable[[str], None]] + **kwargs # type: Any +): # type: (...) -> str """Generates a shared access signature for a file. @@ -403,6 +428,10 @@ def generate_file_sas( generating and distributing the SAS. This can only be used when generating a SAS with delegation key. :keyword str encryption_scope: Specifies the encryption scope for a request made so that all write operations will be service encrypted. + :keyword sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :paramtype sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str """ @@ -418,7 +447,9 @@ def generate_file_sas( user_delegation_key=credential if not isinstance(credential, str) else None, permission=permission, expiry=expiry, - **kwargs) + sts_hook=sts_hook, + **kwargs + ) def _is_credential_sastoken(credential: Any) -> bool: if not credential or not isinstance(credential, str): diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_version.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_version.py index 75c4fa39d53ff..64bfa0b4f1ab6 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_version.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_version.py @@ -4,4 +4,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "12.17.0b1" +VERSION = "12.17.0" diff --git a/sdk/storage/azure-storage-file-datalake/setup.py b/sdk/storage/azure-storage-file-datalake/setup.py index c9e595af8482c..19462196b4587 100644 --- a/sdk/storage/azure-storage-file-datalake/setup.py +++ b/sdk/storage/azure-storage-file-datalake/setup.py @@ -57,7 +57,7 @@ url='https://github.com/Azure/azure-sdk-for-python', keywords="azure, azure sdk", classifiers=[ - 'Development Status :: 4 - Beta', + 'Development Status :: 5 - Production/Stable', 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3', @@ -77,14 +77,14 @@ ]), python_requires=">=3.8", install_requires=[ - "azure-core>=1.28.0", - "azure-storage-blob>=12.22.0", + "azure-core>=1.30.0", + "azure-storage-blob>=12.23.0", "typing-extensions>=4.6.0", "isodate>=0.6.1" ], extras_require={ "aio": [ - "azure-core[aio]>=1.28.0", + "azure-core[aio]>=1.30.0", ], }, ) diff --git a/sdk/storage/azure-storage-file-share/CHANGELOG.md b/sdk/storage/azure-storage-file-share/CHANGELOG.md index 5da614dd5e02f..a267a6f7ac7cc 100644 --- a/sdk/storage/azure-storage-file-share/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-share/CHANGELOG.md @@ -1,10 +1,24 @@ # Release History -## 12.18.0b1 (Unreleased) +## 12.18.0 (Unreleased) ### Features Added +## 12.18.0b1 (2024-08-07) + +### Features Added +- Added support for service version 2024-11-04. +- Added support for Entra ID authentication for all data plane file operations that were previously not enabled. +- Added support to set `paid_bursting_enabled`, `paid_bursting_bandwidth_mibps`, and `paid_bursting_iops` for Share's +`create_share` and `set_share_properties` APIs, and also retrieve them on the `get_share_properties` API. +- Added `file_permission_format` to specify permission format for Share's `create_permission_for_share` and +`get_permission_for_share` APIs; File's `create_file`, `rename_file`, and `set_http_headers` APIs; and +Directory's `rename_directory` and `set_http_headers` APIs. + +### Other Changes +- Bumped minimum `azure-core` dependency to 1.30.0. + ## 12.17.0 (2024-07-18) ### Features Added diff --git a/sdk/storage/azure-storage-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json index dc4e8ec6406e7..f3eba605543df 100644 --- a/sdk/storage/azure-storage-file-share/assets.json +++ b/sdk/storage/azure-storage-file-share/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-file-share", - "Tag": "python/storage/azure-storage-file-share_d41363cb87" + "Tag": "python/storage/azure-storage-file-share_b797b17048" } diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py index 9be9254bac66e..1ea203f8565bb 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py @@ -341,6 +341,9 @@ def create_directory(self, **kwargs): :keyword str file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the file-permission or file-permission-key should be specified. + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :keyword file_change_time: Change time for the directory. If not specified, change time will be set to the current date/time. @@ -463,6 +466,9 @@ def rename_directory( :keyword str file_permission_key: Key of the permission to be set for the directory. Note: Only one of the file-permission or file-permission-key should be specified. + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :keyword file_attributes: The file system attributes for the directory. :paramtype file_attributes: ~azure.storage.fileshare.NTFSAttributes or str @@ -820,6 +826,9 @@ def set_http_headers(self, file_attributes="none", # type: Union[str, NTFSAttri directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. :type permission_key: str + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :keyword file_change_time: Change time for the directory. If not specified, change time will be set to the current date/time. diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py index b39f62de421f1..9b056f8df555d 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py @@ -425,6 +425,9 @@ def create_file( # type: ignore directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. :type permission_key: str + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :keyword file_change_time: Change time for the file. If not specified, change time will be set to the current date/time. @@ -969,6 +972,9 @@ def rename_file( :keyword str file_permission_key: Key of the permission to be set for the file. Note: Only one of the file-permission or file-permission-key should be specified. + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :keyword file_attributes: The file system attributes for the file. :paramtype file_attributes: ~azure.storage.fileshare.NTFSAttributes or str @@ -1134,6 +1140,9 @@ def set_http_headers(self, content_settings, # type: ContentSettings directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. :type permission_key: str + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :keyword file_change_time: Change time for the file. If not specified, change time will be set to the current date/time. diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py index aac0adcdceeca..f8ac462835363 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py @@ -44,7 +44,7 @@ class AzureFileStorage: # pylint: disable=client-accepts-api-version-keyword URI. Default value is None. :type allow_source_trailing_dot: bool :keyword version: Specifies the version of the operation to use for this request. Default value - is "2024-08-04". Note that overriding this default value may result in unsupported behavior. + is "2024-11-04". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. Default value is "update". Note that diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py index 54aea03421110..7ebbda623a2e0 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py @@ -33,7 +33,7 @@ class AzureFileStorageConfiguration: # pylint: disable=too-many-instance-attrib URI. Default value is None. :type allow_source_trailing_dot: bool :keyword version: Specifies the version of the operation to use for this request. Default value - is "2024-08-04". Note that overriding this default value may result in unsupported behavior. + is "2024-11-04". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. Default value is "update". Note that @@ -49,7 +49,7 @@ def __init__( allow_source_trailing_dot: Optional[bool] = None, **kwargs: Any ) -> None: - version: Literal["2024-08-04"] = kwargs.pop("version", "2024-08-04") + version: Literal["2024-11-04"] = kwargs.pop("version", "2024-11-04") file_range_write_from_url: Literal["update"] = kwargs.pop("file_range_write_from_url", "update") if url is None: diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py index 46b977e4d5793..8dd1300ab7ffb 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py @@ -44,7 +44,7 @@ class AzureFileStorage: # pylint: disable=client-accepts-api-version-keyword URI. Default value is None. :type allow_source_trailing_dot: bool :keyword version: Specifies the version of the operation to use for this request. Default value - is "2024-08-04". Note that overriding this default value may result in unsupported behavior. + is "2024-11-04". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. Default value is "update". Note that diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py index a71a8e74cfb82..694f5fa8a193b 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py @@ -33,7 +33,7 @@ class AzureFileStorageConfiguration: # pylint: disable=too-many-instance-attrib URI. Default value is None. :type allow_source_trailing_dot: bool :keyword version: Specifies the version of the operation to use for this request. Default value - is "2024-08-04". Note that overriding this default value may result in unsupported behavior. + is "2024-11-04". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. Default value is "update". Note that @@ -49,7 +49,7 @@ def __init__( allow_source_trailing_dot: Optional[bool] = None, **kwargs: Any ) -> None: - version: Literal["2024-08-04"] = kwargs.pop("version", "2024-08-04") + version: Literal["2024-11-04"] = kwargs.pop("version", "2024-11-04") file_range_write_from_url: Literal["update"] = kwargs.pop("file_range_write_from_url", "update") if url is None: diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py index 2877ddb3fa110..538d7f3b0d973 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py @@ -70,6 +70,7 @@ async def create( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, file_attributes: str = "none", file_creation_time: str = "now", @@ -93,6 +94,13 @@ async def create( # pylint: disable=inconsistent-return-statements input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None. @@ -133,6 +141,7 @@ async def create( # pylint: disable=inconsistent-return-statements timeout=timeout, metadata=metadata, file_permission=file_permission, + file_permission_format=file_permission_format, file_permission_key=file_permission_key, file_attributes=file_attributes, file_creation_time=file_creation_time, @@ -349,6 +358,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, file_attributes: str = "none", file_creation_time: str = "now", @@ -369,6 +379,13 @@ async def set_properties( # pylint: disable=inconsistent-return-statements input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None. @@ -409,6 +426,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements url=self._config.url, timeout=timeout, file_permission=file_permission, + file_permission_format=file_permission_format, file_permission_key=file_permission_key, file_attributes=file_attributes, file_creation_time=file_creation_time, @@ -836,6 +854,7 @@ async def rename( # pylint: disable=inconsistent-return-statements replace_if_exists: Optional[bool] = None, ignore_read_only: Optional[bool] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, source_lease_access_conditions: Optional[_models.SourceLeaseAccessConditions] = None, @@ -871,6 +890,13 @@ async def rename( # pylint: disable=inconsistent-return-statements input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None. @@ -934,6 +960,7 @@ async def rename( # pylint: disable=inconsistent-return-statements file_last_write_time=_file_last_write_time, file_change_time=_file_change_time, file_permission=file_permission, + file_permission_format=file_permission_format, file_permission_key=file_permission_key, metadata=metadata, allow_trailing_dot=self._config.allow_trailing_dot, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py index 8aa0012fd84a4..2be57bdc00d6c 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py @@ -80,6 +80,7 @@ async def create( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, file_attributes: str = "none", file_creation_time: str = "now", @@ -107,6 +108,13 @@ async def create( # pylint: disable=inconsistent-return-statements input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None. @@ -175,6 +183,7 @@ async def create( # pylint: disable=inconsistent-return-statements file_content_disposition=_file_content_disposition, metadata=metadata, file_permission=file_permission, + file_permission_format=file_permission_format, file_permission_key=file_permission_key, file_attributes=file_attributes, file_creation_time=file_creation_time, @@ -633,6 +642,7 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, file_content_length: Optional[int] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, file_attributes: str = "none", file_creation_time: str = "now", @@ -659,6 +669,13 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None. @@ -726,6 +743,7 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements file_content_md5=_file_content_md5, file_content_disposition=_file_content_disposition, file_permission=file_permission, + file_permission_format=file_permission_format, file_permission_key=file_permission_key, file_attributes=file_attributes, file_creation_time=file_creation_time, @@ -1965,6 +1983,7 @@ async def rename( # pylint: disable=inconsistent-return-statements replace_if_exists: Optional[bool] = None, ignore_read_only: Optional[bool] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, source_lease_access_conditions: Optional[_models.SourceLeaseAccessConditions] = None, @@ -2001,6 +2020,13 @@ async def rename( # pylint: disable=inconsistent-return-statements input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None. @@ -2068,6 +2094,7 @@ async def rename( # pylint: disable=inconsistent-return-statements file_last_write_time=_file_last_write_time, file_change_time=_file_change_time, file_permission=file_permission, + file_permission_format=file_permission_format, file_permission_key=file_permission_key, metadata=metadata, file_content_type=_file_content_type, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py index 82b5d5681cc2c..e6cc22728183d 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py @@ -97,6 +97,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements _request = build_set_properties_request( url=self._config.url, timeout=timeout, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, content_type=content_type, @@ -159,6 +160,7 @@ async def get_properties(self, timeout: Optional[int] = None, **kwargs: Any) -> _request = build_get_properties_request( url=self._config.url, timeout=timeout, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, @@ -249,6 +251,7 @@ async def list_shares_segment( maxresults=maxresults, include=include, timeout=timeout, + file_request_intent=self._config.file_request_intent, comp=comp, version=self._config.version, headers=_headers, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py index bb89d8fb19c1e..4540e926b6c3d 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py @@ -83,6 +83,9 @@ async def create( # pylint: disable=inconsistent-return-statements enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, enable_snapshot_virtual_directory_access: Optional[bool] = None, + paid_bursting_enabled: Optional[bool] = None, + paid_bursting_max_bandwidth_mibps: Optional[int] = None, + paid_bursting_max_iops: Optional[int] = None, **kwargs: Any ) -> None: """Creates a new share under the specified account. If the share with the same name already @@ -108,6 +111,17 @@ async def create( # pylint: disable=inconsistent-return-statements :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash :param enable_snapshot_virtual_directory_access: Default value is None. :type enable_snapshot_virtual_directory_access: bool + :param paid_bursting_enabled: Optional. Boolean. Default if not specified is false. This + property enables paid bursting. Default value is None. + :type paid_bursting_enabled: bool + :param paid_bursting_max_bandwidth_mibps: Optional. Integer. Default if not specified is the + maximum throughput the file share can support. Current maximum for a file share is 10,340 + MiB/sec. Default value is None. + :type paid_bursting_max_bandwidth_mibps: int + :param paid_bursting_max_iops: Optional. Integer. Default if not specified is the maximum IOPS + the file share can support. Current maximum for a file share is 102,400 IOPS. Default value is + None. + :type paid_bursting_max_iops: int :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -135,6 +149,10 @@ async def create( # pylint: disable=inconsistent-return-statements enabled_protocols=enabled_protocols, root_squash=root_squash, enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, + paid_bursting_enabled=paid_bursting_enabled, + paid_bursting_max_bandwidth_mibps=paid_bursting_max_bandwidth_mibps, + paid_bursting_max_iops=paid_bursting_max_iops, + file_request_intent=self._config.file_request_intent, restype=restype, version=self._config.version, headers=_headers, @@ -213,6 +231,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements sharesnapshot=sharesnapshot, timeout=timeout, lease_id=_lease_id, + file_request_intent=self._config.file_request_intent, restype=restype, version=self._config.version, headers=_headers, @@ -273,6 +292,15 @@ async def get_properties( # pylint: disable=inconsistent-return-statements response_headers["x-ms-enable-snapshot-virtual-directory-access"] = self._deserialize( "bool", response.headers.get("x-ms-enable-snapshot-virtual-directory-access") ) + response_headers["x-ms-share-paid-bursting-enabled"] = self._deserialize( + "bool", response.headers.get("x-ms-share-paid-bursting-enabled") + ) + response_headers["x-ms-share-paid-bursting-max-iops"] = self._deserialize( + "int", response.headers.get("x-ms-share-paid-bursting-max-iops") + ) + response_headers["x-ms-share-paid-bursting-max-bandwidth-mibps"] = self._deserialize( + "int", response.headers.get("x-ms-share-paid-bursting-max-bandwidth-mibps") + ) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -330,6 +358,7 @@ async def delete( # pylint: disable=inconsistent-return-statements timeout=timeout, delete_snapshots=delete_snapshots, lease_id=_lease_id, + file_request_intent=self._config.file_request_intent, restype=restype, version=self._config.version, headers=_headers, @@ -418,6 +447,7 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements proposed_lease_id=proposed_lease_id, sharesnapshot=sharesnapshot, request_id_parameter=request_id_parameter, + file_request_intent=self._config.file_request_intent, comp=comp, action=action, restype=restype, @@ -506,6 +536,7 @@ async def release_lease( # pylint: disable=inconsistent-return-statements timeout=timeout, sharesnapshot=sharesnapshot, request_id_parameter=request_id_parameter, + file_request_intent=self._config.file_request_intent, comp=comp, action=action, restype=restype, @@ -599,6 +630,7 @@ async def change_lease( # pylint: disable=inconsistent-return-statements proposed_lease_id=proposed_lease_id, sharesnapshot=sharesnapshot, request_id_parameter=request_id_parameter, + file_request_intent=self._config.file_request_intent, comp=comp, action=action, restype=restype, @@ -687,6 +719,7 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements timeout=timeout, sharesnapshot=sharesnapshot, request_id_parameter=request_id_parameter, + file_request_intent=self._config.file_request_intent, comp=comp, action=action, restype=restype, @@ -789,6 +822,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements lease_id=_lease_id, request_id_parameter=request_id_parameter, sharesnapshot=sharesnapshot, + file_request_intent=self._config.file_request_intent, comp=comp, action=action, restype=restype, @@ -863,6 +897,7 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements url=self._config.url, timeout=timeout, metadata=metadata, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, @@ -1030,12 +1065,23 @@ async def create_permission( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def get_permission( - self, file_permission_key: str, timeout: Optional[int] = None, **kwargs: Any + self, + file_permission_key: str, + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, + timeout: Optional[int] = None, + **kwargs: Any ) -> _models.SharePermission: """Returns the permission (security descriptor) for a given key. :param file_permission_key: Key of the permission to be set for the directory/file. Required. :type file_permission_key: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1063,6 +1109,7 @@ async def get_permission( _request = build_get_permission_request( url=self._config.url, file_permission_key=file_permission_key, + file_permission_format=file_permission_format, timeout=timeout, file_request_intent=self._config.file_request_intent, restype=restype, @@ -1106,6 +1153,9 @@ async def set_properties( # pylint: disable=inconsistent-return-statements access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, enable_snapshot_virtual_directory_access: Optional[bool] = None, + paid_bursting_enabled: Optional[bool] = None, + paid_bursting_max_bandwidth_mibps: Optional[int] = None, + paid_bursting_max_iops: Optional[int] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: @@ -1126,6 +1176,17 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash :param enable_snapshot_virtual_directory_access: Default value is None. :type enable_snapshot_virtual_directory_access: bool + :param paid_bursting_enabled: Optional. Boolean. Default if not specified is false. This + property enables paid bursting. Default value is None. + :type paid_bursting_enabled: bool + :param paid_bursting_max_bandwidth_mibps: Optional. Integer. Default if not specified is the + maximum throughput the file share can support. Current maximum for a file share is 10,340 + MiB/sec. Default value is None. + :type paid_bursting_max_bandwidth_mibps: int + :param paid_bursting_max_iops: Optional. Integer. Default if not specified is the maximum IOPS + the file share can support. Current maximum for a file share is 102,400 IOPS. Default value is + None. + :type paid_bursting_max_iops: int :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :return: None or the result of cls(response) @@ -1159,6 +1220,10 @@ async def set_properties( # pylint: disable=inconsistent-return-statements lease_id=_lease_id, root_squash=root_squash, enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, + paid_bursting_enabled=paid_bursting_enabled, + paid_bursting_max_bandwidth_mibps=paid_bursting_max_bandwidth_mibps, + paid_bursting_max_iops=paid_bursting_max_iops, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, @@ -1238,6 +1303,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements timeout=timeout, metadata=metadata, lease_id=_lease_id, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, @@ -1312,6 +1378,7 @@ async def get_access_policy( url=self._config.url, timeout=timeout, lease_id=_lease_id, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, @@ -1401,6 +1468,7 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements url=self._config.url, timeout=timeout, lease_id=_lease_id, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, content_type=content_type, @@ -1477,6 +1545,7 @@ async def get_statistics( url=self._config.url, timeout=timeout, lease_id=_lease_id, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, @@ -1563,6 +1632,7 @@ async def restore( # pylint: disable=inconsistent-return-statements request_id_parameter=request_id_parameter, deleted_share_name=deleted_share_name, deleted_share_version=deleted_share_version, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/__init__.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/__init__.py index 111a6ed2932ae..edf7a957c677e 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/__init__.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/__init__.py @@ -43,6 +43,7 @@ from ._azure_file_storage_enums import CopyStatusType from ._azure_file_storage_enums import DeleteSnapshotsOptionType from ._azure_file_storage_enums import FileLastWrittenMode +from ._azure_file_storage_enums import FilePermissionFormat from ._azure_file_storage_enums import FileRangeWriteType from ._azure_file_storage_enums import LeaseDurationType from ._azure_file_storage_enums import LeaseStateType @@ -95,6 +96,7 @@ "CopyStatusType", "DeleteSnapshotsOptionType", "FileLastWrittenMode", + "FilePermissionFormat", "FileRangeWriteType", "LeaseDurationType", "LeaseStateType", diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py index c92ebe7add487..72de9b03134e1 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py @@ -41,6 +41,13 @@ class FileLastWrittenMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): PRESERVE = "Preserve" +class FilePermissionFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """FilePermissionFormat.""" + + SDDL = "Sddl" + BINARY = "Binary" + + class FileRangeWriteType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """FileRangeWriteType.""" diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py index 7f283d0dadcf9..d31101cef6484 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py @@ -1175,6 +1175,8 @@ class SharePermission(_serialization.Model): :ivar permission: The permission in the Security Descriptor Definition Language (SDDL). Required. :vartype permission: str + :ivar format: Known values are: "Sddl" and "Binary". + :vartype format: str or ~azure.storage.fileshare.models.FilePermissionFormat """ _validation = { @@ -1183,16 +1185,22 @@ class SharePermission(_serialization.Model): _attribute_map = { "permission": {"key": "permission", "type": "str"}, + "format": {"key": "format", "type": "str"}, } - def __init__(self, *, permission: str, **kwargs: Any) -> None: + def __init__( + self, *, permission: str, format: Optional[Union[str, "_models.FilePermissionFormat"]] = None, **kwargs: Any + ) -> None: """ :keyword permission: The permission in the Security Descriptor Definition Language (SDDL). Required. :paramtype permission: str + :keyword format: Known values are: "Sddl" and "Binary". + :paramtype format: str or ~azure.storage.fileshare.models.FilePermissionFormat """ super().__init__(**kwargs) self.permission = permission + self.format = format class SharePropertiesInternal(_serialization.Model): # pylint: disable=too-many-instance-attributes @@ -1241,6 +1249,12 @@ class SharePropertiesInternal(_serialization.Model): # pylint: disable=too-many :vartype root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash :ivar enable_snapshot_virtual_directory_access: :vartype enable_snapshot_virtual_directory_access: bool + :ivar paid_bursting_enabled: + :vartype paid_bursting_enabled: bool + :ivar paid_bursting_max_iops: + :vartype paid_bursting_max_iops: int + :ivar paid_bursting_max_bandwidth_mibps: + :vartype paid_bursting_max_bandwidth_mibps: int """ _validation = { @@ -1269,6 +1283,9 @@ class SharePropertiesInternal(_serialization.Model): # pylint: disable=too-many "enabled_protocols": {"key": "EnabledProtocols", "type": "str"}, "root_squash": {"key": "RootSquash", "type": "str"}, "enable_snapshot_virtual_directory_access": {"key": "EnableSnapshotVirtualDirectoryAccess", "type": "bool"}, + "paid_bursting_enabled": {"key": "PaidBurstingEnabled", "type": "bool"}, + "paid_bursting_max_iops": {"key": "PaidBurstingMaxIops", "type": "int"}, + "paid_bursting_max_bandwidth_mibps": {"key": "PaidBurstingMaxBandwidthMibps", "type": "int"}, } def __init__( @@ -1293,6 +1310,9 @@ def __init__( enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, "_models.ShareRootSquash"]] = None, enable_snapshot_virtual_directory_access: Optional[bool] = None, + paid_bursting_enabled: Optional[bool] = None, + paid_bursting_max_iops: Optional[int] = None, + paid_bursting_max_bandwidth_mibps: Optional[int] = None, **kwargs: Any ) -> None: """ @@ -1337,6 +1357,12 @@ def __init__( :paramtype root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash :keyword enable_snapshot_virtual_directory_access: :paramtype enable_snapshot_virtual_directory_access: bool + :keyword paid_bursting_enabled: + :paramtype paid_bursting_enabled: bool + :keyword paid_bursting_max_iops: + :paramtype paid_bursting_max_iops: int + :keyword paid_bursting_max_bandwidth_mibps: + :paramtype paid_bursting_max_bandwidth_mibps: int """ super().__init__(**kwargs) self.last_modified = last_modified @@ -1358,6 +1384,9 @@ def __init__( self.enabled_protocols = enabled_protocols self.root_squash = root_squash self.enable_snapshot_virtual_directory_access = enable_snapshot_virtual_directory_access + self.paid_bursting_enabled = paid_bursting_enabled + self.paid_bursting_max_iops = paid_bursting_max_iops + self.paid_bursting_max_bandwidth_mibps = paid_bursting_max_bandwidth_mibps class ShareProtocolSettings(_serialization.Model): diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py index 52e76948e0269..070a3c0278372 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py @@ -44,6 +44,7 @@ def build_create_request( timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, file_attributes: str = "none", file_creation_time: str = "now", @@ -57,7 +58,7 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -81,6 +82,10 @@ def build_create_request( _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if file_permission is not None: _headers["x-ms-file-permission"] = _SERIALIZER.header("file_permission", file_permission, "str") + if file_permission_format is not None: + _headers["x-ms-file-permission-format"] = _SERIALIZER.header( + "file_permission_format", file_permission_format, "str" + ) if file_permission_key is not None: _headers["x-ms-file-permission-key"] = _SERIALIZER.header("file_permission_key", file_permission_key, "str") _headers["x-ms-file-attributes"] = _SERIALIZER.header("file_attributes", file_attributes, "str") @@ -110,7 +115,7 @@ def build_get_properties_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -151,7 +156,7 @@ def build_delete_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -183,6 +188,7 @@ def build_set_properties_request( *, timeout: Optional[int] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, file_attributes: str = "none", file_creation_time: str = "now", @@ -197,7 +203,7 @@ def build_set_properties_request( restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -218,6 +224,10 @@ def build_set_properties_request( _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if file_permission is not None: _headers["x-ms-file-permission"] = _SERIALIZER.header("file_permission", file_permission, "str") + if file_permission_format is not None: + _headers["x-ms-file-permission-format"] = _SERIALIZER.header( + "file_permission_format", file_permission_format, "str" + ) if file_permission_key is not None: _headers["x-ms-file-permission-key"] = _SERIALIZER.header("file_permission_key", file_permission_key, "str") _headers["x-ms-file-attributes"] = _SERIALIZER.header("file_attributes", file_attributes, "str") @@ -250,7 +260,7 @@ def build_set_metadata_request( restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -299,7 +309,7 @@ def build_list_files_and_directories_segment_request( # pylint: disable=name-to restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -355,7 +365,7 @@ def build_list_handles_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["listhandles"] = kwargs.pop("comp", _params.pop("comp", "listhandles")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -406,7 +416,7 @@ def build_force_close_handles_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["forceclosehandles"] = kwargs.pop("comp", _params.pop("comp", "forceclosehandles")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -454,6 +464,7 @@ def build_rename_request( file_last_write_time: Optional[str] = None, file_change_time: Optional[str] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, allow_trailing_dot: Optional[bool] = None, @@ -466,7 +477,7 @@ def build_rename_request( restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) comp: Literal["rename"] = kwargs.pop("comp", _params.pop("comp", "rename")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -506,6 +517,10 @@ def build_rename_request( _headers["x-ms-file-change-time"] = _SERIALIZER.header("file_change_time", file_change_time, "str") if file_permission is not None: _headers["x-ms-file-permission"] = _SERIALIZER.header("file_permission", file_permission, "str") + if file_permission_format is not None: + _headers["x-ms-file-permission-format"] = _SERIALIZER.header( + "file_permission_format", file_permission_format, "str" + ) if file_permission_key is not None: _headers["x-ms-file-permission-key"] = _SERIALIZER.header("file_permission_key", file_permission_key, "str") if metadata is not None: @@ -548,6 +563,7 @@ def create( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, file_attributes: str = "none", file_creation_time: str = "now", @@ -571,6 +587,13 @@ def create( # pylint: disable=inconsistent-return-statements input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None. @@ -611,6 +634,7 @@ def create( # pylint: disable=inconsistent-return-statements timeout=timeout, metadata=metadata, file_permission=file_permission, + file_permission_format=file_permission_format, file_permission_key=file_permission_key, file_attributes=file_attributes, file_creation_time=file_creation_time, @@ -827,6 +851,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, file_attributes: str = "none", file_creation_time: str = "now", @@ -847,6 +872,13 @@ def set_properties( # pylint: disable=inconsistent-return-statements input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None. @@ -887,6 +919,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements url=self._config.url, timeout=timeout, file_permission=file_permission, + file_permission_format=file_permission_format, file_permission_key=file_permission_key, file_attributes=file_attributes, file_creation_time=file_creation_time, @@ -1314,6 +1347,7 @@ def rename( # pylint: disable=inconsistent-return-statements replace_if_exists: Optional[bool] = None, ignore_read_only: Optional[bool] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, source_lease_access_conditions: Optional[_models.SourceLeaseAccessConditions] = None, @@ -1349,6 +1383,13 @@ def rename( # pylint: disable=inconsistent-return-statements input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None. @@ -1412,6 +1453,7 @@ def rename( # pylint: disable=inconsistent-return-statements file_last_write_time=_file_last_write_time, file_change_time=_file_change_time, file_permission=file_permission, + file_permission_format=file_permission_format, file_permission_key=file_permission_key, metadata=metadata, allow_trailing_dot=self._config.allow_trailing_dot, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py index a26b1206aa0a3..94a72d63c9231 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py @@ -51,6 +51,7 @@ def build_create_request( file_content_disposition: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, file_attributes: str = "none", file_creation_time: str = "now", @@ -65,7 +66,7 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) file_type_constant: Literal["file"] = kwargs.pop("file_type_constant", _headers.pop("x-ms-type", "file")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -104,6 +105,10 @@ def build_create_request( _headers["x-ms-meta"] = _SERIALIZER.header("metadata", metadata, "{str}") if file_permission is not None: _headers["x-ms-file-permission"] = _SERIALIZER.header("file_permission", file_permission, "str") + if file_permission_format is not None: + _headers["x-ms-file-permission-format"] = _SERIALIZER.header( + "file_permission_format", file_permission_format, "str" + ) if file_permission_key is not None: _headers["x-ms-file-permission-key"] = _SERIALIZER.header("file_permission_key", file_permission_key, "str") _headers["x-ms-file-attributes"] = _SERIALIZER.header("file_attributes", file_attributes, "str") @@ -136,7 +141,7 @@ def build_download_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -183,7 +188,7 @@ def build_get_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -225,7 +230,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -265,6 +270,7 @@ def build_set_http_headers_request( file_content_md5: Optional[bytes] = None, file_content_disposition: Optional[str] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, file_attributes: str = "none", file_creation_time: str = "now", @@ -279,7 +285,7 @@ def build_set_http_headers_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -315,6 +321,10 @@ def build_set_http_headers_request( ) if file_permission is not None: _headers["x-ms-file-permission"] = _SERIALIZER.header("file_permission", file_permission, "str") + if file_permission_format is not None: + _headers["x-ms-file-permission-format"] = _SERIALIZER.header( + "file_permission_format", file_permission_format, "str" + ) if file_permission_key is not None: _headers["x-ms-file-permission-key"] = _SERIALIZER.header("file_permission_key", file_permission_key, "str") _headers["x-ms-file-attributes"] = _SERIALIZER.header("file_attributes", file_attributes, "str") @@ -349,7 +359,7 @@ def build_set_metadata_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -396,7 +406,7 @@ def build_acquire_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -445,7 +455,7 @@ def build_release_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -492,7 +502,7 @@ def build_change_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -540,7 +550,7 @@ def build_break_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -592,7 +602,7 @@ def build_upload_range_request( comp: Literal["range"] = kwargs.pop("comp", _params.pop("comp", "range")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -658,7 +668,7 @@ def build_upload_range_from_url_request( file_range_write_from_url: Literal["update"] = kwargs.pop( "file_range_write_from_url", _headers.pop("x-ms-write", "update") ) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -734,7 +744,7 @@ def build_get_range_list_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["rangelist"] = kwargs.pop("comp", _params.pop("comp", "rangelist")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -795,7 +805,7 @@ def build_start_copy_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -869,7 +879,7 @@ def build_abort_copy_request( copy_action_abort_constant: Literal["abort"] = kwargs.pop( "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") ) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -915,7 +925,7 @@ def build_list_handles_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["listhandles"] = kwargs.pop("comp", _params.pop("comp", "listhandles")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -963,7 +973,7 @@ def build_force_close_handles_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["forceclosehandles"] = kwargs.pop("comp", _params.pop("comp", "forceclosehandles")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1009,6 +1019,7 @@ def build_rename_request( file_last_write_time: Optional[str] = None, file_change_time: Optional[str] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, file_content_type: Optional[str] = None, @@ -1021,7 +1032,7 @@ def build_rename_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["rename"] = kwargs.pop("comp", _params.pop("comp", "rename")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1060,6 +1071,10 @@ def build_rename_request( _headers["x-ms-file-change-time"] = _SERIALIZER.header("file_change_time", file_change_time, "str") if file_permission is not None: _headers["x-ms-file-permission"] = _SERIALIZER.header("file_permission", file_permission, "str") + if file_permission_format is not None: + _headers["x-ms-file-permission-format"] = _SERIALIZER.header( + "file_permission_format", file_permission_format, "str" + ) if file_permission_key is not None: _headers["x-ms-file-permission-key"] = _SERIALIZER.header("file_permission_key", file_permission_key, "str") if metadata is not None: @@ -1105,6 +1120,7 @@ def create( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, file_attributes: str = "none", file_creation_time: str = "now", @@ -1132,6 +1148,13 @@ def create( # pylint: disable=inconsistent-return-statements input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None. @@ -1200,6 +1223,7 @@ def create( # pylint: disable=inconsistent-return-statements file_content_disposition=_file_content_disposition, metadata=metadata, file_permission=file_permission, + file_permission_format=file_permission_format, file_permission_key=file_permission_key, file_attributes=file_attributes, file_creation_time=file_creation_time, @@ -1658,6 +1682,7 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, file_content_length: Optional[int] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, file_attributes: str = "none", file_creation_time: str = "now", @@ -1684,6 +1709,13 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None. @@ -1751,6 +1783,7 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements file_content_md5=_file_content_md5, file_content_disposition=_file_content_disposition, file_permission=file_permission, + file_permission_format=file_permission_format, file_permission_key=file_permission_key, file_attributes=file_attributes, file_creation_time=file_creation_time, @@ -2990,6 +3023,7 @@ def rename( # pylint: disable=inconsistent-return-statements replace_if_exists: Optional[bool] = None, ignore_read_only: Optional[bool] = None, file_permission: str = "inherit", + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, file_permission_key: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, source_lease_access_conditions: Optional[_models.SourceLeaseAccessConditions] = None, @@ -3026,6 +3060,13 @@ def rename( # pylint: disable=inconsistent-return-statements input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value is None. @@ -3093,6 +3134,7 @@ def rename( # pylint: disable=inconsistent-return-statements file_last_write_time=_file_last_write_time, file_change_time=_file_change_time, file_permission=file_permission, + file_permission_format=file_permission_format, file_permission_key=file_permission_key, metadata=metadata, file_content_type=_file_content_type, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py index 7923f4cc5bcc6..2176120946666 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py @@ -39,7 +39,12 @@ def build_set_properties_request( - url: str, *, content: Any, timeout: Optional[int] = None, **kwargs: Any + url: str, + *, + content: Any, + timeout: Optional[int] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -47,7 +52,7 @@ def build_set_properties_request( restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -66,6 +71,8 @@ def build_set_properties_request( # Construct headers _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -73,13 +80,19 @@ def build_set_properties_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, content=content, **kwargs) -def build_get_properties_request(url: str, *, timeout: Optional[int] = None, **kwargs: Any) -> HttpRequest: +def build_get_properties_request( + url: str, + *, + timeout: Optional[int] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -98,6 +111,8 @@ def build_get_properties_request(url: str, *, timeout: Optional[int] = None, **k # Construct headers _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -111,13 +126,14 @@ def build_list_shares_segment_request( maxresults: Optional[int] = None, include: Optional[List[Union[str, _models.ListSharesIncludeType]]] = None, timeout: Optional[int] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -143,6 +159,8 @@ def build_list_shares_segment_request( # Construct headers _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -206,6 +224,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements _request = build_set_properties_request( url=self._config.url, timeout=timeout, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, content_type=content_type, @@ -268,6 +287,7 @@ def get_properties(self, timeout: Optional[int] = None, **kwargs: Any) -> _model _request = build_get_properties_request( url=self._config.url, timeout=timeout, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, @@ -358,6 +378,7 @@ def list_shares_segment( maxresults=maxresults, include=include, timeout=timeout, + file_request_intent=self._config.file_request_intent, comp=comp, version=self._config.version, headers=_headers, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py index 4f78e8fd55ff3..025ca1df7d942 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py @@ -49,13 +49,17 @@ def build_create_request( enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, enable_snapshot_virtual_directory_access: Optional[bool] = None, + paid_bursting_enabled: Optional[bool] = None, + paid_bursting_max_bandwidth_mibps: Optional[int] = None, + paid_bursting_max_iops: Optional[int] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -87,6 +91,20 @@ def build_create_request( _headers["x-ms-enable-snapshot-virtual-directory-access"] = _SERIALIZER.header( "enable_snapshot_virtual_directory_access", enable_snapshot_virtual_directory_access, "bool" ) + if paid_bursting_enabled is not None: + _headers["x-ms-share-paid-bursting-enabled"] = _SERIALIZER.header( + "paid_bursting_enabled", paid_bursting_enabled, "bool" + ) + if paid_bursting_max_bandwidth_mibps is not None: + _headers["x-ms-share-paid-bursting-max-bandwidth-mibps"] = _SERIALIZER.header( + "paid_bursting_max_bandwidth_mibps", paid_bursting_max_bandwidth_mibps, "int" + ) + if paid_bursting_max_iops is not None: + _headers["x-ms-share-paid-bursting-max-iops"] = _SERIALIZER.header( + "paid_bursting_max_iops", paid_bursting_max_iops, "int" + ) + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -98,13 +116,14 @@ def build_get_properties_request( sharesnapshot: Optional[str] = None, timeout: Optional[int] = None, lease_id: Optional[str] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -126,6 +145,8 @@ def build_get_properties_request( _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if lease_id is not None: _headers["x-ms-lease-id"] = _SERIALIZER.header("lease_id", lease_id, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -138,13 +159,14 @@ def build_delete_request( timeout: Optional[int] = None, delete_snapshots: Optional[Union[str, _models.DeleteSnapshotsOptionType]] = None, lease_id: Optional[str] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -168,6 +190,8 @@ def build_delete_request( _headers["x-ms-delete-snapshots"] = _SERIALIZER.header("delete_snapshots", delete_snapshots, "str") if lease_id is not None: _headers["x-ms-lease-id"] = _SERIALIZER.header("lease_id", lease_id, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) @@ -181,6 +205,7 @@ def build_acquire_lease_request( proposed_lease_id: Optional[str] = None, sharesnapshot: Optional[str] = None, request_id_parameter: Optional[str] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -189,7 +214,7 @@ def build_acquire_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -217,6 +242,8 @@ def build_acquire_lease_request( _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if request_id_parameter is not None: _headers["x-ms-client-request-id"] = _SERIALIZER.header("request_id_parameter", request_id_parameter, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -229,6 +256,7 @@ def build_release_lease_request( timeout: Optional[int] = None, sharesnapshot: Optional[str] = None, request_id_parameter: Optional[str] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -237,7 +265,7 @@ def build_release_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -262,6 +290,8 @@ def build_release_lease_request( _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if request_id_parameter is not None: _headers["x-ms-client-request-id"] = _SERIALIZER.header("request_id_parameter", request_id_parameter, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -275,6 +305,7 @@ def build_change_lease_request( proposed_lease_id: Optional[str] = None, sharesnapshot: Optional[str] = None, request_id_parameter: Optional[str] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -283,7 +314,7 @@ def build_change_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -310,6 +341,8 @@ def build_change_lease_request( _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if request_id_parameter is not None: _headers["x-ms-client-request-id"] = _SERIALIZER.header("request_id_parameter", request_id_parameter, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -322,6 +355,7 @@ def build_renew_lease_request( timeout: Optional[int] = None, sharesnapshot: Optional[str] = None, request_id_parameter: Optional[str] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -330,7 +364,7 @@ def build_renew_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -355,6 +389,8 @@ def build_renew_lease_request( _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if request_id_parameter is not None: _headers["x-ms-client-request-id"] = _SERIALIZER.header("request_id_parameter", request_id_parameter, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -368,6 +404,7 @@ def build_break_lease_request( lease_id: Optional[str] = None, request_id_parameter: Optional[str] = None, sharesnapshot: Optional[str] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -376,7 +413,7 @@ def build_break_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -404,20 +441,27 @@ def build_break_lease_request( _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if request_id_parameter is not None: _headers["x-ms-client-request-id"] = _SERIALIZER.header("request_id_parameter", request_id_parameter, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_create_snapshot_request( - url: str, *, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, **kwargs: Any + url: str, + *, + timeout: Optional[int] = None, + metadata: Optional[Dict[str, str]] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["snapshot"] = kwargs.pop("comp", _params.pop("comp", "snapshot")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -438,6 +482,8 @@ def build_create_snapshot_request( if metadata is not None: _headers["x-ms-meta"] = _SERIALIZER.header("metadata", metadata, "{str}") _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -456,7 +502,7 @@ def build_create_permission_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["filepermission"] = kwargs.pop("comp", _params.pop("comp", "filepermission")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -488,6 +534,7 @@ def build_get_permission_request( url: str, *, file_permission_key: str, + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, timeout: Optional[int] = None, file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any @@ -497,7 +544,7 @@ def build_get_permission_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["filepermission"] = kwargs.pop("comp", _params.pop("comp", "filepermission")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -516,6 +563,10 @@ def build_get_permission_request( # Construct headers _headers["x-ms-file-permission-key"] = _SERIALIZER.header("file_permission_key", file_permission_key, "str") + if file_permission_format is not None: + _headers["x-ms-file-permission-format"] = _SERIALIZER.header( + "file_permission_format", file_permission_format, "str" + ) _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if file_request_intent is not None: _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") @@ -533,6 +584,10 @@ def build_set_properties_request( lease_id: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, enable_snapshot_virtual_directory_access: Optional[bool] = None, + paid_bursting_enabled: Optional[bool] = None, + paid_bursting_max_bandwidth_mibps: Optional[int] = None, + paid_bursting_max_iops: Optional[int] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -540,7 +595,7 @@ def build_set_properties_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -571,6 +626,20 @@ def build_set_properties_request( _headers["x-ms-enable-snapshot-virtual-directory-access"] = _SERIALIZER.header( "enable_snapshot_virtual_directory_access", enable_snapshot_virtual_directory_access, "bool" ) + if paid_bursting_enabled is not None: + _headers["x-ms-share-paid-bursting-enabled"] = _SERIALIZER.header( + "paid_bursting_enabled", paid_bursting_enabled, "bool" + ) + if paid_bursting_max_bandwidth_mibps is not None: + _headers["x-ms-share-paid-bursting-max-bandwidth-mibps"] = _SERIALIZER.header( + "paid_bursting_max_bandwidth_mibps", paid_bursting_max_bandwidth_mibps, "int" + ) + if paid_bursting_max_iops is not None: + _headers["x-ms-share-paid-bursting-max-iops"] = _SERIALIZER.header( + "paid_bursting_max_iops", paid_bursting_max_iops, "int" + ) + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -582,6 +651,7 @@ def build_set_metadata_request( timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, lease_id: Optional[str] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -589,7 +659,7 @@ def build_set_metadata_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -612,20 +682,27 @@ def build_set_metadata_request( _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if lease_id is not None: _headers["x-ms-lease-id"] = _SERIALIZER.header("lease_id", lease_id, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_access_policy_request( - url: str, *, timeout: Optional[int] = None, lease_id: Optional[str] = None, **kwargs: Any + url: str, + *, + timeout: Optional[int] = None, + lease_id: Optional[str] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -646,13 +723,21 @@ def build_get_access_policy_request( _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if lease_id is not None: _headers["x-ms-lease-id"] = _SERIALIZER.header("lease_id", lease_id, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_set_access_policy_request( - url: str, *, timeout: Optional[int] = None, lease_id: Optional[str] = None, content: Any = None, **kwargs: Any + url: str, + *, + timeout: Optional[int] = None, + lease_id: Optional[str] = None, + content: Any = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -660,7 +745,7 @@ def build_set_access_policy_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -681,6 +766,8 @@ def build_set_access_policy_request( _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if lease_id is not None: _headers["x-ms-lease-id"] = _SERIALIZER.header("lease_id", lease_id, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -689,14 +776,19 @@ def build_set_access_policy_request( def build_get_statistics_request( - url: str, *, timeout: Optional[int] = None, lease_id: Optional[str] = None, **kwargs: Any + url: str, + *, + timeout: Optional[int] = None, + lease_id: Optional[str] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["stats"] = kwargs.pop("comp", _params.pop("comp", "stats")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -717,6 +809,8 @@ def build_get_statistics_request( _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") if lease_id is not None: _headers["x-ms-lease-id"] = _SERIALIZER.header("lease_id", lease_id, "str") + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -729,6 +823,7 @@ def build_restore_request( request_id_parameter: Optional[str] = None, deleted_share_name: Optional[str] = None, deleted_share_version: Optional[str] = None, + file_request_intent: Optional[Union[str, _models.ShareTokenIntent]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -736,7 +831,7 @@ def build_restore_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) - version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) + version: Literal["2024-11-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-11-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -763,6 +858,8 @@ def build_restore_request( _headers["x-ms-deleted-share-version"] = _SERIALIZER.header( "deleted_share_version", deleted_share_version, "str" ) + if file_request_intent is not None: + _headers["x-ms-file-request-intent"] = _SERIALIZER.header("file_request_intent", file_request_intent, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -797,6 +894,9 @@ def create( # pylint: disable=inconsistent-return-statements enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, enable_snapshot_virtual_directory_access: Optional[bool] = None, + paid_bursting_enabled: Optional[bool] = None, + paid_bursting_max_bandwidth_mibps: Optional[int] = None, + paid_bursting_max_iops: Optional[int] = None, **kwargs: Any ) -> None: """Creates a new share under the specified account. If the share with the same name already @@ -822,6 +922,17 @@ def create( # pylint: disable=inconsistent-return-statements :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash :param enable_snapshot_virtual_directory_access: Default value is None. :type enable_snapshot_virtual_directory_access: bool + :param paid_bursting_enabled: Optional. Boolean. Default if not specified is false. This + property enables paid bursting. Default value is None. + :type paid_bursting_enabled: bool + :param paid_bursting_max_bandwidth_mibps: Optional. Integer. Default if not specified is the + maximum throughput the file share can support. Current maximum for a file share is 10,340 + MiB/sec. Default value is None. + :type paid_bursting_max_bandwidth_mibps: int + :param paid_bursting_max_iops: Optional. Integer. Default if not specified is the maximum IOPS + the file share can support. Current maximum for a file share is 102,400 IOPS. Default value is + None. + :type paid_bursting_max_iops: int :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -849,6 +960,10 @@ def create( # pylint: disable=inconsistent-return-statements enabled_protocols=enabled_protocols, root_squash=root_squash, enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, + paid_bursting_enabled=paid_bursting_enabled, + paid_bursting_max_bandwidth_mibps=paid_bursting_max_bandwidth_mibps, + paid_bursting_max_iops=paid_bursting_max_iops, + file_request_intent=self._config.file_request_intent, restype=restype, version=self._config.version, headers=_headers, @@ -927,6 +1042,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements sharesnapshot=sharesnapshot, timeout=timeout, lease_id=_lease_id, + file_request_intent=self._config.file_request_intent, restype=restype, version=self._config.version, headers=_headers, @@ -987,6 +1103,15 @@ def get_properties( # pylint: disable=inconsistent-return-statements response_headers["x-ms-enable-snapshot-virtual-directory-access"] = self._deserialize( "bool", response.headers.get("x-ms-enable-snapshot-virtual-directory-access") ) + response_headers["x-ms-share-paid-bursting-enabled"] = self._deserialize( + "bool", response.headers.get("x-ms-share-paid-bursting-enabled") + ) + response_headers["x-ms-share-paid-bursting-max-iops"] = self._deserialize( + "int", response.headers.get("x-ms-share-paid-bursting-max-iops") + ) + response_headers["x-ms-share-paid-bursting-max-bandwidth-mibps"] = self._deserialize( + "int", response.headers.get("x-ms-share-paid-bursting-max-bandwidth-mibps") + ) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -1044,6 +1169,7 @@ def delete( # pylint: disable=inconsistent-return-statements timeout=timeout, delete_snapshots=delete_snapshots, lease_id=_lease_id, + file_request_intent=self._config.file_request_intent, restype=restype, version=self._config.version, headers=_headers, @@ -1132,6 +1258,7 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements proposed_lease_id=proposed_lease_id, sharesnapshot=sharesnapshot, request_id_parameter=request_id_parameter, + file_request_intent=self._config.file_request_intent, comp=comp, action=action, restype=restype, @@ -1220,6 +1347,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements timeout=timeout, sharesnapshot=sharesnapshot, request_id_parameter=request_id_parameter, + file_request_intent=self._config.file_request_intent, comp=comp, action=action, restype=restype, @@ -1313,6 +1441,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements proposed_lease_id=proposed_lease_id, sharesnapshot=sharesnapshot, request_id_parameter=request_id_parameter, + file_request_intent=self._config.file_request_intent, comp=comp, action=action, restype=restype, @@ -1401,6 +1530,7 @@ def renew_lease( # pylint: disable=inconsistent-return-statements timeout=timeout, sharesnapshot=sharesnapshot, request_id_parameter=request_id_parameter, + file_request_intent=self._config.file_request_intent, comp=comp, action=action, restype=restype, @@ -1503,6 +1633,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements lease_id=_lease_id, request_id_parameter=request_id_parameter, sharesnapshot=sharesnapshot, + file_request_intent=self._config.file_request_intent, comp=comp, action=action, restype=restype, @@ -1577,6 +1708,7 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements url=self._config.url, timeout=timeout, metadata=metadata, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, @@ -1744,12 +1876,23 @@ def create_permission( # pylint: disable=inconsistent-return-statements @distributed_trace def get_permission( - self, file_permission_key: str, timeout: Optional[int] = None, **kwargs: Any + self, + file_permission_key: str, + file_permission_format: Optional[Union[str, _models.FilePermissionFormat]] = None, + timeout: Optional[int] = None, + **kwargs: Any ) -> _models.SharePermission: """Returns the permission (security descriptor) for a given key. :param file_permission_key: Key of the permission to be set for the directory/file. Required. :type file_permission_key: str + :param file_permission_format: Optional. Available for version 2023-06-01 and later. Specifies + the format in which the permission is returned. Acceptable values are SDDL or binary. If + x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + permission is returned as a base64 string representing the binary encoding of the permission. + Known values are: "Sddl" and "Binary". Default value is None. + :type file_permission_format: str or ~azure.storage.fileshare.models.FilePermissionFormat :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1777,6 +1920,7 @@ def get_permission( _request = build_get_permission_request( url=self._config.url, file_permission_key=file_permission_key, + file_permission_format=file_permission_format, timeout=timeout, file_request_intent=self._config.file_request_intent, restype=restype, @@ -1820,6 +1964,9 @@ def set_properties( # pylint: disable=inconsistent-return-statements access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, enable_snapshot_virtual_directory_access: Optional[bool] = None, + paid_bursting_enabled: Optional[bool] = None, + paid_bursting_max_bandwidth_mibps: Optional[int] = None, + paid_bursting_max_iops: Optional[int] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: @@ -1840,6 +1987,17 @@ def set_properties( # pylint: disable=inconsistent-return-statements :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash :param enable_snapshot_virtual_directory_access: Default value is None. :type enable_snapshot_virtual_directory_access: bool + :param paid_bursting_enabled: Optional. Boolean. Default if not specified is false. This + property enables paid bursting. Default value is None. + :type paid_bursting_enabled: bool + :param paid_bursting_max_bandwidth_mibps: Optional. Integer. Default if not specified is the + maximum throughput the file share can support. Current maximum for a file share is 10,340 + MiB/sec. Default value is None. + :type paid_bursting_max_bandwidth_mibps: int + :param paid_bursting_max_iops: Optional. Integer. Default if not specified is the maximum IOPS + the file share can support. Current maximum for a file share is 102,400 IOPS. Default value is + None. + :type paid_bursting_max_iops: int :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :return: None or the result of cls(response) @@ -1873,6 +2031,10 @@ def set_properties( # pylint: disable=inconsistent-return-statements lease_id=_lease_id, root_squash=root_squash, enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, + paid_bursting_enabled=paid_bursting_enabled, + paid_bursting_max_bandwidth_mibps=paid_bursting_max_bandwidth_mibps, + paid_bursting_max_iops=paid_bursting_max_iops, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, @@ -1952,6 +2114,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements timeout=timeout, metadata=metadata, lease_id=_lease_id, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, @@ -2026,6 +2189,7 @@ def get_access_policy( url=self._config.url, timeout=timeout, lease_id=_lease_id, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, @@ -2115,6 +2279,7 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements url=self._config.url, timeout=timeout, lease_id=_lease_id, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, content_type=content_type, @@ -2191,6 +2356,7 @@ def get_statistics( url=self._config.url, timeout=timeout, lease_id=_lease_id, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, @@ -2277,6 +2443,7 @@ def restore( # pylint: disable=inconsistent-return-statements request_id_parameter=request_id_parameter, deleted_share_name=deleted_share_name, deleted_share_version=deleted_share_version, + file_request_intent=self._config.file_request_intent, restype=restype, comp=comp, version=self._config.version, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py index 364a53ecd5d0b..5def1546849c8 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py @@ -344,6 +344,9 @@ class ShareProperties(DictMixin): :ivar bool enable_snapshot_virtual_directory_access: Specifies whether the snapshot virtual directory should be accessible at the root of the share mount point when NFS is enabled. If not specified, it will be accessible. + :ivar bool paid_bursting_enabled: This property enables paid bursting. + :ivar int paid_bursting_bandwidth_mibps: The maximum throughput the file share can support in MiB/s. + :ivar int paid_bursting_iops: The maximum IOPS the file share can support. """ def __init__(self, **kwargs): @@ -369,6 +372,10 @@ def __init__(self, **kwargs): self.root_squash = kwargs.get('x-ms-root-squash', None) self.enable_snapshot_virtual_directory_access = \ kwargs.get('x-ms-enable-snapshot-virtual-directory-access') + self.paid_bursting_enabled = kwargs.get('x-ms-share-paid-bursting-enabled') + self.paid_bursting_bandwidth_mibps = kwargs.get('x-ms-share-paid-bursting-max-bandwidth-mibps') + self.paid_bursting_iops = kwargs.get('x-ms-share-paid-bursting-max-iops') + @classmethod def _from_generated(cls, generated): props = cls() @@ -393,7 +400,9 @@ def _from_generated(cls, generated): if generated.properties.enabled_protocols else None props.root_squash = generated.properties.root_squash props.enable_snapshot_virtual_directory_access = generated.properties.enable_snapshot_virtual_directory_access - + props.paid_bursting_enabled = generated.properties.paid_bursting_enabled + props.paid_bursting_bandwidth_mibps = generated.properties.paid_bursting_max_bandwidth_mibps + props.paid_bursting_iops = generated.properties.paid_bursting_max_iops return props diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py index 15bb36f4f6a35..4fc83fdee994b 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py @@ -43,6 +43,7 @@ '2023-11-03', '2024-05-04', '2024-08-04', + '2024-11-04', ] diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py index a0b9e7a8583a2..673cd76a826e8 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py @@ -374,6 +374,9 @@ def create_share(self, **kwargs): Root squash to set on the share. Only valid for NFS shares. Possible values include: 'NoRootSquash', 'RootSquash', 'AllSquash'. :paramtype root_squash: str or ~azure.storage.fileshare.ShareRootSquash + :keyword bool paid_bursting_enabled: This property enables paid bursting. + :keyword int paid_bursting_bandwidth_mibps: The maximum throughput the file share can support in MiB/s. + :keyword int paid_bursting_iops: The maximum IOPS the file share can support. :returns: Share-updated property dict (Etag and last modified). :rtype: Dict[str, Any] @@ -392,6 +395,8 @@ def create_share(self, **kwargs): timeout = kwargs.pop('timeout', None) root_squash = kwargs.pop('root_squash', None) protocols = kwargs.pop('protocols', None) + paid_bursting_bandwidth_mibps = kwargs.pop('paid_bursting_bandwidth_mibps', None) + paid_bursting_iops = kwargs.pop('paid_bursting_iops', None) if protocols and protocols not in ['NFS', 'SMB', ShareProtocols.SMB, ShareProtocols.NFS]: raise ValueError("The enabled protocol must be set to either SMB or NFS.") if root_squash and protocols not in ['NFS', ShareProtocols.NFS]: @@ -407,6 +412,8 @@ def create_share(self, **kwargs): access_tier=access_tier, root_squash=root_squash, enabled_protocols=protocols, + paid_bursting_max_bandwidth_mibps=paid_bursting_bandwidth_mibps, + paid_bursting_max_iops=paid_bursting_iops, cls=return_response_headers, headers=headers, **kwargs) @@ -643,6 +650,9 @@ def set_share_properties(self, **kwargs): :keyword lease: Required if the share has an active lease. Value can be a ShareLeaseClient object or the lease ID as a string. + :keyword bool paid_bursting_enabled: This property enables paid bursting. + :keyword int paid_bursting_bandwidth_mibps: The maximum throughput the file share can support in MiB/s. + :keyword int paid_bursting_iops: The maximum IOPS the file share can support. :returns: Share-updated property dict (Etag and last modified). :rtype: dict[str, Any] @@ -660,6 +670,8 @@ def set_share_properties(self, **kwargs): access_tier = kwargs.pop('access_tier', None) quota = kwargs.pop('quota', None) root_squash = kwargs.pop('root_squash', None) + paid_bursting_bandwidth_mibps = kwargs.pop('paid_bursting_bandwidth_mibps', None) + paid_bursting_iops = kwargs.pop('paid_bursting_iops', None) if all(parameter is None for parameter in [access_tier, quota, root_squash]): raise ValueError("set_share_properties should be called with at least one parameter.") try: @@ -669,6 +681,8 @@ def set_share_properties(self, **kwargs): access_tier=access_tier, root_squash=root_squash, lease_access_conditions=access_conditions, + paid_bursting_max_bandwidth_mibps=paid_bursting_bandwidth_mibps, + paid_bursting_max_iops=paid_bursting_iops, cls=return_response_headers, **kwargs) except HttpResponseError as error: @@ -940,6 +954,9 @@ def create_permission_for_share(self, file_permission, # type: str This value is not tracked or validated on the client. To configure client-side network timesouts see `here `__. + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :returns: A file permission key :rtype: str """ @@ -968,6 +985,9 @@ def get_permission_for_share( # type: ignore This value is not tracked or validated on the client. To configure client-side network timesouts see `here `__. + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :returns: A file permission (a portable SDDL) :rtype: str """ diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py index 56458cd8d82af..28c58255677b0 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py @@ -76,6 +76,7 @@ def __init__( self._location_mode = kwargs.get("_location_mode", LocationMode.PRIMARY) self._hosts = kwargs.get("_hosts") self.scheme = parsed_url.scheme + self._is_localhost = False if service not in ["blob", "queue", "file-share", "dfs"]: raise ValueError(f"Invalid service: {service}") @@ -85,6 +86,7 @@ def __init__( self.account_name = account[0] if len(account) > 1 else None if not self.account_name and parsed_url.netloc.startswith("localhost") \ or parsed_url.netloc.startswith("127.0.0.1"): + self._is_localhost = True self.account_name = parsed_url.path.strip("/") self.credential = _format_shared_key_credential(self.account_name, credential) diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/shared_access_signature.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/shared_access_signature.py index 344e398de454a..8a5ebf699c6ce 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/shared_access_signature.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/shared_access_signature.py @@ -106,8 +106,16 @@ def __init__(self, account_name, account_key, x_ms_version=X_MS_VERSION): self.account_key = account_key self.x_ms_version = x_ms_version - def generate_account(self, services, resource_types, permission, expiry, start=None, - ip=None, protocol=None) -> str: + def generate_account( + self, services, + resource_types, + permission, + expiry, + start=None, + ip=None, + protocol=None, + sts_hook=None + ) -> str: ''' Generates a shared access signature for the account. Use the returned signature with the sas_token parameter of the service @@ -148,6 +156,10 @@ def generate_account(self, services, resource_types, permission, expiry, start=N :param str protocol: Specifies the protocol permitted for a request made. The default value is https,http. See :class:`~azure.storage.common.models.Protocol` for possible values. + :param sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :type sts_hook: Optional[Callable[[str], None]] :returns: The generated SAS token for the account. :rtype: str ''' @@ -156,12 +168,16 @@ def generate_account(self, services, resource_types, permission, expiry, start=N sas.add_account(services, resource_types) sas.add_account_signature(self.account_name, self.account_key) + if sts_hook is not None: + sts_hook(sas.string_to_sign) + return sas.get_token() class _SharedAccessHelper(object): def __init__(self): self.query_dict = {} + self.string_to_sign = "" def _add_query(self, name, val): if val: @@ -207,7 +223,7 @@ def get_value_to_append(query): return_value = self.query_dict.get(query) or '' return return_value + '\n' - string_to_sign = \ + self.string_to_sign = \ (account_name + '\n' + get_value_to_append(QueryStringConstants.SIGNED_PERMISSION) + get_value_to_append(QueryStringConstants.SIGNED_SERVICES) + @@ -221,7 +237,7 @@ def get_value_to_append(query): ) self._add_query(QueryStringConstants.SIGNED_SIGNATURE, - sign_string(account_key, string_to_sign)) + sign_string(account_key, self.string_to_sign)) def get_token(self) -> str: return '&'.join([f'{n}={url_quote(v)}' for n, v in self.query_dict.items() if v is not None]) diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared_access_signature.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared_access_signature.py index 1dc7c595d62a6..588359a176c39 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared_access_signature.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared_access_signature.py @@ -6,7 +6,8 @@ # pylint: disable=docstring-keyword-should-match-keyword-only from typing import ( # pylint: disable=unused-import - Union, Optional, Any, List, TYPE_CHECKING + Any, Callable, List, Optional, Union, + TYPE_CHECKING ) from urllib.parse import parse_qs @@ -42,11 +43,23 @@ def __init__(self, account_name, account_key): ''' super(FileSharedAccessSignature, self).__init__(account_name, account_key, x_ms_version=X_MS_VERSION) - def generate_file(self, share_name, directory_name=None, file_name=None, - permission=None, expiry=None, start=None, policy_id=None, - ip=None, protocol=None, cache_control=None, - content_disposition=None, content_encoding=None, - content_language=None, content_type=None): + def generate_file( + self, share_name, + directory_name=None, + file_name=None, + permission=None, + expiry=None, + start=None, + policy_id=None, + ip=None, + protocol=None, + cache_control=None, + content_disposition=None, + content_encoding=None, + content_language=None, + content_type=None, + sts_hook=None + ): ''' Generates a shared access signature for the file. Use the returned signature with the sas_token parameter of FileService. @@ -108,6 +121,10 @@ def generate_file(self, share_name, directory_name=None, file_name=None, :param str content_type: Response header value for Content-Type when resource is accessed using this shared access signature. + :param sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :type sts_hook: Optional[Callable[[str], None]] :returns: The generated SAS token for the account. :rtype: str ''' @@ -125,13 +142,26 @@ def generate_file(self, share_name, directory_name=None, file_name=None, content_type) sas.add_resource_signature(self.account_name, self.account_key, resource_path) + if sts_hook is not None: + sts_hook(sas.string_to_sign) + return sas.get_token() - def generate_share(self, share_name, permission=None, expiry=None, - start=None, policy_id=None, ip=None, protocol=None, - cache_control=None, content_disposition=None, - content_encoding=None, content_language=None, - content_type=None): + def generate_share( + self, share_name, + permission=None, + expiry=None, + start=None, + policy_id=None, + ip=None, + protocol=None, + cache_control=None, + content_disposition=None, + content_encoding=None, + content_language=None, + content_type=None, + sts_hook=None + ): ''' Generates a shared access signature for the share. Use the returned signature with the sas_token parameter of FileService. @@ -188,6 +218,10 @@ def generate_share(self, share_name, permission=None, expiry=None, :param str content_type: Response header value for Content-Type when resource is accessed using this shared access signature. + :param sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :type sts_hook: Optional[Callable[[str], None]] :returns: The generated SAS token for the account. :rtype: str ''' @@ -200,6 +234,9 @@ def generate_share(self, share_name, permission=None, expiry=None, content_type) sas.add_resource_signature(self.account_name, self.account_key, share_name) + if sts_hook is not None: + sts_hook(sas.string_to_sign) + return sas.get_token() @@ -238,6 +275,7 @@ def get_value_to_append(query): self._add_query(QueryStringConstants.SIGNED_SIGNATURE, sign_string(account_key, string_to_sign)) + self.string_to_sign = string_to_sign def generate_account_sas( @@ -250,6 +288,7 @@ def generate_account_sas( ip: Optional[str] = None, *, services: Union[Services, str] = Services(fileshare=True), + sts_hook: Optional[Callable[[str], None]] = None, **kwargs: Any ) -> str: """Generates a shared access signature for the file service. @@ -287,6 +326,10 @@ def generate_account_sas( Will default to only this package (i.e. fileshare) if not provided. :keyword str protocol: Specifies the protocol permitted for a request made. The default value is https. + :keyword sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :paramtype sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str @@ -307,6 +350,7 @@ def generate_account_sas( expiry=expiry, start=start, ip=ip, + sts_hook=sts_hook, **kwargs ) # type: ignore @@ -320,6 +364,8 @@ def generate_share_sas( start=None, # type: Optional[Union[datetime, str]] policy_id=None, # type: Optional[str] ip=None, # type: Optional[str] + *, + sts_hook=None, # Optional[Callable[[str], None]] **kwargs # type: Any ): # type: (...) -> str """Generates a shared access signature for a share. @@ -382,6 +428,10 @@ def generate_share_sas( using this shared access signature. :keyword str protocol: Specifies the protocol permitted for a request made. The default value is https. + :keyword sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :paramtype sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str """ @@ -398,6 +448,7 @@ def generate_share_sas( start=start, policy_id=policy_id, ip=ip, + sts_hook=sts_hook, **kwargs ) @@ -412,6 +463,8 @@ def generate_file_sas( start=None, # type: Optional[Union[datetime, str]] policy_id=None, # type: Optional[str] ip=None, # type: Optional[str] + *, + sts_hook=None, # type: Optional[Callable[[str], None]] **kwargs # type: Any ): # type: (...) -> str @@ -477,6 +530,10 @@ def generate_file_sas( using this shared access signature. :keyword str protocol: Specifies the protocol permitted for a request made. The default value is https. + :keyword sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :paramtype sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str """ @@ -499,6 +556,7 @@ def generate_file_sas( start=start, policy_id=policy_id, ip=ip, + sts_hook=sts_hook, **kwargs ) diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_version.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_version.py index e2a8a2d4a09e1..dc5b854a0eeb7 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_version.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_version.py @@ -4,4 +4,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "12.18.0b1" +VERSION = "12.18.0" diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py index d874a3fe541b0..e68863eff9e13 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py @@ -214,6 +214,9 @@ async def create_directory(self, **kwargs): :keyword str file_permission_key: Key of the permission to be set for the directory/file. Note: Only one of the file-permission or file-permission-key should be specified. + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :keyword file_change_time: Change time for the directory. If not specified, change time will be set to the current date/time. @@ -336,6 +339,9 @@ async def rename_directory( :keyword str file_permission_key: Key of the permission to be set for the directory. Note: Only one of the file-permission or file-permission-key should be specified. + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :keyword file_attributes: The file system attributes for the directory. :paramtype file_attributes: ~azure.storage.fileshare.NTFSAttributes or str @@ -692,6 +698,9 @@ async def set_http_headers(self, file_attributes="none", # type: Union[str, NTF directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. :type permission_key: str + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :keyword file_change_time: Change time for the directory. If not specified, change time will be set to the current date/time. diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py index f287ec39f839b..2aad1255b3abf 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py @@ -272,6 +272,9 @@ async def create_file( # type: ignore directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. :type permission_key: str + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :keyword file_change_time: Change time for the file. If not specified, change time will be set to the current date/time. @@ -825,6 +828,9 @@ async def rename_file( :keyword str file_permission_key: Key of the permission to be set for the file. Note: Only one of the file-permission or file-permission-key should be specified. + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :keyword file_attributes: The file system attributes for the file. :paramtype file_attributes: ~azure.storage.fileshare.NTFSAttributes or str @@ -991,6 +997,9 @@ async def set_http_headers(self, content_settings, # type: ContentSettings directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. :type permission_key: str + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :keyword file_change_time: Change time for the file. If not specified, change time will be set to the current date/time. diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py index 1ef7acec87802..f63824a4d5c60 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py @@ -223,6 +223,9 @@ async def create_share(self, **kwargs): Root squash to set on the share. Only valid for NFS shares. Possible values include: 'NoRootSquash', 'RootSquash', 'AllSquash'. :paramtype root_squash: str or ~azure.storage.fileshare.ShareRootSquash + :keyword bool paid_bursting_enabled: This property enables paid bursting. + :keyword int paid_bursting_bandwidth_mibps: The maximum throughput the file share can support in MiB/s. + :keyword int paid_bursting_iops: The maximum IOPS the file share can support. :returns: Share-updated property dict (Etag and last modified). :rtype: Dict[str, Any] @@ -241,6 +244,8 @@ async def create_share(self, **kwargs): timeout = kwargs.pop('timeout', None) root_squash = kwargs.pop('root_squash', None) protocols = kwargs.pop('protocols', None) + paid_bursting_bandwidth_mibps = kwargs.pop('paid_bursting_bandwidth_mibps', None) + paid_bursting_iops = kwargs.pop('paid_bursting_iops', None) if protocols and protocols not in ['NFS', 'SMB', ShareProtocols.SMB, ShareProtocols.NFS]: raise ValueError("The enabled protocol must be set to either SMB or NFS.") if root_squash and protocols not in ['NFS', ShareProtocols.NFS]: @@ -256,6 +261,8 @@ async def create_share(self, **kwargs): access_tier=access_tier, root_squash=root_squash, enabled_protocols=protocols, + paid_bursting_max_bandwidth_mibps=paid_bursting_bandwidth_mibps, + paid_bursting_max_iops=paid_bursting_iops, cls=return_response_headers, headers=headers, **kwargs) @@ -491,6 +498,9 @@ async def set_share_properties(self, **kwargs): :keyword lease: Required if the share has an active lease. Value can be a ShareLeaseClient object or the lease ID as a string. + :keyword bool paid_bursting_enabled: This property enables paid bursting. + :keyword int paid_bursting_bandwidth_mibps: The maximum throughput the file share can support in MiB/s. + :keyword int paid_bursting_iops: The maximum IOPS the file share can support. :returns: Share-updated property dict (Etag and last modified). :rtype: dict[str, Any] @@ -508,6 +518,8 @@ async def set_share_properties(self, **kwargs): access_tier = kwargs.pop('access_tier', None) quota = kwargs.pop('quota', None) root_squash = kwargs.pop('root_squash', None) + paid_bursting_bandwidth_mibps = kwargs.pop('paid_bursting_bandwidth_mibps', None) + paid_bursting_iops = kwargs.pop('paid_bursting_iops', None) if all(parameter is None for parameter in [access_tier, quota, root_squash]): raise ValueError("set_share_properties should be called with at least one parameter.") try: @@ -517,6 +529,8 @@ async def set_share_properties(self, **kwargs): access_tier=access_tier, root_squash=root_squash, lease_access_conditions=access_conditions, + paid_bursting_max_bandwidth_mibps=paid_bursting_bandwidth_mibps, + paid_bursting_max_iops=paid_bursting_iops, cls=return_response_headers, **kwargs) except HttpResponseError as error: @@ -777,6 +791,9 @@ async def create_permission_for_share(self, file_permission, # type: str This value is not tracked or validated on the client. To configure client-side network timesouts see `here `__. + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :returns: A file permission key :rtype: str """ @@ -805,6 +822,9 @@ async def get_permission_for_share( # type: ignore This value is not tracked or validated on the client. To configure client-side network timesouts see `here `__. + :keyword file_permission_format: + Specifies the format in which the permission is returned. If not specified, SDDL will be the default. + :paramtype file_permission_format: Literal['sddl', 'binary'] :returns: A file permission (a portable SDDL) :rtype: str """ diff --git a/sdk/storage/azure-storage-file-share/pyproject.toml b/sdk/storage/azure-storage-file-share/pyproject.toml index ff779a518143f..05ee5668ed6ac 100644 --- a/sdk/storage/azure-storage-file-share/pyproject.toml +++ b/sdk/storage/azure-storage-file-share/pyproject.toml @@ -2,4 +2,3 @@ mypy = false pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/storage/azure-storage-file-share/setup.py b/sdk/storage/azure-storage-file-share/setup.py index fef43a9b1927b..832fc9c7d6a42 100644 --- a/sdk/storage/azure-storage-file-share/setup.py +++ b/sdk/storage/azure-storage-file-share/setup.py @@ -45,7 +45,7 @@ url='https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-share', keywords="azure, azure sdk", classifiers=[ - 'Development Status :: 4 - Beta', + 'Development Status :: 5 - Production/Stable', 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3', @@ -65,14 +65,14 @@ ]), python_requires=">=3.8", install_requires=[ - "azure-core>=1.28.0", + "azure-core>=1.30.0", "cryptography>=2.1.4", "typing-extensions>=4.6.0", "isodate>=0.6.1" ], extras_require={ "aio": [ - "azure-core[aio]>=1.28.0", + "azure-core[aio]>=1.30.0", ], }, ) diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index e70e47c65c990..37a4e927030ae 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -16,7 +16,7 @@ autorest --v3 --python ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-11-04/file.json output-folder: ../azure/storage/fileshare/_generated namespace: azure.storage.fileshare no-namespace-folders: true diff --git a/sdk/storage/azure-storage-file-share/tests/test_directory.py b/sdk/storage/azure-storage-file-share/tests/test_directory.py index d8fce4b7f0ce9..391438bec7525 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_directory.py +++ b/sdk/storage/azure-storage-file-share/tests/test_directory.py @@ -1396,6 +1396,62 @@ def test_bad_audience_directory_client(self, **kwargs): # Assert directory_client.exists() + @FileSharePreparer() + @recorded_by_proxy + def test_file_permission_format_directory(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + share_client = self.fsc.get_share_client(self.share_name) + user_given_permission_sddl = ("O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-" + "1604012920-1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;" + "S-1-5-21-397955417-626881126-188441444-3053964)S:NO_ACCESS_CONTROL") + user_given_permission_binary = ("AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/AR8AAQEAAAAAAAUSAAAAAAAYAP8BHw" + "ABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAAAABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUA" + "AAAAAAUVAAAAoGXPfnhLm1/nfIdwr/1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA=") + + directory_client = share_client.create_directory( + 'dir1', + file_permission=user_given_permission_binary, + file_permission_format="binary" + ) + + props = directory_client.get_directory_properties() + assert props is not None + assert props.permission_key is not None + + directory_client.set_http_headers( + file_permission=user_given_permission_binary, + file_permission_format="binary" + ) + + props = directory_client.get_directory_properties() + assert props is not None + assert props.permission_key is not None + + server_returned_permission = share_client.get_permission_for_share( + props.permission_key, + file_permission_format="sddl" + ) + assert server_returned_permission == user_given_permission_sddl + + new_directory_client = directory_client.rename_directory( + 'dir2', + file_permission=user_given_permission_binary, + file_permission_format="binary" + ) + props = new_directory_client.get_directory_properties() + assert props is not None + assert props.permission_key is not None + + server_returned_permission = share_client.get_permission_for_share( + props.permission_key, + file_permission_format="binary" + ) + assert server_returned_permission == user_given_permission_binary + + new_directory_client.delete_directory() # ------------------------------------------------------------------------------ if __name__ == '__main__': diff --git a/sdk/storage/azure-storage-file-share/tests/test_directory_async.py b/sdk/storage/azure-storage-file-share/tests/test_directory_async.py index cb9450ef26051..4648df892090a 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_directory_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_directory_async.py @@ -1497,4 +1497,61 @@ async def test_bad_audience_directory_client(self, **kwargs): # Assert await directory_client.exists() + @FileSharePreparer() + @recorded_by_proxy_async + async def test_file_permission_format_directory(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + await self._setup(storage_account_name, storage_account_key) + share_client = self.fsc.get_share_client(self.share_name) + user_given_permission_sddl = ("O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-" + "1604012920-1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;" + "S-1-5-21-397955417-626881126-188441444-3053964)S:NO_ACCESS_CONTROL") + user_given_permission_binary = ("AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/AR8AAQEAAAAAAAUSAAAAAAAYAP8BHw" + "ABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAAAABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUA" + "AAAAAAUVAAAAoGXPfnhLm1/nfIdwr/1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA=") + + directory_client = await share_client.create_directory( + 'dir1', + file_permission=user_given_permission_binary, + file_permission_format="binary" + ) + + props = await directory_client.get_directory_properties() + assert props is not None + assert props.permission_key is not None + + await directory_client.set_http_headers( + file_permission=user_given_permission_binary, + file_permission_format="binary" + ) + + props = await directory_client.get_directory_properties() + assert props is not None + assert props.permission_key is not None + + server_returned_permission = await share_client.get_permission_for_share( + props.permission_key, + file_permission_format="sddl" + ) + assert server_returned_permission == user_given_permission_sddl + + new_directory_client = await directory_client.rename_directory( + 'dir2', + file_permission=user_given_permission_binary, + file_permission_format="binary" + ) + props = await new_directory_client.get_directory_properties() + assert props is not None + assert props.permission_key is not None + + server_returned_permission = await share_client.get_permission_for_share( + props.permission_key, + file_permission_format="binary" + ) + assert server_returned_permission == user_given_permission_binary + + await new_directory_client.delete_directory() + # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-file-share/tests/test_file.py b/sdk/storage/azure-storage-file-share/tests/test_file.py index b2193296e35f0..307ed37092c28 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file.py @@ -3763,4 +3763,68 @@ def test_bad_audience_file_client(self, **kwargs): # Assert file_client.exists() + @FileSharePreparer() + @recorded_by_proxy + def test_file_permission_format(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + share_client = self.fsc.get_share_client(self.share_name) + source_file = share_client.get_file_client('file1') + user_given_permission_sddl = ("O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-" + "1604012920-1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;" + "S-1-5-21-397955417-626881126-188441444-3053964)S:NO_ACCESS_CONTROL") + user_given_permission_binary = ("AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/AR8AAQEAAAAAAAUSAAAAAAAYAP8BHw" + "ABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAAAABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUA" + "AAAAAAUVAAAAoGXPfnhLm1/nfIdwr/1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA=") + + source_file.create_file( + 1024, + file_permission=user_given_permission_binary, + file_permission_format="binary" + ) + + props = source_file.get_file_properties() + assert props is not None + assert props.permission_key is not None + + new_file = source_file.rename_file( + 'file2', + file_permission=user_given_permission_binary, + file_permission_format="binary" + ) + props = new_file.get_file_properties() + assert props is not None + assert props.permission_key is not None + + server_returned_permission = share_client.get_permission_for_share( + props.permission_key, + file_permission_format="binary" + ) + assert server_returned_permission == user_given_permission_binary + + content_settings = ContentSettings( + content_language='spanish', + content_disposition='inline' + ) + new_file.set_http_headers( + content_settings=content_settings, + file_permission=user_given_permission_binary, + file_permission_format="binary" + ) + props = new_file.get_file_properties() + assert props is not None + assert props.permission_key is not None + assert props.content_settings.content_language == content_settings.content_language + assert props.content_settings.content_disposition == content_settings.content_disposition + + server_returned_permission = share_client.get_permission_for_share( + props.permission_key, + file_permission_format="sddl" + ) + assert server_returned_permission == user_given_permission_sddl + + new_file.delete_file() + # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_async.py index 4596ab5e4e85a..9f1edd055be40 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_async.py @@ -3878,3 +3878,68 @@ async def test_bad_audience_file_client(self, **kwargs): # Assert await file_client.exists() + + @FileSharePreparer() + @recorded_by_proxy_async + async def test_file_permission_format(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + await self._setup_share(storage_account_name, storage_account_key) + share_client = self.fsc.get_share_client(self.share_name) + source_file = share_client.get_file_client('file1') + user_given_permission_sddl = ("O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-" + "1604012920-1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;" + "S-1-5-21-397955417-626881126-188441444-3053964)S:NO_ACCESS_CONTROL") + user_given_permission_binary = ("AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/AR8AAQEAAAAAAAUSAAAAAAAYAP8BHw" + "ABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAAAABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUA" + "AAAAAAUVAAAAoGXPfnhLm1/nfIdwr/1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA=") + + await source_file.create_file( + 1024, + file_permission=user_given_permission_binary, + file_permission_format="binary" + ) + + props = await source_file.get_file_properties() + assert props is not None + assert props.permission_key is not None + + new_file = await source_file.rename_file( + 'file2', + file_permission=user_given_permission_binary, + file_permission_format="binary" + ) + props = await new_file.get_file_properties() + assert props is not None + assert props.permission_key is not None + + server_returned_permission = await share_client.get_permission_for_share( + props.permission_key, + file_permission_format="binary" + ) + assert server_returned_permission == user_given_permission_binary + + content_settings = ContentSettings( + content_language='spanish', + content_disposition='inline' + ) + await new_file.set_http_headers( + content_settings=content_settings, + file_permission=user_given_permission_binary, + file_permission_format="binary" + ) + props = await new_file.get_file_properties() + assert props is not None + assert props.permission_key is not None + assert props.content_settings.content_language == content_settings.content_language + assert props.content_settings.content_disposition == content_settings.content_disposition + + server_returned_permission = await share_client.get_permission_for_share( + props.permission_key, + file_permission_format="sddl" + ) + assert server_returned_permission == user_given_permission_sddl + + await new_file.delete_file() diff --git a/sdk/storage/azure-storage-file-share/tests/test_share.py b/sdk/storage/azure-storage-file-share/tests/test_share.py index f5455ce9c88a9..6b975e6eee1c7 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_share.py +++ b/sdk/storage/azure-storage-file-share/tests/test_share.py @@ -22,7 +22,9 @@ AccountSasPermissions, generate_account_sas, generate_share_sas, + Metrics, ResourceTypes, + RetentionPolicy, ShareAccessTier, ShareClient, ShareFileClient, @@ -1567,6 +1569,38 @@ def test_create_permission_for_share(self, **kwargs): # server returned permission assert permission_key == permission_key2 + @FileSharePreparer() + @recorded_by_proxy + def test_get_permission_format(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + share_client = self._create_share() + user_given_permission_sddl = ("O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-" + "1604012920-1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;" + "S-1-5-21-397955417-626881126-188441444-3053964)S:NO_ACCESS_CONTROL") + user_given_permission_binary = ("AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/AR8AAQEAAAAAAAUSAAAAAAAYAP8BHw" + "ABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAAAABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUA" + "AAAAAAUVAAAAoGXPfnhLm1/nfIdwr/1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA=") + + permission_key = share_client.create_permission_for_share(user_given_permission_sddl) + assert permission_key is not None + + server_returned_permission = share_client.get_permission_for_share( + permission_key, + file_permission_format="sddl" + ) + assert server_returned_permission == user_given_permission_sddl + + server_returned_permission = share_client.get_permission_for_share( + permission_key, + file_permission_format="binary" + ) + assert server_returned_permission == user_given_permission_binary + + self._delete_shares(share_client.share_name) + @pytest.mark.live_test_only @FileSharePreparer() def test_transport_closed_only_once(self, **kwargs): @@ -1611,6 +1645,146 @@ def test_delete_directory_from_share(self, **kwargs): self._delete_shares() + @FileSharePreparer() + @recorded_by_proxy + def test_share_paid_bursting(self, **kwargs): + premium_storage_file_account_name = kwargs.pop("premium_storage_file_account_name") + premium_storage_file_account_key = kwargs.pop("premium_storage_file_account_key") + + try: + # Arrange + self._setup(premium_storage_file_account_name, premium_storage_file_account_key) + mibps = 10340 + iops = 102400 + + # Act / Assert + share = self._create_share( + paid_bursting_enabled=True, + paid_bursting_bandwidth_mibps=5000, + paid_bursting_iops=1000 + ) + share_props = share.get_share_properties() + assert share_props.paid_bursting_enabled + assert share_props.paid_bursting_bandwidth_mibps == 5000 + assert share_props.paid_bursting_iops == 1000 + + share.set_share_properties( + root_squash="NoRootSquash", + paid_bursting_enabled=True, + paid_bursting_bandwidth_mibps=mibps, + paid_bursting_iops=iops + ) + share_props = share.get_share_properties() + share_name = share_props.name + assert share_props.paid_bursting_enabled + assert share_props.paid_bursting_bandwidth_mibps == mibps + assert share_props.paid_bursting_iops == iops + + shares = list(self.fsc.list_shares()) + assert shares is not None + assert len(shares) >= 1 + + share_exists = False + for share in shares: + if share.name == share_name: + assert share is not None + assert share.paid_bursting_enabled + assert share.paid_bursting_bandwidth_mibps == mibps + assert share.paid_bursting_iops == iops + share_exists = True + break + + if not share_exists: + raise ValueError("Share with modified bursting values not found.") + finally: + self._delete_shares() + + @FileSharePreparer() + @recorded_by_proxy + def test_share_client_with_oauth(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + token_credential = self.get_credential(ShareClient) + + self._setup(storage_account_name, storage_account_key) + first_share = self._create_share('test1') + second_share = self._create_share('test2') + + share_names = {share.name for share in self.fsc.list_shares()} + assert first_share.share_name in share_names + assert second_share.share_name in share_names + + first_share_client = ShareClient( + self.account_url(storage_account_name, "file"), + share_name=first_share.share_name, + credential=token_credential, + token_intent=TEST_INTENT + ) + second_share_client = ShareClient( + self.account_url(storage_account_name, "file"), + share_name=second_share.share_name, + credential=token_credential, + token_intent=TEST_INTENT + ) + + first_share_props = first_share_client.get_share_properties() + second_share_props = second_share_client.get_share_properties() + assert first_share_props is not None + assert first_share_props.name == first_share.share_name + assert first_share_props.access_tier == 'TransactionOptimized' + assert second_share_props is not None + assert second_share_props.name == second_share.share_name + assert second_share_props.access_tier == 'TransactionOptimized' + + first_share_client.set_share_properties(access_tier='Hot') + first_share_props = first_share_client.get_share_properties() + assert first_share_props is not None + assert first_share_props.name == first_share.share_name + assert first_share_props.access_tier == 'Hot' + + share_names = {share.name for share in self.fsc.list_shares()} + assert first_share.share_name in share_names + assert second_share.share_name in share_names + + first_share_client.delete_share() + second_share_client.delete_share() + + @FileSharePreparer() + @recorded_by_proxy + def test_share_lease_with_oauth(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + token_credential = self.get_credential(ShareClient) + + # Arrange + self._setup(storage_account_name, storage_account_key) + share = self._create_share('test') + share_client = ShareClient( + self.account_url(storage_account_name, "file"), + share_name=share.share_name, + credential=token_credential, + token_intent=TEST_INTENT + ) + + # Act / Assert + lease_duration = 60 + lease_id = '00000000-1111-2222-3333-444444444444' + lease = share_client.acquire_lease( + lease_id=lease_id, + lease_duration=lease_duration + ) + props = share_client.get_share_properties(lease=lease) + assert props.lease.duration == 'fixed' + assert props.lease.state == 'leased' + assert props.lease.status == 'locked' + + lease.renew() + assert lease.id == lease_id + + lease.release() + share_client.delete_share() + + # ------------------------------------------------------------------------------ if __name__ == '__main__': unittest.main() diff --git a/sdk/storage/azure-storage-file-share/tests/test_share_async.py b/sdk/storage/azure-storage-file-share/tests/test_share_async.py index 962799b7cd985..34093f8e203da 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_share_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_share_async.py @@ -1602,6 +1602,38 @@ async def test_create_permission_for_share(self, **kwargs): assert permission_key == permission_key2 await self._delete_shares(share_client.share_name) + @FileSharePreparer() + @recorded_by_proxy_async + async def test_get_permission_format(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + share_client = await self._create_share() + user_given_permission_sddl = ("O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-" + "1604012920-1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;" + "S-1-5-21-397955417-626881126-188441444-3053964)S:NO_ACCESS_CONTROL") + user_given_permission_binary = ("AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/AR8AAQEAAAAAAAUSAAAAAAAYAP8BHw" + "ABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAAAABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUA" + "AAAAAAUVAAAAoGXPfnhLm1/nfIdwr/1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA=") + + permission_key = await share_client.create_permission_for_share(user_given_permission_sddl) + assert permission_key is not None + + server_returned_permission = await share_client.get_permission_for_share( + permission_key, + file_permission_format="sddl" + ) + assert server_returned_permission == user_given_permission_sddl + + server_returned_permission = await share_client.get_permission_for_share( + permission_key, + file_permission_format="binary" + ) + assert server_returned_permission == user_given_permission_binary + + await self._delete_shares(share_client.share_name) + @pytest.mark.live_test_only @FileSharePreparer() async def test_transport_closed_only_once(self, **kwargs): @@ -1650,3 +1682,141 @@ async def test_delete_directory_from_share(self, **kwargs): assert len(resp) == 2 await self._delete_shares(share.share_name) + @FileSharePreparer() + @recorded_by_proxy_async + async def test_share_paid_bursting(self, **kwargs): + premium_storage_file_account_name = kwargs.pop("premium_storage_file_account_name") + premium_storage_file_account_key = kwargs.pop("premium_storage_file_account_key") + + # Arrange + try: + self._setup(premium_storage_file_account_name, premium_storage_file_account_key) + mibps = 10340 + iops = 102400 + + # Act / Assert + share = await self._create_share( + paid_bursting_enabled=True, + paid_bursting_bandwidth_mibps=5000, + paid_bursting_iops=1000 + ) + share_props = await share.get_share_properties() + share_name = share_props.name + assert share_props.paid_bursting_enabled + assert share_props.paid_bursting_bandwidth_mibps == 5000 + assert share_props.paid_bursting_iops == 1000 + + await share.set_share_properties( + root_squash="NoRootSquash", + paid_bursting_enabled=True, + paid_bursting_bandwidth_mibps=mibps, + paid_bursting_iops=iops + ) + share_props = await share.get_share_properties() + assert share_props.paid_bursting_enabled + assert share_props.paid_bursting_bandwidth_mibps == mibps + assert share_props.paid_bursting_iops == iops + + share_exists = False + async for share in self.fsc.list_shares(): + if share.name == share_name: + assert share is not None + assert share.paid_bursting_enabled + assert share.paid_bursting_bandwidth_mibps == mibps + assert share.paid_bursting_iops == iops + share_exists = True + break + + if not share_exists: + raise ValueError("Share with modified bursting values not found.") + finally: + await self._delete_shares() + + @FileSharePreparer() + @recorded_by_proxy_async + async def test_share_client_with_oauth(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + token_credential = self.get_credential(ShareClient, is_async=True) + + self._setup(storage_account_name, storage_account_key) + first_share = await self._create_share('test1') + second_share = await self._create_share('test2') + + share_names = [] + async for share in self.fsc.list_shares(): + share_names.append(share.name) + assert first_share.share_name in share_names + assert second_share.share_name in share_names + + first_share_client = ShareClient( + self.account_url(storage_account_name, "file"), + share_name=first_share.share_name, + credential=token_credential, + token_intent=TEST_INTENT + ) + second_share_client = ShareClient( + self.account_url(storage_account_name, "file"), + share_name=second_share.share_name, + credential=token_credential, + token_intent=TEST_INTENT + ) + + first_share_props = await first_share_client.get_share_properties() + second_share_props = await second_share_client.get_share_properties() + assert first_share_props is not None + assert first_share_props.name == first_share.share_name + assert first_share_props.access_tier == 'TransactionOptimized' + assert second_share_props is not None + assert second_share_props.name == second_share.share_name + assert second_share_props.access_tier == 'TransactionOptimized' + + await first_share_client.set_share_properties(access_tier='Hot') + first_share_props = await first_share_client.get_share_properties() + assert first_share_props is not None + assert first_share_props.name == first_share.share_name + assert first_share_props.access_tier == 'Hot' + + share_names = [] + async for share in self.fsc.list_shares(): + share_names.append(share.name) + assert first_share.share_name in share_names + assert second_share.share_name in share_names + + first_share_client.delete_share() + second_share_client.delete_share() + + @FileSharePreparer() + @recorded_by_proxy_async + async def test_share_lease_with_oauth(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + token_credential = self.get_credential(ShareClient, is_async=True) + + # Arrange + self._setup(storage_account_name, storage_account_key) + share = await self._create_share('test') + share_client = ShareClient( + self.account_url(storage_account_name, "file"), + share_name=share.share_name, + credential=token_credential, + token_intent=TEST_INTENT + ) + + # Act / Assert + lease_duration = 60 + lease_id = '00000000-1111-2222-3333-444444444444' + lease = await share_client.acquire_lease( + lease_id=lease_id, + lease_duration=lease_duration + ) + props = await share_client.get_share_properties(lease=lease) + assert props.lease.duration == 'fixed' + assert props.lease.state == 'leased' + assert props.lease.status == 'locked' + + await lease.renew() + assert lease.id == lease_id + + await lease.release() + await share_client.delete_share() diff --git a/sdk/storage/azure-storage-queue/CHANGELOG.md b/sdk/storage/azure-storage-queue/CHANGELOG.md index 28d639e626810..9656a24deb19b 100644 --- a/sdk/storage/azure-storage-queue/CHANGELOG.md +++ b/sdk/storage/azure-storage-queue/CHANGELOG.md @@ -1,10 +1,18 @@ # Release History -## 12.12.0b1 (Unreleased) +## 12.12.0 (Unreleased) ### Features Added +## 12.12.0b1 (2024-08-07) + +### Features Added +- Added support for service version 2024-11-04. + +### Other Changes +- Bumped minimum `azure-core` dependency to 1.30.0. + ## 12.11.0 (2024-07-18) ### Features Added diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py index 56458cd8d82af..28c58255677b0 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py @@ -76,6 +76,7 @@ def __init__( self._location_mode = kwargs.get("_location_mode", LocationMode.PRIMARY) self._hosts = kwargs.get("_hosts") self.scheme = parsed_url.scheme + self._is_localhost = False if service not in ["blob", "queue", "file-share", "dfs"]: raise ValueError(f"Invalid service: {service}") @@ -85,6 +86,7 @@ def __init__( self.account_name = account[0] if len(account) > 1 else None if not self.account_name and parsed_url.netloc.startswith("localhost") \ or parsed_url.netloc.startswith("127.0.0.1"): + self._is_localhost = True self.account_name = parsed_url.path.strip("/") self.credential = _format_shared_key_credential(self.account_name, credential) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/shared_access_signature.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/shared_access_signature.py index 11dc27543df16..1fa72d1b7caae 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/shared_access_signature.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/shared_access_signature.py @@ -106,8 +106,16 @@ def __init__(self, account_name, account_key, x_ms_version=X_MS_VERSION): self.account_key = account_key self.x_ms_version = x_ms_version - def generate_account(self, services, resource_types, permission, expiry, start=None, - ip=None, protocol=None) -> str: + def generate_account( + self, services, + resource_types, + permission, + expiry, + start=None, + ip=None, + protocol=None, + sts_hook=None, + ) -> str: ''' Generates a shared access signature for the account. Use the returned signature with the sas_token parameter of the service @@ -148,6 +156,10 @@ def generate_account(self, services, resource_types, permission, expiry, start=N :param str protocol: Specifies the protocol permitted for a request made. The default value is https,http. See :class:`~azure.storage.common.models.Protocol` for possible values. + :param sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :type sts_hook: Optional[Callable[[str], None]] :returns: The generated SAS token for the account. :rtype: str ''' @@ -156,12 +168,16 @@ def generate_account(self, services, resource_types, permission, expiry, start=N sas.add_account(services, resource_types) sas.add_account_signature(self.account_name, self.account_key) + if sts_hook is not None: + sts_hook(sas.string_to_sign) + return sas.get_token() class _SharedAccessHelper(object): def __init__(self): self.query_dict = {} + self.string_to_sign = "" def _add_query(self, name, val): if val: @@ -222,6 +238,7 @@ def get_value_to_append(query): self._add_query(QueryStringConstants.SIGNED_SIGNATURE, sign_string(account_key, string_to_sign)) + self.string_to_sign = string_to_sign def get_token(self) -> str: return '&'.join([f'{n}={url_quote(v)}' for n, v in self.query_dict.items() if v is not None]) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared_access_signature.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared_access_signature.py index fddbf745bd439..c6585a8a2732f 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared_access_signature.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared_access_signature.py @@ -5,7 +5,10 @@ # -------------------------------------------------------------------------- # pylint: disable=docstring-keyword-should-match-keyword-only -from typing import Any, Optional, TYPE_CHECKING, Union +from typing import ( + Any, Callable, Optional, Union, + TYPE_CHECKING +) from urllib.parse import parse_qs from azure.storage.queue._shared import sign_string @@ -49,7 +52,8 @@ def generate_queue( start: Optional[Union["datetime", str]] = None, policy_id: Optional[str] = None, ip: Optional[str] = None, - protocol: Optional[str] = None + protocol: Optional[str] = None, + sts_hook: Optional[Callable[[str], None]] = None ) -> str: ''' Generates a shared access signature for the queue. @@ -90,6 +94,10 @@ def generate_queue( :param str protocol: Specifies the protocol permitted for a request made. The default value is https,http. See :class:`~azure.storage.common.models.Protocol` for possible values. + :param sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :type sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str ''' @@ -98,6 +106,9 @@ def generate_queue( sas.add_id(policy_id) sas.add_resource_signature(self.account_name, self.account_key, queue_name) + if sts_hook is not None: + sts_hook(sas.string_to_sign) + return sas.get_token() @@ -131,6 +142,7 @@ def get_value_to_append(query): self._add_query(QueryStringConstants.SIGNED_SIGNATURE, sign_string(account_key, string_to_sign)) + self.string_to_sign = string_to_sign def generate_account_sas( @@ -143,6 +155,7 @@ def generate_account_sas( ip: Optional[str] = None, *, services: Union[Services, str] = Services(queue=True), + sts_hook: Optional[Callable[[str], None]] = None, **kwargs: Any ) -> str: """Generates a shared access signature for the queue service. @@ -180,6 +193,10 @@ def generate_account_sas( Will default to only this package (i.e. queue) if not provided. :keyword str protocol: Specifies the protocol permitted for a request made. The default value is https. + :keyword sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :paramtype sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str """ @@ -191,6 +208,7 @@ def generate_account_sas( expiry=expiry, start=start, ip=ip, + sts_hook=sts_hook, **kwargs ) @@ -204,6 +222,8 @@ def generate_queue_sas( start: Optional[Union["datetime", str]] = None, policy_id: Optional[str] = None, ip: Optional[str] = None, + *, + sts_hook: Optional[Callable[[str], None]] = None, **kwargs: Any ) -> str: """Generates a shared access signature for a queue. @@ -249,6 +269,10 @@ def generate_queue_sas( restricts the request to those IP addresses. :keyword str protocol: Specifies the protocol permitted for a request made. The default value is https. + :keyword sts_hook: + For debugging purposes only. If provided, the hook is called with the string to sign + that was used to generate the SAS. + :paramtype sts_hook: Optional[Callable[[str], None]] :return: A Shared Access Signature (sas) token. :rtype: str @@ -274,6 +298,7 @@ def generate_queue_sas( start=start, policy_id=policy_id, ip=ip, + sts_hook=sts_hook, **kwargs ) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_version.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_version.py index 295470a06c5c6..2962b1a7ddd00 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_version.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_version.py @@ -4,4 +4,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "12.12.0b1" +VERSION = "12.12.0" diff --git a/sdk/storage/azure-storage-queue/setup.py b/sdk/storage/azure-storage-queue/setup.py index 8130656427c5c..ee2dda40b482a 100644 --- a/sdk/storage/azure-storage-queue/setup.py +++ b/sdk/storage/azure-storage-queue/setup.py @@ -46,7 +46,7 @@ url='https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue', keywords="azure, azure sdk", classifiers=[ - 'Development Status :: 4 - Beta', + 'Development Status :: 5 - Production/Stable', 'Programming Language :: Python', "Programming Language :: Python :: 3 :: Only", 'Programming Language :: Python :: 3', @@ -68,14 +68,14 @@ ]), python_requires=">=3.8", install_requires=[ - "azure-core>=1.28.0", + "azure-core>=1.30.0", "cryptography>=2.1.4", "typing-extensions>=4.6.0", "isodate>=0.6.1" ], extras_require={ "aio": [ - "azure-core[aio]>=1.28.0", + "azure-core[aio]>=1.30.0", ], }, ) diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index a22b506e4ad10..34f6fa0eee16e 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -50,7 +50,7 @@ extends: - name: azure-storage-extensions safeName: azurestorageextensions # Pure C-based storage extension package, not generating docs at this moment. - skipPublishDocs: true + skipPublishDocGithubIo: true skipPublishDocMs: true - name: azure-mgmt-storage safeName: azuremgmtstorage diff --git a/sdk/storageactions/azure-mgmt-storageactions/pyproject.toml b/sdk/storageactions/azure-mgmt-storageactions/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/storageactions/azure-mgmt-storageactions/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/storagemover/azure-mgmt-storagemover/pyproject.toml b/sdk/storagemover/azure-mgmt-storagemover/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/storagemover/azure-mgmt-storagemover/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/storagepool/azure-mgmt-storagepool/pyproject.toml b/sdk/storagepool/azure-mgmt-storagepool/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/storagepool/azure-mgmt-storagepool/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/streamanalytics/azure-mgmt-streamanalytics/pyproject.toml b/sdk/streamanalytics/azure-mgmt-streamanalytics/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/streamanalytics/azure-mgmt-streamanalytics/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/subscription/azure-mgmt-subscription/pyproject.toml b/sdk/subscription/azure-mgmt-subscription/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/subscription/azure-mgmt-subscription/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/support/azure-mgmt-support/pyproject.toml b/sdk/support/azure-mgmt-support/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/support/azure-mgmt-support/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/synapse/azure-mgmt-synapse/pyproject.toml b/sdk/synapse/azure-mgmt-synapse/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/synapse/azure-synapse-accesscontrol/pyproject.toml b/sdk/synapse/azure-synapse-accesscontrol/pyproject.toml index a3a58bd090306..b8570555c5c38 100644 --- a/sdk/synapse/azure-synapse-accesscontrol/pyproject.toml +++ b/sdk/synapse/azure-synapse-accesscontrol/pyproject.toml @@ -2,5 +2,4 @@ pylint = false pyright = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/synapse/azure-synapse-artifacts/pyproject.toml b/sdk/synapse/azure-synapse-artifacts/pyproject.toml index 34cc3a9963f3c..b27822eb6df43 100644 --- a/sdk/synapse/azure-synapse-artifacts/pyproject.toml +++ b/sdk/synapse/azure-synapse-artifacts/pyproject.toml @@ -2,5 +2,4 @@ pylint = false pyright = false type_check_samples = false -verifytypes = false sphinx = false diff --git a/sdk/synapse/azure-synapse-managedprivateendpoints/pyproject.toml b/sdk/synapse/azure-synapse-managedprivateendpoints/pyproject.toml index a3a58bd090306..b8570555c5c38 100644 --- a/sdk/synapse/azure-synapse-managedprivateendpoints/pyproject.toml +++ b/sdk/synapse/azure-synapse-managedprivateendpoints/pyproject.toml @@ -2,5 +2,4 @@ pylint = false pyright = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/synapse/azure-synapse-monitoring/pyproject.toml b/sdk/synapse/azure-synapse-monitoring/pyproject.toml index a3a58bd090306..b8570555c5c38 100644 --- a/sdk/synapse/azure-synapse-monitoring/pyproject.toml +++ b/sdk/synapse/azure-synapse-monitoring/pyproject.toml @@ -2,5 +2,4 @@ pylint = false pyright = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/synapse/azure-synapse-spark/pyproject.toml b/sdk/synapse/azure-synapse-spark/pyproject.toml index a3a58bd090306..b8570555c5c38 100644 --- a/sdk/synapse/azure-synapse-spark/pyproject.toml +++ b/sdk/synapse/azure-synapse-spark/pyproject.toml @@ -2,5 +2,4 @@ pylint = false pyright = false type_check_samples = false -verifytypes = false ci_enabled = false diff --git a/sdk/testbase/azure-mgmt-testbase/pyproject.toml b/sdk/testbase/azure-mgmt-testbase/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/timeseriesinsights/azure-mgmt-timeseriesinsights/pyproject.toml b/sdk/timeseriesinsights/azure-mgmt-timeseriesinsights/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/timeseriesinsights/azure-mgmt-timeseriesinsights/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/trafficmanager/azure-mgmt-trafficmanager/pyproject.toml b/sdk/trafficmanager/azure-mgmt-trafficmanager/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/trafficmanager/azure-mgmt-trafficmanager/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/pyproject.toml b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/vision/tests.yml b/sdk/vision/tests.yml new file mode 100644 index 0000000000000..29ae38ad5ef17 --- /dev/null +++ b/sdk/vision/tests.yml @@ -0,0 +1,7 @@ +trigger: none + +# NOTE: Service live tests are NOT enabled. This file only enables the analyze stage currently. +extends: + template: /eng/pipelines/templates/stages/python-analyze-weekly-standalone.yml + parameters: + ServiceDirectory: vision diff --git a/sdk/voiceservices/azure-mgmt-voiceservices/pyproject.toml b/sdk/voiceservices/azure-mgmt-voiceservices/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/voiceservices/azure-mgmt-voiceservices/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/webpubsub/azure-messaging-webpubsubclient/pyproject.toml b/sdk/webpubsub/azure-messaging-webpubsubclient/pyproject.toml index 45f4a483fc063..90102e2ec3386 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubclient/pyproject.toml +++ b/sdk/webpubsub/azure-messaging-webpubsubclient/pyproject.toml @@ -2,4 +2,3 @@ pylint = false pyright = false type_check_samples = false -verifytypes = false diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/CHANGELOG.md b/sdk/webpubsub/azure-messaging-webpubsubservice/CHANGELOG.md index 447b4347852e1..550864fbaf737 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/CHANGELOG.md +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.1.1 (Unreleased) +## 1.2.2 (Unreleased) ### Features Added @@ -10,6 +10,18 @@ ### Other Changes +## 1.2.1 (2024-08-13) + +### Bugs Fixed +- Fix endpoint parsing issues + +## 1.2.0 (2024-08-08) + +### Features Added +- Change API version to `2024-01-01` +- Added a `webpubsub_client_access` option to specify the type of client access when generating token. This is used to generate token and client connection URL for a specific client endpoint type +- Added operations `add_connections_to_groups` and `remove_connections_from_groups` + ## 1.1.0 (2024-04-24) ### Bugs Fixed diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/__init__.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/__init__.py index c62fc8fea7863..e12a3479f5c4a 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/__init__.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["WebPubSubServiceClient"] +__all__ = [ + "WebPubSubServiceClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_client.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_client.py index c65ee51b18bbe..d9206c0fff998 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_client.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_client.py @@ -8,8 +8,10 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core import PipelineClient +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from ._configuration import WebPubSubServiceClientConfiguration @@ -33,21 +35,38 @@ class WebPubSubServiceClient( :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-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, hub: str, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: - _endpoint = "{Endpoint}" + _endpoint = "{endpoint}" self._config = WebPubSubServiceClientConfiguration(hub=hub, endpoint=endpoint, credential=credential, **kwargs) - self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -67,21 +86,18 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "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) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> WebPubSubServiceClient + def __enter__(self) -> Self: self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_configuration.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_configuration.py index 4f8d6fa8e8f4e..d8eb9e09b989b 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_configuration.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from ._version import VERSION @@ -18,7 +17,7 @@ from azure.core.credentials import TokenCredential -class WebPubSubServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class WebPubSubServiceClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for WebPubSubServiceClient. Note that all parameters used to create this instance are saved as instance @@ -31,14 +30,13 @@ class WebPubSubServiceClientConfiguration(Configuration): # pylint: disable=too :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-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, hub: str, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: - super(WebPubSubServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-11-01") # type: str + api_version: str = kwargs.pop("api_version", "2024-01-01") if hub is None: raise ValueError("Parameter 'hub' must not be None.") @@ -53,20 +51,18 @@ def __init__(self, hub: str, endpoint: str, credential: "TokenCredential", **kwa self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://webpubsub.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "messaging-webpubsubservice/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = policies.BearerTokenCredentialPolicy( diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/__init__.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/__init__.py index b5ccfcd01e1b9..b3272b3ee978c 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/__init__.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/__init__.py @@ -9,7 +9,7 @@ from ._operations import WebPubSubServiceClientOperationsMixin from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/_operations.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/_operations.py index 67f7532bd8ae9..5b197221a1563 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/_operations.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, cast +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,13 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from .._serialization import Serializer -from .._vendor import MixinABC, _format_url_section +from .._vendor import WebPubSubServiceClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -38,13 +38,13 @@ _SERIALIZER.client_side_validation = False -def build_close_all_connections_request( +def build_web_pub_sub_service_close_all_connections_request( # pylint: disable=name-too-long hub: str, *, excluded: Optional[List[str]] = None, reason: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +53,7 @@ def build_close_all_connections_request( "hub": _SERIALIZER.url("hub", hub, "str", pattern=r"^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if excluded is not None: @@ -68,19 +68,20 @@ def build_close_all_connections_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_client_access_token_request( +def build_web_pub_sub_service_get_client_access_token_request( # pylint: disable=name-too-long hub: str, *, user_id: Optional[str] = None, roles: Optional[List[str]] = None, minutes_to_expire: int = 60, groups: Optional[List[str]] = None, + client_type: str = "Default", **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json, text/json") # Construct URL @@ -89,7 +90,7 @@ def build_get_client_access_token_request( "hub": _SERIALIZER.url("hub", hub, "str", pattern=r"^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if user_id is not None: @@ -101,6 +102,8 @@ def build_get_client_access_token_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if groups is not None: _params["group"] = [_SERIALIZER.query("groups", q, "str") if q is not None else "" for q in groups] + if client_type is not None: + _params["clientType"] = _SERIALIZER.query("client_type", client_type, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -108,14 +111,20 @@ def build_get_client_access_token_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_send_to_all_request( - hub: str, *, content: IO, excluded: Optional[List[str]] = None, filter: Optional[str] = None, **kwargs: Any +def build_web_pub_sub_service_send_to_all_request( # pylint: disable=name-too-long + hub: str, + *, + content: IO[bytes], + excluded: Optional[List[str]] = None, + filter: Optional[str] = None, + message_ttl_seconds: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +133,7 @@ def build_send_to_all_request( "hub": _SERIALIZER.url("hub", hub, "str", pattern=r"^[A-Za-z][A-Za-z0-9_`,.[\]]{0,127}$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if excluded is not None: @@ -132,6 +141,10 @@ def build_send_to_all_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: _params["filter"] = _SERIALIZER.query("filter", filter, "str") + if message_ttl_seconds is not None: + _params["messageTtlSeconds"] = _SERIALIZER.query( + "message_ttl_seconds", message_ttl_seconds, "int", maximum=300, minimum=0 + ) # Construct headers if content_type is not None: @@ -141,13 +154,13 @@ def build_send_to_all_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, content=content, **kwargs) -def build_close_connection_request( +def build_web_pub_sub_service_close_connection_request( # pylint: disable=name-too-long connection_id: str, hub: str, *, reason: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +170,7 @@ def build_close_connection_request( "connectionId": _SERIALIZER.url("connection_id", connection_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if reason is not None: @@ -170,10 +183,12 @@ def build_close_connection_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_connection_exists_request(connection_id: str, hub: str, **kwargs: Any) -> HttpRequest: +def build_web_pub_sub_service_connection_exists_request( # pylint: disable=name-too-long + connection_id: str, hub: str, **kwargs: Any +) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) # Construct URL _url = "/api/hubs/{hub}/connections/{connectionId}" path_format_arguments = { @@ -181,7 +196,7 @@ def build_connection_exists_request(connection_id: str, hub: str, **kwargs: Any) "connectionId": _SERIALIZER.url("connection_id", connection_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -189,12 +204,14 @@ def build_connection_exists_request(connection_id: str, hub: str, **kwargs: Any) return HttpRequest(method="HEAD", url=_url, params=_params, **kwargs) -def build_send_to_connection_request(connection_id: str, hub: str, *, content: IO, **kwargs: Any) -> HttpRequest: +def build_web_pub_sub_service_send_to_connection_request( # pylint: disable=name-too-long + connection_id: str, hub: str, *, content: IO[bytes], message_ttl_seconds: Optional[int] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,10 +221,14 @@ def build_send_to_connection_request(connection_id: str, hub: str, *, content: I "connectionId": _SERIALIZER.url("connection_id", connection_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if message_ttl_seconds is not None: + _params["messageTtlSeconds"] = _SERIALIZER.query( + "message_ttl_seconds", message_ttl_seconds, "int", maximum=300, minimum=0 + ) # Construct headers if content_type is not None: @@ -217,11 +238,13 @@ def build_send_to_connection_request(connection_id: str, hub: str, *, content: I return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, content=content, **kwargs) -def build_remove_connection_from_all_groups_request(connection_id: str, hub: str, **kwargs: Any) -> HttpRequest: +def build_web_pub_sub_service_remove_connection_from_all_groups_request( # pylint: disable=name-too-long + connection_id: str, hub: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +254,7 @@ def build_remove_connection_from_all_groups_request(connection_id: str, hub: str "connectionId": _SERIALIZER.url("connection_id", connection_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,10 +265,12 @@ def build_remove_connection_from_all_groups_request(connection_id: str, hub: str return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_group_exists_request(group: str, hub: str, **kwargs: Any) -> HttpRequest: +def build_web_pub_sub_service_group_exists_request( # pylint: disable=name-too-long + group: str, hub: str, **kwargs: Any +) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) # Construct URL _url = "/api/hubs/{hub}/groups/{group}" path_format_arguments = { @@ -253,7 +278,7 @@ def build_group_exists_request(group: str, hub: str, **kwargs: Any) -> HttpReque "group": _SERIALIZER.url("group", group, "str", max_length=1024, min_length=1, pattern=r"^(?!\s+$).+$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -261,13 +286,13 @@ def build_group_exists_request(group: str, hub: str, **kwargs: Any) -> HttpReque return HttpRequest(method="HEAD", url=_url, params=_params, **kwargs) -def build_close_group_connections_request( +def build_web_pub_sub_service_close_group_connections_request( # pylint: disable=name-too-long group: str, hub: str, *, excluded: Optional[List[str]] = None, reason: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -277,7 +302,7 @@ def build_close_group_connections_request( "group": _SERIALIZER.url("group", group, "str", max_length=1024, min_length=1, pattern=r"^(?!\s+$).+$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if excluded is not None: @@ -292,20 +317,21 @@ def build_close_group_connections_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_send_to_group_request( +def build_web_pub_sub_service_send_to_group_request( # pylint: disable=name-too-long group: str, hub: str, *, - content: IO, + content: IO[bytes], excluded: Optional[List[str]] = None, filter: Optional[str] = None, + message_ttl_seconds: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -315,7 +341,7 @@ def build_send_to_group_request( "group": _SERIALIZER.url("group", group, "str", max_length=1024, min_length=1, pattern=r"^(?!\s+$).+$"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if excluded is not None: @@ -323,6 +349,10 @@ def build_send_to_group_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: _params["filter"] = _SERIALIZER.query("filter", filter, "str") + if message_ttl_seconds is not None: + _params["messageTtlSeconds"] = _SERIALIZER.query( + "message_ttl_seconds", message_ttl_seconds, "int", maximum=300, minimum=0 + ) # Construct headers if content_type is not None: @@ -332,11 +362,13 @@ def build_send_to_group_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, content=content, **kwargs) -def build_remove_connection_from_group_request(group: str, connection_id: str, hub: str, **kwargs: Any) -> HttpRequest: +def build_web_pub_sub_service_remove_connection_from_group_request( # pylint: disable=name-too-long + group: str, connection_id: str, hub: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -347,7 +379,7 @@ def build_remove_connection_from_group_request(group: str, connection_id: str, h "connectionId": _SERIALIZER.url("connection_id", connection_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -358,11 +390,13 @@ def build_remove_connection_from_group_request(group: str, connection_id: str, h return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_add_connection_to_group_request(group: str, connection_id: str, hub: str, **kwargs: Any) -> HttpRequest: +def build_web_pub_sub_service_add_connection_to_group_request( # pylint: disable=name-too-long + group: str, connection_id: str, hub: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -373,7 +407,7 @@ def build_add_connection_to_group_request(group: str, connection_id: str, hub: s "connectionId": _SERIALIZER.url("connection_id", connection_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -384,13 +418,13 @@ def build_add_connection_to_group_request(group: str, connection_id: str, hub: s return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_revoke_permission_request( +def build_web_pub_sub_service_revoke_permission_request( # pylint: disable=name-too-long permission: str, connection_id: str, hub: str, *, target_name: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -401,7 +435,7 @@ def build_revoke_permission_request( "connectionId": _SERIALIZER.url("connection_id", connection_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if target_name is not None: @@ -414,12 +448,12 @@ def build_revoke_permission_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_has_permission_request( +def build_web_pub_sub_service_has_permission_request( # pylint: disable=name-too-long permission: str, connection_id: str, hub: str, *, target_name: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) # Construct URL _url = "/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}" path_format_arguments = { @@ -428,7 +462,7 @@ def build_has_permission_request( "connectionId": _SERIALIZER.url("connection_id", connection_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if target_name is not None: @@ -438,13 +472,13 @@ def build_has_permission_request( return HttpRequest(method="HEAD", url=_url, params=_params, **kwargs) -def build_grant_permission_request( +def build_web_pub_sub_service_grant_permission_request( # pylint: disable=name-too-long permission: str, connection_id: str, hub: str, *, target_name: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -455,7 +489,7 @@ def build_grant_permission_request( "connectionId": _SERIALIZER.url("connection_id", connection_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if target_name is not None: @@ -468,10 +502,12 @@ def build_grant_permission_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_user_exists_request(user_id: str, hub: str, **kwargs: Any) -> HttpRequest: +def build_web_pub_sub_service_user_exists_request( # pylint: disable=name-too-long + user_id: str, hub: str, **kwargs: Any +) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) # Construct URL _url = "/api/hubs/{hub}/users/{userId}" path_format_arguments = { @@ -479,7 +515,7 @@ def build_user_exists_request(user_id: str, hub: str, **kwargs: Any) -> HttpRequ "userId": _SERIALIZER.url("user_id", user_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -487,13 +523,13 @@ def build_user_exists_request(user_id: str, hub: str, **kwargs: Any) -> HttpRequ return HttpRequest(method="HEAD", url=_url, params=_params, **kwargs) -def build_close_user_connections_request( +def build_web_pub_sub_service_close_user_connections_request( # pylint: disable=name-too-long user_id: str, hub: str, *, excluded: Optional[List[str]] = None, reason: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -503,7 +539,7 @@ def build_close_user_connections_request( "userId": _SERIALIZER.url("user_id", user_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if excluded is not None: @@ -518,14 +554,20 @@ def build_close_user_connections_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_send_to_user_request( - user_id: str, hub: str, *, content: IO, filter: Optional[str] = None, **kwargs: Any +def build_web_pub_sub_service_send_to_user_request( # pylint: disable=name-too-long + user_id: str, + hub: str, + *, + content: IO[bytes], + filter: Optional[str] = None, + message_ttl_seconds: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -535,12 +577,16 @@ def build_send_to_user_request( "userId": _SERIALIZER.url("user_id", user_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: _params["filter"] = _SERIALIZER.query("filter", filter, "str") + if message_ttl_seconds is not None: + _params["messageTtlSeconds"] = _SERIALIZER.query( + "message_ttl_seconds", message_ttl_seconds, "int", maximum=300, minimum=0 + ) # Construct headers if content_type is not None: @@ -550,11 +596,13 @@ def build_send_to_user_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, content=content, **kwargs) -def build_remove_user_from_all_groups_request(user_id: str, hub: str, **kwargs: Any) -> HttpRequest: +def build_web_pub_sub_service_remove_user_from_all_groups_request( # pylint: disable=name-too-long + user_id: str, hub: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -564,7 +612,7 @@ def build_remove_user_from_all_groups_request(user_id: str, hub: str, **kwargs: "userId": _SERIALIZER.url("user_id", user_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -575,11 +623,13 @@ def build_remove_user_from_all_groups_request(user_id: str, hub: str, **kwargs: return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_remove_user_from_group_request(group: str, user_id: str, hub: str, **kwargs: Any) -> HttpRequest: +def build_web_pub_sub_service_remove_user_from_group_request( # pylint: disable=name-too-long + group: str, user_id: str, hub: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -590,7 +640,7 @@ def build_remove_user_from_group_request(group: str, user_id: str, hub: str, **k "userId": _SERIALIZER.url("user_id", user_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -601,11 +651,13 @@ def build_remove_user_from_group_request(group: str, user_id: str, hub: str, **k return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_add_user_to_group_request(group: str, user_id: str, hub: str, **kwargs: Any) -> HttpRequest: +def build_web_pub_sub_service_add_user_to_group_request( # pylint: disable=name-too-long + group: str, user_id: str, hub: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) # type: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -616,7 +668,7 @@ def build_add_user_to_group_request(group: str, user_id: str, hub: str, **kwargs "userId": _SERIALIZER.url("user_id", user_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -627,7 +679,8 @@ def build_add_user_to_group_request(group: str, user_id: str, hub: str, **kwargs return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -class WebPubSubServiceClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods +class WebPubSubServiceClientOperationsMixin(WebPubSubServiceClientMixinABC): # pylint: disable=too-many-public-methods + @distributed_trace def close_all_connections( # pylint: disable=inconsistent-return-statements self, *, excluded: Optional[List[str]] = None, reason: Optional[str] = None, **kwargs: Any @@ -645,7 +698,7 @@ def close_all_connections( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,9 +709,9 @@ def close_all_connections( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_close_all_connections_request( + _request = build_web_pub_sub_service_close_all_connections_request( hub=self._config.hub, excluded=excluded, reason=reason, @@ -667,12 +720,13 @@ def close_all_connections( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -682,7 +736,7 @@ def close_all_connections( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get_client_access_token( @@ -692,6 +746,7 @@ def get_client_access_token( roles: Optional[List[str]] = None, minutes_to_expire: int = 60, groups: Optional[List[str]] = None, + client_protocol: str = "Default", **kwargs: Any ) -> JSON: """Generate token for the client to connect Azure Web PubSub service. @@ -707,6 +762,10 @@ def get_client_access_token( :paramtype minutes_to_expire: int :keyword groups: Groups that the connection will join when it connects. Default value is None. :paramtype groups: list[str] + :keyword client_protocol: The type of client protocol. Case-insensitive. If not set, it's "Default". For Web + PubSub for Socket.IO, only the default value is supported. For Web PubSub, the valid values are + 'Default' and 'MQTT'. Known values are: "Default" and "MQTT". Default value is "Default". + :paramtype client_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -716,11 +775,10 @@ def get_client_access_token( # response body for status code(s): 200 response == { - "token": "str" # Optional. The token value for the WebSocket client to - connect to the service. + "token": "str" } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -731,25 +789,27 @@ def get_client_access_token( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) - request = build_get_client_access_token_request( + _request = build_web_pub_sub_service_get_client_access_token_request( hub=self._config.hub, user_id=user_id, roles=roles, minutes_to_expire=minutes_to_expire, groups=groups, + client_type=client_protocol, api_version=self._config.api_version, headers=_headers, params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -764,30 +824,42 @@ def get_client_access_token( deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace def send_to_all( # pylint: disable=inconsistent-return-statements - self, message: IO, *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, **kwargs: Any + self, + message: IO[bytes], + *, + excluded: Optional[List[str]] = None, + filter: Optional[str] = None, + message_ttl_seconds: Optional[int] = None, + **kwargs: Any ) -> None: """Broadcast content inside request body to all the connected client connections. Broadcast content inside request body to all the connected client connections. :param message: The payload body. Required. - :type message: IO + :type message: IO[bytes] :keyword excluded: Excluded connection Ids. Default value is None. :paramtype excluded: list[str] :keyword filter: Following OData filter syntax to filter out the subscribers receiving the messages. Default value is None. :paramtype filter: str + :keyword message_ttl_seconds: The time-to-live (TTL) value in seconds for messages sent to the + service. 0 is the default value, which means the message never expires. 300 is the maximum + value. If this parameter is non-zero, messages that are not consumed by the client within the + specified TTL will be dropped by the service. This parameter can help when the client's + bandwidth is limited. Default value is None. + :paramtype message_ttl_seconds: int :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -798,15 +870,16 @@ def send_to_all( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _content = message - request = build_send_to_all_request( + _request = build_web_pub_sub_service_send_to_all_request( hub=self._config.hub, excluded=excluded, filter=filter, + message_ttl_seconds=message_ttl_seconds, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -814,12 +887,13 @@ def send_to_all( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -829,7 +903,7 @@ def send_to_all( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def close_connection( # pylint: disable=inconsistent-return-statements @@ -847,7 +921,7 @@ def close_connection( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -858,9 +932,9 @@ def close_connection( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_close_connection_request( + _request = build_web_pub_sub_service_close_connection_request( connection_id=connection_id, hub=self._config.hub, reason=reason, @@ -869,12 +943,13 @@ def close_connection( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -884,7 +959,7 @@ def close_connection( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def connection_exists(self, connection_id: str, **kwargs: Any) -> bool: @@ -898,7 +973,7 @@ def connection_exists(self, connection_id: str, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -909,9 +984,9 @@ def connection_exists(self, connection_id: str, **kwargs: Any) -> bool: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_connection_exists_request( + _request = build_web_pub_sub_service_connection_exists_request( connection_id=connection_id, hub=self._config.hub, api_version=self._config.api_version, @@ -919,12 +994,13 @@ def connection_exists(self, connection_id: str, **kwargs: Any) -> bool: params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -934,12 +1010,12 @@ def connection_exists(self, connection_id: str, **kwargs: Any) -> bool: raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 @distributed_trace def send_to_connection( # pylint: disable=inconsistent-return-statements - self, connection_id: str, message: IO, **kwargs: Any + self, connection_id: str, message: IO[bytes], *, message_ttl_seconds: Optional[int] = None, **kwargs: Any ) -> None: """Send content inside request body to the specific connection. @@ -948,12 +1024,18 @@ def send_to_connection( # pylint: disable=inconsistent-return-statements :param connection_id: The connection Id. Required. :type connection_id: str :param message: The payload body. Required. - :type message: IO + :type message: IO[bytes] + :keyword message_ttl_seconds: The time-to-live (TTL) value in seconds for messages sent to the + service. 0 is the default value, which means the message never expires. 300 is the maximum + value. If this parameter is non-zero, messages that are not consumed by the client within the + specified TTL will be dropped by the service. This parameter can help when the client's + bandwidth is limited. Default value is None. + :paramtype message_ttl_seconds: int :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -964,14 +1046,15 @@ def send_to_connection( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _content = message - request = build_send_to_connection_request( + _request = build_web_pub_sub_service_send_to_connection_request( connection_id=connection_id, hub=self._config.hub, + message_ttl_seconds=message_ttl_seconds, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -979,12 +1062,13 @@ def send_to_connection( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -994,7 +1078,7 @@ def send_to_connection( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def remove_connection_from_all_groups( # pylint: disable=inconsistent-return-statements @@ -1010,7 +1094,7 @@ def remove_connection_from_all_groups( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1021,9 +1105,9 @@ def remove_connection_from_all_groups( # pylint: disable=inconsistent-return-st _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_remove_connection_from_all_groups_request( + _request = build_web_pub_sub_service_remove_connection_from_all_groups_request( connection_id=connection_id, hub=self._config.hub, api_version=self._config.api_version, @@ -1031,12 +1115,13 @@ def remove_connection_from_all_groups( # pylint: disable=inconsistent-return-st params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1046,7 +1131,7 @@ def remove_connection_from_all_groups( # pylint: disable=inconsistent-return-st raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def group_exists(self, group: str, **kwargs: Any) -> bool: @@ -1061,7 +1146,7 @@ def group_exists(self, group: str, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1072,9 +1157,9 @@ def group_exists(self, group: str, **kwargs: Any) -> bool: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_group_exists_request( + _request = build_web_pub_sub_service_group_exists_request( group=group, hub=self._config.hub, api_version=self._config.api_version, @@ -1082,12 +1167,13 @@ def group_exists(self, group: str, **kwargs: Any) -> bool: params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1097,7 +1183,7 @@ def group_exists(self, group: str, **kwargs: Any) -> bool: raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 @distributed_trace @@ -1120,7 +1206,7 @@ def close_group_connections( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1131,9 +1217,9 @@ def close_group_connections( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_close_group_connections_request( + _request = build_web_pub_sub_service_close_group_connections_request( group=group, hub=self._config.hub, excluded=excluded, @@ -1143,12 +1229,13 @@ def close_group_connections( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1158,16 +1245,17 @@ def close_group_connections( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def send_to_group( # pylint: disable=inconsistent-return-statements self, group: str, - message: IO, + message: IO[bytes], *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, + message_ttl_seconds: Optional[int] = None, **kwargs: Any ) -> None: """Send content inside request body to a group of connections. @@ -1178,17 +1266,23 @@ def send_to_group( # pylint: disable=inconsistent-return-statements Required. :type group: str :param message: The payload body. Required. - :type message: IO + :type message: IO[bytes] :keyword excluded: Excluded connection Ids. Default value is None. :paramtype excluded: list[str] :keyword filter: Following OData filter syntax to filter out the subscribers receiving the messages. Default value is None. :paramtype filter: str + :keyword message_ttl_seconds: The time-to-live (TTL) value in seconds for messages sent to the + service. 0 is the default value, which means the message never expires. 300 is the maximum + value. If this parameter is non-zero, messages that are not consumed by the client within the + specified TTL will be dropped by the service. This parameter can help when the client's + bandwidth is limited. Default value is None. + :paramtype message_ttl_seconds: int :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1199,16 +1293,17 @@ def send_to_group( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _content = message - request = build_send_to_group_request( + _request = build_web_pub_sub_service_send_to_group_request( group=group, hub=self._config.hub, excluded=excluded, filter=filter, + message_ttl_seconds=message_ttl_seconds, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -1216,12 +1311,13 @@ def send_to_group( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1231,7 +1327,7 @@ def send_to_group( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def remove_connection_from_group( # pylint: disable=inconsistent-return-statements @@ -1250,7 +1346,7 @@ def remove_connection_from_group( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1261,9 +1357,9 @@ def remove_connection_from_group( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_remove_connection_from_group_request( + _request = build_web_pub_sub_service_remove_connection_from_group_request( group=group, connection_id=connection_id, hub=self._config.hub, @@ -1272,12 +1368,13 @@ def remove_connection_from_group( # pylint: disable=inconsistent-return-stateme params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1287,7 +1384,7 @@ def remove_connection_from_group( # pylint: disable=inconsistent-return-stateme raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def add_connection_to_group( # pylint: disable=inconsistent-return-statements @@ -1306,7 +1403,7 @@ def add_connection_to_group( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1317,9 +1414,9 @@ def add_connection_to_group( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_add_connection_to_group_request( + _request = build_web_pub_sub_service_add_connection_to_group_request( group=group, connection_id=connection_id, hub=self._config.hub, @@ -1328,12 +1425,13 @@ def add_connection_to_group( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1343,7 +1441,7 @@ def add_connection_to_group( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def revoke_permission( # pylint: disable=inconsistent-return-statements @@ -1366,7 +1464,7 @@ def revoke_permission( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1377,9 +1475,9 @@ def revoke_permission( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revoke_permission_request( + _request = build_web_pub_sub_service_revoke_permission_request( permission=permission, connection_id=connection_id, hub=self._config.hub, @@ -1389,12 +1487,13 @@ def revoke_permission( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1404,7 +1503,7 @@ def revoke_permission( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def has_permission( @@ -1427,7 +1526,7 @@ def has_permission( :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1438,9 +1537,9 @@ def has_permission( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_has_permission_request( + _request = build_web_pub_sub_service_has_permission_request( permission=permission, connection_id=connection_id, hub=self._config.hub, @@ -1450,12 +1549,13 @@ def has_permission( params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1465,7 +1565,7 @@ def has_permission( raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 @distributed_trace @@ -1489,7 +1589,7 @@ def grant_permission( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1500,9 +1600,9 @@ def grant_permission( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_grant_permission_request( + _request = build_web_pub_sub_service_grant_permission_request( permission=permission, connection_id=connection_id, hub=self._config.hub, @@ -1512,12 +1612,13 @@ def grant_permission( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1527,7 +1628,7 @@ def grant_permission( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def user_exists(self, user_id: str, **kwargs: Any) -> bool: @@ -1541,7 +1642,7 @@ def user_exists(self, user_id: str, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1552,9 +1653,9 @@ def user_exists(self, user_id: str, **kwargs: Any) -> bool: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_user_exists_request( + _request = build_web_pub_sub_service_user_exists_request( user_id=user_id, hub=self._config.hub, api_version=self._config.api_version, @@ -1562,12 +1663,13 @@ def user_exists(self, user_id: str, **kwargs: Any) -> bool: params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1577,7 +1679,7 @@ def user_exists(self, user_id: str, **kwargs: Any) -> bool: raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 @distributed_trace @@ -1599,7 +1701,7 @@ def close_user_connections( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1610,9 +1712,9 @@ def close_user_connections( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_close_user_connections_request( + _request = build_web_pub_sub_service_close_user_connections_request( user_id=user_id, hub=self._config.hub, excluded=excluded, @@ -1622,12 +1724,13 @@ def close_user_connections( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1637,11 +1740,17 @@ def close_user_connections( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def send_to_user( # pylint: disable=inconsistent-return-statements - self, user_id: str, message: IO, *, filter: Optional[str] = None, **kwargs: Any + self, + user_id: str, + message: IO[bytes], + *, + filter: Optional[str] = None, + message_ttl_seconds: Optional[int] = None, + **kwargs: Any ) -> None: """Send content inside request body to the specific user. @@ -1650,15 +1759,21 @@ def send_to_user( # pylint: disable=inconsistent-return-statements :param user_id: The user Id. Required. :type user_id: str :param message: The payload body. Required. - :type message: IO + :type message: IO[bytes] :keyword filter: Following OData filter syntax to filter out the subscribers receiving the messages. Default value is None. :paramtype filter: str + :keyword message_ttl_seconds: The time-to-live (TTL) value in seconds for messages sent to the + service. 0 is the default value, which means the message never expires. 300 is the maximum + value. If this parameter is non-zero, messages that are not consumed by the client within the + specified TTL will be dropped by the service. This parameter can help when the client's + bandwidth is limited. Default value is None. + :paramtype message_ttl_seconds: int :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1669,15 +1784,16 @@ def send_to_user( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _content = message - request = build_send_to_user_request( + _request = build_web_pub_sub_service_send_to_user_request( user_id=user_id, hub=self._config.hub, filter=filter, + message_ttl_seconds=message_ttl_seconds, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -1685,12 +1801,13 @@ def send_to_user( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1700,7 +1817,7 @@ def send_to_user( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def remove_user_from_all_groups( # pylint: disable=inconsistent-return-statements @@ -1716,7 +1833,7 @@ def remove_user_from_all_groups( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1727,9 +1844,9 @@ def remove_user_from_all_groups( # pylint: disable=inconsistent-return-statemen _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_remove_user_from_all_groups_request( + _request = build_web_pub_sub_service_remove_user_from_all_groups_request( user_id=user_id, hub=self._config.hub, api_version=self._config.api_version, @@ -1737,12 +1854,13 @@ def remove_user_from_all_groups( # pylint: disable=inconsistent-return-statemen params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1752,7 +1870,7 @@ def remove_user_from_all_groups( # pylint: disable=inconsistent-return-statemen raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def remove_user_from_group( # pylint: disable=inconsistent-return-statements @@ -1771,7 +1889,7 @@ def remove_user_from_group( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1782,9 +1900,9 @@ def remove_user_from_group( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_remove_user_from_group_request( + _request = build_web_pub_sub_service_remove_user_from_group_request( group=group, user_id=user_id, hub=self._config.hub, @@ -1793,12 +1911,13 @@ def remove_user_from_group( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1808,7 +1927,7 @@ def remove_user_from_group( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def add_user_to_group( # pylint: disable=inconsistent-return-statements @@ -1827,7 +1946,7 @@ def add_user_to_group( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1838,9 +1957,9 @@ def add_user_to_group( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_add_user_to_group_request( + _request = build_web_pub_sub_service_add_user_to_group_request( group=group, user_id=user_id, hub=self._config.hub, @@ -1849,12 +1968,13 @@ def add_user_to_group( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1864,4 +1984,4 @@ def add_user_to_group( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/_patch.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/_patch.py index 4b4e9f010dd7f..38dcf4b2afe80 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/_patch.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize @@ -23,10 +24,10 @@ from ._operations import ( WebPubSubServiceClientOperationsMixin as WebPubSubServiceClientOperationsMixinGenerated, JSON, - build_send_to_all_request, - build_send_to_connection_request, - build_send_to_user_request, - build_send_to_group_request, + build_web_pub_sub_service_send_to_all_request, + build_web_pub_sub_service_send_to_connection_request, + build_web_pub_sub_service_send_to_user_request, + build_web_pub_sub_service_send_to_group_request, ) @@ -45,10 +46,12 @@ def dst(self, dt): return self.__class__.ZERO -def get_token_by_key(endpoint: str, hub: str, key: str, **kwargs: Any) -> str: +def get_token_by_key(endpoint: str, path: str, hub: str, key: str, **kwargs: Any) -> str: """build token with access key. :param endpoint: HTTPS endpoint for the WebPubSub service instance. :type endpoint: str + :param path: HTTPS path for the WebPubSub service instance. + :type endpoint: str :param hub: The hub to give access to. :type hub: str :param key: The access key @@ -57,7 +60,7 @@ def get_token_by_key(endpoint: str, hub: str, key: str, **kwargs: Any) -> str: :returns: token :rtype: str """ - audience = "{}/client/hubs/{}".format(endpoint, hub) + audience = endpoint + path + hub user = kwargs.pop("user_id", None) ttl = timedelta(minutes=kwargs.pop("minutes_to_expire", 60)) roles = kwargs.pop("roles", []) @@ -80,7 +83,7 @@ def get_token_by_key(endpoint: str, hub: str, key: str, **kwargs: Any) -> str: class WebPubSubServiceClientOperationsMixin(WebPubSubServiceClientOperationsMixinGenerated): @distributed_trace - def get_client_access_token(self, **kwargs: Any) -> JSON: + def get_client_access_token(self, *, client_protocol: Optional[str] = "Default", **kwargs: Any) -> JSON: """Build an authentication token. :keyword user_id: User Id. @@ -92,6 +95,10 @@ def get_client_access_token(self, **kwargs: Any) -> JSON: :keyword dict[str, any] jwt_headers: Any headers you want to pass to jwt encoding. :keyword groups: Groups that the connection will join when it connects. Default value is None. :paramtype groups: list[str] + :keyword client_protocol: The type of client protocol. Case-insensitive. If not set, it's "Default". For Web + PubSub for Socket.IO, only the default value is supported. For Web PubSub, the valid values are + 'Default' and 'MQTT'. Known values are: "Default" and "MQTT". Default value is "Default". + :paramtype client_type: str :returns: JSON response containing the web socket endpoint, the token and a url with the generated access token. :rtype: JSON @@ -110,17 +117,22 @@ def get_client_access_token(self, **kwargs: Any) -> JSON: "Invalid endpoint: '{}' has unknown scheme - expected 'http://' or 'https://'".format(endpoint) ) # Ensure endpoint has no trailing slash + endpoint = endpoint.rstrip("/") # Switch from http(s) to ws(s) scheme + client_endpoint = "ws" + endpoint[4:] hub = self._config.hub - client_url = "{}/client/hubs/{}".format(client_endpoint, hub) + path = "/clients/mqtt/hubs/" if client_protocol.lower() == "mqtt" else "/client/hubs/" + # Example URL for Default Client Type: https://.webpubsub.azure.com/client/hubs/ + # and for MQTT Client Type: https://.webpubsub.azure.com/clients/mqtt/hubs/ + client_url = client_endpoint + path + hub jwt_headers = kwargs.pop("jwt_headers", {}) if isinstance(self._config.credential, AzureKeyCredential): - token = get_token_by_key(endpoint, hub, self._config.credential.key, jwt_headers=jwt_headers, **kwargs) + token = get_token_by_key(endpoint, path, hub, self._config.credential.key, jwt_headers=jwt_headers, **kwargs) else: - token = super().get_client_access_token(**kwargs).get("token") + token = super().get_client_access_token(client_protocol=client_protocol, **kwargs).get("token") return { "baseUrl": client_url, "token": token, @@ -131,7 +143,13 @@ def get_client_access_token(self, **kwargs: Any) -> JSON: @overload def send_to_all( # pylint: disable=inconsistent-return-statements - self, message: Union[str, JSON], *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, content_type: Optional[str] = "application/json", **kwargs: Any + self, + message: Union[str, JSON], + *, + excluded: Optional[List[str]] = None, + filter: Optional[str] = None, + content_type: Optional[str] = "application/json", + **kwargs: Any ) -> None: """Broadcast content inside request body to all the connected client connections. @@ -153,7 +171,13 @@ def send_to_all( # pylint: disable=inconsistent-return-statements @overload def send_to_all( # pylint: disable=inconsistent-return-statements - self, message: str, *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, content_type: Optional[str] = "text/plain", **kwargs: Any + self, + message: str, + *, + excluded: Optional[List[str]] = None, + filter: Optional[str] = None, + content_type: Optional[str] = "text/plain", + **kwargs: Any ) -> None: """Broadcast content inside request body to all the connected client connections. @@ -175,7 +199,13 @@ def send_to_all( # pylint: disable=inconsistent-return-statements @overload def send_to_all( # pylint: disable=inconsistent-return-statements - self, message: IO, *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, content_type: Optional[str] = "application/octet-stream", **kwargs: Any + self, + message: IO, + *, + excluded: Optional[List[str]] = None, + filter: Optional[str] = None, + content_type: Optional[str] = "application/octet-stream", + **kwargs: Any ) -> None: """Broadcast content inside request body to all the connected client connections. @@ -197,7 +227,13 @@ def send_to_all( # pylint: disable=inconsistent-return-statements @distributed_trace def send_to_all( # pylint: disable=inconsistent-return-statements - self, message: Union[IO, str, JSON], *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, content_type: Optional[str] = None, **kwargs: Any + self, + message: Union[IO, str, JSON], + *, + excluded: Optional[List[str]] = None, + filter: Optional[str] = None, + content_type: Optional[str] = None, + **kwargs: Any ) -> None: """Broadcast content inside request body to all the connected client connections. @@ -242,7 +278,7 @@ def send_to_all( # pylint: disable=inconsistent-return-statements "The content_type '{}' is not one of the allowed values: " "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) ) - request = build_send_to_all_request( + request = build_web_pub_sub_service_send_to_all_request( hub=self._config.hub, excluded=excluded, filter=filter, @@ -254,7 +290,7 @@ def send_to_all( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -272,7 +308,13 @@ def send_to_all( # pylint: disable=inconsistent-return-statements @overload def send_to_user( # pylint: disable=inconsistent-return-statements - self, user_id: str, message: Union[str, JSON], *, filter: Optional[str] = None, content_type: Optional[str] = "application/json", **kwargs: Any + self, + user_id: str, + message: Union[str, JSON], + *, + filter: Optional[str] = None, + content_type: Optional[str] = "application/json", + **kwargs: Any ) -> None: """Send content inside request body to the specific user. @@ -291,10 +333,16 @@ def send_to_user( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - - @overload + + @overload def send_to_user( # pylint: disable=inconsistent-return-statements - self, user_id: str, message: str, *, filter: Optional[str] = None, content_type: Optional[str] = "text/plain", **kwargs: Any + self, + user_id: str, + message: str, + *, + filter: Optional[str] = None, + content_type: Optional[str] = "text/plain", + **kwargs: Any ) -> None: """Send content inside request body to the specific user. @@ -316,7 +364,13 @@ def send_to_user( # pylint: disable=inconsistent-return-statements @overload def send_to_user( # pylint: disable=inconsistent-return-statements - self, user_id: str, message: IO, *, filter: Optional[str] = None, content_type: Optional[str] = "application/octet-stream", **kwargs: Any + self, + user_id: str, + message: IO, + *, + filter: Optional[str] = None, + content_type: Optional[str] = "application/octet-stream", + **kwargs: Any ) -> None: """Send content inside request body to the specific user. @@ -338,7 +392,13 @@ def send_to_user( # pylint: disable=inconsistent-return-statements @distributed_trace def send_to_user( # pylint: disable=inconsistent-return-statements - self, user_id: str, message: Union[IO, str, JSON], *, filter: Optional[str] = None, content_type: Optional[str] = None, **kwargs: Any + self, + user_id: str, + message: Union[IO, str, JSON], + *, + filter: Optional[str] = None, + content_type: Optional[str] = None, + **kwargs: Any ) -> None: """Send content inside request body to the specific user. @@ -383,7 +443,7 @@ def send_to_user( # pylint: disable=inconsistent-return-statements "The content_type '{}' is not one of the allowed values: " "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) ) - request = build_send_to_user_request( + request = build_web_pub_sub_service_send_to_user_request( user_id=user_id, hub=self._config.hub, filter=filter, @@ -395,7 +455,7 @@ def send_to_user( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -564,7 +624,7 @@ def send_to_group( # pylint: disable=inconsistent-return-statements "The content_type '{}' is not one of the allowed values: " "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) ) - request = build_send_to_group_request( + request = build_web_pub_sub_service_send_to_group_request( group=group, hub=self._config.hub, excluded=excluded, @@ -577,7 +637,7 @@ def send_to_group( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -592,10 +652,15 @@ def send_to_group( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: return cls(pipeline_response, None, {}) - + @overload def send_to_connection( # pylint: disable=inconsistent-return-statements - self, connection_id: str, message: Union[str, JSON], *, content_type: Optional[str] = "application/json", **kwargs: Any + self, + connection_id: str, + message: Union[str, JSON], + *, + content_type: Optional[str] = "application/json", + **kwargs: Any ) -> None: """Send content inside request body to the specific connection. @@ -633,7 +698,12 @@ def send_to_connection( # pylint: disable=inconsistent-return-statements @overload def send_to_connection( # pylint: disable=inconsistent-return-statements - self, connection_id: str, message: IO, *, content_type: Optional[str] = "application/octet-stream", **kwargs: Any + self, + connection_id: str, + message: IO, + *, + content_type: Optional[str] = "application/octet-stream", + **kwargs: Any ) -> None: """Send content inside request body to the specific connection. @@ -649,7 +719,7 @@ def send_to_connection( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - + @distributed_trace def send_to_connection( # pylint: disable=inconsistent-return-statements self, connection_id: str, message: Union[IO, str, JSON], *, content_type: Optional[str] = None, **kwargs: Any @@ -694,7 +764,7 @@ def send_to_connection( # pylint: disable=inconsistent-return-statements "The content_type '{}' is not one of the allowed values: " "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) ) - request = build_send_to_connection_request( + request = build_web_pub_sub_service_send_to_connection_request( connection_id=connection_id, hub=self._config.hub, content_type=content_type, @@ -705,7 +775,7 @@ def send_to_connection( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_patch.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_patch.py index 9ffdbb5a29d71..a937202277f30 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_patch.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_patch.py @@ -24,6 +24,7 @@ # IN THE SOFTWARE. # # -------------------------------------------------------------------------- + from typing import Any, TYPE_CHECKING, Optional, Union, Awaitable from datetime import datetime, timedelta import jwt @@ -38,6 +39,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_serialization.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_serialization.py index 7c1dedb5133d3..8139854b97bb8 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_serialization.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate +import isodate # type: ignore -from typing import Dict, Any, cast, TYPE_CHECKING - -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -109,7 +124,7 @@ def deserialize_from_text(cls, data, content_type=None): pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -128,12 +143,13 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -156,13 +172,6 @@ def deserialize_from_http_generics(cls, body_bytes, headers): return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore - _LOGGER = logging.getLogger(__name__) try: @@ -188,7 +197,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +228,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +285,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -290,27 +299,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,14 +328,14 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): - """Return the JSON that would be sent to azure from this model. + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -337,10 +346,15 @@ def serialize(self, keep_readonly=False, **kwargs): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -371,7 +385,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -387,7 +401,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,10 +410,15 @@ def deserialize(cls, data, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +431,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -421,7 +440,7 @@ def from_dict(cls, data, key_extractors=None, content_type=None): if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -453,7 +472,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +556,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -605,14 +624,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,30 +640,30 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) - serialized.append(local_node) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -659,8 +678,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +694,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -686,7 +705,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -706,6 +725,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -718,7 +738,9 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. - :rtype: str + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -726,10 +748,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -780,6 +800,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is CoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -798,7 +820,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -843,7 +865,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -866,6 +888,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -878,9 +902,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -925,7 +954,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -958,7 +989,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1001,10 +1032,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1135,10 +1166,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1164,7 +1195,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1173,7 +1205,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1194,7 +1225,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1245,7 +1275,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1269,7 +1299,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1335,7 +1365,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1385,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1408,15 +1438,15 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,8 +1474,8 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name - raise_with_traceback(DeserializationError, msg, err) + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1474,22 +1504,22 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1529,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1542,8 +1572,8 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1595,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1616,7 +1646,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1664,7 +1694,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1721,7 +1751,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1747,7 +1777,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1772,7 +1802,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1798,7 +1827,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1839,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,10 +1855,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1841,7 +1870,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1857,7 +1886,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1871,10 +1900,10 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1886,7 +1915,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1930,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1909,7 +1938,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1924,7 +1953,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1946,7 +1975,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1960,11 +1989,12 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_vendor.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_vendor.py index e2934cb572514..d74b846997bbf 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_vendor.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_vendor.py @@ -17,18 +17,7 @@ from ._serialization import Deserializer, Serializer -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) - - -class MixinABC(ABC): +class WebPubSubServiceClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" _client: "PipelineClient" diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_version.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_version.py index 924647bfeefca..8fa00346e343c 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_version.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.1" +VERSION = "1.2.2" diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/__init__.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/__init__.py index be98227493716..774736128a5fb 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/__init__.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["WebPubSubServiceClient"] +__all__ = [ + "WebPubSubServiceClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_client.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_client.py index 2991ae25f2524..ff32780191815 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_client.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_client.py @@ -8,8 +8,10 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core import AsyncPipelineClient +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from .._serialization import Deserializer, Serializer @@ -33,21 +35,40 @@ class WebPubSubServiceClient( :type endpoint: str :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. Default value is "2022-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, hub: str, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: - _endpoint = "{Endpoint}" + _endpoint = "{endpoint}" self._config = WebPubSubServiceClientConfiguration(hub=hub, endpoint=endpoint, credential=credential, **kwargs) - self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -67,18 +88,18 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "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) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WebPubSubServiceClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_configuration.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_configuration.py index 880f0e23b0e92..fd003ed4e711b 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_configuration.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from .._version import VERSION @@ -18,7 +17,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class WebPubSubServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class WebPubSubServiceClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for WebPubSubServiceClient. Note that all parameters used to create this instance are saved as instance @@ -31,14 +30,13 @@ class WebPubSubServiceClientConfiguration(Configuration): # pylint: disable=too :type endpoint: str :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. Default value is "2022-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, hub: str, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: - super(WebPubSubServiceClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-11-01") # type: str + api_version: str = kwargs.pop("api_version", "2024-01-01") if hub is None: raise ValueError("Parameter 'hub' must not be None.") @@ -53,6 +51,7 @@ def __init__(self, hub: str, endpoint: str, credential: "AsyncTokenCredential", self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://webpubsub.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "messaging-webpubsubservice/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -61,9 +60,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy( diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/__init__.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/__init__.py index b5ccfcd01e1b9..b3272b3ee978c 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/__init__.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/__init__.py @@ -9,7 +9,7 @@ from ._operations import WebPubSubServiceClientOperationsMixin from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/_operations.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/_operations.py index cdaaf89d1a744..fe04f0e8f58be 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/_operations.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, cast +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,35 +19,34 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from ..._operations._operations import ( - build_add_connection_to_group_request, - build_add_user_to_group_request, - build_close_all_connections_request, - build_close_connection_request, - build_close_group_connections_request, - build_close_user_connections_request, - build_connection_exists_request, - build_get_client_access_token_request, - build_grant_permission_request, - build_group_exists_request, - build_has_permission_request, - build_remove_connection_from_all_groups_request, - build_remove_connection_from_group_request, - build_remove_user_from_all_groups_request, - build_remove_user_from_group_request, - build_revoke_permission_request, - build_send_to_all_request, - build_send_to_connection_request, - build_send_to_group_request, - build_send_to_user_request, - build_user_exists_request, + build_web_pub_sub_service_add_connection_to_group_request, + build_web_pub_sub_service_add_user_to_group_request, + build_web_pub_sub_service_close_all_connections_request, + build_web_pub_sub_service_close_connection_request, + build_web_pub_sub_service_close_group_connections_request, + build_web_pub_sub_service_close_user_connections_request, + build_web_pub_sub_service_connection_exists_request, + build_web_pub_sub_service_get_client_access_token_request, + build_web_pub_sub_service_grant_permission_request, + build_web_pub_sub_service_group_exists_request, + build_web_pub_sub_service_has_permission_request, + build_web_pub_sub_service_remove_connection_from_all_groups_request, + build_web_pub_sub_service_remove_connection_from_group_request, + build_web_pub_sub_service_remove_user_from_all_groups_request, + build_web_pub_sub_service_remove_user_from_group_request, + build_web_pub_sub_service_revoke_permission_request, + build_web_pub_sub_service_send_to_all_request, + build_web_pub_sub_service_send_to_connection_request, + build_web_pub_sub_service_send_to_group_request, + build_web_pub_sub_service_send_to_user_request, + build_web_pub_sub_service_user_exists_request, ) -from .._vendor import MixinABC +from .._vendor import WebPubSubServiceClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -57,7 +57,8 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class WebPubSubServiceClientOperationsMixin(MixinABC): # pylint: disable=too-many-public-methods +class WebPubSubServiceClientOperationsMixin(WebPubSubServiceClientMixinABC): # pylint: disable=too-many-public-methods + @distributed_trace_async async def close_all_connections( # pylint: disable=inconsistent-return-statements self, *, excluded: Optional[List[str]] = None, reason: Optional[str] = None, **kwargs: Any @@ -75,7 +76,7 @@ async def close_all_connections( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -86,9 +87,9 @@ async def close_all_connections( # pylint: disable=inconsistent-return-statemen _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_close_all_connections_request( + _request = build_web_pub_sub_service_close_all_connections_request( hub=self._config.hub, excluded=excluded, reason=reason, @@ -97,12 +98,13 @@ async def close_all_connections( # pylint: disable=inconsistent-return-statemen params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -112,7 +114,7 @@ async def close_all_connections( # pylint: disable=inconsistent-return-statemen raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get_client_access_token( @@ -122,6 +124,7 @@ async def get_client_access_token( roles: Optional[List[str]] = None, minutes_to_expire: int = 60, groups: Optional[List[str]] = None, + client_protocol: str = "Default", **kwargs: Any ) -> JSON: """Generate token for the client to connect Azure Web PubSub service. @@ -137,6 +140,10 @@ async def get_client_access_token( :paramtype minutes_to_expire: int :keyword groups: Groups that the connection will join when it connects. Default value is None. :paramtype groups: list[str] + :keyword client_protocol: The type of client protocol. Case-insensitive. If not set, it's "Default". For Web + PubSub for Socket.IO, only the default value is supported. For Web PubSub, the valid values are + 'Default' and 'MQTT'. Known values are: "Default" and "MQTT". Default value is "Default". + :paramtype client_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -146,11 +153,10 @@ async def get_client_access_token( # response body for status code(s): 200 response == { - "token": "str" # Optional. The token value for the WebSocket client to - connect to the service. + "token": "str" } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,25 +167,27 @@ async def get_client_access_token( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls: ClsType[JSON] = kwargs.pop("cls", None) - request = build_get_client_access_token_request( + _request = build_web_pub_sub_service_get_client_access_token_request( hub=self._config.hub, user_id=user_id, roles=roles, minutes_to_expire=minutes_to_expire, groups=groups, + client_type=client_protocol, api_version=self._config.api_version, headers=_headers, params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -194,30 +202,42 @@ async def get_client_access_token( deserialized = None if cls: - return cls(pipeline_response, cast(JSON, deserialized), {}) + return cls(pipeline_response, cast(JSON, deserialized), {}) # type: ignore - return cast(JSON, deserialized) + return cast(JSON, deserialized) # type: ignore @distributed_trace_async async def send_to_all( # pylint: disable=inconsistent-return-statements - self, message: IO, *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, **kwargs: Any + self, + message: IO[bytes], + *, + excluded: Optional[List[str]] = None, + filter: Optional[str] = None, + message_ttl_seconds: Optional[int] = None, + **kwargs: Any ) -> None: """Broadcast content inside request body to all the connected client connections. Broadcast content inside request body to all the connected client connections. :param message: The payload body. Required. - :type message: IO + :type message: IO[bytes] :keyword excluded: Excluded connection Ids. Default value is None. :paramtype excluded: list[str] :keyword filter: Following OData filter syntax to filter out the subscribers receiving the messages. Default value is None. :paramtype filter: str + :keyword message_ttl_seconds: The time-to-live (TTL) value in seconds for messages sent to the + service. 0 is the default value, which means the message never expires. 300 is the maximum + value. If this parameter is non-zero, messages that are not consumed by the client within the + specified TTL will be dropped by the service. This parameter can help when the client's + bandwidth is limited. Default value is None. + :paramtype message_ttl_seconds: int :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -228,15 +248,16 @@ async def send_to_all( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _content = message - request = build_send_to_all_request( + _request = build_web_pub_sub_service_send_to_all_request( hub=self._config.hub, excluded=excluded, filter=filter, + message_ttl_seconds=message_ttl_seconds, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -244,12 +265,13 @@ async def send_to_all( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -259,7 +281,7 @@ async def send_to_all( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def close_connection( # pylint: disable=inconsistent-return-statements @@ -277,7 +299,7 @@ async def close_connection( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,9 +310,9 @@ async def close_connection( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_close_connection_request( + _request = build_web_pub_sub_service_close_connection_request( connection_id=connection_id, hub=self._config.hub, reason=reason, @@ -299,12 +321,13 @@ async def close_connection( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -314,7 +337,7 @@ async def close_connection( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def connection_exists(self, connection_id: str, **kwargs: Any) -> bool: @@ -328,7 +351,7 @@ async def connection_exists(self, connection_id: str, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,9 +362,9 @@ async def connection_exists(self, connection_id: str, **kwargs: Any) -> bool: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_connection_exists_request( + _request = build_web_pub_sub_service_connection_exists_request( connection_id=connection_id, hub=self._config.hub, api_version=self._config.api_version, @@ -349,12 +372,13 @@ async def connection_exists(self, connection_id: str, **kwargs: Any) -> bool: params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,12 +388,12 @@ async def connection_exists(self, connection_id: str, **kwargs: Any) -> bool: raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 @distributed_trace_async async def send_to_connection( # pylint: disable=inconsistent-return-statements - self, connection_id: str, message: IO, **kwargs: Any + self, connection_id: str, message: IO[bytes], *, message_ttl_seconds: Optional[int] = None, **kwargs: Any ) -> None: """Send content inside request body to the specific connection. @@ -378,12 +402,18 @@ async def send_to_connection( # pylint: disable=inconsistent-return-statements :param connection_id: The connection Id. Required. :type connection_id: str :param message: The payload body. Required. - :type message: IO + :type message: IO[bytes] + :keyword message_ttl_seconds: The time-to-live (TTL) value in seconds for messages sent to the + service. 0 is the default value, which means the message never expires. 300 is the maximum + value. If this parameter is non-zero, messages that are not consumed by the client within the + specified TTL will be dropped by the service. This parameter can help when the client's + bandwidth is limited. Default value is None. + :paramtype message_ttl_seconds: int :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -394,14 +424,15 @@ async def send_to_connection( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _content = message - request = build_send_to_connection_request( + _request = build_web_pub_sub_service_send_to_connection_request( connection_id=connection_id, hub=self._config.hub, + message_ttl_seconds=message_ttl_seconds, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -409,12 +440,13 @@ async def send_to_connection( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,7 +456,7 @@ async def send_to_connection( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def remove_connection_from_all_groups( # pylint: disable=inconsistent-return-statements @@ -440,7 +472,7 @@ async def remove_connection_from_all_groups( # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -451,9 +483,9 @@ async def remove_connection_from_all_groups( # pylint: disable=inconsistent-ret _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_remove_connection_from_all_groups_request( + _request = build_web_pub_sub_service_remove_connection_from_all_groups_request( connection_id=connection_id, hub=self._config.hub, api_version=self._config.api_version, @@ -461,12 +493,13 @@ async def remove_connection_from_all_groups( # pylint: disable=inconsistent-ret params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -476,7 +509,7 @@ async def remove_connection_from_all_groups( # pylint: disable=inconsistent-ret raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def group_exists(self, group: str, **kwargs: Any) -> bool: @@ -491,7 +524,7 @@ async def group_exists(self, group: str, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -502,9 +535,9 @@ async def group_exists(self, group: str, **kwargs: Any) -> bool: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_group_exists_request( + _request = build_web_pub_sub_service_group_exists_request( group=group, hub=self._config.hub, api_version=self._config.api_version, @@ -512,12 +545,13 @@ async def group_exists(self, group: str, **kwargs: Any) -> bool: params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -527,7 +561,7 @@ async def group_exists(self, group: str, **kwargs: Any) -> bool: raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 @distributed_trace_async @@ -550,7 +584,7 @@ async def close_group_connections( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -561,9 +595,9 @@ async def close_group_connections( # pylint: disable=inconsistent-return-statem _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_close_group_connections_request( + _request = build_web_pub_sub_service_close_group_connections_request( group=group, hub=self._config.hub, excluded=excluded, @@ -573,12 +607,13 @@ async def close_group_connections( # pylint: disable=inconsistent-return-statem params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -588,16 +623,17 @@ async def close_group_connections( # pylint: disable=inconsistent-return-statem raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def send_to_group( # pylint: disable=inconsistent-return-statements self, group: str, - message: IO, + message: IO[bytes], *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, + message_ttl_seconds: Optional[int] = None, **kwargs: Any ) -> None: """Send content inside request body to a group of connections. @@ -608,17 +644,23 @@ async def send_to_group( # pylint: disable=inconsistent-return-statements Required. :type group: str :param message: The payload body. Required. - :type message: IO + :type message: IO[bytes] :keyword excluded: Excluded connection Ids. Default value is None. :paramtype excluded: list[str] :keyword filter: Following OData filter syntax to filter out the subscribers receiving the messages. Default value is None. :paramtype filter: str + :keyword message_ttl_seconds: The time-to-live (TTL) value in seconds for messages sent to the + service. 0 is the default value, which means the message never expires. 300 is the maximum + value. If this parameter is non-zero, messages that are not consumed by the client within the + specified TTL will be dropped by the service. This parameter can help when the client's + bandwidth is limited. Default value is None. + :paramtype message_ttl_seconds: int :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,16 +671,17 @@ async def send_to_group( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _content = message - request = build_send_to_group_request( + _request = build_web_pub_sub_service_send_to_group_request( group=group, hub=self._config.hub, excluded=excluded, filter=filter, + message_ttl_seconds=message_ttl_seconds, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -646,12 +689,13 @@ async def send_to_group( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -661,7 +705,7 @@ async def send_to_group( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def remove_connection_from_group( # pylint: disable=inconsistent-return-statements @@ -680,7 +724,7 @@ async def remove_connection_from_group( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -691,9 +735,9 @@ async def remove_connection_from_group( # pylint: disable=inconsistent-return-s _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_remove_connection_from_group_request( + _request = build_web_pub_sub_service_remove_connection_from_group_request( group=group, connection_id=connection_id, hub=self._config.hub, @@ -702,12 +746,13 @@ async def remove_connection_from_group( # pylint: disable=inconsistent-return-s params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -717,7 +762,7 @@ async def remove_connection_from_group( # pylint: disable=inconsistent-return-s raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def add_connection_to_group( # pylint: disable=inconsistent-return-statements @@ -736,7 +781,7 @@ async def add_connection_to_group( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -747,9 +792,9 @@ async def add_connection_to_group( # pylint: disable=inconsistent-return-statem _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_add_connection_to_group_request( + _request = build_web_pub_sub_service_add_connection_to_group_request( group=group, connection_id=connection_id, hub=self._config.hub, @@ -758,12 +803,13 @@ async def add_connection_to_group( # pylint: disable=inconsistent-return-statem params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -773,7 +819,7 @@ async def add_connection_to_group( # pylint: disable=inconsistent-return-statem raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def revoke_permission( # pylint: disable=inconsistent-return-statements @@ -796,7 +842,7 @@ async def revoke_permission( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,9 +853,9 @@ async def revoke_permission( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revoke_permission_request( + _request = build_web_pub_sub_service_revoke_permission_request( permission=permission, connection_id=connection_id, hub=self._config.hub, @@ -819,12 +865,13 @@ async def revoke_permission( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -834,7 +881,7 @@ async def revoke_permission( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def has_permission( @@ -857,7 +904,7 @@ async def has_permission( :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -868,9 +915,9 @@ async def has_permission( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_has_permission_request( + _request = build_web_pub_sub_service_has_permission_request( permission=permission, connection_id=connection_id, hub=self._config.hub, @@ -880,12 +927,13 @@ async def has_permission( params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -895,7 +943,7 @@ async def has_permission( raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 @distributed_trace_async @@ -919,7 +967,7 @@ async def grant_permission( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -930,9 +978,9 @@ async def grant_permission( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_grant_permission_request( + _request = build_web_pub_sub_service_grant_permission_request( permission=permission, connection_id=connection_id, hub=self._config.hub, @@ -942,12 +990,13 @@ async def grant_permission( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -957,7 +1006,7 @@ async def grant_permission( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def user_exists(self, user_id: str, **kwargs: Any) -> bool: @@ -971,7 +1020,7 @@ async def user_exists(self, user_id: str, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -982,9 +1031,9 @@ async def user_exists(self, user_id: str, **kwargs: Any) -> bool: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_user_exists_request( + _request = build_web_pub_sub_service_user_exists_request( user_id=user_id, hub=self._config.hub, api_version=self._config.api_version, @@ -992,12 +1041,13 @@ async def user_exists(self, user_id: str, **kwargs: Any) -> bool: params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1007,7 +1057,7 @@ async def user_exists(self, user_id: str, **kwargs: Any) -> bool: raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore return 200 <= response.status_code <= 299 @distributed_trace_async @@ -1029,7 +1079,7 @@ async def close_user_connections( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1040,9 +1090,9 @@ async def close_user_connections( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_close_user_connections_request( + _request = build_web_pub_sub_service_close_user_connections_request( user_id=user_id, hub=self._config.hub, excluded=excluded, @@ -1052,12 +1102,13 @@ async def close_user_connections( # pylint: disable=inconsistent-return-stateme params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1067,11 +1118,17 @@ async def close_user_connections( # pylint: disable=inconsistent-return-stateme raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def send_to_user( # pylint: disable=inconsistent-return-statements - self, user_id: str, message: IO, *, filter: Optional[str] = None, **kwargs: Any + self, + user_id: str, + message: IO[bytes], + *, + filter: Optional[str] = None, + message_ttl_seconds: Optional[int] = None, + **kwargs: Any ) -> None: """Send content inside request body to the specific user. @@ -1080,15 +1137,21 @@ async def send_to_user( # pylint: disable=inconsistent-return-statements :param user_id: The user Id. Required. :type user_id: str :param message: The payload body. Required. - :type message: IO + :type message: IO[bytes] :keyword filter: Following OData filter syntax to filter out the subscribers receiving the messages. Default value is None. :paramtype filter: str + :keyword message_ttl_seconds: The time-to-live (TTL) value in seconds for messages sent to the + service. 0 is the default value, which means the message never expires. 300 is the maximum + value. If this parameter is non-zero, messages that are not consumed by the client within the + specified TTL will be dropped by the service. This parameter can help when the client's + bandwidth is limited. Default value is None. + :paramtype message_ttl_seconds: int :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1099,15 +1162,16 @@ async def send_to_user( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) _content = message - request = build_send_to_user_request( + _request = build_web_pub_sub_service_send_to_user_request( user_id=user_id, hub=self._config.hub, filter=filter, + message_ttl_seconds=message_ttl_seconds, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -1115,12 +1179,13 @@ async def send_to_user( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1130,7 +1195,7 @@ async def send_to_user( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def remove_user_from_all_groups( # pylint: disable=inconsistent-return-statements @@ -1146,7 +1211,7 @@ async def remove_user_from_all_groups( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1157,9 +1222,9 @@ async def remove_user_from_all_groups( # pylint: disable=inconsistent-return-st _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_remove_user_from_all_groups_request( + _request = build_web_pub_sub_service_remove_user_from_all_groups_request( user_id=user_id, hub=self._config.hub, api_version=self._config.api_version, @@ -1167,12 +1232,13 @@ async def remove_user_from_all_groups( # pylint: disable=inconsistent-return-st params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1182,7 +1248,7 @@ async def remove_user_from_all_groups( # pylint: disable=inconsistent-return-st raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def remove_user_from_group( # pylint: disable=inconsistent-return-statements @@ -1201,7 +1267,7 @@ async def remove_user_from_group( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1212,9 +1278,9 @@ async def remove_user_from_group( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_remove_user_from_group_request( + _request = build_web_pub_sub_service_remove_user_from_group_request( group=group, user_id=user_id, hub=self._config.hub, @@ -1223,12 +1289,13 @@ async def remove_user_from_group( # pylint: disable=inconsistent-return-stateme params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1238,7 +1305,7 @@ async def remove_user_from_group( # pylint: disable=inconsistent-return-stateme raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def add_user_to_group( # pylint: disable=inconsistent-return-statements @@ -1257,7 +1324,7 @@ async def add_user_to_group( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1268,9 +1335,9 @@ async def add_user_to_group( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) - request = build_add_user_to_group_request( + _request = build_web_pub_sub_service_add_user_to_group_request( group=group, user_id=user_id, hub=self._config.hub, @@ -1279,12 +1346,13 @@ async def add_user_to_group( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } - request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore + _request.url = self._client.format_url(_request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1294,4 +1362,4 @@ async def add_user_to_group( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/_patch.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/_patch.py index 109bb95c781b0..848bac5ff70f0 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/_patch.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_operations/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize @@ -21,10 +22,10 @@ from ._operations import ( WebPubSubServiceClientOperationsMixin as WebPubSubServiceClientOperationsMixinGenerated, JSON, - build_send_to_all_request, - build_send_to_connection_request, - build_send_to_user_request, - build_send_to_group_request, + build_web_pub_sub_service_send_to_all_request, + build_web_pub_sub_service_send_to_connection_request, + build_web_pub_sub_service_send_to_user_request, + build_web_pub_sub_service_send_to_group_request, ) from ..._operations._patch import get_token_by_key @@ -39,6 +40,7 @@ async def get_client_access_token( # pylint: disable=arguments-differ minutes_to_expire: Optional[int] = 60, jwt_headers: Dict[str, Any] = None, groups: Optional[List[str]] = None, + client_protocol: Optional[str] = "Default", **kwargs: Any ) -> JSON: """Generate token for the client to connect Azure Web PubSub service. @@ -55,6 +57,10 @@ async def get_client_access_token( # pylint: disable=arguments-differ :keyword api_version: Api Version. The default value is "2021-10-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str + :keyword client_protocol: The type of client protocol. Case-insensitive. If not set, it's "Default". For Web + PubSub for Socket.IO, only the default value is supported. For Web PubSub, the valid values are + 'Default' and 'MQTT'. Known values are: "Default" and "MQTT". Default value is "Default". + :paramtype client_type: str :return: JSON object :rtype: JSON :raises: ~azure.core.exceptions.HttpResponseError @@ -74,15 +80,19 @@ async def get_client_access_token( # pylint: disable=arguments-differ "Invalid endpoint: '{}' has unknown scheme - expected 'http://' or 'https://'".format(endpoint) ) # Ensure endpoint has no trailing slash + endpoint = endpoint.rstrip("/") # Switch from http(s) to ws(s) scheme + client_endpoint = "ws" + endpoint[4:] hub = self._config.hub - client_url = "{}/client/hubs/{}".format(client_endpoint, hub) + path = "/clients/mqtt/hubs/" if client_protocol.lower() == "mqtt" else "/client/hubs/" + client_url = client_endpoint + path + hub if isinstance(self._config.credential, AzureKeyCredential): token = get_token_by_key( endpoint, + path, hub, self._config.credential.key, user_id=user_id, @@ -94,7 +104,12 @@ async def get_client_access_token( # pylint: disable=arguments-differ ) else: access_token = await super().get_client_access_token( - user_id=user_id, roles=roles, minutes_to_expire=minutes_to_expire, groups=groups, **kwargs + user_id=user_id, + roles=roles, + minutes_to_expire=minutes_to_expire, + groups=groups, + client_protocol=client_protocol, + **kwargs ) token = access_token.get("token") return { @@ -107,7 +122,13 @@ async def get_client_access_token( # pylint: disable=arguments-differ @overload async def send_to_all( # pylint: disable=inconsistent-return-statements - self, message: Union[str, JSON], *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, content_type: Optional[str] = "application/json", **kwargs: Any + self, + message: Union[str, JSON], + *, + excluded: Optional[List[str]] = None, + filter: Optional[str] = None, + content_type: Optional[str] = "application/json", + **kwargs: Any ) -> None: """Broadcast content inside request body to all the connected client connections. @@ -129,7 +150,13 @@ async def send_to_all( # pylint: disable=inconsistent-return-statements @overload async def send_to_all( # pylint: disable=inconsistent-return-statements - self, message: str, *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, content_type: Optional[str] = "text/plain", **kwargs: Any + self, + message: str, + *, + excluded: Optional[List[str]] = None, + filter: Optional[str] = None, + content_type: Optional[str] = "text/plain", + **kwargs: Any ) -> None: """Broadcast content inside request body to all the connected client connections. @@ -151,7 +178,13 @@ async def send_to_all( # pylint: disable=inconsistent-return-statements @overload async def send_to_all( # pylint: disable=inconsistent-return-statements - self, message: IO, *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, content_type: Optional[str] = "application/octet-stream", **kwargs: Any + self, + message: IO, + *, + excluded: Optional[List[str]] = None, + filter: Optional[str] = None, + content_type: Optional[str] = "application/octet-stream", + **kwargs: Any ) -> None: """Broadcast content inside request body to all the connected client connections. @@ -173,7 +206,13 @@ async def send_to_all( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def send_to_all( # pylint: disable=inconsistent-return-statements - self, message: Union[IO, str, JSON], *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, content_type: Optional[str] = None, **kwargs: Any + self, + message: Union[IO, str, JSON], + *, + excluded: Optional[List[str]] = None, + filter: Optional[str] = None, + content_type: Optional[str] = None, + **kwargs: Any ) -> None: """Broadcast content inside request body to all the connected client connections. @@ -203,7 +242,9 @@ async def send_to_all( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = _headers.pop("Content-Type", "application/json") if content_type is None else content_type # type: str + content_type = ( + _headers.pop("Content-Type", "application/json") if content_type is None else content_type + ) # type: str cls = kwargs.pop("cls", None) # type: ClsType[None] _json = None @@ -218,7 +259,7 @@ async def send_to_all( # pylint: disable=inconsistent-return-statements "The content_type '{}' is not one of the allowed values: " "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) ) - request = build_send_to_all_request( + request = build_web_pub_sub_service_send_to_all_request( hub=self._config.hub, excluded=excluded, filter=filter, @@ -230,7 +271,7 @@ async def send_to_all( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -384,7 +425,9 @@ async def send_to_group( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = _headers.pop("Content-Type", "application/json") if content_type is None else content_type # type: str + content_type = ( + _headers.pop("Content-Type", "application/json") if content_type is None else content_type + ) # type: str cls = kwargs.pop("cls", None) # type: ClsType[None] _json = None @@ -399,7 +442,7 @@ async def send_to_group( # pylint: disable=inconsistent-return-statements "The content_type '{}' is not one of the allowed values: " "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) ) - request = build_send_to_group_request( + request = build_web_pub_sub_service_send_to_group_request( group=group, hub=self._config.hub, excluded=excluded, @@ -412,7 +455,7 @@ async def send_to_group( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -427,10 +470,15 @@ async def send_to_group( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response) if cls: return cls(pipeline_response, None, {}) - + @overload async def send_to_connection( # pylint: disable=inconsistent-return-statements - self, connection_id: str, message: Union[str, JSON], *, content_type: Optional[str] = "application/json", **kwargs: Any + self, + connection_id: str, + message: Union[str, JSON], + *, + content_type: Optional[str] = "application/json", + **kwargs: Any ) -> None: """Send content inside request body to the specific connection. @@ -468,7 +516,12 @@ async def send_to_connection( # pylint: disable=inconsistent-return-statements @overload async def send_to_connection( # pylint: disable=inconsistent-return-statements - self, connection_id: str, message: IO, *, content_type: Optional[str] = "application/octet-stream", **kwargs: Any + self, + connection_id: str, + message: IO, + *, + content_type: Optional[str] = "application/octet-stream", + **kwargs: Any ) -> None: """Send content inside request body to the specific connection. @@ -514,7 +567,9 @@ async def send_to_connection( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = _headers.pop("Content-Type", "application/json") if content_type is None else content_type # type: str + content_type = ( + _headers.pop("Content-Type", "application/json") if content_type is None else content_type + ) # type: str cls = kwargs.pop("cls", None) # type: ClsType[None] _json = None @@ -529,7 +584,7 @@ async def send_to_connection( # pylint: disable=inconsistent-return-statements "The content_type '{}' is not one of the allowed values: " "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) ) - request = build_send_to_connection_request( + request = build_web_pub_sub_service_send_to_connection_request( connection_id=connection_id, hub=self._config.hub, content_type=content_type, @@ -540,7 +595,7 @@ async def send_to_connection( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore @@ -558,7 +613,13 @@ async def send_to_connection( # pylint: disable=inconsistent-return-statements @overload async def send_to_user( # pylint: disable=inconsistent-return-statements - self, user_id: str, message: Union[str, JSON], *, filter: Optional[str] = None, content_type: Optional[str] = "application/json", **kwargs: Any + self, + user_id: str, + message: Union[str, JSON], + *, + filter: Optional[str] = None, + content_type: Optional[str] = "application/json", + **kwargs: Any ) -> None: """Send content inside request body to the specific user. @@ -580,7 +641,13 @@ async def send_to_user( # pylint: disable=inconsistent-return-statements @overload async def send_to_user( # pylint: disable=inconsistent-return-statements - self, user_id: str, message: str, *, filter: Optional[str] = None, content_type: Optional[str] = "text/plain", **kwargs: Any + self, + user_id: str, + message: str, + *, + filter: Optional[str] = None, + content_type: Optional[str] = "text/plain", + **kwargs: Any ) -> None: """Send content inside request body to the specific user. @@ -602,7 +669,13 @@ async def send_to_user( # pylint: disable=inconsistent-return-statements @overload async def send_to_user( # pylint: disable=inconsistent-return-statements - self, user_id: str, message: IO, *, filter: Optional[str] = None, content_type: Optional[str] = "application/octet-stream", **kwargs: Any + self, + user_id: str, + message: IO, + *, + filter: Optional[str] = None, + content_type: Optional[str] = "application/octet-stream", + **kwargs: Any ) -> None: """Send content inside request body to the specific user. @@ -624,7 +697,13 @@ async def send_to_user( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def send_to_user( # pylint: disable=inconsistent-return-statements - self, user_id: str, message: Union[IO, str, JSON], *, filter: Optional[str] = None, content_type: Optional[str] = None, **kwargs: Any + self, + user_id: str, + message: Union[IO, str, JSON], + *, + filter: Optional[str] = None, + content_type: Optional[str] = None, + **kwargs: Any ) -> None: """Send content inside request body to the specific user. @@ -654,7 +733,9 @@ async def send_to_user( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type = _headers.pop("Content-Type", "application/json") if content_type is None else content_type # type: str + content_type = ( + _headers.pop("Content-Type", "application/json") if content_type is None else content_type + ) # type: str cls = kwargs.pop("cls", None) # type: ClsType[None] _json = None @@ -669,7 +750,7 @@ async def send_to_user( # pylint: disable=inconsistent-return-statements "The content_type '{}' is not one of the allowed values: " "['application/json', 'application/octet-stream', 'text/plain']".format(content_type) ) - request = build_send_to_user_request( + request = build_web_pub_sub_service_send_to_user_request( user_id=user_id, hub=self._config.hub, filter=filter, @@ -681,7 +762,7 @@ async def send_to_user( # pylint: disable=inconsistent-return-statements params=_params, ) path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_patch.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_patch.py index d744bd12c0f64..4f9113376ca83 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_patch.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_patch.py @@ -24,6 +24,7 @@ # IN THE SOFTWARE. # # -------------------------------------------------------------------------- + from typing import Any, TYPE_CHECKING, Union from azure.core.credentials import AzureKeyCredential diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_vendor.py b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_vendor.py index 8db2aefbc7fc7..3da089d49e732 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_vendor.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/aio/_vendor.py @@ -17,7 +17,7 @@ from .._serialization import Deserializer, Serializer -class MixinABC(ABC): +class WebPubSubServiceClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" _client: "AsyncPipelineClient" diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/setup.py b/sdk/webpubsub/azure-messaging-webpubsubservice/setup.py index 54a7c339fc606..0dc5b48cb9d4e 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/setup.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/setup.py @@ -29,7 +29,7 @@ setup( name=PACKAGE_NAME, version=version, - description="Microsoft Azure WebPubSub Service Client Library for Python", + description="Microsoft {} Client Library for Python".format(PACKAGE_PPRINT_NAME), long_description=open("README.md", "r").read(), long_description_content_type="text/markdown", license="MIT License", @@ -38,6 +38,7 @@ url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk", keywords="azure, azure sdk", classifiers=[ + "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", @@ -59,12 +60,13 @@ ), include_package_data=True, package_data={ - "pytyped": ["py.typed"], + "azure.messaging.webpubsubservice": ["py.typed"], }, install_requires=[ "isodate>=0.6.1", - "azure-core>=1.24.0", - "pyjwt>=2.6.0", + "azure-core>=1.30.0", + "typing-extensions>=4.6.0", + "pyjwt>=2.6.0" ], python_requires=">=3.8", ) diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/swagger/README.md b/sdk/webpubsub/azure-messaging-webpubsubservice/swagger/README.md index 561fe174479cc..7079126ef13a5 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/swagger/README.md +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/swagger/README.md @@ -1,4 +1,4 @@ -# Azure Purview for Python +# Azure WebPubsub for Python > see https://aka.ms/autorest @@ -20,7 +20,7 @@ autorest ### Settings ```yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/webpubsub/data-plane/WebPubSub/stable/2022-11-01/webpubsub.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/webpubsub/data-plane/WebPubSub/stable/2024-01-01/webpubsub.json output-folder: ../ namespace: azure.messaging.webpubsubservice package-name: azure-messaging-webpubsubservice diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_jwt.py b/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_jwt.py index 4136a4f1cb662..3a75e78867b4d 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_jwt.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_jwt.py @@ -15,12 +15,12 @@ from urllib.parse import urlparse -def _decode_token(client, token): +def _decode_token(client, token, path="/client/hubs/hub"): return jwt.decode( token, client._config.credential.key, algorithms=["HS256"], - audience="{}/client/hubs/hub".format(client._config.endpoint) + audience=client._config.endpoint + path ) @@ -117,3 +117,22 @@ def test_pass_in_jwt_headers(connection_string): kid = '1234567890' token = client.get_client_access_token(jwt_headers={"kid":kid })['token'] assert jwt.get_unverified_header(token)['kid'] == kid + +test_cases = [ + ("Endpoint=http://localhost;Port=8080;AccessKey={};Version=1.0;".format(access_key), "hub", "ws://localhost:8080/clients/mqtt/hubs/hub"), + ("Endpoint=https://a;AccessKey={};Version=1.0;".format(access_key), "hub", "wss://a/clients/mqtt/hubs/hub"), + ("Endpoint=http://a;AccessKey={};Version=1.0;".format(access_key), "hub", "ws://a/clients/mqtt/hubs/hub") +] +@pytest.mark.parametrize("connection_string,hub,expected_url", test_cases) +def test_generate_mqtt_token(connection_string, hub, expected_url): + client = WebPubSubServiceClient.from_connection_string(connection_string, hub) + url_1 = client.get_client_access_token(client_protocol="MQTT")['url'] + + assert url_1.split("?")[0] == expected_url + + token_1 = urlparse(url_1).query[len("access_token="):] + + decoded_token_1 = _decode_token(client, token_1, path="/clients/mqtt/hubs/hub") + + assert len(decoded_token_1) == 3 + assert decoded_token_1['aud'] == expected_url.replace('ws', 'http') diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_reverse_proxy.py b/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_reverse_proxy.py index 6cff6eebf7849..d70445d547612 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_reverse_proxy.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_reverse_proxy.py @@ -6,7 +6,7 @@ # ------------------------------------------------------------------------- import pytest from azure.messaging.webpubsubservice import WebPubSubServiceClient -from azure.messaging.webpubsubservice._operations._operations import build_send_to_all_request +from azure.messaging.webpubsubservice._operations._operations import build_web_pub_sub_service_send_to_all_request from azure.core.credentials import AzureKeyCredential from testcase import WebpubsubTest, WebpubsubPowerShellPreparer from azure.identity import DefaultAzureCredential @@ -24,7 +24,7 @@ def _callback(pipeline_request): apim_endpoint = "https://apim.contoso.com/" credential = AzureKeyCredential("AzureKeyCredential") client = WebPubSubServiceClient(wps_endpoint, "Hub", credential, reverse_proxy_endpoint=apim_endpoint) - request = build_send_to_all_request('Hub', content='test_webpubsub_send_request', content_type='text/plain') + request = build_web_pub_sub_service_send_to_all_request('Hub', content='test_webpubsub_send_request', content_type='text/plain') with pytest.raises(ValueError) as ex: client.send_request(request, raw_request_hook=_callback) @@ -39,7 +39,7 @@ def _callback(pipeline_request): apim_endpoint = "https://apim.contoso.com/" credential = self.get_credential(WebPubSubServiceClient) client = WebPubSubServiceClient(wps_endpoint, "Hub", credential, reverse_proxy_endpoint=apim_endpoint) - request = build_send_to_all_request('Hub', content='test_webpubsub_send_request', content_type='text/plain') + request = build_web_pub_sub_service_send_to_all_request('Hub', content='test_webpubsub_send_request', content_type='text/plain') with pytest.raises(ValueError) as ex: client.send_request(request, raw_request_hook=_callback) diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_reverse_proxy_async.py b/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_reverse_proxy_async.py index 2254686ad2ffa..40c67743e30f0 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_reverse_proxy_async.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_reverse_proxy_async.py @@ -6,7 +6,7 @@ # ------------------------------------------------------------------------- import pytest from azure.messaging.webpubsubservice.aio import WebPubSubServiceClient -from azure.messaging.webpubsubservice._operations._operations import build_send_to_all_request +from azure.messaging.webpubsubservice._operations._operations import build_web_pub_sub_service_send_to_all_request from azure.core.credentials import AzureKeyCredential from testcase import WebpubsubPowerShellPreparer @@ -25,7 +25,7 @@ def _callback(pipeline_request): wps_endpoint = "https://wps.contoso.com/" apim_endpoint = "https://apim.contoso.com/" credential = AzureKeyCredential("AzureKeyCredential") - request = build_send_to_all_request("Hub", content='test_webpubsub_send_request', content_type='text/plain') + request = build_web_pub_sub_service_send_to_all_request("Hub", content='test_webpubsub_send_request', content_type='text/plain') async with WebPubSubServiceClient(wps_endpoint, "Hub", credential, reverse_proxy_endpoint=apim_endpoint) as client: with pytest.raises(ValueError) as ex: await client.send_request(request, raw_request_hook=_callback) @@ -40,7 +40,7 @@ def _callback(pipeline_request): wps_endpoint = "https://wps.contoso.com/" apim_endpoint = "https://apim.contoso.com/" credential = self.get_credential(WebPubSubServiceClient, is_async=True) - request = build_send_to_all_request('Hub', content='test_webpubsub_send_request', content_type='text/plain') + request = build_web_pub_sub_service_send_to_all_request('Hub', content='test_webpubsub_send_request', content_type='text/plain') async with WebPubSubServiceClient(wps_endpoint, "Hub", credential, reverse_proxy_endpoint=apim_endpoint) as client: with pytest.raises(ValueError) as ex: await client.send_request(request, raw_request_hook=_callback) diff --git a/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_smoke.py b/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_smoke.py index a890cd17ed8aa..54f8bc0758ab3 100644 --- a/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_smoke.py +++ b/sdk/webpubsub/azure-messaging-webpubsubservice/tests/test_smoke.py @@ -7,7 +7,7 @@ import pytest import json from testcase import WebpubsubTest, WebpubsubPowerShellPreparer -from azure.messaging.webpubsubservice._operations._operations import build_send_to_all_request +from azure.messaging.webpubsubservice._operations._operations import build_web_pub_sub_service_send_to_all_request from azure.core.exceptions import ServiceRequestError, HttpResponseError from devtools_testutils import recorded_by_proxy @@ -31,7 +31,7 @@ def test_webpubsub_send_to_all_api_management_proxy(self, webpubsub_endpoint, we @recorded_by_proxy def test_webpubsub_send_request(self, webpubsub_endpoint): client = self.create_client(endpoint=webpubsub_endpoint, hub='hub') - request = build_send_to_all_request('Hub', content='test_webpubsub_send_request', content_type='text/plain') + request = build_web_pub_sub_service_send_to_all_request('Hub', content='test_webpubsub_send_request', content_type='text/plain') response = client.send_request(request) assert response.status_code == 202 diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/pyproject.toml b/sdk/webpubsub/azure-mgmt-webpubsub/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/webpubsub/cspell.json b/sdk/webpubsub/cspell.json new file mode 100644 index 0000000000000..915b3b9afc74e --- /dev/null +++ b/sdk/webpubsub/cspell.json @@ -0,0 +1,6 @@ +{ + "ignoreWords": [ + "MQTT", + "mqtt" + ] +} diff --git a/sdk/workloadmonitor/azure-mgmt-workloadmonitor/pyproject.toml b/sdk/workloadmonitor/azure-mgmt-workloadmonitor/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/workloadmonitor/azure-mgmt-workloadmonitor/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/workloads/azure-mgmt-workloads/pyproject.toml b/sdk/workloads/azure-mgmt-workloads/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloads/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/pyproject.toml b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/pyproject.toml new file mode 100644 index 0000000000000..42a7f73e03867 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/pyproject.toml @@ -0,0 +1,2 @@ +[tool.azure-sdk-build] +breaking = false diff --git a/shared_requirements.txt b/shared_requirements.txt index 1f1da74ba0a0a..226a12dccbdbf 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -67,3 +67,4 @@ uamqp yarl azure-identity openai +dnspython diff --git a/swagger_to_sdk_config.json b/swagger_to_sdk_config.json index b064c3eb67faf..07981b08b5d46 100644 --- a/swagger_to_sdk_config.json +++ b/swagger_to_sdk_config.json @@ -1,22 +1,22 @@ { "advancedOptions": { "createSdkPullRequests": true, - "generationCallMode": "one-for-all-configs", + "generationCallMode": "one-per-config", "breakingChangeTracking": true }, "initOptions": { "initScript": { - "path": "sh scripts/automation_init.sh" + "path": "sh scripts/automation_init.sh", + "stderr": { + "showInComment": false + } } }, "generateOptions": { "generateScript": { "path": "sh scripts/automation_generate.sh", - "stderr": { - "showInComment": true - }, "stdout": { - "showInComment": "^\\[Autorest\\]" + "showInComment": "(.*\\[ERROR\\]\\s*).*" } }, "parseGenerateOutput": true diff --git a/swagger_to_sdk_config_autorest.json b/swagger_to_sdk_config_autorest.json index abf231a4ac115..1c379eb87d8a0 100644 --- a/swagger_to_sdk_config_autorest.json +++ b/swagger_to_sdk_config_autorest.json @@ -2,7 +2,7 @@ "meta": { "autorest_options": { "version": "3.10.2", - "use": ["@autorest/python@6.17.0", "@autorest/modelerfour@4.27.0"], + "use": ["@autorest/python@6.19.0", "@autorest/modelerfour@4.27.0"], "python": "", "sdkrel:python-sdks-folder": "./sdk/.", "version-tolerant": false, diff --git a/swagger_to_sdk_config_dpg.json b/swagger_to_sdk_config_dpg.json index baee5a2af44f5..98584b13fae04 100644 --- a/swagger_to_sdk_config_dpg.json +++ b/swagger_to_sdk_config_dpg.json @@ -2,7 +2,7 @@ "meta": { "autorest_options": { "version": "3.10.2", - "use": ["@autorest/python@6.17.0", "@autorest/modelerfour@4.27.0"] + "use": ["@autorest/python@6.19.0", "@autorest/modelerfour@4.27.0"] }, "advanced_options": { "create_sdk_pull_requests": true, diff --git a/tools/azure-sdk-tools/packaging_tools/generate_sdk.py b/tools/azure-sdk-tools/packaging_tools/generate_sdk.py index 0256b1faa5754..7fcceee28e1cf 100644 --- a/tools/azure-sdk-tools/packaging_tools/generate_sdk.py +++ b/tools/azure-sdk-tools/packaging_tools/generate_sdk.py @@ -1,3 +1,4 @@ +import sys import argparse import logging from pathlib import Path @@ -15,6 +16,11 @@ get_repo_tag_meta, ) +logging.basicConfig( + stream=sys.stdout, + format="%(asctime)s [%(levelname)s] %(message)s", + datefmt="%Y-%m-%d %X", +) _LOGGER = logging.getLogger(__name__) diff --git a/tools/azure-sdk-tools/packaging_tools/generate_utils.py b/tools/azure-sdk-tools/packaging_tools/generate_utils.py index a5e4de8a7e12b..ee744d5554e43 100644 --- a/tools/azure-sdk-tools/packaging_tools/generate_utils.py +++ b/tools/azure-sdk-tools/packaging_tools/generate_utils.py @@ -1,4 +1,3 @@ -from contextlib import suppress import json import logging import os @@ -7,7 +6,7 @@ from ci_tools.git_tools import get_add_diff_file_list from pathlib import Path -from subprocess import check_output, CalledProcessError, check_call, getoutput +from subprocess import check_output, CalledProcessError, check_call, STDOUT from typing import Dict, Any from glob import glob import yaml @@ -27,9 +26,9 @@ _DPG_README = "README.md" -# input example: "../azure-rest-api-specs/specification/informatica/Informatica.DataManagement" -def del_outdated_generated_files(readme: str): - tspconfig = Path(readme) / "tspconfig.yaml" +# tsp example: "../azure-rest-api-specs/specification/informatica/Informatica.DataManagement" +def del_outdated_generated_files(tsp: str): + tspconfig = Path(tsp) / "tspconfig.yaml" if not tspconfig.exists(): _LOGGER.info(f"do not find tspconfig.yaml: {tspconfig}") return @@ -78,7 +77,11 @@ def return_origin_path(func): @wraps(func) def wrapper(*args, **kwargs): current_path = os.getcwd() - result = func(*args, **kwargs) + try: + result = func(*args, **kwargs) + except Exception as e: + os.chdir(current_path) + raise e os.chdir(current_path) return result @@ -195,8 +198,11 @@ def update_servicemetadata(sdk_folder, data, config, folder_name, package_name, f.write("".join(includes)) -def judge_tag_preview(path: str) -> bool: - files = [i for i in Path(path).glob("**/*.py")] +@return_origin_path +def judge_tag_preview(path: str, package_name: str) -> bool: + os.chdir(path) + first_level = package_name.split("-")[0] + files = [i for i in Path(".").glob(f"{first_level}/**/*.py")] default_api_version = "" # for multi-api api_version = "" # for single-api for file in files: @@ -427,14 +433,26 @@ def gen_typespec(typespec_relative_path: str, spec_folder: str, head_sha: str, r try: tsp_dir = (Path(spec_folder) / typespec_relative_path).resolve() repo_url = rest_repo_url.replace("https://github.com/", "") - check_output( - f"tsp-client init --tsp-config {tsp_dir} --local-spec-repo {tsp_dir} --commit {head_sha} --repo {repo_url} --debug", - shell=True, - ) + cmd = f"tsp-client init --tsp-config {tsp_dir} --local-spec-repo {tsp_dir} --commit {head_sha} --repo {repo_url} --debug" + _LOGGER.info(f"generation cmd: {cmd}") + output = check_output(cmd, stderr=STDOUT, shell=True) except CalledProcessError as e: - _LOGGER.error(f"Failed to generate sdk from typespec: {e.output.decode('utf-8')}") + _LOGGER.error("Error occurred when call tsp-client:") + for item in e.output.decode("utf-8").split("\n"): + if "Error: " in item: + _LOGGER.error(item) + _LOGGER.info(f"whole output when fail to call tsp-client: {e.output.decode('utf-8')}") raise e + decode_output = output.decode("utf-8") + # before https://github.com/Azure/azure-sdk-tools/issues/8815, have to check output to judge whether sdk generation succeeds + if " - error " in decode_output: + _LOGGER.error(f"Failed to generate sdk from typespec:") + for item in decode_output.split("\n"): + if " - error " in item: + _LOGGER.error(item) + raise Exception(f"Complete output when fail to generate sdk from typespec: {decode_output}") + with open(Path("eng/emitter-package.json"), "r") as file_in: data = json.load(file_in) npm_package_verstion = { diff --git a/tools/azure-sdk-tools/packaging_tools/package_utils.py b/tools/azure-sdk-tools/packaging_tools/package_utils.py index 88c07302f9689..7c3ecbd305a19 100644 --- a/tools/azure-sdk-tools/packaging_tools/package_utils.py +++ b/tools/azure-sdk-tools/packaging_tools/package_utils.py @@ -1,11 +1,17 @@ +import os +from typing import Optional from pathlib import Path - -from subprocess import check_call +import logging +from subprocess import check_call, CalledProcessError, getoutput +from .generate_utils import return_origin_path from .change_log import main as change_log_main DEFAULT_DEST_FOLDER = "./dist" +_LOGGER = logging.getLogger(__name__) + + # prefolder: "sdk/compute"; name: "azure-mgmt-compute" def create_package(prefolder, name, dest_folder=DEFAULT_DEST_FOLDER): absdirpath = Path(prefolder, name).absolute() @@ -16,7 +22,33 @@ def create_package(prefolder, name, dest_folder=DEFAULT_DEST_FOLDER): ) -def change_log_generate(package_name, last_version, tag_is_stable: bool = False): +@return_origin_path +def change_log_new(package_folder: str, lastest_pypi_version: bool) -> str: + os.chdir(package_folder) + cmd = "tox run -c ../../../eng/tox/tox.ini --root . -e breaking -- --changelog " + if lastest_pypi_version: + cmd += "--latest-pypi-version" + try: + _LOGGER.info(f"Run breaking change detector with command: {cmd}") + output = getoutput(cmd) + except CalledProcessError as e: + _LOGGER.warning(f"Error ocurred when call breaking change detector: {e.output.decode('utf-8')}") + raise e + _LOGGER.info(f"Breaking change detector output: {output}") + result = [l for l in output.split("\n")] + begin = result.index("===== changelog start =====") + end = result.index("===== changelog end =====") + return "\n".join(result[begin + 1 : end]).strip() + + +def change_log_generate( + package_name, + last_version, + tag_is_stable: bool = False, + *, + prefolder: Optional[str] = None, + is_multiapi: bool = False, +): from pypi_tools.pypi import PyPIClient client = PyPIClient() @@ -31,15 +63,31 @@ def change_log_generate(package_name, last_version, tag_is_stable: bool = False) last_version[-1] = str(last_release) except: return "### Other Changes\n\n - Initial version" - else: - return change_log_main(f"{package_name}:pypi", f"{package_name}:latest", tag_is_stable) + + # try new changelog tool + if prefolder and not is_multiapi: + try: + return change_log_new(str(Path(prefolder) / package_name), not (last_stable_release and tag_is_stable)) + except Exception as e: + _LOGGER.warning(f"Failed to generate changelog with breaking_change_detector: {e}") + + # fallback to old changelog tool + _LOGGER.info("Fallback to old changelog tool") + return change_log_main(f"{package_name}:pypi", f"{package_name}:latest", tag_is_stable) def extract_breaking_change(changelog): log = changelog.split("\n") breaking_change = [] - for i in range(0, len(log)): - if log[i].find("Breaking Changes") > -1: - breaking_change = log[min(i + 2, len(log) - 1) :] - break + idx = -1 + try: + idx = log.index("### Breaking Changes") + except ValueError: + pass + if idx > -1: + for i in range(idx + 1, len(log)): + if log[i].find("###") > -1: + break + if log[i]: + breaking_change.append(log[i]) return sorted([x.replace(" - ", "") for x in breaking_change]) diff --git a/tools/azure-sdk-tools/packaging_tools/sdk_generator.py b/tools/azure-sdk-tools/packaging_tools/sdk_generator.py index 7ffafd8095688..29a3d05378afd 100644 --- a/tools/azure-sdk-tools/packaging_tools/sdk_generator.py +++ b/tools/azure-sdk-tools/packaging_tools/sdk_generator.py @@ -1,3 +1,4 @@ +import sys from typing import List, Dict, Any import argparse import json @@ -7,6 +8,7 @@ import shutil import re import os + try: # py 311 adds this library natively import tomllib as toml @@ -35,6 +37,11 @@ ) from .conf import CONF_NAME +logging.basicConfig( + stream=sys.stdout, + format="%(asctime)s [%(levelname)s] %(message)s", + datefmt="%Y-%m-%d %X", +) _LOGGER = logging.getLogger(__name__) @@ -61,6 +68,7 @@ def multiapi_combiner(sdk_code_path: str, package_name: str): ) check_call("pip install -e .", shell=True) + @return_origin_path def after_multiapi_combiner(sdk_code_path: str, package_name: str, folder_name: str): toml_file = Path(sdk_code_path) / CONF_NAME @@ -75,12 +83,14 @@ def after_multiapi_combiner(sdk_code_path: str, package_name: str, folder_name: # azure-mgmt-resource has subfolders subfolder_path = Path(sdk_code_path) / package_name.replace("-", "/") subfolders_name = [s.name for s in subfolder_path.iterdir() if s.is_dir() and not s.name.startswith("_")] - content["packaging"]["exclude_folders"] = ",".join([exclude(f"{package_name}-{s}") for s in subfolders_name]) + content["packaging"]["exclude_folders"] = ",".join( + [exclude(f"{package_name}-{s}") for s in subfolders_name] + ) with open(toml_file, "wb") as file_out: tomlw.dump(content, file_out) call_build_config(package_name, folder_name) - + # remove .egg-info to reinstall package for item in Path(sdk_code_path).iterdir(): if item.suffix == ".egg-info": @@ -91,14 +101,20 @@ def after_multiapi_combiner(sdk_code_path: str, package_name: str, folder_name: _LOGGER.info(f"do not find {toml_file}") -def del_outdated_files(readme: str): +# readme: ../azure-rest-api-specs/specification/paloaltonetworks/resource-manager/readme.md or absolute path +def get_readme_python_content(readme: str) -> List[str]: python_readme = Path(readme).parent / "readme.python.md" if not python_readme.exists(): _LOGGER.info(f"do not find python configuration: {python_readme}") - return + return [] with open(python_readme, "r") as file_in: - content = file_in.readlines() + return file_in.readlines() + + +# readme: ../azure-rest-api-specs/specification/paloaltonetworks/resource-manager/readme.md +def del_outdated_files(readme: str): + content = get_readme_python_content(readme) sdk_folder = extract_sdk_folder(content) is_multiapi = is_multiapi_package(content) if sdk_folder: @@ -144,7 +160,7 @@ def get_related_swagger(readme_content: List[str], tag: str) -> List[str]: def get_last_commit_info(files: List[str]) -> str: - result = [getoutput(f'git log -1 --pretty="format:%ai %H" {f}').strip('\n ') + " " + f for f in files] + result = [getoutput(f'git log -1 --pretty="format:%ai %H" {f}').strip("\n ") + " " + f for f in files] result.sort() return result[-1] @@ -193,7 +209,9 @@ def extract_version_info(config: Dict[str, Any]) -> str: def if_need_regenerate(meta: Dict[str, Any]) -> bool: with open(str(Path("../azure-sdk-for-python", CONFIG_FILE)), "r") as file_in: config = json.load(file_in) - current_info = config["meta"]["autorest_options"]["version"] + "".join(sorted(config["meta"]["autorest_options"]["use"])) + current_info = config["meta"]["autorest_options"]["version"] + "".join( + sorted(config["meta"]["autorest_options"]["use"]) + ) recorded_info = meta["autorest"] + "".join(sorted(meta["use"])) return recorded_info != current_info @@ -255,106 +273,119 @@ def main(generate_input, generate_output): result = {} python_tag = data.get("python_tag") package_total = set() - spec_word = "readmeMd" - if "relatedReadmeMdFiles" in data: - readme_files = data["relatedReadmeMdFiles"] - elif "relatedReadmeMdFile" in data: - input_readme = data["relatedReadmeMdFile"] - if "specification" in spec_folder: - spec_folder = str(Path(spec_folder.split("specification")[0])) - if "specification" not in input_readme: - input_readme = str(Path("specification") / input_readme) - readme_files = [input_readme] - else: - # ["specification/confidentialledger/ConfientialLedger"] - if isinstance(data["relatedTypeSpecProjectFolder"], str): - readme_files = [data["relatedTypeSpecProjectFolder"]] - else: - readme_files = data["relatedTypeSpecProjectFolder"] - spec_word = "typespecProject" - - for input_readme in readme_files: - _LOGGER.info(f"[CODEGEN]({input_readme})codegen begin") - if "resource-manager" in input_readme: - relative_path_readme = str(Path(spec_folder, input_readme)) - update_metadata_for_multiapi_package(spec_folder, input_readme) - del_outdated_files(relative_path_readme) - config = generate( - CONFIG_FILE, - sdk_folder, - [], - relative_path_readme, - spec_folder, - force_generation=True, - python_tag=python_tag, - ) - elif "data-plane" in input_readme: - config = gen_dpg(input_readme, data.get("autorestConfig", ""), dpg_relative_folder(spec_folder)) - else: - del_outdated_generated_files(str(Path(spec_folder, input_readme))) - config = gen_typespec(input_readme, spec_folder, data["headSha"], data["repoHttpsUrl"]) - package_names = get_package_names(sdk_folder) - _LOGGER.info(f"[CODEGEN]({input_readme})codegen end. [(packages:{str(package_names)})]") + readme_and_tsp = data.get("relatedReadmeMdFiles", []) + data.get("relatedTypeSpecProjectFolder", []) + for readme_or_tsp in readme_and_tsp: + _LOGGER.info(f"[CODEGEN]({readme_or_tsp})codegen begin") + try: + if "resource-manager" in readme_or_tsp: + relative_path_readme = str(Path(spec_folder, readme_or_tsp)) + update_metadata_for_multiapi_package(spec_folder, readme_or_tsp) + del_outdated_files(relative_path_readme) + config = generate( + CONFIG_FILE, + sdk_folder, + [], + relative_path_readme, + spec_folder, + force_generation=True, + python_tag=python_tag, + ) + elif "data-plane" in readme_or_tsp: + config = gen_dpg(readme_or_tsp, data.get("autorestConfig", ""), dpg_relative_folder(spec_folder)) + else: + del_outdated_generated_files(str(Path(spec_folder, readme_or_tsp))) + config = gen_typespec(readme_or_tsp, spec_folder, data["headSha"], data["repoHttpsUrl"]) + except Exception as e: + _LOGGER.error(f"fail to generate sdk for {readme_or_tsp}: {str(e)}") + for hint_message in [ + "======================================= Whant Can I do (begin) ========================================================================", + f"Fail to generate sdk for {readme_or_tsp}. If you are from service team, please first check if the failure happens only to Python automation, or for all SDK automations. ", + "If it happens for all SDK automations, please double check your Swagger / Typespec, and check whether there is error in ModelValidation and LintDiff. ", + "If it happens to Python alone, you can open an issue to https://github.com/Azure/autorest.python/issues. Please include the link of this Pull Request in the issue.", + "======================================= Whant Can I do (end) =========================================================================", + ]: + _LOGGER.error(hint_message) + if len(readme_and_tsp) == 1: + raise e # folder_name: "sdk/containerservice"; package_name: "azure-mgmt-containerservice" + package_names = get_package_names(sdk_folder) + spec_word = "readmeMd" if "readme.md" in readme_or_tsp else "typespecProject" for folder_name, package_name in package_names: if package_name in package_total: continue - package_total.add(package_name) - sdk_code_path = str(Path(sdk_folder, folder_name, package_name)) - if package_name not in result: - package_entry = {} - package_entry["packageName"] = package_name - package_entry["path"] = [folder_name] - package_entry[spec_word] = [input_readme] - package_entry["tagIsStable"] = not judge_tag_preview(sdk_code_path) - result[package_name] = package_entry - else: - result[package_name]["path"].append(folder_name) - result[package_name][spec_word].append(input_readme) - - # Generate some necessary file for new service - init_new_service(package_name, folder_name) - format_samples_and_tests(sdk_code_path) - - # Update metadata + _LOGGER.info( + f"[CODEGEN]({readme_or_tsp})codegen end and new package '{folder_name}/{package_name}' generated" + ) try: - update_servicemetadata( - sdk_folder, - data, - config, - folder_name, - package_name, - spec_folder, - input_readme, + package_total.add(package_name) + sdk_code_path = str(Path(sdk_folder, folder_name, package_name)) + if package_name not in result: + package_entry = {} + package_entry["packageName"] = package_name + package_entry["path"] = [folder_name] + package_entry[spec_word] = [readme_or_tsp] + package_entry["tagIsStable"] = not judge_tag_preview(sdk_code_path, package_name) + readme_python_content = get_readme_python_content(str(Path(spec_folder) / readme_or_tsp)) + package_entry["isMultiapi"] = is_multiapi_package(readme_python_content) + result[package_name] = package_entry + else: + result[package_name]["path"].append(folder_name) + result[package_name][spec_word].append(readme_or_tsp) + + # Generate some necessary file for new service + init_new_service(package_name, folder_name) + format_samples_and_tests(sdk_code_path) + + # Update metadata + try: + update_servicemetadata( + sdk_folder, + data, + config, + folder_name, + package_name, + spec_folder, + readme_or_tsp, + ) + except Exception as e: + _LOGGER.error(f"fail to update meta: {str(e)}") + + # Setup package locally + check_call( + f"pip install --ignore-requires-python -e {sdk_code_path}", + shell=True, ) - except Exception as e: - _LOGGER.info(f"fail to update meta: {str(e)}") - - # Setup package locally - check_call( - f"pip install --ignore-requires-python -e {sdk_code_path}", - shell=True, - ) - # check whether multiapi package has only one api-version in per subfolder - # skip check for network for https://github.com/Azure/azure-sdk-for-python/issues/30556#issuecomment-1571341309 - if "azure-mgmt-network" not in sdk_code_path: - check_api_version_in_subfolder(sdk_code_path) + # check whether multiapi package has only one api-version in per subfolder + # skip check for network for https://github.com/Azure/azure-sdk-for-python/issues/30556#issuecomment-1571341309 + if "azure-mgmt-network" not in sdk_code_path: + check_api_version_in_subfolder(sdk_code_path) - # use multiapi combiner to combine multiapi package - if package_name in ("azure-mgmt-network"): - multiapi_combiner(sdk_code_path, package_name) - after_multiapi_combiner(sdk_code_path, package_name, folder_name) - result[package_name]["afterMultiapiCombiner"] = True - else: - result[package_name]["afterMultiapiCombiner"] = False + # use multiapi combiner to combine multiapi package + if package_name in ("azure-mgmt-network"): + multiapi_combiner(sdk_code_path, package_name) + after_multiapi_combiner(sdk_code_path, package_name, folder_name) + result[package_name]["afterMultiapiCombiner"] = True + else: + result[package_name]["afterMultiapiCombiner"] = False + except Exception as e: + _LOGGER.error(f"fail to setup package: {str(e)}") # remove duplicates - for value in result.values(): - value["path"] = list(set(value["path"])) - value[spec_word] = list(set(value[spec_word])) + try: + for value in result.values(): + value["path"] = list(set(value["path"])) + if value.get("typespecProject"): + value["typespecProject"] = list(set(value["typespecProject"])) + if value.get("readmeMd"): + value["readmeMd"] = list(set(value["readmeMd"])) + except Exception as e: + _LOGGER.error(f"fail to remove duplicates: {str(e)}") + + if len(result) == 0 and len(readme_and_tsp) > 1: + raise Exception("No package is generated, please check the log for details") with open(generate_output, "w") as writer: json.dump(result, writer) diff --git a/tools/azure-sdk-tools/packaging_tools/sdk_package.py b/tools/azure-sdk-tools/packaging_tools/sdk_package.py index f918a918ed314..db58836b61a8b 100644 --- a/tools/azure-sdk-tools/packaging_tools/sdk_package.py +++ b/tools/azure-sdk-tools/packaging_tools/sdk_package.py @@ -1,3 +1,4 @@ +import sys import argparse import json import logging @@ -7,6 +8,11 @@ from .package_utils import create_package, change_log_generate, extract_breaking_change +logging.basicConfig( + stream=sys.stdout, + format="%(asctime)s [%(levelname)s] %(message)s", + datefmt="%Y-%m-%d %X", +) _LOGGER = logging.getLogger(__name__) @@ -24,7 +30,13 @@ def main(generate_input, generate_output): last_version = ["first release"] if "azure-mgmt-" in package_name: try: - md_output = change_log_generate(package_name, last_version, package["tagIsStable"]) + md_output = change_log_generate( + package_name, + last_version, + package["tagIsStable"], + prefolder=prefolder, + is_multiapi=package["isMultiapi"], + ) except: md_output = "change log generation failed!!!" else: @@ -47,9 +59,19 @@ def main(generate_input, generate_output): if "azure-mgmt-" not in package_name: try: package_path = Path(sdk_folder, folder_name, package_name) - check_call(["python", "-m" "pip", "install", "-r", "../../../eng/apiview_reqs.txt", - "--index-url=https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi" - "/simple/"], cwd=package_path, timeout=300) + check_call( + [ + "python", + "-m" "pip", + "install", + "-r", + "../../../eng/apiview_reqs.txt", + "--index-url=https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi" + "/simple/", + ], + cwd=package_path, + timeout=300, + ) check_call(["apistubgen", "--pkg-path", "."], cwd=package_path, timeout=600) for file in os.listdir(package_path): if "_python.json" in file and package_name in file: diff --git a/tools/azure-sdk-tools/packaging_tools/swaggertosdk/autorest_tools.py b/tools/azure-sdk-tools/packaging_tools/swaggertosdk/autorest_tools.py index 0f08dfe734e3a..ff5a7beb02bc2 100644 --- a/tools/azure-sdk-tools/packaging_tools/swaggertosdk/autorest_tools.py +++ b/tools/azure-sdk-tools/packaging_tools/swaggertosdk/autorest_tools.py @@ -1,3 +1,4 @@ +import sys import json import logging import os.path @@ -5,6 +6,11 @@ import shutil import subprocess +logging.basicConfig( + stream=sys.stdout, + format="%(asctime)s [%(levelname)s] %(message)s", + datefmt="%Y-%m-%d %X", +) _LOGGER = logging.getLogger(__name__) @@ -145,7 +151,7 @@ def run_command(): if process.returncode: # print necessary error info which will be displayed in swagger pr for i in range(-min(len(output_buffer), 20), 0): - print(f"[Autorest] {output_buffer[i]}") + _LOGGER.error(output_buffer[i]) raise subprocess.CalledProcessError(process.returncode, cmd_line, output) return output